@arcgis/core 5.1.0-next.95 → 5.1.0-next.97

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 (138) hide show
  1. package/Graphic.d.ts +16 -1
  2. package/Graphic.js +1 -1
  3. package/applications/MapViewer/templateUtils.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/0175098da590a7109539.js +1 -0
  6. package/assets/esri/core/workers/chunks/0e6feed31340cf3c1966.js +1 -0
  7. package/assets/esri/core/workers/chunks/26f28406056ddc0e159c.js +1 -0
  8. package/assets/esri/core/workers/chunks/27d6ad4ca5ab8c9d62cd.js +1 -0
  9. package/assets/esri/core/workers/chunks/{23241e6093e245f9c774.js → 2b00229c238aae70b948.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{6b4c99c7648f37feec00.js → 308e1b0aea941958de44.js} +1 -1
  11. package/assets/esri/core/workers/chunks/34c11e7c8762fe0c19fb.js +1 -0
  12. package/assets/esri/core/workers/chunks/34e026549ba2822b8ebd.js +1 -0
  13. package/assets/esri/core/workers/chunks/4020f95d8131493f799e.js +1 -0
  14. package/assets/esri/core/workers/chunks/40bc7c65b708fcc80fab.js +1 -0
  15. package/assets/esri/core/workers/chunks/{8de61993e114f453579b.js → 40e887e87ae24ace27a5.js} +1 -1
  16. package/assets/esri/core/workers/chunks/4255ad7601c7a7621b71.js +1 -0
  17. package/assets/esri/core/workers/chunks/{5853925d2f7fb550bd2e.js → 44b5e4640fe547285e0c.js} +1 -1
  18. package/assets/esri/core/workers/chunks/58c15c42e6a618386a2f.js +1 -0
  19. package/assets/esri/core/workers/chunks/6d59a9cf533ebc590f70.js +1 -0
  20. package/assets/esri/core/workers/chunks/{0f527961805cd45c14e2.js → 708bd77e6d723e3f0aa8.js} +1 -1
  21. package/assets/esri/core/workers/chunks/7485d59d60d61737d662.js +1 -0
  22. package/assets/esri/core/workers/chunks/7dc9ff66e1eceadbae24.js +1 -0
  23. package/assets/esri/core/workers/chunks/9954928d6430e2bfdb1a.js +1 -0
  24. package/assets/esri/core/workers/chunks/9a29b7f9e6281ee40c37.js +1 -0
  25. package/assets/esri/core/workers/chunks/9f4a9b193485f88d4461.js +1 -0
  26. package/assets/esri/core/workers/chunks/a001e7e8a39f27284d87.js +1 -0
  27. package/assets/esri/core/workers/chunks/a93a058678c8c8996d54.js +1 -0
  28. package/assets/esri/core/workers/chunks/acb8cff06142f828fb78.js +1 -0
  29. package/assets/esri/core/workers/chunks/{bf73232057ebc1ecc0ad.js → b06cc59068d32baaaa87.js} +1 -1
  30. package/assets/esri/core/workers/chunks/b63cbf6c2c9ec1b02b9a.js +1 -0
  31. package/assets/esri/core/workers/chunks/b891d95b7858665cd6c1.js +1 -0
  32. package/assets/esri/core/workers/chunks/bfb417d72d0c90e116fe.js +1 -0
  33. package/assets/esri/core/workers/chunks/c0c693c2e0043ecba4a5.js +1 -0
  34. package/assets/esri/core/workers/chunks/{fa869bfe4366f7f49cca.js → e5f8c73349407c25956b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/e8a885b576da3ec145d3.js +1 -0
  36. package/assets/esri/core/workers/chunks/{bd721bbc7afc75d3bddb.js → eda51e512eff551ad858.js} +1 -1
  37. package/assets/esri/core/workers/chunks/f27397379c6c88bc6ef4.js +1 -0
  38. package/assets/esri/core/workers/chunks/f91a2c69a93295cf4de6.js +1 -0
  39. package/assets/esri/core/workers/chunks/fec3fffcf854a6226df4.js +1 -0
  40. package/chunks/GaussianSplat.glsl.js +9 -9
  41. package/chunks/NativeLine.glsl.js +4 -4
  42. package/config.js +1 -1
  43. package/kernel.js +1 -1
  44. package/layers/SceneLayer.d.ts +59 -32
  45. package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
  46. package/layers/graphics/sources/OGCFeatureSource.js +1 -1
  47. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  48. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  49. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  50. package/layers/mixins/ArcGISImageService.js +1 -1
  51. package/layers/raster/formats/Lerc.js +1 -1
  52. package/layers/raster/formats/RasterCodec.js +1 -1
  53. package/layers/scene/ModelFileInfo.d.ts +6 -2
  54. package/layers/scene/ModelInfo.d.ts +16 -7
  55. package/layers/scene/types.d.ts +2 -0
  56. package/layers/support/ExportImageServiceParameters.js +1 -1
  57. package/layers/support/capabilities.js +1 -1
  58. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  59. package/layers/types.d.ts +25 -2
  60. package/package.json +1 -1
  61. package/rest/knowledgeGraph/CreateReplicaResponse.d.ts +5 -4
  62. package/rest/knowledgeGraph/wasmInterface/wasmToReplicaFactories.js +1 -1
  63. package/rest/query/operations/queryUtils.js +1 -1
  64. package/rest/support/OutDistance.js +1 -1
  65. package/rest/support/Query.d.ts +39 -1
  66. package/rest/support/Query.js +1 -1
  67. package/support/revision.js +1 -1
  68. package/tables/AttributeTableTemplate.d.ts +1 -1
  69. package/tables/elements/AttributeTableGroupElement.d.ts +1 -1
  70. package/tables/support/tablesUtils.d.ts +2 -2
  71. package/tables/support/templateUtils.d.ts +136 -0
  72. package/tables/support/templateUtils.js +2 -0
  73. package/tables/support/types.d.ts +90 -0
  74. package/views/2d/engine/webgl/definitions.js +1 -1
  75. package/views/2d/engine/webgl/shaderGraph/techniques/animated/attributes.js +1 -1
  76. package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js +1 -1
  77. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  78. package/views/2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js +1 -1
  79. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  80. package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js +1 -1
  81. package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
  82. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  83. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  84. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  85. package/views/2d/layers/BaseLayerView2D.d.ts +2 -2
  86. package/views/2d/layers/BaseLayerViewGL2D.d.ts +2 -2
  87. package/views/3d/support/QualityProfile.js +1 -1
  88. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  89. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  90. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  91. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +6 -19
  92. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  93. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  94. package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
  95. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +40 -1
  96. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  97. package/widgets/BatchAttributeForm/ReactiveGraphic.js +1 -1
  98. package/widgets/BatchAttributeForm/expressions/types.d.ts +1 -0
  99. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +52 -1
  100. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  101. package/widgets/BatchAttributeForm/inputs/BatchFormInputs.d.ts +3 -0
  102. package/widgets/BatchAttributeForm/inputs/BatchFormInputs.js +1 -1
  103. package/widgets/BatchAttributeForm/inputs/EditableInput.d.ts +2 -0
  104. package/widgets/BatchAttributeForm/inputs/EditableInput.js +1 -1
  105. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  106. package/widgets/BatchAttributeForm/types.d.ts +79 -0
  107. package/widgets/Editor/Edits.js +1 -1
  108. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  109. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  110. package/assets/esri/core/workers/chunks/0ab1384282afc8731857.js +0 -1
  111. package/assets/esri/core/workers/chunks/130abc6a353e4d79a1b1.js +0 -1
  112. package/assets/esri/core/workers/chunks/1a68a249540fda9083a9.js +0 -1
  113. package/assets/esri/core/workers/chunks/1ae016e4f5e39c34a941.js +0 -1
  114. package/assets/esri/core/workers/chunks/2f6ba01ea8b8f193bea5.js +0 -1
  115. package/assets/esri/core/workers/chunks/31837f2f8859e2cf2efd.js +0 -1
  116. package/assets/esri/core/workers/chunks/41e811138c96d85fd3e8.js +0 -1
  117. package/assets/esri/core/workers/chunks/43b5cfb34b11c4124b51.js +0 -1
  118. package/assets/esri/core/workers/chunks/44b30dfce12824ee1f33.js +0 -1
  119. package/assets/esri/core/workers/chunks/4644e1b00fd4e628219d.js +0 -1
  120. package/assets/esri/core/workers/chunks/5648379d1ed4ca02eedd.js +0 -1
  121. package/assets/esri/core/workers/chunks/6666cd3bf1a3d175dc8c.js +0 -1
  122. package/assets/esri/core/workers/chunks/7536f0683e488159d8bd.js +0 -1
  123. package/assets/esri/core/workers/chunks/8bfe4841c83eb3abfbe8.js +0 -1
  124. package/assets/esri/core/workers/chunks/a12fd6a445f42326642f.js +0 -1
  125. package/assets/esri/core/workers/chunks/a8e2fbbfbdf1c3203d5e.js +0 -1
  126. package/assets/esri/core/workers/chunks/a94674826e5893c9d197.js +0 -1
  127. package/assets/esri/core/workers/chunks/b2504657d3ef8769005e.js +0 -1
  128. package/assets/esri/core/workers/chunks/b90db0829da3f96e4a19.js +0 -1
  129. package/assets/esri/core/workers/chunks/bd9dae2d5ec199f8e9ba.js +0 -1
  130. package/assets/esri/core/workers/chunks/be19d4a6fb9b1c923127.js +0 -1
  131. package/assets/esri/core/workers/chunks/c2589e5e0e0f81a378c2.js +0 -1
  132. package/assets/esri/core/workers/chunks/c33f1f722499a5c6fc11.js +0 -1
  133. package/assets/esri/core/workers/chunks/e03713dee3205c96d53f.js +0 -1
  134. package/assets/esri/core/workers/chunks/ead6e4d0a515c0913bee.js +0 -1
  135. package/assets/esri/core/workers/chunks/f95e3333a65a0c09fd1e.js +0 -1
  136. package/assets/esri/core/workers/chunks/ffb8fa77297578afef7c.js +0 -1
  137. package/tables/types.d.ts +0 -18
  138. package/widgets/FeatureTable/support/templateUtils.js +0 -2
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[6061,9599],{61691(e,t,s){s.d(t,{G:()=>r});class r{*[Symbol.iterator](){let e=this.next();for(;e;)yield e,e=this.next()}}},76061(e,t,s){s.d(t,{S:()=>i});var r=s(61691);class i extends r.G{constructor(e){super(),this.m_iGeom=-1,this.m_aGeoms=e?e.slice():[]}next(){if(this.m_iGeom<this.m_aGeoms.length-1){const e=this.m_aGeoms[++this.m_iGeom];return this.m_aGeoms[this.m_iGeom]=null,e}return null}tock(){return!1}getGeometryID(){return this.m_iGeom}getRank(){return 1}}},46140(e,t,s){s.d(t,{A:()=>i});var r=s(49186);class i{constructor(e,t,s=""){this.major=e,this.minor=t,this._context=s}lessThan(e,t){return this.major<e||e===this.major&&this.minor<t}greaterEqual(e,t){return!this.lessThan(e,t)}toString(){return`${this.major}.${this.minor}`}validate(e){if(this.major!==e.major){const t=this._context&&this._context+":",s=this._context&&this._context+" ";throw new r.A(t+"unsupported-version",`Required major ${s}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:e})}}clone(){return new i(this.major,this.minor,this._context)}static parse(e,t=""){const[s,n]=e.split("."),o=/^\s*\d+\s*$/;if(!s?.match||!o.test(s))throw new r.A((t&&t+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:e});if(!n?.match||!o.test(n))throw new r.A((t&&t+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:e});const a=parseInt(s,10),c=parseInt(n,10);return new i(a,c,t)}}},6797(e,t,s){s.d(t,{Ui:()=>d});var r=s(69622),i=s(7762),n=s(88620);const o=new Set(["esri.Color","esri.portal.Portal","esri.symbols.support.Symbol3DAnchorPosition2D","esri.symbols.support.Symbol3DAnchorPosition3D"]);function a(e){return e instanceof r.A}function c(e){return e instanceof i.A?Object.keys(e.items):a(e)?(0,n.oY)(e).keys():e?Object.keys(e):[]}function l(e,t){return e instanceof i.A?e.items[t]:e[t]}function u(e){return e?e.declaredClass:null}function h(e,t){const s=e.diff;if(s&&"function"==typeof s)return s(e,t);const r=c(e),i=c(t);if(0===r.length&&0===i.length)return;if(!r.length||!i.length||function(e,t){return!(!Array.isArray(e)||!Array.isArray(t))&&e.length!==t.length}(e,t))return{type:"complete",oldValue:e,newValue:t};const n=i.filter(e=>!r.includes(e)),d=r.filter(e=>!i.includes(e)),p=r.filter(s=>i.includes(s)&&l(e,s)!==l(t,s)).concat(n,d).sort(),f=u(e);if(f&&o.has(f)&&p.length)return{type:"complete",oldValue:e,newValue:t};let _;const m=a(e)&&a(t);for(const r of p){const i=l(e,r),n=l(t,r);let o;if((m||"function"!=typeof i&&"function"!=typeof n)&&i!==n&&(null!=i||null!=n)){if(s&&s[r]&&"function"==typeof s[r])o=s[r]?.(i,n);else if(i instanceof Date&&n instanceof Date){if(i.getTime()===n.getTime())continue;o={type:"complete",oldValue:i,newValue:n}}else o="object"==typeof i&&"object"==typeof n&&u(i)===u(n)?h(i,n):{type:"complete",oldValue:i,newValue:n};null!=o&&(null!=_?_.diff[r]=o:_={type:"partial",diff:{[r]:o}})}}return _}function d(e,t){if("function"!=typeof e&&"function"!=typeof t&&(null!=e||null!=t))return null==e||null==t||"object"==typeof e&&"object"==typeof t&&u(e)!==u(t)?{type:"complete",oldValue:e,newValue:t}:h(e,t)}},67482(e,t,s){function r(e){return null!=a(e)||null!=o(e)}function i(e){return c.test(e)}function n(e){return a(e)??o(e)}function o(e){const t=new Date(e);return function(e,t){if(Number.isNaN(e.getTime()))return!1;let s=!0;if(u&&/\d+\W*$/.test(t)){const e=t.match(/[a-zA-Z]{2,}/);if(e){let t=!1,r=0;for(;!t&&r<=e.length;)t=!l.test(e[r]),r++;s=!t}}return s}(t,e)?Number.isNaN(t.getTime())?null:t.getTime()-6e4*t.getTimezoneOffset():null}function a(e){const t=c.exec(e);if(!t?.groups)return null;const s=t.groups,r=+s.year,i=+s.month-1,n=+s.day,o=+(s.hours??"0"),a=+(s.minutes??"0"),l=+(s.seconds??"0");if(o>23)return null;if(a>59)return null;if(l>59)return null;const u=s.ms??"0",h=u?+u.padEnd(3,"0").slice(0,3):0;let d;if(s.isUTC||!s.offsetSign)d=Date.UTC(r,i,n,o,a,l,h);else{const e=+s.offsetHours,t=+s.offsetMinutes;d=6e4*("+"===s.offsetSign?-1:1)*(60*e+t)+Date.UTC(r,i,n,o,a,l,h)}return Number.isNaN(d)?null:d}s.d(t,{Br:()=>i,Cq:()=>r,_U:()=>n});const c=/^(?:(?<year>-?\d{4,})-(?<month>\d{2})-(?<day>\d{2}))(?:T(?<hours>\d{2}):(?<minutes>\d{2}):(?<seconds>\d{2})(?:\.(?<ms>\d+))?)?(?:(?<isUTC>Z)|(?:(?<offsetSign>\+|-)(?<offsetHours>\d{2}):(?<offsetMinutes>\d{2})))?$/,l=/^((jan(uary)?)|(feb(ruary)?)|(mar(ch)?)|(apr(il)?)|(may)|(jun(e)?)|(jul(y)?)|(aug(ust)?)|(sep(tember)?)|(oct(ober)?)|(nov(ember)?)|(dec(ember)?)|(am)|(pm)|(gmt)|(utc))$/i,u=!Number.isNaN(new Date("technology 10").getTime())},90629(e,t,s){s.d(t,{Lz:()=>i,PN:()=>n,cr:()=>o,gs:()=>c,r_:()=>l,tc:()=>a});const r=/^-?(\d+(\.\d+)?)\s*((px)|(pt))?$/i;function i(e){return e?e/72*96:0}function n(e){return e?72*e/96:0}function o(e){if("string"==typeof e){const t=e.match(r);if(t){const s=Number(t[1]),r=t[3]&&t[3].toLowerCase(),i=e.startsWith("-"),o="px"===r?n(s):s;return i?-o:o}return console.warn("screenUtils.toPt: input not recognized!"),null}return e}function a(e=0,t=0){return{x:e,y:t}}function c(e=0,t=0){return[e,t]}function l(e=0,t=0,s=0){return[e,t,s]}},15585(e,t,s){s.d(t,{If:()=>p,O5:()=>y,O9:()=>_,QT:()=>m,l3:()=>f});var r=s(5482),i=s(2741),n=s(49186),o=s(44208),a=s(34727);let c=null,l=null,u=null,h=null;const d=(new Float32Array(0),new Uint32Array(0),new Uint32Array(0),new Uint32Array(0),{vertices:new Float64Array(0),indices:new Uint32Array(0),outlineIndices:new Uint32Array(0),outlineRingLengths:new Uint32Array(0),vertexCount:0,indexCount:0,outlineIndexCount:0,outlineRingCount:0});async function p(){return c??=async function(){const e=await s.e(2997).then(s.bind(s,42997)),t=await e.default({locateFile:e=>(0,i.s)(`esri/core/libs/libtess/${e}`)});u=t}(),c}async function f(){return l??=async function(){const e=await s.e(9134).then(s.bind(s,99134)),t=await e.default({locateFile:e=>(0,i.s)(`esri/core/libs/libtess/${e}`)});h=t}(),l}function _(){return null!==h}function m(e,t,s=2){const i={stack:[],error:void 0,hasError:!1};try{const a=u;if(!a)throw new n.A("libtess:not-loaded","libtessF32 not loaded");const c=(0,r.mS)(i,b.from(a,e),!1),l=(0,r.mS)(i,S.from(a,t),!1),h=e.length/s*4,d=(0,r.mS)(i,new b(a,h*s),!1),p=a.triangulate(c.ptr,l.ptr,l.size,s,d.ptr,h);if((0,o.A)("esri-tessellation-debug")){const e=a.getError();0!==e&&console.warn("libtess:triangulation",I(e))}return{buffer:d.slice(0,p*s),vertexCount:p}}catch(e){i.error=e,i.hasError=!0}finally{(0,r.hk)(i)}}function y(e,t,s=2,i=!0){const c={stack:[],error:void 0,hasError:!1};try{const l=h;if(!l)throw new n.A("libtess:not-loaded","libtessF64 not loaded");const u=(0,r.mS)(c,v.from(l,e),!1),p=(0,r.mS)(c,S.from(l,t),!1),f=(0,r.mS)(c,new S(l,1),!1),_=(0,r.mS)(c,new S(l,1),!1),m=(0,r.mS)(c,new S(l,1),!1),y=(0,r.mS)(c,new S(l,1),!1),{maxVertexCount:g,maxIndexCount:x,maxOutlineIndexCount:b,maxOutlineRingCount:k}=function(e,t){const s=e.reduce((e,t)=>e+t,0),r=e.length,i=Math.max(0,e.length-1),n=Math.max(0,s+2*i-2),o=Math.max(0,Math.ceil(2*s)),c=Math.max(0,Math.ceil(3*n*2)),l=(0,a.mP)(c,3),u=s>0?Math.max(2,Math.ceil(.25*s)):0,h=s>0?Math.max(1,Math.ceil(u/3)):0;return{maxVertexCount:o,maxIndexCount:l,maxOutlineIndexCount:t?Math.max(0,s+r+u):0,maxOutlineRingCount:t?Math.max(0,r+h):0}}(t,i);let T=0,A=0,M=0,F=0,C=0;{const e={stack:[],error:void 0,hasError:!1};try{const t=(0,r.mS)(e,new v(l,g*s),!1),n=(0,r.mS)(e,new S(l,x),!1),o=(0,r.mS)(e,i?new S(l,b):null,!1),a=(0,r.mS)(e,i?new S(l,k):null,!1);if(l.triangulateIndexed(u.ptr,p.ptr,p.size,s,t.ptr,g,s,n.ptr,x,f.ptr,_.ptr,o?.ptr??0,b,a?.ptr??0,k,m.ptr,y.ptr),C=l.getError(),T=w(l)[f.ptr/Int32Array.BYTES_PER_ELEMENT],A=w(l)[_.ptr/Int32Array.BYTES_PER_ELEMENT],M=w(l)[m.ptr/Int32Array.BYTES_PER_ELEMENT],F=w(l)[y.ptr/Int32Array.BYTES_PER_ELEMENT],0===C){const e=t.slice(0,T*s);return{vertices:e,indices:n.slice(0,A),outlineIndices:i&&o?o.slice(0,M):d.outlineIndices,outlineRingLengths:i&&a?a.slice(0,F):d.outlineRingLengths,vertexCount:T,indexCount:A,outlineIndexCount:i?M:0,outlineRingCount:i?F:0}}}catch(t){e.error=t,e.hasError=!0}finally{(0,r.hk)(e)}}if(100903!==C)return(0,o.A)("esri-tessellation-debug")&&console.warn("libtess:triangulation",I(C)),d;const P=(0,r.mS)(c,new v(l,T*s),!1),E=(0,r.mS)(c,new S(l,A),!1),R=(0,r.mS)(c,i?new S(l,M):null,!1),O=(0,r.mS)(c,i?new S(l,F):null,!1);if(l.triangulateIndexed(u.ptr,p.ptr,p.size,s,P.ptr,T,s,E.ptr,A,f.ptr,_.ptr,R?.ptr??0,i?M:0,O?.ptr??0,i?F:0,m.ptr,y.ptr),C=l.getError(),0!==C)return(0,o.A)("esri-tessellation-debug")&&console.warn("libtess:triangulation",I(C)),d;const z=w(l)[f.ptr/Int32Array.BYTES_PER_ELEMENT],L=w(l)[_.ptr/Int32Array.BYTES_PER_ELEMENT],D=w(l)[m.ptr/Int32Array.BYTES_PER_ELEMENT],q=w(l)[y.ptr/Int32Array.BYTES_PER_ELEMENT],N=P.slice(0,z*s);return{vertices:N,indices:E.slice(0,L),outlineIndices:i&&R?R.slice(0,D):d.outlineIndices,outlineRingLengths:i&&O?O.slice(0,q):d.outlineRingLengths,vertexCount:z,indexCount:L,outlineIndexCount:i?D:0,outlineRingCount:i?q:0}}catch(e){c.error=e,c.hasError=!0}finally{(0,r.hk)(c)}}function g(e){return e.HEAPF64}function x(e){return e.HEAPF32}function w(e){return e.HEAP32}class b{static from(e,t){const s=new b(e,t.length);return s.set(t),s}constructor(e,t){this._libtess=e,this.size=t,this.ptr=e.allocateCoordinateArray(t)}destroy(){this._libtess.destroyCoordinateArray(this.ptr)}[Symbol.dispose](){this.destroy()}get bytesPerCoordinate(){return Float32Array.BYTES_PER_ELEMENT}set(e){x(this._libtess).set(e,this.ptr/this.bytesPerCoordinate)}slice(e,t){const s=this.ptr/this.bytesPerCoordinate;return x(this._libtess).slice(s+e,s+t)}}class v{static from(e,t){const s=new v(e,t.length);return s.set(t),s}constructor(e,t){this._libtess=e,this.size=t,this.ptr=e.allocateCoordinateArray(t)}destroy(){this._libtess.destroyCoordinateArray(this.ptr)}[Symbol.dispose](){this.destroy()}get bytesPerCoordinate(){return Float64Array.BYTES_PER_ELEMENT}set(e){g(this._libtess).set(e,this.ptr/this.bytesPerCoordinate)}slice(e,t){const s=this.ptr/this.bytesPerCoordinate;return g(this._libtess).slice(s+e,s+t)}}class S{static from(e,t){const s=new S(e,t.length);return s.set(t),s}constructor(e,t){this._libtess=e,this.size=t,this.ptr=e.allocateLengthsArray(t)}destroy(){this._libtess.destroyLengthsArray(this.ptr)}[Symbol.dispose](){this.destroy()}get bytesPerCoordinate(){return Int32Array.BYTES_PER_ELEMENT}set(e){w(this._libtess).set(e,this.ptr/this.bytesPerCoordinate)}slice(e,t){const s=this.ptr/this.bytesPerCoordinate;return function(e){const t=w(e);return new Uint32Array(t.buffer,t.byteOffset,t.length)}(this._libtess).slice(s+e,s+t)}}function I(e){switch(e){case 100903:return"Insufficient output buffer";case 100902:return"Out of memory";case 100151:return"Missing begin polygon";case 100152:return"Missing begin contour";case 100153:return"Missing end polygon";case 100154:return"Missing end countour";case 100155:return"Coordinates too large";case 100156:return"Missing combine callback";default:return`Unknown: ${e}`}}},77085(e,t,s){s.d(t,{Hh:()=>a,fz:()=>u,g7:()=>c,s1:()=>o,zo:()=>l});var r=s(76061),i=s(83290);let n;function o(){return!!n&&(0,i.i)()}async function a(){if(!o()){const[e,t]=await Promise.all([Promise.all([s.e(6042),s.e(1878),s.e(8885),s.e(5756),s.e(1088)]).then(s.bind(s,31088)),Promise.all([s.e(6042),s.e(1878),s.e(8885),s.e(5756)]).then(s.bind(s,15756)).then(e=>e.aP).then(({injectPe:e})=>e),(0,i.l)()]);n=new e.OperatorGeodeticDensifyByLength,t(i.p)}}function c(e,t,s,r){return n.execute(e,t,s,r,null)}function l(e,t,s,i){const o=n.executeMany(new r.S(e),t,s,i,null);return Array.from(o)}function u(){return n.supportsCurves()}},5808(e,t,s){s.d(t,{O:()=>r});const r={geodesic:0,loxodrome:1,"great-elliptic":2,"normal-section":3,"shape-preserving":4}},89056(e,t,s){s.d(t,{b3:()=>h,jZ:()=>u});var r=s(12195),i=s(19419),n=s(537),o=s(95108),a=s(60408),c=s(80754),l=s(21325);function u(e){return d(e,!0)}function h(e){return d(e,!1)}function d(e,t){if(null==e)return null;const s=e.spatialReference,i=(0,l.Vp)(s),o=(0,r.W)(e)?e.toJSON():e;if(!i)return o;const u=(0,l.K8)(s)?102100:4326,h=c.j7[u].maxX,d=c.j7[u].minX;if((0,a.fT)(o))return f(o,h,d);if((0,a.U9)(o))return o.points=o.points.map(e=>f(e,h,d)),o;if((0,a.ZC)(o))return p(o,i);if((0,a.Bi)(o)||(0,a.Rg)(o)){const e=(0,n.Rg)(w,o),s={xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3]},r=(0,c.kd)(s.xmin,d)*(2*h),i=0===r?o:(0,c.kS)(o,r);return s.xmin+=r,s.xmax+=r,s.xmax>h?g(i,h,t):s.xmin<d?g(i,d,t):i}return o}function p(e,t){if(!t)return e;const s=function(e,t){const s=[],{ymin:r,ymax:i,xmin:n,xmax:o}=e,a=e.xmax-e.xmin,[c,l]=t.valid,{x:u,frameId:h}=_(e.xmin,t),{x:d,frameId:p}=_(e.xmax,t),f=u===d&&a>0;if(a>2*l){const e={xmin:n<o?u:d,ymin:r,xmax:l,ymax:i},t={xmin:c,ymin:r,xmax:n<o?d:u,ymax:i},a={xmin:0,ymin:r,xmax:l,ymax:i},f={xmin:c,ymin:r,xmax:0,ymax:i},_=[],y=[];m(e,a)&&_.push(h),m(e,f)&&y.push(h),m(t,a)&&_.push(p),m(t,f)&&y.push(p);for(let e=h+1;e<p;e++)_.push(e),y.push(e);s.push(new x(e,[h]),new x(t,[p]),new x(a,_),new x(f,y))}else u>d||f?s.push(new x({xmin:u,ymin:r,xmax:l,ymax:i},[h]),new x({xmin:c,ymin:r,xmax:d,ymax:i},[p])):s.push(new x({xmin:u,ymin:r,xmax:d,ymax:i},[h]));return s}(e,t).map(e=>e.extent);return s.length<2?s[0]||e:s.length>2?(e.xmin=t.valid[0],e.xmax=t.valid[1],e):{rings:s.map(e=>[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]])}}function f(e,t,s){if(Array.isArray(e)){const r=e[0];if(r>t){const s=(0,c.kd)(r,t);e[0]=r+s*(-2*t)}else if(r<s){const t=(0,c.kd)(r,s);e[0]=r+t*(-2*s)}}else{const r=e.x;if(r>t){const s=(0,c.kd)(r,t);e.x+=s*(-2*t)}else if(r<s){const t=(0,c.kd)(r,s);e.x+=t*(-2*s)}}return e}function _(e,t){const[s,r]=t.valid,i=2*r;let n,o=0;return e>r?(n=Math.ceil(Math.abs(e-r)/i),e-=n*i,o=n):e<s&&(n=Math.ceil(Math.abs(e-s)/i),e+=n*i,o=-n),{x:e,frameId:o}}function m(e,t){const{xmin:s,ymin:r,xmax:i,ymax:n}=t;return y(e,s,r)&&y(e,s,n)&&y(e,i,n)&&y(e,i,r)}function y(e,t,s){return t>=e.xmin&&t<=e.xmax&&s>=e.ymin&&s<=e.ymax}function g(e,t,s=!0){const r=!(0,a.Rg)(e);if(r&&(0,o.m3)(e),s)return(new b).cut(e,t);const i=r?e.rings:e.paths,n=r?4:2,c=i.length,l=-2*t;for(let e=0;e<c;e++){const t=i[e];if(t&&t.length>=n){const e=[];for(const[s,...r]of t)e.push([s+l,...r]);i.push(e)}}return r?e.rings=i:e.paths=i,e}class x{constructor(e,t){this.extent=e,this.frameIds=t}}const w=(0,i.vt)();class b{constructor(){this._linesIn=[],this._linesOut=[]}cut(e,t){let s;if(this._xCut=t,e.rings)this._closed=!0,s=e.rings,this._minPts=4;else{if(!e.paths)return null;this._closed=!1,s=e.paths,this._minPts=2}for(const e of s){if(!e||e.length<this._minPts)continue;let t=!0;for(const s of e)t?(this.moveTo(s),t=!1):this.lineTo(s);this._closed&&this.close()}this._pushLineIn(),this._pushLineOut(),s=[];for(const e of this._linesIn)e&&e.length>=this._minPts&&s.push(e);const r=-2*this._xCut;for(const e of this._linesOut)if(e&&e.length>=this._minPts){for(const t of e)t[0]+=r;s.push(e)}return this._closed?e.rings=s:e.paths=s,e}moveTo(e){this._pushLineIn(),this._pushLineOut(),this._prevSide=this._side(e[0]),this._moveTo(e[0],e[1],this._prevSide),this._prevPt=e,this._firstPt=e}lineTo(e){const t=this._side(e[0]);if(t*this._prevSide===-1){const s=this._intersect(this._prevPt,e);this._lineTo(this._xCut,s,0),this._prevSide=0,this._lineTo(e[0],e[1],t)}else this._lineTo(e[0],e[1],t);this._prevSide=t,this._prevPt=e}close(){const e=this._firstPt,t=this._prevPt;e[0]===t[0]&&e[1]===t[1]||this.lineTo(e),this._checkClosingPt(this._lineIn),this._checkClosingPt(this._lineOut)}_moveTo(e,t,s){this._closed?(this._lineIn.push([s<=0?e:this._xCut,t]),this._lineOut.push([s>=0?e:this._xCut,t])):(s<=0&&this._lineIn.push([e,t]),s>=0&&this._lineOut.push([e,t]))}_lineTo(e,t,s){this._closed?(v(this._lineIn,s<=0?e:this._xCut,t),v(this._lineOut,s>=0?e:this._xCut,t)):s<0?(0===this._prevSide&&this._pushLineOut(),this._lineIn.push([e,t])):s>0?(0===this._prevSide&&this._pushLineIn(),this._lineOut.push([e,t])):this._prevSide<0?(this._lineIn.push([e,t]),this._lineOut.push([e,t])):this._prevSide>0&&(this._lineOut.push([e,t]),this._lineIn.push([e,t]))}_checkClosingPt(e){const t=e.length;t>3&&e[0][0]===this._xCut&&e[t-2][0]===this._xCut&&e[1][0]===this._xCut&&(e[0][1]=e[t-2][1],e.pop())}_side(e){return e<this._xCut?-1:e>this._xCut?1:0}_intersect(e,t){const s=(this._xCut-e[0])/(t[0]-e[0]);return e[1]+s*(t[1]-e[1])}_pushLineIn(){this._lineIn&&this._lineIn.length>=this._minPts&&this._linesIn.push(this._lineIn),this._lineIn=[]}_pushLineOut(){this._lineOut&&this._lineOut.length>=this._minPts&&this._linesOut.push(this._lineOut),this._lineOut=[]}}function v(e,t,s){const r=e.length;r>1&&e[r-1][0]===t&&e[r-2][0]===t?e[r-1][1]=s:e.push([t,s])}},37730(e,t,s){s.d(t,{T:()=>i});var r=s(43334);const i={getObjectId:e=>e.objectId,getAttributes:e=>e.attributes,getAttribute:(e,t)=>e.attributes[t],cloneWithGeometry:(e,t,s)=>new r.Om(t,e.attributes,null,e.objectId,e.displayId,e.distance,e.vertexCount),getGeometry:e=>e.geometry,getCentroid:(e,t)=>e.ensureCentroid(t)}},60986(e,t,s){s.r(t),s.d(t,{createConnection:()=>M});var r=s(11254),i=s(49186),n=s(31464),o=s(9916),a=s(5482),c=s(65529),l=s(91429);let u=class extends c.nJ{destroy(){this.emit("destroy")}get connectionError(){return this.errorString?new i.A("stream-connection",this.errorString):null}onFeature(e){this.emit("data-received",e)}onMessage(e){this.emit("message-received",e)}};(0,a.Cg)([(0,l.MZ)({readOnly:!0})],u.prototype,"connectionError",null),u=(0,a.Cg)([(0,l.$K)("esri.layers.support.StreamConnection")],u);class h extends u{constructor(e,t){super(),this._config=e,this._outSpatialReference=t,this.connectionStatus="connected",this.errorString=null,this._isPolling=!1,this._lastIngestedAt=null,this._pollTimer=null,this._pollRecentData=async()=>{if(!this.destroyed&&!this._isPolling){this._isPolling=!0;try{const e=await this._queryChanges(this._lastIngestedAt);if(this.destroyed)return;this._handleResult(e)}catch(e){this.errorString=e instanceof Error?e.message:"Failed to fetch"}finally{this._isPolling=!1}}},this._initialize()}destroy(){super.destroy(),this._pollTimer&&(clearInterval(this._pollTimer),this._pollTimer=null)}sendMessageToSocket(e){throw new i.A("kusto:unsupported","sendMessageToSocket not supported for Kusto connections")}sendMessageToClient(e){throw new i.A("kusto:unsupported","sendMessageToClient not supported for Kusto connections")}updateCustomParameters(e){throw new i.A("kusto:unsupported","updateCustomParameters not supported for Kusto connections")}async _initialize(){await(0,n.Nk)(this._config.sourceSpatialReference,this._outSpatialReference);try{const e=await this._queryInitial();this._handleResult(e),this._pollTimer=setInterval(this._pollRecentData,6e4*this._config.refreshInterval)}catch{throw new i.A("kusto:connection","Failed to query KQL database")}}async _queryInitial(){const{trackIdField:e}=this._config,t=d(await this._executeQuery(`${(0,o.xw)(this._config.table)} | extend IngestedAt = ingestion_time() | summarize arg_max(IngestedAt, *) by ${(0,o.xw)(e)}`));if(!t)throw new i.A("kusto:connection","Unable to find primaryTable");return{ingestedAt:p(t),table:t}}async _queryChanges(e=null){const t=e??"1970-01-01T00:00:00Z",s=d(await this._executeQuery(`${(0,o.xw)(this._config.table)} | extend IngestedAt = ingestion_time() | where IngestedAt > todatetime('${(0,o.iD)(t)}') | order by IngestedAt asc`));if(!s)throw new i.A("kusto:connection","Unable to find primaryTable");return{ingestedAt:p(s),table:s}}async _executeQuery(e){const t=this._config.database,s=t.properties.queryServiceUri,{data:i}=await(0,r.A)(`${s}/v2/rest/query`,{responseType:"json",method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({db:t.displayName,csl:e})});return i}_handleResult(e){this._lastIngestedAt=e.ingestedAt;const t=this._createFeatures(e.table);if(null!=t){this.onMessage(t);for(const e of t)this.onFeature(e)}}_createFeatures(e){if(null==e||0===e.Rows.length)return null;const{xField:t,yField:s}=this._config.geometryEncoding,r=e.Columns.findIndex(e=>e.ColumnName===t),i=e.Columns.findIndex(e=>e.ColumnName===s);return e.Rows.map(t=>this._createFeature(e.Columns,r,i,t))}_createFeature(e,t,s,r){const{xField:i,yField:o}=this._config.geometryEncoding,a={};for(let t=0;t<e.length;t++){const s=e[t],n=r[t]??null;s.ColumnName!==o&&s.ColumnName!==i&&(a[s.ColumnName]=n)}let c=null;const l=r[t],u=r[s];return null!=u&&null!=l&&(c=(0,n.Cv)({x:l,y:u},this._config.sourceSpatialReference,this._outSpatialReference)),{attributes:a,geometry:c}}}function d(e){return e.find(e=>"DataTable"===e.FrameType&&"PrimaryResult"===e.TableKind)??null}function p(e){const t=e.Columns.findIndex(e=>"IngestedAt"===e.ColumnName);if(t<0)return null;let s=null;for(const r of e.Rows){const e=r[t];"string"==typeof e&&(null==s||e>s)&&(s=e)}return s}var f=s(53966),_=s(84952),m=s(16930),y=s(65864),g=s(17676),x=s(62815);function w(e,t){if(null==e&&null==t)return null;const s={};return null!=t&&(s.geometry=t),null!=e&&(s.where=e),s}let b=class extends u{constructor(e,t){super({}),this._outSpatialReference=t,this._outstandingMessages=[],this.errorString=null;const{geometryType:s,sourceSpatialReference:r}=e;this._config=e,this._featureZScaler=(0,x.N)(s,r,this._outSpatialReference),this._open()}normalizeCtorArgs(){return{}}async _open(){await this._tryCreateWebSocket(),this.destroyed||await this._handshake()}destroy(){super.destroy(),null!=this._websocket&&(this._websocket.onopen=null,this._websocket.onclose=null,this._websocket.onerror=null,this._websocket.onmessage=null,this._websocket.close()),this._websocket=null}get connectionStatus(){if(null==this._websocket)return"disconnected";switch(this._websocket.readyState){case 0:case 1:return"connected";case 2:case 3:return"disconnected"}}sendMessageToSocket(e){null!=this._websocket?this._websocket.send(JSON.stringify(e)):this._outstandingMessages.push(e)}sendMessageToClient(e){this._onMessage(e)}updateCustomParameters(e){this._config.customParameters=e,null!=this._websocket&&this._websocket.close()}async _tryCreateWebSocket(e=this._config.url.path,t=1e3,s=0){try{if(this.destroyed)return;const t=(0,_.a6)(e,this._config.customParameters??{});this._websocket=await this._createWebSocket(t),this.notifyChange("connectionStatus")}catch(r){const n=t/1e3;return this._config.maxReconnectionAttempts&&s>=this._config.maxReconnectionAttempts?(f.A.getLogger(this).error(new i.A("websocket-connection","Exceeded maxReconnectionAttempts attempts. No further attempts will be made")),void this.destroy()):(f.A.getLogger(this).error(new i.A("websocket-connection",`Failed to connect. Attempting to reconnect in ${n}s`,r)),await(0,g.Pl)(t),this._tryCreateWebSocket(e,Math.min(1.5*t,1e3*this._config.maxReconnectionInterval),s+1))}}_setWebSocketJSONParseHandler(e){e.onmessage=e=>{try{const t=JSON.parse(e.data);this._onMessage(t)}catch(e){return void f.A.getLogger(this).error(new i.A("websocket-connection","Failed to parse message, invalid JSON",{error:e}))}}}_createWebSocket(e){return new Promise((t,s)=>{const r=new WebSocket(e);r.onopen=()=>{if(r.onopen=null,this.destroyed)return r.onclose=null,void r.close();r.onclose=e=>this._onClose(e),r.onerror=e=>this._onError(e),this._setWebSocketJSONParseHandler(r),t(r)},r.onclose=e=>{r.onopen=r.onclose=null,s(e)}})}async _handshake(e=1e4){const t=this._websocket;if(null==t)return;const s=Promise.withResolvers(),r=t.onmessage,n=w(this._config.definitionExpression,this._config.geometryDefinition),{outFields:o}=this._config,a=setTimeout(()=>s.reject(),e),c=()=>{clearTimeout(a),s.reject()};return t.onmessage=e=>{let l=null;try{l=JSON.parse(e.data)}catch(e){}l&&"object"==typeof l||(f.A.getLogger(this).error(new i.A("websocket-connection","Protocol violation. Handshake failed - malformed message",e.data)),c(),this.destroy()),l.spatialReference?.wkid!==this._outSpatialReference?.wkid&&(f.A.getLogger(this).error(new i.A("websocket-connection",`Protocol violation. Handshake failed - expected wkid of ${this._outSpatialReference.wkid}`,e.data)),c(),this.destroy()),"json"!==l.format&&(f.A.getLogger(this).error(new i.A("websocket-connection","Protocol violation. Handshake failed - format is not set",e.data)),c(),this.destroy()),n&&l.filter!==n&&f.A.getLogger(this).error(new i.A("websocket-connection","Tried to set filter, but server doesn't support it")),o&&l.outFields!==o&&f.A.getLogger(this).error(new i.A("websocket-connection","Tried to set outFields, but server doesn't support it")),t.onmessage=r;for(const e of this._outstandingMessages)t.send(JSON.stringify(e));this._outstandingMessages=[],clearTimeout(a),s.resolve()},t.send(JSON.stringify({filter:n,outFields:o,format:"json",spatialReference:{wkid:this._outSpatialReference.wkid}})),s.promise}_onMessage(e){if(this.onMessage(e),"type"in e)switch(e.type){case"features":case"featureResult":for(const t of e.features)null!=this._featureZScaler&&this._featureZScaler(t.geometry),this.onFeature(t)}}_onError(e){const t="Encountered an error over WebSocket connection";this._set("errorString",t),f.A.getLogger(this).error("websocket-connection",t)}_onClose(e){this._websocket=null,this.notifyChange("connectionStatus"),1e3!==e.code&&f.A.getLogger(this).error("websocket-connection",`WebSocket closed unexpectedly with error code ${e.code}`),this.destroyed||this._open()}};(0,a.Cg)([(0,l.MZ)()],b.prototype,"connectionStatus",null),(0,a.Cg)([(0,l.MZ)()],b.prototype,"errorString",void 0),b=(0,a.Cg)([(0,l.$K)("esri.layers.graphics.sources.connections.WebSocketConnection")],b);var v=s(80893),S=s(61956);const I={maxQueryDepth:5,maxRecordCountFactor:3};let k=class extends b{constructor(e,t){super({...I,...e},t),this._buddyServicesQuery=null,this._relatedFeatures=null}async _open(){const e=await this._fetchServiceDefinition(this._config.url);e.timeInfo.trackIdField||f.A.getLogger(this).warn("GeoEvent service was configured without a TrackIdField. This may result in certain functionality being disabled. The purgeOptions.maxObservations property will have no effect.");const t=this._fetchWebSocketUrl(e.streamUrls,this._outSpatialReference);this._buddyServicesQuery||(this._buddyServicesQuery=this._queryBuddyServices()),await this._buddyServicesQuery,await this._tryCreateWebSocket(t);const s=w(this._config.definitionExpression,this._config.geometryDefinition),{outFields:r}=this._config;this.destroyed||this._setFilter(s,r)}_onMessage(e){if("attributes"in e){let t;try{t=this._enrich(e),null!=this._featureZScaler&&this._featureZScaler(t.geometry)}catch(e){return void f.A.getLogger(this).error(new i.A("geoevent-connection","Failed to parse message",e))}this.onFeature(t)}else this.onMessage(e)}async _fetchServiceDefinition(e){const t={f:"json",...this._config.customParameters},s=(0,r.A)(e.path,{query:t,responseType:"json"}),i=(await s).data;return this._serviceDefinition=i,i}_fetchWebSocketUrl(e,t){const s=e[0],{urls:r,token:i}=s,n=this._inferWebSocketBaseUrl(r);return(0,_.a6)(`${n}/subscribe`,{outSR:""+t.wkid,token:i})}_inferWebSocketBaseUrl(e){if(1===e.length)return e[0];for(const t of e)if(t.includes("wss"))return t;return f.A.getLogger(this).error(new i.A("geoevent-connection","Unable to infer WebSocket url",e)),null}async _setFilter(e,t){const s=this._websocket;if(null==s||null==e&&null==t)return;const r=JSON.stringify({filter:this._serializeFilter(e,t)});let n=!1;const o=Promise.withResolvers();return s.onmessage=e=>{const t=JSON.parse(e.data);t.filter&&(t.error&&(f.A.getLogger(this).error(new i.A("geoevent-connection","Failed to set service filter",t.error)),this._set("errorString",`Could not set service filter - ${t.error}`),o.reject(t.error)),this._setWebSocketJSONParseHandler(s),n=!0,o.resolve())},s.send(r),setTimeout(()=>{n||(this.destroyed||this._websocket!==s||f.A.getLogger(this).error(new i.A("geoevent-connection","Server timed out when setting filter")),o.reject())},1e4),o.promise}_serializeFilter(e,t){const s={};if(null==e&&null==t)return s;if(e?.geometry)try{const t=(0,y.rS)(e.geometry);if("extent"!==t.type)throw new i.A("geoevent-connection",`Expected extent but found type ${t.type}`);s.geometry=JSON.stringify(t.shiftCentralMeridian())}catch(e){f.A.getLogger(this).error(new i.A("geoevent-connection","Encountered an error when setting connection geometryDefinition",e))}return e?.where&&"1 = 1"!==e.where&&"1=1"!==e.where&&(s.where=e.where),null!=t&&(s.outFields=t.join(",")),s}_enrich(e){if(!this._relatedFeatures)return e;const t=this._serviceDefinition.relatedFeatures.joinField,s=e.attributes[t],r=this._relatedFeatures.get(s);if(!r)return f.A.getLogger(this).warn("geoevent-connection","Feature join failed. Is the join field configured correctly?",e),e;const{attributes:n,geometry:o}=r;for(const t in n)e.attributes[t]=n[t];return o&&(e.geometry=o),e.geometry||e.centroid||f.A.getLogger(this).error(new i.A("geoevent-connection","Found malformed feature - no geometry found",e)),e}async _queryBuddyServices(){try{const{relatedFeatures:e,keepLatestArchive:t}=this._serviceDefinition,s=this._queryRelatedFeatures(e),r=this._queryArchive(t);await s;const i=await r;if(!i)return;for(const e of i.features)this.onFeature(this._enrich(e))}catch(e){f.A.getLogger(this).error(new i.A("geoevent-connection","Encountered an error when querying buddy services",{error:e}))}}async _queryRelatedFeatures(e){if(!e)return;const t=await this._queryBuddy(e.featuresUrl);this._addRelatedFeatures(t)}async _queryArchive(e){if(e)return this._queryBuddy(e.featuresUrl)}async _queryBuddy(e){const t=new((await Promise.all([s.e(7632),s.e(8278),s.e(7865),s.e(6554),s.e(2869),s.e(3910),s.e(9953),s.e(1733),s.e(1214),s.e(8399),s.e(1017),s.e(4674),s.e(993),s.e(8589),s.e(7609),s.e(812),s.e(4460)]).then(s.bind(s,18589))).default)({url:e}),{capabilities:r}=await t.load(),i=r.query.supportsMaxRecordCountFactor,n=r.query.supportsPagination,o=r.query.supportsCentroid,a=this._config.maxRecordCountFactor,c=t.capabilities.query.maxRecordCount,l=i?c*a:c,u=new S.A;if(u.outFields=this._config.outFields??["*"],u.where=this._config.definitionExpression??"1=1",u.returnGeometry=!0,u.returnExceededLimitFeatures=!0,u.outSpatialReference=m.A.fromJSON(this._outSpatialReference),o&&(u.returnCentroid=!0),i&&(u.maxRecordCountFactor=a),n)return u.num=l,t.destroy(),this._queryPages(e,u);const h=await(0,v.eW)(e,u,this._config.sourceSpatialReference);return t.destroy(),h}async _queryPages(e,t,s=[],r=0){t.start=null!=t.num?r*t.num:null;const i=await(0,v.eW)(e,t,this._config.sourceSpatialReference);return i.exceededTransferLimit&&r<(this._config.maxQueryDepth??0)?(i.features.forEach(e=>s.push(e)),this._queryPages(e,t,s,r+1)):(s.forEach(e=>i.features.push(e)),i)}_addRelatedFeatures(e){const t=new Map,s=e.features,r=this._serviceDefinition.relatedFeatures.joinField;for(const e of s){const s=e.attributes[r];t.set(s,e)}this._relatedFeatures=t}};k=(0,a.Cg)([(0,l.$K)("esri.layers.graphics.sources.connections.GeoEventConnection")],k);var T=s(64108);let A=class extends u{constructor(e,t){super({}),this.connectionStatus="connected",this.errorString=null;const{geometryType:s,sourceSpatialReference:r}=e;this._featureZScaler=(0,x.N)(s,r,t)}normalizeCtorArgs(){return{}}updateCustomParameters(e){}sendMessageToSocket(e){}sendMessageToClient(e){if("type"in e)switch(e.type){case"features":case"featureResult":for(const t of e.features)null!=this._featureZScaler&&this._featureZScaler(t.geometry),this.onFeature(t)}this.onMessage(e)}};function M(e,t){switch(e.type){case"client":return new A(e,t);case"custom":return new b(e,t);case"geoevent":return new k(e,t);case"kusto":return new h(e,t)}}(0,a.Cg)([(0,l.MZ)()],A.prototype,"connectionStatus",void 0),(0,a.Cg)([(0,l.MZ)()],A.prototype,"errorString",void 0),A=(0,a.Cg)([(0,T.$)("esri.layers.support.ClientSideConnection")],A)},85113(e,t,s){s.d(t,{BM:()=>k,bd:()=>T,sO:()=>I,xD:()=>h});var r=s(67482),i=s(49186),n=s(21325),o=s(90708),a=s(43334),c=s(92722),l=s(30524);const u={LineString:"esriGeometryPolyline",MultiLineString:"esriGeometryPolyline",MultiPoint:"esriGeometryMultipoint",Point:"esriGeometryPoint",Polygon:"esriGeometryPolygon",MultiPolygon:"esriGeometryPolygon"};function h(e){return u[e]}function*d(e){switch(e.type){case"Feature":yield e;break;case"FeatureCollection":for(const t of e.features)t&&(yield t)}}function*p(e){if(e)switch(e.type){case"Point":yield e.coordinates;break;case"LineString":case"MultiPoint":yield*e.coordinates;break;case"MultiLineString":case"Polygon":for(const t of e.coordinates)yield*t;break;case"MultiPolygon":for(const t of e.coordinates)for(const e of t)yield*e}}function f(e){for(const t of e)if(t.length>2)return!0;return!1}function _(e){let t=0;for(let s=0;s<e.length;s++){const r=e[s],i=e[(s+1)%e.length];t+=r[0]*i[1]-i[0]*r[1]}return t<=0}function m(e){const t=e[0],s=e[e.length-1];t[0]===s[0]&&t[1]===s[1]&&t[2]===s[2]||e.push(t)}function y(e,t){const{coordinates:s,type:r}=e,i=t.hasZ??!1,n=!0;switch(r){case"Point":return new c.A([],[...s],i,!1);case"LineString":return(0,o.Ap)({paths:[s],hasZ:n},i,!1);case"MultiLineString":return(0,o.Ap)({paths:s,hasZ:n},i,!1);case"MultiPoint":return(0,o.PR)({points:s,hasZ:n},i,!1);case"Polygon":case"MultiPolygon":{const e=new c.A([],[],i,!1);for(const t of"Polygon"===r?[s]:s){g(e,t[0],i);for(let s=1;s<t.length;s++)x(e,t[s],i)}return e}}}function g(e,t,s){m(t),function(e){return!_(e)}(t)?b(e,t,s):w(e,t,s)}function x(e,t,s){m(t),function(e){return _(e)}(t)?b(e,t,s):w(e,t,s)}function w(e,t,s){for(const r of t)v(e,r,s);e.lengths.push(t.length)}function b(e,t,s){for(let r=t.length-1;r>=0;r--)v(e,t[r],s);e.lengths.push(t.length)}function v(e,[t,s,r],i){e.coords.push(t,s),i&&e.coords.push(r||0)}function S(e){switch(typeof e){case"string":return(0,r.Br)(e)?"esriFieldTypeDate":"esriFieldTypeString";case"number":return"esriFieldTypeDouble";default:return"unknown"}}function I(e,t=4326){if(!e)throw new i.A("geojson-layer:empty","GeoJSON data is empty");if("Feature"!==e.type&&"FeatureCollection"!==e.type)throw new i.A("geojson-layer:unsupported-geojson-object","missing or not supported GeoJSON object type",{data:e});const{crs:s}=e;if(!s)return;const r="string"==typeof s?s:"name"===s.type?s.properties.name:"EPSG"===s.type?s.properties.code:null,o=(0,n.oT)({wkid:t})?new RegExp(".*(CRS84H?|4326)$","i"):new RegExp(`.*(${t})$`,"i");if(!r||!o.test(r))throw new i.A("geojson:unsupported-crs","unsupported GeoJSON 'crs' member",{crs:s})}function k(e,t={}){const s=[],r=new Set,i=new Set;let n,o=!1,a=null,c=!1,{geometryType:u=null}=t;for(const t of d(e)){const{geometry:e,properties:d,id:_}=t;if((!e||(u||(u=h(e.type)),h(e.type)===u))&&(o||(o=f(p(e))),c||(c=null!=_,c&&(n=typeof _,d&&(a=Object.keys(d).filter(e=>d[e]===_)))),d&&a&&c&&null!=_&&(a.length>1?a=a.filter(e=>d[e]===_):1===a.length&&(a=d[a[0]]===_?a:[])),d))for(const e in d){if(r.has(e))continue;const t=S(d[e]);if("unknown"===t){i.add(e);continue}i.delete(e),r.add(e);const n=(0,l.rS)(e);n&&s.push({name:n,alias:e,type:t})}}const _=(0,l.rS)(1===a?.length&&a[0]||null)??void 0;if(_)for(const e of s)if(e.name===_&&(0,l.WA)(e)){e.type="esriFieldTypeOID";break}return{fields:s,geometryType:u,hasZ:o,objectIdFieldName:_,objectIdFieldType:n,unknownFields:Array.from(i)}}function T(e,t){return Array.from(function*(e,t={}){const{geometryType:s,objectIdField:r}=t;for(const i of e){const{geometry:e,properties:n,id:o}=i;if(e&&h(e.type)!==s)continue;const c=n||{};let l;r&&(l=c[r],null==o||l||(c[r]=l=o)),yield new a.Om(e&&y(e,t),c,null,l)}}(d(e),t))}},82832(e,t,s){s.d(t,{$1:()=>m,CR:()=>_,MB:()=>d,PC:()=>y,Yx:()=>c,bP:()=>u});var r=s(67482),i=s(21325),n=s(30524);class o{constructor(e){this.description=e,this.code=null}}class a{constructor(e){this.globalId=null,this.objectId=null,this.success=!1,this.uniqueId=null,this.error=new o(e)}}function c(e){return new a(e)}class l{constructor(e){this.globalId=null,this.success=!0,this.objectId=this.uniqueId=e}}function u(e){return new l(e)}const h=new Set;function d(e,t,s,r=!1){h.clear();for(const i in s){const o=e.get(i);if(!o)continue;const a=p(o,s[i]);if(h.add(o.name),o&&(r||o.editable)){const e=(0,n.CJ)(o,a);if(e)return c((0,n.uo)(e,o,a));t[o.name]=a}}for(const t of e.requiredFields??[])if(!h.has(t.name))return c(`missing required field "${t.name}"`);return null}function p(e,t){let s=t;return(0,n.WA)(e)&&"string"==typeof t?s=parseFloat(t):(0,n.yM)(e)&&null!=t&&"string"!=typeof t?s=String(t):(0,n.vE)(e)&&"string"==typeof t&&(s=(0,r._U)(t)),(0,n.WX)(s)}let f;function _(e,t){if(!e||!(0,i.fn)(t))return e;if("rings"in e||"paths"in e){if(null==f)throw new TypeError("geometry engine not loaded");return f.simplify(t,e)}return e}async function m(e,t){!(0,i.fn)(e)||"esriGeometryPolygon"!==t&&"esriGeometryPolyline"!==t||await async function(){return null==f&&(f=await s.e(1023).then(s.bind(s,81023))),f}()}const y={supportsAutoIntervalBin:!0,supportsFixedIntervalBin:!0,supportsFixedBoundariesBin:!0,supportsDateBin:!0,supportsStackBy:!0,supportsSplitBy:!0,supportsNormalization:!0,supportedStatisticTypes:["COUNT","SUM","AVG","VAR","STDDEV","MIN","MAX","PERCENTILE_CONT","PERCENTILE_DISC","CentroidAggregate","EnvelopeAggregate","ConvexHullAggregate"],supportedNormalizationTypes:["field","log","naturalLog","percentOfTotal","squareRoot"]}},75321(e,t,s){s.d(t,{CJ:()=>I,GA:()=>A,GL:()=>S,I:()=>C,J0:()=>M,Ki:()=>T,Px:()=>k,QE:()=>v,bW:()=>F,vJ:()=>b});var r=s(11254),i=s(49186),n=s(53966),o=s(84952),a=s(16930),c=s(21325),l=s(28735),u=s(90708),h=s(58512),d=s(85113),p=s(64714),f=s(82832),_=s(95466),m=s(98453),y=s(98623);const g=()=>n.A.getLogger("esri.layers.ogc.ogcFeatureUtils"),x="startindex",w=new Set([x,"offset"]),b="http://www.opengis.net/def/crs/",v=`${b}OGC/1.3/CRS84`;async function S(e,t,s={},n=5){const{links:a}=e,c=z(a);if(!c)throw new i.A("ogc-feature-layer:missing-items-page","Missing items url");const{apiKey:l,customParameters:u,signal:h}=s,f=(0,o.s2)(c.href,e.landingPage.url),w={limit:n,...u,token:l},b=(0,o.a6)(f,w),{data:v}=await(0,r.A)(b,{signal:h,headers:{accept:"application/geo+json"}}),S=q(b,n,v.links)??x;(0,d.sO)(v);const I=v.numberMatched,k=(0,d.BM)(v,{geometryType:t.geometryType}),T=t.fields||k.fields||[],A=null!=t.hasZ?t.hasZ:k.hasZ,M=k.geometryType,F=t.objectIdField||k.objectIdFieldName||"OBJECTID";let C=t.timeInfo;const P=T.find(({name:e})=>e===F);if(P)P.editable=!1,P.nullable=!1;else{if(!k.objectIdFieldType)throw new i.A("ogc-feature-layer:missing-feature-id","Collection geojson require a feature id as a unique identifier");T.unshift({name:F,alias:F,type:"number"===k.objectIdFieldType?"esriFieldTypeOID":"esriFieldTypeString",editable:!1,nullable:!1})}if(F!==k.objectIdFieldName){const e=T.find(({name:e})=>e===k.objectIdFieldName);e&&(e.type="esriFieldTypeInteger")}T===k.fields&&k.unknownFields.length>0&&g().warn({name:"ogc-feature-layer:unknown-field-types",message:"Some fields types couldn't be inferred from the features and were dropped",details:{unknownFields:k.unknownFields}});for(const e of T){if(e.name??=e.alias,e.alias??=e.name,"esriFieldTypeOID"!==e.type&&"esriFieldTypeGlobalID"!==e.type&&(e.editable??=!0,e.nullable??=!0),!e.name)throw new i.A("ogc-feature-layer:invalid-field-name","field name is missing",{field:e});if(!m.m.jsonValues.includes(e.type))throw new i.A("ogc-feature-layer:invalid-field-type",`invalid type for field "${e.name}"`,{field:e})}if(C){const e=new _.A(T);if(C.startTimeField){const t=e.get(C.startTimeField);t?(C.startTimeField=t.name,t.type="esriFieldTypeDate"):C.startTimeField=null}if(C.endTimeField){const t=e.get(C.endTimeField);t?(C.endTimeField=t.name,t.type="esriFieldTypeDate"):C.endTimeField=null}if(C.trackIdField){const t=e.get(C.trackIdField);t?C.trackIdField=t.name:(C.trackIdField=null,g().warn({name:"ogc-feature-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:C}}))}C.timeReference||={timeZoneIANA:y.n$},C.startTimeField||C.endTimeField||(g().warn({name:"ogc-feature-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing",details:{timeInfo:C}}),C=void 0)}return{drawingInfo:M?(0,p.F0)(M):null,extent:O(e),geometryType:M,fields:T,hasZ:!!A,objectIdField:F,paginationParameter:S,timeInfo:C,featureCount:I}}async function I(e,t={}){const{links:s,url:n}=e,a=L(c=s,"data","application/json")??L(c,"http://www.opengis.net/def/rel/ogc/1.0/data","application/json");var c;if(!a)throw new i.A("ogc-feature-layer:missing-collections-page","Missing collections url");const{apiKey:l,customParameters:u,signal:h}=t,d=(0,o.s2)(a.href,n),{data:p}=await(0,r.A)(d,{signal:h,headers:{accept:"application/json"},query:{...u,token:l}});for(const t of p.collections)t.landingPage=e;return p}async function k(e,t={}){const{links:s,url:n}=e,a=L(c=s,"conformance","application/json")??L(c,"http://www.opengis.net/def/rel/ogc/1.0/conformance","application/json");var c;if(!a)throw new i.A("ogc-feature-layer:missing-conformance-page","Missing conformance url");const{apiKey:l,customParameters:u,signal:h}=t,d=(0,o.s2)(a.href,n),{data:p}=await(0,r.A)(d,{signal:h,headers:{accept:"application/json"},query:{...u,token:l}});return p}async function T(e,t={}){const{apiKey:s,customParameters:i,signal:n}=t,{data:o}=await(0,r.A)(e,{signal:n,headers:{accept:"application/json"},query:{...i,token:s}});return o.url=e,o}async function A(e,t={}){const{links:s,url:i}=e,n=L(s,"service-desc","application/vnd.oai.openapi+json;version=3.0");if(!n)return g().warn("ogc-feature-layer:missing-openapi-page","The OGC API-Features server does not have an OpenAPI page."),null;const{apiKey:a,customParameters:c,signal:l}=t,u=(0,o.s2)(n.href,i),{data:h}=await(0,r.A)(u,{signal:l,headers:{accept:"application/vnd.oai.openapi+json;version=3.0"},query:{...c,token:a}});return h}function M(e){const t=/^http:\/\/www\.opengis.net\/def\/crs\/(?<authority>.*)\/(?<version>.*)\/(?<code>.*)$/i.exec(e),s=t?.groups;if(!s)return null;const{authority:r,code:i}=s;switch(r.toLowerCase()){case"ogc":switch(i.toLowerCase()){case"crs27":return a.A.GCS_NAD_1927.wkid;case"crs83":return 4269;case"crs84":case"crs84h":return a.A.WGS84.wkid;default:return null}case"esri":case"epsg":{const e=Number.parseInt(i,10);return Number.isNaN(e)?null:e}default:return null}}async function F(e,t,s){const r=await C(e,t,s);return(0,u.ZF)(r)}async function C(e,t,s){const{collection:{links:n,landingPage:{url:p}},layerDefinition:m,maxRecordCount:y,queryParameters:{apiKey:g,customParameters:x},spatialReference:w,supportedCrs:b}=e,v=z(n);if(!v)throw new i.A("ogc-feature-layer:missing-items-page","Missing items url");const{geometry:S,num:I,start:k,timeExtent:T,where:A}=t;if(t.objectIds)throw new i.A("ogc-feature-layer:query-by-objectids-not-supported","Queries with object ids are not supported");const M=a.A.fromJSON(w),F=t.outSpatialReference??M,C=F.isWGS84?null:P(F,b),E=R(S,b),O=function(e){if(!e)return null;const{start:t,end:s}=e;return`${null!=t?t.toISOString():".."}/${null!=s?s.toISOString():".."}`}(T),L=(Z=A)&&"1=1"!==Z?Z:null,q=I??(null==k?y:10),N=0===k?void 0:k,{fields:B,geometryType:G,hasZ:j,objectIdField:U,paginationParameter:V}=m,W=(0,o.s2)(v.href,p),{data:Y}=await(0,r.A)(W,{...s,query:{...x,...E,crs:C,datetime:O,query:L,limit:q,[V]:N,token:g},headers:{accept:"application/geo+json"}}),$=(0,d.bd)(Y,{geometryType:G,hasZ:j,objectIdField:U}),H=$.length===q&&!!D(Y.links??[]),Q=new _.A(B);var Z;for(const e of $){const t={};(0,f.MB)(Q,t,e.attributes,!0);for(const e of Q.fields)e.nullable&&!(e.name in t)&&(t[e.name]=null);t[U]=e.attributes[U],e.attributes=t}if(!C&&F.isWebMercator)for(const e of $)if(null!=e.geometry&&null!=G){const t=(0,u.zv)(e.geometry,G,j,!1);t.spatialReference=a.A.WGS84,e.geometry=(0,u.Ux)((0,l.Cv)(t,F))}for(const e of $)e.objectId=e.attributes[U];const X=C||!C&&F.isWebMercator?F.toJSON():c.KK,K=new h.A;return K.exceededTransferLimit=H,K.features=$,K.fields=B,K.geometryType=G,K.hasZ=j,K.spatialReference=X,K}function P(e,t){const{isWebMercator:s,wkid:r,latestWkid:i}=e;if(!r&&!i)return null;const n=s?t[3857]??t[102100]??t[102113]??t[900913]:r&&t[r]||i&&t[i];return n?`${b}${n}`:null}function E(e){if(!e)return"";const{xmin:t,ymin:s,xmax:r,ymax:i}=e;return`${t},${s},${r},${i}`}function R(e,t){if(!function(e){return null!=e&&"extent"===e.type}(e))return null;const{spatialReference:s}=e;if(!s||s.isWGS84)return{bbox:E(e)};const r=P(s,t);return null!=r?{bbox:E(e),"bbox-crs":r}:s.isWebMercator?{bbox:E((0,l.Cv)(e,a.A.WGS84))}:null}function O(e){const t=e.extent?.spatial;if(!t)return null;const s=t.bbox[0],r=4===s.length,[i,n]=s,o=r?void 0:s[2];return{xmin:i,ymin:n,xmax:r?s[2]:s[3],ymax:r?s[3]:s[4],zmin:o,zmax:r?void 0:s[5],spatialReference:a.A.WGS84.toJSON()}}function z(e){return L(e,"items","application/geo+json","http://www.opengis.net/def/profile/ogc/0/rfc7946")??L(e,"http://www.opengis.net/def/rel/ogc/1.0/items","application/geo+json","http://www.opengis.net/def/profile/ogc/0/rfc7946")}function L(e,t,s,r){return r?e.find(({rel:e,type:i,profile:n})=>e===t&&i===s&&n?.includes(r))??e.find(({rel:e,type:r,profile:i})=>e===t&&r===s&&!i):e.find(({rel:e,type:r})=>e===t&&r===s)??e.find(({rel:e,type:s})=>e===t&&!s)}function D(e){return L(e,"next","application/geo+json")}function q(e,t,s){if(!s)return;const r=D(s),i=(0,o.An)(r?.href)?.query;if(!i)return;const n=(0,o.An)(e).query,a=Object.keys(n??{}),c=Object.entries(i).filter(([e])=>!a.includes(e)).find(([e,s])=>w.has(e.toLowerCase())&&Number.parseInt(s,10)===t),l=c?.[0];return l}},25747(e,t,s){s.d(t,{A:()=>l});var r=s(5482),i=s(69540),n=s(25482),o=s(91429),a=s(64108),c=s(9075);let l=class extends((0,n.T)(i.Pw)){constructor(e){super(e),this.type="fabric",this.refreshInterval=5e3/6e4}};(0,r.Cg)([(0,o.MZ)({type:["fabric"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],l.prototype,"type",void 0),(0,r.Cg)([(0,o.MZ)({type:String,json:{read:!1,write:{ignoreOrigin:!0}}})],l.prototype,"workspace",void 0),(0,r.Cg)([(0,o.MZ)({type:String,json:{read:!1,write:{ignoreOrigin:!0}}})],l.prototype,"database",void 0),(0,r.Cg)([(0,o.MZ)({type:String,json:{read:!1,write:{ignoreOrigin:!0}}})],l.prototype,"table",void 0),(0,r.Cg)([(0,o.MZ)({type:c.A,json:{read:!1,write:{ignoreOrigin:!0}}})],l.prototype,"geometryEncoding",void 0),(0,r.Cg)([(0,o.MZ)({type:Number,json:{read:!1,write:{ignoreOrigin:!0}}})],l.prototype,"refreshInterval",void 0),l=(0,r.Cg)([(0,a.$)("esri.layers.support.FabricKustoSource")],l)},41560(e,t,s){s.d(t,{Ch:()=>o,mW:()=>n});var r=s(34727),i=s(39516);function n(e,t){return{...t,filterMode:e.mode}}function o(e,t,s){const n=function(e){if("manual"===l(e))return null;const t=[Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY];for(const{minScale:s,maxScale:r}of e.filters)t[0]=Math.max(t[0],u(s)),t[1]=Math.min(t[1],h(r));return t}(e);if(n&&((0,r.gg)(t,n[0])||(0,r.ZH)(s,n[1])))return"";const o=Array.from(a(e,t,s)),c=function(e,t,s){if(0===e.length)return!0;const i=u(e.at(0)?.minScale),n=h(e.at(-1)?.maxScale);if((0,r.ZH)(i,t)||(0,r.gg)(n,s))return!0;for(let t=0;t<e.length-1;t++){const s=e[t],i=e[t+1];if((0,r.ZH)(u(i.minScale),h(s.maxScale)))return!0}return!1}(o,t,s)?"1=1":o.map(e=>e.where||"1=1").reduce((e,t)=>(0,i.IW)(e,t),"");return c&&"1=1"!==c?c:""}function*a(e,t,s){if("manual"===l(e)){const t=e.filters.find(t=>t.id===e.activeFilterId);t&&(yield t)}else{"object"==typeof t&&(t=t.scale);for(const r of e.filters)c(r.minScale,r.maxScale,t,s)&&(yield r)}}function c(e,t,s,i){return e=u(e),s=u(s),t=h(t),!(!(0,r.Sp)(s,e)&&(i??s)>e||(0,r.Hx)(t,s)||void 0!==i&&(0,r.Sp)(i,e))}function l(e){return"mode"in e?e.mode:e.filterMode}function u(e){return e||Number.POSITIVE_INFINITY}function h(e){return e||0}},9916(e,t,s){s.d(t,{ZF:()=>l,iD:()=>d,xw:()=>h});var r=s(11254),i=s(49186),n=s(25747),o=s(20437),a=s(9075),c=s(54625);async function l(e,t,s,o,l={}){if(o.database||(o.database=await async function(e,t){const{data:s}=await(0,r.A)(`https://api.fabric.microsoft.com/v1/workspaces/${e}/kqlDatabases/${t}`,{responseType:"json"});if(null==s)throw new i.A("kusto:connection",`KQL database '${t}' was not found in workspace '${e}'`);return s}(e,t)),o.fields?.length||(o.fields=await async function(e,t,s={}){const n=await async function(e,t,s={}){const n=e.properties.queryServiceUri;return function(e){const t=e.Tables[0];if(null==t||0===t.Rows.length)throw new i.A("kusto:invalid-schema-response","Kusto schema response did not include any rows");const[s,r]=t.Rows[0];if("string"!=typeof r)throw new i.A("kusto:invalid-schema-response","Kusto schema response did not include a schema string");return JSON.parse(r)}((await(0,r.A)(`${n}/v1/rest/mgmt`,{responseType:"json",method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({db:e.displayName,csl:`.show table ${h(t)} schema as json`}),signal:s.signal})).data)}(e,t,s),o=[];for(const e of n.OrderedColumns){const t=u(e);t&&o.push(t)}return o}(o.database,s,l)),o.source||(o.source=new n.A({workspace:e,database:t,table:s})),!o.source.geometryEncoding){const e=(0,c.i_)(o.fields.map(e=>e.name));e.latitudeFieldName&&e.longitudeFieldName&&(o.source.geometryEncoding=new a.A({xField:e.longitudeFieldName,yField:e.latitudeFieldName}))}return o}function u(e){const t=function(e){switch(e){case"bool":return"small-integer";case"guid":case"string":return"string";case"int":return"integer";case"long":return"big-integer";case"real":return"double";case"dynamic":case"datetime":case"decimal":case"timespan":return null}}(e.CslType);return t?new o.A({name:e.Name,type:t}):null}function h(e){return`['${e.replaceAll("'","''")}']`}function d(e){return e.replaceAll("'","''")}},32730(e,t,s){s.d(t,{BI:()=>p,D3:()=>h,XJ:()=>d,lc:()=>u,mX:()=>_,rU:()=>f,tH:()=>w,vK:()=>b,zA:()=>v});var r=s(799);const i="__begin__",n="__end__",o=new RegExp(i,"ig"),a=new RegExp(n,"ig"),c=new RegExp("^"+i,"i"),l=new RegExp(n+"$","i");function u(e){return e.replaceAll(new RegExp("\\[","g"),"{").replaceAll(new RegExp("\\]","g"),"}")}function h(e){return e.replaceAll(new RegExp("\\{","g"),"[").replaceAll(new RegExp("\\}","g"),"]")}function d(e){const t={expression:"",type:"none"};return e.labelExpressionInfo?e.labelExpressionInfo.value?(t.expression=e.labelExpressionInfo.value,t.type="conventional"):e.labelExpressionInfo.expression&&(t.expression=e.labelExpressionInfo.expression,t.type="arcade"):null!=e.labelExpression&&(t.expression=u(e.labelExpression),t.type="conventional"),t}function p(e){const t=d(e);if(!t)return null;switch(t.type){case"conventional":return _(t.expression);case"arcade":return t.expression}return null}function f(e){const t=d(e);if(!t)return null;switch(t.type){case"conventional":return function(e){const t=e?.match(m);return t?.[1].trim()||null}(t.expression);case"arcade":return w(t.expression)}return null}function _(e){let t;return e?(t=(0,r.HC)(e,e=>i+'$feature["'+e+'"]'+n),t=c.test(t)?t.replace(c,""):'"'+t,t=l.test(t)?t.replace(l,""):t+'"',t=t.replaceAll(o,'" + ').replaceAll(a,' + "')):t='""',t}const m=/^\s*\{([^}]+)\}\s*$/i,y=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*$/i,g=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(\1|\3)(\5)\s*\));?\s*$/i,x=/^\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(.+)(\1)\s*\));?\s*$/i;function w(e){if(!e)return null;let t=y.exec(e)||g.exec(e);return t?t[1]||t[3]:(t=x.exec(e),t?t[2]:null)}const b=Symbol("LabelClassInstance");function v(e){return null!=e&&"object"==typeof e&&b in e}},72691(e,t,s){s.d(t,{Aw:()=>o,DN:()=>r,EA:()=>n,Gm:()=>i,xq:()=>a});const r="__esri_stream_id__",i="__esri_timestamp__",n="__esri_track_part__",o="__esri_time_received__",a="__esri_track_line__"},73681(e,t,s){s.d(t,{n:()=>c});var r=s(49186),i=s(53966),n=s(46140),o=s(95466),a=s(55674);class c{static async from(e,t,s){const o=e.dictionary_version?n.A.parse(e.dictionary_version):null,u=new Set(e.itemsNames),h={};if(t)for(const e in t)h[e]=t[e];if(e.authoringInfo.configuration)for(const t of e.authoringInfo.configuration)h.hasOwnProperty(t.name)||(h[t.name]=t.value);const d=new Set(e.authoringInfo.symbol);for(const e of Object.keys(s))d.delete(e);d.size&&i.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("missing-fields: fieldMap entries for the following symbol fields are missing",{symbolFields:d});const p=await(0,a.xR)(e.expression,null,h);if(!p)throw new r.A("dictionary-renderer:expression-error","Unable to create dictionary renderer expression");const f=!o||!o.greaterEqual(4,0);f&&i.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("Dictionary script does not support native field types. Applying fallback",{version:o});const _=new l(s,f);return new c(f,u,p,_)}constructor(e,t,s,r){this._requiresFieldCoercionToString=e,this._itemNames=t,this._compiled=s,this._reader=r}get itemNames(){return this._itemNames}evaluate(e,t,s,r){try{return this._reader.bind(e,s,r),this._compiled.evaluate(this._reader,{$view:{scale:t}})}catch(e){i.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("arcade: dictionary script evaluation failed",{error:e})}return null}createDictionaryFieldsIndex(e){if(!this._requiresFieldCoercionToString)return new o.A(e);const t=e.map(e=>({...e,type:"esriFieldTypeString"}));return new o.A(t)}}class l extends a.Gj{constructor(e,t){super(),this._fieldMap=e,this._requiresFieldCoercionToString=t}_getField(e){const t=this._fieldMap[e]??e;return this._boundSchema.fieldsIndex.get(t)}field(e){if(!this._requiresFieldCoercionToString)return super.field(e,!1);const t=this._getField(e);return null==t||null==this._boundTarget.attributes[t.name]?"":""+this._boundTarget.attributes[t.name]}}},55674(e,t,s){s.d(t,{Ad:()=>p,Gj:()=>m,QY:()=>d,lL:()=>y,xR:()=>f});var r=s(66131),i=s(49186),n=(s(44208),s(44729)),o=s(15032),a=s(65864),c=s(95466),l=s(43668),u=s(98623);const h=["geometry","scale","timeProperties"];function d(e,t){if(null!=t)for(const s of h)t.hasArcadeDependency(s)&&e.add(s);return e}function p(e,t){return _.create(e,t,null,["$feature","$view"])}function f(e,t,s){return _.create(e,t,s,["$feature","$view","$config"])}class _{static async create(e,t,s,r){const{arcade:n,Dictionary:o}=await(0,l.l)();let a;try{a=n.parseScript(e)}catch(t){throw new i.A("arcade-bad-expression","Failed to parse arcade script",{script:e,error:t})}const c=n.scriptUsesGeometryEngine(a);c&&await n.enableGeometrySupport(),await n.loadDependentModules(new Set,a,null,!1,c);const u={vars:r.reduce((e,t)=>({...e,[t]:null}),{}),spatialReference:t,useAsync:!1},h=n.compileScript(a,u);let d=null;null!=s&&(d=new o(s),d.immutable=!0);const p=new o;return p.immutable=!1,p.setField("scale",0),new _(e,n,a,h,t,p,d,o)}constructor(e,t,s,r,i,n,o,a){this.script=e,this._arcade=t,this._syntaxTree=s,this._compiled=r,this._spatialReference=i,this._viewDict=n,this._configDict=o,this._dictionaryCtor=a,this._dependencies=new Map,this._featureReader=new m,this._dependencies.set("geometry",t.scriptTouchesGeometry(this._syntaxTree)),this._dependencies.set("scale",this._arcade.referencesMember(this._syntaxTree,"scale")),this._dependencies.set("timeProperties",this._arcade.scriptUsesViewProperties(this._syntaxTree,["timeProperties"]))}evaluate(e,t){const s=t.$view?.timeZone;if(t.$view){let e;if(this._viewDict.setField("scale",t.$view.scale),null!=t.$view.timeProperties){const{currentStart:i,currentEnd:n}=t.$view.timeProperties;e=new this._dictionaryCtor({currentStart:null!=i?null!=s?r.lY.epochToArcadeDate(i,s):r.lY.unknownEpochToArcadeDate(i):void 0,currentEnd:null!=n?null!=s?r.lY.epochToArcadeDate(n,s):r.lY.unknownEpochToArcadeDate(n):void 0,startIncluded:!0,endIncluded:!0})}this._viewDict.setField("timeProperties",e)}return this._compiled({vars:{$view:this._viewDict,$config:this._configDict,$feature:e},spatialReference:this._spatialReference,timeZone:s})}repurposeFeature(e,t){return this._featureReader.bind(e,t,this._spatialReference),this._featureReader}references(e){return this._dependencies.get(e)??!1}}class m{constructor(){this._boundTarget=null,this._boundSchema={fields:null,fieldsIndex:null,spatialReference:null,get geometryType(){return null},get objectIdField(){return null}},this.arcadeDeclaredClass="esri.arcade.Feature",this._contextTimeZone=null}bind(e,t,s){const r=t??new c.A(y(e.attributes));this._boundTarget=e,this._boundSchema.fields=r.fields,this._boundSchema.fieldsIndex=r,this._boundSchema.spatialReference=s}_getField(e){return this._boundSchema.fieldsIndex.get(e)}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this._boundSchema.fieldsIndex.has(e)}geometry(){if("fromJSON"in this._boundTarget)return this._boundTarget.geometry;const e=(0,a.rS)(this._boundTarget.geometry);if(e){if(!this._boundSchema.spatialReference)throw new Error("InternalError: Expected spatial reference to be defined");e.spatialReference=this._boundSchema.spatialReference}return e}_hasGeometry(){return null!=this._boundTarget.geometry}isUnknownDateTimeField(e){return this._boundSchema.fieldsIndex.getTimeZone(e)===u.L5}field(e,t=!0){const s=this._getField(e);if(s){const t=this._boundTarget.attributes[s.name];if(null==t)return null;switch(s.type){case"date-only":case"esriFieldTypeDateOnly":return n.n.fromReader(t);case"time-only":case"esriFieldTypeTimeOnly":return o.k.fromReader(t);case"esriFieldTypeTimestampOffset":case"timestamp-offset":return r.lY.fromReaderAsTimeStampOffset(t);case"date":case"esriFieldTypeDate":return this.isUnknownDateTimeField(e)?r.lY.unknownEpochToArcadeDate(t):r.lY.epochToArcadeDate(t,this.contextTimeZone??u.qU);default:return t}}if(t)throw new Error(`Field ${e} does not exist`);return null}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this._boundSchema.fieldsIndex.fields.map(e=>e.name)}isEmpty(){return this._boundSchema.fields.length<=0&&!this._hasGeometry()}castToText(e=!1){return JSON.stringify(this._boundTarget)}gdbVersion(){return null}fullSchema(){return this._boundSchema}castAsJson(e=null){return{attributes:this._boundTarget.attributes,geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}}function y(e){const t=[];for(const s in e)t.push({name:s,alias:s,type:"string"==typeof e[s]?"esriFieldTypeString":"esriFieldTypeDouble"});return t}},83773(e,t,s){s.d(t,{i:()=>f});var r=s(76213);function i(e,t){return e.x===t.x&&e.y===t.y}function n(e){if(!e)return;const t=e.length;if(t<=1)return;let s=0;for(let r=1;r<t;r++)i(e[r],e[s])||++s===r||(e[s]=e[r]);e.length=s+1}function o(e,t){return e.x=t.y,e.y=-t.x,e}function a(e,t){return e.x=-t.y,e.y=t.x,e}function c(e,t){return e.x=t.x,e.y=t.y,e}function l(e,t){return e.x=-t.x,e.y=-t.y,e}function u(e){return Math.sqrt(e.x*e.x+e.y*e.y)}function h(e,t){return e.x*t.y-e.y*t.x}function d(e,t){return e.x*t.x+e.y*t.y}function p(e,t,s,r){return e.x=t.x*s+t.y*r,e.y=t.x*r-t.y*s,e}class f{constructor(e,t,s){this._writeVertex=e,this._writeTriangle=t,this._canUseThinTessellation=s,this._prevNormal={x:void 0,y:void 0},this._nextNormal={x:void 0,y:void 0},this._textureNormalLeft={x:0,y:1},this._textureNormalRight={x:0,y:-1},this._textureNormal={x:void 0,y:void 0},this._joinNormal={x:void 0,y:void 0},this._inner={x:void 0,y:void 0},this._outer={x:void 0,y:void 0},this._roundStart={x:void 0,y:void 0},this._roundEnd={x:void 0,y:void 0},this._startBreak={x:void 0,y:void 0},this._endBreak={x:void 0,y:void 0},this._innerPrev={x:void 0,y:void 0},this._innerNext={x:void 0,y:void 0},this._bevelStart={x:void 0,y:void 0},this._bevelEnd={x:void 0,y:void 0},this._bevelMiddle={x:void 0,y:void 0}}tessellate(e,t,s=this._canUseThinTessellation){n(e),s&&t.halfWidth<r.Gh&&!t.offset?this._tessellateThin(e,t):this._tessellate(e,t)}_tessellateThin(e,t){if(e.length<2)return;const s=t.wrapDistance||65535;let r=t.initialDistance||0,i=!1,n=e[0].x,o=e[0].y;const a=e.length;for(let t=1;t<a;++t){i&&(i=!1,r=0);let a=e[t].x,c=e[t].y,l=a-n,u=c-o,h=Math.sqrt(l*l+u*u);if(l/=h,u/=h,r+h>s){i=!0;const e=(s-r)/h;h=s-r,a=(1-e)*n+e*a,c=(1-e)*o+e*c,--t}const d=this._writeVertex(n,o,0,0,l,u,u,-l,0,-1,r),p=this._writeVertex(n,o,0,0,l,u,-u,l,0,1,r);r+=h;const f=this._writeVertex(a,c,0,0,l,u,u,-l,0,-1,r),_=this._writeVertex(a,c,0,0,l,u,-u,l,0,1,r);this._writeTriangle(d,p,f),this._writeTriangle(p,f,_),n=a,o=c}}_tessellate(e,t){const s=e[0],r=e[e.length-1],n=i(s,r),f=n?3:2;if(e.length<f)return;const _=t.pixelCoordRatio,m=null!=t.capType?t.capType:0,y=null!=t.joinType?t.joinType:2,g=null!=t.miterLimit?Math.min(t.miterLimit,4):2,x=null!=t.roundLimit?Math.min(t.roundLimit,1.05):1.05,w=null!=t.halfWidth?t.halfWidth:2,b=!!t.textured;let v,S,I,k=null;const T=this._prevNormal,A=this._nextNormal;let M=-1,F=-1;const C=this._joinNormal;let P,E;const R=this._textureNormalLeft,O=this._textureNormalRight,z=this._textureNormal;let L=-1,D=-1;const q=t.wrapDistance||65535;let N=t.initialDistance||0;const B=this._writeVertex,G=this._writeTriangle,j=(e,t,s,r,i,n)=>{const o=B(S,I,P,E,s,r,e,t,i,n,N);return L>=0&&D>=0&&o>=0&&G(L,D,o),L=D,D=o,o};n&&(v=e[e.length-2],A.x=r.x-v.x,A.y=r.y-v.y,F=u(A),A.x/=F,A.y/=F);let U=!1;for(let t=0;t<e.length;++t){if(U&&(U=!1,N=0),v&&(T.x=-A.x,T.y=-A.y,M=F,N+M>q&&(U=!0)),U){const s=(q-N)/M;M=q-N,v={x:(1-s)*v.x+s*e[t].x,y:(1-s)*v.y+s*e[t].y},--t}else v=e[t];S=v.x,I=v.y;const s=t<=0&&!U,r=t===e.length-1;if(s||(N+=M),k=r?n?e[1]:null:e[t+1],k?(A.x=k.x-S,A.y=k.y-I,F=u(A),A.x/=F,A.y/=F):(A.x=void 0,A.y=void 0),!n){if(s){a(C,A),P=C.x,E=C.y,2===m&&(j(-A.y-A.x,A.x-A.y,A.x,A.y,0,-1),j(A.y-A.x,-A.x-A.y,A.x,A.y,0,1)),1===m&&(j(-A.y-A.x,A.x-A.y,A.x,A.y,-1,-1),j(A.y-A.x,-A.x-A.y,A.x,A.y,-1,1)),1!==m&&0!==m||(j(-A.y,A.x,A.x,A.y,0,-1),j(A.y,-A.x,A.x,A.y,0,1));continue}if(r){o(C,T),P=C.x,E=C.y,1!==m&&0!==m||(j(T.y,-T.x,-T.x,-T.y,0,-1),j(-T.y,T.x,-T.x,-T.y,0,1)),2===m&&(j(T.y-T.x,-T.x-T.y,-T.x,-T.y,0,-1),j(-T.y-T.x,T.x-T.y,-T.x,-T.y,0,1)),1===m&&(j(T.y-T.x,-T.x-T.y,-T.x,-T.y,1,-1),j(-T.y-T.x,T.x-T.y,-T.x,-T.y,1,1));continue}}let i,f,B=-h(T,A);if(Math.abs(B)<.01)d(T,A)>0?(C.x=T.x,C.y=T.y,B=1,i=Number.MAX_VALUE,f=!0):(a(C,A),B=1,i=1,f=!1);else{C.x=(T.x+A.x)/B,C.y=(T.y+A.y)/B,i=u(C);const e=(i-1)*w*_;f=i>4||e>M&&e>F}P=C.x,E=C.y;let G=y;switch(y){case 0:i<1.05&&(G=2);break;case 1:i<x&&(G=2);break;case 2:i>g&&(G=0)}switch(G){case 2:if(j(C.x,C.y,-T.x,-T.y,0,-1),j(-C.x,-C.y,-T.x,-T.y,0,1),r)break;if(b){const e=U?0:N;L=this._writeVertex(S,I,P,E,A.x,A.y,C.x,C.y,0,-1,e),D=this._writeVertex(S,I,P,E,A.x,A.y,-C.x,-C.y,0,1,e)}break;case 0:{const e=B<0;let t,s,i,n;if(e){const e=L;L=D,D=e,t=R,s=O}else t=O,s=R;if(f)i=e?a(this._innerPrev,T):o(this._innerPrev,T),n=e?o(this._innerNext,A):a(this._innerNext,A);else{const t=e?l(this._inner,C):c(this._inner,C);i=t,n=t}const u=e?o(this._bevelStart,T):a(this._bevelStart,T);j(i.x,i.y,-T.x,-T.y,t.x,t.y);const h=j(u.x,u.y,-T.x,-T.y,s.x,s.y);if(r)break;const d=e?a(this._bevelEnd,A):o(this._bevelEnd,A);if(f){const e=this._writeVertex(S,I,P,E,-T.x,-T.y,0,0,0,0,N);L=this._writeVertex(S,I,P,E,A.x,A.y,n.x,n.y,t.x,t.y,N),D=this._writeVertex(S,I,P,E,A.x,A.y,d.x,d.y,s.x,s.y,N),this._writeTriangle(h,e,D)}else{if(b){const e=this._bevelMiddle;e.x=(u.x+d.x)/2,e.y=(u.y+d.y)/2,p(z,e,-T.x,-T.y),j(e.x,e.y,-T.x,-T.y,z.x,z.y),p(z,e,A.x,A.y),L=this._writeVertex(S,I,P,E,A.x,A.y,e.x,e.y,z.x,z.y,N),D=this._writeVertex(S,I,P,E,A.x,A.y,n.x,n.y,t.x,t.y,N)}else{const e=L;L=D,D=e}j(d.x,d.y,A.x,A.y,s.x,s.y)}if(e){const e=L;L=D,D=e}break}case 1:{const e=B<0;let t,s;if(e){const e=L;L=D,D=e,t=R,s=O}else t=O,s=R;const n=e?l(this._inner,C):c(this._inner,C);let u,h;f?(u=e?a(this._innerPrev,T):o(this._innerPrev,T),h=e?o(this._innerNext,A):a(this._innerNext,A)):(u=n,h=n);const _=e?o(this._roundStart,T):a(this._roundStart,T),m=e?a(this._roundEnd,A):o(this._roundEnd,A),y=j(u.x,u.y,-T.x,-T.y,t.x,t.y),g=j(_.x,_.y,-T.x,-T.y,s.x,s.y);if(r)break;const x=this._writeVertex(S,I,P,E,-T.x,-T.y,0,0,0,0,N);f||this._writeTriangle(L,D,x);const w=l(this._outer,n),v=this._writeVertex(S,I,P,E,A.x,A.y,m.x,m.y,s.x,s.y,N);let k,M;const F=i>2;if(F){let t;i!==Number.MAX_VALUE?(w.x/=i,w.y/=i,t=d(T,w),t=(i*(t*t-1)+1)/t):t=-1,k=e?o(this._startBreak,T):a(this._startBreak,T),k.x+=T.x*t,k.y+=T.y*t,M=e?a(this._endBreak,A):o(this._endBreak,A),M.x+=A.x*t,M.y+=A.y*t}p(z,w,-T.x,-T.y);const q=this._writeVertex(S,I,P,E,-T.x,-T.y,w.x,w.y,z.x,z.y,N);p(z,w,A.x,A.y);const G=b?this._writeVertex(S,I,P,E,A.x,A.y,w.x,w.y,z.x,z.y,N):q,U=x,V=b?this._writeVertex(S,I,P,E,A.x,A.y,0,0,0,0,N):x;let W=-1,Y=-1;if(F&&(p(z,k,-T.x,-T.y),W=this._writeVertex(S,I,P,E,-T.x,-T.y,k.x,k.y,z.x,z.y,N),p(z,M,A.x,A.y),Y=this._writeVertex(S,I,P,E,A.x,A.y,M.x,M.y,z.x,z.y,N)),b?F?(this._writeTriangle(U,g,W),this._writeTriangle(U,W,q),this._writeTriangle(V,G,Y),this._writeTriangle(V,Y,v)):(this._writeTriangle(U,g,q),this._writeTriangle(V,G,v)):F?(this._writeTriangle(x,g,W),this._writeTriangle(x,W,Y),this._writeTriangle(x,Y,v)):(this._writeTriangle(x,g,q),this._writeTriangle(x,G,v)),f?(L=this._writeVertex(S,I,P,E,A.x,A.y,h.x,h.y,t.x,t.y,N),D=v):(L=b?this._writeVertex(S,I,P,E,A.x,A.y,h.x,h.y,t.x,t.y,N):y,this._writeTriangle(L,V,v),D=v),e){const e=L;L=D,D=e}break}}}}}},69599(e,t,s){s.r(t),s.d(t,{default:()=>Ea});var r=s(49186),i=s(36563),n=s(44208),o=s(26390),a=s(17676),c=s(87811),l=s(36708),u=s(90629),h=s(8341),d=s(87045),p=s(76213);class f{constructor(e){this._client=e,this.layerView=this._client.createInvokeProxy(""),this.container=this._client.createInvokeProxy("container"),this._eventLog=this._client.createInvokeProxy("eventLog")}onEvent(e){"error"===e.type&&e.error&&"toJSON"in e.error&&(e.error=e.error.toJSON()),(0,h.oV)(this._eventLog.onEvent(e))}}var _=s(97768),m=s(93637),y=s(6797),g=s(62577),x=s(21325),w=s(44159);function b(e,t){return[e,t]}function v(e,t,s){return e[0]=t,e[1]=s,e}const S=new w.A("0/0/0/0");class I{static create(e,t,s=null){const r=(0,x.Vp)(e.spatialReference),i=t.origin||b(e.origin.x,e.origin.y),n=b(e.size[0]*t.resolution,e.size[1]*t.resolution),o=b(-1/0,-1/0),a=b(1/0,1/0),c=b(1/0,1/0);null!=s&&(v(o,Math.max(0,Math.floor((s.xmin-i[0])/n[0])),Math.max(0,Math.floor((i[1]-s.ymax)/n[1]))),v(a,Math.max(0,Math.floor((s.xmax-i[0])/n[0])),Math.max(0,Math.floor((i[1]-s.ymin)/n[1]))),v(c,a[0]-o[0]+1,a[1]-o[1]+1));const{cols:l,rows:u}=t;let h,d,p,f;return!s&&l&&u&&(v(o,l[0],u[0]),v(a,l[1],u[1]),v(c,l[1]-l[0]+1,u[1]-u[0]+1)),e.isWrappable?(h=b(Math.ceil(Math.round((r.valid[1]-r.valid[0])/t.resolution)/e.size[0]),c[1]),d=!0,p=r.origin,f=r.valid):(h=c,d=!1),new I(t.level,t.resolution,t.scale,i,o,a,c,n,h,d,p,f)}constructor(e,t,s,r,i,n,o,a,c,l,u,h){this.level=e,this.resolution=t,this.scale=s,this.origin=r,this.first=i,this.last=n,this.size=o,this.norm=a,this.worldSize=c,this.wrap=l,this._spatialReferenceOrigin=u,this._spatialReferenceValid=h}normalizeCol(e){if(!this.wrap)return e;const t=this.worldSize[0];return e<0?t-1-Math.abs((e+1)%t):e%t}normalizeKey(e){if(!this.wrap)return;const t=this.worldSize[0],s=e.col;s<0?(e.col=s+t,e.world-=1):s>=t&&(e.col=s-t,e.world+=1)}denormalizeCol(e,t){return this.wrap?this.worldSize[0]*t+e:e}getWorldForColumn(e){return this.wrap?Math.floor(e/this.worldSize[0]):0}getFirstColumnForWorld(e){return e*this.worldSize[0]+this.first[0]}getLastColumnForWorld(e){return e*this.worldSize[0]+this.first[0]+this.size[0]-1}getColumnForX(e){return(e-this.origin[0])/this.norm[0]}getXForColumn(e){const t=this.origin[0]+e*this.norm[0],s=this._spatialReferenceOrigin,r=this._spatialReferenceValid;return this.wrap&&s&&r?t===s[0]?r[0]:this.origin[0]===s[0]&&e===this.worldSize[0]?r[1]:t:t}getRowForY(e){return(this.origin[1]-e)/this.norm[1]}getYForRow(e){return this.origin[1]-e*this.norm[1]}getTileBounds(e,t,s=!1){S.set(t);const r=s?S.col:this.denormalizeCol(S.col,S.world),i=S.row;return function(e,t,s,r,i){e[0]=t,e[1]=s,e[2]=r,e[3]=i}(e,this.getXForColumn(r),this.getYForRow(i+1),this.getXForColumn(r+1),this.getYForRow(i)),e}getTileCoords(e,t,s=!1){S.set(t);const r=s?S.col:this.denormalizeCol(S.col,S.world);return Array.isArray(e)?v(e,this.getXForColumn(r),this.getYForRow(S.row)):(e.x=this.getXForColumn(r),e.y=this.getYForRow(S.row)),e}}var k=s(93687);class T{constructor(){this.spans=[]}static{this.pool=new k.A(()=>new T)}acquire(e){this.lodInfo=e}release(){this.lodInfo=null,this.spans.length=0}*keys(){const e=this.lodInfo;for(const{row:t,colFrom:s,colTo:r}of this.spans)for(let i=s;i<=r;i++){const s=e.getWorldForColumn(i);yield new w.A(e.level,t,e.normalizeCol(i),s)}}forEach(e,t){const{spans:s,lodInfo:r}=this,{level:i}=r;if(0!==s.length)for(const{row:n,colFrom:o,colTo:a}of s)for(let s=o;s<=a;s++)e.call(t,i,n,r.normalizeCol(s),r.getWorldForColumn(s))}}class A{constructor(e,t,s){this.row=e,this.colFrom=t,this.colTo=s}}const M=new w.A("0/0/0/0");class F{static create(e,t){e[1]>t[1]&&([e,t]=[t,e]);const[s,r]=e,[i,n]=t,o=i-s,a=n-r,c=0!==a?o/a:0,l=(Math.ceil(r)-r)*c,u=(Math.floor(r)-r)*c;return new F(s,Math.floor(r),Math.ceil(n),c,o<0?l:u,o<0?u:l,o<0?i:s,o<0?s:i)}constructor(e,t,s,r,i,n,o,a){this.x=e,this.ymin=t,this.ymax=s,this.invM=r,this.leftAdjust=i,this.rightAdjust=n,this.leftBound=o,this.rightBound=a}incrRow(){this.x+=this.invM}getLeftCol(){return Math.max(this.x+this.leftAdjust,this.leftBound)}getRightCol(){return Math.min(this.x+this.rightAdjust,this.rightBound)}}const C=[[0,0],[0,0],[0,0],[0,0]];class P{constructor(e,t=null,s=e.lods[0].level,r=e.lods[e.lods.length-1].level){this.tileInfo=e,this.fullExtent=t,this.scales=[],this._infoByScale={},this._infoByLevel={};const i=e.lods.filter(e=>e.level>=s&&e.level<=r);this.minScale=i[0].scale,this.maxScale=i[i.length-1].scale;const n=this._lodInfos=i.map(s=>I.create(e,s,t));i.forEach((e,t)=>{this._infoByLevel[e.level]=n[t],this._infoByScale[e.scale]=n[t],this.scales[t]=e.scale},this),this._wrap=e.isWrappable}get spatialReference(){return this.tileInfo.spatialReference}get origin(){return this.tileInfo.origin}get size(){return this.tileInfo.size}getLODInfoAt(e){return this._infoByLevel["number"==typeof e?e:e.level]}getTileBounds(e,t,s=!1){M.set(t);const r=this._infoByLevel[M.level];return r?r.getTileBounds(e,M,s):e}getTileCoords(e,t,s=!1){M.set(t);const r=this._infoByLevel[M.level];return r?r.getTileCoords(e,M,s):e}getTileCoverage(e,t=192,s=!0,r="closest"){if(!s&&(e.scale>this.minScale||e.scale<this.maxScale))return null;const i="closest"===r?this.getClosestInfoForScale(e.scale):this.getSmallestInfoForScale(e.scale),n=T.pool.acquire(i),o=this._wrap;let a,c,l,u=1/0,h=-1/0;const d=n.spans;C[0][0]=C[0][1]=C[1][1]=C[3][0]=-t,C[1][0]=C[2][0]=e.size[0]+t,C[2][1]=C[3][1]=e.size[1]+t;for(const t of C)e.toMap(t,t),t[0]=i.getColumnForX(t[0]),t[1]=i.getRowForY(t[1]);const p=[];let f=3;for(let e=0;e<4;e++){if(C[e][1]===C[f][1]){f=e;continue}const t=F.create(C[e],C[f]);u=Math.min(t.ymin,u),h=Math.max(t.ymax,h),void 0===p[t.ymin]&&(p[t.ymin]=[]),p[t.ymin].push(t),f=e}if(null==u||null==h||h-u>100)return null;let _=[];for(a=u;a<h;){null!=p[a]&&(_=_.concat(p[a])),c=1/0,l=-1/0;for(let e=_.length-1;e>=0;e--){const t=_[e];c=Math.min(c,t.getLeftCol()),l=Math.max(l,t.getRightCol())}if(c=Math.floor(c),l=Math.floor(l),a>=i.first[1]&&a<=i.last[1])if(o)if(i.size[0]<i.worldSize[0]){const e=Math.floor(l/i.worldSize[0]);for(let t=Math.floor(c/i.worldSize[0]);t<=e;t++)d.push(new A(a,Math.max(i.getFirstColumnForWorld(t),c),Math.min(i.getLastColumnForWorld(t),l)))}else d.push(new A(a,c,l));else c>i.last[0]||l<i.first[0]||(c=Math.max(c,i.first[0]),l=Math.min(l,i.last[0]),d.push(new A(a,c,l)));a+=1;for(let e=_.length-1;e>=0;e--){const t=_[e];t.ymax>=a?t.incrRow():_.splice(e,1)}}return n}getTileParentId(e){M.set(e);const t=this._infoByLevel[M.level],s=this._lodInfos.indexOf(t)-1;return s<0?null:(this._getTileIdAtLOD(M,this._lodInfos[s],M),M.id)}getTileResolution(e){const t=this._infoByLevel["object"==typeof e?e.level:e];return t?t.resolution:-1}getTileScale(e){const t=this._infoByLevel[e.level];return t?t.scale:-1}intersects(e,t){M.set(t);const s=this._infoByLevel[M.level],r=e.lodInfo;if(r.resolution>s.resolution){this._getTileIdAtLOD(M,r,M);const t=r.denormalizeCol(M.col,M.world);for(const s of e.spans)if(s.row===M.row&&s.colFrom<=t&&s.colTo>=t)return!0}if(r.resolution<s.resolution){const[t,i,n,o]=e.spans.reduce((e,t)=>(e[0]=Math.min(e[0],t.row),e[1]=Math.max(e[1],t.row),e[2]=Math.min(e[2],t.colFrom),e[3]=Math.max(e[3],t.colTo),e),[1/0,-1/0,1/0,-1/0]),a=s.denormalizeCol(M.col,M.world),c=r.getColumnForX(s.getXForColumn(a)),l=r.getRowForY(s.getYForRow(M.row)),u=r.getColumnForX(s.getXForColumn(a+1))-1,h=r.getRowForY(s.getYForRow(M.row+1))-1;return!(c>o||u<n||l>i||h<t)}const i=r.denormalizeCol(M.col,M.world);return e.spans.some(e=>e.row===M.row&&e.colFrom<=i&&e.colTo>=i)}normalizeBounds(e,t,s){if(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],this._wrap){const t=(0,x.Vp)(this.tileInfo.spatialReference),r=-s*(t.valid[1]-t.valid[0]);e[0]+=r,e[2]+=r}return e}getSmallestInfoForScale(e){const t=this.scales;if(this._infoByScale[e])return this._infoByScale[e];if(e>t[0])return this._infoByScale[t[0]];for(let s=1;s<t.length-1;s++)if(e>t[s]+1e-6)return this._infoByScale[t[s-1]];return this._infoByScale[t[t.length-1]]}getClosestInfoForScale(e){const t=this.scales;return this._infoByScale[e]||(e=t.reduce((t,s)=>Math.abs(s-e)<Math.abs(t-e)?s:t,t[0])),this._infoByScale[e]}scaleToLevel(e){const t=this.scales;if(this._infoByScale[e])return this._infoByScale[e].level;for(let s=t.length-1;s>=0;s--)if(e<t[s])return s===t.length-1?this._infoByScale[t[t.length-1]].level:this._infoByScale[t[s]].level+(t[s]-e)/(t[s]-t[s+1]);return this._infoByScale[t[0]].level}scaleToZoom(e){return this.tileInfo.scaleToZoom(e)}zoomToScale(e){return this.tileInfo.zoomToScale(e)}_getTileIdAtLOD(e,t,s){const r=this._infoByLevel[s.level];return e.set(s),t.resolution<r.resolution?null:(t.resolution===r.resolution||(e.level=t.level,e.col=Math.floor(s.col*r.resolution/t.resolution+.01),e.row=Math.floor(s.row*r.resolution/t.resolution+.01)),e)}}var E=s(5482),R=s(69622),O=s(91869),z=s(3483),L=s(91429),D=s(37585),q=s(9775),N=s(32587),B=s(76030),G=s(44794);class j{constructor(e,t){this.item=e,this.controller=t,this.promise=null}}class U{constructor(e){this._schedule=null,this._task=null,this._deferreds=new N.A,this._controllers=new N.A,this._processingItems=new N.A,this._pausedSignal=(0,G.v)(!1),this.concurrency=1,e.concurrency&&(this.concurrency=e.concurrency),this._queue=new q.A(e.peeker),this.process=e.process;const t=e.scheduler;e.priority&&t&&(this._task=t.registerTask(e.priority,this))}destroy(){this.clear(),this._schedule=(0,_.xt)(this._schedule),this._task=(0,_.xt)(this._task)}get updating(){return!!this._task?.updating||this.readyToRun}get length(){return this._processingItems.size+this._queue.length}abort(e){const t=this._controllers.get(e);t&&t.abort()}clear(){this._queue.clear();const e=[];this._controllers.forEach(t=>e.push(t)),this._controllers.clear(),e.forEach(e=>e.abort()),this._processingItems.clear(),this._cancelNext()}forEach(e){this._deferreds.forEach((t,s)=>e(s))}get(e){const t=this._deferreds.get(e);return t?t.promise:void 0}isOngoing(e){return this._processingItems.has(e)}has(e){return this._deferreds.has(e)}pause(){this._pausedSignal.value||(this._pausedSignal.value=!0,this._cancelNext())}push(e,t){const s=this.get(e);if(s)return s;const r=new AbortController;let i=null;t&&(i=(0,a.u7)(t,()=>r.abort()));const n=()=>{o.remove(),null!=i&&i.remove(),this._removeItem(e),this._queue.remove(e),this._scheduleNext()},o=(0,a.NY)(r.signal,()=>{const t=this._processingItems.get(e);t&&t.controller.abort(),n(),c.reject((0,a.NK)())}),c=Promise.withResolvers();return this._deferreds.set(e,c),this._controllers.set(e,r),c.promise.then(n,n),this._queue.push(e),this._scheduleNext(),c.promise}last(){return this._queue.last()}lastPromise(){const e=this.last();return e?this.get(e):null}peek(){return this._queue.peek()}popLast(){const e=this._queue.popLast();return e&&(this._deferreds.get(e)?.reject((0,a.NK)()),this._removeItem(e)),e}reset(){const e=Array.from(this._processingItems.values());this._processingItems.clear();for(const t of e)this._queue.push(t.item),t.controller.abort();this._scheduleNext()}resume(){this._pausedSignal.value&&(this._pausedSignal.value=!1,this._scheduleNext())}takeAll(){const e=[];for(;this._queue.length;)e.push(this._queue.pop());return this.clear(),e}get readyToRun(){return!this._pausedSignal.value&&this._queue.length>0&&this._processingItems.size<this.concurrency}runTask(e){for(;!e.done&&this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop()),e.madeProgress()}_removeItem(e){this._deferreds.delete(e),this._controllers.delete(e),this._processingItems.delete(e)}_scheduleNext(){this._task||this._pausedSignal.value||this._schedule||(this._schedule=(0,B._)(()=>{this._schedule=null,this._next()}))}_next(){for(;this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop())}_cancelNext(){this._schedule&&(this._schedule.remove(),this._schedule=null)}_processResult(e,t){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).resolve(t))}_processError(e,t){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).reject(t))}_canProcessFulfillment(e){return!!this._deferreds.get(e.item)&&this._processingItems.get(e.item)===e}_process(e){if(null==e)return;let t;const s=new AbortController,r=new j(e,s);this._processingItems.set(e,r);try{t=this.process(e,s.signal)}catch(e){this._processError(r,e)}(0,a.$X)(t)?(r.promise=t,t.then(e=>this._processResult(r,e),e=>this._processError(r,e))):this._processResult(r,t)}get test(){}}const V=[0,0];let W=class extends R.A{constructor(e){super(e),this._keyToItem=new Map,this._tilesByScale=new Map,this.concurrency=6}initialize(){const{concurrency:e,process:t,scheduler:s,priority:r}=this;this._queue=new U({concurrency:e,scheduler:s,priority:r,process:(e,s)=>{const r=this._keyToItem.get(e);return t(r,{signal:s})},peeker:e=>this._peek(e)})}destroy(){this.clear(),this._queue=(0,_.pR)(this._queue)}get length(){return this._queue?this._queue.length:0}abort(e){const t="string"==typeof e?e:e.id;this._queue.abort(t)}clear(){this._queue.clear(),this._keyToItem.clear(),this._tilesByScale.clear()}has(e){return"string"==typeof e?this._keyToItem.has(e):this._keyToItem.has(e.id)}pause(){this._queue.pause()}push(e){const t=e.key.id;if(this._queue.has(t))return this._queue.get(t);const s=this._queue.push(t),r=this.tileInfoView.getTileScale(e.key),i=(0,O.tE)(this._tilesByScale,r,()=>new Set),n=()=>{i.delete(e.key),0===i.size&&this._tilesByScale.delete(r),this._keyToItem.delete(t)};return i.add(e.key),this._keyToItem.set(t,e),s.then(n,n),s}reset(){this._queue.reset()}resume(){this._queue.resume()}_peek(e){if(!this.state)return e.values().next().value;const t=new Set;for(const s of e)t.add(this._keyToItem.get(s).key);const s=this.state.scale;let r,i=Number.POSITIVE_INFINITY;for(const[e,n]of this._tilesByScale)if((0,z.bw)(n,e=>t.has(e))){const t=Math.abs(e-s);t<i&&(r=n,i=t)}return this._getClosestTileKey(r,e).id}_getClosestTileKey(e,t){const s=this.tileInfoView,r=this.state.center;let i,n=Number.POSITIVE_INFINITY;for(const o of e)if(t.has(o.id)){s.getTileCoords(V,o);const e=(0,D.Io)(V,r);e<n&&(n=e,i=o)}return i}};(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],W.prototype,"concurrency",void 0),(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],W.prototype,"priority",void 0),(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],W.prototype,"process",void 0),(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],W.prototype,"scheduler",void 0),(0,E.Cg)([(0,L.MZ)()],W.prototype,"state",void 0),(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],W.prototype,"tileInfoView",void 0),W=(0,E.Cg)([(0,L.$K)("esri.views.2d.tiling.TileQueue")],W);var Y=s(19419);new w.A(0,0,0,0),new Map;class ${static{this.byteSizeHint=7*Uint32Array.BYTES_PER_ELEMENT}static{this.estimatedMemory=40}constructor(e,t,s,r,i,n,o){this.instanceId=e,this.textureKey=t,this.indexStart=s,this.indexCount=r,this.vertexStart=i,this.vertexCount=n,this.overlaps=o}updateBaseOffsets(e){this.vertexStart+=e.vertexFrom,this.indexStart+=e.indexFrom}clone(){return new $(this.instanceId,this.textureKey,this.indexStart,this.indexCount,this.vertexStart,this.vertexCount,this.overlaps)}static write(e,t,s,r,i,n,o,a){e.push(t),e.push(s),e.push(r),e.push(i),e.push(n),e.push(o),e.push(a)}serialize(e){return e.push(this.instanceId),e.push(this.textureKey),e.push(this.indexStart),e.push(this.indexCount),e.push(this.vertexStart),e.push(this.vertexCount),e.push(this.overlaps),e}static deserialize(e){const t=e.readInt32(),s=e.readInt32(),r=e.readInt32(),i=e.readInt32(),n=e.readInt32(),o=e.readInt32(),a=e.readInt32();return new $(t,s,r,i,n,o,a)}}function H(e,t){if(null!==t){e.push(t.length);for(const s of t)s.serialize(e);return e}e.push(0)}function Q(e,t,s){const r=e.readInt32(),i=new Array(r);for(let r=0;r<i.length;r++)i[r]=t.deserialize(e,s);return i}class Z{static{this.byteSizeHint=2*Uint32Array.BYTES_PER_ELEMENT+$.byteSizeHint}static estimateMemory(e){return 24+$.estimatedMemory*e}constructor(e,t){this.id=e,this.sortKey=t,this.records=[]}serialize(e){return e.push(this.id),e.writeF32(this.sortKey),H(e,this.records),e}static deserialize(e){const t=e.readInt32(),s=e.readF32(),r=new Z(t,s);return r.records=Q(e,$)??[],r}}class X{get length(){return this._pos}constructor(e,t){this._pos=0;const s=t?this._roundToNearest(t,e.BYTES_PER_ELEMENT):40;this._array=new ArrayBuffer(s),this._buffer=new e(this._array),this._ctor=e,this._i16View=new Int16Array(this._array)}_roundToNearest(e,t){const s=Math.round(e);return 1===t?s:s+(t-s%t)}_ensureSize(e){if(this._pos+e>=this._buffer.length){const t=this._roundToNearest(1.25*(this._array.byteLength+e*this._buffer.BYTES_PER_ELEMENT),this._buffer.BYTES_PER_ELEMENT),s=new ArrayBuffer(t),r=new this._ctor(s);r.set(this._buffer,0),this._array=s,this._buffer=r,this._i16View=new Int16Array(this._array)}}ensureSize(e){this._ensureSize(e)}writeF32(e){this._ensureSize(1);const t=this._pos;return new Float32Array(this._array,4*this._pos,1)[0]=e,this._pos++,t}push(e){this._ensureSize(1);const t=this._pos;return this._buffer[this._pos++]=e,t}writeFixed(e){this._buffer[this._pos++]=e}setValue(e,t){this._buffer[e]=t}i1616Add(e,t,s){this._i16View[2*e]+=t,this._i16View[2*e+1]+=s}getValue(e){return this._buffer[e]}getValueF32(e){return new Float32Array(this._array,4*e,1)[0]}incr(e){if(this._buffer.length<e)throw new Error("Increment index overflows the target buffer");this._buffer[e]++}decr(e){this._buffer[e]--}writeRegion(e){this._ensureSize(e.length);const t=this._pos;return this._buffer.set(e,this._pos),this._pos+=e.length,t}writeManyFrom(e,t,s){this._ensureSize(s-t);for(let r=t;r!==s;r++)this.writeFixed(e._buffer[r])}buffer(){const e=this._array.slice(0,4*this._pos);return this.destroy(),e}toArray(){return[...this._buffer]}seek(e){this._pos=e}destroy(){this._array=null,this._buffer=null}}class K{constructor(e,t,s=0){const r=6*s*Uint32Array.BYTES_PER_ELEMENT,i=4*s*t.stride,n=t.stride/4,o=t.attributes.find(e=>"pos"===e.name||"position"===e.name);if(!o)throw new Error("InternalError: Unable to find position attribute");this.layout={...t,position:o},this._indices=new X(Uint32Array,r),this._vertices=new X(Uint32Array,i),this._metrics=new X(Uint32Array,0),this._metricCountOffset=this._metrics.push(0),this._strideInt=n,this._instanceId=e}serialize(e){const t=this._indices.buffer(),s=this._vertices.buffer(),r=this._metrics.length?this._metrics.buffer():null;return e.push(t,s),{instanceId:this._instanceId,layout:this.layout,indices:t,vertices:s,metrics:r}}get strideInt(){return this._strideInt}get vertexCount(){return this._vertices.length/this._strideInt}get indexCount(){return this._indices.length}get indexWriter(){return this._indices}get vertexWriter(){return this._vertices}get metricWriter(){return this._metrics}vertexEnsureSize(e){this._vertices.ensureSize(e)}indexEnsureSize(e){this._indices.ensureSize(e)}writeIndex(e){this._indices.push(e)}writeVertex(e){this._vertices.push(e)}writeVertexRegion(e){this._vertices.writeRegion(e)}writeVertexF32(e){this._vertices.writeF32(e)}writeMetric(e){this._metrics.incr(this._metricCountOffset),e.serialize(this._metrics)}}class J{constructor(e,t=0){this._id=e,this._sizeHint=t,this._entityRecordCountOffset=0,this._entityCountOffset=0,this._entityIdIndex=0,this._entitySortKeyIndex=0,this._didEntityStart=!1,this._instanceIdToVertexData=new Map,this._recordIndexStart=0,this._recordIndexCount=0,this._recordVertexStart=0,this._recordVertexCount=0,this._current={metric:null,writer:null,start:0,sortKey:0,instanceId:0,layoutHash:0,indexStart:0,vertexStart:0,textureKey:0,metricBoxLenPointer:0},this._requiresRefresh=!1,this._entities=new X(Uint32Array,this._sizeHint*Z.byteSizeHint),this._entityCountOffset=this._entities.push(0)}get id(){return this._id}serialize(){const e=new Array,t=[],s=this._entities.buffer();for(const s of this._instanceIdToVertexData.values())t.push(s.serialize(e));return{message:{data:t,entities:s},transferList:e}}get requiresRefresh(){return this._requiresRefresh}set requiresRefresh(e){this._requiresRefresh=e}vertexStart(){return this._current.vertexStart??0}vertexCount(){return this._current.writer?.vertexCount??0}indexCount(){return this._current.writer?.indexCount??0}vertexEnsureSize(e){this._current.writer.vertexEnsureSize(e)}indexEnsureSize(e){this._current.writer.indexEnsureSize(e)}vertexWrite(e){this._current.writer.writeVertex(e)}vertexWriteRegion(e){this._current.writer.writeVertexRegion(e)}vertexWriteF32(e){this._current.writer.writeVertexF32(e)}recordBounds(e,t,s,r){}indexWrite(e){this._current.writer.writeIndex(e)}metricStart(e){this._current.metric=e,this._current.metric.recordStart=this.recordCount()}metricEnd(){const e=this._current.writer;this._current.metric&&(this._current.metric.recordCount=this.recordCount()-this._current.metric.recordStart),this._current.metric?.bounds.length&&this._current.metric?.recordCount?(e.writeMetric(this._current.metric),this._current.metric=null):this._current.metric=null}metricBoxWrite(e){this._current.metric.bounds.push(e)}entityStart(e,t=e){this._entityIdIndex=this._entities.push(e),this._entitySortKeyIndex=this._entities.writeF32(t),this._entityRecordCountOffset=this._entities.push(0),this._didEntityStart=!0}entityRecordCount(){return this._entities.getValue(this._entityRecordCountOffset)}entityEnd(){this._didEntityStart&&(0===this.entityRecordCount()?this._entities.seek(this._entityIdIndex):this._entities.incr(this._entityCountOffset),this._didEntityStart=!1)}recordCount(){return this._entities.getValue(this._entityRecordCountOffset)}recordStart(e,t,s=0){this._current.writer=this._getVertexWriter(e,t),this._current.indexStart=this._current.writer.indexCount,this._current.vertexStart=this._current.writer.vertexCount,this._current.instanceId=e,this._current.layoutHash=t.hash,this._current.textureKey=s}recordEnd(e=0){const t=this._current.vertexStart,s=this._current.writer.vertexCount-t;if(!s)return!1;const r=this._current.indexStart,i=this._current.writer.indexCount-r;return this._recordIndexStart=r,this._recordIndexCount=i,this._recordVertexStart=t,this._recordVertexCount=s,this._entities.incr(this._entityRecordCountOffset),$.write(this._entities,this._current.instanceId,this._current.textureKey,r,i,t,s,e),!0}copyLast(e,t){const s=this._recordVertexStart+this._recordVertexCount;this._entities.incr(this._entityRecordCountOffset),$.write(this._entities,this._current.instanceId,this._current.textureKey,this._recordIndexStart+this._recordIndexCount,this._recordIndexCount,s,this._recordVertexCount,0);const r=this._current.writer.indexWriter,i=this._current.writer.vertexWriter,n=this._recordIndexStart+this._recordIndexCount,o=this._recordVertexCount;for(let e=this._recordIndexStart;e!==n;e++){const t=r.getValue(e);r.push(t+o)}const a=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,c=this._recordVertexStart*a,l=(this._recordVertexStart+this._recordVertexCount)*a;for(let e=c;e!==l;e++){const t=i.getValue(e);i.push(t)}const u=this._current.writer.layout.position,h=u.packPrecisionFactor??1,d=u.offset/Uint32Array.BYTES_PER_ELEMENT,p=e*h,f=t*h;for(let e=s*a;e<=i.length;e+=a)i.i1616Add(e+d,p,f)}copyLastFrom(e,t,s){const r=e._entities.getValue(e._entityIdIndex);if(r!==this._entities.getValue(this._entityIdIndex)){const t=e._entities.getValueF32(e._entitySortKeyIndex);this.entityStart(r,t)}this.recordStart(e._current.instanceId,e._current.writer.layout,e._current.textureKey);const i=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,n=this._current.vertexStart,o=e._current.vertexStart-n,a=this._current.writer.indexWriter,c=this._current.writer.vertexWriter,l=e._current.writer.indexWriter,u=e._current.writer.vertexWriter;for(let t=e._current.indexStart;t!==l.length;t++){const e=l.getValue(t);a.push(e-o)}for(let t=e._current.vertexStart*i;t!==u.length;t++){const e=u.getValue(t);c.push(e)}const h=this._current.writer.layout.position,d=h.packPrecisionFactor??1,p=h.offset/Uint32Array.BYTES_PER_ELEMENT,f=t*d,_=s*d;for(let e=n*i;e<=c.length;e+=i)c.i1616Add(e+p,f,_);this.recordEnd()}_getVertexWriter(e,t){const s=this._instanceIdToVertexData;return s.has(e)||s.set(e,new K(e,t,this._sizeHint)),s.get(e)}}function ee(e){switch(e){case 1:case 8:case 32:return-1;case 2:case 64:return 0;case 4:case 16:case 128:return 1}}function te(e){switch(e){case 1:case 2:case 4:return-1;case 8:case 16:return 0;case 32:case 64:case 128:return 1}}class se{constructor(e,t,s,r,i=0){this.tileKey=e,this._bufferingEnabled=t,this._sizeHint=i,this._meshes={self:new J(this.id,this._sizeHint),neighbors:new Array},this._currentRecordOverlaps=0,this._currentEntityOverlaps=0;const n=r?1:0;this._copyBufferedDataIntoSelf=s&&this._bufferingEnabled&&e.level===n}get id(){return this.tileKey.id}get requiresRefresh(){return this._meshes.self.requiresRefresh||this._meshes.neighbors.some(e=>e.requiresRefresh)}set requiresRefresh(e){this._meshes.self.requiresRefresh=e}vertexStart(){return this._meshes.self.vertexStart()??0}vertexCount(){return this._meshes.self.vertexCount()}indexCount(){return this._meshes.self.indexCount()}indexEnsureSize(e){this._meshes.self.indexEnsureSize(e)}entityStart(e,t=e){this._currentEntityOverlaps=0,this._meshes.self.entityStart(e,t)}entityRecordCount(){return this._meshes.self.entityRecordCount()}entityEnd(){if(this._meshes.self.entityEnd(),this._bufferingEnabled){if(this._copyBufferedDataIntoSelf)return;for(let e=0;e<8;e++){const t=1<<e;this._currentEntityOverlaps&t&&this._meshes.neighbors[e].entityEnd()}}}recordStart(e,t,s){this._currentRecordOverlaps=0,this._meshes.self.recordStart(e,t,s)}recordEnd(e=0){const t=this._meshes.self.recordEnd(this._currentRecordOverlaps);return t&&0!==this._currentRecordOverlaps?(this._copyIntoNeighbors(),this._currentEntityOverlaps|=this._currentRecordOverlaps,!0):t}recordBounds(e,t,s,r){this._bufferingEnabled&&this._addOverlap(e,t,s,r)}recordCount(){return this._meshes.self.recordCount()}metricStart(e){this._meshes.self.metricStart(e)}metricBoxWrite(e){this._meshes.self.metricBoxWrite(e)}metricEnd(){this._meshes.self.metricEnd()}vertexWrite(e){this._meshes.self.vertexWrite(e)}vertexWriteF32(e){this._meshes.self.vertexWriteF32(e)}vertexWriteRegion(e){this._meshes.self.vertexWriteRegion(e)}indexWrite(e){this._meshes.self.indexWrite(e)}serialize(e){const t={message:[],transferList:[]},s=this._meshes.self.serialize();return t.message.push({tileId:this.tileKey.id,requiresRefresh:this.requiresRefresh,...s.message}),t.transferList.push(...s.transferList),this._meshes.neighbors.forEach((s,r)=>{const i=s.serialize(),n=1<<r,o=ee(n),a=te(n),c=new w.A(this.tileKey).getNormalizedNeighbor(o,a,e);t.message.push({tileId:c.id,requiresRefresh:this.requiresRefresh,...i.message}),t.transferList.push(...i.transferList)}),t}_addOverlap(e,t,s,r){const i=Math.min(p.CQ/2,s),n=Math.min(p.CQ/2,r),o=255^((e<0+i?148:e>=p.CQ-i?41:189)|(t<0+n?224:t>=p.CQ-n?7:231));this._currentRecordOverlaps|=o}_copyIntoNeighbors(){for(let e=0;e<8;e++){const t=1<<e;if(this._currentRecordOverlaps&t){if(this._copyBufferedDataIntoSelf){const e=-ee(t)*p.CQ,s=-te(t)*p.CQ;if(0!==s)continue;this._meshes.self.copyLast(e,s);continue}if(!this._meshes.neighbors[e]){const s=Math.floor(this._sizeHint/16);this._meshes.neighbors[e]=new J(t,s)}const s=this._meshes.neighbors[e],r=-ee(t)*p.CQ,i=-te(t)*p.CQ;s.copyLastFrom(this._meshes.self,r,i)}}}}class re{}var ie=s(72691),ne=s(73681);class oe{constructor(){this._defaultResult=null,this._backgroundFillResult=null}static async from(e,t){const s=new oe;return s.setDefault(await e.createMeshWriters(t.meshes)),s}size(){return 1}getDefault(){return this._defaultResult}setDefault(e){this._defaultResult=e}getBackgroundFill(){return this._backgroundFillResult}setBackgroundFill(e){this._backgroundFillResult=e}hasArcadeDependency(e){return this._defaultResult?.some(t=>t.hasArcadeDependency(e))??!1}match(e,t,s){const r=this.doMatch(e,t)||this.getDefault();if(r&&r.length>0){const e=this.getBackgroundFill();if(e)return[...e,...r]}return r}getSortKey(e,t){return 0}doMatch(e,t){return null}async fetchResources(e,t){}}class ae extends oe{static async fromDictionaryRenderer(e,t){const s=await ne.n.from(t.dictionaryInfo,t.userConfig,t.fieldMap);return new ae(e,s)}constructor(e,t){super(),this._context=e,this._evaluator=t,this._controlStringToPromise=new Map,this._controlStringToGroup=new Map}async fetchResources(e,t){const s=t.getCursor(),r=new Set;for(;s.next();){const e=this._evaluateControlString(s);e&&r.add(e)}const i=Array.from(r.values()).map(t=>this._ensureGroup(e,t));await Promise.all(i)}match(e,t){const s=this._evaluateControlString(e);return s?this._controlStringToGroup.get(s):null}_evaluateControlString(e){const t=e.readLegacyFeatureWorldSpace();return this._evaluator.evaluate(t,0,e.fields,null)}_ensureGroup(e,t){let s=this._controlStringToPromise.get(t);return null==s&&(s=this._fetchGroup(e,t),this._controlStringToPromise.set(t,s)),s}async _fetchGroup(e,t){const s=await e.fetchDictionaryResourceImmediate({type:"dictionary-request",controlString:t});if(!s)return;const r=await this._context.createMeshWriters(s.meshes);this._controlStringToGroup.set(t,r)}}class ce extends oe{constructor(e,t){super(),this._intervals=[],this._isMaxInclusive=t,this._field=e}static async fromIntervalSchema(e,t){const s=await e.storage.createComputedField(t),r=new ce(s,t.isMaxInclusive);await Promise.all(t.intervals.map(async t=>{const s=[...await e.createMeshWriters(t.meshes),...await e.createMeshWriters(t.alternateMeshes)];r.add(t,s)}));const i=await e.createMeshWriters(t.defaultSymbol);r.setDefault(i);const n=await e.createMeshWriters(t.backgroundFill);return r.setBackgroundFill(n),r}add(e,t){this._intervals.push({interval:e,result:t}),this._intervals.sort((e,t)=>e.interval.min-t.interval.min)}size(){return super.size()+this._intervals.length}hasArcadeDependency(e){return this._field?.hasArcadeDependency(e)||this._intervals.some(t=>t.result.some(t=>t.hasArcadeDependency(e)))}doMatch(e,t){const s=this._field?.read(e,t);if(null==s||isNaN(s)||s===1/0||s===-1/0)return null;for(let e=0;e<this._intervals.length;e++){const{interval:t,result:r}=this._intervals[e],i=s>=t.min,n=this._isMaxInclusive?s<=t.max:s<t.max;if(i&&n)return r}return null}}class le extends oe{static async fromLabelSchema(e,t){const s=t.classes.map(async t=>{const s=await e.createMeshWriters(t.meshes);return{minScale:t.minScale,maxScale:t.maxScale,meshes:s,expression:null,where:await e.storage.createWhereClause(t.where)}}),r=await Promise.all(s);return new le(r)}constructor(e){super(),this._labels=e}match(e,t,s){if(!this._labels.length)return null;const r=this._getLabels(t.$view.scale),i=[];for(const t of r)t.where&&!t.where(e,s)||i.push(...t.meshes);return i}hasArcadeDependency(e){return this._labels.some(t=>t.meshes.some(t=>t.hasArcadeDependency(e)))}_getLabels(e){return this._labels.filter(t=>this._validForTileScale(t,e))}_validForTileScale(e,t){const s=t-t/4,r=t+t/2;return(!e.minScale||e.minScale>=s)&&(!e.maxScale||e.maxScale<=r)}}class ue extends oe{constructor(e,t){super(),this._defaultSymbolSortKey=0,this._nullResult=null,this._resultsMap=new Map,this._fields=[],this._fields=e,this._separator=t||""}static async fromMatcherSchema(e,t){const s=t.expression?[e.storage.createComputedField({expression:t.expression})]:[t.field?e.storage.createComputedField({field:t.field}):null,t.field2?e.storage.createComputedField({field:t.field2}):null,t.field3?e.storage.createComputedField({field:t.field3}):null],r=(await Promise.all(s)).filter(e=>!!e),i=new ue(r,t.fieldDelimiter),n=await e.createMeshWriters(t.defaultSymbol);i.setDefault(n);const o=await e.createMeshWriters(t.backgroundFill);return i.setBackgroundFill(o),await Promise.all(t.map.map(async(t,s)=>{const r=[...await e.createMeshWriters(t.meshes),...await e.createMeshWriters(t.alternateMeshes)];"<Null>"===t.value?i.setNullResult(r):i.add(t.value,r,s+1)})),i}setNullResult(e){this._nullResult=e}getSortKey(e,t){const s=this._getValueFromFields(e,t);if(null==s||""===s||"<Null>"===s)return 0;const r=this._resultsMap.get(s.toString());return r?r.sortKey:this._defaultSymbolSortKey}add(e,t,s){this._resultsMap.set(e.toString(),{meshWriters:t,sortKey:s}),this._defaultSymbolSortKey=Math.max(this._defaultSymbolSortKey,s+1)}size(){return super.size()+this._resultsMap.size}hasArcadeDependency(e){return this._fields.some(t=>t.hasArcadeDependency(e))||[...this._resultsMap.values()].some(t=>t.meshWriters.some(t=>t.hasArcadeDependency(e)))||this._nullResult?.some(t=>t.hasArcadeDependency(e))||!1}doMatch(e,t){const s=this._getValueFromFields(e,t);if(null!==this._nullResult&&(null==s||""===s||"<Null>"===s))return this._nullResult;if(null==s)return null;const r=s.toString();return this._resultsMap.get(r)?.meshWriters}_getValueFromFields(e,t){const s=[];for(const r of this._fields){const i=r.read(e,t);null==i||""===i?s.push("<Null>"):s.push(i)}return s.join(this._separator)}}async function he(e,t){switch(t.type){case"simple":case"heatmap":case"dot-density":case"pie-chart":return oe.from(e,t);case"interval":return ce.fromIntervalSchema(e,t);case"dictionary":return ae.fromDictionaryRenderer(e,t);case"label":return le.fromLabelSchema(e,t);case"map":return ue.fromMatcherSchema(e,t);case"subtype":return de.fromSubtypes(e,t);case"cluster":return pe.fromClusterSchema(e,t);case"track":return fe.fromTrackSchema(e,t);default:throw new Error("Impl")}}class de extends oe{constructor(e,t){super(),this._subMatchers=e,this._subtypeField=t}static async fromSubtypes(e,t){const s=new Map,r=[];for(const i in t.renderers){const n=parseInt(i,10),o=he(e,t.renderers[i]).then(e=>s.set(n,e));r.push(o)}return await Promise.all(r),new de(s,t.subtypeField)}match(e,t,s){const r=e.readAttribute(this._subtypeField),i=this._subMatchers.get(r);return i?i.match(e,t,s):null}hasArcadeDependency(e){for(const t of this._subMatchers.values())if(t.hasArcadeDependency(e))return!0;return!1}}class pe extends oe{static async fromClusterSchema(e,t){const[s,r]=await Promise.all([he(e,t.feature),he(e,t.cluster)]);return new pe(s,r)}constructor(e,t){super(),this._featureMatcher=e,this._clusterMatcher=t}match(e,t,s){return 1===e.readAttribute("cluster_count")?this._featureMatcher.match(e,t,s):this._clusterMatcher.match(e,t,s)}hasArcadeDependency(e){return this._featureMatcher.hasArcadeDependency(e)||this._clusterMatcher.hasArcadeDependency(e)}}class fe extends oe{static async fromTrackSchema(e,t){const[s,r,i]=await Promise.all([he(e,t.previousObservation),he(e,t.latestObservation),he(e,t.trackLine)]);return new fe(s,r,i)}constructor(e,t,s){super(),this._previousObservationMatcher=e,this._latestObservationMatcher=t,this._trackLineMatcher=s}match(e,t,s){switch(e.readAttribute(ie.EA)){case 0:return this._trackLineMatcher.match(e,t,s);case 1:return this._latestObservationMatcher.match(e,t,s);case 2:return this._previousObservationMatcher.match(e,t,s)}return null}hasArcadeDependency(e){return this._trackLineMatcher.hasArcadeDependency(e)||this._latestObservationMatcher.hasArcadeDependency(e)||this._previousObservationMatcher.hasArcadeDependency(e)}}class _e extends re{static async create(e,t){const s=await he(e,t.symbology),r=t.labels?await he(e,t.labels):null;return new _e(s,r)}constructor(e,t){super(),this._symbology=e,this._labels=t}destroy(){}async enqueueMatcherRequests(e,t){await Promise.all([this._symbology.fetchResources(e,t),this._labels?.fetchResources(e,t)])}enqueueWriterRequests(e,t,s,r){const i=this._symbology.match(t,s,r);if(i){for(const r of i)r.enqueueRequest(e,t,s);if(this._labels){const i=this._labels.match(t,s,r);if(!i)return;for(const r of i)r.enqueueRequest(e,t,s)}}}write(e,t,s,r,i,n,o){const a=this._symbology.match(s,r,i);if(a){for(const i of a)i.write(e,t,s,r,n);if(e.entityRecordCount()>=1&&this._labels){const c=this._labels.match(s,r,i);if(!c)return;for(const i of c)i.setReferences(a),i.write(e,t,s,r,n,o)}}}getSortKey(e,t){return this._symbology.getSortKey(e,t)}hasArcadeDependency(e){return!(!this._symbology.hasArcadeDependency(e)&&!this._labels?.hasArcadeDependency(e))}}var me=s(799);class ye{}class ge extends ye{constructor(e){super(),this._fetcher=e,this._controller=new AbortController,this._pendingRequests=new Map,this._resourceIdToResource=new Map}destroy(){this._controller.abort()}get _abortOptions(){return{signal:this._controller.signal}}enqueueRequest(e){const t=function(e){return"url"in e&&"urlHash"in e?{...e,url:""}:e}(e.resource),s=(0,me.xq)(JSON.stringify(t));return this._pendingRequests.has(s)||this._pendingRequests.set(s,e),s}async fetchEnqueuedResources(){const e=Array.from(this._pendingRequests.entries()),t=e.map(e=>e[1]);if(0===t.length)return;const s=await this._fetcher.fetch(t,this._abortOptions);for(let t=0;t<s.length;t++){const r=e[t][0];this._resourceIdToResource.set(r,s[t])}this._pendingRequests.clear()}async fetchResourceImmediate(e){const t=await this._fetcher.fetch([e]);if(1!==t.length)throw new Error("FeaturePipelineResourceProxy: failed to fetch resources");return t[0]}async fetchDictionaryResourceImmediate(e){const t=await this._fetcher.fetchDictionary([e]);if(1!==t.length)throw new Error("FeaturePipelineResourceProxy: failed to fetch dictionary resources");return t[0]}getResource(e){return this._resourceIdToResource.get(e)}}var xe=s(36745),we=s(35521),be=s(92580);class ve{static getPlacement(e,t,s,r,i){const n=(0,be.c)(s);return n?(-1===t&&e.invertY(),n.execute(e,s,r,i)):null}}var Se=s(68197),Ie=s(53966);function ke(e,t){return[!!e?.minScale&&t.scaleToZoom(e.minScale)||0,!!e?.maxScale&&t.scaleToZoom(e.maxScale)||100]}function Te(e){return 1<<e}function Ae(e){let t=0;for(const[s,r]of e)r&&(t|=1<<s);return t}function Me(e){let t;if(!e)return[0,0,0,0];if("string"==typeof e){const s=Se.A.fromString(e);if(!s)return Ie.A.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.meshWriterUtils").errorOnce(new r.A("mapview:mesh-processing","Unable to parse string into color",{color:e})),[0,0,0,0];t=s.toArray()}else t=e;const[s,i,n,o]=t;return[s*(o/255),i*(o/255),n*(o/255),o]}function Fe(e){switch(e){case"butt":case"Butt":return 0;case"round":case"Round":return 1;case"square":case"Square":return 2}}function Ce(e){switch(e){case"bevel":case"Bevel":return 0;case"miter":case"Miter":return 2;case"round":case"Round":return 1}}function Pe(e,t){return Math.round(Math.min(Math.sqrt(e*t),255))}function Ee(e,t){return Math.round(e*t)/t}const Re=0,Oe=1,ze=2,Le=3,De=4,qe=5;var Ne=s(35833),Be=s(93397),Ge=s(51118);class je{static executeEffects(e,t,s){let r=new Ne.kT(t);for(const t of e){const e=(0,be.A)(t);e&&(r=e.execute(r,t,s))}return r}static applyEffects(e,t){if(!e)return t;const s={geomUnitsPerPoint:1,tileKey:null,maxInflateSize:(0,Be.ll)(e),scale:null,spatialReference:null,preventClipping:!1};let r,i=new Ne.kT(xe.z.fromJSONCIM(t));for(const t of e){const e=(0,be.A)(t);e&&(i=e.execute(i,t,s))}const n=[];let o=null;for(;r=i.next();)n.push(...(0,Ge.x)(r)),o=r.geometryType;return 0===n.length||null===o?null:"esriGeometryPolygon"===o?{rings:n}:{paths:n}}}var Ue=s(89518),Ve=s(68572),We=s(63907);class Ye{static fromVertexSpec(e,t){const s=Ve.q.fromVertexSpec(e,t);return new Ye(s)}constructor(e){this._spec=e,this._packed=new Uint8Array(this._spec.stride*this._spec.packVertexCount),this._packedU32View=new Uint32Array(this._packed.buffer),this._dataView=new DataView(this._packed.buffer)}get attributeLayout(){return this._spec.attributeLayout}get stride(){return this._spec.stride}writeVertex(e,t,s,r,i,n){for(let e=0;e<this._spec.packVertexCount;e++){const o=e*this._spec.stride;this._packPosition(s,r,o),this._packId(t,o);const a=this._spec.bitset;if(n){if(a.packTessellation){const e=a.packTessellation(n,i,s,r);this._pack(e,a,o)}for(const e of this._spec.standardAttributes)if(null!=e.packTessellation){const t=e.packTessellation(n,i,s,r);this._pack(t,e,o)}else if(e.packAlternating?.packTessellation){const t=e.packAlternating.packTessellation(n,i,s,r);for(let s=0;s<this._spec.packVertexCount;s++){const r=t[s];this._pack(r,e,s*this._spec.stride)}}}}e.vertexWriteRegion(this._packedU32View)}pack(e,t){for(const s of this._spec.standardAttributes)if(s.pack&&"string"!=typeof s.pack){const r=s.pack(e,t);for(let e=0;e<this._spec.packVertexCount;e++)this._pack(r,s,e*this._spec.stride)}else if(s.packAlternating?.pack){const r=s.packAlternating.pack(e,t);for(let e=0;e<this._spec.packVertexCount;e++){const t=r[e];this._pack(t,s,e*this._spec.stride)}}}_packPosition(e,t,s){const{offset:r}=this._spec.position,i=this._spec.position.packPrecisionFactor??1,n=(0,Ue.M9)(e*i,t*i);this._dataView.setUint32(s+r,n,!0)}_packId(e,t){const s=e*(this._spec.id.packPrecisionFactor??1),r=4278190080&this._dataView.getUint32(t+this._spec.id.offset,!0);this._dataView.setUint32(t+this._spec.id.offset,s|r,!0)}_pack(e,t,s){!function(e,t,s,r){const i=s.packPrecisionFactor??1;switch(s.type){case We.pe.BYTE:if(1===s.count)e.setInt8(r+s.offset,t*i);else for(let n=0;n<s.count;n++){const o=n*Int8Array.BYTES_PER_ELEMENT;e.setInt8(r+s.offset+o,t[n]*i)}break;case We.pe.UNSIGNED_BYTE:if(1===s.count)e.setUint8(r+s.offset,t*i);else for(let n=0;n<s.count;n++){const o=n*Uint8Array.BYTES_PER_ELEMENT;e.setUint8(r+s.offset+o,t[n]*i)}break;case We.pe.SHORT:if(1===s.count)e.setInt16(r+s.offset,t*i,!0);else for(let n=0;n<s.count;n++){const o=n*Int16Array.BYTES_PER_ELEMENT;e.setInt16(r+s.offset+o,t[n]*i,!0)}break;case We.pe.UNSIGNED_SHORT:if(1===s.count)e.setUint16(r+s.offset,t*i,!0);else for(let n=0;n<s.count;n++){const o=n*Uint16Array.BYTES_PER_ELEMENT;e.setUint16(r+s.offset+o,t[n]*i,!0)}break;case We.pe.INT:if(1===s.count)e.setInt32(r+s.offset,t*i,!0);else for(let n=0;n<s.count;n++){const o=n*Int32Array.BYTES_PER_ELEMENT;e.setInt32(r+s.offset+o,t[n]*i,!0)}break;case We.pe.UNSIGNED_INT:if(1===s.count)e.setUint32(r+s.offset,t*i,!0);else for(let n=0;n<s.count;n++){const o=n*Uint32Array.BYTES_PER_ELEMENT;e.setUint32(r+s.offset+o,t[n]*i,!0)}break;case We.pe.FLOAT:if(1===s.count)e.setFloat32(r+s.offset,t*i,!0);else for(let n=0;n<s.count;n++){const o=n*Float32Array.BYTES_PER_ELEMENT;e.setFloat32(r+s.offset+o,t[n]*i,!0)}break;case We.pe.HALF_FLOAT:if(1===s.count)e.setUint16(r+s.offset,(0,Ue.fw)(t*i),!0);else for(let n=0;n<s.count;n++){const o=n*Uint16Array.BYTES_PER_ELEMENT;e.setUint16(r+s.offset+o,(0,Ue.fw)(t[n]*i),!0)}}}(this._dataView,e,t,s)}}const $e=96/72;class He{constructor(e,t,s,r){this._instanceId=e,this._evaluator=t,this._enabledOptionalAttributes=s,this._viewParams=r,this._evaluator.evaluator=e=>this.vertexSpec.createComputedParams(e)}get _vertexPack(){if(!this._cachedVertexPack){const e=Ye.fromVertexSpec(this.vertexSpec,this._enabledOptionalAttributes);this._evaluator.hasDynamicProperties||e.pack(this._evaluator.evaluatedMeshParams,this._viewParams),this._cachedVertexPack=e}return this._cachedVertexPack}get evaluatedMeshParams(){return this._evaluator.evaluatedMeshParams}get hasEffects(){return!!this.evaluatedMeshParams.effects}get effectInfos(){return this._evaluator.inputMeshParams.effects?.effectInfos}get placementInfo(){return this._evaluator.inputMeshParams.placement}get instanceId(){return this._instanceId}get attributeLayout(){return this._vertexPack.attributeLayout}get _preventEffectClipping(){return!1}setReferences(e){this._references=e}getBoundsInfo(){return null}getTileInfo(){return this._viewParams.tileInfo}async loadDependencies(){for(const{effect:e}of this.effectInfos||[])await(0,Ne.ai)(e);this.placementInfo&&await(0,Ne.g1)(this.placementInfo.placement)}enqueueRequest(e,t,s){this._evaluator.hasDynamicProperties&&this._evaluator.enqueueRequest(e,t,s)}write(e,t,s,r,i,n){this.ensurePacked(t,s,r);const o=e.id||"",a=this.evaluatedMeshParams.effects,c=this._createEffectExecutionContext(s,r,o),l={target:s,options:r,level:i,viewExtent:n};if(!a||0===a.length)return void this._write(e,l);const u=this.getEffectCursor(s,a,c);if(!u)return;let h;for(;h=u.next();)h.invertY(),this._write(e,{...l,effectGeometry:h})}ensurePacked(e,t,s){if(!this._evaluator.hasDynamicProperties)return;const r=this._evaluator.evaluateMeshParams(e,t,s);this._vertexPack.pack(r,this._viewParams)}hasArcadeDependency(e){return this._evaluator.hasArcadeDependency(e)}_writeVertex(e,t,s,r,i){const n=this.evaluatedMeshParams;this._vertexPack.writeVertex(e,t,s,r,n,i)}_createEffectExecutionContext(e,t,s){return{geomUnitsPerPoint:$e,maxInflateSize:(0,Be.ll)(this.evaluatedMeshParams.effects),scale:t.$view.scale,spatialReference:e.metadata.outSpatialReference??e.metadata.spatialReference,preventClipping:this._preventEffectClipping,tileKey:s}}getEffectCursor(e,t,s){const r=e.readGeometryForDisplay()?.clone();if(!r)return;const i=xe.z.fromOptimizedCIM(r,e.geometryType);return i.invertY(),je.executeEffects(t,i,s)}}class Qe extends He{}var Ze=s(13195);function Xe(e,t){let s;if("string"==typeof e)s=(0,me.Wm)(e+`-seed(${t})`);else{let r=12;s=e^t;do{s=107*(s>>8^s)+r|0}while(0!==--r)}return(1+s/(1<<31))/2}function Ke(e){return Math.floor(Xe(e,Je)*et)}const Je=53290320,et=10;class tt{generateSource(e){const t=[];for(let s=1;s<this.length;s++)t.push(`vec4 atom${s} = texture(${e.animationTexture}, (pointer + 0.5) / size);`),t.push("pointer.x += 1.0;");for(let e=0;e<this.ins;e++)t.push("top--;"),t.push(`vec4 in${this.ins-e-1} = stack[top];`);for(let e=0;e<this.outs;e++)t.push(`vec4 out${e};`);const{microcode:s}=this;for(const e of s)t.push(e);for(let e=0;e<this.outs;e++)t.push(`stack[top] = out${e};`),t.push("top++;"),t.push(`if (top >= ${lt}) { top = ${lt-1}; }`);return t}}let st=128;function rt(e){return[`float duration = clamp(${e.duration}, 0.05, 3600.0);`,`float startTimeOffset = ${e.startTimeOffset};`,`float repeatDelay = ${e.repeatDelay};`,`float timeOriginSelector = ${e.timeOriginSelector};`,`float repeatType = ${e.repeatType};`,`float easing = ${e.easing};`,`float playAnimation = ${e.playAnimation} * (1.0 - step(0.0, -${e.duration}));`,`float reverseAnimation = ${e.reverseAnimation};`,"float time = globalTime - (timeOriginSelector == 1.0 ? localTimeOrigin : 0.0);","time *= playAnimation;","time *= 1.0 - reverseAnimation * 2.0;","float period = duration + repeatDelay;","time += reverseAnimation == 1.0 ? (period - startTimeOffset - 0.001) : startTimeOffset + 0.001;","float omega = time / period;","float oi = floor(omega);","omega = repeatType == 1.0 || repeatType == 3.0 ? omega - oi : omega;","float of = omega * period;","of = (clamp(of, reverseAnimation * repeatDelay, period - (1.0 - reverseAnimation) * repeatDelay) - reverseAnimation * repeatDelay) / duration;","of = easing == 2.0 ? pow(of, 3.0) : of;","of = easing == 3.0 ? 1.0 - pow(1.0 - of, 3.0) : of;","of = easing == 4.0 ? of < 0.5 ? 4.0 * pow(of, 3.0) : 1.0 - pow(-2.0 * of + 2.0, 3.0) / 2.0 : of;","bool oscillate = repeatType == 3.0 && mod(oi, 2.0) == 1.0;",`${e.out} = oscillate ? 1.0 - of : of;`]}const it={Linear:1,EaseIn:2,EaseOut:3,EaseInOut:4},nt={Loop:1,None:2,Oscillate:3},ot={Local:1,Global:2};function at(e){const t=it[e.easing],s=nt[e.repeatType],r=ot[e.timeOriginSelector];return[[e.duration,e.startTimeOffset,e.repeatDelay,r],[s,t,e.playAnimation,e.reverseAnimation]]}const ct={scalar:new class extends tt{constructor(){super(...arguments),this.opcode=++st,this.length=1,this.ins=0,this.outs=1,this.microcode=["out0 = vec4(atom0.y, atom0.y, atom0.y, atom0.y);"]}encode(e){return[[this.opcode,e,0,0]]}},vector3:new class extends tt{constructor(){super(...arguments),this.opcode=++st,this.length=1,this.ins=0,this.outs=1,this.microcode=["out0 = vec4(atom0.yzw, 0.0);"]}encode(e){return[[this.opcode,e[0]||0,e[1]||0,e[2]||0]]}},vector4:new class extends tt{constructor(){super(...arguments),this.opcode=++st,this.length=2,this.ins=0,this.outs=1,this.microcode=["out0 = atom1;"]}encode(e){return[[this.opcode,0,0,0],e]}},animatedTransform:new class extends tt{constructor(){super(...arguments),this.opcode=++st,this.length=10,this.ins=1,this.outs=1,this.microcode=["vec2 fromTranslation = atom1.xy;","vec2 toTranslation = atom1.zw;","float fromRotation = atom2.x;","float toRotation = atom2.y;","float fromScale = atom2.z;","float toScale = atom2.w;","bool relativeTranslation = atom9.x == 1.0;","bool absoluteScale = atom9.y == 1.0;","vec2 translationMultiplier = relativeTranslation ? pixelDimensions : vec2(1.0, 1.0);","float scaleDivisor = absoluteScale ? pixelDimensions.y : 1.0;","float fTranslation;","{",...rt({duration:"atom3.x",startTimeOffset:"atom3.y",repeatDelay:"atom3.z",timeOriginSelector:"atom3.w",repeatType:"atom4.x",easing:"atom4.y",playAnimation:"atom4.z",reverseAnimation:"atom4.w",out:"fTranslation"}),"}","float fRotation;","{",...rt({duration:"atom5.x",startTimeOffset:"atom5.y",repeatDelay:"atom5.z",timeOriginSelector:"atom5.w",repeatType:"atom6.x",easing:"atom6.y",playAnimation:"atom6.z",reverseAnimation:"atom6.w",out:"fRotation"}),"}","float fScale;","{",...rt({duration:"atom7.x",startTimeOffset:"atom7.y",repeatDelay:"atom7.z",timeOriginSelector:"atom7.w",repeatType:"atom8.x",easing:"atom8.y",playAnimation:"atom8.z",reverseAnimation:"atom8.w",out:"fScale"}),"}","vec2 aTranslation = mix(fromTranslation, toTranslation, fTranslation);","float aRotation = mix(fromRotation, toRotation, fRotation);","float aScale = mix(fromScale, toScale, fScale);","vec2 pTranslation = in0.xy;","float pRotation = in0.z;","float pScale = in0.w;","aTranslation *= translationMultiplier;","aScale /= scaleDivisor;","float rotation = pRotation + aRotation;","float scale = pScale * aScale;","float sin1 = sin(pRotation);","float cos1 = cos(pRotation);","float s1 = pScale;","float x1 = pTranslation.x;","float y1 = pTranslation.y;","float x2 = aTranslation.x;","float y2 = aTranslation.y;","\n vec2 translation = vec2(\n cos1 * s1 * x2 - sin1 * s1 * y2 + x1,\n sin1 * s1 * x2 + cos1 * s1 * y2 + y1\n );\n ","out0 = vec4(translation, rotation, scale);"]}encode(e){return[[this.opcode,0,0,0],[e.translation.from[0],e.translation.from[1],e.translation.to[0],e.translation.to[1]],[e.rotation.from,e.rotation.to,e.scale.from,e.scale.to],...at(e.translation.timing),...at(e.rotation.timing),...at(e.scale.timing),[e.relativeTranslation?1:0,e.absoluteScale?1:0,0,0]]}},animatedColor:new class extends tt{constructor(){super(...arguments),this.opcode=++st,this.length=7,this.ins=1,this.outs=1,this.microcode=["float fromOpacity = atom0.y;","float toOpacity = atom0.z;","vec4 fromColor = atom1;","vec4 toColor = atom2;","float fColor;","{",...rt({duration:"atom3.x",startTimeOffset:"atom3.y",repeatDelay:"atom3.z",timeOriginSelector:"atom3.w",repeatType:"atom4.x",easing:"atom4.y",playAnimation:"atom4.z",reverseAnimation:"atom4.w",out:"fColor"}),"}","float fOpacity;","{",...rt({duration:"atom5.x",startTimeOffset:"atom5.y",repeatDelay:"atom5.z",timeOriginSelector:"atom5.w",repeatType:"atom6.x",easing:"atom6.y",playAnimation:"atom6.z",reverseAnimation:"atom6.w",out:"fOpacity"}),"}","vec4 aColor = mix(fromColor, toColor, fColor);","aColor.a *= mix(fromOpacity, toOpacity, fOpacity);","vec4 pColor = in0;","out0 = aColor * pColor;"]}encode(e){return[[this.opcode,e.opacity.from,e.opacity.to,0],[e.color.from[0],e.color.from[1],e.color.from[2],e.color.from[3]],[e.color.to[0],e.color.to[1],e.color.to[2],e.color.to[3]],...at(e.color.timing),...at(e.opacity.timing)]}},animatedShift:new class extends tt{constructor(){super(...arguments),this.opcode=++st,this.length=4,this.ins=1,this.outs=1,this.microcode=["float fromShift = atom0.y;","float toShift = atom0.z;","float duration = atom1.x;","bool multiplyByLineLength = atom3.x == 1.0;","float fShift;","{",...rt({duration:"duration",startTimeOffset:"atom1.y",repeatDelay:"atom1.z",timeOriginSelector:"atom1.w",repeatType:"atom2.x",easing:"atom2.y",playAnimation:"atom2.z",reverseAnimation:"atom2.w",out:"fShift"}),"}","toShift *= multiplyByLineLength ? lineLength : 1.0;","float aShift = mix(fromShift, toShift, fShift);","vec4 pShift = in0;","out0 = mod(aShift + pShift, lineLength);"]}encode(e){return[[this.opcode,e.shift.from,e.shift.to,0],...at(e.shift.timing),[e.multiplyByLineLength?1:0,0,0,0]]}},ret:new class extends tt{constructor(){super(...arguments),this.opcode=++st,this.length=1,this.ins=0,this.outs=0,this.microcode=["break;"]}encode(){return[[this.opcode,0,0,0]]}}},lt=4;function ut(e){return e instanceof ht?e:"object"==typeof e&&"type"in e?mt[e.type].hydrate(e):new dt(e)}class ht{constructor(e){this.inputs=e}encode(){const e=[];for(const t of this.inputs)e.push(...t.encode());return e.push(...this.instructions),e}}class dt extends ht{constructor(e){super([]),this.value=e}simplify(){return this}get instructions(){if(Array.isArray(this.value)){const[e,t,s,r]=this.value;return null!=r?ct.vector4.encode([e,t||0,s||0,r]):ct.vector3.encode([e,t||0,s||0])}return ct.scalar.encode(this.value)}}class pt extends ht{constructor(e,t){super([t]),this._config=e,this._parent=t}static hydrate(e){return new pt(e,ut(e.parent))}simplify(){if(this._config.relativeTranslation||this._config.absoluteScale)return this;const e=this._parent.simplify();if(!(e instanceof dt))return this;const[t,s,r,i]=e.value,n=this._config.translation.from[0],o=this._config.translation.from[1],a=this._config.rotation.from,c=this._config.scale.from;if(n===this._config.translation.to[0]&&o===this._config.translation.to[1]&&a===this._config.rotation.to&&c===this._config.scale.to){const e=r+a,l=i*c,u=Math.sin(r),h=Math.cos(r);return new dt([h*i*n-u*i*o+t,u*i*n+h*i*o+s,e,l])}return new pt(this._config,e)}get instructions(){return ct.animatedTransform.encode(this._config)}}class ft extends ht{constructor(e,t){super([t]),this._config=e,this._parent=t}static hydrate(e){return new ft(e,ut(e.parent))}simplify(){const e=this._parent.simplify();if(!(e instanceof dt))return this;const[t,s,r,i]=e.value,n=this._config.color.from[0],o=this._config.color.from[1],a=this._config.color.from[2];let c=this._config.color.from[3];const l=this._config.opacity.from;return n===this._config.color.to[0]&&o===this._config.color.to[1]&&a===this._config.color.to[2]&&c===this._config.color.to[3]&&l===this._config.opacity.to?(c*=l,new dt([t*n,s*o,r*a,i*c])):new ft(this._config,e)}get instructions(){return ct.animatedColor.encode(this._config)}}class _t extends ht{constructor(e,t){super([t]),this._config=e,this._parent=t}static hydrate(e){return new _t(e,ut(e.parent))}simplify(){const e=this._parent.simplify();return e instanceof dt?new _t(this._config,e):this}get instructions(){return ct.animatedShift.encode(this._config)}}const mt={AnimatedTransform:pt,AnimatedColor:ft,AnimatedShift:_t};function yt(e){return xt(e.map(e=>bt(e)).map(e=>ut(e).simplify()))}function gt(e){const t=[];return t.push(e.transform),t.push(e.fromColor),t.push(e.toColor),t.push(e.colorMix),t.push(e.toOpacity),t.push(e.opacityMix),e?.shift?t.push(e?.shift):t.push([1,1,1,1]),t}function xt(e){const t=[],s=[];let r=0;for(const i of e){const n=[...i.encode(),...ct.ret.encode()];t.push([r+e.length,0,0,0]),s.push(...n),r+=n.length}return[...t,...s]}async function wt(e,t){const s=e;let r;if("number"==typeof s||"string"==typeof s||"boolean"==typeof s)r=s;else if(Array.isArray(s))r=await Promise.all(s.map(e=>wt(e,t)));else if("object"==typeof s)if("valueExpressionInfo"in s){const{valueExpressionInfo:e}=s,{expression:i}=e;r={...s,computed:await t.createComputedField({expression:i})}}else{r={};for(const e in s)r[e]=await wt(s[e],t)}return r}function bt(e,t,s){const r=e;let i;if("number"==typeof r||"string"==typeof r||"boolean"==typeof r)i=r;else if(Array.isArray(r))i=r.map(e=>bt(e,t,s));else if("object"==typeof r)if("type"in r&&null!=r.type&&"Process"===r.type)switch(r.op){case"ArcadeColor":{const e=bt(r.value,t,s);St(Array.isArray(e)&&4===e.length),i=[e[0]/255,e[1]/255,e[2]/255,e[3]]}break;case"Transparency":{const e=bt(r.value,t,s);St("number"==typeof e),i=1-e/100}break;case"Divide":case"Multiply":case"Add":{const e=bt(r.left,t,s);St("number"==typeof e);const n=bt(r.right,t,s);switch(St("number"==typeof n),r.op){case"Divide":i=e/n;break;case"Multiply":i=e*n;break;case"Add":i=e+n}}break;case"Random":{const e=bt(r.seed,t,s),n=bt(r.min,t,s),o=bt(r.max,t,s);i=n+Xe(Ke(t.getObjectId()||0),e)*(o-n)}break;case"Cond":{const e=bt(r.condition,t,s),n=bt(r.ifTrue,t,s),o=bt(r.ifFalse,t,s);i=e?n:o}break;case"MatchWinding":{const e=bt(r.sign,t,s);let n=bt(r.angle,t,s);if(e>0)for(;n<0;)n+=2*Math.PI;else for(;n>0;)n-=2*Math.PI;i=n}}else if("computed"in r)i=function(e){if(!("computed"in e))return e;let r=e.computed.readWithDefault(t,s,[255*e.defaultValue[0],255*e.defaultValue[1],255*e.defaultValue[2],e.defaultValue[3]]);if("string"==typeof r){const e=Se.A.fromString(r);e&&(r=[e.r,e.g,e.b,e.a])}return r}(r);else{i={};for(const e in r)i[e]=bt(r[e],t,s)}return i}function*vt(e){const t=e;if(Array.isArray(t))for(const e of t)yield*vt(e);else if("object"==typeof t)if("type"in t&&null!=t.type&&"Process"===t.type)switch(t.op){case"ArcadeColor":case"Transparency":yield*vt(t.value);break;case"Divide":case"Multiply":case"Add":yield*vt(t.left),yield*vt(t.right);break;case"Random":yield*vt(t.seed),yield*vt(t.min),yield*vt(t.max);break;case"Cond":yield*vt(t.condition),yield*vt(t.ifTrue),yield*vt(t.ifFalse);break;case"MatchWinding":yield*vt(t.sign),yield*vt(t.angle)}else if("computed"in t)yield t.computed;else for(const e in t)yield*vt(t[e])}function St(e){if(!e)throw new Error("Assertion failed.")}const It={type:We.pe.HALF_FLOAT,count:2,pack:({scaleInfo:e},{tileInfo:t})=>ke(e,t)},kt={type:We.pe.FLOAT,count:4,packPrecisionFactor:1,packTessellation:({value1Position2Value2:e})=>(St(e),e)},Tt={type:We.pe.FLOAT,count:4,packPrecisionFactor:1,packTessellation:()=>[0,0,0,1]},At={type:We.pe.FLOAT,count:1,packPrecisionFactor:1,pack:()=>0},Mt={type:We.pe.FLOAT,count:1,packPrecisionFactor:1,packTessellation:({lineLength:e})=>e},Ft={type:We.pe.UNSIGNED_SHORT,count:1,packTessellation:({distance:e})=>e},Ct={type:We.pe.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:e,directionY:t})=>[e,t]},Pt={type:We.pe.FLOAT,count:2,packPrecisionFactor:16,packTessellation:({normalX:e,normalY:t})=>[e,t]},Et={type:We.pe.UNSIGNED_BYTE,count:3,pack:"id"},Rt={type:We.pe.UNSIGNED_BYTE,count:1,pack:function(e){const{sprite:t,isMapAligned:s,colorLocked:r,scaleSymbolsProportionally:i,isStroke:n}=e;let o=0;return s&&(o|=Te(Oe)),r&&(o|=Te(De)),t.sdf&&(o|=Te(Re)),i&&(o|=Te(ze)),n&&(o|=Te(qe)),o}},Ot={type:We.pe.SHORT,count:2,pack:"position",packPrecisionFactor:1},zt={marker:{type:We.pe.FLOAT,count:2,packAlternating:{count:4,pack:({texelDimensions:e})=>[[-.5*e[0],-.5*e[1]],[.5*e[0],-.5*e[1]],[-.5*e[0],.5*e[1]],[.5*e[0],.5*e[1]]]}},line:{type:We.pe.FLOAT,count:2,packTessellation:({extrusionOffsetX:e,extrusionOffsetY:t},{baseSize:s})=>[e*s/2,t*s/2]},fill:{type:We.pe.FLOAT,count:2,packTessellation:()=>[0,0]}},Lt={marker:{type:We.pe.SHORT,count:2,packPrecisionFactor:1,packAlternating:{count:4,packTessellation:({texXmax:e,texXmin:t,texYmax:s,texYmin:r})=>[[t,r],[e,r],[t,s],[e,s]]}}},Dt={type:We.pe.UNSIGNED_SHORT,count:4,pack:({sprite:e})=>{const{rect:t,width:s,height:r}=e,i=t.x+p.hM,n=t.y+p.hM;return[i+1,n+1,i+s-1,n+r-1]}},qt={type:We.pe.UNSIGNED_SHORT,count:4,packPrecisionFactor:4,pack:({animations:e,baseSize:t,referenceSize:s})=>[e.dataColumn,e.dataRow,t,s]},Nt={type:We.pe.UNSIGNED_SHORT,count:4,packPrecisionFactor:8,pack:({strokeWidth:e,pixelDimensions:t,baseSize:s,sprite:r,sizeRatio:i})=>{const n=Math.max(s*r.width/r.height,s),o=r.sdfDecodeCoeff*n*i;return[t[0],t[1],e,o]}},Bt={type:We.pe.BYTE,count:1,packTessellation:({angle:e})=>e*Ze.aA},Gt={type:We.pe.BYTE,count:1,pack:({angle:e})=>e?e*Ze.aA:0},jt={type:We.pe.BYTE,count:1,pack:()=>0};function Ut(e){let{pixelDimensions:t,texelDimensions:s,baseSize:r,referenceSize:i,strokeWidth:n,sizeRatio:o}=e;if(t||(t=e.sprite.sdf?[0,0]:[e.sprite.width,e.sprite.height]),s||(s=e.sprite.sdf?[0,0]:t),null!=e.patternHeight){const s=e.patternHeight/t[1];t[1]*=s,t[0]*=s}-1===r&&(r=t[1]),r=(0,u.Lz)(r),i=(0,u.Lz)(i),n=(0,u.Lz)(n);const a=(e.sprite.sdfDecodeCoeff??1)*o;return{...e,pixelDimensions:t,texelDimensions:s,baseSize:r,referenceSize:i,strokeWidth:n,sdfDecodeCoeff:a}}class Vt extends Qe{get vertexSpec(){return{createComputedParams:Ut,optionalAttributes:{zoomRange:It,value1Position2Value2:kt,lineLength:Mt},attributes:{id:Et,bitset:Rt,pos:Ot,offset:zt.marker,uv:Lt.marker,animationPointerAndBaseSizeAndReferenceSize:qt,sizing:Nt,angle:Bt}}}_write(e,{target:t,effectGeometry:s}){const r=this.evaluatedMeshParams.sprite,{textureBinding:i}=r;e.recordStart(this.instanceId,this.attributeLayout,i);const n=t.getDisplayId();if(this.shift&&"esriGeometryPolyline"===t.geometryType){if(!s){const s=xe.z.fromFeatureSetReaderCIM(t);s&&this._writeParticles(e,t,s)}}else if(null!=this.evaluatedMeshParams.placement)this._writePlacedMarkers(e,t);else if("esriGeometryPolygon"===t.geometryType){const s=t.readCentroidForDisplay();if(!s)return;const[r,i]=s.coords;this._writeQuad(e,n,r,i)}else if("esriGeometryPoint"===t.geometryType){const s=t.readXForDisplay(),r=t.readYForDisplay();this._writeQuad(e,n,s,r)}else{const s=t.readGeometryForDisplay();s&&s.forEachVertex((t,s)=>{this._writeQuad(e,n,t,s)})}e.recordEnd()}_writePlacedMarkers(e,t){const s=xe.z.fromFeatureSetReaderCIM(t)?.clone();if(!s)return;const r=ve.getPlacement(s,-1,this.evaluatedMeshParams.placement,(0,u.Lz)(1),e.id);if(!r)return;const i=t.getDisplayId();let n=r.next(),o=null;for(;null!=n;){const t=n.tx,s=-n.ty;if(Math.abs(t)>we.$u||Math.abs(s)>we.$u){n=r.next();continue}const a=-n.getAngle();e.recordBounds(t,s,64,64),this.shift?o&&this._writeQuad(e,i,o[0],o[1],void 0,a):this._writeQuad(e,i,t,s,void 0,a),o=[t,s],n=r.next()}}_writeParticles(e,t,s){const r=t.getDisplayId();for(;s.nextPath();){const t=[];for(;s.nextPoint();)t.push([s.x,s.y]);const i=Wt(t);let n=0;for(let e=1;e<t.length;e++){const s=t[e][0]-t[e-1][0],r=t[e][1]-t[e-1][1],i=Math.sqrt(s*s+r*r);n+=i}const o=t=>{for(const s of i){const{a:i,b:o}=s;this._writeQuad(e,r,i.position[0],i.position[1],[i.distance-t,o.position[0],o.position[1],o.distance-t],this.evaluatedMeshParams.angleToLine?Math.atan2(i.direction[1],i.direction[0]):0,n,!0)}},{placement:a}=this.evaluatedMeshParams;if(!a||"placementTemplate"in a||"CIMMarkerPlacementOnVertices"===a.type){let e;if(a&&"CIMMarkerPlacementOnVertices"!==a.type)e=a.placementTemplate;else{e=[0];for(const t of i){const{a:s,b:r}=t,i=s.position[0]-r.position[0],n=s.position[1]-r.position[1],o=Math.sqrt(i*i+n*n);e.push(o)}}let t=-1*n;for(;t<2*n;)for(const s of e)t+=s,o(t)}else"CIMMarkerPlacementAtExtremities"===a.type?"JustBegin"===a.extremityPlacement?o(1):"JustEnd"===a.extremityPlacement?(o(n-1),o(-1)):"Both"===a.extremityPlacement&&(o(1),o(n-1)):"CIMMarkerPlacementOnLine"===a.type&&("LineBeginning"===a.relativeTo?o(1):"LineEnd"===a.relativeTo?(o(n-1),o(-1)):"LineMiddle"===a.relativeTo&&o(n/2))}}_writeQuad(e,t,s,r,i,n=0,o=0,a=!1){const c=this.evaluatedMeshParams.sprite,{rect:l}=c,u=l.x+p.hM,h=l.y+p.hM,d=l.x+l.width-p.hM,f=l.y+l.height-p.hM,_=e.vertexCount();a||e.recordBounds(s,r,64,64);const m={texXmin:u,texYmin:h,texXmax:d,texYmax:f,value1Position2Value2:i,angle:n/.024543692606171875,lineLength:o};for(let i=0;i<4;i++)this._writeVertex(e,t,s,r,m);e.indexEnsureSize(6),e.indexWrite(_),e.indexWrite(_+1),e.indexWrite(_+2),e.indexWrite(_+1),e.indexWrite(_+3),e.indexWrite(_+2)}}function Wt(e){const t=[];let s=0;for(let r=1;r<e.length;r++){const i=e[r-1],n=e[r],o=n[0]-i[0],a=n[1]-i[1],c=Math.sqrt(o*o+a*a),l=o/c,u=a/c;t.push({a:{position:i,distance:s,direction:[l,u]},b:{position:n,distance:s+c,direction:[l,u]}}),s+=c}return t}class Yt extends Vt{constructor(){super(...arguments),this.shift=!1}}class $t extends Vt{constructor(){super(...arguments),this.shift=!0}}var Ht=s(15585),Qt=s(83773),Zt=s(6774),Xt=s(92722);function Kt(e,t,s,r,i,n,o){vs=0;const a=(r-s)*n,c=i&&i.length,l=c?(i[0]-s)*n:a;let u,h,d,p,f,_=Jt(t,s,0,0,l,n,!0);if(_&&_.next!==_.prev){if(c&&(_=function(e,t,s,r,i,n){const o=new Array;for(let i=0,a=r.length;i<a;i++){const c=Jt(e,t,0,r[i]*n,i<a-1?r[i+1]*n:s*n,n,!1);c===c.next&&(c.steiner=!0),o.push(os(c))}o.sort(_s);for(const e of o)i=as(e,i);return i}(t,s,r,i,_,n)),a>80*n){u=d=t[0+s*n],h=p=t[1+s*n];for(let e=n;e<l;e+=n){const r=t[e+s*n],i=t[e+1+s*n];u=Math.min(u,r),h=Math.min(h,i),d=Math.max(d,r),p=Math.max(p,i)}f=Math.max(d-u,p-h),f=0!==f?1/f:0}ts(_,e,n,u,h,f,o,0)}}function Jt(e,t,s,r,i,n,o){let a;if(o===function(e,t,s,r,i,n){let o=0;for(let s=r,a=i-n;s<i;s+=n)o+=(e[a+t*n]-e[s+t*n])*(e[s+1+t*n]+e[a+1+t*n]),a=s;return o}(e,t,0,r,i,n)>0)for(let s=r;s<i;s+=n)a=is(s+t*n,e[s+t*n],e[s+1+t*n],a);else for(let s=i-n;s>=r;s-=n)a=is(s+t*n,e[s+t*n],e[s+1+t*n],a);return a&&fs(a,a.next)&&(ns(a),a=a.next),a}function es(e,t=e){if(!e)return e;let s,r=e;do{if(s=!1,r.steiner||!fs(r,r.next)&&0!==ls(r.prev,r,r.next))r=r.next;else{if(ns(r),r=t=r.prev,r===r.next)break;s=!0}}while(s||r!==t);return t}function ts(e,t,s,r,i,n,o,a){if(!e)return;!a&&n&&(e=cs(e,r,i,n));let c=e;for(;e.prev!==e.next;){const l=e.prev,u=e.next;if(n?rs(e,r,i,n):ss(e))t.push(l.index/s+o),t.push(e.index/s+o),t.push(u.index/s+o),ns(e),e=u.next,c=u.next;else if((e=u)===c){a?1===a?ts(e=ms(e,t,s,o),t,s,r,i,n,o,2):2===a&&ys(e,t,s,r,i,n,o):ts(es(e),t,s,r,i,n,o,1);break}}}function ss(e){const t=e.prev,s=e,r=e.next;if(ls(t,s,r)>=0)return!1;let i=e.next.next;const n=i;let o=0;for(;i!==e.prev&&(0===o||i!==n);){if(o++,hs(t.x,t.y,s.x,s.y,r.x,r.y,i.x,i.y)&&ls(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function rs(e,t,s,r){const i=e.prev,n=e,o=e.next;if(ls(i,n,o)>=0)return!1;const a=i.x<n.x?i.x<o.x?i.x:o.x:n.x<o.x?n.x:o.x,c=i.y<n.y?i.y<o.y?i.y:o.y:n.y<o.y?n.y:o.y,l=i.x>n.x?i.x>o.x?i.x:o.x:n.x>o.x?n.x:o.x,u=i.y>n.y?i.y>o.y?i.y:o.y:n.y>o.y?n.y:o.y,h=ps(a,c,t,s,r),d=ps(l,u,t,s,r);let p=e.prevZ,f=e.nextZ;for(;p&&p.z>=h&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&hs(i.x,i.y,n.x,n.y,o.x,o.y,p.x,p.y)&&ls(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&hs(i.x,i.y,n.x,n.y,o.x,o.y,f.x,f.y)&&ls(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&hs(i.x,i.y,n.x,n.y,o.x,o.y,p.x,p.y)&&ls(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&hs(i.x,i.y,n.x,n.y,o.x,o.y,f.x,f.y)&&ls(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function is(e,t,s,r){const i=ws.create(e,t,s);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function ns(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function os(e){let t=e,s=e;do{(t.x<s.x||t.x===s.x&&t.y<s.y)&&(s=t),t=t.next}while(t!==e);return s}function as(e,t){const s=function(e,t){let s=t;const r=e.x,i=e.y;let n,o=-1/0;do{if(i<=s.y&&i>=s.next.y&&s.next.y!==s.y){const e=s.x+(i-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(e<=r&&e>o){if(o=e,e===r){if(i===s.y)return s;if(i===s.next.y)return s.next}n=s.x<s.next.x?s:s.next}}s=s.next}while(s!==t);if(!n)return null;if(r===o)return n.prev;const a=n,c=n.x,l=n.y;let u,h=1/0;for(s=n.next;s!==a;)r>=s.x&&s.x>=c&&r!==s.x&&hs(i<l?r:o,i,c,l,i<l?o:r,i,s.x,s.y)&&(u=Math.abs(i-s.y)/(r-s.x),(u<h||u===h&&s.x>n.x)&&ds(s,e)&&(n=s,h=u)),s=s.next;return n}(e,t);if(!s)return t;const r=xs(s,e);return es(r,r.next),es(s,s.next)}function cs(e,t,s,r){let i;for(;i!==e;i=i.next){if(i=i||e,null===i.z&&(i.z=ps(i.x,i.y,t,s,r)),i.prev.next!==i||i.next.prev!==i)return i.prev.next=i,i.next.prev=i,cs(e,t,s,r);i.prevZ=i.prev,i.nextZ=i.next}return e.prevZ.nextZ=null,e.prevZ=null,function(e){let t,s=1;for(;;){let r,i=e;e=null,t=null;let n=0;for(;i;){n++,r=i;let o=0;for(;o<s&&r;o++)r=r.nextZ;let a=s;for(;o>0||a>0&&r;){let s;0===o?(s=r,r=r.nextZ,a--):0!==a&&r?i.z<=r.z?(s=i,i=i.nextZ,o--):(s=r,r=r.nextZ,a--):(s=i,i=i.nextZ,o--),t?t.nextZ=s:e=s,s.prevZ=t,t=s}i=r}if(t.nextZ=null,s*=2,n<2)return e}}(e)}function ls(e,t,s){return(t.y-e.y)*(s.x-t.x)-(t.x-e.x)*(s.y-t.y)}function us(e,t,s,r){return!!(fs(e,t)&&fs(s,r)||fs(e,r)&&fs(s,t))||ls(e,t,s)>0!=ls(e,t,r)>0&&ls(s,r,e)>0!=ls(s,r,t)>0}function hs(e,t,s,r,i,n,o,a){return(i-o)*(t-a)-(e-o)*(n-a)>=0&&(e-o)*(r-a)-(s-o)*(t-a)>=0&&(s-o)*(n-a)-(i-o)*(r-a)>=0}function ds(e,t){return ls(e.prev,e,e.next)<0?ls(e,t,e.next)>=0&&ls(e,e.prev,t)>=0:ls(e,t,e.prev)<0||ls(e,e.next,t)<0}function ps(e,t,s,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-s)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function fs(e,t){return e.x===t.x&&e.y===t.y}function _s(e,t){return e.x-t.x}function ms(e,t,s,r){let i=e;do{const n=i.prev,o=i.next.next;!fs(n,o)&&us(n,i,i.next,o)&&ds(n,o)&&ds(o,n)&&(t.push(n.index/s+r),t.push(i.index/s+r),t.push(o.index/s+r),ns(i),ns(i.next),i=e=o),i=i.next}while(i!==e);return i}function ys(e,t,s,r,i,n,o){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.index!==e.index&&gs(a,e)){let c=xs(a,e);return a=es(a,a.next),c=es(c,c.next),ts(a,t,s,r,i,n,o,0),void ts(c,t,s,r,i,n,o,0)}e=e.next}a=a.next}while(a!==e)}function gs(e,t){return e.next.index!==t.index&&e.prev.index!==t.index&&!function(e,t){let s=e;do{if(s.index!==e.index&&s.next.index!==e.index&&s.index!==t.index&&s.next.index!==t.index&&us(s,s.next,e,t))return!0;s=s.next}while(s!==e);return!1}(e,t)&&ds(e,t)&&ds(t,e)&&function(e,t){let s=e,r=!1;const i=(e.x+t.x)/2,n=(e.y+t.y)/2;do{s.y>n!=s.next.y>n&&s.next.y!==s.y&&i<(s.next.x-s.x)*(n-s.y)/(s.next.y-s.y)+s.x&&(r=!r),s=s.next}while(s!==e);return r}(e,t)}function xs(e,t){const s=ws.create(e.index,e.x,e.y),r=ws.create(t.index,t.x,t.y),i=e.next,n=t.prev;return e.next=t,t.prev=e,s.next=i,i.prev=s,r.next=s,s.prev=r,n.next=r,r.prev=n,r}class ws{constructor(){this.index=0,this.x=0,this.y=0,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}static create(e,t,s){const r=vs<bs.length?bs[vs++]:new ws;return r.index=e,r.x=t,r.y=s,r.prev=null,r.next=null,r.z=null,r.prevZ=null,r.nextZ=null,r.steiner=!1,r}}const bs=[];let vs=0;for(let e=0;e<8096;e++)bs.push(new ws);const Ss=new Zt.O3(0,0,0,1,0),Is=new Zt.O3(0,0,0,1,0);function ks(e,t,s){let r=0;for(let i=1;i<s;i++){const s=e[2*(t+i-1)],n=e[2*(t+i-1)+1];r+=(e[2*(t+i)]-s)*(e[2*(t+i)+1]+n)}return r}function Ts(e,t,s,r,i){let n=0;for(let o=s;o<r;o+=3){const s=2*(e[o]-i),r=2*(e[o+1]-i),a=2*(e[o+2]-i);n+=Math.abs((t[s]-t[a])*(t[r+1]-t[s+1])-(t[s]-t[r])*(t[a+1]-t[s+1]))}return n}function As(e,t){const{coords:s,lengths:r}=t,i=e;let n=0;for(let e=0;e<r.length;){let t=e,o=r[e],a=ks(s,n,o);const c=[];for(;++t<r.length;){const e=r[t],i=ks(s,n+o,e);if(!(i>0))break;a+=i,c.push(n+o),o+=e}const l=i.length;Kt(i,s,n,n+o,c,2,0);const u=Ts(i,s,l,i.length,0),h=Math.abs(a);if(Math.abs((u-h)/Math.max(1e-7,h))>1e-5)return i.length=0,!1;e=t,n+=o}return!0}function Ms(e){const{coords:t,lengths:s}=e,{buffer:r}=(0,Ht.QT)(t,s);return r}function Fs(e,t){if(null==e)return null;if(!function(e,t,s){let r=0;for(let t=0;t<e.lengths.length;t++){const i=e.lengths[t];for(let t=0;t<i;t++){const i=e.coords[2*(t+r)],n=e.coords[2*(t+r)+1];if(i<-128||i>s||n<-128||n>s)return!0}r+=i}return!1}(e,0,p.CQ+128))return e;Ss.setPixelMargin(t),Ss.reset(3);const{stride:s,lengths:r,coords:i}=e;let n=0;for(const e of r){const t=n+e*s;for(Ss.moveTo(i[n],i[n+1]),n+=s;n<t;)Ss.lineTo(i[n],i[n+1]),n+=s;Ss.close()}const o=Ss.result(!1);if(!o)return null;const a=new Xt.A;for(const e of o){for(const{x:t,y:s}of e)a.coords.push(t,s);a.lengths.push(e.length)}return a}function Cs(e,t){Is.setPixelMargin(t);const s=Is,r=-t,i=p.CQ+t;let n=[],o=!1;if(!e.nextPath())return null;let a=e.pathLength(),c=!0;for(;c;){e.seekPathStart();const t=[];if(!e.pathSize)return null;s.reset(2),e.nextPoint();let l=e.x,u=e.y;if(o)s.moveTo(l,u);else{if(l<r||l>i||u<r||u>i){o=!0;continue}t.push({x:l,y:u})}let h=!1;for(;e.nextPoint();)if(l=e.x,u=e.y,o)s.lineTo(l,u);else{if(l<r||l>i||u<r||u>i){h=!0;break}t.push({x:l,y:u})}if(h)o=!0;else{if(o){const e=s.resultWithStarts();if(e)for(const t of e)n.push({...t,pathLength:a})}else n.push({line:t,start:0,pathLength:a});c=e.nextPath(),a=c?e.pathLength():0,o=!1}}return n=n.filter(e=>e.line.length>1),0===n.length?null:n}Ss.setExtent(p.CQ),Is.setExtent(p.CQ);var Ps=s(23304);class Es{constructor(){this.extrusionOffsetX=0,this.extrusionOffsetY=0,this.normalX=0,this.normalY=0,this.directionX=0,this.directionY=0,this.distance=0,this.pathLength=0,this.distanceOffset=0,this.lineLength=0}}const Rs={createComputedParams:e=>e,optionalAttributes:{zoomRange:{type:We.pe.HALF_FLOAT,count:2,pack:({scaleInfo:e},{tileInfo:t})=>ke(e,t)}},attributes:{id:{type:We.pe.UNSIGNED_BYTE,count:3,pack:"id"},pos:{type:We.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},bitset:{type:We.pe.UNSIGNED_BYTE,count:1},color:{type:We.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>Me(e)},offset:{type:We.pe.BYTE,count:2,packPrecisionFactor:16,packTessellation:({extrusionOffsetX:e,extrusionOffsetY:t})=>[Ee(e,16),Ee(t,16)]},normal:{type:We.pe.BYTE,count:2,packPrecisionFactor:16,packTessellation:({normalX:e,normalY:t})=>[Ee(e,16),Ee(t,16)]},halfWidth:{type:We.pe.HALF_FLOAT,count:1,pack:({width:e})=>(0,u.Lz)(.5*e)},referenceHalfWidth:{type:We.pe.HALF_FLOAT,count:1,pack:({referenceWidth:e})=>(0,u.Lz)(.5*e)}}};class Os{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0,this.pathLength=0,this.distanceOffset=0}}const zs=65535;class Ls extends He{constructor(e,t,s,r){super(e,t,s,r),this.vertexSpec=Rs,this._currentWrite=new Os,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:zs,textured:!1},this._tessParams=new Es,this._initializeTessellator()}writeLineVertices(e,t,s){const r=this._getLines(t);null!=r&&this._writeVertices(e,s,r)}_initializeTessellator(){this._lineTessellator=new Qt.i(this._writeTesselatedVertex.bind(this),this._writeTriangle.bind(this),!0)}_write(e,{target:t,effectGeometry:s}){const r=s??xe.z.fromFeatureSetReaderCIM(t);r&&this._writeGeometry(e,t,r)}_writeGeometry(e,t,s,r){e.recordStart(this.instanceId,this.attributeLayout,r),this.writeLineVertices(e,s,t),e.recordEnd()}_getLines(e){return Cs(e,(0,Ps.Z0)(this.evaluatedMeshParams))}_writeVertices(e,t,s){const{_currentWrite:r,_tessellationOptions:i,evaluatedMeshParams:n}=this,{width:o,capType:a,joinType:c,miterLimit:l,hasSizeVV:h}=n,d=(0,u.Lz)(.5*o);i.halfWidth=d,i.capType=Fe(a),i.joinType=Ce(c),i.miterLimit=l;const f=!h;r.out=e,r.id=t.getDisplayId(),r.vertexCount=0,r.indexCount=0,r.vertexFrom=e.vertexCount(),r.vertexBounds=f&&d<p.Gh?0:1;for(const{line:e,start:t,pathLength:n}of s)i.initialDistance=t%zs,r.pathLength=n,r.distanceOffset=Math.floor(t/zs)*zs,this._lineTessellator.tessellate(e,i,f)}_writeTesselatedVertex(e,t,s,r,i,n,o,a,c,l,u){const{out:h,id:d,vertexBounds:p,pathLength:f,distanceOffset:_}=this._currentWrite;return this.hasEffects&&h.recordBounds(e,t,p,p),this._tessParams.extrusionOffsetX=o,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=c,this._tessParams.normalY=l,this._tessParams.directionX=i,this._tessParams.directionY=n,this._tessParams.distance=u,this._tessParams.pathLength=f,this._tessParams.distanceOffset=_,this._writeVertex(h,d,e,t,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(e,t,s){const{out:r}=this._currentWrite;r.indexEnsureSize(3),r.indexWrite(e),r.indexWrite(t),r.indexWrite(s),this._currentWrite.indexCount+=3}}class Ds extends Qe{_write(e,{target:t,effectGeometry:s}){const r=s??xe.z.fromFeatureSetReaderCIM(t);if(!r)return;const i=this.evaluatedMeshParams.sprite,{textureBinding:n}=i;e.recordStart(this.instanceId,this.attributeLayout,n);const o=t.getDisplayId();this._writePoly(e,o,r.asOptimized()),e.recordEnd()}}class qs extends Ds{constructor(){super(...arguments),this.vertexSpec={createComputedParams:Ut,attributes:{id:Et,bitset:Rt,pos:Ot,offset:zt.fill,tlbr:Dt,animationPointerAndBaseSizeAndReferenceSize:qt,sizing:Nt},optionalAttributes:{zoomRange:It,value1Position2Value2:Tt,lineLength:At,angle:Gt}}}_writePoly(e,t,s){const r=this._clip(s);if(!r)return;s=r;const i=[],n=e.vertexCount();let o;if(As(i,s)){if(0===i.length)return;o=0;for(const r of i){const i=s.coords[2*r],n=s.coords[2*r+1];this._writeVertex(e,t,i,n),o++}}else{const{coords:r,lengths:i}=s,n=(0,Ht.QT)(r,i);o=n.vertexCount;for(let s=0;s<n.buffer.length/2;s++){const r=n.buffer[2*s],i=n.buffer[2*s+1];this._writeVertex(e,t,r,i)}}if(o>0){e.indexEnsureSize(o);for(let t=0;t<o;t++)e.indexWrite(t+n)}}_clip(e){return Fs(e,this.hasEffects?256:8)}}class Ns{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0,this.pathLength=0}}class Bs extends Ds{constructor(){super(...arguments),this.vertexSpec={createComputedParams:Ut,attributes:{id:Et,bitset:Rt,pos:Ot,offset:zt.line,tlbr:Dt,animationPointerAndBaseSizeAndReferenceSize:qt,sizing:Nt,accumulatedDistance:Ft,normal:Pt,segmentDirection:Ct},optionalAttributes:{zoomRange:It,value1Position2Value2:Tt,lineLength:Mt,angle:jt}},this._tessParams=new Es,this._currentWrite=new Ns,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:65535,textured:!1},this._lineLength=0,this._lineTessellator=new Qt.i((e,t,s,r,i,n,o,a,c,l,u)=>this._writeTesselatedVertex(e,t,s,r,i,n,o,a,c,l,u,this._lineLength),this._writeTriangle.bind(this),!1)}_writePoly(e,t,s){const r=Cs(xe.z.fromOptimized(s,"esriGeometryPolyline"),64);if(null==r)return;const{_currentWrite:i,_tessellationOptions:n}=this,{baseSize:o,capType:a,joinType:c,miterLimit:l}=this.evaluatedMeshParams,h=(0,u.Lz)(.5*o);n.halfWidth=h,n.capType=Fe(a||"Round"),n.joinType=Ce(c||"Round"),n.miterLimit=l||2,i.out=e,i.id=t,i.vertexCount=0,i.indexCount=0,i.vertexFrom=e.vertexCount(),i.vertexBounds=1;for(const{line:e,start:t,pathLength:s}of r){n.initialDistance=t%65535,i.pathLength=s,this._lineLength=0;for(let t=1;t<e.length;t++){const s=e[t].x-e[t-1].x,r=e[t].y-e[t-1].y;this._lineLength+=Math.sqrt(s*s+r*r)}this._lineTessellator.tessellate(e,n,!1)}}_writeTesselatedVertex(e,t,s,r,i,n,o,a,c,l,u,h){const{out:d,id:p,vertexBounds:f,pathLength:_}=this._currentWrite;return this.hasEffects&&d.recordBounds(e,t,f,f),this._tessParams.extrusionOffsetX=o,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=c,this._tessParams.normalY=l,this._tessParams.directionX=i,this._tessParams.directionY=n,this._tessParams.distance=u,this._tessParams.pathLength=_,this._tessParams.lineLength=h,this._writeVertex(d,p,e,t,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(e,t,s){const{out:r}=this._currentWrite;r.indexEnsureSize(3),r.indexWrite(e),r.indexWrite(t),r.indexWrite(s),this._currentWrite.indexCount+=3}}class Gs extends He{async loadDependencies(){await Promise.all([super.loadDependencies(),(0,Ht.If)()])}_write(e,{target:t,effectGeometry:s}){const r=s?.asOptimized()??t.readGeometryForDisplay(),i=this._clip(r);i&&(e.recordStart(this.instanceId,this.attributeLayout),this._writeGeometry(e,t,i),e.recordEnd())}_clip(e){return e?Fs(e,this.hasEffects?256:8):null}_writeGeometry(e,t,s){const r=function(e){const t=[];return e.maxLength>100||!As(t,e)?{indices:null,vertices:Ms(e)}:t.length?{indices:t,vertices:e.coords}:null}(s=s.justXY());if(!r||!r.vertices.length)return;const i=this.createTesselationParams(t);this._writeVertices(e,t,r,i)}_writeVertices(e,t,s,r){const i=t.getDisplayId(),n=e.vertexCount(),o=this.hasEffects,{vertices:a,indices:c}=s;let l=0;if(c)for(const t of c){const s=a[2*t],n=a[2*t+1];o&&e.recordBounds(s,n,0,0),this._writeVertex(e,i,s,n,r),l++}else for(let t=0;t<a.length;t+=2){const s=Math.round(a[t]),n=Math.round(a[t+1]);o&&e.recordBounds(s,n,0,0),this._writeVertex(e,i,s,n,r),l++}e.indexEnsureSize(l);for(let t=0;t<l;t++)e.indexWrite(t+n)}}const js={createComputedParams:e=>e,optionalAttributes:{},attributes:{id:{type:We.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:We.pe.UNSIGNED_BYTE,count:1},pos:{type:We.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},inverseArea:{type:We.pe.FLOAT,count:1,packTessellation:({inverseArea:e})=>e}}};class Us extends Gs{constructor(){super(...arguments),this.vertexSpec=js}createTesselationParams(e){return{inverseArea:1/e.readGeometryArea()}}}const Vs={createComputedParams:e=>e,optionalAttributes:{zoomRange:{type:We.pe.HALF_FLOAT,count:2,pack:({scaleInfo:e},{tileInfo:t})=>ke(e,t)}},attributes:{id:{type:We.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:We.pe.UNSIGNED_BYTE,count:1},pos:{type:We.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},color:{type:We.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>Me(e)}}};class Ws extends Gs{constructor(){super(...arguments),this.vertexSpec=Vs}createTesselationParams(e){return null}}const Ys={createComputedParams:e=>e,optionalAttributes:Vs.optionalAttributes,attributes:{...Vs.attributes,tlbr:{count:4,type:We.pe.UNSIGNED_SHORT,pack:({sprite:e})=>{const{rect:t,width:s,height:r}=e,i=t.x+p.hM,n=t.y+p.hM;return[i,n,i+s,n+r]}},inverseRasterizationScale:{count:1,type:We.pe.BYTE,packPrecisionFactor:16,pack:({sprite:e})=>1/e.rasterizationScale}}};class $s extends Ws{constructor(){super(...arguments),this.vertexSpec=Ys}_write(e,{target:t,effectGeometry:s}){const r=s?.asOptimized()??t.readGeometryForDisplay(),i=this._clip(r);if(!i)return;const n=this.evaluatedMeshParams.sprite?.textureBinding;e.recordStart(this.instanceId,this.attributeLayout,n),this._writeGeometry(e,t,i),e.recordEnd()}}function Hs(e){const{sprite:t,aspectRatio:s,scaleProportionally:r}=e,i=(0,u.Lz)(e.height),n=i>0?i:t.height;let o=i*s;return o<=0?o=t.width:r&&(o*=t.width/t.height),{width:o,height:n}}function Qs(e){const{applyRandomOffset:t,sampleAlphaOnly:s}=e;return Ae([[2,t],[4,s]])}const Zs={createComputedParams:e=>e,optionalAttributes:Ys.optionalAttributes,attributes:{...Ys.attributes,bitset:{count:1,type:We.pe.UNSIGNED_BYTE,pack:Qs},width:{count:1,type:We.pe.HALF_FLOAT,pack:e=>Hs(e).width},height:{count:1,type:We.pe.HALF_FLOAT,pack:e=>Hs(e).height},offset:{count:2,type:We.pe.HALF_FLOAT,pack:({offsetX:e,offsetY:t})=>[(0,u.Lz)(e),-(0,u.Lz)(t)]},scale:{count:2,type:We.pe.UNSIGNED_BYTE,packPrecisionFactor:16,pack:({scaleX:e,scaleY:t})=>[e,t]},angle:{count:1,type:We.pe.UNSIGNED_BYTE,pack:({angle:e})=>(0,Ze.wV)(e)}}};class Xs extends $s{constructor(){super(...arguments),this.vertexSpec=Zs}}const Ks={createComputedParams:e=>e,optionalAttributes:Rs.optionalAttributes,attributes:{...Rs.attributes,bitset:{type:We.pe.UNSIGNED_BYTE,count:1,pack:e=>0},color:{type:We.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>Me(e)}}},Js={createComputedParams:e=>e,optionalAttributes:Rs.optionalAttributes,attributes:{...Rs.attributes,bitset:{type:We.pe.UNSIGNED_BYTE,count:1,pack:e=>Ae([[0,!0],[1,e.outlineUsesColorVV]])},color:{type:We.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>Me(e)}}};class er extends Ls{constructor(){super(...arguments),this.vertexSpec=Js}}class tr extends Ws{constructor(e,t,s,r){super(e,t,s,r),this.vertexSpec=Ks,this._lineMeshWriter=this._createOutlineWriter(e,t,s,r)}_createOutlineWriter(e,t,s,r){return new er(e,t,s,r)}_write(e,{target:t,options:s}){const r=this.evaluatedMeshParams.effects,i=this.evaluatedMeshParams.outlineEffects,n=e.id||"",o=this._createEffectExecutionContext(t,s,n);if(r?.length||i?.length){if(r?.length){const s=this.getEffectCursor(t,r,o);if(s){let r;for(;r=s?.next();)r.invertY(),this._writeFill(e,t,r)}}else this._writeFill(e,t);if(i?.length){const s=this.getEffectCursor(t,i,o);if(s){let r;for(;r=s?.next();)r.invertY(),this._writeOutline(e,t,r)}}else this._writeOutline(e,t)}else this._writeSimpleOutlineFill(e,t)}_writeSimpleOutlineFill(e,t){const s=t.readGeometryForDisplay(),r=this._clip(s);r&&(this._writeGeometry(e,t,r),this._lineMeshWriter.writeLineVertices(e,xe.z.fromOptimizedCIM(r,"esriGeometryPolyline"),t))}_writeFill(e,t,s){const r=s?.asOptimized()??t.readGeometryForDisplay(),i=this._clip(r);i&&this._writeGeometry(e,t,i)}_writeOutline(e,t,s){const r=s?.asOptimized()??t.readGeometryForDisplay(),i=this._clip(r);i&&this._lineMeshWriter.writeLineVertices(e,xe.z.fromOptimizedCIM(i,"esriGeometryPolyline"),t)}_clip(e){return e?Fs(e,(0,Ps.Z0)(this.evaluatedMeshParams)):null}get effectInfos(){return[...this._evaluator.inputMeshParams.effects?.effectInfos??[],...this._evaluator.inputMeshParams.outlineEffects?.effectInfos??[]]}write(e,t,s,r,i){this.ensurePacked(t,s,r),e.recordStart(this.instanceId,this.attributeLayout),this._write(e,{target:s,options:r,level:i}),e.recordEnd()}ensurePacked(e,t,s){super.ensurePacked(e,t,s),this._lineMeshWriter.ensurePacked(e,t,s)}enqueueRequest(e,t,s){super.enqueueRequest(e,t,s),this._lineMeshWriter.enqueueRequest(e,t,s)}async loadDependencies(){await Promise.all([super.loadDependencies(),this._lineMeshWriter.loadDependencies()])}get hasEffects(){return!!this.evaluatedMeshParams.outlineEffects}}const sr=Zs,rr=Js,ir={createComputedParams:e=>e,optionalAttributes:sr.optionalAttributes,attributes:{...sr.attributes,bitset:{type:We.pe.UNSIGNED_BYTE,count:1,pack:e=>Qs(e)},aux1:{count:1,type:We.pe.HALF_FLOAT,pack:e=>Hs(e).width},aux2:{count:1,type:We.pe.HALF_FLOAT,pack:e=>Hs(e).height},aux3:{count:2,type:We.pe.HALF_FLOAT,pack:({offsetX:e,offsetY:t})=>[(0,u.Lz)(e),(0,u.Lz)(t)]},aux4:{count:2,type:We.pe.UNSIGNED_BYTE,pack:({scaleX:e,scaleY:t})=>[16*e,16*t]}}},nr={createComputedParams:e=>e,optionalAttributes:sr.optionalAttributes,attributes:{...sr.attributes,color:rr.attributes.color,bitset:{type:We.pe.UNSIGNED_BYTE,count:1,pack:e=>Ae([[0,!0]])},aux1:{count:1,type:We.pe.HALF_FLOAT,pack:e=>(0,u.Lz)(.5*e.width)},aux2:{count:1,type:We.pe.HALF_FLOAT,pack:e=>(0,u.Lz)(.5*e.referenceWidth)},aux3:{count:2,type:We.pe.HALF_FLOAT,packTessellation:({extrusionOffsetX:e,extrusionOffsetY:t})=>[e,t]},aux4:{count:2,type:We.pe.UNSIGNED_BYTE,packTessellation:({normalX:e,normalY:t})=>[16*e+128,16*t+128]}}};class or extends er{constructor(){super(...arguments),this.vertexSpec=nr}}class ar extends tr{constructor(){super(...arguments),this.vertexSpec=ir}_createOutlineWriter(e,t,s,r){return new or(e,t,s,r)}write(e,t,s,r,i){this.ensurePacked(t,s,r);const n=this.evaluatedMeshParams.sprite?.textureBinding;e.recordStart(this.instanceId,this.attributeLayout,n),this._write(e,{target:s,options:r,level:i}),e.recordEnd()}ensurePacked(e,t,s){super.ensurePacked(e,t,s),this._lineMeshWriter.ensurePacked(e,t,s)}enqueueRequest(e,t,s){super.enqueueRequest(e,t,s),this._lineMeshWriter.enqueueRequest(e,t,s)}async loadDependencies(){await Promise.all([super.loadDependencies(),this._lineMeshWriter.loadDependencies()])}}var cr=s(13337);var lr=s(34727);class ur{constructor(e,t){this._size=e,this._sizeUnits=t,this._relativeSize=null}get relativeSize(){return this._relativeSize??=this.calculateRelativeSize(),this._relativeSize}calculateRelativeSize(){if(this._sizeUnits===cr.h.Relative){const e=Math.min(this._size/100,1);return[e,e]}return this.calculateRelativeSizeFromAbsolute()}}class hr extends ur{constructor(e,t,s,r){super(t,s),this.rotationMatrix00=1,this.rotationMatrix01=0,this.rotationMatrix10=0,this.rotationMatrix11=1,this.bounds={xmin:1/0,ymin:1/0,xmax:-1/0,ymax:-1/0},this.rotationMatrix00=Math.cos(r),this.rotationMatrix01=-Math.sin(r),this.rotationMatrix10=-this.rotationMatrix01,this.rotationMatrix11=this.rotationMatrix00;const{bounds:i,rotationMatrix00:n,rotationMatrix01:o,rotationMatrix10:a,rotationMatrix11:c}=this;e.forEachVertex((e,t)=>{const s=e*n+t*o,r=e*a+t*c;i.xmin=Math.min(i.xmin,s),i.ymin=Math.min(i.ymin,r),i.xmax=Math.max(i.xmax,s),i.ymax=Math.max(i.ymax,r)}),this.center=[(i.xmin+i.xmax)/2,(i.ymin+i.ymax)/2]}}class dr extends hr{constructor(e,t,s,r){super(e,t,s,r),this.method="linear"}getRelativePosition(e,t){const{rotationMatrix00:s,rotationMatrix01:r,bounds:i}=this,{xmin:n,xmax:o}=i;return[(e*s+t*r-n)/(o-n),0]}calculateRelativeSizeFromAbsolute(){const{_size:e,bounds:t}=this,{xmin:s,xmax:r}=t;return[(0,u.Lz)(e)/(r-s),0]}}class pr extends hr{constructor(e,t,s,r){super(e,t,s,r),this.method="rectangular"}getRelativePosition(e,t){const{bounds:s,center:r,rotationMatrix00:i,rotationMatrix01:n,rotationMatrix10:o,rotationMatrix11:a}=this,c=e*o+t*a,l=e*i+t*n-r[0],u=c-r[1];return[l*(2/(s.xmax-s.xmin)),-u*(2/(s.ymax-s.ymin))]}calculateRelativeSizeFromAbsolute(){const{_size:e,bounds:t}=this,{xmin:s,ymin:r,xmax:i,ymax:n}=t;return[(0,u.Lz)(2*e)/(i-s),(0,u.Lz)(2*e)/(n-r)]}}class fr extends hr{constructor(e,t,s){super(e,t,s,0),this.method="circular";const{xmin:r,xmax:i,ymin:n,ymax:o}=this.bounds,a=i-r,c=o-n;this.radius=Math.sqrt(a*a+c*c)/2}getRelativePosition(e,t){const{center:s,radius:r}=this;return[(e-s[0])/r,-(t-s[1])/r]}calculateRelativeSizeFromAbsolute(){const{_size:e}=this;return[(0,u.Lz)(e)/this.radius,0]}}function _r(e,t){if(null==e)return null;const s=(0,lr.kU)(t.angle),r=t.gradientSize,i=t.gradientSizeUnits;switch(t.gradientMethod.toLowerCase()){case"linear":return new dr(e,r,i,s);case"rectangular":return new pr(e,r,i,s);case"circular":return new fr(e,r,i);default:return Ie.A.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.fill.GradientSizeHelper").errorOnce(`Gradient fill method "${t.gradientMethod}" currently unsupported.`),null}}const mr={createComputedParams:e=>e,optionalAttributes:Vs.optionalAttributes,attributes:{...Vs.attributes,bitset:{type:We.pe.UNSIGNED_BYTE,count:1,pack:({gradientSizeUnits:e,gradientType:t})=>{let s=0;return e===cr.h.Absolute&&(s|=Te(0)),"discrete"===t.toLowerCase()&&(s|=Te(1)),s}},tlbr:{count:4,type:We.pe.UNSIGNED_SHORT,pack:({sprite:e})=>{const{rect:t,width:s,height:r}=e,i=t.x+p.hM+p.MZ,n=t.y+p.hM;return[i,n,i+s-2*p.MZ,n+r]}},relativePosition:{count:2,type:We.pe.HALF_FLOAT,packTessellation:({gradientStats:e},t,s,r)=>e?.getRelativePosition(s,r)??[0,0]},relativeGradientSize:{count:2,type:We.pe.HALF_FLOAT,packTessellation:({gradientStats:e})=>e?.relativeSize??[1,1]},gradientMethod:{count:1,type:We.pe.UNSIGNED_BYTE,pack:({gradientMethod:e})=>{switch(e.toLowerCase()){case"rectangular":return 1;case"circular":return 2;default:return 0}}}}};class yr extends Gs{constructor(){super(...arguments),this.vertexSpec=mr}get _preventEffectClipping(){return!0}createTesselationParams(e){return{gradientStats:_r(this._unclippedGeometry,this.evaluatedMeshParams)}}_write(e,{target:t,effectGeometry:s}){const r=s?.asOptimized()??t.readGeometryForDisplay();this._unclippedGeometry=r;const i=this._clip(r);if(!i)return void(this._unclippedGeometry=null);const n=this.evaluatedMeshParams.sprite?.textureBinding;e.recordStart(this.instanceId,this.attributeLayout,n),this._writeGeometry(e,t,i),this._unclippedGeometry=null,e.recordEnd()}}const gr={optionalAttributes:Ys.optionalAttributes,createComputedParams:e=>e,attributes:{...Ys.attributes,...Ks.attributes}},xr={optionalAttributes:Ys.optionalAttributes,createComputedParams:e=>e,attributes:{...Ys.attributes,...Js.attributes}};class wr extends er{constructor(){super(...arguments),this.vertexSpec=xr}}class br extends tr{constructor(){super(...arguments),this.vertexSpec=gr}_createOutlineWriter(e,t,s,r){return new wr(e,t,s,r)}write(e,t,s,r,i){this.ensurePacked(t,s,r);const n=this.evaluatedMeshParams.sprite?.textureBinding;e.recordStart(this.instanceId,this.attributeLayout,n),this._write(e,{target:s,options:r,level:i}),e.recordEnd()}ensurePacked(e,t,s){super.ensurePacked(e,t,s),this._lineMeshWriter.ensurePacked(e,t,s)}enqueueRequest(e,t,s){super.enqueueRequest(e,t,s),this._lineMeshWriter.enqueueRequest(e,t,s)}async loadDependencies(){await Promise.all([super.loadDependencies(),this._lineMeshWriter.loadDependencies()])}}const vr={createComputedParams:e=>e,optionalAttributes:{},attributes:{pos:{type:We.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:We.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:We.pe.UNSIGNED_BYTE,count:1},offset:{type:We.pe.BYTE,count:2,packAlternating:{count:4,pack:()=>[[-1,-1],[1,-1],[-1,1],[1,1]]}}}};class Sr extends He{constructor(){super(...arguments),this.vertexSpec=vr}_write(e,{target:t}){e.recordStart(this.instanceId,this.attributeLayout);const s=t.getDisplayId();if("esriGeometryPoint"===t.geometryType){const r=t.readXForDisplay(),i=t.readYForDisplay();this._writeQuad(e,s,r,i)}else if("esriGeometryMultipoint"===t.geometryType){const r=t.readGeometryForDisplay();r?.forEachVertex((t,r)=>{t>=0&&t<=512&&r>=0&&r<=512&&this._writeQuad(e,s,t,r)})}e.recordEnd()}_writeQuad(e,t,s,r){const i=e.vertexCount();this._writeVertex(e,t,s,r),e.indexWrite(i+0),e.indexWrite(i+1),e.indexWrite(i+2),e.indexWrite(i+1),e.indexWrite(i+3),e.indexWrite(i+2)}}var Ir=s(16905),kr=s(85560),Tr=s(88340),Ar=s(48163),Mr=s(87992),Fr=s(32011),Cr=s(90708),Pr=s(15660);class Er{constructor(e,t,s,r,i,n,o,a,c,l,u,h=[],d=0,p=0){this.displayId=e,this.labelClassId=t,this.labelIdHash=s,this.hash=r,this.anchorX=i,this.anchorY=n,this.directionX=o,this.directionY=a,this.maxScale=c,this.minScale=l,this.referenceBounds=u,this.bounds=h,this.recordStart=d,this.recordCount=p,this.priority=0,this._colliders=null,this.uniqueSymbol=null,this.selectedForRendering=!1}get xTile(){return this.anchorX}get yTile(){return this.anchorY}colliders(e){if(!this._colliders){const t=e.attributeView,s=p.C2;let r=this.referenceBounds?.size??0;const i=e.labelingCollisionInfos[0].vvEvaluators[0];if(null!=i){const e=i(t.getVisualVariableData(this.displayId,0));r=isNaN(e)||null==e||e===1/0?r:e}const n=this.minScale?e.tilingScheme.scaleToZoom(this.minScale):0,o=this.maxScale?e.tilingScheme.scaleToZoom(this.maxScale):25,a=this.directionX*(s+r/2),c=this.directionY*(s+r/2);this._colliders=this.bounds.map(e=>({labelId:this.labelIdHash,xTile:this.anchorX,yTile:this.anchorY,dxPixels:e.x-e.halfWidth+a,dyPixels:e.y-e.halfHeight+c,hard:!0,partIndex:1,width:e.width+2,height:e.height+2,angle:0,xScreen:0,yScreen:0,dxScreen:0,dyScreen:0,enabled:!0,minLod:n,maxLod:o}))}return this._colliders}get id(){return this.displayId}serialize(e){e.push(this.displayId),e.push(this.labelClassId),e.push(this.labelIdHash),e.push(this.hash),e.push(this.recordStart),e.push(this.recordCount),e.writeF32(this.anchorX),e.writeF32(this.anchorY),e.writeF32(this.directionX),e.writeF32(this.directionY),e.writeF32(this.maxScale),e.writeF32(this.minScale),this.referenceBounds?(e.writeF32(this.referenceBounds.size),e.writeF32(this.referenceBounds.offsetX),e.writeF32(this.referenceBounds.offsetY)):(e.writeF32(0),e.writeF32(0),e.writeF32(0)),H(e,this.bounds)}static deserialize(e){const t=e.readInt32(),s=e.readInt32(),r=e.readInt32(),i=e.readInt32(),n=e.readInt32(),o=e.readInt32(),a=e.readF32(),c=e.readF32(),l=e.readF32(),u=e.readF32(),h=e.readF32(),d=e.readF32(),p=e.readF32(),f=e.readF32(),_=e.readF32(),m=Q(e,Pr.A)??[];return new Er(t,s,r,i,a,c,l,u,h,d,{size:p,offsetX:f,offsetY:_},m,n,o)}}function Rr(e,t,s){return e[0]=t[0]-s[0],e[1]=t[1]-s[1],e}function Or(e,t){return Math.sqrt(e*e+t*t)}function zr(e){const t=Or(e[0],e[1]);e[0]/=t,e[1]/=t}function Lr(e,t){return Or(e[0]-t[0],e[1]-t[1])}function Dr(e){return e.length-1}function qr(e,t,s=1){let[r,i]=function(e,t){return e[t+1]}(e,t);return[r,i]=[Math.round(r),Math.round(i)],Math.sqrt(r*r+i*i)*s}class Nr{constructor(e,t,s,r,i){this._segments=e,this._index=t,this._distance=s,this._xStart=r,this._yStart=i,this._done=!1}static create(e){return new Nr(e,0,0,e[0][0],e[0][1])}clone(){return new Nr(this._segments,this._index,this._distance,this.xStart,this.yStart)}equals(e){return this._index===e._index||e._index===this._index-1&&(0===this._distance||1===e._distance)||e._index===this._index+1&&(1===this._distance||0===e._distance)}leq(e){return this._index<e._index||this._index===e._index&&this._distance<=e._distance}geq(e){return this._index>e._index||this._index===e._index&&this._distance>=e._distance}get _segment(){return this._segments[this._index+1]}get angle(){const e=this.dy,t=(0*e+-1*-this.dx)/(1*this.length);let s=Math.acos(t);return e>0&&(s=2*Math.PI-s),s}get xStart(){return this._xStart}get yStart(){return this._yStart}get x(){return this.xStart+this.distance*this.dx}get y(){return this.yStart+this.distance*this.dy}get dx(){return this._segment[0]}get dy(){return this._segment[1]}get xMidpoint(){return this.xStart+.5*this.dx}get yMidpoint(){return this.yStart+.5*this.dy}get xEnd(){return this.xStart+this.dx}get yEnd(){return this.yStart+this.dy}get length(){const{dx:e,dy:t}=this;return Math.sqrt(e*e+t*t)}get remainingLength(){return this.length*(1-this._distance)}get backwardLength(){return this.length*this._distance}get distance(){return this._distance}get done(){return this._done}hasPrev(){return this._index-1>=0}hasNext(){return this._index+1<Dr(this._segments)}next(){return this.hasNext()?(this._xStart+=this.dx,this._yStart+=this.dy,this._distance=0,this._index+=1,this):null}prev(){return this.hasPrev()?(this._index-=1,this._xStart-=this.dx,this._yStart-=this.dy,this._distance=1,this):(this._done=!0,null)}_seekBackwards(e,t){const s=this.backwardLength;if(e<=s)return this._distance=(s-e)/this.length,this;let r=this.backwardLength;for(;this.prev();){if(r+this.length>e)return this._seekBackwards(e-r);r+=this.length}return this._distance=0,t?this:null}seek(e,t=!1){if(e<0)return this._seekBackwards(Math.abs(e),t);if(e<=this.remainingLength)return this._distance=(this.backwardLength+e)/this.length,this;let s=this.remainingLength;for(;this.next();){if(s+this.length>e)return this.seek(e-s,t);s+=this.length}return this._distance=1,t?this:null}}function Br(e,t,s,r=!0){const i=function(e){let t=0;for(let s=0;s<Dr(e);s++)t+=qr(e,s);return t}(e),n=Nr.create(e),o=i/2;if(!r)return n.seek(o),void(n.x<p.CQ&&n.y<p.CQ&&n.x>=0&&n.y>=0&&s(n.clone(),0,o+0*t,i));const a=Math.max((i-t)/2,0),c=Math.floor(a/t),l=o-c*t;n.seek(l);for(let e=-c;e<=c;e++)n.x<p.CQ&&n.y<p.CQ&&n.x>=0&&n.y>=0&&s(n.clone(),e,o+e*t,i),n.seek(t)}function Gr(e,t){const s=t;for(let t=0;t<e.length;t++){let r=e[t];jr(r,s);const i=[];i.push(r[0]);for(let e=1;e<r.length;e++){const[t,s]=r[e-1],[n,o]=r[e],a=n-t,c=o-s;i.push([a,c])}e[t]=i,r=i}return e}function jr(e,t){const s=1e-6;if(t<=0)return;const r=e.length;if(r<3)return;const i=[];let n=0;i.push(0);for(let t=1;t<r;t++)n+=Lr(e[t],e[t-1]),i.push(n);t=Math.min(t,.2*n);const o=[];o.push(e[0][0]),o.push(e[0][1]);const a=e[r-1][0],c=e[r-1][1],l=Rr([0,0],e[0],e[1]);zr(l),e[0][0]+=t*l[0],e[0][1]+=t*l[1],Rr(l,e[r-1],e[r-2]),zr(l),e[r-1][0]+=t*l[0],e[r-1][1]+=t*l[1];for(let e=1;e<r;e++)i[e]+=t;i[r-1]+=t;const u=.5*t;for(let n=1;n<r-1;n++){let a=0,c=0,l=0;for(let r=n-1;r>=0&&!(i[r+1]<i[n]-u);r--){const o=u+i[r+1]-i[n],h=i[r+1]-i[r],d=i[n]-i[r]<u?1:o/h;if(Math.abs(d)<s)break;const p=d*d,f=d*o-.5*p*h,_=d*h/t,m=e[r+1],y=e[r][0]-m[0],g=e[r][1]-m[1];a+=_/f*(m[0]*d*o+.5*p*(o*y-h*m[0])-p*d*h*y/3),c+=_/f*(m[1]*d*o+.5*p*(o*g-h*m[1])-p*d*h*g/3),l+=_}for(let o=n+1;o<r&&!(i[o-1]>i[n]+u);o++){const r=u-i[o-1]+i[n],h=i[o]-i[o-1],d=i[o]-i[n]<u?1:r/h;if(Math.abs(d)<s)break;const p=d*d,f=d*r-.5*p*h,_=d*h/t,m=e[o-1],y=e[o][0]-m[0],g=e[o][1]-m[1];a+=_/f*(m[0]*d*r+.5*p*(r*y-h*m[0])-p*d*h*y/3),c+=_/f*(m[1]*d*r+.5*p*(r*g-h*m[1])-p*d*h*g/3),l+=_}o.push(a/l),o.push(c/l)}o.push(a),o.push(c);for(let t=0,s=0;t<r;t++)e[t][0]=o[s++],e[t][1]=o[s++]}var Ur=s(63933),Vr=s(75434);class Wr{constructor(e){const{offsetX:t,offsetY:s,postAngle:r,fontSize:i,haloSize:n,outlineSize:o,scaleFactor:a,transforms:c}=e;if(this.offsetX=t,this.offsetY=s,this.postAngle=r,this.fontSize=Math.min(i,96),this.haloSize=n??0,this.outlineSize=o??0,this.transforms=c,c&&c.infos.length>1){const e=(0,Be.zb)(i,r,!1,t,s,c,!1);this.fontSize=Math.min(e.size,96);const n=e.size/i;this.haloSize*=n,this.outlineSize*=n,this.postAngle=e.rotation,this.offsetX=e.offsetX,this.offsetY=e.offsetY}a&&(this.fontSize*=a,this.offsetX*=a,this.offsetY*=a)}}const Yr=28,$r=[4,4],Hr=[16,4],Qr={topLeft:Hr,topRight:Hr,bottomLeft:Hr,bottomRight:Hr},Zr=[4,2],Xr=[4,6],Kr={topLeft:Zr,topRight:Zr,bottomLeft:Xr,bottomRight:Xr},Jr={topLeft:Zr,topRight:Xr,bottomLeft:Zr,bottomRight:Xr},ei={topLeft:Xr,topRight:Xr,bottomLeft:$r,bottomRight:$r},ti={topLeft:$r,topRight:$r,bottomLeft:Xr,bottomRight:Xr},si={topLeft:Xr,topRight:$r,bottomLeft:Xr,bottomRight:$r},ri={topLeft:$r,topRight:Xr,bottomLeft:$r,bottomRight:Xr};function ii(e){return{backgroundColor:e.boxBackgroundColor??e.backgroundColor??null,borderLineColor:e.boxBorderLineColor??e.borderLineColor??null,borderLineSize:e.boxBorderLineSize>0?e.boxBorderLineSize:e.borderLineWidth??0}}const ni={createComputedParams:e=>e,optionalAttributes:{zoomRange:{type:We.pe.HALF_FLOAT,count:2,packTessellation:({minZoom:e,maxZoom:t})=>[e||0,t||Yr]},clipAngle:{type:We.pe.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:e})=>ai(e||0)},referenceSymbol:{type:We.pe.BYTE,count:4,packTessellation:(e,t)=>{const s=e.isLineLabel||!e.referenceBounds,r=(0,Ur.iT)(s?"center":t.horizontalAlignment),i=(0,Ur.Dy)(s?"middle":t.verticalAlignment),{offsetX:n,offsetY:o,size:a}=s?{offsetX:0,offsetY:0,size:0}:e.referenceBounds;return[(0,u.Lz)(n),-(0,u.Lz)(o),Math.round((0,u.Lz)(a)),r+1<<2|i+1]}},visibility:{type:We.pe.FLOAT,count:1,otherSource:!0}},attributes:{pos:{type:We.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:We.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:We.pe.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:e,mapAligned:t})=>Ae([[0,e],[3,!!t]])},offset:{type:We.pe.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:e})=>{const{bottomLeft:t,bottomRight:s,topLeft:r,topRight:i}=e;return[r,i,t,s]}}},textureUV:{type:We.pe.UNSIGNED_SHORT,count:2,packAlternating:{count:4,packTessellation:({texcoords:e})=>{const{bottomLeft:t,bottomRight:s,topLeft:r,topRight:i}=e;return[r,i,t,s]}}},color:{type:We.pe.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:e})=>e},fontAndReferenceSize:{type:We.pe.UNSIGNED_SHORT,count:4,packPrecisionFactor:4,packTessellation:({fontSize:e,sdfSize:t,sdfRadius:s},{referenceSize:r})=>[Math.round((0,u.Lz)(e)),Math.round((0,u.Lz)(r??e)),t,s]},outlineColor:{type:We.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>Me(e)},haloColor:{type:We.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:e})=>Me(e)},outlineAndHaloSize:{type:We.pe.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:e,haloSize:t})=>[Math.round((0,u.Lz)(e)),Math.round((0,u.Lz)(t))]}}};class oi extends He{constructor(){super(...arguments),this.vertexSpec=ni,this._textMeshParamsPropsInitialized=!1}ensurePacked(e,t,s){super.ensurePacked(e,t,s),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new Wr(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}_write(e,{target:t,effectGeometry:s}){const r=this._getShaping();if(!r)return;const i=1===this.evaluatedMeshParams.alignment,n=t.getDisplayId();if(null!=this.evaluatedMeshParams.placement)return this._writePlacedTextMarkers(e,t,r,(0,Be.oI)(s));if(s?.nextPath())return s.nextPoint(),this._writeGlyphs(e,n,s.x,s.y,r,0,void 0,{mapAligned:i});if("esriGeometryPolygon"===t.geometryType){const s=t.readCentroidForDisplay();if(!s)return;const[o,a]=s.coords;return this._writeGlyphs(e,n,o,a,r,0,void 0,{mapAligned:i})}if("esriGeometryMultipoint"===t.geometryType){const s=t.readGeometryForDisplay();return void s?.forEachVertex((t,s)=>this._writeGlyphs(e,n,t,s,r,0,void 0,{mapAligned:i}))}const o=t.readXForDisplay(),a=t.readYForDisplay();return this._writeGlyphs(e,n,o,a,r,0,void 0,{mapAligned:i})}_writePlacedTextMarkers(e,t,s,r){const i=r??xe.z.fromFeatureSetReaderCIM(t);if(!i)return;const n=ve.getPlacement(i,-1,this.evaluatedMeshParams.placement,(0,u.Lz)(1),e.id);if(!n)return;const o=t.getDisplayId();let a=n.next();for(;null!=a;){const t=-a.getAngle(),r=a.tx,i=-a.ty;this._writeGlyphs(e,o,r,i,s,t,void 0,{mapAligned:1===this.evaluatedMeshParams.alignment}),a=n.next()}}_getShaping(e){const t=this._textMeshTransformProps,s=this.evaluatedMeshParams;if(!s.glyphs?.glyphs.length)return null;const r=(0,u.Lz)(t.fontSize),i=(0,u.Lz)(t.offsetX),n=(0,u.Lz)(t.offsetY),o=s.glyphs.sdfSize,a=(0,lr.qE)((0,u.Lz)(s.lineWidth),p.GR,p.cp),c=o/24*p.DY*(0,lr.qE)(s.lineHeightRatio,.25,4),{backgroundColor:l,borderLineSize:h}=ii(s);return(0,Vr.Tl)(s.glyphs,{scale:r/o,angle:t.postAngle,xOffset:i,yOffset:n,horizontalAlignment:s.horizontalAlignment,verticalAlignment:e||s.verticalAlignment,maxLineWidth:a,lineHeight:c,decoration:s.decoration,borderLineSizePx:(0,u.Lz)(h),hasBackground:!!l,useCIMAngleBehavior:s.useCIMAngleBehavior})}_writeGlyphs(e,t,s,r,i,n,o,a,c=!0){const l=this.evaluatedMeshParams,h=this._textMeshTransformProps,d=(0,u.Lz)(h.fontSize),p=h.haloSize,f=h.outlineSize,_=(0,u.Lz)(h.offsetX),m=(0,u.Lz)(h.offsetY),{sdfSize:y,sdfRadius:g}=l.glyphs,[x,w]=ke(l.scaleInfo,this.getTileInfo());0!==n&&i.setRotation(n);const b=i.bounds,v=s+b.x+_,S=r+b.y-m,I=2*(l.minPixelBuffer?l.minPixelBuffer/d:1),k=Math.max(b.width,b.height)*I;i.textBox&&(e.recordStart(this.instanceId,this.attributeLayout,i.glyphs[0].textureBinding),c&&e.recordBounds(v,S,k,k),this._writeTextBox(e,t,s,r,i.textBox,o,a),e.recordEnd());for(const n of i.glyphs){e.recordStart(this.instanceId,this.attributeLayout,n.textureBinding),c&&e.recordBounds(v,S,k,k);const{texcoords:i,offsets:u}=n;this._writeQuad(e,t,s,r,{texcoords:i,offsets:u,fontSize:d,haloSize:p,outlineSize:f,sdfSize:y,sdfRadius:g,color:Me(l.color),isBackground:!1,referenceBounds:o,minZoom:x,maxZoom:w,...a}),e.recordEnd()}0!==n&&i.setRotation(-n)}_writeTextBox(e,t,s,r,i,n,o){const a=this.evaluatedMeshParams,{fontSize:c,haloSize:l,outlineSize:u}=this._textMeshTransformProps,{backgroundColor:h,borderLineColor:d,borderLineSize:p}=ii(a),{sdfSize:f,sdfRadius:_}=a.glyphs,m=!!d&&p>0,y={isBackground:!0,fontSize:c,haloSize:l,outlineSize:u,referenceBounds:n,sdfSize:f,sdfRadius:_,...o};h&&(this._writeQuad(e,t,s,r,{texcoords:Qr,offsets:i.main,color:Me(h),...y}),m||(this._writeQuad(e,t,s,r,{texcoords:ei,offsets:i.top,color:Me(h),...y}),this._writeQuad(e,t,s,r,{texcoords:ti,offsets:i.bot,color:Me(h),...y}),this._writeQuad(e,t,s,r,{texcoords:si,offsets:i.left,color:Me(h),...y}),this._writeQuad(e,t,s,r,{texcoords:ri,offsets:i.right,color:Me(h),...y}))),m&&(this._writeQuad(e,t,s,r,{texcoords:Kr,offsets:i.top,color:Me(d),...y}),this._writeQuad(e,t,s,r,{texcoords:Kr,offsets:i.bot,color:Me(d),...y}),this._writeQuad(e,t,s,r,{texcoords:Jr,offsets:i.left,color:Me(d),...y}),this._writeQuad(e,t,s,r,{texcoords:Jr,offsets:i.right,color:Me(d),...y}))}_writeQuad(e,t,s,r,i){const n=e.vertexCount();this._writeVertex(e,t,s,r,i),e.indexWrite(n+0),e.indexWrite(n+1),e.indexWrite(n+2),e.indexWrite(n+1),e.indexWrite(n+3),e.indexWrite(n+2)}}const ai=e=>Math.round(e*(256/360)),ci=p.CQ*p.CQ/16,li=(0,Be.z9)(()=>Promise.all([s.e(6042),s.e(1878),s.e(8885),s.e(5756),s.e(3708)]).then(s.bind(s,33708))),ui=(0,Be.z9)(()=>Promise.all([s.e(6042),s.e(1878),s.e(8885),s.e(4690)]).then(s.bind(s,14690))),hi=(0,O.Bj)(e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t});class di extends oi{constructor(){super(...arguments),this._zoomLevel=0}async loadDependencies(){await Promise.all([super.loadDependencies(),li.getImportPromise(),ui.getImportPromise()])}_write(e,{target:t,effectGeometry:s,level:r,viewExtent:i}){if(this._zoomLevel=r,null!=s)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const s=t.readXForDisplay(),r=t.readYForDisplay();this._writePoint(e,s,r,0,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":this._writePolygon(e,t,i);break;case"esriGeometryMultipoint":{let s=0;const r=xe.z.fromFeatureSetReader(t);if(r?.nextPath())for(;r.nextPoint();)this._writePoint(e,r.x,r.y,s++,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_getMetricDir(){const{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return["center"===e?0:"right"===e?-1:1,"middle"===t?0:"bottom"===t?-1:1]}_createLineLabelMetric(e,t,s,r,i,n){const[o,a]=this._getMetricDir(),c=this.evaluatedMeshParams.scaleInfo?.maxScale??0,l=this.evaluatedMeshParams.scaleInfo?.minScale??0,u=this.evaluatedMeshParams.labelClassId;return new Er(e,u,t,s,r,i,o,a,c,l,n)}_writePolygon(e,t,s){const r=li.module,i=ui.module.constructFromFlatGeometry,n=t.readGeometryForDisplay(),o=t.readCentroidForDisplay()?.coords,a=n?.area()||0;if(!o)return;const c=a>=ci;e.requiresRefresh||=c;const l=i((0,Mr.ME)(s)),u=i((0,Mr.ME)({x:o[0],y:o[1]})),h=!!r.execute(u,l,null);if(!n||!c||!h)return void this._writePoint(e,o[0],o[1],0,t);const d=i((0,Mr.Nh)("polygon",n,null)),p=r.execute(d,l,null);if(!p)return void this._writePoint(e,o[0],o[1],0,t);const f=(0,Mr.JR)(new Mr.uX(p.toFlatGeometry())),_=xe.z.fromOptimized(f,"esriGeometryPolygon",1),m=(0,Fr.d)(_)??o;this._writePoint(e,m[0],m[1],0,t)}_writePoint(e,t,s,r,i){if(t<0||t>p.CQ||s<0||s>p.CQ)return;const n=this._getShaping();if(!n)return;const o=i.getDisplayId(),a=this.evaluatedMeshParams.labelClassId,c=function(e,t,s){return(0,me.Wm)(`${e}${t}${s}`)}(this.evaluatedMeshParams.layerId,i.getObjectId(),r),l=function(e,t,s){return(0,me.Wm)(`${e}${t}${s}`)}(i.getObjectId(),a,r),[u,h]=this._getMetricDir(),d=this.evaluatedMeshParams.scaleInfo?.maxScale??0,f=this.evaluatedMeshParams.scaleInfo?.minScale??0,_=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new Er(o,a,c,l,t,s,u,h,d,f,_)),this._writeGlyphs(e,o,t,s,n,0,_,void 0,!1),e.metricBoxWrite(n.boundsT),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t){const{scaleInfo:s,verticalAlignment:r}=this.evaluatedMeshParams,i=this.evaluatedMeshParams.repeatLabelDistance||128,n=this._getShaping("middle");if(!n)return;const o=(e,t,s,r)=>this._placeSubdivGlyphs(e,t,s,r),a=(n.bounds.width+i)/2;this._current={out:e,id:t.getDisplayId(),objId:t.getObjectId(),shaping:n,zoomRange:ke(s,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null,pathIndex:0},this._verticalPlacement="bottom"===r?"above":"top"===r?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,o,a):this._writeCenterAlong(t,o,a)}_writeAboveAndBelowAlong(e,t,s){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:i}=this._current,n=i.bounds.halfHeight,o=e.readGeometryForDisplay();if(!o)return;const a=(0,Cr.kz)(o,"esriGeometryPolyline",1)??new Xt.A,c=pi(a,n),l=pi(a,-n),u=(0,Cr.zv)(l,"esriGeometryPolyline",!1,!1),h=Gr((0,Cr.zv)(c,"esriGeometryPolyline",!1,!1).paths,i.bounds.width),d=Gr(u.paths,i.bounds.width);this._current.offsetDirection="above";for(let e=0;e<h.length;e++)this._current.pathIndex=e,Br(h[e],s,t,!!r);this._current.offsetDirection="below";for(let e=0;e<d.length;e++)this._current.pathIndex=e,Br(d[e],s,t,!!r)}_writeCenterAlong(e,t,s){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:i}=this._current,n=Gr(e.readLegacyGeometryForDisplay().paths,i.bounds.width);for(let e=0;e<n.length;e++)this._current.pathIndex=e,Br(n[e],s,t,!!r)}_placeSubdivGlyphs(e,t,s,r){const{allowOverrun:i,labelPosition:n,repeatLabelDistance:o,layerId:a,labelClassId:c}=this.evaluatedMeshParams,{objId:l,shaping:u,pathIndex:h}=this._current,d=this._current.zoomRange[0],p=hi(t),f=this._current.shaping.bounds.width/2,_=Math.sqrt(o||128)/2,m=Math.min(s,r-s),y=u.isMultiline?Yr:Math.log2(m/(_+f/2)),g=0===t?y:Math.min(p,y),x=Math.max(d,this._zoomLevel+1-g),w=this._zoomLevel-x,b=u.bounds.width/2*2**w,v=function(e,t,s,r,i){return(0,me.Wm)(`${e}${t}${s}${r*2**(Yr-i)}`)}(a,l,h,t,this._zoomLevel),S=function(e,t,s,r,i){return(0,me.Wm)(`${e}${i}${t}${s*2**(Yr-r)}`)}(l,h,t,this._zoomLevel,c);this._current.shaping.isMultiline?0===t&&this._placeStraight(e,x,v,S):i&&w<0?this._placeStraightAlong(e,d,v,S):"parallel"===n?this._placeStraightAlong(e,x,v,S):"curved"===n&&this._placeCurved(e,x,b,v,S)}_placeStraight(e,t,s,r){const{out:i,id:n,shaping:o,referenceBounds:a}=this._current,{x:c,y:l}=e;i.metricStart(this._createLineLabelMetric(n,s,r,c,l)),i.metricBoxWrite(o.boundsT);const u=e.angle*(180/Math.PI)%360,h=(e.angle*(180/Math.PI)+180)%360;if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const e={clipAngle:u,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(i,n,c,l,o,0,a,e,!1)}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const e={clipAngle:h,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(i,n,c,l,o,0,a,e,!1)}i.metricEnd()}_placeCurved(e,t,s,r,i){const{out:n,id:o}=this._current;n.metricStart(this._createLineLabelMetric(o,r,i,e.x,e.y));const a=e.clone(),c=e.angle*(180/Math.PI)%360,l=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(a,t,1,c),this._placeBack(e,a,t,s,1,c),this._placeForward(e,a,t,s,1,c)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(a,t,0,l),this._placeBack(e,a,t,s,0,l),this._placeForward(e,a,t,s,0,l)),n.metricEnd()}_placeStraightAlong(e,t,s,r){const{out:i,id:n,shaping:o,zoomRange:a,referenceBounds:c}=this._current,{boxBorderLineColor:l,boxBackgroundColor:h}=this.evaluatedMeshParams,d=e.clone(),p=e.angle*(180/Math.PI)%360,f=(e.angle*(180/Math.PI)+180)%360,_=o.glyphs.length>0&&!(!l&&!h);if(i.metricStart(this._createLineLabelMetric(n,s,r,e.x,e.y)),_){const s=Math.max(t,a[0],0),r=Math.min(Yr,a[1]),l=(0,Ir.$0)((0,kr.vt)(),-e.angle),h={minZoom:s,maxZoom:r,clipAngle:p,mapAligned:!0,isLineLabel:!0},d=(0,u.Lz)(this.evaluatedMeshParams.offsetX),_=(0,u.Lz)(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=(0,Tr.fA)(d,-1*_),[s,r]=o.shapeBackground((0,Ir.Tl)((0,kr.vt)(),l,t));i.recordStart(this.instanceId,this.attributeLayout,o.glyphs[0].textureBinding),this._writeTextBox(i,n,e.x,e.y,r,c,h),i.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=(0,Tr.fA)(d,_),[s,r]=o.shapeBackground((0,Ir.Tl)((0,kr.vt)(),l,t));h.clipAngle=f,i.recordStart(this.instanceId,this.attributeLayout,o.glyphs[0].textureBinding),this._writeTextBox(i,n,e.x,e.y,r,c,h),i.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(d,t,1,p,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(d,t,0,f,!0),i.metricEnd()}_placeBack(e,t,s,r,i,n){const o=e.clone();let a=e.backwardLength+0;for(;o.prev()&&!(a>=r);)this._placeOnSegment(o,t,a,s,-1,i,n),a+=o.length+0}_placeForward(e,t,s,r,i,n){const o=e.clone();let a=e.remainingLength+0;for(;o.next()&&!(a>=r);)this._placeOnSegment(o,t,a,s,1,i,n),a+=o.length+0}_placeFirst(e,t,s,r,i=!1){const{out:n,id:o,shaping:a,zoomRange:c,referenceBounds:l}=this._current,u=a.glyphs,h=this._getBoundsOffset(e.angle);for(const d of u){const u=d.x>a.bounds.x?s:1-s,p=u*e.remainingLength+(1-u)*e.backwardLength,f=Math.abs(d.x+d.width/2-a.bounds.x),_=Math.max(0,this._zoomLevel+Math.log2(f/(p+0))),m=Math.max(t,i?0:_);d.angle=e.angle+(1-s)*Math.PI;const y=[Math.max(c[0],m),Math.min(c[1],Yr)];this._writeLineGlyph(n,o,e.x,e.y,d,y,r,l),this._writeLineGlyphBox(n,d,s,y,h)}}_placeOnSegment(e,t,s,r,i,n,o){const{out:a,id:c,shaping:l,referenceBounds:u}=this._current,h=l.glyphs,d=e.dx/e.length,p=e.dy/e.length,f={x:e.x+s*-i*d,y:e.y+s*-i*p},_=this._getBoundsOffset(e.angle);for(const t of h){const h=t.x>l.bounds.x?n:1-n;if(!(h&&1===i||!h&&-1===i))continue;const d=Math.abs(t.x+t.width/2-l.bounds.x),p=Math.max(0,this._zoomLevel+Math.log2(d/s)-.1),m=Math.max(r,this._zoomLevel+Math.log2(d/(s+e.length+0)));if(0===p)continue;t.angle=e.angle+(1-n)*Math.PI;const y=[m,p];this._writeLineGlyph(a,c,f.x,f.y,t,y,o,u),this._writeLineGlyphBox(a,t,n,y,_)}}_getBoundsOffset(e){const t=(0,u.Lz)(this.evaluatedMeshParams.offsetX),s=(0,u.Lz)(this.evaluatedMeshParams.offsetY),r=(0,Tr.fA)(t,s),i=(0,Ir.$0)((0,kr.vt)(),-e);return(0,D.l0)(r,r,i)}_writeLineGlyph(e,t,s,r,i,n,o,a){if(s<0||s>p.CQ||r<0||r>p.CQ)return;e.recordStart(this.instanceId,this.attributeLayout,i.textureBinding);const{texcoords:c,offsets:l}=i,{fontSize:u,haloSize:h,outlineSize:d}=this._textMeshTransformProps,{sdfSize:f,sdfRadius:_}=this.evaluatedMeshParams.glyphs;this._writeQuad(e,t,s,r,{sdfSize:f,sdfRadius:_,texcoords:c,offsets:l,fontSize:u,haloSize:h,outlineSize:d,color:Me(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:a,minZoom:Math.max(this._current.zoomRange[0],n[0]),maxZoom:Math.min(this._current.zoomRange[1],n[1]),clipAngle:o,mapAligned:!0,isLineLabel:!0}),e.recordEnd()}_writeLineGlyphBox(e,t,s,r,i){if((s||this._current.offsetDirection)&&this._isVisible(r)&&t.bounds){const s=t.bounds,r=new Pr.A(s.x+i[0],s.y+i[1],s.width,s.height);e.metricBoxWrite(r)}}_isVisible(e){const t=Math.max(this._current.zoomRange[0],e[0]),s=Math.min(this._current.zoomRange[1],e[1]),r=this._zoomLevel;return t<=r&&r<=s}}function pi(e,t){const s=new Xt.A,{coords:r,lengths:i}=e,n=(0,Ar.vt)(),o=(0,Ar.vt)(),a=(0,Ar.vt)(),c=(0,Ar.vt)(),l=(0,Ar.vt)(),u=(0,Ar.vt)();let h=0;for(let e=0;e<i.length;e++){const d=i[e];for(let e=0;e<d;e++){const i=2*(e+h-1),p=2*(e+h),f=2*(e+h+1);e>0?(0,D.hZ)(n,r[i],r[i+1]):(0,D.hZ)(n,0,0),(0,D.hZ)(o,r[p],r[p+1]),e<d-1?(0,D.hZ)(a,r[f],r[f+1]):(0,D.hZ)(a,0,0),0===e?(0,D.hZ)(c,0,0):((0,D.jb)(c,o,n),(0,D.S8)(c,c),(0,D.hZ)(c,c[1],-c[0])),e===d-1?(0,D.hZ)(l,0,0):((0,D.jb)(l,a,o),(0,D.S8)(l,l),(0,D.hZ)(l,l[1],-l[0])),(0,D.WQ)(u,c,l),(0,D.S8)(u,u);const _=u[0]*l[0]+u[1]*l[1];0!==_&&(0,D.hs)(u,u,_),(0,D.hs)(u,u,t),s.coords.push(o[0]+u[0],o[1]+u[1])}s.lengths.push(d),h+=d}return s}const fi={createComputedParams:e=>e,optionalAttributes:Rs.optionalAttributes,attributes:{...Rs.attributes,bitset:{type:We.pe.UNSIGNED_BYTE,count:1,pack:({gradientMethod:e,gradientSizeUnits:t,gradientType:s})=>Ae([[0,"alongline"===e.toLowerCase()],[1,t===cr.h.Absolute],[2,"discrete"===s.toLowerCase()]])},tlbr:{type:We.pe.UNSIGNED_SHORT,count:4,pack:({sprite:e})=>{const{rect:t,width:s,height:r}=e,i=t.x+p.hM+p.MZ,n=t.y+p.hM;return[i,n,i+s-2*p.MZ,n+r]}},accumulatedDistance:{type:We.pe.HALF_FLOAT,count:1,packTessellation:({distance:e,pathLength:t,distanceOffset:s})=>(s+e)/t},gradientSize:{type:We.pe.HALF_FLOAT,count:1,pack:({gradientSize:e,gradientSizeUnits:t})=>t===cr.h.Relative?e/100:(0,u.Lz)(e)},totalLength:{type:We.pe.HALF_FLOAT,count:1,packTessellation:({pathLength:e})=>e},segmentDirection:{type:We.pe.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:e,directionY:t})=>[e,t]}}};class _i extends Ls{get _preventEffectClipping(){return!0}constructor(e,t,s,r){super(e,t,s,r),this.vertexSpec=fi,this._tessellationOptions.textured=!0}_write(e,{target:t,effectGeometry:s}){const r=s??xe.z.fromFeatureSetReaderCIM(t);if(!r)return;const{sprite:i}=this.evaluatedMeshParams;this._writeGeometry(e,t,r,i?.textureBinding)}}const mi={createComputedParams:e=>e,optionalAttributes:Rs.optionalAttributes,attributes:{...Rs.attributes,bitset:{type:We.pe.UNSIGNED_BYTE,count:1,pack:({shouldSampleAlphaOnly:e,shouldScaleDash:t,isSDF:s})=>Ae([[4,e],[2,t],[3,s]])},tlbr:{type:We.pe.UNSIGNED_SHORT,count:4,pack:({sprite:e})=>{const{rect:t,width:s,height:r}=e,i=t.x+p.hM,n=t.y+p.hM;return[i,n,i+s,n+r]}},accumulatedDistance:{type:We.pe.UNSIGNED_SHORT,count:1,packTessellation:({distance:e})=>e},segmentDirection:{type:We.pe.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:e,directionY:t})=>[e,t]},offsetAlongLine:{type:We.pe.HALF_FLOAT,count:1,pack:({offsetAlongLine:e})=>(0,u.Lz)(e)},capType:{type:We.pe.UNSIGNED_BYTE,count:1,pack:({capType:e})=>{switch(e){case"Butt":case"butt":default:return 0;case"Square":case"square":return 1;case"Round":case"round":return 2}}}}};class yi extends Ls{constructor(e,t,s,r){super(e,t,s,r),this.vertexSpec=mi,this._tessellationOptions.textured=!0}_write(e,{target:t,effectGeometry:s}){const r=s??xe.z.fromFeatureSetReaderCIM(t);if(!r)return;const{sprite:i}=this.evaluatedMeshParams;this._writeGeometry(e,t,r,i?.textureBinding)}}class gi{static from(e){return"width"in e?this.fromSimpleMeshParams(e):this.fromComplexMeshParams(e)}static fromSimpleMeshParams(e){const t=new gi(e.sprite,e.color,e.outlineColor,e.minPixelBuffer,e.placement,e.scaleInfo,e.effects),{type:s,width:r,height:i,angle:n,alignment:o,outlineSize:a,referenceSize:c,sprite:l,overrideOutlineColor:h}=e;return t.rawWidth=(0,u.Lz)(r),t.rawHeight=(0,u.Lz)(i),t.angle=n,t.alignment=o,t.outlineSize=(0,u.Lz)(a),t.referenceSize=(0,u.Lz)(c),t.overrideOutlineColor=h,t.offsetX=(0,u.Lz)(e.offsetX),t.offsetY=(0,u.Lz)(e.offsetY),"simple"!==s||l.sdf||(t.rawWidth=l.width,t.rawHeight=l.height),t._computeSize(e,!1),t}static fromComplexMeshParams(e){const t=new gi(e.sprite,e.color,e.outlineColor,e.minPixelBuffer,e.placement,e.scaleInfo,e.effects);let{alignment:s,transforms:r,size:i,scaleX:n,anchorX:o,anchorY:a,angle:c,colorLocked:l,frameHeight:h,widthRatio:d,offsetX:p,offsetY:f,outlineSize:_,referenceSize:m,scaleFactor:y,sizeRatio:g,isAbsoluteAnchorPoint:x,rotateClockwise:w,scaleSymbolsProportionally:b,sprite:v}=e;if(r&&r.infos.length>0){const e=(0,Be.zb)(i,c,w,p,f,r);i=e.size,c=e.rotation,p=e.offsetX,f=e.offsetY,w=!1}y&&(i*=y,p*=y,f*=y);const S=n*(v.width/v.height);t.alignment=s,t.rawHeight=(0,u.Lz)(i),t.rawWidth=t.rawHeight*S,t.referenceSize=(0,u.Lz)(m),t.sizeRatio=g,t.sdfDecodeCoeff=(v.sdfDecodeCoeff??1)*g,t.angle=c,t.rotateClockwise=w,t.anchorX=o,t.anchorY=a,t.offsetX=(0,u.Lz)(p),t.offsetY=(0,u.Lz)(f),x&&i&&(v.sdf?t.anchorX=o/(i*d):t.anchorX=o/(i*S),t.anchorY=a/i);const I=b&&h?i/h:1;return t.outlineSize=0===_||isNaN(_)?0:(0,u.Lz)(_)*I,t.scaleSymbolsProportionally=b,t.colorLocked=l,t._computeSize(e,!0),t}constructor(e,t,s,r,i,n,o){this.sprite=e,this.color=t,this.outlineColor=s,this.minPixelBuffer=r,this.placement=i,this.scaleInfo=n,this.effects=o,this.rawWidth=0,this.rawHeight=0,this.angle=0,this.outlineSize=0,this.referenceSize=0,this.sizeRatio=1,this.sdfDecodeCoeff=1,this.alignment=0,this.scaleSymbolsProportionally=!1,this.overrideOutlineColor=!1,this.colorLocked=!1,this.anchorX=0,this.anchorY=0,this.computedWidth=0,this.computedHeight=0,this.texXmin=0,this.texYmin=0,this.texXmax=0,this.texYmax=0,this.offsetX=0,this.offsetY=0,this.rotateClockwise=!0}get boundsInfo(){return{size:Math.max(this.computedHeight,this.computedWidth),offsetX:this.offsetX,offsetY:this.offsetY}}_computeSize(e,t){const{sprite:s,hasSizeVV:r}=e,i=!!s.sdf,n=s.sdfPaddingRatio??.5,{rawWidth:o,rawHeight:a,sizeRatio:c,outlineSize:l}=this,u=s.rect;let h=o*c,d=a*c,f=0,_=0;if(i){const e=1/(1-n);if(h*=e,d*=e,r)this.computedWidth=h,this.computedHeight=d;else{const e=t&&o>a?h:o,r=a,i=l+2;this.computedWidth=Math.min(e+i,h),this.computedHeight=Math.min(r+i,d);const n=Math.max(s.width,s.height)/Math.max(h,d);f=(this.computedWidth-h)*n,_=(this.computedHeight-d)*n}}else this.computedWidth=h*(u.width/s.width),this.computedHeight=d*(u.height/s.height),f=2*p.hM,_=2*p.hM;const m=u.x+p.hM-f/2,y=u.y+p.hM-_/2,g=m+s.width+f,x=y+s.height+_;this.texXmin=xi(m),this.texYmin=xi(y),this.texXmax=wi(g),this.texYmax=wi(x),this.computedWidth*=(this.texXmax-this.texXmin)/(g-m),this.computedHeight*=(this.texYmax-this.texYmin)/(x-y),this.anchorX*=h/this.computedWidth,this.anchorY*=d/this.computedHeight}}function xi(e,t=1e-7){const s=Math.ceil(e);return s-e<t?s:Math.floor(e)}function wi(e,t=1e-7){const s=Math.floor(e);return e-s<t?s:Math.ceil(e)}const bi=128/Math.PI;const vi={createComputedParams:e=>gi.from(e),optionalAttributes:{zoomRange:{type:We.pe.HALF_FLOAT,count:2,pack:({scaleInfo:e},{tileInfo:t})=>ke(e,t)}},attributes:{pos:{type:We.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:We.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:We.pe.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:s,overrideOutlineColor:r,colorLocked:i})=>{let n=0;return e.sdf&&(n|=Te(Re)),1===t&&(n|=Te(Oe)),s&&(n|=Te(ze)),r&&(n|=Te(Le)),i&&(n|=Te(De)),n}},offset:{type:We.pe.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:s,anchorX:r,anchorY:i,offsetX:n,offsetY:o,rotateClockwise:a})=>{const c=function(e,t,s,r,i=!1){const n=(0,kr.vt)(),o=i?1:-1;return(0,Ir.D_)(n),(t||s)&&(0,Ir.Tl)(n,n,[t,-s]),r&&(0,Ir.e$)(n,n,.017453292519944444*o*-r),n}(0,n,o,-e,a),l=-(.5+r)*t,u=-(.5-i)*s,h=[l,u],d=[l+t,u],p=[l,u+s],f=[l+t,u+s];return(0,D.l0)(h,h,c),(0,D.l0)(d,d,c),(0,D.l0)(p,p,c),(0,D.l0)(f,f,c),[h,d,p,f]}}},textureUV:{type:We.pe.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:s,texYmin:r})=>[[t,r],[e,r],[t,s],[e,s]]}},color:{type:We.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>Me(e)},outlineColor:{type:We.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>Me(e)},sizing:{type:We.pe.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:s,referenceSize:r})=>[Pe(Math.max(e,t),128),Pe(s,128),Pe(r,128),0]},placementAngle:{type:We.pe.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>function(e){return function(e){return e%=256,Math.abs(e>=0?e:e+256)}(e*bi)}(e)},sdfDecodeCoeff:{type:We.pe.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class Si extends He{constructor(){super(...arguments),this.vertexSpec=vi}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(e,{target:t,effectGeometry:s}){const r=this.evaluatedMeshParams.sprite?.textureBinding,i=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,r);const n=this.evaluatedMeshParams.minPixelBuffer,o=Math.max(this.evaluatedMeshParams.computedWidth,n),a=Math.max(this.evaluatedMeshParams.computedHeight,n),c=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,l=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,u=this.evaluatedMeshParams.offsetX+c,h=-this.evaluatedMeshParams.offsetY+l;if(null!=this.evaluatedMeshParams.placement){let r=null;if(null!=s){const e=Math.max(this.evaluatedMeshParams.computedWidth,this.evaluatedMeshParams.computedHeight);if(r=(0,Ne.qc)(s,2*e,!1),null===r)return}this._writePlacedMarkers(e,t,r,o,a)}else if(s?.nextPath()){s.nextPoint();const t=s.x,r=s.y;e.recordBounds(t+u,r+h,o,a),this._writeQuad(e,i,t,r)}else if("esriGeometryPolygon"===t.geometryType){const s=t.readCentroidForDisplay();if(!s)return;const[r,n]=s.coords;e.recordBounds(r+u,n+h,o,a),this._writeQuad(e,i,r,n)}else if("esriGeometryPoint"===t.geometryType){const s=t.readXForDisplay(),r=t.readYForDisplay();e.recordBounds(s+u,r+h,o,a),this._writeQuad(e,i,s,r)}else{const s=t.readGeometryForDisplay();s?.forEachVertex((t,s)=>{e.recordBounds(t+u,s+h,o,a),Math.abs(t)>we.$u||Math.abs(s)>we.$u||this._writeQuad(e,i,t,s)})}e.recordEnd()}_writePlacedMarkers(e,t,s,r,i){const n=s??xe.z.fromFeatureSetReaderCIM(t);if(!n)return;const o=ve.getPlacement(n,-1,this.evaluatedMeshParams.placement,(0,u.Lz)(1),e.id);if(!o)return;const a=t.getDisplayId();let c=o.next();const l=this.evaluatedMeshParams.offsetX,h=-this.evaluatedMeshParams.offsetY;for(;null!=c;){const t=c.tx,s=-c.ty;if(Math.abs(t)>we.$u||Math.abs(s)>we.$u){c=o.next();continue}const n=-c.getAngle();e.recordBounds(t+l,s+h,r,i),this._writeQuad(e,a,t,s,n),c=o.next()}}_writeQuad(e,t,s,r,i){const n=e.vertexCount(),o=null==i?null:{placementAngle:i};this._writeVertex(e,t,s,r,o),e.indexWrite(n+0),e.indexWrite(n+1),e.indexWrite(n+2),e.indexWrite(n+1),e.indexWrite(n+3),e.indexWrite(n+2)}}var Ii=s(4576),ki=s(4718),Ti=s(55674);class Ai{destroy(){}}class Mi extends Ai{constructor(e){super(),this._value=e}resize(e){}read(e,t){return this._value}readWithDefault(e,t,s){return this._value}hasArcadeDependency(e){return!1}}const Fi=()=>Ie.A.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.mesh.MeshWriterInputEvaluator");async function Ci(e,t,s,r){const{defaultValue:i,valueExpressionInfo:n,value:o}=t;if(n){if("dictionary-template"===n.type)return{...t,computed:e.createDictionaryTemplateField(n,s),defaultValue:i};const{expression:o}=n,a=await e.createComputedField({expression:o},r);return a?{...t,computed:a,defaultValue:i}:null}return{...t,computed:new Mi(o),defaultValue:i}}async function Pi(e,t,s){const{valueExpressionInfo:r}=t,i="dictionary-template"===r.type?e.createDictionaryTemplateField(r,s):await e.createComputedField({expression:r.expression});return i?{...t,computed:i}:null}function Ei(e){return"object"==typeof e&&null!=e&&(!(!("valueExpressionInfo"in e)||!e.valueExpressionInfo)||"type"in e&&"Process"===e.type&&"op"in e&&"Random"===e.op)}function Ri(e){if(Array.isArray(e))for(const t of e)if(Ri(t))return!0;if("object"==typeof e){if(Ei(e))return!0;for(const t in e)if(Ri(e[t]))return!0}return!1}class Oi{static async create(e,t,s,r){const i={},n=new Map,o=new Map,a=new Map,c=new Map,l=new Map,u=new Map;for(const h in s){const d=s[h];if(null!=d&&"object"==typeof d)if(Array.isArray(d)){if("object"==typeof d[0])throw new Error(`InternalError: Cannot handle ${h}. Nested array params are not supported`);i[h]=d}else{if("valueExpressionInfo"in d){if(d.value){i[h]=d.value;continue}const t=await Pi(e,d,r);if(!t){i[h]=d.defaultValue;continue}n.set(h,t),i[h]=null;continue}switch(d.type){case"cim-effect-infos":if(d.effectInfos.some(e=>e.overrides.length)){o.set(h,{effects:await Promise.all(d.effectInfos.map(async t=>{const s=t.overrides.map(t=>Ci(e,t,r,!1));return{effect:t.effect,compiledOverrides:(await Promise.all(s)).filter(Ii.Ru)}}))});break}i[h]=d.effectInfos.map(e=>e.effect);break;case"cim-marker-placement-param":d.overrides.length&&a.set(h,{placementInfo:d,compiledOverrides:(await Promise.all(d.overrides.map(t=>Ci(e,t,r,!1)))).filter(Ii.Ru)}),i[h]=d.placement;break;case"text-rasterization-param":{if(d.overrides.length){const t=d.overrides.map(t=>Ci(e,t,r,d.useLegacyLabelEvaluationRules??!1));c.set(h,{compiledOverrides:(await Promise.all(t)).filter(Ii.Ru),rasterizationParam:d,objectIdToResourceId:new Map});continue}const s={type:"cim-rasterization-info",resource:d.resource};i[h]=await t.fetchResourceImmediate(s)??null;break}case"sprite-rasterization-param":{if(d.overrides.length){const t=d.overrides.map(t=>Ci(e,t,r,!1));c.set(h,{compiledOverrides:(await Promise.all(t)).filter(Ii.Ru),rasterizationParam:d,objectIdToResourceId:new Map});continue}if("animated"===d.resource.type){c.set(h,{compiledOverrides:[],rasterizationParam:d,objectIdToResourceId:new Map});continue}const s={type:"cim-rasterization-info",resource:d.resource};i[h]=await t.fetchResourceImmediate(s)??null;break}case"cim-marker-transform-param":{const{params:t}=d;if(Ri(t)){const s={compiledMarkerInfos:[]};await Promise.all(t.map(async t=>{const i={props:{}};for(const s in t)if(Ei(t[s])){const n=await Pi(e,t[s],r);i.compiledExpressionMap||(i.compiledExpressionMap=new Map);const o=i.compiledExpressionMap;n&&o.set(s,n)}else i.props[s]=t[s];s.compiledMarkerInfos.push(i)})),l.set(h,s)}else i[h]={type:"cim-marker-transform-info",infos:t};break}case"animation-params":{const{params:s}=d,r=gt(s);if(Ri(r)){const t=await Promise.all(r.map(t=>wt(t,e)));u.set(h,{params:t,propertyIdToResourceId:new Map,key:h})}else{const e=yt(r),s=await t.fetchResourceImmediate({type:"animation-info",resource:e});null!=s&&"sprite"===s.type&&(i[h]={dataRow:s.rect.y,dataColumn:s.rect.x})}break}default:i[h]=d}}else i[h]=d}return new Oi(s,i,n,o,a,c,l,u)}constructor(e,t,s,r,i,n,o,a){this.inputMeshParams=e,this._resolvedMeshParams=t,this._dynamicProperties=s,this._dynamicEffectProperties=r,this._dynamicPlacementProperties=i,this._dynamicAsyncProperties=n,this._dynamicTransformProperties=o,this._dynamicAsyncAnimations=a,this.evaluator=e=>e,this._arcadeDependencies=new Set;for(const e of this._expressions())(0,Ti.QY)(this._arcadeDependencies,e)}get hasDynamicProperties(){return!!(this._dynamicProperties.size||this._dynamicAsyncProperties.size||this._dynamicEffectProperties.size||this._dynamicTransformProperties.size||this._dynamicPlacementProperties.size||this._dynamicAsyncAnimations.size)}get evaluatedMeshParams(){return this._evaluatedMeshParams||(this._evaluatedMeshParams=this.evaluator(this._resolvedMeshParams)),this._evaluatedMeshParams}enqueueRequest(e,t,s){for(const i of this._dynamicAsyncProperties.values()){const n=(0,ki.o8)(i.rasterizationParam.resource);"animated"===i.rasterizationParam.resource.type&&i.rasterizationParam.resource.randomizeStartTime&&(n.primitiveName="__RESERVED__PRIMITIVE__NAME__",n.startGroup=Ke(t.getObjectId()||0));for(const{primitiveName:e,propertyName:o,computed:a,defaultValue:c,valueExpressionInfo:l}of i.compiledOverrides)try{const r="animated"===i.rasterizationParam.resource.type?n.primitiveName:e;(0,Ps.Ph)(n,r,o,a,t,s,c)}catch(e){Fi().errorOnce(new r.A("invalid-arcade-expression","Encountered an error when evaluating the arcade expression",{error:e,valueExpressionInfo:l}))}const o=e.enqueueRequest({type:"cim-rasterization-info",resource:n});i.objectIdToResourceId.set(t.getObjectId(),o)}for(const r of this._dynamicAsyncAnimations.values()){const i=r.params.map(e=>bt(e,t,s)).map(ut).map(e=>e.simplify()),n=xt(i),o=e.enqueueRequest({type:"animation-info",resource:n});r.propertyIdToResourceId.set(t.getObjectId()+"."+r.key,o)}}evaluateMeshParams(e,t,s){for(const[e,r]of this._dynamicProperties.entries())this._resolvedMeshParams[e]=r.computed.readWithDefault(t,s,r.defaultValue);for(const[e,r]of this._dynamicPlacementProperties.entries())for(const{computed:i,defaultValue:n,propertyName:o}of r.compiledOverrides){const a=i.readWithDefault(t,s,n);r.placementInfo.placement[o]=a,this._resolvedMeshParams[e]=r.placementInfo.placement}for(const[e,r]of this._dynamicEffectProperties.entries())for(const i of r.effects){for(const{computed:e,defaultValue:r,propertyName:n}of i.compiledOverrides){const o=e.readWithDefault(t,s,r);i.effect[n]=o}this._resolvedMeshParams[e]=r.effects.map(e=>e.effect)}for(const[e,r]of this._dynamicTransformProperties.entries()){const i={type:"cim-marker-transform-info",infos:[]};for(const e of r.compiledMarkerInfos){const r={...e.props};if(e.compiledExpressionMap)for(const[i,n]of e.compiledExpressionMap){const e=n.computed.readWithDefault(t,s,n.defaultValue);r[i]="number"==typeof e||"boolean"==typeof e?e:n.defaultValue}i.infos.push(r)}this._resolvedMeshParams[e]=i}for(const[s,r]of this._dynamicAsyncProperties.entries()){const i=r.objectIdToResourceId.get(t.getObjectId());if(null==i)continue;const n=e.getResource(i);this._resolvedMeshParams[s]=n}for(const[s,r]of this._dynamicAsyncAnimations.entries()){const i=r.propertyIdToResourceId.get(t.getObjectId()+"."+s);if(null==i)continue;const n=e.getResource(i);this._resolvedMeshParams[s]={dataRow:n.rect.y,dataColumn:n.rect.x}}return this._evaluatedMeshParams=this.evaluator(this._resolvedMeshParams),this.evaluatedMeshParams}hasArcadeDependency(e){return this._arcadeDependencies.has(e)}*_expressions(){for(const e of this._dynamicProperties.values())yield e.computed;for(const e of this._dynamicEffectProperties.values())for(const t of e.effects)for(const e of t.compiledOverrides)yield e.computed;for(const e of this._dynamicPlacementProperties.values())for(const t of e.compiledOverrides)yield t.computed;for(const e of this._dynamicAsyncProperties.values())for(const t of e.compiledOverrides)yield t.computed;for(const e of this._dynamicTransformProperties.values())for(const t of e.compiledMarkerInfos)if(null!=t.compiledExpressionMap)for(const e of t.compiledExpressionMap.values())yield e.computed;for(const e of this._dynamicAsyncAnimations.values())for(const t of e.params)yield*vt(t)}}const zi={createComputedParams:e=>e,optionalAttributes:{},attributes:{pos:{type:We.pe.SHORT,count:2,packPrecisionFactor:10,pack:"position"},id:{type:We.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:We.pe.UNSIGNED_BYTE,count:1,pack:e=>0},offset:{type:We.pe.SHORT,count:2,packPrecisionFactor:16,packAlternating:{count:4,pack:({size:e})=>{const t=(0,u.Lz)(e),s=-t/2,r=-t/2;return[[s,r],[s+t,r],[s,r+t],[s+t,r+t]]}}},texCoords:{type:We.pe.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:()=>[[0,1],[1,1],[0,0],[1,0]]}},referenceSize:{type:We.pe.UNSIGNED_BYTE,count:1,pack:({size:e})=>(0,u.Lz)(e)},zoomRange:{type:We.pe.UNSIGNED_BYTE,count:2,pack:({scaleInfo:e},{tileInfo:t})=>ke(e,t)}}};class Li extends He{constructor(){super(...arguments),this.vertexSpec=zi}_write(e,{target:t}){const s=t.getDisplayId(),r=this.evaluatedMeshParams.minPixelBuffer,i=Math.max((0,u.Lz)(this.evaluatedMeshParams.size),r);let n,o;if("esriGeometryPoint"===t.geometryType)n=t.readXForDisplay(),o=t.readYForDisplay();else{const e=t.readCentroidForDisplay();if(!e)return;n=e?.coords[0],o=e?.coords[1]}e.recordStart(this.instanceId,this.attributeLayout),e.recordBounds(n,o,i,i);const a=e.vertexCount();this._writeVertex(e,s,n,o),e.indexWrite(a+0),e.indexWrite(a+1),e.indexWrite(a+2),e.indexWrite(a+1),e.indexWrite(a+3),e.indexWrite(a+2),e.recordEnd()}}class Di{async createMeshWriter(e,t,s,r,i){const n=this._getMeshWriter(r.techniqueType),o=await Oi.create(e,t,r.inputParams,i),a=new n(r.id,o,r.optionalAttributes,s);return await a.loadDependencies(),a}_getMeshWriter(e){switch(e){case 15:return Ws;case 12:return Us;case 10:return Xs;case 28:return $s;case 16:return yr;case 26:return tr;case 29:return br;case 11:return ar;case 23:return Si;case 30:return Li;case 32:return oi;case 21:return Ls;case 33:return yi;case 17:return _i;case 19:return Sr;case 20:return di;case 2:return Yt;case 3:return $t;case 0:return qs;case 1:return Bs;default:throw new Error("Internal Error: Mesh writer not in the registry")}}}class qi{constructor(e,t,s,r,i){this.storage=e,this.proxy=t,this.viewParams=s,this.registry=r,this.fieldsMap=i}async createMeshWriters(e){const t=e.map(e=>this.registry.createMeshWriter(this.storage,this.proxy,this.viewParams,e,this.fieldsMap));return Promise.all(t)}}var Ni=s(563);class Bi{constructor(e){this._outstandingMessages=[],this._queue=new Ni.QueueProcessor({concurrency:e.concurrency,process:t=>e.process(t)})}async push(e){if(e.end)return await Promise.all(this._outstandingMessages),await this._queue.push(e),void(this._outstandingMessages=[]);const t=this._queue.push(e);return this._outstandingMessages.push(t),t}}var Gi=s(16930),ji=s(43334),Ui=s(31464),Vi=s(95466);class Wi{static async create(e,t){if("count"===t.statisticType){const e=new Mi(1);return new Wi(t.name,t.alias,t.type,t.statisticType,e)}const s=await e.createComputedField({expression:t.onStatisticExpression?.expression,field:t.onStatisticField});return new Wi(t.name,t.alias,t.type,t.statisticType,s)}constructor(e,t,s,r,i){this.name=e,this.alias=t,this.type=s,this.statisticType=r,this.computed=i}}var Yi=s(65529),$i=s(70328),Hi=s(37730),Qi=s(75752);class Zi{constructor(e){this.subscription=e,this.handledChunks=new Set,(0,n.A)("esri-2d-update-debug")&&console.debug(`Tile[${e.tile.id}] ASendState.create`)}destroy(){}}class Xi{constructor(e,t,s){this._source=e,this._attributeStore=t,this._sqlOptions=s,this._sendStates=new Map}destroy(){}get enablePixelBuffering(){return!0}get isAggregate(){return!1}get usedMemory(){return 0}updateRequiredLevel(e,t){}onSubscribe(e){const t=this.createState(e);this._sendStates.set(e.key.id,t)}onUnsubscribe(e){this._sendStates.get(e.key.id)?.destroy(),this._sendStates.delete(e.key.id)}get hasSubscribers(){return this._sendStates.size>0}requiresInvalidation(e){return!1}invalidate(){const e=Array.from(this._sendStates.values());this._sendStates.clear();for(const t of e)t.destroy(),this.onSubscribe(t.subscription)}invalidateAttributeData(e){}hasArcadeDependency(e){return!1}getFeatureObjectIdsForAggregate(e){throw new Error("InternalError: AggregateId lookup not supported")}getDisplayIds(e){return this.displayMap(e,e=>e,e=>e)}getDisplayAndObjectIds(e){return this.displayMap(e,e=>e,(e,t,s)=>[e,s])}afterUpdateChunks(){}}class Ki extends Xi{constructor(e,t,s,r,i){super(e,t,i),this.spatialReference=s,this.aggregateFields=r,this._arcadeDependencies=new Set,this.events=new Yi.bk,this.featureAdapter=Hi.T;for(const e of r)(0,Ti.QY)(this._arcadeDependencies,e.computed)}get aggregateQueryEngine(){return this._aggregateQueryEngine||(this._aggregateQueryEngine=new Qi.do({featureStore:this,fieldsIndex:this._metadata.fieldsIndex,geometryType:this._metadata.geometryType,featureIdInfo:this._metadata.featureIdInfo,spatialReference:this.spatialReference})),this._aggregateQueryEngine}get isAggregate(){return!0}removeChunks(e){}hasArcadeDependency(e){return this._arcadeDependencies.has(e)}forEach(e){return this.forEachAggregateWorldSpace(e)}forEachInBounds(e,t){}forEachBounds(e,t){const s=(0,$i.vt)();for(const r of e){const e=(0,Cr.jQ)(s,r.geometry);e&&t(e)}}}class Ji{constructor(e,t,s,r){this.subscription=e,this.reader=t,this.end=s,this.debugInfo=r,this.type="append"}get id(){return this.subscription.tile.id}createMessage(e,t,s){return{type:"append",id:this.id,append:e,end:this.end,debugInfo:this.debugInfo,subscriptionVesrion:this.subscription.version,version:t,attributeEpoch:s}}}class en{constructor(e,t,s,r,i){this.subscription=e,this.reader=t,this.remove=s,this.end=r,this.debugInfo=i,this.type="update"}get id(){return this.subscription.tile.id}createMessage(e,t,s){return{type:"update",id:this.id,modify:e,debugInfo:this.debugInfo,remove:this.remove,version:t,subscriptionVesrion:this.subscription.version,end:this.end,attributeEpoch:s}}}const tn=8388607,sn=e=>e&tn;class rn extends Ai{constructor(e){super(),this._field=e}resize(e){throw new Error("Method not implemented.")}read(e,t){return e.readAttribute(this._field)}readWithDefault(e,t){return e.readAttribute(this._field)}hasArcadeDependency(e){return!1}}var nn=s(50115);class on extends Ai{static async create(e,t){const s=await(0,Ti.Ad)(e,t.spatialReference),r=(0,me.Wm)(e);return new on(s,r)}constructor(e,t){super(),this._compiled=e,this._cacheKey=t}resize(e){}read(e,t){return this.hasArcadeDependency("scale")||"system"!==t.$view.timeZone?(0,nn.V4)(this._compiled,e,t):this._readCached(e,t)}readWithDefault(e,t,s){return this.hasArcadeDependency("scale")||"system"!==t.$view.timeZone?(0,nn.OP)(this._compiled,e,t,s):this._readWithDefaultCached(e,t,s)}hasArcadeDependency(e){return this._compiled?.references(e)??!1}_getCacheKey(e){if(!this._compiled?.references("timeProperties"))return this._cacheKey;const{currentStart:t,currentEnd:s}=e.$view.timeProperties;return this._cacheKey+function(e,t){const s=43758.5453*Math.sin(12.9898*e+78.233*t);return s-Math.floor(s)}(t??1,s??1)}_readCached(e,t){if(e.setCache(this._getCacheKey(t)),e.hasCachedValue())return e.getCachedValue();const s=(0,nn.V4)(this._compiled,e,t);return e.setCachedValue(s),s}_readWithDefaultCached(e,t,s){if(e.setCache(this._getCacheKey(t)),e.hasCachedValue())return e.getCachedValue();const r=(0,nn.OP)(this._compiled,e,t,s);return e.setCachedValue(r),r}}var an=s(39516),cn=s(97770),ln=s(18047),un=s(68463),hn=s(30524),dn=s(32730);class pn extends Ai{static async create(e,t){const s=(0,dn.lc)(e);return new pn(e=>s.replaceAll(/{[^}]*}/g,t=>{const s=t.slice(1,-1),r=e.metadata.fieldsIndex.get(s);if(null==r)return t;const i=e.readAttribute(s);return null==i?"":function(e,t){if(null==e)return"";const s=t.domain;if(s)if("codedValue"===s.type||"coded-value"===s.type){const t=e;for(const e of s.codedValues)if(e.code===t)return e.name}else if("range"===s.type){const{max:r,min:i}=(0,un.A5)(t),n=+e;if(null!=i&&null!=r&&i<=n&&n<=r)return s.name}let r=e;return(0,hn.vE)(t)?r=(0,cn.Yq)(r,(0,cn.J2)("short-date")):(0,hn.WA)(t)&&(r=(0,ln.ZV)(+r)),r||""}(i,r)}))}constructor(e){super(),this._evaluator=e}resize(e){}read(e,t){return this._evaluator(e)}readWithDefault(e,t,s){const r=this._evaluator(e);return(0,nn.rZ)(r)?s:r}hasArcadeDependency(e){return!1}}class fn extends Ai{constructor(e,t){super(),this._template=e,this._parts=(0,Be.gQ)(e.template,t)}resize(e){}read(e,t){return(0,Be._h)(e,this._parts,this._template.textCase)}readWithDefault(e,t,s){return(0,Be._h)(e,this._parts,this._template.textCase)}hasArcadeDependency(e){return!1}}class _n extends Ai{constructor(e,t){super(),this._field=e,this._normalizationInfo=t}resize(e){throw new Error("Method not implemented.")}read(e,t){return this._readNormalized(e)}readWithDefault(e,t){return this._readNormalized(e)}hasArcadeDependency(e){return!1}_readNormalized(e){const t=e.readAttribute(this._field);if(null==t)return null;const{normalizationField:s,normalizationTotal:r,normalizationType:i}=this._normalizationInfo,n=e.readAttribute(s);switch(i??"esriNormalizeByField"){case"esriNormalizeByField":return n?n?t/n:void 0:null;case"esriNormalizeByLog":return Math.log(t)*Math.LOG10E;case"esriNormalizeByPercentOfTotal":return r?t/r*100:null}}}var mn=s(73250);const yn=()=>Ie.A.getLogger("esri.views.2d.layers.FeatureLayerView2D"),gn={getAttribute:(e,t)=>e.readAttribute(t)};async function xn(e,t){try{const s=await(0,an.GP)(e,t);return s.isStandardized||yn().error(new r.A("sql-parse-error","expression is not standardized",{where:e})),(t,i)=>{const n=t.readArcadeFeature();try{return s.testFeatureCompiled(n,gn,i.currentUser)}catch(t){return yn().warn(new r.A("sql-runtime-error","Encountered an error when evaluating where clause",{where:e,error:t})),!0}}}catch(t){return yn().warn(new r.A("sql-runtime-error","Encountered an error when evaluating where clause",{where:e,error:t})),e=>!0}}const wn=()=>Ie.A.getLogger("esri.views.2d.layers.features.support.ComputedAttributeStorage"),bn=4294967295;function vn(e,t,s){if(!(e.length>t))for(;e.length<=t;)e.push(s)}class Sn{constructor(e){this._numerics=[],this._strings=[],this._allocatedSize=256,this._bitsets=[],this._instanceIds=[],this._bounds=[],this._dirtyBitset=this.getBitset(this.createBitset()),this.compilationOptions=e}createBitset(){const e=this._bitsets.length;return this._bitsets.push(mn.y.create(this._allocatedSize,tn)),e+1}createDictionaryTemplateField(e,t){return new fn(e,t)}async createComputedField(e,t=!1){if(e.expression)try{if(!this.compilationOptions)throw new Error("InternalError: Compilation options not defined");return t?await pn.create(e.expression,this.compilationOptions):await on.create(e.expression,this.compilationOptions)}catch(t){const s=new r.A("featurelayer","Failed to compile arcade expression",{error:t,expression:e.expression});return wn().error(s),null}if(e.normalizationType||e.normalizationField)return new _n(e.field,e);if(e.field)return new rn(e.field);const s=new r.A("featurelayer","Unable to create computed field. No expression or field found",{info:e});return wn().error(s),null}async createWhereClause(e){return e?xn(e,this.compilationOptions.fields):null}getBitset(e){return this._bitsets[e-1]}getComputedNumeric(e,t){return this.getComputedNumericAtIndex(e&tn,0)}setComputedNumeric(e,t,s){return this.setComputedNumericAtIndex(e&tn,s,0)}getComputedString(e,t){return this.getComputedStringAtIndex(e&tn,0)}setComputedString(e,t,s){return this.setComputedStringAtIndex(e&tn,0,s)}getComputedNumericAtIndex(e,t){const s=e&tn;return this._ensureNumeric(t,s),this._numerics[t][s]}setComputedNumericAtIndex(e,t,s){const r=e&tn;this._ensureNumeric(t,r),this._numerics[t][r]=s}getPackedChunkId(e){const t=e&tn;return this._ensureInstanceId(t),this._instanceIds[t]}setPackedChunkId(e,t){const s=e&tn;this._ensureInstanceId(s),this._instanceIds[s]=t}getComputedStringAtIndex(e,t){const s=e&tn;return this._ensureString(t,s),this._strings[t][s]}setComputedStringAtIndex(e,t,s){const r=e&tn;this._ensureString(t,r),this._strings[t][r]=s}getXMin(e){return this._bounds[4*(e&tn)]}getYMin(e){return this._bounds[4*(e&tn)+1]}getXMax(e){return this._bounds[4*(e&tn)+2]}getYMax(e){return this._bounds[4*(e&tn)+3]}setBounds(e,t,s=!1){const r=e&tn;if(!s&&!this._dirtyBitset.has(e))return this._bounds[4*r]!==bn;this._dirtyBitset.unset(e);const i=t.readGeometryWorldSpace();if(vn(this._bounds,4*r+4,0),!i||!i.coords.length)return this._bounds[4*r]=bn,this._bounds[4*r+1]=bn,this._bounds[4*r+2]=bn,this._bounds[4*r+3]=bn,!1;let n=1/0,o=1/0,a=-1/0,c=-1/0;return i.forEachVertex((e,t)=>{n=Math.min(n,e),o=Math.min(o,t),a=Math.max(a,e),c=Math.max(c,t)}),this._bounds[4*r]=n,this._bounds[4*r+1]=o,this._bounds[4*r+2]=a,this._bounds[4*r+3]=c,!0}getBounds(e,t){const s=this.getXMin(t),r=this.getYMin(t),i=this.getXMax(t),n=this.getYMax(t);return(0,$i.BI)(e,s,r,i,n),s!==bn}_ensureNumeric(e,t){this._numerics[e]||(this._numerics[e]=[]),vn(this._numerics[e],t,0)}_ensureInstanceId(e){vn(this._instanceIds,e,0)}_ensureString(e,t){this._strings[e]||(this._strings[e]=[]),vn(this._strings[e],t,null)}}var In=s(537),kn=s(58727),Tn=s(62660),An=s(86420),Mn=s(61956),Fn=s(30661);class Cn{constructor(e){this._geometryBounds=(0,Y.vt)(),this._idToVisibility=new Map,this._serviceInfo=e}static async create(e){const t=new Cn(e);return await t.update(e.filterJSON,e.spatialReference),t}get hash(){return this._hash}check(e,t){return this._applyFilter(e,t)}invalidate(){this._idToVisibility.forEach((e,t)=>{this._idToVisibility.set(t,0)})}setKnownIds(e){for(const t of e)this._idToVisibility.set(t,1)}setTrue(e){const t=[],s=[],r=new Set(e);return this._idToVisibility.forEach((e,i)=>{const n=!!(1&this._idToVisibility.get(i)),o=r.has(i);!n&&o?t.push(i):n&&!o&&s.push(i),this._idToVisibility.set(i,o?3:0)}),{show:t,hide:s}}createQuery(){const{geometry:e,spatialRel:t,where:s,timeExtent:r,objectIds:i}=this;return Mn.A.fromJSON({geometry:e,spatialRel:t,where:s,timeExtent:r,objectIds:i})}async update(e,t){this._hash=JSON.stringify(e);const s=await(0,kn.T2)(e,null,t);await Promise.all([this._setGeometryFilter(s),this._setIdFilter(s),this._setAttributeFilter(s),this._setTimeFilter(s)])}async _setAttributeFilter(e){if(!e?.where)return this._clause=null,void(this.where=null);this._clause=await xn(e.where,this._serviceInfo.fieldsIndex),this.where=e.where}_setIdFilter(e){this._idsToShow=e?.objectIds&&new Set(e.objectIds),this._idsToHide=e?.hiddenIds&&new Set(e.hiddenIds),this.objectIds=e?.objectIds}async _setGeometryFilter(e){if(!e?.geometry)return this._spatialQueryOperator=null,this.geometry=null,void(this.spatialRel=null);const t=e.geometry,s=e.spatialRel??"esriSpatialRelIntersects",r=await(0,Tn.xt)(s,t,this._serviceInfo.geometryType);(0,In.Rg)(this._geometryBounds,t),this._spatialQueryOperator=r,this.geometry=t,this.spatialRel=s}_setTimeFilter(e){if(this.timeExtent=this._timeOperator=null,e?.timeExtent){if(!this._serviceInfo.timeInfo){const t=new r.A("feature-layer-view:time-filter-not-available","Unable to apply time filter, as layer doesn't have time metadata.",e.timeExtent);return void Ie.A.getLogger("esri.views.2d.layers.features.controllers.FeatureFilter").error(t)}this.timeExtent=e.timeExtent,this._timeOperator=(0,An.I)(this._serviceInfo.timeInfo,e.timeExtent,Fn.Z.Shared)}}_applyFilter(e,t){return this._filterByGeometry(e)&&this._filterById(e)&&this._filterByTime(e)&&this._filterByExpression(e,t)}_filterByExpression(e,t){return!this.where||this._clause(e,t)}_filterById(e){return(!this._idsToHide?.size||!this._idsToHide.has(e.getObjectId()))&&(!this._idsToShow?.size||this._idsToShow.has(e.getObjectId()))}_filterByGeometry(e){if(!this.geometry)return!0;const t=e.readGeometryWorldSpace();return!!t&&this._spatialQueryOperator(t)}_filterByTime(e){return null==this._timeOperator||this._timeOperator(e)}}var Pn=s(35258),En=s(8446);class Rn{constructor(e,t=JSON.stringify(e)){this.inner=e,this.hash=t}}class On extends Zi{constructor(e,t){super(e),this.bins=new Map,this.featureCache=new Map,this.done=!1,this._store=t}take(){const e=this.bins,t=this.featureCache;return this.bins=new Map,this.featureCache=new Map,{bins:e,featureCache:t}}destroy(){const e=this.subscription.tile.key.level;for(const t of this.featureCache.keys())this._store.releaseDisplayIdForObjectId(`${t}.${e}`);this.bins.clear(),this.featureCache.clear(),this.handledChunks.clear()}get tile(){return this.subscription.tile}*featuresWorldSpace(){for(const e of this.featureCache.values()){const t=e.clone();t.geometry&&(0,Cr.aQ)(t.geometry,this.subscription.tile.transform),yield t}}}class zn extends Ki{static async create(e,t,s,r,i){const n=t.metadata.outSpatialReference,o=new Sn({spatialReference:n}),a=await Promise.all(e.fields.map(async e=>Wi.create(o,e))),c=e.featureFilter?await Cn.create({geometryType:t.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:t.metadata.timeInfo,fieldsIndex:t.metadata.fieldsIndex,spatialReference:n,filterJSON:e.featureFilter}):null;return"geohash"===e.index.type&&await(0,Ui.Nk)(n,Gi.A.WGS84),new zn(e,c,r,a,n,t,s,i)}constructor(e,t,s,r,i,n,o,a){super(n,o,i,r,a),this._schema=e,this._featureFilter=t,this._arcadeContextInfo=s,this._handled=new Set,this._invalidated=!1,this._metadata=Pn.i.createFeature({geometryType:"esriGeometryPolygon",hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new Vi.A(e.fields).toJSON(),globalIdField:null,spatialReference:n.metadata.spatialReference,outSpatialReference:n.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null}),this._getIndex=this._createGetIndex()}requiresInvalidation(e){for(const e of this._sendStates.values())if(!e.done)return!0;const t=new Set;for(const s of e)t.add(s.chunkId);return!(0,z.aI)(t,this._handled)&&(this._handled=t,!0)}invalidate(){this._invalidated=!0}createState(e){return new On(e,this._attributeStore)}async*applyOverrideUpdate(e){}displayMap(e,t,s){const r=new Map(e.map(e=>[t(e),e])),i=[];for(const e of this._sendStates.values())for(const t of e.featuresWorldSpace()){const{objectId:e,displayId:n}=t,o=r.get(e);if(null!=o){const t=s(n,o,e);i.push(t),r.delete(e)}}return i}getDisplayFeatures(e){const t=new Set(e),s=new Set,r=[];for(const e of this._sendStates.values())for(const i of e.featuresWorldSpace())t.has(i.displayId)&&!s.has(i.objectId)&&(i.geometry&&r.push({...(0,Cr.oN)(i,this._metadata.geometryType,!1,!1),displayId:i.displayId}),s.add(i.objectId));return{features:[],aggregates:r,tracks:[]}}getFeatureObjectIdsForAggregate(e){for(const t of this._sendStates.values())for(const s of t.bins.values())if(s.id===e)return Array.from(s.containedObjectIds);return[]}async*updateChunks(e,t){if(this._invalidated){this._invalidated=!1;for(const s of this._sendStates.values())yield*this._update(s,e,t)}}forEachAggregateWorldSpace(e){const t=new Set;for(const s of this._sendStates.values())for(const r of s.featuresWorldSpace())t.has(r.objectId)||(e(r),t.add(r.objectId))}_createGetIndex(){return(e,t)=>{switch(this._schema.index.type){case"geohash":return e.getGeohashIndex(new Rn({type:"geohash",fields:this.aggregateFields,featureFilter:this._featureFilter,geohashLevel:this._schema.index.fixBinLevel,spatialReference:this.spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:t.scale,sqlOptions:this._sqlOptions}));case"grid":{const s=this._schema.index.fixedBinLevel,r=null!=s?t.tileInfoView.getLODInfoAt(s).scale:t.scale;return e.getGridIndex(new Rn({type:"grid",fields:this.aggregateFields,cellSize:this._schema.index.size,featureFilter:this._featureFilter,spatialReference:this.spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:r,sqlOptions:this._sqlOptions}))}}}}async*_update(e,t,s){const{subscription:r}=e,i=e.take(),{bins:n,featureCache:o}=e,a=r.tile,c=new Set;for(const s of t)this._getIndex(s,a).putBounded(n,c,e.tile.extent,e.tile.resolution);const l=[],u=r.tile.transform,h=r.tile.key.level;for(const e of n.values()){const t=e.getGeometry(this.spatialReference,u),s=new ji.Om(t,e.getAttributes(),null,e.id);t||(s.centroid=e.getGeometricCentroid(this.spatialReference,u)),s.displayId=this._attributeStore.createDisplayIdForObjectId(`${s.objectId}.${h}`),o.set(e.id,s),l.push(s)}this.events.emit("changed"),e.done||=!s;const d=En.K.fromOptimizedFeatures(l,this._metadata,u),p=d.getCursor(),f=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo);for(;p.next();)this._attributeStore.setAttributeData(p.getDisplayId(),p,f,this._sqlOptions);const _=new en(e.subscription,d,[],e.done,{});for(const e of i.featureCache.keys())this._attributeStore.releaseDisplayIdForObjectId(`${e}.${h}`);yield _}}var Ln=s(75538),Dn=s(17184),qn=s(68974);class Nn{constructor(e,t){this.inner=e,this.displayId=t}}var Bn=s(9012);class Gn extends Zi{constructor(e){super(e),this.didSend=!1,this.done=!1}}class jn{constructor(e,t,s,r,i){this._level=e,this._scale=t,this._indexOptions=s,this._clusterRadius=r,this._store=i,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const e of this._clusters.values())this._store.releaseDisplayIdForObjectId(e.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const e of this._clusters.values()){const t=e.inner.getCentroid(null),s=new ji.Om(t,e.inner.getAttributes(),null,e.inner.id,e.displayId);yield s}}clusters(){return this._clusters.values()}updateChunks(e,t){const s={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},r=(0,qn.p)(this._indexOptions.spatialReference,this._scale),i=this._indexOptions.cellSize;for(const{subscription:e}of t){const t=e.tile.bounds,n=Math.floor(t[0]*r/i),o=Math.floor(t[1]*r/i),a=Math.ceil(t[2]*r/i),c=Math.ceil(t[3]*r/i);s.xMin=Math.min(s.xMin,n),s.yMin=Math.min(s.yMin,o),s.xMax=Math.max(s.xMax,a),s.yMax=Math.max(s.yMax,c)}null!=this._lastCellBounds&&s.xMin===this._lastCellBounds.xMin&&s.yMin===this._lastCellBounds.yMin&&s.yMin===this._lastCellBounds.yMin&&s.yMax===this._lastCellBounds.yMax||(this._lastCellBounds=s),this._clusterCells(e,s)}async updateStatistics(e){let t=!1;for(const e of this._clusters.values())e.inner.count>1&&(t=this._updateAggregateStatistics(this._statistics,e.inner)||t);if(t){const t=Array.from(this._statistics.entries()).map(([e,t])=>({fieldName:e,minValue:t.minValue,maxValue:t.maxValue}));await e.container.updateStatistics(this._level,t)}}createAggregateFeatures(e,t){const s=e.subscription,r=[],i=s.tile.transform,o=Array.from(this._clusters.values()),a=o.length;for(const e of o){const t=e.inner.getCentroidX(i),s=e.inner.getCentroidY(i),n=1===e.inner.count?e.inner.firstObjectId:e.inner.id,o=e.displayId;if(t<p.CQ+128&&t>=-128&&s<p.CQ+128&&s>=-128){const i=new Xt.A([],[t,s]),a=new ji.Om(i,e.inner.getAttributes(),null,n,o);r.push(a)}}const c=En.K.fromOptimizedFeatures(r,t,s.tile.transform);return(0,n.A)("esri-2d-update-debug")&&console.debug(`Tile[${e.subscription.tile.id}] ClusterStrategy.createAggregateFeatures`,{clusters:c,levelClusterCount:a}),c}_clusterCells(e,t){this._clearClusters();const s=this._clusterRadius*(1/(0,qn.p)(this._indexOptions.spatialReference,this._scale)),{arcadeContextInfo:r}=this._indexOptions,i=(0,Bn.N)(this._scale,r),n=new Rn({...this._indexOptions,scale:this._scale}),o=new Set,a=new Map;for(let s=t.yMin;s<=t.yMax;s++)for(let r=t.xMin;r<=t.xMax;r++){const t=Dn.x.createId(r,s),c=Ln.L.createId(r,s);for(const l of e){const e=l.getGridIndex(n);e.forEachInCell(t,t=>{const n=t.getObjectId();o.has(n)||(o.add(n),(0,O.tE)(a,c,()=>Ln.L.create(r,s,this._indexOptions.fields,e.worldUnitsPerCell)).insert(t,i))})}}let c=Array.from(a.values());c=c.sort((e,t)=>t.count-e.count);const l=new Set;for(const e of c){if(l.has(e.id))continue;if(e.gridX<t.xMin||e.gridX>t.xMax||e.gridY<t.yMin||e.gridY>t.yMax)continue;const r=1+this._clusterRadius/this._indexOptions.cellSize,i=this._store.createDisplayIdForObjectId(e.id),n=new Nn(e.clone(),i);l.add(e.id),this._clusters.set(e.id,n);const o=e.centroidXWorld,c=e.centroidYWorld;for(let t=e.gridY-r;t<=e.gridY+r;t++)for(let i=e.gridX-r;i<=e.gridX+r;i++){if(t===e.gridY&&i===e.gridX)continue;const r=a.get(Ln.L.createId(i,t));if(!r||l.has(r.id))continue;const u=Math.abs(r.centroidXWorld-o),h=Math.abs(r.centroidYWorld-c);u<s&&h<s&&(n.inner.merge(r),l.add(r.id))}}}_updateAggregateStatistics(e,t){let s=!1;for(const r of t.statistics.values()){if("esriFieldTypeString"===r.field.type)continue;const t=r.value,i=r.field,n=e.get(i.name);if(n){const{minValue:e,maxValue:r}=n,i=Math.min(n.minValue,t),o=Math.max(n.maxValue,t);e===i&&r===o||(n.minValue=i,n.maxValue=o,s=!0);continue}e.set(i.name,{minValue:t,maxValue:t}),s=!0}return s}}class Un extends Ki{static async create(e,t,s,r,i,n,o,a){const c=s.metadata.outSpatialReference,l=new Sn({spatialReference:c}),u={type:"grid",fields:await Promise.all(t.fields.map(async e=>Wi.create(l,e))),spatialReference:c,featureFilter:t.featureFilter?await Cn.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:c,filterJSON:t.featureFilter}):null,cellSize:t.clusterRadius/4,arcadeContextInfo:i,sqlOptions:n};return new Un(e,t.clusterRadius,u,t.fields,s,r,n,o,a)}constructor(e,t,s,r,i,n,o,a,c){super(i,n,s.spatialReference,s.fields,o),this._connection=e,this._clusterRadius=t,this._indexOptions=s,this._requiredLevel=a,this._requiredScale=c,this._cellsPerScale=new Map,this._handled=new Set,this._invalidated=!1,this._metadata=Pn.i.createFeature({geometryType:"esriGeometryPoint",hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new Vi.A([...r,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}]).toJSON(),globalIdField:null,spatialReference:i.metadata.spatialReference,outSpatialReference:i.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!0}requiresInvalidation(e){for(const e of this._sendStates.values())if(!e.done)return!0;const t=new Set;for(const s of e)t.add(s.chunkId);return!(0,z.aI)(t,this._handled)&&(this._handled=t,!0)}invalidate(){this._invalidated=!0;for(const e of this._cellsPerScale.values())e.destroy();this._cellsPerScale.clear()}updateRequiredLevel(e,t){this._requiredLevel=e,this._requiredScale=t}createState(e){return new Gn(e)}async*applyOverrideUpdate(e){for(const e of this._cellsPerScale.values())e.destroy();this._cellsPerScale.clear();for(const e of this._sendStates.values())e.done=!1}displayMap(e,t,s){const r=new Map(e.map(e=>[t(e),e])),i=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const e of n.clusters()){const t=r.get(e.inner.id);if(null!=t){const n=s(e.displayId,t,e.inner.id);i.push(n),r.delete(e.inner.id);continue}if(1===e.inner.count){const{firstObjectId:t}=e.inner,n=t?r.get(t):null;if(null!=n){const o=s(e.displayId,n,t);i.push(o),r.delete(t)}}}return i}getDisplayFeatures(e){const t=new Set(e),s=new Set,r=[],i=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const e of n.aggregatesWorldSpace())if(t.has(e.displayId)&&!s.has(e.displayId)){const t=(0,Cr.oN)(e,this._metadata.geometryType,!1,!1);if(s.add(e.displayId),1===t.attributes.cluster_count){r.push({...t,displayId:e.displayId});continue}i.push({...t,displayId:e.displayId})}return{features:r,aggregates:i,tracks:[]}}getFeatureObjectIdsForAggregate(e){const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.clusters())if(s.inner.id===e)return Array.from(s.inner.containedObjectIds);return[]}async*updateChunks(e,t){if(!this._invalidated)return;this._invalidated=!1;const s=this._getClusterState(this._requiredLevel,this._requiredScale);s.updateChunks(e,Array.from(this._sendStates.values()));for(const e of this._sendStates.values())yield*this._update(e,s,t);await s.updateStatistics(this._connection)}forEachAggregateWorldSpace(e){if(null==this._requiredLevel||null==this._requiredScale)return;const t=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of t.aggregatesWorldSpace())e(s)}_getClusterState(e,t){if(null==e||null==t)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(t);return s||(s=new jn(e,t,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(t,s)),s}async*_update(e,t,s){const r=t.createAggregateFeatures(e,this._metadata);this.events.emit("changed"),e.done=e.done||!s;const i=r.getCursor(),o=e.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.arcadeContextInfo);for(;i.next();)this._attributeStore.setAttributeData(i.getDisplayId(),i,o,this._sqlOptions);(0,n.A)("esri-2d-update-debug")&&console.debug(`Tile[${e.subscription.tile.id}] ClusterStrategy._update`,{done:e.done});const a=new Ji(e.subscription,r,e.done,{});yield a}}var Vn=s(5162);class Wn extends Zi{}class Yn extends Xi{constructor(e,t,s,r){super(e,t,r),this._arcadeContextInfo=s,this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set,this._streamLayerDeferredObjectIdsToRemove=[]}destroy(){super.destroy();for(const e of this._source.chunks())this._cleanupChunkIds(e)}invalidateAttributeData(e){this.handledChunksForAttributeData.clear(),this._arcadeContextInfo=e,null!=this._evalOptions&&(this._evalOptions=(0,Bn.N)(this._evalOptions.$view.scale,e))}onSubscribe(e){super.onSubscribe(e),this._evalOptions=e.tile.createArcadeEvaluationOptions(this._arcadeContextInfo)}createState(e){return new Wn(e)}get aggregateQueryEngine(){return null}displayMap(e,t,s){const r=new Map(e.map(e=>[t(e),e])),i=[];for(const e of this._source.chunks()){const t=e.reader.getCursor();for(;t.next();){const e=t.getObjectId(),n=t.getDisplayId(),o=r.get(e);if(null!=o){const t=s(n,o,e);i.push(t),r.delete(e)}}}return i}getDisplayFeatures(e){const t=new Set(e),s=new Set,r=[];for(const e of this._source.chunks()){const i=e.reader.getCursor();for(;i.next();){const e=i.getObjectId(),n=i.getDisplayId();t.has(n)&&!s.has(e)&&(r.push({...i.readLegacyFeatureWorldSpace(),displayId:n}),s.add(e))}}return{features:r,aggregates:[],tracks:[]}}async*applyOverrideUpdate(e){const t=[];for(const s of e.modified.values()){const e=this._attributeStore.createDisplayIdForObjectId(s.objectId);s.displayId=e,t.push(e)}const s=En.K.fromOptimizedFeatures(Array.from(e.modified.values()),this._source.metadata).getCursor();for(;s.next();)this._attributeStore.setAttributeData(s.getDisplayId(),s,this._evalOptions,this._sqlOptions);const r=[];for(const t of e.removed){const e=this._attributeStore.getDisplayIdForObjectId(t);null!=e&&r.push(e)}(0,n.A)("esri-2d-update-debug")&&console.debug("FeatureUpdateStrategy.applyLocalEdit",{message:e,modifiedDisplayIds:t,removedDisplayIds:r});const i=Vn.KN.fromFeatures(Array.from(e.modified.values()),this._source.metadata);this.handledChunks.add(i.chunkId),this.handledChunksForAttributeData.add(i.chunkId),this.handledChunksForIdCreation.add(i.chunkId);for(const e of this._sendStates.values())e.handledChunks.add(i.chunkId),yield new en(e.subscription,null,t,!1,i.queryInfo);for(const e of this._sendStates.values()){const t=i.getTileReader(e.subscription.tile);yield new en(e.subscription,t,r,!1,i.queryInfo)}for(const t of e.removed)this._attributeStore.releaseDisplayIdForObjectId(t)}async*updateChunks(e,t){if(e.length){this._updateAttributeData();for(const e of this._sendStates.values())yield*this._update(e)}}removeChunks(e){for(const t of e)this.handledChunks.delete(t.chunkId),this.handledChunksForAttributeData.delete(t.chunkId),this._cleanupChunkIds(t)}afterUpdateChunks(){for(const e of this._streamLayerDeferredObjectIdsToRemove)this._attributeStore.releaseDisplayIdForObjectId(e);this._streamLayerDeferredObjectIdsToRemove=[]}_cleanupChunkIds(e){if(this.handledChunksForIdCreation.has(e.chunkId)){const t=e.reader.getCursor();for(;t.next();){const e=t.getObjectId();this._source.isStream?this._streamLayerDeferredObjectIdsToRemove.push(e):this._attributeStore.releaseDisplayIdForObjectId(e)}this.handledChunksForIdCreation.delete(e.chunkId)}}_updateAttributeData(){for(const e of this._source.chunks()){const{chunkId:t,reader:s}=e;if(!this.handledChunksForIdCreation.has(t)){this.handledChunksForIdCreation.add(t);const e=s.getCursor();for(;e.next();){const t=this._attributeStore.createDisplayIdForObjectId(e.getObjectId());e.setDisplayId(t)}}}for(const e of this._source.chunks())if(this._attributeStore.referencesScale()||!this.handledChunksForAttributeData.has(e.chunkId)){this.handledChunksForAttributeData.add(e.chunkId);const t=e.reader.getCursor();for(;t.next();){const e=t.getDisplayId();this._attributeStore.setAttributeData(e,t,this._evalOptions,this._sqlOptions)}}}*_update(e){const{subscription:t,handledChunks:s}=e;for(const r of this._source.chunks()){const{chunkId:i}=r;if(s.has(i)||!this.handledChunksForIdCreation.has(i)||!this.handledChunksForAttributeData.has(i))continue;s.add(i);const n=r.getTileReader(t.tile);n&&(yield new Ji(e.subscription,n,r.end,r.queryInfo))}}}var $n=s(77085),Hn=s(5808),Qn=s(17136),Zn=s(89056),Xn=s(92029),Kn=s(52350);let Jn;class eo{constructor(e,t,s,r,i){this.chunkIndex=e,this.featureIndex=t,this.objectId=s,this.displayId=r,this.time=i}}class to{static getOid(e){return ie.xq+e}constructor(e,t,s,r,i,n,o,a){this._schema=e,this.trackId=t,this.objectId=s,this.displayId=r,this._fields=i,this._spatialReference=n,this._metadata=o,this._isStream=a,this._maxDisplayDuration=this._schema.maxDisplayDuration>0?this._schema.maxDisplayDuration:1/0,this._maxDisplayObservationsPerTrack=this._schema.maxDisplayObservationsPerTrack>=1?this._schema.maxDisplayObservationsPerTrack:1/0,this._observationRecords=[],this._nextObservationRecords=[],this._trackLinePath=[],this._bounds=[],this._trackLineGeometry=new Xt.A}get _trackLineAttributes(){const e={...this._latestObservationFeature?.attributes,aggregateId:this.objectId,[ie.EA]:0};if(null!=this._statistics)for(const t of this._statistics.values())e[t.field.name]=t.value;return e}get _startTimeField(){return this._metadata.timeInfo?.startTimeField}get length(){return this._observationRecords.length}*observations(){yield*this._observationRecords}*previousObservations(){for(let e=0;e<this._observationRecords.length-1;e++)yield this._observationRecords[e]}get latestObservationFeature(){return this._latestObservationFeature}get latestObservationRecord(){return this._latestObservationRecord}stageObservation(e,t){this._nextObservationRecords.push(new eo(e,t.getIndex(),t.getObjectId(),t.getDisplayId(),null!=this._startTimeField?t.readAttributeAsTimestamp(this._startTimeField):null))}commitObservations(e,t,s){const r=new Set(this._nextObservationRecords.map(e=>e.objectId)),i=this._observationRecords.filter(e=>!r.has(e.objectId)).map(e=>e.objectId);let n,o;switch(this._observationRecords=[],this._trackLinePath=[],this._isStream||null==this._startTimeField||this._nextObservationRecords.sort((e,t)=>{const s=e.time,r=t.time;return null!=s&&null!=r?s-r:0}),this._schema.timeField){case"startTimeField":n=this._metadata.timeInfo?.startTimeField;break;case"endTimeField":n=this._metadata.timeInfo?.endTimeField;break;case"timeReceived":n=this._isStream?ie.Aw:null}o=this._isStream?s?.end??Date.now():s?.end??-1/0;const a=t.map(e=>e.reader.getCursor());let c;for(let e=this._nextObservationRecords.length-1;e>=0&&!(this._observationRecords.length>=this._maxDisplayObservationsPerTrack);e--){const t=this._nextObservationRecords[e],s=a[t.chunkIndex];(0,_.Lw)(s),s.setIndex(t.featureIndex);const r=null!=n?s.readAttributeAsTimestamp(n):null;(null!=r?o-r:0)>=this._maxDisplayDuration||(this._commitObservation(t,s),c??=t)}if(null!=c){const{chunkIndex:t,featureIndex:s}=c,r=`${c.objectId}.latest`,n=e.createDisplayIdForObjectId(r),o=a[t];(0,_.Lw)(o),o.setIndex(s);const l=new ji.Om(o.readGeometryWorldSpace(),{...o.readAttributes(),[ie.EA]:1},null,r,n);this._latestObservationFeature&&i.push(this._latestObservationFeature.objectId),this._latestObservationFeature=l,this._latestObservationRecord=c}else this._latestObservationFeature=null;return this._trackLineGeometry=function(e,t){if(e.length<2)return(0,Cr.Ap)({paths:[e]},!1,!1);if(t.isWrappable){let s=!1;for(let r=1;r<e.length;r++){const i=e[r][0],n=(0,Qn.O7)(i,e[r-1][0],t);i!==n&&(e[r][0]=n,s=!0)}if(s){const s=(0,Zn.b3)({paths:[e],spatialReference:t});if(null!=s)return(0,Cr.Ap)({paths:s.paths},!1,!1)}return(0,Cr.Ap)({paths:[e]},!1,!1)}const s=Jn.fromGeometryToGXGeometry({hasM:!1,hasZ:!1,paths:[e]}),r=Jn.fromSpatialReference(t);if(null!=r){const e=(0,$n.g7)(s,1e6,r,Hn.O.geodesic);if(null!=e){const t=Jn.toGeometry(e,r);if(null!=t&&"paths"in t)return(0,Cr.Ap)({paths:t.paths},!1,!1)}}return(0,Cr.Ap)({paths:[e]},!1,!1)}(this._trackLinePath,this._spatialReference),this._bounds=function(e){const{lengths:t,coords:s}=e;if(!t.length)return[(0,Y.Ie)()];const r=[];let i=0;for(let e=0;e<t.length;e++){const n=t[e],o=(0,Y.Ie)();r.push(o);for(let e=0;e<n;e++){const t=s[2*(e+i)],r=s[2*(e+i)+1];(0,Y.tK)(o,[t,r])}i+=n}return r}(this._trackLineGeometry),this._nextObservationRecords=[],i}updateStatistics(e,t){this._statistics=Xn.o.create(this._fields);const s=e.map(e=>e.reader.getCursor());for(const{chunkIndex:e,featureIndex:r}of this._observationRecords){const i=s[e];(0,_.Lw)(i),i.setIndex(r),this._statistics.insert(i,t)}}overlapsTile(e){for(const t of this._bounds)if((0,Y.$9)(t,e.bounds,32))return!0;return!1}getLatestObservationFeatureForTile(e){if(null==this._latestObservationFeature)return null;const{objectId:t,displayId:s,geometry:r,attributes:i}=this._latestObservationFeature,n=(0,Cr.Nl)(r,this._metadata.geometryType,e.subscription.tile.transform)??new Xt.A,o=(0,Y.fA)(1/0,1/0,-1/0,-1/0);return function(e,t){const{coords:s,lengths:r}=e;if(!r.length)return void t(s[0],s[1]);let i=0;for(let e=0;e<r.length;e++){const n=r[e];let o=0,a=0;for(let e=0;e<n;e++)o+=s[2*(e+i)],a+=s[2*(e+i)+1],t(o,a);i+=n}}(n,(e,t)=>(0,Y.tK)(o,[e,t])),(0,Y.HY)(o,(0,Y.fA)(0,0,p.CQ,p.CQ))?new ji.Om(n,i,null,t,s):null}getTrackLineFeatureForTile(e){const t=(0,Cr.Nl)(this._trackLineGeometry,"esriGeometryPolyline",e.subscription.tile.transform)??new Xt.A;return new ji.Om(t,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineOptimizedFeature(){return new ji.Om(this._trackLineGeometry,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineDisplayFeature(){const{_trackLineGeometry:e,_trackLineAttributes:t,displayId:s}=this;return{geometry:(0,Cr.zv)(e,"esriGeometryPolyline",!1,!1),attributes:t,displayId:s}}_commitObservation(e,t){const s=t.readCentroidWorldSpace();let r=s?.coords[0],i=s?.coords[1];null==s&&(r=t.readXWorldSpace(),i=t.readYWorldSpace()),null!=r&&null!=i&&(this._observationRecords.unshift(e),this._trackLinePath.unshift([r,i]))}}class so extends Zi{constructor(e){super(e),this.done=!1}}class ro extends Ki{static async create(e,t,r,i,n){const o=t.metadata.outSpatialReference,a=new Sn({spatialReference:o}),c=await Promise.all(e.fields.map(async e=>Wi.create(a,e))),l=e.featureFilter?await Cn.create({geometryType:t.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:t.metadata.timeInfo,fieldsIndex:t.metadata.fieldsIndex,spatialReference:o,filterJSON:e.featureFilter}):null;return o.isWrappable||(0,$n.s1)()||await Promise.all([Promise.all([s.e(6042),s.e(1878),s.e(8885),s.e(5756),s.e(3299),s.e(8125)]).then(s.bind(s,78125)),Promise.all([s.e(6042),s.e(1878),s.e(8885),s.e(5756),s.e(3299)]).then(s.bind(s,83299)),(0,$n.Hh)()]).then(([e,t,s])=>{Jn={fromGeometryToGXGeometry:t.fromGeometryToGXGeometry,toGeometry:t.toGeometry,fromSpatialReference:e.fromSpatialReference}}),new ro(e,t,r,o,c,l,i,n)}constructor(e,t,s,r,i,n,o,a){super(t,s,r,i,a),this._schema=e,this._featureFilter=n,this._arcadeContextInfo=o,this._tracks=new Map,this._handledChunks=new Set,this._metadata=t.metadata.weakCloneWithAdditionalFields([{name:ie.EA,alias:"trackPart",type:"esriFieldTypeSmallInteger"}]),this._trackLineMetadata=Pn.i.createFeature({geometryType:"esriGeometryPolyline",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:{fields:[...this._source.metadata.fieldsIndex.fields,...this.aggregateFields,{name:ie.EA,alias:"trackPart",type:"esriFieldTypeSmallInteger"},{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],timeZoneByFieldName:null},globalIdField:null,spatialReference:t.metadata.spatialReference,outSpatialReference:t.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:t.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null,hasZ:!1,hasM:!1})}destroy(){super.destroy(),this._clear()}get _isStream(){return this._source.isStream}get enablePixelBuffering(){return!0}get isAggregate(){return!1}requiresInvalidation(){return!0}invalidate(){super.invalidate(),this._clear()}createState(e){return new so(e)}async*applyOverrideUpdate(e){Ie.A.getLogger("esri.views.2d.layers.features.processor.TrackStrategy").error("Applying override to tracks is not supported")}displayMap(e,t,s){const r=new Map(e.map(e=>[t(e),e])),i=[];for(const e of this._tracks.values()){const t=r.get(e.objectId);if(null!=t){const n=s(e.displayId,t,e.objectId);i.push(n),r.delete(e.objectId);continue}const n=e.latestObservationFeature;if(n?.objectId){const e=r.get(n.objectId);if(null!=e){const t=s(n.displayId,e,n.objectId);i.push(t),r.delete(n.objectId);continue}}for(const t of e.observations()){const e=r.get(t.objectId);if(null!=e){const n=s(t.displayId,e,t.objectId);i.push(n),r.delete(t.objectId)}}}return i}getDisplayFeatures(e){const t=new Set(e),s=[],r=[],i=this._source.chunks().map(e=>e.reader.getCursor());for(const e of this._tracks.values()){if(t.has(e.displayId)&&r.push(e.getTrackLineDisplayFeature()),null!=e.latestObservationFeature&&t.has(e.latestObservationFeature.displayId)){const{displayId:t,chunkIndex:r,featureIndex:n}=e.latestObservationRecord,o=i[r];o.setIndex(n),s.push({displayId:t,...o.readLegacyFeatureWorldSpace()})}for(const{displayId:r,chunkIndex:n,featureIndex:o}of e.observations())if(t.has(r)){const e=i[n];e.setIndex(o),s.push({displayId:r,...e.readLegacyFeatureWorldSpace()})}}return{features:s,aggregates:[],tracks:r}}getFeatureObjectIdsForAggregate(e){for(const t of this._tracks.values())if(t.objectId===e)return Array.from(t.observations(),e=>e.objectId);return[]}async*updateChunks(){0===this._handledChunks.size&&this._rebuildTracks();for(const e of this._sendStates.values())yield*this._update(e)}forEachAggregateWorldSpace(e){for(const t of this._tracks.values())e(t.getTrackLineOptimizedFeature())}_clear(){for(const e of this._source.chunks())if(this._handledChunks.has(e.chunkId)){const t=e.reader.getCursor();for(;t.next();){const e=t.getObjectId();this._attributeStore.releaseDisplayIdForObjectId(e)}}this._handledChunks.clear();for(const e of this._tracks.values())this._removeTrack(e);this._tracks.clear()}_rebuildTracks(){const e=this._source.chunks();if(!e.length)return;const t=this._metadata.timeInfo?.trackIdField;if(null==t)return;const s=new Set;for(let r=0;r<e.length;r++){const i=e[r];if(this._handledChunks.has(i.chunkId))continue;this._handledChunks.add(i.chunkId);const n=i.reader.getCursor();for(;n.next();){const e=n.getObjectId();n.setDisplayId(this._attributeStore.createDisplayIdForObjectId(e));const i=n.readAttribute(t);if(null!=i&&null!=e&&(null===this._featureFilter||this._featureFilter.check(n,this._sqlOptions))){if(!this._tracks.has(i)){const e=to.getOid(i),t=this._attributeStore.createDisplayIdForObjectId(e),s=new to(this._schema,i,e,t,this.aggregateFields,this.spatialReference,this._source.metadata,this._isStream);this._tracks.set(i,s)}this._tracks.get(i).stageObservation(r,n),s.add(i)}}}for(const t of this._tracks.values())if(s.has(t.trackId)){const s=t.commitObservations(this._attributeStore,e,this._featureFilter?.timeExtent);for(const e of s)this._attributeStore.releaseDisplayIdForObjectId(e);t.updateStatistics(e,(0,Bn.N)(1,this._arcadeContextInfo))}else this._removeTrack(t)}_removeTrack(e){this._tracks.delete(e.trackId),this._attributeStore.releaseDisplayIdForObjectId(e.objectId),null!=e.latestObservationFeature&&this._attributeStore.releaseDisplayIdForObjectId(e.latestObservationFeature.objectId)}*_update(e){if(e.done)return;e.done=!this._source.updateTracking.updating;const t=[],s=[];for(const r of this._tracks.values())if(r.length>0){if(this._schema.showLatestObservation){const s=r.getLatestObservationFeatureForTile(e);null!=s&&t.push(s)}this._schema.showTrackLine&&r.overlapsTile(e.subscription.tile)&&s.push(r.getTrackLineFeatureForTile(e))}const r=En.K.fromOptimizedFeatures(t,this._metadata,e.subscription.tile.transform),i=En.K.fromOptimizedFeatures(s,this._trackLineMetadata,e.subscription.tile.transform);let n=[];if(this._schema.showPreviousObservations){const t=this._source.chunks().map(()=>[]);for(const e of this._tracks.values())for(const{chunkIndex:s,featureIndex:r}of e.previousObservations())t[s].push(r);n=this._source.chunks().map((s,r)=>{const i=s.getTileReader(e.subscription.tile);if(null==i)return null;const n=Kn.e.from(i,t[r]);return n.setProcessorAttributes({[ie.EA]:2}),"esriGeometryPoint"!==n.geometryType&&null!=n.getInTransform()||n.setTransformForDisplay(e.subscription.tile.transform),n}).filter(Ii.Ru)}this.events.emit("changed");const o=e.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo),a=i.getCursor();for(;a.next();)this._attributeStore.setAttributeData(a.getDisplayId(),a,o,this._sqlOptions);for(const e of n){const t=e.getCursor();for(;t.next();)this._attributeStore.setAttributeData(t.getDisplayId(),t,o,this._sqlOptions)}const c=r.getCursor();for(;c.next();)this._attributeStore.setAttributeData(c.getDisplayId(),c,o,this._sqlOptions);yield new Ji(e.subscription,i,!1,{});for(const t of n)yield new Ji(e.subscription,t,!1,{});yield new Ji(e.subscription,r,e.done,{})}}new Map;var io=s(69397);class no{constructor(e){this.data=e,this._referenceCount=0}static{this.estimatedMemory=20}increment(){this._referenceCount+=1}decrement(){this._referenceCount-=1}get empty(){return 0===this._referenceCount}}class oo{constructor(){this._freeIdsGenerationA=[],this._freeIdsGenerationB=[],this._idCounter=1,this._freeIds=this._freeIdsGenerationA,this._objectIdToDisplayId=new Map}get usedMemory(){let e=0;return e+=(0,io.Qf)(this._freeIdsGenerationA),e+=(0,io.Qf)(this._freeIdsGenerationB),e+=this._objectIdToDisplayId.size*(no.estimatedMemory+8),e}createIdForObjectId(e){let t=this._objectIdToDisplayId.get(e);return t?t.increment():(t=new no(function(e){return(0|e)>>>0}(this._getFreeId())),t.increment(),this._objectIdToDisplayId.set(e,t)),t.data}releaseIdForObjectId(e){const t=this._objectIdToDisplayId.get(e);t&&(t.decrement(),t.empty&&(this._objectIdToDisplayId.delete(e),this._freeIds.push(t.data)))}getDisplayIdForObjectId(e){const t=this._objectIdToDisplayId.get(e);return null!=t?t.data:null}releaseAll(){for(const e of this._objectIdToDisplayId.values())this._freeIds.push(e.data);this._objectIdToDisplayId.clear()}incrementGeneration(){this._freeIds=this._freeIds===this._freeIdsGenerationA?this._freeIdsGenerationB:this._freeIdsGenerationA}_getFreeId(){return this._freeIds.length?this._freeIds.pop():this._idCounter++}}const ao=()=>Ie.A.getLogger("esri.views.layers.2d.features.support.AttributeStore"),co=(ao(),()=>null),lo=(0,n.A)("esri-shared-array-buffer");(0,n.A)("esri-atomics");class uo{constructor(e,t,s){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:r,layout:i,textureOnly:n}=t;this.textureOnly=n||!1,this.pixelType=r,this.layout=i,this._resetRange(),this.size=e,this.isLocal=s,n||(this.data=this._initData(r,e))}get usedMemory(){return this.data?.byteLength??0}get buffer(){return this.data?.buffer}unsetComponentAllTexels(e,t){const s=this.data;for(let r=0;r<this.size*this.size;r++)s[r*this.texelSize+e]&=~t;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(e,t){const s=this.data;for(let r=0;r<this.size*this.size;r++)s[r*this.texelSize+e]|=255&t;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(e,t,s){const r=this.data;for(const i of s)r[i*this.texelSize+e]|=t,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}setComponentTexel(e,t,s){this.data[s*this.texelSize+e]|=t,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)}unsetComponentTexel(e,t,s){this.data[s*this.texelSize+e]&=~t,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)}getData(e,t){const s=sn(e);return this.data[s*this.texelSize+t]}setData(e,t,s){const r=sn(e),i=1<<t;0!==(this.layout&i)?null!=this.data&&(this.data[r*this.texelSize+t]=s,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)):ao().error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}expand(e){if(this.size=e,!this.textureOnly){const t=this._initData(this.pixelType,e),s=this.data;t.set(s),this.data=t}}toMessage(){const e=this.dirtyStart,t=this.dirtyEnd,s=this.texelSize;if(e>t)return null;this._resetRange();const r=!this.isLocal,i=this.pixelType,n=this.layout,o=this.data;return{start:e,end:t,data:r&&o.slice(e*s,(t+1)*s)||null,pixelType:i,layout:n}}_initData(e,t){const s=ArrayBuffer,i=function(e){switch(e){case We.ld.UNSIGNED_BYTE:return Uint8Array;case We.ld.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case We.ld.FLOAT:return Float32Array;default:return void Ie.A.getLogger("esri.views.2d.engine.webgl.Utils").error(new r.A("webgl-utils",`Unable to handle type ${e}`))}}(e),n=new i(new s(t*t*4*i.BYTES_PER_ELEMENT));for(let e=0;e<n.length;e+=4)n[e+1]=255;return n}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class ho{constructor(e){this._client=e,this._filters=[],this._blocks=new Array,this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=p.TB,this._idsToHighlight=new Map,this._arcadeDependencies=new Set,this._initialized=!1,this.version=0,this._idGenerator=new oo,this._epoch=1}destroy(){this._abortController.abort()}_initialize(){if(null!=this._blockDescriptors)return;const e=We.ld.FLOAT;co(`Creating AttributeStore ${lo?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:We.ld.UNSIGNED_BYTE,layout:1},{pixelType:We.ld.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:We.ld.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:e,layout:15},{pixelType:e,layout:15},{pixelType:e,layout:15},{pixelType:e,layout:15},{pixelType:We.ld.FLOAT,layout:15}],this._blocks=this._blockDescriptors.map(()=>null)}get usedMemory(){let e=0;for(const t of this._blocks)t&&(e+=t.usedMemory);return e+=this._idGenerator.usedMemory,e}get hasHighlight(){return this._idsToHighlight.size>0}createDisplayIdForObjectId(e){return this._idGenerator.createIdForObjectId(e)}releaseDisplayIdForObjectId(e){return this._idGenerator.releaseIdForObjectId(e)}getDisplayIdForObjectId(e){return this._idGenerator.getDisplayIdForObjectId(e)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}hasArcadeDependency(e){return this._arcadeDependencies.has(e)}releaseAllIds(){this._idGenerator.releaseAll()}async update(e,t,s,r=0){const i=(0,y.Ui)(this._schema,e);if(this.version=r,i&&((0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${r}] AttributeStore.update`,{changed:i}),this._schema=e,this._attributeComputeInfo=null,this._initialize(),null!=e))if(s&&(this._filters=await Promise.all(e.filters.map(e=>e?Cn.create({geometryType:s.geometryType,hasM:!1,hasZ:!1,timeInfo:s.timeInfo,fieldsIndex:s.fieldsIndex,spatialReference:s.outSpatialReference,filterJSON:e}):null))),"multi"!==e.type)this._attributeComputeInfo={type:"feature",map:new Map},await Promise.all(e.bindings.map(async e=>{const s=await this._bind(t,e);this._updateReferences(s)}));else{this._attributeComputeInfo={type:"multi",keyField:e.keyField,map:new Map};for(const s in e.bindings){const r=e.bindings[s];await Promise.all(r.map(async e=>{const r=await this._bind(t,e,parseInt(s,10));this._updateReferences(r)}))}}}setHighlight(e,t){let s=null;0===e.length&&0===t.length&&(s=this._getBlock(0),s.unsetComponentAllTexels(0,(1<<p.U5)-1));for(const{displayId:t,highlightFlags:r}of e){if(null==t||-1===t)continue;s||(s=this._getBlock(0),s.unsetComponentAllTexels(0,(1<<p.U5)-1));const e=sn(t);s.setComponent(0,r,[e])}this._idsToHighlight.clear();for(const{objectId:t,highlightFlags:s}of e)this._idsToHighlight.set(t,s);for(const{objectId:e,highlightFlags:s}of t)this._idsToHighlight.set(e,s)}setData(e,t,s,r){const i=sn(e);this._ensureSizeForTexel(i),this._getBlock(t).setData(e,s,r)}getData(e,t,s){return this._getBlock(t).getData(e,s)}getHighlightFlags(e){return this._idsToHighlight.get(e)||0}unsetAttributeData(e){const t=sn(e);this._getBlock(0).setData(t,0,0)}referencesScale(){const e=this._attributeComputeInfo;if(!e)return!1;if("multi"===e.type){for(const t of e.map.values())for(const{field:e}of t.values())if(e?.hasArcadeDependency("scale"))return!0}else for(const{field:t}of e.map.values())if(t?.hasArcadeDependency("scale"))return!0;return!1}setAttributeData(e,t,s,r){const i=sn(e);this._ensureSizeForTexel(i),this._getBlock(0).setData(i,0,this.getFilterFlags(t,r));const n=this._attributeComputeInfo;let o=null;n&&(o="multi"===n.type?n.map.get(t.readAttribute(n.keyField)):n.map,o?.size&&o.forEach((e,r)=>{const n=1*r%4,o=Math.floor(1*r/4),a=this._getBlock(o+3);let c=e.field?.read(t,s);e.valueRepresentation&&(c=function(e,t){if(!e||!t)return e;switch(t){case"radius":case"distance":return 2*e;case"diameter":case"width":return e;case"area":return Math.sqrt(e)}return e}(c,e.valueRepresentation)),(null===c||isNaN(c)||c===1/0||c===-1/0)&&(c=1e-30),a.setData(i,n,c)}))}get epoch(){return this._epoch}sendUpdates(){const e=this._blocks.map(e=>null!=e?e.toMessage():null),t=this._getInitArgs();this._client.update({initArgs:t,blockData:e,version:this.version,sendUpdateEpoch:this._epoch}),this._epoch+=1}_ensureSizeForTexel(e){for(;e>=this._size*this._size;)if(this._expand())return}async _bind(e,t,s){const r=await e.createComputedField(t),{valueRepresentation:i}=t,n=this._attributeComputeInfo;if("multi"===n.type){const e=n.map.get(s)??new Map;e.set(t.binding,{field:r,valueRepresentation:i}),n.map.set(s,e)}else n.map.set(t.binding,{field:r,valueRepresentation:i});return r}_getInitArgs(){return this._initialized?null:(this._initialized=!0,this._getBlock(1),this._getBlock(2),this._getBlock(7),{blockSize:this._size,blockDescriptors:this._blocks.map(e=>null!=e?{textureOnly:e.textureOnly,buffer:e.buffer,pixelType:e.pixelType}:null)})}_getBlock(e){const t=this._blocks[e];if(null!=t)return t;co(`Initializing AttributeBlock at index ${e}`);const s=new uo(this._size,this._blockDescriptors[e],this._client.isLocal);return this._blocks[e]=s,this._initialized=!1,s}_expand(){if(this._size<this._schema.capabilities.maxTextureSize){const e=this._size<<=1;co("Expanding block size to",e,this._blocks);for(const t of this._blocks)t?.expand(e);return this._initialized=!1,this._size=e,0}return ao().error(new r.A("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}_updateReferences(e){(0,Ti.QY)(this._arcadeDependencies,e)}isVisible(e){return!!(this._getBlock(0).getData(e,0)&1<<p.U5)}getFilterFlags(e,t){let s=0;for(let r=0;r<this._filters.length;r++){const i=this._filters[r];(null==i||i.check(e,t))&&(s|=1<<r)}let r=0;if(this._idsToHighlight.size){const t=e.getObjectId();r=this.getHighlightFlags(t)}return s<<p.U5|r}}class po{constructor(e,t,s,r){this._connection=e,this._source=t,this._requiredLevel=s,this._requiredScale=r,this._version=1,this._registry=new Di,this._proxy=new ge({fetch:(e,t)=>this._connection.layerView.fetch(e,t),fetchDictionary:(e,t)=>this._connection.layerView.fetchDictionary(e,t)}),this._attributeStore=new ho({isLocal:!1,update:e=>(0,h.oV)(this._connection.container.updateAttributeView(e))})}destroy(){this._proxy.destroy(),this._strategy?.destroy(),this._attributeStore.destroy()}get hasClusters(){return"cluster"===this._schema?.mesh.strategy.type}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}get usedMemory(){let e=0;return e+=this._attributeStore.usedMemory,this._strategy&&(e+=this._strategy.usedMemory),e}get version(){return this._version}getDisplayFeatures(e){return this._strategy?this._strategy.getDisplayFeatures(e):{features:[],aggregates:[],tracks:[]}}getDisplayIds(e){const t={};return this._strategy?(this._strategy.displayMap(e,e=>e,(e,s,r)=>{t[r]=e}),t):t}getFeatureObjectIdsForAggregate(e){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(e):[]}onSubscribe(e){this._strategy?.onSubscribe(e)}onUnsubscribe(e){this._strategy?.onUnsubscribe(e)}requiresInvalidation(e){return this._strategy?.requiresInvalidation(e)??!1}updateRequiredLevel(e,t){this._strategy?.updateRequiredLevel(e,t),this._requiredLevel=e,this._requiredScale=t}async update(e,t,s,r,i){const o=e.processor,a=(0,m.i8)(this._schema?.storage,o.storage),c=(0,m.i8)(this._schema?.mesh.properties,o.mesh.properties),l=(0,m.i8)(this._schema?.mesh.factory,o.mesh.factory),u=(0,m.i8)(this._schema?.mesh.strategy,o.mesh.strategy),h=function(e,t){const s=[];return e?.timeExtent?.start===t.timeExtent?.start&&e?.timeExtent?.end===t.timeExtent?.end||s.push("timeProperties"),s}(this._schema?.expressionProperties,o.expressionProperties),d=h.some(e=>this._attributeStore.hasArcadeDependency(e)),p=h.some(e=>this._factory?.hasArcadeDependency(e)??!1),f=h.some(e=>this._strategy?.hasArcadeDependency(e))||this._strategy?.isAggregate&&d,_=p||f,g=c||l||u;if(!(a||g||p||d||f||r))return!1;(0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:(0,y.Ui)(this._schema,o),schema:o}),this._schema=o;const x=new Sn({fields:this._source.metadata.fieldsIndex,spatialReference:this._source.metadata.outSpatialReference}),w={currentUser:o.mesh.properties.currentUser};if((a||g||d)&&(await this._attributeStore.update(o.storage,x,this._source.metadata,t),this._strategy?.invalidateAttributeData(fo(o))),!r&&!g&&!_)return!1;(u||c||_)&&await this._updateStrategy(o.mesh.strategy,i,fo(o),w),this._updateSortKey(x,"sortKey"in o.mesh.properties?o.mesh.properties.sortKey:null);const b="dictionary"===o.mesh.factory.symbology.type?o.mesh.factory.symbology.fieldMap:null,v=new qi(x,this._proxy,s,this._registry,b);return(l||"dictionary"===o.mesh.factory.symbology.type)&&(this._factory=await _e.create(v,o.mesh.factory)),this._version=t,!0}async applyOverrideUpdate(e,t){if(!this._strategy)return;const s=this._strategy.applyOverrideUpdate(e);for await(const e of s)try{await this._process(e,t)}catch(e){}}async updateChunks(e,t,s){await this._doUpdateChunks(e,t,s),this._strategy?.afterUpdateChunks()}async removeChunks(e){this._strategy?.removeChunks(e),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:e}){if(!this._strategy||!this._strategy.hasSubscribers)return void this._attributeStore.setHighlight(e.map(({objectId:e,highlightFlags:t})=>({objectId:e,highlightFlags:t,displayId:-1})),e);const t=this._strategy.displayMap(e,({objectId:e})=>e,(e,{highlightFlags:t},s)=>({objectId:s,displayId:e,highlightFlags:t}));this._attributeStore.setHighlight(t,e)}invalidate(){this._strategy&&this._strategy.invalidate()}async _doUpdateChunks(e,t,s){if(!this._strategy)return;const r=this._strategy.updateChunks(e,t),i=[],o=new Map;for await(const e of r){let t=o.get(e.id);null==t&&(t=new Bi({concurrency:16,process:e=>this._process(e,s)}),o.set(e.id,t));const r=t.push(e).catch(e=>(0,a.jH)(e));i.push(r)}try{await Promise.all(i)}catch(e){}(0,n.A)("esri-2d-update-debug")&&console.log("SendUpdates"),this._attributeStore.sendUpdates(),(0,n.A)("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(e,t,s,r){switch(this._strategy?.destroy(),e.type){case"feature":this._strategy=new Yn(this._source,this._attributeStore,s,r);break;case"binning":this._strategy=await zn.create(e,this._source,this._attributeStore,s,r);break;case"cluster":this._strategy=await Un.create(this._connection,e,this._source,this._attributeStore,s,r,this._requiredLevel,this._requiredScale);break;case"track":this._strategy=await ro.create(e,this._source,this._attributeStore,s,r)}for(const e of t)this._strategy.onSubscribe(e)}async _updateSortKey(e,t){if(this._sortInfo=(0,_.pR)(this._sortInfo?.computed),null!=t){const s=t.byRenderer?null:await e.createComputedField(t);this._sortInfo={...t,computed:s}}}async _process(e,t){const s=e.subscription;if((0,n.A)("esri-2d-update-debug")){const t=s.tile;console.debug(`Version[${this._version}] Tile[${t.key.id}, end=${e.end}] Processor._process`)}const r={currentUser:this._schema?.mesh.properties.currentUser};await this._fetchResources(e,r),(0,a.Te)(s.signal);const i=await this._write(e,s.tile.createArcadeEvaluationOptions(fo(this._schema)),r,t),o=s.tile.tileInfoView.getLODInfoAt(s.tile.key);(0,a.Te)(s.signal);const{message:c,transferList:l}=i.serialize(o),u={objectIdMap:null,inner:e.createMessage(c,this._version,this._attributeStore.epoch)};if(this._schema?.mesh.properties.returnMeshObjectId){u.objectIdMap={};const t=e.reader?.getCursor();if(t)for(;t.next();)u.objectIdMap[t.getDisplayId()]=t.getObjectId()}if((0,a.Te)(s.signal),await this._connection.container.onMessage(u,{signal:s.signal,transferList:l}),this._attributeStore.sendUpdates(),(0,n.A)("esri-2d-update-debug")){const t=s.tile;console.debug(`Version[${this._version}] Tile[${t.key.id}, end=${e.end}] Processor._process.await`)}}async _fetchResources(e,t){await this._fetchMatcherResources(e),await this._fetchWriterResources(e,t)}async _fetchMatcherResources(e){if(e.reader)return this._factory.enqueueMatcherRequests(this._proxy,e.reader)}async _fetchWriterResources(e,t){if(!e.reader)return;const s=e.reader.getCursor(),r=e.subscription.tile.createArcadeEvaluationOptions(fo(this._schema));for(;s.next();)this._factory.enqueueWriterRequests(this._proxy,s,r,t);await this._proxy.fetchEnqueuedResources()}async _write(e,t,s,r){const i=e.subscription.tile,n=e.reader?.getCursor(),o=n?.getSize()??0,c=i.tileInfoView.tileInfo.isWrappable,l=i.tileInfoView.spatialReference.isWGS84,u=new se(i.key,this._strategy.enablePixelBuffering,c,l,o);if(!n)return u;const h=function(e,t){const s=(0,g.Q1)(e),r=[];for(const e of t.rings){const t=[];for(const r of e)t.push([(0,g.IE)(s,r[0]),(0,g.B2)(s,r[1])]);r.push(t)}return{rings:r}}(i.transform,r),d=i.createArcadeEvaluationOptions(fo(this._schema));let p=0;for(;n.next();){++p%1e3||(await(0,a.Pl)(0),(0,a.Te)(e.subscription));const r=this._getSortKeyValue(n,t);u.entityStart(n.getDisplayId(),r);try{this._factory.write(u,this._proxy,n,d,s,i.level,h)}catch(e){}u.entityEnd()}return u}_getSortKeyValue(e,t){if(!this._sortInfo)return 0;const{computed:s,order:r,byRenderer:i}=this._sortInfo,n=i?this._factory.getSortKey(e,t):s?.read(e,t);return null==n||isNaN(n)?0:n*("asc"===r?-1:1)}}function fo(e){const{timeZone:t}=e?.mesh.properties??{},{timeExtent:s}=e?.expressionProperties??{};return{timeZone:t,timeExtent:s}}class _o{static from(e){let t=0,s=0,r=0;return e.forEach(e=>{const i=e._readGeometry();i&&(s+=i.isPoint?1:i.lengths.reduce((e,t)=>e+t,0),r+=i.isPoint?1:i.lengths.length,t+=1)}),new _o(t,s,r)}constructor(e,t,s){this.featureCount=e,this.vertexCount=t,this.ringCount=s}toJSON(){return{featureCount:this.featureCount,ringCount:this.featureCount,vertexCount:this.featureCount}}}let mo=class extends R.A{constructor(e){super(),this._connection=e,this._enabledEventTypes=new Set,this._updateInfo={websocket:0,client:0},this._lastTime=performance.now(),this._queuedCommands=[],this.addHandles([(0,l.wB)(()=>this._strategy?.connectionStatus??"disconnected",e=>{this._layerView.setProperty({propertyName:"pipelineConnectionStatus",value:e})},{initial:!0}),(0,l.wB)(()=>this._strategy?.errorString||null,e=>this._layerView.setProperty({propertyName:"pipelineErrorString",value:e}),{initial:!0})])}destroy(){this._strategy=null,this.removeAllHandles()}get _layerView(){return this._connection.layerView}set strategy(e){null==this._strategy&&this._resetUpdateInfo(performance.now());const t="event-handles";this.removeHandles(t),null!=e&&(this.addHandles([e.events.on("data-received",e=>this._onFeature(e)),e.events.on("message-received",e=>this._onWebSocketMessage(e)),e.events.on("features-updated",e=>this._onUpdate(e)),e.events.on("tick",()=>this._onTick())],t),this._queuedCommands.forEach(t=>t(e)),this._queuedCommands=[]),this._strategy=e}updateCustomParameters(e){null!=e&&this._callOrEnqueue(t=>t.updateCustomParameters(e))}sendMessageToSocket(e){this._callOrEnqueue(t=>t.sendMessageToSocket(e))}sendMessageToClient(e){this._callOrEnqueue(t=>t.sendMessageToClient(e))}enableEvent(e,t){t?this._enabledEventTypes.add(e):this._enabledEventTypes.delete(e)}disconnect(){this._strategy?.disconnect()}connect(){this._strategy?.connect()}clear(){this._strategy?.clear()}_onWebSocketMessage(e){this._enabledEventTypes.has("message-received")&&this._layerView.emitEvent({name:"message-received",event:e})}_onFeature(e){this._updateInfo.websocket++,this._enabledEventTypes.has("data-received")&&this._layerView.emitEvent({name:"data-received",event:{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry}})}_onUpdate(e){this._updateInfo.client+=e}_onTick(){const e=performance.now(),t=e-this._lastTime;if(t>2500){const s=Math.round(this._updateInfo.client/(t/1e3)),r=Math.round(this._updateInfo.websocket/(t/1e3));this._resetUpdateInfo(e),this._layerView.emitEvent({name:"update-rate",event:{client:s,websocket:r}})}}_resetUpdateInfo(e){this._lastTime=e,this._updateInfo.client=0,this._updateInfo.websocket=0}_callOrEnqueue(e){null!=this._strategy?e(this._strategy):this._queuedCommands.push(e)}};(0,E.Cg)([(0,L.MZ)()],mo.prototype,"_strategy",void 0),mo=(0,E.Cg)([(0,L.$K)("esri.views.2d.layers.features.sources.StreamMessenger")],mo);class yo{constructor(){this._requiresInvalidation=!1}get requiresInvalidation(){return this._requiresInvalidation}requireInvalidation(){this._requiresInvalidation=!0}}class go{constructor(e,t,s){this._context=s,this._controller=new AbortController,this.metadata=Pn.i.createFeature(e),this._schema=t}destroy(){this._controller.abort(),this.store.destroy()}get store(){return this._context.store}get _connection(){return this._context.connection}get _options(){return{signal:this._controller.signal}}get _signal(){return this._controller.signal}async applyOverride(e){this._onOverride(),await this.store.applyOverride(e)}takeOverrideUpdate(){return this.store.takeOverrideUpdate()}unsafeSetQueryHistoricMoment(e){throw new Error("InternalError: LoadStrategy does not support query info")}async queryByObjectId(e,t){throw new Error("InternalError: LoadStrategy does not support fetching")}prepareCacheUpdate(e,t){}applyCacheUpdate(){return null}}var xo=s(13069),wo=s(28923);class bo{constructor(e,t,s,i){this.store=e,this.queryInfo=t,this._options=s,this._fetch=i,this._nextBatch=new Set,this._fetchFeatures=(0,a.sg)(async()=>{if(0===this._nextBatch.size||this._options.signal?.aborted)return;const e=Array.from(this._nextBatch);this._nextBatch.clear(),e.length>8e3&&Ie.A.getLogger("esri.views.2d.layers.FeatureLayerView2D").warn(new r.A("highlight-too-many-features","highlight is limited to 8000 features on large layers configured with a display filter to avoid performance issues"));const t=this.queryInfo.objectIdsQueryPageSize,s=Math.ceil(8e3/t),i=Math.min(s,Math.ceil(e.length/t)),n=Array.from({length:i},(s,r)=>{const i=r*t,n=Math.min(i+t,e.length);return{num:r,query:this.queryInfo.createObjectIdsQuery(e.slice(i,n))}});try{await async function(e,t,s,i={}){const n=(await Promise.allSettled(s.map(s=>async function(e,t,s,r={}){const i=`${e.chunkPrefix??""}${s.num}`,n=await e.fetch(s.query,r,{chunkId:i}),o=new wo.j(n,s.query.inner.toJSON(),s.num,!1);o.chunkId=o.normalizedChunkId=i,(0,a.Te)(r),t.insert(o)}(e,t,s,i)))).filter(e=>"rejected"===e.status).map(e=>e.reason);if(n.length)throw new r.A("featurelayer-query","Encountered errors when downloading data",{errors:n})}({chunkPrefix:"cache."+(0,xo.lk)(),fetch:this._fetch},this.store,n,this._options)}catch(e){}})}prepareCacheUpdate(e,t){if(t)for(const e of t)this._nextBatch.delete(e);for(const t of e)this._nextBatch.add(t)}applyCacheUpdate(){return 0===this._nextBatch.size||this._options.signal?.aborted?null:this._fetchFeatures().catch(()=>{})}}var vo=s(11254),So=s(41560),Io=s(79677);class ko{static create(e,t,s){const r=t.queryScaleRanges,i=t.displayFilterInfo;return new ko(function(e,t,s){const r=function(e){switch(e.type){case"object-id":case"unique-id-simple":return`${e.fieldName} ASC`;case"unique-id-composite":return`${e.fieldNames.join(",")} ASC`}}(s.featureIdInfo);return{returnCentroid:"esriGeometryPolygon"===s.serviceGeometryType&&!e.queryMetadata.supportsCentroidOnDegeneratedQuantizedGeometry&&!e.queryMetadata.supportsDegeneratedQuantizedGeometry,returnGeometry:!0,returnZ:t.returnZ,returnM:t.returnM,timeReferenceUnknownClient:s.timeReferenceUnknownClient??void 0,outSpatialReference:Gi.A.fromJSON(e.outSpatialReference),orderByFields:"memory"===e.type?[]:[r],where:t.definitionExpression??"1=1",outFields:t.availableFields,multipatchOption:"esriGeometryMultiPatch"===s.serviceGeometryType?"xyFootprint":null,gdbVersion:t.gdbVersion,historicMoment:t.historicMoment?new Date(t.historicMoment):null,timeExtent:t.timeExtent?Io.A.fromJSON(t.timeExtent):null}}(e,t,s),i,r,s.subtypeField,t.customParameters,s.geometryType,e.queryMetadata)}constructor(e,t,s,r,i,n,o){this._queryParams=e,this._displayFilter=t,this._queryScaleRanges=s,this._subtypeField=r,this._customParameters=i,this._geometryType=n,this._queryMetadata=o}getPageSize(e){if(null==this._queryMetadata)throw new Error("InternalError: Service does not support paged queries");const t=this._queryMetadata.supportsMaxRecordCountFactor?4:null,s=((e?this._queryMetadata.tileMaxRecordCount:this._queryMetadata.maxRecordCount)??this._queryMetadata.maxRecordCount??2e3)*(t??1),r=(0,n.A)("featurelayer-query-max-page-size")??8e3;return Math.min(r,s)}get objectIdsQueryPageSize(){return this._queryMetadata?.maxRecordCount??2e3}updateHistoricMoment(e){this._queryParams.historicMoment=e}updateFields(e){this._queryParams.outFields=e}createPatchFieldsQuery(e,t,s){if(!t.getSize())return null;const r=e.clone();if("*"===this._queryParams.outFields[0]){if("*"===(r.outFields??[])[0])return null;r.outFields=this._queryParams.outFields}else{const e=new Set(this._queryParams.outFields),s=[];for(const r of e)t.hasField(r)||s.push(r);if(0===s.length)return null;r.outFields=s}r.returnGeometry=!1,r.returnCentroid=!1,r.quantizationParameters=null,r.cacheHint=!0;const i={inner:r,customParameters:this._customParameters};if((0,n.A)("esri-tiles-debug")&&null!=s){const e=s.chunkId.toString().replaceAll("/",".");i.customParameters=i.customParameters?{...i.customParameters,chunkId:e}:{chunkId:e}}return i}createQuery(e={}){if(!this._queryParams)throw new Error("InternalError: queryInfo should be defined");return{inner:new Mn.A({...this._queryParams,...e}),customParameters:this._customParameters}}createTileQuery(e,t){if(null==this._queryMetadata)throw new Error("InternalError: Service does not support tile queries");const s=this.createQuery(t),r=s.inner;if(this._queryScaleRanges?.length){const t=this._queryScaleRanges.filter(t=>(!t.minScale||t.minScale>=e.maxScale)&&(!t.maxScale||t.maxScale<=e.minScale)).map(e=>e.subtypeCode);if(t.length){const e=`${this._subtypeField} IN (${t})`;r.where=(0,an.mA)(r.where,e)}}if(this._displayFilter&&(r.where=(0,an.mA)(r.where,(0,So.Ch)(this._displayFilter,e.minScale,e.maxScale))),r.quantizationParameters=t.quantizationParameters??e.getQuantizationParameters(),r.resultType="tile",r.geometry=e.hydratedExtent,this._queryMetadata.supportsQuantization?"esriGeometryPolyline"===this._geometryType&&(r.maxAllowableOffset=e.resolution*(0,n.A)("feature-polyline-generalization-factor")):"esriGeometryPolyline"!==this._geometryType&&"esriGeometryPolygon"!==this._geometryType||(r.maxAllowableOffset=e.resolution,"esriGeometryPolyline"===this._geometryType&&(r.maxAllowableOffset*=(0,n.A)("feature-polyline-generalization-factor"))),r.defaultSpatialReferenceEnabled=this._queryMetadata.supportsDefaultSpatialReference,r.compactGeometryEnabled=this._queryMetadata.supportsCompactGeometry,this._queryMetadata.supportsMaxRecordCountFactor&&(r.maxRecordCountFactor=4),(0,n.A)("esri-tiles-debug")){const t=e.id.replaceAll("/",".");s.customParameters=s.customParameters?{...s.customParameters,tileId:t}:{tileId:t}}return s}createPagedTileQuery(e,t){const s=this.getPageSize(!0);return this.createTileQuery(e,{start:s*t,num:s,returnExceededLimitFeatures:!0})}createPagedQuery(e,t){const s=this.getPageSize(!1);return this.createQuery({start:s*e,num:s,returnExceededLimitFeatures:!0,maxRecordCountFactor:4,quantizationParameters:t,cacheHint:!0})}createObjectIdsQuery(e){return this.createQuery({objectIds:e,outFields:["*"]})}}var To=s(10382),Ao=s(75321),Mo=s(80893),Fo=s(51624),Co=s(97633),Po=s(99996),Eo=s(53655);const Ro=268435455;class Oo{constructor(){this.hasFeatures=!1,this.exceededTransferLimit=!1,this.hasZ=!1,this.hasM=!1,this.fieldCount=0,this.featureCount=0,this.idFieldIndices=[],this.transform=null,this.vertexCount=0,this.offsets={attributes:new Array,geometry:new Array},this.centroid=new Array,this.byReferenceVertexCounts=new Map}get usedMemory(){let e=0;return e+=(0,io.Qf)(this.idFieldIndices),e+=(0,io.Qf)(this.offsets.attributes),e+=(0,io.Qf)(this.offsets.geometry),e+=(0,io.Qf)(this.centroid),this.displayIds&&(e+=(0,io.Qf)(this.displayIds)),this.groupIds&&(e+=(0,io.Qf)(this.groupIds)),e}get stride(){return 2+Number(this.hasZ)+Number(this.hasM)}}const zo=128e3,Lo={small:{delta:new Int32Array(128),decoded:new Int32Array(128)},small64:{delta:new Float64Array(0),decoded:new Float64Array(0)},large:{delta:new Int32Array(zo),decoded:new Int32Array(zo)},large64:{delta:new Float64Array(0),decoded:new Float64Array(0)}};function Do(e,t){return t?e<=Lo.small64.delta.length?Lo.small64:(e<=Lo.large64.delta.length||(Lo.large64.delta=new Float64Array(Math.round(1.25*e)),Lo.large64.decoded=new Float64Array(Math.round(1.25*e))),Lo.large64):e<=Lo.small.delta.length?Lo.small:(e<=Lo.large.delta.length||(Lo.large.delta=new Int32Array(Math.round(1.25*e)),Lo.large.decoded=new Int32Array(Math.round(1.25*e))),Lo.large)}function qo(e){for(;e.next();){if(1===e.tag())return e.getMessage();e.skip()}return null}function No(e,t,s,r,i){return!!e&&0===t*i-r*s&&t*r+s*i>0}class Bo extends Po.Y{static fromBuffer(e,t,s=!1){const i=t.geometryType,n=function(e){try{const t=new Fo.A(new Uint8Array(e),new DataView(e));for(;t.next();){if(2===t.tag())return qo(t.getMessage());t.skip()}}catch(e){throw new r.A("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:e})}return null}(e),o=function(e,t,s){const r=e.asUnsafe(),i=r.pos(),n=new Oo;let o=0,a=0,c=null;const l=[];for(;r.next();)switch(r.tag()){case 12:c=r.processMessage(Eo.ae);break;case 9:n.exceededTransferLimit=r.getBool();break;case 10:n.hasZ=r.getBool();break;case 11:n.hasM=r.getBool();break;case 13:{const e=r.processMessage(Eo.cn);e.index=o++,l.push(e);break}case 15:{const e=r.getPackedEnd(),s=n.offsets.geometry,i=n.centroid;s.push(0);const{stride:o}=n;for(i.push(Ro),i.push(Ro);r.pos()<e&&r.next();)switch(r.tag()){case 1:{n.offsets.attributes.push(r.pos());const e=r.getLength();r.skipLen(e);break}case 2:if(t){const e=r.getPackedEnd();for(;r.pos()<e&&r.next();)switch(r.tag()){case 3:{const e=r.getPackedEnd();let t=a*o;for(;r.pos()<e;)n.centroid[t++]=r.getSInt64();break}default:r.skip()}}else{n.offsets.geometry[a]=r.pos();const e=r.getLength();n.vertexCount+=e,r.skipLen(e)}break;case 4:{const e=r.getLength(),t=r.pos()+e;for(;r.pos()<t&&r.next();)switch(r.tag()){case 3:{const e=r.getPackedEnd();let t=a*o;for(;r.pos()<e;)n.centroid[t++]=r.getSInt64();break}default:r.skip()}break}case 12:{const e=r.getUInt64();n.byReferenceVertexCounts.set(a,e);break}default:r.skip()}a++,n.hasFeatures=!0;break}default:r.skip()}n.fields=new Vi.A(l),n.featureCount=a,n.fieldCount=o;const u=function*(e){switch(e.type){case"object-id":case"unique-id-simple":return void(yield e.fieldName);case"unique-id-composite":return void(yield*e.fieldNames)}}(s);return n.idFieldIndices=Array.from(u,e=>n.fields.get(e)?.index),n.transform=c,n.displayIds=new Uint32Array(n.featureCount),n.groupIds=new Uint16Array(n.featureCount),r.move(i),n}(n,"esriGeometryPoint"===i,t.featureIdInfo);return new Bo(n,o,t,s)}constructor(e,t,s,r){super(s),this._use64Bit=r,this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0},this._parseCaches=new Array,this._geometryType=s.geometryType,this._reader=e,this._header=t,this._hasNext=t.hasFeatures,this._isPoints="esriGeometryPoint"===s.geometryType}get _size(){return this._header.featureCount}get fields(){return this._header.fields}get geometryType(){return this._geometryType}get hasZ(){return this._header.hasZ}get hasM(){return this._header.hasM}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}getByReferenceVertexCount(){return this._header.byReferenceVertexCounts.get(this._featureIndex)}getSize(){return this._size}getInTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(e){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._featureIndex=e}getAttributeHash(){let e="";for(const t of this._header.fields.fields)e+=this._readAttributeAtIndex(t.index)+".";return e}getObjectId(){if(1===this._header.idFieldIndices.length)return this._readAttributeAtIndex(this._header.idFieldIndices[0]);const e=this._header.idFieldIndices.map(e=>this._readAttributeAtIndex(e));return JSON.stringify(e)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}readGeometryArea(){return this._cache.area||this._readGeometry(!0),this._cache.area}copy(){const e=this._reader.clone(),t=new Bo(e,this._header,this.metadata,this._use64Bit);return this.copyInto(t),t}next(){for(this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0;++this._featureIndex<this._size&&!this._getExists(););return this._featureIndex<this._size}get usedMemory(){return io.qK+(this._cache.geometry?.usedMemory??0)}get underlyingMemory(){return super.underlyingMemory+this._reader.usedMemory+this._header.usedMemory}_readX(){return this._header.centroid[this._featureIndex*this._header.stride]}_readY(){return this._header.centroid[this._featureIndex*this._header.stride+1]}_readServerCentroid(){const e=new Xt.A([],[],this.hasZ,this.hasM),{coords:t,stride:s}=e;for(let e=this._featureIndex*s,r=e+s;e<r;++e)t.push(this._header.centroid[e]);return 268435455===t[0]?null:e}_readGeometry(e=!1){if((this.hasZ||this.hasM)&&(e=!1),void 0===this._cache.geometry){let t=null;if(this._isPoints)t=this._readServerCentroid();else{const s=this._header.offsets.geometry[this._featureIndex],r=this._reader;if(0===s)return null;r.move(s);try{t=e?this._parseGeometryForDisplay(r):this._parseGeometry(r)}catch(e){return null}}return 0===t?.coords.length&&(t=null),this._cache.geometry=t,t}return this._cache.geometry}_readAttribute(e,t){const s=this._header.fields.get(e);if(null==s)return;const r=this._readAttributeAtIndex(s.index),i=this._header.fields.isDateField(s.name);return t?null==r?r:i?new Date(r):r:r}_readAttributes(){const e={};for(const t of this._header.fields.fields)e[t.name]=this._readAttributeAtIndex(t.index);return e}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._featureOffset=this._featureOffset,e._hasNext=this._hasNext,e._parseCaches=this._parseCaches}_readAttributeAtIndex(e){let t=this._parseCaches[e];if(t||(t=new Co.P(this.getSize()),this._parseCaches[e]=t),t.has(this._featureIndex))return t.get(this._featureIndex);const s=this._header.offsets.attributes[this._featureIndex*this._header.fieldCount+e],r=this._reader;r.move(s);const i=function(e){const t=e.getLength(),s=e.pos()+t;for(;e.pos()<s&&e.next();)switch(e.tag()){case 1:return e.getString();case 2:return e.getFloat();case 3:return e.getDouble();case 4:return e.getSInt32();case 5:return e.getUInt32();case 6:return e.getInt64();case 7:return e.getUInt64();case 8:return e.getSInt64();case 9:return e.getBool();default:return e.skip(),null}return null}(r);return t.set(this._featureIndex,i),i}_readGeometryDeltaDecoded(e){if(void 0===this._cache.unquantGeometry){const t=this._readGeometry(e);if(!t)return this._cache.unquantGeometry=void 0,null;const s=this.getInTransform();if(!s)return this._cache.unquantGeometry=t,t;const r=s.scale[2]??1,i=s.translate[2]??1,n=s.scale[3]??1,o=s.translate[3]??1,a=Do(t.coords.length,this._use64Bit).decoded,c=t.clone(a);this._cache.unquantGeometry=c;const{lengths:l,coords:u,hasZ:h,hasM:d}=c,p=h&&(1!==r||0!==i),f=d&&(1!==n||0!==o);let _=0;for(const e of l){let t=u[_++],s=u[_++];if(p){const e=u[_];u[_++]=r*e+i}if(f){const e=u[_];u[_++]=n*e+o}for(let a=1;a<e;++a){if(t=u[_++]+=t,s=u[_++]+=s,p){const e=u[_];u[_++]=r*e+i}if(f){const e=u[_];u[_++]=n*e+o}}}return c}return this._cache.unquantGeometry}_parseGeometry(e){const t=e.asUnsafe(),s=t.getPackedEnd(),r=[],i=[];for(;t.pos()<s&&t.next();)switch(t.tag()){case 2:{const e=t.getPackedEnd();for(;t.pos()<e;)i.push(t.getUInt32());break}case 3:{const e=t.getPackedEnd();for(;t.pos()<e;)r.push(t.getSInt64());break}default:t.skip()}return new Xt.A(i,r,this.hasZ,this.hasM)}_parseGeometryForDisplay(e){const t=e.asUnsafe(),s=t.getLength(),r=t.pos()+s,i=[],n=[];let o=0,a=0,c=null,l=0;const u="esriGeometryPolygon"===this.geometryType,h="esriGeometryPolyline"===this.geometryType,d=u?3:h?2:1,p=u||h;for(;t.pos()<r&&t.next();)switch(t.tag()){case 2:{const e=t.getUInt32(),s=t.pos()+e;for(;t.pos()<s;){const e=t.getUInt32();i.push(e),o+=e}c=Do(2*o,this._use64Bit).delta;break}case 3:{t.getUInt32();const e=2+(this.hasZ?1:0)+(this.hasM?1:0);(0,_.Lw)(c);for(const s of i){if(a+e*s>c.length){for(let e=0;e<s;e++)t.getSInt64(),t.getSInt64(),this.hasZ&&t.getSInt64(),this.hasM&&t.getSInt64();continue}let r=t.getSInt64(),i=t.getSInt64();this.hasZ&&t.getSInt64(),this.hasM&&t.getSInt64(),c[a++]=r,c[a++]=i;let o=1;for(let e=1;e<s;e++){const e=t.getSInt64(),s=t.getSInt64();this.hasZ&&t.getSInt64(),this.hasM&&t.getSInt64();const n=r+e,u=i+s;l+=-.5*(n-r)*(u+i),r=n,i=u,0===e&&0===s||No(p,c[a-2],c[a-1],e,s)?(c[a-2]+=e,c[a-1]+=s):(c[a++]=e,c[a++]=s,o+=1)}o>=d?n.push(o):a-=o*e}break}default:t.skip()}return this._cache.area=l,n.length?new Xt.A(n,c):null!=c?this._createDeltaQuantizedExtrudedGeometry(c[0],c[1]):null}}class Go{constructor(e,t){this.service=e,this._metadata=t}destroy(){}}class jo extends Go{constructor(e,t,s){super(e,t),this._ports=[],this._loaded=this._load(s)}destroy(){this._loaded.finally(()=>{this._client.close(),this._client=null;for(const e of this._ports)e.close()}).catch(()=>{})}async _load(e){this._ports=await e.layerView.openMemoryPorts(),this._client=await async function(e){const t=new To.A;return await t.open(e,{}),t}(this._ports)}async executeQuery(e,t){await this._loaded;const s=await this._client.invoke("queryFeatures",e.toJSON(),t);return En.K.fromFeatureSet(s,this._metadata)}}class Uo extends Go{async executeQuery(e,t){const s=await(0,Mo.kS)(this.service.source,e,t),i=!e.quantizationParameters;try{return Bo.fromBuffer(s,this._metadata,i)}catch(s){const i=await(0,Mo.LT)(this.service.source,e,"pbf",t??{}),{data:{url:n}}=await(0,vo.A)(i.url,{responseType:"native-request-init",...i.options});throw new r.A("featurelayer:query","Failed to parse response",{url:n,error:s,query:e.toJSON()})}}}class Vo extends Go{async executeQuery(e,t){const{source:s,queryMetadata:r}=this.service;if(null!=e.quantizationParameters&&!r.supportsQuantization){const r=e.clone(),i=(0,g.VV)(r.quantizationParameters);r.quantizationParameters=null;const n=await(0,Mo.eW)(s,r,this._metadata.spatialReference,t),o=(0,Cr.q3)(n,this._metadata.featureIdInfo);return(0,Cr.jH)(i,o),En.K.fromOptimizedFeatureSet(o,this._metadata)}const i=await(0,Mo.eW)(s,e,this._metadata.spatialReference,t);return"esriGeometryPoint"===this._metadata.geometryType&&(i.features=i.features?.filter(e=>{if(null!=e.geometry){const t=e.geometry;return Number.isFinite(t.x)&&Number.isFinite(t.y)}return!0})),En.K.fromFeatureSet(i,this._metadata)}}class Wo extends Go{async executeQuery(e,t){if(e.quantizationParameters&&!this.service.queryMetadata.supportsQuantization){const s=e.clone(),r=(0,g.VV)(s.quantizationParameters);s.quantizationParameters=null;const i=await(0,Ao.I)(this.service.source,e,t);return(0,Cr.jH)(r,i),En.K.fromOptimizedFeatureSet(i,this._metadata)}const s=await(0,Ao.I)(this.service.source,e,t);return En.K.fromOptimizedFeatureSet(s,this._metadata)}}class Yo extends go{constructor(e,t,s){super(e.metadata,t,s),this._service=e,this._didApplyOverride=!1,this._queue=new Ni.QueueProcessor({concurrency:32,process:async e=>{const t={signal:e.options?.signal,query:e.query.customParameters,useQueue:!0};return this._adapter.executeQuery(e.query.inner,t)}}),this._queryInfo=ko.create(e,{...t.full,...t.partial},this.metadata),this._adapter=function(e,t,s){switch(e.type){case"memory":return new jo(e,t,s);case"ogc":return new Wo(e,t);case"feature-service":return e.queryMetadata.supportsFormatPBF&&(0,n.A)("featurelayer-pbf")?new Uo(e,t):new Vo(e,t)}}(e,this.metadata,s.connection),this._lastEditDate=e.queryMetadata.lastEditDate}destroy(){super.destroy(),this._adapter.destroy()}unsafeSetQueryHistoricMoment(e){this._queryInfo.updateHistoricMoment(e)}async tryUpdate(e,t){if((0,m.i8)(this.availableFields,t.availableFields)){if(this._didApplyOverride||await this._queryLastEditDateChanged())return!1;await this._updateFields(t.availableFields)}return this._schema.partial=t,!0}async queryByObjectId(e,t){if(0===e.length)return En.K.empty(this.metadata);const s=this._queryInfo.createQuery({objectIds:e});return s.inner.outFields=t,this._fetch(s,null,null)}get availableFields(){return this._schema.partial.availableFields}get definitionExpression(){return this._schema.full.definitionExpression}_onOverride(){this._didApplyOverride=!0}async _updateFields(e){this._queryInfo.updateFields(e);const t=Array.from(this.store.chunks()).map(async e=>{const t=Mn.A.fromJSON(e.queryInfo.queryJSON);if(t)try{return await this._tryUpdateFields(e.reader,t,{chunkId:e.chunkId}),null}catch(e){return e}}),s=(await Promise.all(t)).filter(e=>e);if(s.length)throw new r.A("featurelayer-query","Encountered errors when downloading fields",{errors:s})}async _fetch(e,t,s){const r=await this._enqueue(e,t);return await this._tryUpdateFields(r,e.inner,s),r}async _queryLastEditDateChanged(){if(null==this._lastEditDate)return!1;if(!("source"in this._service))return!1;const e=this._service.source,t={...e.query,f:"json"},s=(await(0,vo.A)(e.path,{query:t,responseType:"json"})).data.editingInfo.lastEditDate;return s!==this._lastEditDate&&(this._lastEditDate=s,!0)}async _tryUpdateFields(e,t,s){const i=this._queryInfo.createPatchFieldsQuery(t,e,s);if(!i)return;const n=await this._enqueue(i,this._options);n.getSize()===e.getSize()?e.joinAttributes(n):Ie.A.getLogger("esri.views.2d.layers.features.sources.strategies.AFetchLoadStrategy").error(new r.A("featurelayer-query",`Failed to join features. Expected a count of ${e.getSize()} features, but got ${n.getSize()}`,{query:i.inner.toJSON(),debugInfo:s}))}async _enqueue(e,t){return this._connection.onEvent({type:"fetchStart"}),this._queue.push({query:e,options:t}).finally(()=>{this._connection.onEvent({type:"fetchEnd",done:0===this._queue.length})})}}class $o extends Yo{constructor(e,t,s){super(e,t,s),this._chunksById=new Map,this._featureCache=new bo(this.store,this._queryInfo,this._options,this._fetch.bind(this))}prepareCacheUpdate(e,t){return this._featureCache.prepareCacheUpdate(e,t)}applyCacheUpdate(){return this._featureCache.applyCacheUpdate()}unload(e){this._removeChunks(e.tile)}_onRemoveTileChunk(e){}_addChunk(e){const t=e.tile.id;this._chunksById.has(t)||this._chunksById.set(t,[]);const s=e.size();(s||e.first||e.end)&&((0,n.A)("esri-2d-update-debug")&&console.debug(`Chunk[${e.chunkId}] ATileLoadStrategy.addChunk [count=${s}]`),this._chunksById.get(t).push(e),this.store.insert(e))}_removeChunks(e){const t=this._chunksById.get(e.key.id)??[];for(const s of t)(0,n.A)("esri-2d-update-debug")&&console.debug(`Tile[${e.key.id}] Chunk[${s.chunkId}] ATileLoadStrategy.removeChunk`),this._onRemoveTileChunk(s),this.store.remove(s);this._chunksById.delete(e.key.id)}}var Ho=s(70300);class Qo extends Ho.K{constructor(e,t,s,r,i,n){super(),this._reader=e,this._queryJSON=t,this._tile=s,this._sourceTile=r,this._sourceTileDepth=i,this._end=n,this.chunkId=`${this._tile.key.id}.${this._sourceTile?.key.id}${this._end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._sourceTile?.key.normalizedId}${this._end?"e":""}`}get queryInfo(){return{type:"drill-down-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,sourceTileDepth:this._sourceTileDepth,sourceTileId:this._sourceTile?.key.id,size:this.size(),end:this.end}}get first(){return 0===this._sourceTileDepth}get reader(){return this._reader}get end(){return this._end}get tile(){return this._tile}get isTiled(){return!0}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}const Zo=(0,n.A)("featurelayer-query-max-depth");class Xo{constructor(e,t){this.subscription=e,this._tileIdToResult=new Map,this._controller=new AbortController,this._handles=(0,i.vE)([(0,a.u7)(e.signal,()=>this._controller.abort()),(0,a.u7)(t,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get(e){return this._tileIdToResult.get(e)}set(e,t){this._tileIdToResult.set(e,t)}get options(){return{signal:this._controller.signal}}}class Ko extends $o{constructor(){super(...arguments),this._loadStates=new Map}destroy(){super.destroy();for(const e of this._loadStates.values())e.destroy();this._loadStates.clear()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}async load(e){this._loadStates.has(e.key.id)||this._loadStates.set(e.key.id,new Xo(e,this._options));const t=this._loadStates.get(e.key.id);let s;try{for await(const s of this._fetchChunkInfos(t,e.tile,0)){const{queryJSON:e,reader:r,sourceTile:i,sourceTileDepth:n,tile:o}=s,c=new Qo(r,e,o,i,n,!1);(0,a.Te)(t.options),this._addChunk(c)}}catch(e){s=e}(0,a.Te)(t.options);const r=new Qo(En.K.empty(this.metadata),null,e.tile,null,-1,!0);if(this._addChunk(r),s)throw s}unload(e){super.unload(e),this._loadStates.get(e.key.id)?.destroy(),this._loadStates.delete(e.key.id)}async*_fetchChunkInfos(e,t,s){let r=e.get(t.id);const i=!!r;if(r||(r=await this._fetchChunkInfo(e,t,s),e.set(t.id,r)),r.reader.exceededTransferLimit&&s<(0,n.A)("featurelayer-query-max-depth"))for(const r of t.createChildTiles())yield*this._fetchChunkInfos(e,r,s+1);else i||(yield r)}async _fetchChunkInfo(e,t,s){const r=e.subscription.tile.getQuantizationParameters(),i=this._queryInfo.createTileQuery(t,{returnExceededLimitFeatures:s===Zo,quantizationParameters:r});return{reader:await this._fetch(i,e.options,{chunkId:t.id}),queryJSON:i.inner.toJSON(),tile:e.subscription.tile,sourceTile:t,sourceTileDepth:s}}}var Jo=s(27348);class ea extends Ho.K{constructor(e,t){super(),this._reader=e,this._tile=t;const s=this._reader.getCursor();s.next();const r=s.getObjectId();this.chunkId=`${this._tile.key.id}.${r}${this.end?"e":""}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader}get first(){return!1}get end(){return!1}get queryInfo(){return{type:"snapshot",chunkId:this.chunkId,size:this.size(),end:this.end}}get isTiled(){return!1}get tile(){return this._tile}getTileReader(e){if(this._tile.key.id!==e.key.id)return null;const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}class ta extends Ho.K{constructor(e,t,s,r,i){super(),this._reader=e,this._queryJSON=t,this._tile=s,this._page=r,this._end=i,this.chunkId=`${this._tile.key.id}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._page}${this.end?"e":""}`}get queryInfo(){return{type:"paged-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get reader(){return this._reader}get first(){return 0===this._page}get end(){return this._end}get page(){return this._page}get tile(){return this._tile}get isTiled(){return!0}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}class sa{constructor(e,t){this.subscription=e,this._pages=new Set,this._controller=new AbortController,this._done=!1,this._handles=(0,i.vE)([(0,a.u7)(e.signal,()=>this._controller.abort()),(0,a.u7)(t,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get pageStart(){let e=-1;for(const t of this._pages.values())e=Math.max(e,t);return e+1}get done(){return this._done}get options(){return{signal:this._controller.signal}}add(e,t){this._pages.add(e),this._done=this._done||t}}class ra extends $o{constructor(){super(...arguments),this._loadStates=new Map,this._levels=new Map}destroy(){super.destroy();for(const e of this._loadStates.values())e.destroy();this._loadStates.clear()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}async load(e){const t=(0,O.tE)(this._loadStates,e.key.id,()=>new sa(e,this._options));for await(const e of this._fetchPages(t))this._addChunk(e)}unload(e){super.unload(e),this._loadStates.get(e.key.id)?.destroy(),this._loadStates.delete(e.key.id)}_onRemoveTileChunk(e){if(e instanceof ea){const t=e.reader.getCursor(),s=e.tile.resolution;for(;t.next();)this._removeReferenceFeature(t.getObjectId(),s)}}async*_fetchPages(e){let t;try{for await(const t of this._concurrentPageStream(e)){(0,a.Te)(e.options);for(const e of t)0!==e.size()&&(yield e)}}catch(e){t=e}if(t&&(0,a.zf)(t)||(yield new ta(En.K.empty(this.metadata),null,e.subscription.tile,-1,!0)),t)throw t}async*_concurrentPageStream(e){const t=(0,n.A)("featurelayer-query-tile-concurrency"),s=this._pageStreamAll(e),r=[];let i=!1,o=1;for(;!i;){const e=[];for(;!i&&r.length<o;){const t=s.next();if(!t.value){i=!0;break}const n=t.value;n.then(e=>{e.some(e=>e.reader.exceededTransferLimit)||(i=!0)}).catch(e=>{i=!0}).finally(()=>{r.splice(r.indexOf(n),1)}),r.push(n),e.push(n)}for(const t of e)yield t;r.length&&await Promise.race(r),o<t&&(o+=1)}}*_pageStreamAll(e){const t=Math.ceil((0,n.A)("featurelayer-query-tile-max-features")/this._queryInfo.getPageSize(!0));for(let s=0;s<t;s++)yield this._downloadPage(s,e)}async _downloadPage(e,t){(0,a.Te)(t.options);const s=t.subscription.tile,r=this._queryInfo.createPagedTileQuery(s,e);r.inner.returnExceededLimitGeometries=!1;const i=await this._fetch(r,t.options,{chunkId:`${s.id}-${e}`}),n=[],o=i.getCursor();for(;o.next();){const e=o.getByReferenceVertexCount();e&&(n.push({vertexCount:e,objectId:o.getObjectId()}),o.delete())}const c=new ta(i,r.inner.toJSON(),s,e,!1),l=await this._ensureReferenceFeatures(n,s);return(0,a.Te)(t.options),[c,...l]}async _ensureReferenceFeatures(e,t){let s=this._levels.get(t.resolution);return null==s&&(s=new Map,this._levels.set(t.resolution,s)),(await Promise.all(this._ensureReferenceLevelFeatures(s,e,t.resolution))).map(e=>new ea(e,t))}_removeReferenceFeature(e,t){const s=this._levels.get(t);if(null==s)throw new Error("Expected to find reference feature.");this._removeReferenceLevelFeature(s,e)}_ensureReferenceLevelFeatures(e,t,s){const r=[],i=new Jo.A({mode:"view",originPosition:"upper-left",tolerance:s});for(const s of t){let t=e.get(s.objectId);null==t&&(t=new no(this._queryFeature(s.objectId,i)),e.set(s.objectId,t)),t.increment(),r.push(t.data)}return r}_removeReferenceLevelFeature(e,t){const s=e.get(t);if(null==s)throw new Error("Expected to find reference feature.");s.decrement(),s.empty&&e.delete(t)}async _queryFeature(e,t){const s=this._queryInfo.createQuery({objectIds:[e]});return s.inner.quantizationParameters=t,this._fetch(s,null,null)}}class ia{constructor(e,t){this.subscription=e,this._pages=new Set,this._controller=new AbortController,this._done=!1,this._handles=(0,i.vE)([(0,a.u7)(e.signal,()=>this._controller.abort()),(0,a.u7)(t,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get pageStart(){let e=-1;for(const t of this._pages.values())e=Math.max(e,t);return e+1}get done(){return this._done}get options(){return{signal:this._controller.signal}}add(e,t){this._pages.add(e),this._done=this._done||t}}class na extends $o{constructor(){super(...arguments),this._loadStates=new Map}destroy(){super.destroy();for(const e of this._loadStates.values())e.destroy();this._loadStates.clear()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}async load(e){const t=(0,O.tE)(this._loadStates,e.key.id,()=>new ia(e,this._options));for await(const e of this._fetchPages(t))this._addChunk(e)}unload(e){super.unload(e),this._loadStates.get(e.key.id)?.destroy(),this._loadStates.delete(e.key.id)}async*_fetchPages(e){let t;try{for await(const t of this._concurrentPageStream(e))(0,a.Te)(e.options),0!==t.size()&&(yield t)}catch(e){t=e}if(t&&(0,a.zf)(t)||(yield new ta(En.K.empty(this.metadata),null,e.subscription.tile,-1,!0)),t)throw t}async*_concurrentPageStream(e){const t=(0,n.A)("featurelayer-query-tile-concurrency"),s=this._pageStreamAll(e),r=[];let i=!1,o=1;for(;!i;){const e=[];for(;!i&&r.length<o;){const t=s.next();if(!t.value){i=!0;break}const n=t.value;n.then(e=>{e.reader.exceededTransferLimit||(i=!0)}).catch(e=>{i=!0}).finally(()=>{r.splice(r.indexOf(n),1)}),r.push(n),e.push(n)}for(const t of e)yield t;r.length&&await Promise.race(r),o<t&&(o+=1)}}*_pageStreamAll(e){const t=Math.ceil((0,n.A)("featurelayer-query-tile-max-features")/this._queryInfo.getPageSize(!0));for(let s=0;s<t;s++)yield this._downloadPage(s,e)}async _downloadPage(e,t){(0,a.Te)(t.options);const s=t.subscription.tile,r=this._queryInfo.createPagedTileQuery(s,e),i=await this._fetch(r,t.options,{chunkId:`${s.id}-${e}`});return(0,a.Te)(t.options),new ta(i,r.inner.toJSON(),s,e,!1)}}class oa extends Yo{constructor(e,t,s){super(e,t,s)}get about(){return{willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}load(e){return null==this._promise&&(this._promise=this._download()),this._promise}unload(e){}async _download(){const e=this._schema.snapshotInfo.initialTolerance,t=e?new Jo.A({mode:"view",originPosition:"upper-left",tolerance:e}):null;await this._downloadStreaming(t),null!=t&&await this._downloadRefresh()}async _downloadStreaming(e){try{for await(const t of this._fetchPages(e))this.store.insert(t)}catch(e){throw new r.A("featurelayer-query","Encountered error when downloading data",{error:e})}}async _downloadRefresh(){try{const e=[];for await(const t of this._fetchPages(null))e.push(t);this.store.clear();for(const t of e)this.store.insert(t);this.store.refresh()}catch(e){throw new r.A("featurelayer-query","Encountered error when downloading data",{error:e})}}async*_fetchPages(e){let t;try{for await(const t of this._concurrentPageStream(e))0!==t.size()&&(yield t)}catch(e){t=e}if(t&&(0,a.zf)(t)||(yield new wo.j(En.K.empty(this.metadata),null,-1,!0)),t)throw t}async*_concurrentPageStream(e){const t=(0,n.A)("featurelayer-snapshot-concurrency"),s=this._pageStreamAll(e),r=[];let i=!1,o=1;for(;!i;){const e=[];for(;!i&&r.length<o;){const t=s.next();if(!t.value){i=!0;break}const n=t.value;n.then(e=>{e.reader.exceededTransferLimit||(i=!0)}).catch(e=>{i=!0}).finally(()=>{r.splice(r.indexOf(n),1)}),r.push(n),e.push(n)}for(const t of e)yield t;r.length&&await Promise.race(r),o<t&&(o+=1)}}*_pageStreamAll(e){const t=Math.ceil(this._schema.snapshotInfo.maxFeatureCount/this._queryInfo.getPageSize(!1));for(let s=0;s<t;s++)yield this._downloadPage(s,e)}async _downloadPage(e,t){(0,a.Te)(this._options);const s=this._queryInfo.createPagedQuery(e,t),r=await this._fetch(s,this._options,{chunkId:e.toString()}),i=new wo.j(r,s.inner.toJSON(),e,!1);return(0,a.Te)(this._options),i}}var aa=s(29953),ca=s(39412);class la extends Ho.K{constructor(e,t,s,r,i,n){super(),this._metadata=e,this._reader=t,this._page=s,this._end=r,this._fileIndex=i,this._fileUrl=n,this.chunkId=`${this._fileIndex}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=this.chunkId}get reader(){return this._reader??En.K.empty(this._metadata)}get first(){return 0===this._page}get end(){return this._end}get queryInfo(){return{type:"snapshot",chunkId:this.chunkId,page:this._page,size:this.size(),end:this.end}}get isTiled(){return!1}async updateFields(e,t,s){return this._reader?.updateFields(e,this._fileUrl,t,s)}getTileReader(e){const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}var ua=s(16630);class ha extends go{constructor(e,t,s,r){super(e.metadata,t,s),this._service=e,this._files=new Map,this._loaded=this._load(r)}destroy(){super.destroy(),this._loaded.finally(()=>{this._client.close(),this._client=null;for(const e of this._ports)e.close()}).catch(()=>{})}get about(){return{willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}get availableFields(){return this._schema.partial.availableFields}get definitionExpression(){return this._schema.full.definitionExpression}async tryUpdate(e,t){if(await this._loaded,(0,m.i8)(this.availableFields,t.availableFields)&&await this._updateFields(t.availableFields),(0,m.i8)(this._schema.partial.urls,t.urls)){for(const e of t.urls)this._files.has(e)||await this._loadFile(e);for(const e of this._files.keys())if(!t.urls.includes(e))throw new r.A("unsupported","Removing parquet files is not supported",{previous:this._schema.partial.urls,next:t.urls})}return this._schema.partial=t,!0}async load(e){return this._loaded}unload(e){}_onOverride(){}async _load(e){this._ports=await e.layerView.openMemoryPorts(),this._client=await(0,aa.N1)(this._ports,{maxNumberOfConcurrentJobs:20}),this._proxy=this._client.createInvokeProxy(),this._indexMap=await this._proxy.getIndexMap(),await this._download()}async _updateFields(e){const t=new Set(e),s=(0,z.iv)(t,new Set(this.availableFields));if(null!=this._service.metadata.fieldsIndex&&s.size){const e=Array.from(this.store.insertedChunks()).map(e=>e.updateFields(this._proxy,Array.from(s),this._options));await Promise.all(e)}}async _loadFile(e){const t=await(0,ca.N)(),s=await this._proxy.getFileId(e);this._files.set(e,s),(0,a.Te)(this._options);const r=await this._proxy.queryStream(e,{type:"snapshot",outFields:Array.from(this.availableFields),returnGeometry:!0,outSpatialReference:this.metadata.outSpatialReference.toJSON(),where:this.definitionExpression},this._options);let i=0;const n=[],o=async(n=0)=>{const c=await this._proxy.getStreamNext(e,r,this._options);if((0,a.Te)(this._options),null==c)return;const l=t.ParquetChunk.deserialize(new Uint8Array(c)),u=new ua.s(this.metadata,this._indexMap,l,s),h=new la(this.metadata,u,i++,!1,s,e);return this.store.insert(h),o(n+1)};for(let e=0;e<8;e++)n.push(o());await Promise.all(n)}async _download(){try{await Promise.all(this._schema.partial.urls.map(e=>this._loadFile(e)));const e=new la(this.metadata,null,-1,!0,0,"");this.store.insert(e)}catch(e){throw console.error(e),e}}}class da extends Ho.K{constructor(e,t,s,r,i,n,o){super(),this._metadata=e,this._reader=t,this._tile=s,this._fileId=r,this._fileUrl=i,this._page=n,this._end=o,this.chunkId=`${this._tile.key.id}.${this._fileId}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._fileId}.${this._page}${this.end?"e":""}`}get reader(){return this._reader??En.K.empty(this._metadata)}get first(){return 0===this._page}get end(){return this._end}get tile(){return this._tile}get queryInfo(){return{type:"parquet",chunkId:this.chunkId,queryJSON:null,page:this._page,size:this.size(),tileId:this._tile.id,end:this.end}}get isTiled(){return!0}async updateFields(e,t,s){return this._reader?.updateFields(e,this._fileUrl,t,s)}getTileReader(e){return this._tile.key.id===e.key.id?this.reader:null}}class pa{constructor(e,t){this.subscription=e,this.chunks=[],this.ids=[],this._controller=new AbortController,this._handles=(0,i.vE)([(0,a.u7)(e.signal,()=>this._controller.abort()),(0,a.u7)(t,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get options(){return{signal:this._controller.signal}}addBinaryData(e){this.chunks.push(e)}addSourceChunkId(e){this.ids.push(e)}}class fa extends go{constructor(e,t,s,r){if(super(e.metadata,t,s),this._service=e,this._loadStates=new Map,this._files=new Map,this._queue=new Ni.QueueProcessor({concurrency:32,process:e=>this._loadTile(e)}),!e.geometryInfo.displayOptimization)throw new Error("InternalError: ParquetTileLoadStrategy only supports XZ-enabled parquet files");this._loaded=this._load(r)}destroy(){super.destroy(),this._loaded.finally(()=>{this._client.close(),this._client=null;for(const e of this._ports)e.close()}).catch(()=>{})}get about(){return{willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}get availableFields(){return this._schema.partial.availableFields}get definitionExpression(){return this._schema.full.definitionExpression}async tryUpdate(e,t){await this._loaded;let s=!0;if((0,m.i8)(this.availableFields,t.availableFields)&&await this._updateFields(t.availableFields),(0,m.i8)(this._schema.partial.urls,t.urls)){for(const e of t.urls)this._files.has(e)||(s=!1,await this._insert(e));for(const e of this._files.keys())if(!t.urls.includes(e))throw new r.A("unsupported","Removing parquet files is not supported",{previous:this._schema.partial.urls,next:t.urls})}return this._schema.partial=t,s}async load(e){return await this._loaded,(0,O.tE)(this._loadStates,e.key.id,()=>new pa(e,this._options)),this._queue.push(e)}unload(e){const t=this._loadStates.get(e.tile.id);if(null!=t){for(const e of t.ids)this.store.removeById(e);t.destroy(),this._loadStates.delete(e.tile.id)}}async _load(e){const t=this._schema.partial.urls;this._ports=await e.layerView.openMemoryPorts(),this._client=await(0,aa.N1)(this._ports,{maxNumberOfConcurrentJobs:20}),this._proxy=this._client.createInvokeProxy(),this._indexMap=await this._proxy.getIndexMap(),await Promise.all(t.map(e=>this._insert(e)))}async _insert(e){this._files.set(e,this._files.size)}_onOverride(){}async _updateFields(e){const t=new Set(e),s=(0,z.iv)(t,new Set(this.availableFields));if(null!=this._service.metadata.fieldsIndex&&s.size){const e=Array.from(this.store.insertedChunks()).map(e=>e.updateFields(this._proxy,Array.from(s),this._options));await Promise.all(e)}}async _loadTile(e){const t=e.tile,s=e.signal,r=this._loadStates.get(t.id),i=new Ni.QueueProcessor({process:async t=>{const s=await this._proxy.getFileId(t);return this._downloadFileData(e,t,s)},concurrency:2});await Promise.allSettled(Array.from(this._files.keys()).map(e=>i.push(e))),(0,a.Te)(s);const n=new da(this.metadata,null,t,null,null,0,!0);r.addSourceChunkId(n.chunkId),this.store.insert(n)}async _downloadFileData(e,t,s){const r=await(0,ca.N)(),i=e.tile,n=e.signal,o=this._loadStates.get(i.id),c=await this._proxy.queryStream(t,{type:"tile",extent:i.extent,transform:i.normalizedTransform,outFields:Array.from(this.availableFields),returnGeometry:!0,outSpatialReference:this.metadata.outSpatialReference.toJSON(),scale:i.scale,where:this.definitionExpression},{signal:n});let l=0;const u=[],h=async(e=0)=>{const u=await this._proxy.getStreamNext(t,c,{signal:n});if((0,a.Te)(n),null==u)return;const d=r.ParquetChunk.deserialize(new Uint8Array(u)),p=new ua.s(this.metadata,this._indexMap,d,s),f=new da(this.metadata,p,i,s,t,l++,!1);return o.addBinaryData({data:d,fileUrl:t}),o.addSourceChunkId(f.chunkId),this.store.insert(f),h(e+1)};for(let e=0;e<4;e++)u.push(h());await Promise.all(u)}}class _a{constructor(e){this.size=0,this._start=0,this.maxSize=e,this._buffer=new Array(e)}get entries(){return this._buffer}enqueue(e){if(this.size===this.maxSize){const t=this._buffer[this._start];return this._buffer[this._start]=e,this._start=(this._start+1)%this.maxSize,t}return this._buffer[(this._start+this.size++)%this.maxSize]=e,null}dequeue(){if(0===this.size)return null;const e=this._buffer[this._start];return this._buffer[this._start]=null,this.size--,this._start=(this._start+1)%this.maxSize,e}peek(){return 0===this.size?null:this._buffer[this._start]}peekLast(){return 0===this.size?null:this._buffer[(this._start+(this.size-1))%this.maxSize]}find(e){if(0===this.size)return null;for(const t of this._buffer)if(null!=t&&e(t))return t;return null}clear(e){let t=this.dequeue();for(;null!=t;)e&&e(t),t=this.dequeue()}}class ma{constructor(e,t,s,i,n=128){if(this._trackIdToObservations=new Map,this._idCounter=0,this._lastPurge=performance.now(),this._addOrUpdated=new Map,this._removed=[],this._maxAge=0,this._timeInfo=s,this._purgeOptions=i,this.store=e,"unique-id-composite"===t.type)throw new r.A("stream-layer","composite uniqueIds are not supported");this.idField=t.fieldName,this.purgeInterval=n,this._useGeneratedIds=this.idField===ie.DN}removeById(e){this._removed.push(e)}removeByTrackId(e){const t=this._trackIdToObservations.get(e);if(t)for(const e of t.entries)this._removed.push(e)}add(e){if(this._useGeneratedIds){const t=this._nextId();e.attributes[this.idField]=t,e.objectId=t}else e.objectId=e.attributes[this.idField];const t=e.objectId;if(this._addOrUpdated.set(t,e),this._maxAge=Math.max(this._maxAge,e.attributes[this._timeInfo.startTimeField]),!this._timeInfo.trackIdField)return null==this._trackIdLessObservations&&(this._trackIdLessObservations=new _a(1e5)),void this._trackIdLessObservations.enqueue(t);const s=e.attributes[this._timeInfo.trackIdField];if(!this._trackIdToObservations.has(s)){const e=null!=this._purgeOptions?.maxObservations?this._purgeOptions.maxObservations:1e3,t=(0,lr.qE)(e,0,1e3);this._trackIdToObservations.set(s,new _a(t))}const r=this._trackIdToObservations.get(s),i=r?.enqueue(t);null!=i&&(this._addOrUpdated.has(i)?this._addOrUpdated.delete(i):this._removed.push(i))}checkForUpdates(){const e=this._getToAdd(),t=this._getToRemove(),s=performance.now(),r=s-this._lastPurge,i=Date.now();r>=this.purgeInterval&&(this._purge(s),this._lastPurge=s);const n=[];if(null!=t)for(const e of t){const t=this.store.removeById(e);null!=t&&n.push(t)}const o=[];if(null!=e){const r=new Set(t??[]);for(const t of e)r.has(t.objectId)||(t.attributes[ie.Gm]=s,t.attributes[ie.Aw]=i,this.store.add(t),o.push(t))}return!(!o.length&&!n?.length||(this.store.update(o,n),0))}_getToAdd(){if(!this._addOrUpdated.size)return null;const e=new Array(this._addOrUpdated.size);let t=0;return this._addOrUpdated.forEach(s=>e[t++]=s),this._addOrUpdated.clear(),e}_getToRemove(){const e=this._removed;return this._removed.length?(this._removed=[],e):null}_nextId(){const e=this._idCounter;return this._idCounter=(this._idCounter+1)%4294967294+1,e}_purge(e){const t=this._purgeOptions;null!=t&&(this._purgeSomeByDisplayCount(t),this._purgeByAge(t),this._purgeByAgeReceived(e,t),this._purgeTracks())}_purgeSomeByDisplayCount(e){if(!e.displayCount)return;let t=this.store.size;if(t>e.displayCount){if(this._timeInfo.trackIdField)for(const s of this._trackIdToObservations.values())if(t>e.displayCount&&s.size){const e=s.dequeue();this._removed.push(e),t--}if(null!=this._trackIdLessObservations){let s=t-e.displayCount;for(;s-- >0;){const e=this._trackIdLessObservations.dequeue();null!=e&&this._removed.push(e)}}}}_purgeByAge(e){const t=this._timeInfo?.startTimeField;if(!e.age||!t)return;const s=60*e.age*1e3,r=this._maxAge-s;this.store.forEach(e=>{e.attributes[t]<r&&this._removed.push(e.objectId)})}_purgeByAgeReceived(e,t){if(!t.ageReceived)return;const s=e-60*t.ageReceived*1e3;this.store.forEach(e=>{e.attributes[ie.Gm]<s&&this._removed.push(e.objectId)})}_purgeTracks(){this._trackIdToObservations.forEach((e,t)=>{0===e.size&&this._trackIdToObservations.delete(t)})}}var ya=s(60986),ga=s(10107),xa=s(64108);let wa=class extends R.A{constructor(e){super(e)}get connectionStatus(){return this.connection?.connectionStatus}get errorString(){return this.connection?.errorString}};(0,E.Cg)([(0,ga.MZ)()],wa.prototype,"connection",void 0),(0,E.Cg)([(0,ga.MZ)()],wa.prototype,"connectionStatus",null),(0,E.Cg)([(0,ga.MZ)()],wa.prototype,"errorString",null),wa=(0,E.Cg)([(0,xa.$)("esri.views.2d.layers.features.sources.StreamConnectionState")],wa);class ba{constructor(e,t){this._metadata=e,this._onUpdate=t,this._objectIdToFeature=new Map}get size(){return this._objectIdToFeature.size}get reader(){return En.K.fromFeatures([...this._objectIdToFeature.values()],this._metadata)}add(e){this._objectIdToFeature.set(e.objectId,e)}forEach(e){this._objectIdToFeature.forEach(e)}removeById(e){const t=this._objectIdToFeature.get(e);return t?(this._objectIdToFeature.delete(e),t):null}clear(){this._objectIdToFeature=new Map}update(e,t){this._onUpdate(e?.length??0)}}class va extends Ho.K{constructor(e){super(),this._reader=e,this.chunkId="stream-chunk",this.normalizedChunkId="stream-chunk"}get reader(){return this._reader}get first(){return!0}get end(){return!0}get queryInfo(){return{type:"stream",chunkId:this.chunkId,size:this.size(),end:this.end}}get isTiled(){return!1}getTileReader(e){const t=this.queryFeaturesInBounds(e.bounds);return t.setTransformForDisplay(e.transform),t}}class Sa extends go{constructor(e,t,s){super(e.metadata,t,s),this._service=e,this._connectionState=new wa,this._forceRefresh=!1,this.events=new Yi.bk;const{timeInfo:r}=this.metadata,{purgeOptions:i}=t.full;this._stagingStore=new ba(this.metadata.weakCloneWithAdditionalFields([{name:ie.Aw,alias:"timeReceived",type:"esriFieldTypeDate"}]),e=>this.events.emit("features-updated",e)),this._manager=new ma(this._stagingStore,this.metadata.featureIdInfo,r,i),this.connect()}destroy(){super.destroy(),this.disconnect()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState?.errorString}get availableFields(){return this._schema.full.availableFields}get definitionExpression(){return this._schema.full.definitionExpression}async tryUpdate(e,t){const s=null!=this._chunk;if(t.sourceRefreshVersion!==this._refreshVersion){if(this._refreshVersion=t.sourceRefreshVersion,!this._manager.checkForUpdates()&&s&&!this._forceRefresh)return this.events.emit("tick"),!0;this._chunk&&(this.store.remove(this._chunk),e.requireInvalidation()),this._forceRefresh=!1,this._chunk=new va(this._stagingStore.reader),this.store.insert(this._chunk),this.events.emit("tick")}return this._schema.partial=t,!0}async load(e){}unload(e){}disconnect(){this._streamConnection=(0,_.pR)(this._streamConnection),this._connectionState.connection=null,this._handlesGroup?.remove()}connect(){null==this._streamConnection&&(this._streamConnection=(0,ya.createConnection)(this._service.source,this.metadata.outSpatialReference),this._handlesGroup=(0,i.vE)([this._streamConnection.on("data-received",e=>this._onFeature(e)),this._streamConnection.on("message-received",e=>this._onWebSocketMessage(e))]),this._connectionState.connection=this._streamConnection)}clear(){this._manager.checkForUpdates(),this._stagingStore.clear(),this._forceRefresh=!0}updateCustomParameters(e){this._streamConnection?.updateCustomParameters(e)}sendMessageToSocket(e){this._streamConnection?.sendMessageToSocket(e)}sendMessageToClient(e){this._streamConnection?.sendMessageToClient(e)}_onOverride(){}_onWebSocketMessage(e){if("type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this._manager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this._manager.removeByTrackId(t);break;case"clear":this.clear()}this.events.emit("message-received",e)}_onFeature(e){try{this._manager.add(e),this.events.emit("data-received",e)}catch(e){}}}var Ia=s(44320),ka=s(79897);let Ta=class extends R.A{constructor(e){super(e),this.debugName="",this._updatingHandles=new ka.U,this._idToUpdatingState=new N.A}destroy(){this._updatingHandles=(0,_.pR)(this._updatingHandles),this._idToUpdatingState.clear()}get updating(){return!this.destroyed&&(this._updatingHandles?.updating||Array.from(this._idToUpdatingState.values()).some(e=>e))}addUpdateTracking(e,t){const s=(0,l.wB)(()=>t.updating,t=>this._idToUpdatingState.set(e,t),{sync:!0});this.addHandles(s)}consumePromise(e){this._updatingHandles.consumePromise(e)}addPromise(e){return this._updatingHandles.addPromise(e)}};(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],Ta.prototype,"debugName",void 0),(0,E.Cg)([(0,L.MZ)({readOnly:!0})],Ta.prototype,"updating",null),Ta=(0,E.Cg)([(0,xa.$)("esri.views.2d.layers.support.UpdateTracking2D")],Ta);class Aa{constructor(e,t,s,r){this._aggregateAdapter=e,this._subscriptions=t,this._connection=s,this._cachedObjectIds=r,this._updateTracking=new Ta({debugName:"FeatureSource"}),this.store=new Ia.I}destroy(){this._strategy?.destroy(),this._streamMessenger?.destroy(),this._updateTracking?.destroy(),this.store.destroy()}get metadata(){return this._strategy.metadata}get streamMessenger(){return null==this._streamMessenger&&this._initStreamMessenger(),this._streamMessenger}get statistics(){return _o.from(this.store)}get updateTracking(){return this._updateTracking}get usedMemory(){return this.store.usedMemory}get queryEngine(){if(!this._queryEngine){if(!this.store||!this._strategy)return null;this._queryEngine=new Qi.do({featureStore:this.store,fieldsIndex:this.metadata.fieldsIndex,geometryType:this.metadata.geometryType,featureIdInfo:this.metadata.featureIdInfo,hasZ:this.metadata.hasZ,hasM:this.metadata.hasM,spatialReference:this.metadata.outSpatialReference,aggregateAdapter:this._aggregateAdapter,timeInfo:this.metadata.timeInfo,definitionExpression:this._strategy?.definitionExpression,availableFields:this._strategy?.availableFields})}return this._queryEngine}get isStream(){return"stream"===this._schema.type}get hasQueryDisplayFilter(){if(!this._schema)return!1;switch(this._schema.type){case"feature":return null!=this._schema.strategy.full.displayFilterInfo;case"parquet":case"stream":return!1}}chunks(){return Array.from(this.store.chunks())}prepareCacheUpdate(e,t){const s=new Set,r=new Set;for(const t of e)this._cachedObjectIds.has(t)||(this._cachedObjectIds.add(t),s.add(t));for(const e of t)this._cachedObjectIds.delete(e),r.add(e);this.hasQueryDisplayFilter&&this._strategy.prepareCacheUpdate(s,r)}async applyCacheUpdate(){this.hasQueryDisplayFilter&&await this._updateTracking.addPromise(this._strategy.applyCacheUpdate())}cleanup(){return this.store.cleanup()}onSubscribe(e){if(this._connection.onEvent({type:"subscribe",tile:e.tile.id}),!this._strategy)return;const t=this._strategy.load(e);t.then(()=>this._connection.onEvent({type:"loaded",tile:e.tile.id})).catch(t=>this._connection.onEvent({type:"error",tile:e.tile.id,error:t})),this._updateTracking.consumePromise(t)}onResume(e){this._updateTracking.consumePromise((0,a.QZ)(this._strategy?.load(e)))}onUnsubscribe(e){this._connection.onEvent({type:"unsubscribe",tile:e.tile.id}),this._strategy?.unload(e)}async applyOverride(e){await(this._strategy?.applyOverride(e))}takeOverrideUpdate(){return this._strategy?.takeOverrideUpdate()}async update(e,t){const s=this._schema;if(this._schema=e,this._queryEngine=(0,_.pR)(this._queryEngine),s&&s.type!==e.type)throw new Error("InternalError: Reconfiguring source types is not supported.");const r=new yo;if(!s||(0,m.i8)(s.service,e.service)||s.strategy.type!==e.strategy.type||(0,m.i8)(e.strategy.full,s.strategy.full)||!await this._strategy.tryUpdate(r,e.strategy.partial)){await this._updateStrategyType(this._schema.service,e,t);let s=null;return"postQueryFilter"in this._schema.strategy.full&&this._schema.strategy.full.postQueryFilter&&(s=await Cn.create({geometryType:this.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:this.metadata.timeInfo,fieldsIndex:this.metadata.fieldsIndex,spatialReference:this.metadata.outSpatialReference,filterJSON:this._schema.strategy.full.postQueryFilter})),await this.store.update({metadata:this.metadata,definitionExpression:this._schema.strategy.full.definitionExpression,postQueryFilter:s}),!0}return r.requiresInvalidation}unsafeSetQueryHistoricMoment(e){"feature"===this._schema.type&&(this._schema.strategy.full.historicMoment=e,this._strategy.unsafeSetQueryHistoricMoment(new Date(e)))}_initStreamMessenger(){null==this._streamMessenger&&(this._streamMessenger=new mo(this._connection))}async normalizeOverrides(e){const t={historicMoment:e.historicMoment,commands:{updateWeak:e.commands.updateWeak.map(ji.Om.fromJSON),removeWeak:e.commands.removeWeak,update:e.commands.update.map(ji.Om.fromJSON),remove:e.commands.remove,release:e.commands.release}},s=e.commands.updateByIdWeak,r=await this._queryOptimizedFeatures(s);if(r.length!==s.length){const e=new Set(r.map(e=>e.objectId));for(const r of s)e.has(r)||t.commands.removeWeak.push(r)}return t.commands.updateWeak.push(...r),t}async _queryOptimizedFeatures(e){if(0===e.length)return[];const t=[],s=(await this._strategy.queryByObjectId(e,["*"])).getCursor();for(;s.next();)t.push(s.readOptimizedFeatureWorldSpace());return t}getObjectIdsFromGlobalIds(e){const t=this.metadata.globalIdField;if(null==t)throw new Error("InternalError: Recieved an edit with globalIds, but not supported by the service");const s=this.store.mapObjectIdsFromGlobalIds(e,t).values();return Array.from(s)}async _updateStrategyType(e,t,s){const r=this._createStrategy(e,t);this._connection.onEvent({type:"updateStrategyStart",about:r.about});const i=!!this._strategy;this.store.clear(),this._strategy?.destroy(),this._strategy=r,(0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${s}] FeatureSource.updateStrategy`,{strategy:r});const o=Array.from(this._subscriptions.values());if(!o.length)return void this._connection.onEvent({type:"updateStrategyEnd"});const c=Promise.all(o.map(e=>this._strategy.load(e).then(()=>this._connection.onEvent({type:"loaded",tile:e.tile.id})).catch(t=>this._connection.onEvent({type:"error",tile:e.tile.id,error:t}))));this._updateTracking.consumePromise(c),this._strategy.prepareCacheUpdate(this._cachedObjectIds);try{i&&await c}catch(e){(0,a.jH)(e)}this._connection.onEvent({type:"updateStrategyEnd"}),(0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${s}] FeatureSource.updateStrategyEnd`,{strategy:r})}_createStrategy(e,t){const s={connection:this._connection,store:this.store};switch(t.type){case"feature":return this._createFeatureLoadStrategy(e,t.strategy,s);case"parquet":return this._createParquetLoadStrategy(e,t.strategy,s);case"stream":return this._createStreamLoadStrategy(e,t.strategy,s)}}_createFeatureLoadStrategy(e,t,s){switch(t.type){case"drill-down":return new Ko(e,t,s);case"hybrid-tile":return new ra(e,t,s);case"paged-tile":return new na(e,t,s);case"snapshot":return new oa(e,t,s)}}_createParquetLoadStrategy(e,t,s){switch(t.type){case"xz":return new fa(e,t,s,this._connection);case"snapshot":return new ha(e,t,s,this._connection)}}_createStreamLoadStrategy(e,t,s){const r=new Sa(e,t,s);return this.streamMessenger.strategy=r,r}}class Ma{constructor(e,t){this.tile=e,this.version=t,this._abortController=new AbortController}get key(){return this.tile.key}get signal(){return this._abortController.signal}abort(){this._abortController.abort()}}var Fa=s(98291);class Ca{constructor(e,t){this.key=new w.A(0,0,0,0),this.bounds=(0,Y.vt)(),this.objectIds=new Set,this.key.set(t);const s=e.getLODInfoAt(this.key);this.tileInfoView=e,this.tileInfoView.getTileBounds(this.bounds,this.key,!0),this.resolution=s.resolution,this.level=s.level,this.scale=s.scale,this.minScale=e.zoomToScale(s.level-1),this.maxScale=e.zoomToScale(s.level+1)}get lod(){return this.tileInfoView.getLODInfoAt(this.key)}get id(){return this.key.id}get extent(){const[e,t,s,r]=this.bounds;return{xmin:e,ymin:t,xmax:s,ymax:r}}get hydratedExtent(){return(0,Y.w1)(this.bounds,this.tileInfoView.spatialReference)}get transform(){return{originPosition:"upperLeft",scale:[this.resolution,this.resolution],translate:[this.bounds[0],this.bounds[3]]}}get normalizedTransform(){return(0,g.Q1)(this.transform)}createArcadeEvaluationOptions(e){return(0,Bn.N)(this.scale,e)}createChildTiles(){const e=this.key.getChildKeys(),t=Fa.A.acquire();for(let s=0;s<e.length;s++)t[s]=new Ca(this.tileInfoView,e[s]);return t}getQuantizationParameters(){return Jo.A.fromJSON({mode:"view",originPosition:"upperLeft",tolerance:this.resolution,extent:{xmin:this.bounds[0],ymin:this.bounds[1],xmax:this.bounds[2],ymax:this.bounds[3],spatialReference:this.tileInfoView.spatialReference}})}}class Pa{constructor(e){this.inner=e,this.resolver=Promise.withResolvers()}}class Ea{constructor(){this._aggregateAdapter={getFeatureObjectIds:e=>this._processor.getFeatureObjectIdsForAggregate(e)},this._subscriptions=new Map,this._cachedObjectIds=new Set,this._updateRequested=!1,this._didSourceRefresh=!1,this._refreshRequested=!0,this._updateSubscriptionRequests=[],this._updateHighlightRequests=[]}destroy(){this._subscriptions.clear(),this._processor?.destroy(),this._source?.destroy(),this._handles?.remove(),this._updateOverridesRequest=null,this._tileInfoView=null}onAttach(e){(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.onAttach");const t=this._connection,s=d.A.fromJSON(e.tileInfoJSON);this._tileInfoView=new P(s),this._viewExtent=e.initialViewExtent,this._source=new Aa(this._aggregateAdapter,this._subscriptions,t,this._cachedObjectIds),this._processor=new po(t,this._source,e.requiredLevel,e.requiredScale),this._handles=(0,i.vE)([this._source.store.events.on("changed",()=>this._requestUpdate()),this._source.store.events.on("refresh",()=>this._requestRefresh()),(0,l.wB)(()=>this._source.updateTracking.updating,()=>{this._requestUpdate(),(0,a.QZ)(this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:!0}))})])}onDetach(){(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.onDetach"),this.destroy()}set remoteClient(e){this._connection=new f(e)}get features(){const e=this._source?.queryEngine;if(!e)throw new r.A("no-queryEngine","No query engine defined");return e}get aggregates(){const e=this._processor?.aggregateQueryEngine;if(!e)throw new r.A("no-queryEngine","No aggregate query engine defined");return e}get streamMessenger(){return this._source.streamMessenger}getUsedMemory(){return this._source.usedMemory+this._processor.usedMemory}getDisplayFeatures(e){return this._processor.getDisplayFeatures(e)}getDisplayIds(e){return this._processor.getDisplayIds(e)}getObjectIdsFromGlobalIds(e){return this._source.getObjectIdsFromGlobalIds(e)}updateStationaryExtent(e,t){t&&(this._refreshRequested=!0,this._requestUpdate()),this._viewExtent=e}updateRequiredLevel(e,t){this._processor.updateRequiredLevel(e,t),this._processor.hasClusters&&this._requestUpdate()}async updateSchema(e){return(0,n.A)("esri-2d-update-debug")&&this._updateSchemaRequest&&console.error("InternalError: Schema already updating"),this._updateSchemaRequest=new Pa({version:e}),this._requestUpdate(),this._updateSchemaRequest.resolver.promise}updateSubscriptions(e){const t=new Pa(e);return this._updateSubscriptionRequests.push(t),this._requestUpdate(),t.resolver.promise}updateHighlight(e){const t=new Pa(e);return this._updateHighlightRequests.push(t),this._requestUpdate(),t.resolver.promise}async onOverride(e){if(null!=this._updateOverridesRequest)throw new r.A("featurelayer","InternalError - Already processing an edit");this._updateOverridesRequest=new Pa(e);const t=this._updateOverridesRequest.resolver.promise;return this._requestUpdate(),t}queryStatistics(){return this._source.statistics.toJSON()}async queryVisibleFeatures(e,t){return this.features.executeQuery(e,t)}async queryHeatmapStatistics(e){const t=Math.round((0,u.Lz)(e.radius));let s=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;const i="string"==typeof e.fieldOffset,n=e.fieldOffset??0,o=Array.from(this._subscriptions.values()),a=this._source.chunks(),c=t**2,l=3/(Math.PI*c),h=2*t,d=Math.ceil(p.CQ/h);for(const t of o){const o=t.tile,u=new Float64Array(d*d);for(const t of a){const s=t.getTileReader(o);if(!s)continue;const r=s.getCursor();for(;r.next();){let t=1;if(null!=e.field){const s=r.readAttribute(e.field);t=i?-1*+s:+s+n}const s=r.readXForDisplay()/h,o=r.readYForDisplay()/h,a=Math.floor(s),p=Math.floor(o);if(a<0||p<0||a>=d||p>=d)continue;const f=((.5+a-s)*h)**2+((.5+p-o)*h)**2;if(f>c)continue;const _=t*(l*(1-f/c)**2);u[p+a*d]+=_}}for(let e=0;e<u.length;e++)s=Math.min(s,u[e]),r=Math.max(r,u[e])}return{max:r,min:s}}async getSampleFeatures(e){const t=this._source.chunks();if(t.reduce((e,t)=>e+t.size(),0)<=e.minFeatureCount){if(!this._source.updateTracking.updating){const e=[];return this._source.store.forEachUnsafe(t=>e.push(t.readLegacyFeatureWorldSpace())),e}return null}const s=new Set,r=[],i=t.map(e=>e.reader.getCursor()),n=new c.A,o=3*e.sampleSize;for(let a=0;a<o&&r.length<e.sampleSize;a++){const e=i[n.getIntRange(0,t.length-1)];if(0===e.getSize())continue;const o=n.getIntRange(0,e.getSize()-1);e.setIndex(o);const a=e.getObjectId();s.has(a)||(s.add(a),r.push(e.readLegacyFeatureWorldSpace()))}return r.length>=e.sampleSize?r:null}_requestUpdate(){this._updateRequested||(this._updateRequested=!0,(0,o.d)(()=>this._scheduleNextUpdate()))}_requestRefresh(){this._didSourceRefresh=!0,this._requestUpdate()}_scheduleNextUpdate(){this._updateRequested&&(this._ongoingUpdate||(this._ongoingUpdate=(0,h.oV)(this._doUpdate()).finally(()=>{this._ongoingUpdate=null,this._scheduleNextUpdate()}),this._updateRequested=!1))}_subscribe(e){const t=e.tileId;if(this._subscriptions.has(t))return;(0,n.A)("esri-2d-update-debug")&&console.debug(`Tile[${t}] Pipeline.subscribe`);const s=new Ca(this._tileInfoView,t),r=new Ma(s,e.version);this._subscriptions.set(t,r),this._source.onSubscribe(r),this._processor.onSubscribe(r)}_unsubscribe(e){const t=this._subscriptions.get(e);t&&((0,n.A)("esri-2d-update-debug")&&console.debug(`Tile[${e}] Pipeline.unsubscribe`),t.abort(),this._source.onUnsubscribe(t),this._processor.onUnsubscribe(t),this._subscriptions.delete(t.key.id))}async _doUpdate(){if((0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateStart"),await this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:!0}),this._updateSubscriptionRequests.length){const e=this._updateSubscriptionRequests;this._updateSubscriptionRequests=[];for(const t of e)this._doUpdateSubscriptions(t.inner),t.resolver.resolve()}if(this._updateHighlightRequests.length){const e=this._updateHighlightRequests,t=new Set,s=new Set;for(const r of e)for(const{objectId:e,highlightFlags:i}of r.inner.highlights)i?(t.add(e),s.delete(e)):(s.add(e),t.delete(e));this._source.prepareCacheUpdate(t,s)}const e=this._updateSchemaRequest;this._updateSchemaRequest=null;let t=!1;if(null!=e){const{version:s}=e.inner,r=await this._connection.layerView.updateSchemaStart();r&&(t=await this._doUpdateSchema(r,s))}const s=this._updateOverridesRequest;if(this._updateOverridesRequest=null,null!=s){(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.applyOverride",s.inner),null!=s.inner.historicMoment&&this._source.unsafeSetQueryHistoricMoment(s.inner.historicMoment);const e=await this._source.normalizeOverrides(s.inner);await this._source.applyOverride(e),(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.endOverride",s.inner)}await this._source.applyCacheUpdate();const r=this._source.chunks(),i=this._source.updateTracking.updating;if(this._processor.requiresInvalidation(r)&&(t=!0),this._didSourceRefresh&&(t=!0,this._didSourceRefresh=!1),this._refreshRequested&&(this._refreshRequested=!1,t=!0),t&&(this._processor.invalidate(),await this._connection.container.updateRenderState(this._processor.version)),this._updateHighlightRequests.length){const e=this._updateHighlightRequests;this._updateHighlightRequests=[];for(const t of e)this._processor.updateHighlight(t.inner),t.resolver.resolve()}const o=this._source.cleanup();this._processor.removeChunks(o);try{const e=this._source.takeOverrideUpdate();if(null!=e&&this._subscriptions.size){(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.applyOverrideChangesStart"),await this._connection.container.lockForOverrides();try{await this._processor.applyOverrideUpdate(e,this._viewExtent)}catch(e){(0,n.A)("esri-2d-update-debug")&&console.debug("InternalError",e)}await this._connection.container.unlockForOverrides(),(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.applyOverrideChangesEnd")}this._subscriptions.size&&((0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.updateChunksStart"),await this._processor.updateChunks(r,i,this._viewExtent),(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.updateChunksEnd"))}catch(e){(0,a.jH)(e)}e?await this._connection.layerView.updateSchemaEnd(t):t&&await this._connection.container.swapRenderState(),null!=s&&s.resolver.resolve(),null!=e&&e.resolver.resolve(),this._connection.onEvent({type:"performance",usedMemory:this.getUsedMemory()}),this._updateRequested?((0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateEnd [updateRequested=true]"),await this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:!0})):((0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateEnd [updateRequested=false, After flush]"),await this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:this._updateRequested}))}async _doUpdateSchema(e,t){(0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${t}] Pipeline.updateStart`,{schema:e});const s={tileInfo:this._tileInfoView?.tileInfo},r=await this._source.update(e.source,t),i=Array.from(this._subscriptions.values()),o=this._processor.update(e,t,s,r,i);return(0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${t}] Pipeline.updateEnd`),o}_doUpdateSubscriptions(e){(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.updateSubscriptions",e);for(const t of e.subscribe)this._subscribe(t);for(const t of e.unsubscribe)this._unsubscribe(t)}}},44159(e,t,s){s.d(t,{A:()=>i});var r=s(93687);class i{static{this.pool=new r.A(()=>new i(""),null,null,25,50)}static getId(e,t,s,r){return"object"==typeof e?`${e.level}/${e.row}/${e.col}/${e.world}`:`${e}/${t}/${s}/${r}`}constructor(e,t,s,r){this.set(e,t,s,r)}get key(){return this}get id(){return this.toString()}get normalizedId(){return`${this.level}/${this.row}/${this.col}`}set id(e){this.set(e)}get hash(){const e=4095&this.row,t=4095&this.col,s=63&this.level;return(3&this.world)<<30|t<<22|e<<8|s}acquire(e,t,s,r){this.set(e,t,s,r)}contains(e){const t=e.level-this.level;return t>=0&&this.row===e.row>>t&&this.col===e.col>>t&&this.world===e.world}containsChild(e){const t=e.level-this.level;return t>0&&this.row===e.row>>t&&this.col===e.col>>t&&this.world===e.world}equals(e){return this.level===e.level&&this.row===e.row&&this.col===e.col&&this.world===e.world}clone(){return new i(this)}release(){this.level=0,this.row=0,this.col=0,this.world=0}set(e,t,s,r){if(null==e)this.level=0,this.row=0,this.col=0,this.world=0;else if("object"==typeof e)this.level=e.level||0,this.row=e.row||0,this.col=e.col||0,this.world=e.world||0;else if("string"==typeof e){const[t,s,r,i]=e.split("/");this.level=parseFloat(t),this.row=parseFloat(s),this.col=parseFloat(r),this.world=parseFloat(i)}else this.level=+e,this.row=+t,this.col=+s,this.world=+r||0;return this}toString(){return`${this.level}/${this.row}/${this.col}/${this.world}`}getParentKey(){return this.level<=0?null:new i(this.level-1,this.row>>1,this.col>>1,this.world)}getNormalizedNeighbor(e,t,s){const r=this.clone();return r.col+=e,r.row+=t,s.normalizeKey(r),r}getChildKeys(){const e=this.level+1,t=this.row<<1,s=this.col<<1,r=this.world;return[new i(e,t,s,r),new i(e,t,s+1,r),new i(e,t+1,s,r),new i(e,t+1,s+1,r)]}compareRowMajor(e){return this.row<e.row?-1:this.row>e.row?1:this.col<e.col?-1:this.col>e.col?1:0}}}}]);