@arcgis/core 4.33.0-next.20250507 → 4.33.0-next.20250508

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 (156) hide show
  1. package/WebLinkChart.js +1 -1
  2. package/arcade/batchExec.js +5 -0
  3. package/arcade/functions/aiServices.js +1 -1
  4. package/arcade.js +1 -1
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/029a118e6dfb3f544a5c.js +1 -0
  7. package/assets/esri/core/workers/chunks/037af6379f3e9278633b.js +1 -0
  8. package/assets/esri/core/workers/chunks/0516bd18334d3af6c555.js +1 -0
  9. package/assets/esri/core/workers/chunks/094300acbd24085cb063.js +1 -0
  10. package/assets/esri/core/workers/chunks/0bbb38f59f37c51c72f0.js +1 -0
  11. package/assets/esri/core/workers/chunks/10e6dffa57aa1a626708.js +1 -0
  12. package/assets/esri/core/workers/chunks/1abd026ed12c863e1d94.js +1 -0
  13. package/assets/esri/core/workers/chunks/1eef9cf19634c038b59b.js +1 -0
  14. package/assets/esri/core/workers/chunks/{7cd32b10ed0e18e44ef2.js → 2b01e3bce78541620a86.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{cd81df932b87583b7e4c.js → 306e262f148b3057b11b.js} +1 -1
  16. package/assets/esri/core/workers/chunks/352b7dcd1633e0c98194.js +1 -0
  17. package/assets/esri/core/workers/chunks/35c996f6fbff165b03f4.js +1 -0
  18. package/assets/esri/core/workers/chunks/391b1c3e736a62befbaf.js +1 -0
  19. package/assets/esri/core/workers/chunks/{cbec01223d51cdb9ee79.js → 3c45603af279ad7fed8c.js} +1 -1
  20. package/assets/esri/core/workers/chunks/40e556a0645af8658658.js +1 -0
  21. package/assets/esri/core/workers/chunks/4402336db7210cd583e0.js +1 -0
  22. package/assets/esri/core/workers/chunks/46104db7f77952bb6c12.js +1 -0
  23. package/assets/esri/core/workers/chunks/{5383dc4814b0ba42e871.js → 47cd99ab3ed11a931084.js} +1 -1
  24. package/assets/esri/core/workers/chunks/47f64a340b5d56bf9e59.js +1 -0
  25. package/assets/esri/core/workers/chunks/49f0e53b3c9ba8451442.js +1 -0
  26. package/assets/esri/core/workers/chunks/515e3295495d0958db7e.js +1 -0
  27. package/assets/esri/core/workers/chunks/5ddf463c85c33428e807.js +1 -0
  28. package/assets/esri/core/workers/chunks/5e0118a030cf741f78c6.js +319 -0
  29. package/assets/esri/core/workers/chunks/{875a0e2d023094c8e15e.js → 66e79aa02b3aa12b3778.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{a5a43d54684747561aa9.js → 6b42bcfbb60432e3ed1f.js} +1 -1
  31. package/assets/esri/core/workers/chunks/6b5274d46a155d65dff1.js +39 -0
  32. package/assets/esri/core/workers/chunks/6e5d8a6b29c06a27998c.js +1 -0
  33. package/assets/esri/core/workers/chunks/6eabced7123a65d47292.js +1 -0
  34. package/assets/esri/core/workers/chunks/6f506303017903b9a06f.js +1 -0
  35. package/assets/esri/core/workers/chunks/6f6bf67a7960b7e9b03e.js +1 -0
  36. package/assets/esri/core/workers/chunks/{52a3d0e041717da7697e.js → 736cb9f74bf050b70f4c.js} +1 -1
  37. package/assets/esri/core/workers/chunks/74187c771ee7083d1db7.js +1 -0
  38. package/assets/esri/core/workers/chunks/{85d87cd1bf7eecd54100.js → 752ef63d910852b7be44.js} +1 -1
  39. package/assets/esri/core/workers/chunks/7c49a8877bd744daa3d5.js +1 -0
  40. package/assets/esri/core/workers/chunks/7ffc1db10b00754398e8.js +1 -0
  41. package/assets/esri/core/workers/chunks/81546c6141d564ed59c9.js +1 -0
  42. package/assets/esri/core/workers/chunks/83fcc6f770ad084b8ab9.js +1 -0
  43. package/assets/esri/core/workers/chunks/852dd5af8e704613310a.js +1 -0
  44. package/assets/esri/core/workers/chunks/85efb318cda7260221ae.js +1 -0
  45. package/assets/esri/core/workers/chunks/86138c297095af1ac604.js +1 -0
  46. package/assets/esri/core/workers/chunks/8b74b609de4f70e1a75c.js +1 -0
  47. package/assets/esri/core/workers/chunks/90f93091fe088875f80f.js +1 -0
  48. package/assets/esri/core/workers/chunks/91a02ee91f61cf841111.js +1 -0
  49. package/assets/esri/core/workers/chunks/9aedd7874da7c63865d6.js +1 -0
  50. package/assets/esri/core/workers/chunks/9ca480eb8b2312381ccf.js +1 -0
  51. package/assets/esri/core/workers/chunks/a0d2bd5d4ed3c90f6b1c.js +1 -0
  52. package/assets/esri/core/workers/chunks/a73c6b4bc5baf440f85a.js +1 -0
  53. package/assets/esri/core/workers/chunks/b5d68d8460b7c15001dd.js +1 -0
  54. package/assets/esri/core/workers/chunks/b816b608f31954128246.js +1 -0
  55. package/assets/esri/core/workers/chunks/bcab8b9ce2f9d2ebaae7.js +1 -0
  56. package/assets/esri/core/workers/chunks/bd7b54db7fd278b15500.js +1 -0
  57. package/assets/esri/core/workers/chunks/c1175477dfcdee90a453.js +1 -0
  58. package/assets/esri/core/workers/chunks/c17c269cc30e7e1d0bfb.js +1 -0
  59. package/assets/esri/core/workers/chunks/c2f925167a43f63289a7.js +1 -0
  60. package/assets/esri/core/workers/chunks/c9ab067b07d1eab974d1.js +1 -0
  61. package/assets/esri/core/workers/chunks/cb80b7ddc9acf625d754.js +1 -0
  62. package/assets/esri/core/workers/chunks/{812d8554144ef5a7cd4b.js → cd4fb107489594c57438.js} +1 -1
  63. package/assets/esri/core/workers/chunks/cd5c380196db7fb55242.js +1 -0
  64. package/assets/esri/core/workers/chunks/d874d24568b1acedebc4.js +1 -0
  65. package/assets/esri/core/workers/chunks/d9948763423784b68c09.js +1 -0
  66. package/assets/esri/core/workers/chunks/e662c86b8bafc5512d3d.js +1 -0
  67. package/assets/esri/core/workers/chunks/e697dd4508f02dcfe329.js +1 -0
  68. package/assets/esri/core/workers/chunks/ed6d0fea159dea638c2f.js +1 -0
  69. package/assets/esri/themes/base/widgets/_Daylight.scss +0 -4
  70. package/assets/esri/themes/base/widgets/_ShadowCast.scss +27 -28
  71. package/assets/esri/themes/dark/main.css +1 -1
  72. package/assets/esri/themes/light/main.css +1 -1
  73. package/assets/esri/themes/light/view.css +1 -1
  74. package/assets/esri/widgets/ShadowCast/t9n/ShadowCast.json +1 -1
  75. package/chunks/aiServices.js +1 -1
  76. package/interfaces.d.ts +50 -3
  77. package/layers/KnowledgeGraphLayer.js +1 -1
  78. package/layers/LinkChartLayer.js +1 -1
  79. package/layers/MapImageLayer.js +1 -1
  80. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  81. package/layers/mixins/SublayersOwner.js +1 -1
  82. package/layers/support/Sublayer.js +1 -1
  83. package/package.json +1 -1
  84. package/rest/print.js +1 -1
  85. package/rest/support/JobInfo.js +1 -1
  86. package/rest/support/TranslateContent.js +1 -1
  87. package/rest/support/TranslateParameters.js +1 -1
  88. package/rest/support/TranslateResult.js +1 -1
  89. package/support/loadArcade.js +1 -1
  90. package/support/revision.js +1 -1
  91. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js +1 -1
  92. package/views/2d/engine/webgl/shaderGraph/techniques/fill/AFillMeshWriter.js +1 -1
  93. package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js +1 -1
  94. package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js +1 -1
  95. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  96. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
  97. package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
  98. package/views/3d/state/controllers/InteractiveController.js +1 -1
  99. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  100. package/widgets/Daylight/DaylightViewModel.js +1 -1
  101. package/widgets/Daylight/css.js +1 -1
  102. package/widgets/Daylight.js +1 -1
  103. package/widgets/FeatureForm.js +1 -1
  104. package/widgets/ShadowCast/components/ThresholdConfigurator.js +1 -1
  105. package/widgets/ShadowCast/css.js +1 -1
  106. package/assets/esri/core/workers/chunks/00e49ed684cc167c4481.js +0 -1
  107. package/assets/esri/core/workers/chunks/02e1332e91393ee985e8.js +0 -1
  108. package/assets/esri/core/workers/chunks/0366d46c78aa3b4a0523.js +0 -1
  109. package/assets/esri/core/workers/chunks/076a205298026e926d70.js +0 -1
  110. package/assets/esri/core/workers/chunks/07adf428f5fdba5c7cdf.js +0 -1
  111. package/assets/esri/core/workers/chunks/1349d4ea29fbf41e22bc.js +0 -1
  112. package/assets/esri/core/workers/chunks/2934fd7ec0c07371c4fe.js +0 -1
  113. package/assets/esri/core/workers/chunks/2a72f272051721767ca1.js +0 -319
  114. package/assets/esri/core/workers/chunks/2a9f206c23f69045d3f2.js +0 -1
  115. package/assets/esri/core/workers/chunks/2ac2c9cb88a7d1249b56.js +0 -1
  116. package/assets/esri/core/workers/chunks/2ad47c0ba1680f7d5e03.js +0 -1
  117. package/assets/esri/core/workers/chunks/2b3aa568356f4b70afe8.js +0 -1
  118. package/assets/esri/core/workers/chunks/35002d23c5b9f37c6331.js +0 -1
  119. package/assets/esri/core/workers/chunks/35b138f6d0687c5bee4f.js +0 -1
  120. package/assets/esri/core/workers/chunks/4957450197305498d327.js +0 -1
  121. package/assets/esri/core/workers/chunks/4b63f36189730396721b.js +0 -1
  122. package/assets/esri/core/workers/chunks/55def679b9f1c7c4d4d3.js +0 -1
  123. package/assets/esri/core/workers/chunks/598fade09fa4da759ac2.js +0 -1
  124. package/assets/esri/core/workers/chunks/60f7cd05e88701f43d3f.js +0 -1
  125. package/assets/esri/core/workers/chunks/6118144588af9cd8e49b.js +0 -1
  126. package/assets/esri/core/workers/chunks/62c5030557595c9a7c37.js +0 -1
  127. package/assets/esri/core/workers/chunks/62d1e6e7d8685ffc152f.js +0 -1
  128. package/assets/esri/core/workers/chunks/687a11f49772bf5e1f5a.js +0 -1
  129. package/assets/esri/core/workers/chunks/6b554b42e16ad32b433d.js +0 -1
  130. package/assets/esri/core/workers/chunks/6fc39a58f3011291c602.js +0 -1
  131. package/assets/esri/core/workers/chunks/7978b66cdfe078960ddd.js +0 -1
  132. package/assets/esri/core/workers/chunks/7fa70851868f80eaccfc.js +0 -1
  133. package/assets/esri/core/workers/chunks/8d09cc782dae1dcfc6c4.js +0 -1
  134. package/assets/esri/core/workers/chunks/8ec0a762ec73d1f91fce.js +0 -1
  135. package/assets/esri/core/workers/chunks/919673d958045ab94c95.js +0 -1
  136. package/assets/esri/core/workers/chunks/9321e3244ccb1ee9985a.js +0 -1
  137. package/assets/esri/core/workers/chunks/97a4f8504e76c877893b.js +0 -1
  138. package/assets/esri/core/workers/chunks/9cac00d4bfac14aaae12.js +0 -1
  139. package/assets/esri/core/workers/chunks/a1278a1c4a913c671989.js +0 -1
  140. package/assets/esri/core/workers/chunks/a2452958b0ced28fc1e5.js +0 -1
  141. package/assets/esri/core/workers/chunks/aed72cbac8d463b1d2e0.js +0 -1
  142. package/assets/esri/core/workers/chunks/af44ba2ee6c7670ddcc1.js +0 -1
  143. package/assets/esri/core/workers/chunks/b2f1d1721a9dd88a1adf.js +0 -1
  144. package/assets/esri/core/workers/chunks/b52a738ca2b5c39f8e15.js +0 -1
  145. package/assets/esri/core/workers/chunks/b60504e6326464a512df.js +0 -1
  146. package/assets/esri/core/workers/chunks/b79e8d1e3f2c214549b7.js +0 -1
  147. package/assets/esri/core/workers/chunks/ba4aafa8dfa76006c3e7.js +0 -1
  148. package/assets/esri/core/workers/chunks/bbcc5c5ef7cb92c2e213.js +0 -39
  149. package/assets/esri/core/workers/chunks/bceb837623aa79fcfbed.js +0 -1
  150. package/assets/esri/core/workers/chunks/bfd39cd1d83291ba014b.js +0 -1
  151. package/assets/esri/core/workers/chunks/ca8c631172902c6623fa.js +0 -1
  152. package/assets/esri/core/workers/chunks/cf008faa999e8d07116f.js +0 -1
  153. package/assets/esri/core/workers/chunks/dcb9ab790e694328d02c.js +0 -1
  154. package/assets/esri/core/workers/chunks/e93222c65bd28203ddf7.js +0 -1
  155. package/assets/esri/core/workers/chunks/ea70cabea50960dc8167.js +0 -1
  156. package/assets/esri/core/workers/chunks/f07b3aecff90a6a400d8.js +0 -1
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[788,2470,3186,3515,4342,4697],{10407:(e,t,r)=>{r.d(t,{It:()=>p,LG:()=>a,OM:()=>u,Sm:()=>c,Y:()=>l,bK:()=>o,mm:()=>h,sQ:()=>d});var i=r(80586),s=r(16930),n=r(28735);function a(e,t){if(!l(e,t)){const r=e.typeKeywords;r?r.push(t):e.typeKeywords=[t]}}function l(e,t){return!!e.typeKeywords?.includes(t)}function o(e){return l(e,h.HOSTED_SERVICE)}function u(e,t){const r=e.typeKeywords;if(r){const e=r.indexOf(t);e>-1&&r.splice(e,1)}}function c(e,t,r){r?a(e,t):u(e,t)}async function d(e){const t=e.clone().normalize();let r;if(t.length>1)for(const e of t)r?e.width>r.width&&(r=e):r=e;else r=t[0];return async function(e){const t=e.spatialReference;if(t.isWGS84)return e.clone();if(t.isWebMercator)return(0,n.ci)(e);const r=s.A.WGS84;return await(0,i.initializeProjection)(t,r),(0,i.project)(e,r)}(r)}const h={CHARTS:"Charts",DYNAMIC:"Dynamic",DEVELOPER_BASEMAP:"DeveloperBasemap",GROUP_LAYER_MAP:"Map",HOSTED_SERVICE:"Hosted Service",JSAPI:"ArcGIS API for JavaScript",LOCAL_SCENE:"ViewingMode-Local",METADATA:"Metadata",MULTI_LAYER:"Multilayer",ORIENTED_IMAGERY_LAYER:"OrientedImageryLayer",SINGLE_LAYER:"Singlelayer",SUBTYPE_GROUP_LAYER:"SubtypeGroupLayer",SUBTYPE_GROUP_TABLE:"SubtypeGroupTable",TABLE:"Table",TILED_IMAGERY:"Tiled Imagery"};function p(e){const{portal:t,isOrgItem:r,itemControl:i}=e,s=t.user?.privileges;let n=!s||s.includes("features:user:edit"),a=!!r&&!!s?.includes("features:user:fullEdit");const l="update"===i||"admin"===i;return l?a=n=!0:a&&(n=!0),{features:{edit:n,fullEdit:a},content:{updateItem:l}}}},17311:(e,t,r)=>{r.d(t,{A:()=>d});var i=r(90237),s=r(69622),n=r(60999),a=r(5503),l=r(10107),o=(r(44208),r(53966),r(87811),r(40608)),u=r(30524),c=r(43668);let d=class extends s.A{constructor(e){super(e),this._featureUtils=null,this.effectivePopupTemplate=null}get _arcadeTask(){return this.expressionsUsedInTitle.length>0?this._get("_arcadeTask")||(0,n.UT)((()=>(0,c.l)())):null}get featureUtilsPromise(){return this._get("featureUtilsPromise")??r.e(9926).then(r.bind(r,29926)).then((e=>this._featureUtils=e))}get calculatedExpressions(){const e=new a.A;if(!this.expressionsUsedInTitle.length)return e;if(!this._arcadeTask?.value){for(const t of this.expressionsUsedInTitle??[])e.push({name:t.name,invalid:!0});return e}for(const t of this.expressionsUsedInTitle)try{const r=this._arcadeTask.value.arcade.parseScript(t.expression,["$layer","$map","$datastore"]);if(r.isAsync){e.push({name:t.name,invalid:!0});break}e.push({name:t.name,syntax:r,invalid:!1,func:this._arcadeTask.value.arcade.compileScript(r,{vars:{$feature:"any"}})})}catch{e.push({name:t.name,invalid:!0});break}return e}get expressionsUsedInTitle(){let e=this.effectivePopupTemplate?.title??"";return"string"!=typeof e?[]:(e=e.toLowerCase(),this.effectivePopupTemplate?.expressionInfos?.filter((t=>e.includes(`{expression/${t.name.toLowerCase()}}`)))??[])}get fieldInfoMap(){return this._featureUtils?this._createFieldInfoMap(this._featureUtils.getAllFieldInfos(this.effectivePopupTemplate)):null}get hasBadExpressions(){return this.calculatedExpressions.some((e=>!0===e.invalid))}get requiredFields(){const e=new Set;if(this._arcadeTask?.value&&!this.hasBadExpressions)for(const t of this.calculatedExpressions?.toArray()??[])try{const r=this._arcadeTask.value.arcade.extractFieldLiterals(t.syntax);for(const t of r){const r=t.split("."),i=this.fieldsIndex.get(r.at(-1)??"");i&&e.add(i.name)}}catch{}const t=this._extractFieldNames(this.workingTitle);for(const r of t){const t=this.fieldsIndex.get(r);t&&e.add(t.name)}return e}get titleFromDisplayField(){let e="";return this.displayField&&(e=this.fieldsIndex.get(this.displayField)?.name??""),e||(e=this.fieldsIndex.get(this.objectIdField)?.name??""),e?`{${e}}`:""}get workingTitle(){const e=this.effectivePopupTemplate?this.effectivePopupTemplate.title:"";return""===e||null==e||this.hasBadExpressions||"string"!=typeof e?this.titleFromDisplayField:e}async getTitle(e,t,r){try{const{attributes:i}=t,s=r?.timeZone??"system",[{substituteFieldsInLinksAndAttributes:n}]=await Promise.all([this.featureUtilsPromise,this._arcadeTask?.promise]);if(r.fetchMissingFields&&(t=await this._checkAndReQueryGraphic(e,t)),this.workingTitle&&this.fieldInfoMap){const r=this._createFormattedAttributes(e,t,s).global;return n({attributes:i,expressionAttributes:null,fieldInfoMap:this.fieldInfoMap,globalAttributes:r,layer:e,text:this.workingTitle})}return""}catch{}return""}async _checkAndReQueryGraphic(e,t){const r=t.getObjectId();if(null==r)return t;if(!(0,u.Kl)(this.requiredFields,t)){const t=e.createQuery();t.where="1=1",t.outFields=[...this.requiredFields],t.objectIds=[r];const i=await e.queryFeatures(t);if(1===i?.features.length)return i.features[0]}return t}_createFieldInfoMap(e){const t=new Map;if(!e)return t;for(const r of e){if(!r.fieldName)continue;const e=this.fieldsIndex.get(r.fieldName),i=e?.name??r.fieldName;r.fieldName=i,t.set(i.toLowerCase(),r)}return t}_createFormattedAttributes(e,t,r="system"){const i=this.effectivePopupTemplate?.fieldInfos??[],s={};if(!this._featureUtils)return{};if(!this.hasBadExpressions&&this.calculatedExpressions.length>0&&this._arcadeTask?.value){const r=this._arcadeTask.value.Feature.createFromGraphicLikeObject(t.geometry,t.attributes,e,null);for(const e of this.calculatedExpressions)try{s[`expression/${e.name}`]=e.func({vars:{$feature:r}})}catch{}}const n={...t.attributes,...s};return{global:this._featureUtils.formatAttributes({fieldInfos:i,attributes:n,graphic:t,timeZone:r,layer:e,fieldInfoMap:this.fieldInfoMap}),content:[]}}_extractFieldNames(e){return(0,u.nw)(e).filter((e=>!(0===e.indexOf("relationships/")||0===e.indexOf("expression/"))))}};(0,i._)([(0,l.MZ)({readOnly:!0})],d.prototype,"_arcadeTask",null),(0,i._)([(0,l.MZ)()],d.prototype,"_featureUtils",void 0),(0,i._)([(0,l.MZ)({readOnly:!0})],d.prototype,"featureUtilsPromise",null),(0,i._)([(0,l.MZ)({readOnly:!0})],d.prototype,"calculatedExpressions",null),(0,i._)([(0,l.MZ)()],d.prototype,"displayField",void 0),(0,i._)([(0,l.MZ)()],d.prototype,"effectivePopupTemplate",void 0),(0,i._)([(0,l.MZ)()],d.prototype,"expressionsUsedInTitle",null),(0,i._)([(0,l.MZ)()],d.prototype,"fieldsIndex",void 0),(0,i._)([(0,l.MZ)()],d.prototype,"fieldInfoMap",null),(0,i._)([(0,l.MZ)()],d.prototype,"fields",void 0),(0,i._)([(0,l.MZ)()],d.prototype,"objectIdField",void 0),(0,i._)([(0,l.MZ)()],d.prototype,"requiredFields",null),d=(0,i._)([(0,o.$)("esri.layers.support.TitleCreator")],d)},22671:(e,t,r)=>{r.d(t,{A:()=>m});var i,s=r(90237),n=r(52106),a=r(66552),l=r(25482),o=r(4718),u=r(10107),c=(r(44208),r(53966),r(36005)),d=r(40608),h=r(43937),p=r(16930),f=r(65864),y=r(50498),_=r(20437);const g=new a.J({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let m=i=class extends l.A{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){return this.readFeaturesWithClass(e,t,n.A)}writeGeometryType(e,t,r,i){if(e)return void g.write(e,t,r,i);const{features:s}=this;if(s)for(const e of s)if(null!=e?.geometry)return void g.write(e.geometry.type,t,r,i)}readQueryGeometry(e,t){if(!e)return null;const r=!!e.spatialReference,i=(0,f.rS)(e);return i&&!r&&t.spatialReference&&(i.spatialReference=p.A.fromJSON(t.spatialReference)),i}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:r}=this;if(r)for(const e of r)if(e&&null!=e.geometry&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new i(this.cloneProperties())}cloneProperties(){return(0,o.o8)({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let r=0;r<t.features.length;r++){const i=t.features[r];if(i.geometry){const t=e?.[r];i.geometry=t?.toJSON()||i.geometry}}return t}quantize(e){const{scale:[t,r],translate:[i,s]}=e,n=this.features,a=this._getQuantizationFunction(this.geometryType,(e=>Math.round((e-i)/t)),(e=>Math.round((s-e)/r)));for(let e=0,t=n.length;e<t;e++)a?.(n[e].geometry)||(n.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:r}=this;if(!r)return this;const{translate:[i,s],scale:[n,a]}=r;let l=null,o=null;if(this.hasZ&&null!=r?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=r;l=r=>r*t+e}if(this.hasM&&null!=r?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=r;o=r=>null==r?r:r*t+e}const u=this._getHydrationFunction(e,(e=>e*n+i),(e=>s-e*a),l,o);for(const{geometry:e}of t)null!=e&&u&&u(e);return this.transform=null,this}readFeaturesWithClass(e,t,r){const i=p.A.fromJSON(t.spatialReference),s=[];for(let t=0;t<e.length;t++){const n=e[t],a=r.fromJSON(n),l=n.geometry?.spatialReference;null==a.geometry||l||(a.geometry.spatialReference=i);const o=n.aggregateGeometries,u=a.aggregateGeometries;if(o&&null!=u)for(const e in u){const t=u[e],r=o[e],s=r?.spatialReference;null==t||s||(t.spatialReference=i)}s.push(a)}return s}_quantizePoints(e,t,r){let i,s;const n=[];for(let a=0,l=e.length;a<l;a++){const l=e[a];if(a>0){const e=t(l[0]),a=r(l[1]);e===i&&a===s||(n.push([e-i,a-s]),i=e,s=a)}else i=t(l[0]),s=r(l[1]),n.push([i,s])}return n.length>0?n:null}_getQuantizationFunction(e,t,r){return"point"===e?e=>(e.x=t(e.x),e.y=r(e.y),e):"polyline"===e||"polygon"===e?e=>{const i=(0,f.Bi)(e)?e.rings:e.paths,s=[];for(let e=0,n=i.length;e<n;e++){const n=i[e],a=this._quantizePoints(n,t,r);a&&s.push(a)}return s.length>0?((0,f.Bi)(e)?e.rings=s:e.paths=s,e):null}:"multipoint"===e?e=>{const i=this._quantizePoints(e.points,t,r);return i&&i.length>0?(e.points=i,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,r,i,s){return"point"===e?e=>{e.x=t(e.x),e.y=r(e.y),i&&(e.z=i(e.z))}:"polyline"===e||"polygon"===e?e=>{const n=(0,f.Bi)(e)?e.rings:e.paths;let a,l;for(let e=0,i=n.length;e<i;e++){const i=n[e];for(let e=0,s=i.length;e<s;e++){const s=i[e];e>0?(a+=s[0],l+=s[1]):(a=s[0],l=s[1]),s[0]=t(a),s[1]=r(l)}}if(i&&s)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=i(r[2]),r[3]=s(r[3])}}else if(i)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=i(r[2])}}else if(s)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=s(r[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=r(e.ymin),e.xmax=t(e.xmax),e.ymax=r(e.ymax),i&&null!=e.zmax&&null!=e.zmin&&(e.zmax=i(e.zmax),e.zmin=i(e.zmin)),s&&null!=e.mmax&&null!=e.mmin&&(e.mmax=s(e.mmax),e.mmin=s(e.mmin))}:"multipoint"===e?e=>{const n=e.points;let a,l;for(let e=0,i=n.length;e<i;e++){const i=n[e];e>0?(a+=i[0],l+=i[1]):(a=i[0],l=i[1]),i[0]=t(a),i[1]=r(l)}if(i&&s)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=i(t[2]),t[3]=s(t[3])}else if(i)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=i(t[2])}else if(s)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=s(t[2])}}:null}};(0,s._)([(0,u.MZ)({type:String,json:{write:!0}})],m.prototype,"displayFieldName",void 0),(0,s._)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"exceededTransferLimit",void 0),(0,s._)([(0,u.MZ)({type:[n.A],json:{write:!0}})],m.prototype,"features",void 0),(0,s._)([(0,c.w)("features")],m.prototype,"readFeatures",null),(0,s._)([(0,u.MZ)({type:[_.A],json:{write:!0}})],m.prototype,"fields",void 0),(0,s._)([(0,u.MZ)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:g.read}}})],m.prototype,"geometryType",void 0),(0,s._)([(0,h.K)("geometryType")],m.prototype,"writeGeometryType",null),(0,s._)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasM",void 0),(0,s._)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasZ",void 0),(0,s._)([(0,u.MZ)({types:y.yR,json:{write:!0}})],m.prototype,"queryGeometry",void 0),(0,s._)([(0,c.w)("queryGeometry")],m.prototype,"readQueryGeometry",null),(0,s._)([(0,u.MZ)({type:p.A,json:{write:!0}})],m.prototype,"spatialReference",void 0),(0,s._)([(0,h.K)("spatialReference")],m.prototype,"writeSpatialReference",null),(0,s._)([(0,u.MZ)({json:{write:!0}})],m.prototype,"transform",void 0),m=i=(0,s._)([(0,d.$)("esri.rest.support.FeatureSet")],m),m.prototype.toJSON.isDefaultToJSON=!0},30235:(e,t,r)=>{r.d(t,{A:()=>f});var i=r(52106),s=r(87449),n=r(11221),a=r(89169),l=r(33325),o=r(80609),u=r(39516),c=r(91075),d=r(13600),h=r(33143),p=r(20437);class f extends n.A{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerMemory",this._removeGeometry=!1,this._overrideFields=null,this._forceIsTable=!1,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,!0===e.isTable&&(this._forceIsTable=!0),void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return l.gO}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}get gdbVersion(){return""}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType??"",this.fields=this._layer.fields.slice(),null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const r of this.fields)if("oid"===r.type||this._layer.objectIdField===r.name)e.push(r),t.push(r.name);else for(const i of this._overrideFields)if(i.toLowerCase()===r.name.toLowerCase()){e.push(r),t.push(r.name);break}this.fields=e,this._overrideFields=t}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this._databaseType=l.zl.Standardised,this.hasZ=!0===this._layer?.capabilities?.data?.supportsZ,this.hasM=!0===this._layer?.capabilities?.data?.supportsM,this.subtypeField=("subtypeField"in this._layer?this._layer.subtypeField:null)??"",this.subtypes="subtypes"in this._layer?this._layer.subtypes:null,this.typeIdField=("typeIdField"in this._layer?this._layer.typeIdField:null)??"",this.types="types"in this._layer?this._layer.types:null}isTable(){return this._forceIsTable||"isTable"in this._layer&&this._layer.isTable||"table"===this._layer.type||!this._layer.geometryType}_isInFeatureSet(){return l.J6.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_createQuery(){const e=this._layer.createQuery();return e.returnZ=this.hasZ,e.returnM=this.hasM,e.outFields=this._overrideFields??["*"],e.returnGeometry=!this._removeGeometry,e}_changeFeature(e){const t={};for(const r of this.fields)t[r.name]=e.attributes[r.name];return new i.A({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,r,i,s){let n="",c=!1;if(null!==i&&(n=i.constructClause(),c=!0),this.isTable()&&t&&null!==e&&""!==e)return new a.A([],[],!0,null);const d=this._createQuery();d.where=(0,u.mA)(d.where,null===r?null===t?"1=1":"":(0,o.YY)(r,l.zl.Standardised)),d.spatialRelationship=this._makeRelationshipEnum(e),d.outSpatialReference=this.spatialReference,d.orderByFields=""!==n?n.split(","):null,d.geometry=null===t?null:t,d.relationParameter=this._makeRelationshipParam(e);const h=await this._layer.queryFeatures(d);if(null===h)return new a.A([],[],c,null);this._checkCancelled(s);const p=[];return h.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];p.push(t),this._featureCache[t]=this._changeFeature(e)})),new a.A([],p,c,null)}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _queryAllFeatures(){if(this._wset)return this._wset;if(await this._ensureLoaded(),this._layer.source&&this._layer.source.items){const e=[];return this._layer.source.items.forEach((t=>{const r=t.attributes[this._layer.objectIdField];e.push(r),this._featureCache[r]=this._changeFeature(t)})),this._wset=new a.A([],e,!1,null),this._wset}const e=this._createQuery();e.where="1=1";const t=await this._layer.queryFeatures(e),r=[];return t.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];r.push(t),this._featureCache[t]=this._changeFeature(e)})),this._wset=new a.A([],r,!1,null),this._wset}async _getFeatures(e,t,r){const i=[];-1!==t&&void 0===this._featureCache[t]&&i.push(t);for(let s=e._lastFetchedIndex;s<e._known.length&&(e._lastFetchedIndex+=1,!(void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&i.push(e._known[s]),i.length>r)));s++);if(0===i.length)return"success";throw new s.dr(s.D_.MissingFeatures)}async _refineSetBlock(e){return e}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}relationshipMetaData(){return[]}static _cloneAttr(e){const t={};for(const r in e)t[r]=e[r];return t}nativeCapabilities(){return{title:this._layer.title??"",canQueryRelated:!1,source:this,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:!0}}static create(e,t){let r=e.layerDefinition.objectIdField;const i=e.layerDefinition.typeIdField??"",s=[];if(e.layerDefinition.types)for(const t of e.layerDefinition.types)s.push(h.A.fromJSON(t));let n=e.layerDefinition.geometryType;void 0===n&&(n=e.featureSet.geometryType||"");let a=e.featureSet.features;const l=t.toJSON();if(!r){let t=!1;for(const i of e.layerDefinition.fields)if("oid"===i.type||"esriFieldTypeOID"===i.type){r=i.name,t=!0;break}if(!1===t){let t="FID",i=!0,s=0;for(;i;){let r=!0;for(const i of e.layerDefinition.fields)if(i.name===t){r=!1;break}!0===r?i=!1:(s++,t="FID"+s.toString())}e.layerDefinition.fields.push({type:"esriFieldTypeOID",name:t,alias:t});const n=[];for(let r=0;r<a.length;r++)n.push({geometry:e.featureSet.features[r].geometry,attributes:e.featureSet.features[r].attributes?this._cloneAttr(e.featureSet.features[r].attributes):{}}),n[r].attributes[t]=r;a=n,r=t}}const o=[];for(const t of e.layerDefinition.fields)t instanceof p.A?o.push(t):o.push(p.A.fromJSON(t));let u=n;switch(u||(u=""),u){case"esriGeometryPoint":u="point";break;case"esriGeometryPolyline":u="polyline";break;case"esriGeometryPolygon":u="polygon";break;case"esriGeometryEnvelope":u="extent";break;case"esriGeometryMultipoint":u="multipoint";break;case"":case"esriGeometryNull":u="esriGeometryNull"}if("esriGeometryNull"!==u)for(const e of a)e.geometry&&e.geometry instanceof c.A==0&&(e.geometry.type=u,void 0===e.geometry.spatialReference&&(e.geometry.spatialReference=l));else for(const e of a)e.geometry&&(e.geometry=null);const y={outFields:["*"],source:a,fields:o,hasZ:!0===e?.layerDefinition?.hasZ||!0===e?.featureSet?.hasZ,hasM:!0===e?.layerDefinition?.hasM||!0===e?.featureSet?.hasM,types:s,typeIdField:i,objectIdField:r,spatialReference:t},_="esriGeometryNull"===u||null===u;_||(y.geometryType=u);const g=new d.default(y);return e?.layerDefinition?.subtypeField&&e?.layerDefinition?.subtypes&&g.read({subtypes:e.layerDefinition.subtypes,subtypeField:e.layerDefinition.subtypeField}),new f({layer:g,spatialReference:t,isTable:_})}async queryAttachments(){return[]}async getFeatureByObjectId(e){const t=this._createQuery();t.where=this.objectIdField+"="+e.toString();const r=await this._layer.queryFeatures(t);return 1===r.features.length?r.features[0]:null}async getOwningSystemUrl(){return""}async getIdentityUser(){return""}get preferredTimeZone(){return"preferredTimeZone"in this._layer?this._layer.preferredTimeZone:null}get dateFieldsTimeZone(){return"dateFieldsTimeZone"in this._layer?this._layer.dateFieldsTimeZone:null}get datesInUnknownTimezone(){return"datesInUnknownTimezone"in this._layer&&this._layer.datesInUnknownTimezone}get editFieldsInfo(){return"editFieldsInfo"in this._layer?this._layer.editFieldsInfo:null}get timeInfo(){return this._layer?.timeInfo}async getFeatureSetInfo(){const e=this._layer.title&&this._layer.parent;return this.fsetInfo??{layerId:null,layerName:null,itemId:null,serviceLayerUrl:null,webMapLayerId:e?this._layer.id??null:null,webMapLayerTitle:e?this._layer.title??null:null,className:null,objectClassId:null}}}},32730:(e,t,r)=>{r.d(t,{BI:()=>_,D3:()=>f,XJ:()=>y,lc:()=>p,mX:()=>m,rU:()=>g,tH:()=>I});var i=r(799);const s="__begin__",n="__end__",a=new RegExp(s,"ig"),l=new RegExp(n,"ig"),o=new RegExp("^"+s,"i"),u=new RegExp(n+"$","i"),c='"',d=c+" + ",h=" + "+c;function p(e){return e.replaceAll(new RegExp("\\[","g"),"{").replaceAll(new RegExp("\\]","g"),"}")}function f(e){return e.replaceAll(new RegExp("\\{","g"),"[").replaceAll(new RegExp("\\}","g"),"]")}function y(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=p(e.labelExpression),t.type="conventional"),t}function _(e){const t=y(e);if(!t)return null;switch(t.type){case"conventional":return m(t.expression);case"arcade":return t.expression}return null}function g(e){const t=y(e);if(!t)return null;switch(t.type){case"conventional":return function(e){const t=e?.match(w);return t?.[1].trim()||null}(t.expression);case"arcade":return I(t.expression)}return null}function m(e){let t;return e?(t=(0,i.HC)(e,(e=>s+'$feature["'+e+'"]'+n)),t=o.test(t)?t.replace(o,""):c+t,t=u.test(t)?t.replace(u,""):t+c,t=t.replaceAll(a,d).replaceAll(l,h)):t='""',t}const w=/^\s*\{([^}]+)\}\s*$/i,F=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*$/i,b=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(\1|\3)(\5)\s*\));?\s*$/i,S=/^\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(.+)(\1)\s*\));?\s*$/i;function I(e){if(!e)return null;let t=F.exec(e)||b.exec(e);return t?t[1]||t[3]:(t=S.exec(e),t?t[2]:null)}},32756:(e,t,r)=>{r.d(t,{Rr:()=>o,fY:()=>c,ne:()=>u});var i=r(90237),s=r(93637),n=r(10107),a=(r(44208),r(53966),r(87811),r(40608)),l=r(91880);function o(e,t,r){if(!e)return null;const i=e.find((e=>!!e.field));if(!i)return null;const s=new l.A;return s.read(i,r),[s]}const u={type:[l.A],json:{origins:{"web-scene":{write:!1,read:!1}},name:"layerDefinition.orderBy",read:{reader:o},write:{writer:function(e,t,r,i){const n=e.find((e=>!!e.field));n&&(0,s.sM)(r,[n.toJSON()],t)}}}},c=e=>{let t=class extends e{constructor(){super(...arguments),this.orderBy=null}};return(0,i._)([(0,n.MZ)(u)],t.prototype,"orderBy",void 0),t=(0,i._)([(0,a.$)("esri.layers.mixins.OrderedLayer")],t),t}},33143:(e,t,r)=>{r.d(t,{A:()=>h});var i=r(90237),s=r(69540),n=r(25482),a=r(10107),l=(r(44208),r(53966),r(87811),r(36005)),o=r(40608),u=r(43937),c=r(80451),d=r(29005);let h=class extends(s.A.ClonableMixin(n.A)){constructor(e){super(e),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(e){const t={};for(const r of Object.keys(e))t[r]=(0,c.rS)(e[r]);return t}writeDomains(e,t){const r={};for(const t of Object.keys(e))e[t]&&(r[t]=e[t]?.toJSON());t.domains=r}};(0,i._)([(0,a.MZ)({json:{write:!0}})],h.prototype,"id",void 0),(0,i._)([(0,a.MZ)({json:{write:!0}})],h.prototype,"name",void 0),(0,i._)([(0,a.MZ)({json:{write:!0}})],h.prototype,"domains",void 0),(0,i._)([(0,l.w)("domains")],h.prototype,"readDomains",null),(0,i._)([(0,u.K)("domains")],h.prototype,"writeDomains",null),(0,i._)([(0,a.MZ)({type:[d.A],json:{write:!0}})],h.prototype,"templates",void 0),h=(0,i._)([(0,o.$)("esri.layers.support.FeatureType")],h)},35704:(e,t,r)=>{r.d(t,{A:()=>d});var i=r(87449),s=r(11221),n=r(89169),a=r(33325),l=r(80609),o=r(74887),u=r(88368),c=r(16930);class d extends s.A{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.actions.AttributeFilter",this._maxProcessing=1e3,this._parent=e.parentfeatureset,e.whereclause instanceof u.A?(this._whereclause=e.whereclause,this._whereClauseFunction=null):(this._whereClauseFunction=e.whereclause,this._whereclause=null)}_initialiseFeatureSet(){null!==this._parent?(this.fields=this._parent.fields.slice(),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types,this.subtypeField=this._parent.subtypeField,this.subtypes=this._parent.subtypes):(this.fields=[],this.typeIdField="",this.subtypeField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new c.A({wkid:4326}),this.geometryType=a.ik.point)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._parent._getFilteredSet("",null,this._whereclause,null,e);return this._checkCancelled(e),null!==this._whereClauseFunction?this._wset=new n.A(t._candidates.slice().concat(t._known.slice()),[],t._ordered,this._clonePageDefinition(t.pagesDefinition)):this._wset=new n.A(t._candidates.slice(),t._known.slice(),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){let t=this._parent?._isInFeatureSet(e);return t===a.J6.NotInFeatureSet?t:(t=this._idstates[e],void 0===t?a.J6.Unknown:t)}_getFeature(e,t,r){return this._parent._getFeature(e,t,r)}_getFeatures(e,t,r,i){return this._parent._getFeatures(e,t,r,i)}_featureFromCache(e){return this._parent._featureFromCache(e)}executeWhereClause(e){return this._whereclause?.testFeature(e)??!1}async executeWhereClauseDeferred(e){if(null!==this._whereClauseFunction){const t=this._whereClauseFunction(e);return(0,o.$X)(t),t}return this.executeWhereClause(e)}async _fetchAndRefineFeatures(e,t,r){const i=new n.A([],e,!1,null),s=Math.min(t,e.length);if(await(this._parent?._getFeatures(i,-1,s,r)),this._checkCancelled(r),null==this._whereClauseFunction){for(let t=0;t<s;t++){const r=this._parent?._featureFromCache(e[t]);!0===this.executeWhereClause(r)?this._idstates[e[t]]=a.J6.InFeatureSet:this._idstates[e[t]]=a.J6.NotInFeatureSet}return"success"}const l=[];for(let t=0;t<s;t++){const r=this._parent?._featureFromCache(e[t]);l.push(await this.executeWhereClauseDeferred(r))}for(let r=0;r<t;r++)!0===l[r]?this._idstates[e[r]]=a.J6.InFeatureSet:this._idstates[e[r]]=a.J6.NotInFeatureSet;return"success"}async _getFilteredSet(e,t,r,i,s){null!==this._whereClauseFunction||(null!==r?null!==this._whereclause&&(r=(0,l.kg)(this._whereclause,r)):r=this._whereclause),await this._ensureLoaded();const a=await this._parent._getFilteredSet(e,t,r,i,s);let o;return this._checkCancelled(s),o=null!==this._whereClauseFunction?new n.A(a._candidates.slice().concat(a._known.slice()),[],a._ordered,this._clonePageDefinition(a.pagesDefinition)):new n.A(a._candidates.slice(),a._known.slice(),a._ordered,this._clonePageDefinition(a.pagesDefinition)),o}async _stat(e,t,r,i,s,n,a){if(null!==this._whereClauseFunction)return null===s&&""===r&&null===i?this._manualStat(e,t,n,a):{calculated:!1};let o=this._whereclause;null!==s&&null!==this._whereclause&&(o=(0,l.kg)(this._whereclause,s));const u=await this._parent._stat(e,t,r,i,o,n,a);return!1===u.calculated?null===s&&""===r&&null===i?this._manualStat(e,t,n,a):{calculated:!1}:u}async _canDoAggregates(e,t,r,i,s){return null===this._whereClauseFunction&&(null!==s?null!==this._whereclause&&(s=(0,l.kg)(this._whereclause,s)):s=this._whereclause,null!==this._parent&&this._parent._canDoAggregates(e,t,r,i,s))}async _getAggregatePagesDataSourceDefinition(e,t,r,s,n,a,o){if(null===this._parent)throw new i.dr(i.D_.NeverReach);return null!==n?null!==this._whereclause&&(n=(0,l.kg)(this._whereclause,n)):n=this._whereclause,this._parent._getAggregatePagesDataSourceDefinition(e,t,r,s,n,a,o)}static registerAction(){s.A._featuresetFunctions.filter=function(e){if("function"==typeof e)return new d({parentfeatureset:this,whereclause:e});let t=null;return e instanceof u.A&&(t=e),new d({parentfeatureset:this,whereclause:t})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},36708:(e,t,r)=>{r.d(t,{C_:()=>h,OH:()=>y,Vh:()=>_,on:()=>d,pc:()=>g,wB:()=>o,z7:()=>u});var i=r(37955),s=r(36563),n=r(97768),a=r(74887),l=r(14012);function o(e,t,r={}){return c(e,t,r,p)}function u(e,t,r={}){return c(e,t,r,f)}function c(e,t,r={},i){let s=null;const a=r.once?(e,r)=>{i(e)&&((0,n.xt)(s),t(e,r))}:(e,r)=>{i(e)&&t(e,r)};if(s=(0,l.Cn)(e,a,r.sync,r.equals),r.initial){const t=e();a(t,t)}return s}function d(e,t,r,a={}){let l=null,u=null,c=null;function d(){l&&u&&(u.remove(),a.onListenerRemove?.(l),l=null,u=null)}function h(e){a.once&&a.once&&(0,n.xt)(c),r(e)}const p=o(e,((e,r)=>{d(),(0,i.wb)(e)&&(l=e,u=(0,i.on)(e,t,h),a.onListenerAdd?.(e))}),{sync:a.sync,initial:!0});return c=(0,s.hA)((()=>{p.remove(),d()})),c}function h(e,t){return function(e,t,r){if((0,a.G4)(r))return Promise.reject((0,a.NK)());const i=e();if(t?.(i))return Promise.resolve(i);let l=null;function o(){l=(0,n.xt)(l)}return new Promise(((i,n)=>{l=(0,s.vE)([(0,a.u7)(r,(()=>{o(),n((0,a.NK)())})),c(e,(e=>{o(),i(e)}),{sync:!1,once:!0},t??p)])}))}(e,f,t)}function p(e){return!0}function f(e){return!!e}r(80559);const y={sync:!0},_={initial:!0},g={sync:!0,initial:!0}},39516:(e,t,r)=>{let i;async function s(){return null==i&&(i=Promise.all([r.e(8368),r.e(4123)]).then(r.bind(r,44123)).then((e=>new e.WhereClauseCache(500,500)))),i}async function n(e,t){const r=await s(),i=r.get(e,t);if(null==i)throw r.getError(e,t);return i}function a(e,t){return e||=null,t||=null,"1=1"===e?t??e:"1=1"===t?e??t:e&&t?`(${e}) AND (${t})`:e??t}function l(e,t){return e||=null,t||=null,"1=1"===e||"1=1"===t||e===t?"1=1"===e?e:t:e&&t?`(${e}) OR (${t})`:e??t}r.d(t,{GP:()=>n,IW:()=>l,mA:()=>a})},40334:(e,t,r)=>{r.r(t),r.d(t,{constructAssociationMetaDataFeatureSetFromUrl:()=>te,constructFeatureSet:()=>X,constructFeatureSetFromPortalItem:()=>oe,constructFeatureSetFromRelationship:()=>re,constructFeatureSetFromUrl:()=>H,convertToFeatureSet:()=>le,createFeatureSetCollectionFromMap:()=>ne,createFeatureSetCollectionFromService:()=>ae,initialiseMetaDataCache:()=>Y});var i=r(78888);class s{constructor(){this.declaredRootClass="esri.arcade.featureSetCollection",this._layerById={},this._layerByName={}}add(e,t,r){this._layerById[t]=r,this._layerByName[e]=r}async featureSetByName(e,t=!0,r=["*"]){return void 0===this._layerByName[e]?null:this._layerByName[e]}async featureSetById(e,t=!0,r=["*"]){return void 0===this._layerById[e]?null:this._layerById[e]}castToText(e=!1){return"object, FeatureSetCollection"}}var n=r(78878),a=r(35704),l=r(52106),o=r(68423),u=r(86691),c=r(87449),d=r(11221),h=r(89169),p=r(87594),f=r(33325),y=r(80609),_=r(1262),g=r(88368);class m{constructor(){this.field="",this.tofieldname="",this.typeofstat="MIN",this.workingexpr=null}clone(){const e=new m;return e.field=this.field,e.tofieldname=this.tofieldname,e.typeofstat=this.typeofstat,e.workingexpr=this.workingexpr,e}static parseStatField(e,t,r,i){const s=new m;s.field=e;const n=g.A.create(t,{fieldsIndex:r,timeZone:i}),a=function(e){if("function"===e.parseTree.type){if(0===e.parseTree.args.value.length)return{name:e.parseTree.name,expr:null};if(e.parseTree.args.value.length>1)throw new _.L8(_.Z7.MissingStatisticParameters);const t=g.A.create((0,y.Mi)(e.parseTree.args.value[0],f.zl.Standardised,e.parameters),{fieldsIndex:e.fieldsIndex,timeZone:e.timeZone,currentUser:e.currentUser});return{name:e.parseTree.name,expr:t}}return null}(n);if(null===a)throw new _.L8(_.Z7.UnsupportedSqlFunction,{function:""});const l=a.name.toUpperCase().trim();if("MIN"===l){if(s.typeofstat="MIN",s.workingexpr=a.expr,null===n)throw new _.L8(_.Z7.InvalidFunctionParameters,{function:"min"})}else if("MAX"===l){if(s.typeofstat="MAX",s.workingexpr=a.expr,null===n)throw new _.L8(_.Z7.InvalidFunctionParameters,{function:"max"})}else if("COUNT"===l)s.typeofstat="COUNT",s.workingexpr=a.expr;else if("STDEV"===l){if(s.typeofstat="STDDEV",s.workingexpr=a.expr,null===n)throw new _.L8(_.Z7.InvalidFunctionParameters,{function:"stdev"})}else if("SUM"===l){if(s.typeofstat="SUM",s.workingexpr=a.expr,null===n)throw new _.L8(_.Z7.InvalidFunctionParameters,{function:"sum"})}else if("MEAN"===l){if(s.typeofstat="AVG",s.workingexpr=a.expr,null===n)throw new _.L8(_.Z7.InvalidFunctionParameters,{function:l})}else if("AVG"===l){if(s.typeofstat="AVG",s.workingexpr=a.expr,null===n)throw new _.L8(_.Z7.InvalidFunctionParameters,{function:"avg"})}else{if("VAR"!==l)throw new _.L8(_.Z7.UnsupportedSqlFunction,{function:l});if(s.typeofstat="VAR",s.workingexpr=a.expr,null===n)throw new _.L8(_.Z7.InvalidFunctionParameters,{function:"var"})}return s}toStatisticsName(){switch(this.typeofstat.toUpperCase()){case"MIN":return"min";case"MAX":return"max";case"SUM":return"sum";case"COUNT":default:return"count";case"VAR":return"var";case"STDDEV":return"stddev";case"AVG":return"avg"}}}var w=r(80200),F=r(74639),b=r(44729),S=r(55612),I=r(15032),v=r(16930),A=r(20437),T=r(95466);function x(e){if(!e)return"COUNT";switch(e.toLowerCase()){case"max":return"MAX";case"var":case"variance":return"VAR";case"avg":case"average":case"mean":return"AVG";case"min":return"MIN";case"sum":return"SUM";case"stdev":case"stddev":return"STDDEV";case"count":return"COUNT"}return"COUNT"}class C extends d.A{constructor(e){super(e),this._decodedStatsfield=[],this._decodedGroupbyfield=[],this._candosimplegroupby=!0,this.phsyicalgroupbyfields=[],this.objectIdField="ROW__ID",this._internalObjectIdField="ROW__ID",this._adaptedFields=[],this.declaredClass="esri.arcade.featureset.actions.Aggregate",this._uniqueIds=1,this._maxQuery=10,this._maxProcessing=10,this._parent=e.parentfeatureset,this._config=e}isTable(){return!0}async _getSet(e){if(null===this._wset){const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,this._wset}return this._wset}_isInFeatureSet(){return f.J6.InFeatureSet}_nextUniqueName(e){for(;1===e["T"+this._uniqueIds.toString()];)this._uniqueIds++;const t="T"+this._uniqueIds.toString();return e[t]=1,t}_convertToEsriFieldType(e){return e}_initialiseFeatureSet(){const e={};let t=!1,r=1;const i=this._parent?this._parent.getFieldsIndex():new T.A([]);for(this.objectIdField="ROW__ID",this.globalIdField="";!1===t;){let e=!1;for(let t=0;t<this._config.groupbyfields.length;t++)if(this._config.groupbyfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}if(!1===e)for(let t=0;t<this._config.statsfields.length;t++)if(this._config.statsfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}!1===e?t=!0:(this.objectIdField="ROW__ID"+r.toString(),r++)}for(const e of this._config.statsfields){const t=new m;t.field=e.name,t.tofieldname=e.name,t.workingexpr=e.expression instanceof g.A?e.expression:g.A.create(e.expression,{fieldsIndex:i,timeZone:this.dateFieldsTimeZoneDefaultUTC}),t.typeofstat=x(e.statistic),this._decodedStatsfield.push(t)}this._decodedGroupbyfield=[];for(const e of this._config.groupbyfields){const t={name:e.name,singlefield:null,tofieldname:e.name,expression:e.expression instanceof g.A?e.expression:g.A.create(e.expression,{fieldsIndex:i,timeZone:this.dateFieldsTimeZoneDefaultUTC}),sqlType:null};this._decodedGroupbyfield.push(t)}if(null!==this._parent){this.geometryType=this._parent.geometryType,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField="";for(const t of this._parent.fields)e[t.name.toUpperCase()]=1;this.types=null,this.subtypes=null,this.subtypeField=""}else this.geometryType=f.ik.point,this.typeIdField="",this.types=null,this.subtypes=null,this.subtypeField="",this.spatialReference=new v.A({wkid:4326});this.fields=[];const s=new m;s.field=this._nextUniqueName(e),s.tofieldname=this.objectIdField,s.workingexpr=g.A.create(this._parent.objectIdField,{fieldsIndex:this._parent.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC}),s.typeofstat="MIN",this._decodedStatsfield.push(s);for(const t of this._decodedGroupbyfield){const r=new A.A;if(t.name=this._nextUniqueName(e),r.name=t.tofieldname,r.alias=r.name,(0,y.DA)(t.expression)){const e=this._parent.getField((0,y.YY)(t.expression,f.zl.Standardised));if(!e)throw new c.dr(c.D_.AggregationFieldNotFound);t.name=e.name,t.singlefield=e.name,this.phsyicalgroupbyfields.push(e.name),r.type=e.type,t.sqlType=e.type}else{r.type=this._convertToEsriFieldType((0,y.IY)(t.expression,this._parent.fields));const e=new A.A;e.name=t.name,e.alias=e.name,this.phsyicalgroupbyfields.push(t.name),this._adaptedFields.push(new o.Gr(e,t.expression)),this._candosimplegroupby=!1,t.sqlType=r.type}this.fields.push(r)}if(this._adaptedFields.length>0)for(const e of this._parent.fields)this._adaptedFields.push(new o.IO(e));for(let t=0;t<this._decodedStatsfield.length;t++){const r=new A.A;let i=null;const s=this._decodedStatsfield[t];s.field=this._nextUniqueName(e),s.tofieldname===this.objectIdField&&(this._internalObjectIdField=s.field),r.name=s.tofieldname,r.alias=r.name;const n=null!==s.workingexpr&&(0,y.DA)(s.workingexpr)?(0,y.YY)(s.workingexpr,f.zl.Standardised):"";switch(this._decodedStatsfield[t].typeofstat){case"SUM":if(""!==n){if(i=this._parent.getField(n),!i)throw new c.dr(c.D_.AggregationFieldNotFound);r.type=i.type}else r.type="double";break;case"MIN":case"MAX":if(""!==n){if(i=this._parent.getField(n),!i)throw new c.dr(c.D_.AggregationFieldNotFound);r.type=i.type}else r.type="double";break;case"COUNT":r.type="integer";break;case"STDDEV":case"VAR":case"AVG":if(""!==n&&(i=this._parent.getField(n),!i))throw new c.dr(c.D_.AggregationFieldNotFound);r.type="double"}this.fields.push(r)}}async _canDoAggregates(){return!1}async _getFeatures(e,t,r,i){-1!==t&&this._featureCache[t];const s=this._maxQuery;return!0===this._checkIfNeedToExpandKnownPage(e,s)?(await this._expandPagedSet(e,s,0,0,i),this._getFeatures(e,t,r,i)):"success"}async _getFilteredSet(e,t,r,i,s){if(""!==e)return new h.A([],[],!0,null);let n=null;const l={ordered:!1,nowhereclause:!1};if(await this._ensureLoaded(),null!==r)for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===(0,y.Ju)(r,this._decodedStatsfield[e].tofieldname)){l.nowhereclause=!0,r=null;break}if(null!==i){l.ordered=!0;for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===i.scanForField(this._decodedStatsfield[e].tofieldname)){i=null,l.ordered=!1;break}if(null!==i)for(const e of this._decodedGroupbyfield)if(null===e.singlefield&&!0===i.scanForField(e.tofieldname)){i=null,l.ordered=!1;break}}if(!1!==this._candosimplegroupby&&await this._parent._canDoAggregates(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,null)){let e=null;r&&(e=this._reformulateWhereClauseWithoutGroupByFields(r));let t=null;i&&(t=this._reformulateOrderClauseWithoutGroupByFields(i));const a=await this._parent._getAggregatePagesDataSourceDefinition(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,e,t,this._internalObjectIdField);return this._checkCancelled(s),n=!0===l.nowhereclause?new h.A(a._candidates.slice().concat(a._known.slice()),[],!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)):new h.A(a._candidates.slice(),a._known.slice(),!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)),n}let c=this._parent;if(this._adaptedFields.length>0&&(c=new o.a({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null})),!0===l.nowhereclause)n=new h.A(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new u.A({parentfeatureset:c,orderbyclause:new p.A(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}});else{let e=c;if(null!==r){let t=null;r&&(t=this._reformulateWhereClauseWithoutGroupByFields(r)),e=new a.A({parentfeatureset:e,whereclause:t})}n=new h.A(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new u.A({parentfeatureset:e,orderbyclause:new p.A(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}})}return n}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsfield)e=(0,y.bD)(e,t.tofieldname,(0,y.YY)(t.workingexpr,f.zl.Standardised),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupbyfield)t.tofieldname!==t.name&&(e=(0,y.bD)(e,t.tofieldname,(0,y.YY)(t.expression,f.zl.Standardised),this._parent.getFieldsIndex()));return e}_reformulateOrderClauseWithoutGroupByFields(e){const t=[];for(const e of this._decodedGroupbyfield)e.tofieldname!==e.name&&t.push({field:e.tofieldname,newfield:e.name});return t.length>0?e.replaceFields(t):e}_clonePageDefinition(e){return null===e?null:!0===e.aggregatefeaturesetpagedefinition?{aggregatefeaturesetpagedefinition:!0,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,internal:e.internal}:this._parent._clonePageDefinition(e)}async _refineSetBlock(e,t,r){return!0===this._checkIfNeedToExpandCandidatePage(e,this._maxQuery)?(await this._expandPagedSet(e,this._maxQuery,0,0,r),this._refineSetBlock(e,t,r)):(this._checkCancelled(r),e._candidates.length,this._refineKnowns(e,t),e._candidates.length,e._candidates.length,e)}_expandPagedSet(e,t,r,i,s){return this._expandPagedSetFeatureSet(e,t,r,i,s)}async _getPhysicalPage(e,t,r){if(!0===e.pagesDefinition.aggregatefeaturesetpagedefinition)return this._sequentialGetPhysicalItem(e,e.pagesDefinition.resultRecordCount,r,[]);const i=await this._getAgregagtePhysicalPage(e,t,r);for(const e of i){const t={geometry:e.geometry,attributes:{}},r={};for(const t in e.attributes)r[t.toLowerCase()]=e.attributes[t];for(const e of this._decodedGroupbyfield)t.attributes[e.tofieldname]=r[e.name.toLowerCase()];for(const e of this._decodedStatsfield)t.attributes[e.tofieldname]=r[e.field.toLowerCase()];this._featureCache[t.attributes[this.objectIdField]]=new l.A(t)}return i.length}_sequentialGetPhysicalItem(e,t,r,i){return new Promise(((s,n)=>{null===e.pagesDefinition.internal.iterator&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(r)),!0===e.pagesDefinition.internal.fullyResolved||0===t?s(i.length):this._nextAggregateItem(e,t,r,i,(n=>{null===n?s(i.length):(t-=1,s(this._sequentialGetPhysicalItem(e,t,r,i)))}),n)}))}_nextAggregateItem(e,t,r,i,s,a){try{(0,n.a0)(e.pagesDefinition.internal.iterator.next()).then((n=>{if(null===n)if(null!==e.pagesDefinition.internal.workingItem){const t=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);i.push(t),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(t.attributes[this.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,s(null)}else e.pagesDefinition.internal.fullyResolved=!0,s(null);else{const l=this._generateAggregateHash(n);if(null===e.pagesDefinition.internal.workingItem)e.pagesDefinition.internal.workingItem={features:[n],id:l};else{if(l!==e.pagesDefinition.internal.workingItem.id){const r=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);return i.push(r),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(r.attributes[this.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[n],id:l},void s(r)}e.pagesDefinition.internal.workingItem.features.push(n)}this._nextAggregateItem(e,t,r,i,s,a)}}),a)}catch(e){a(e)}}_calculateFieldStat(e,t,r){const i=[];for(const r of e.features)if(null!==t.workingexpr){const e=t.workingexpr.calculateValue(r);null!==e&&(e instanceof b.n||e instanceof I.k?i.push(e.toNumber()):e instanceof S.g?i.push(e.toMilliseconds()):i.push(e))}else i.push(null);r.attributes[t.tofieldname]=(0,F.s)(t.typeofstat,[i])}_calculateAndAppendAggregateItem(e){const t={attributes:{},geometry:null};for(const r of this._decodedGroupbyfield){const i=r.singlefield?e.features[0].attributes[r.singlefield]:g.A.convertValueToStorageFormat(r.expression.calculateValue(e.features[0]),r.sqlType);t.attributes[r.tofieldname]=i}for(const r of this._decodedStatsfield)this._calculateFieldStat(e,r,t);const r=[];for(let i=0;i<this._decodedStatsfield.length;i++)r.push(this._calculateFieldStat(e,this._decodedStatsfield[i],t));return this._featureCache[t.attributes[this.objectIdField]]=new l.A({attributes:t.attributes,geometry:t.geometry}),t}_generateAggregateHash(e){let t="";for(const r of this._decodedGroupbyfield){const i=r.singlefield?e.attributes[r.singlefield]:r.expression.calculateValue(e);t+=null==i?":":":"+i.toString()}return(0,w.d)(t,w.T.String)}async _stat(){return{calculated:!1}}async getFeatureByObjectId(){return null}static registerAction(){d.A._featuresetFunctions.groupby=function(e,t){return new C({parentfeatureset:this,groupbyfields:e,statsfields:t})}}}var D=r(54784),R=r(54461),k=r(70333),L=r(61454),N=r(66395),E=r(50145),P=r(39516),O=r(65864),M=r(21325),j=r(13600),G=r(54546),U=r(61956),B=r(7562);class q extends d.A{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerDynamic",this._removeGeometry=!1,this._overrideFields=null,this.formulaCredential=null,this._pageJustIds=!1,this._requestStandardised=!1,this._useDefinitionExpression=!0,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return f.gO}end(){return this._layer}optimisePagingFeatureQueries(e){this._pageJustIds=e}get urlQueryPath(){return this._layer.parsedUrl.path||""}convertQueryToLruCacheKey(e){const t=this.urlQueryPath+","+(0,f.JB)(e.toJSON());return(0,w.d)(t,w.T.String)}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType??"",this.fields=this._layer.fields.slice(),this.hasZ=!0===this._layer?.capabilities?.data?.supportsZ,this.hasM=!0===this._layer?.capabilities?.data?.supportsM,null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const r of this.fields)if("oid"===r.type)e.push(r),t.push(r.name);else for(const i of this._overrideFields)if(i.toLowerCase()===r.name.toLowerCase()){e.push(r),t.push(r.name);break}this.fields=e,this._overrideFields=t}if(this._layer.source&&this._layer.source.sourceJSON){const e=this._layer.source.sourceJSON.currentVersion;!0===this._layer.source.sourceJSON.useStandardizedQueries?(this._databaseType=f.zl.StandardisedNoInterval,null!=e&&e>=10.61&&(this._databaseType=f.zl.Standardised)):null!=e&&(e>=10.5&&(this._databaseType=f.zl.StandardisedNoInterval,this._requestStandardised=!0),e>=10.61&&(this._databaseType=f.zl.Standardised))}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this.subtypeField=this._layer.subtypeField??"",this.subtypes=this._layer.subtypes,this.typeIdField=("typeIdField"in this._layer?this._layer.typeIdField:null)??"",this.types="types"in this._layer?this._layer.types:null}_isInFeatureSet(){return f.J6.InFeatureSet}async _refineSetBlock(e){return e}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}async _runDatabaseProbe(e){await this._ensureLoaded();const t=new U.A;this.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t.where=e.replace("OBJECTID",this._layer.objectIdField);try{return await this._layer.queryObjectIds(t),!0}catch(e){return!1}}_canUsePagination(){return!(!this._layer.capabilities||!this._layer.capabilities.query||!0!==this._layer.capabilities.query.supportsPagination)}_cacheableFeatureSetSourceKey(){return this._layer.url}get gdbVersion(){return this._layer&&this._layer.capabilities&&this._layer.capabilities.data&&this._layer.capabilities.data.isVersioned?this._layer.gdbVersion||"SDE.DEFAULT":""}nativeCapabilities(){return{title:this._layer.title??"",source:this,canQueryRelated:!0,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:this._requestStandardised}}_createQuery(){const e=this._layer.createQuery();return e.returnZ=this.hasZ,e.returnM=this.hasM,this.datesInUnknownTimezone&&(e.timeReferenceUnknownClient=!0),this._requestStandardised&&(e.sqlFormat="standard"),this._useDefinitionExpression?"subtype-group"===this._layer.type&&(e.where=this._layer.definitionExpression):e.where=null,e}executeQuery(e,t){const r="execute"===t?this._layer.queryFeatures.bind(this._layer):"executeForCount"===t?this._layer.queryFeatureCount.bind(this._layer):this._layer.queryObjectIds.bind(this._layer);let i=null;if(this.recentlyUsedQueries){const t=this.convertQueryToLruCacheKey(e);i=this.recentlyUsedQueries.getFromCache(t),null===i&&(i=r(e),this.recentlyUsedQueries.addToCache(t,i),i=i.catch((e=>{throw this.recentlyUsedQueries?.removeFromCache(t),e})))}return this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:e,method:t}),null===i&&(i=r(e)),i}async _getFilteredSet(e,t,r,i,s){const n=await this.databaseType();if(this.isTable()&&t&&null!==e&&""!==e)return new h.A([],[],!0,null);if(this._canUsePagination())return this._getFilteredSetUsingPaging(e,t,r,i,s);let a="",l=!1;null!==i&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(a=i.constructClause(),l=!0);const o=this._createQuery();o.where=(0,P.mA)(o.where,null===r?null===t?"1=1":"":(0,y.YY)(r,n)),o.spatialRelationship=this._makeRelationshipEnum(e),o.outSpatialReference=this.spatialReference,o.orderByFields=""!==a?a.split(","):null,o.geometry=null===t?null:t,o.relationParameter=this._makeRelationshipParam(e);let u=await this.executeQuery(o,"executeForIds");return null===u&&(u=[]),this._checkCancelled(s),new h.A([],u,l,null)}_expandPagedSet(e,t,r,i,s){return this._expandPagedSetFeatureSet(e,t,r,i,s)}async _getFilteredSetUsingPaging(e,t,r,i,s){let n="",a=!1;null!==i&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(n=i.constructClause(),a=!0);const l=await this.databaseType(),o=null===r?null===t?"1=1":"":(0,y.YY)(r,l);let u=this._maxQueryRate();const c=this._layer.capabilities?.query.maxRecordCount;null!=c&&c<u&&(u=c);let d=null;if(!0===this._pageJustIds)d=new h.A([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:this._layer.objectIdField,resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:n,returnGeometry:!1,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}});else{let r=!0;!0===this._removeGeometry&&(r=!1);const i=this._overrideFields??this._fieldsIncludingObjectId(["*"]);d=new h.A([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:i.join(","),resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:n,returnGeometry:r,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}return await this._expandPagedSet(d,u,0,1,s),d}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,r){const i=e.pagesDefinition.internal.lastRetrieved,s=i,n=e.pagesDefinition.internal.lastPage,a=this._createQuery();a.spatialRelationship=e.pagesDefinition.spatialRel,a.relationParameter=e.pagesDefinition.relationParam,a.outFields=e.pagesDefinition.outFields.split(","),a.num=e.pagesDefinition.resultRecordCount,a.start=e.pagesDefinition.internal.lastPage,a.geometry=e.pagesDefinition.geometry,a.where=(0,P.mA)(a.where,e.pagesDefinition.where),a.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,a.returnGeometry=e.pagesDefinition.returnGeometry,a.outSpatialReference=this.spatialReference;const l=await this.executeQuery(a,"execute");if(this._checkCancelled(r),e.pagesDefinition.internal.lastPage!==n)return"done";const o=this._layer.objectIdField;for(let t=0;t<l.features.length;t++)e.pagesDefinition.internal.set[s+t]=l.features[t].attributes[o];if(!1===this._pageJustIds)for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[o]]=l.features[e];return(void 0===l.exceededTransferLimit&&l.features.length!==e.pagesDefinition.resultRecordCount||!1===l.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=i+l.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,"done"}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice();if(t.includes("*"))return t;let r=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){r=!0;break}return!1===r&&t.push(this.objectIdField),t}async _getFeatures(e,t,r,i){const s=[];if(-1!==t&&void 0===this._featureCache[t]&&s.push(t),!0===this._checkIfNeedToExpandKnownPage(e,this._maxProcessingRate()))return await this._expandPagedSet(e,this._maxProcessingRate(),0,0,i),this._getFeatures(e,t,r,i);let n=0;for(let i=e._lastFetchedIndex;i<e._known.length;i++){if(e._lastFetchedIndex+=1,n++,void 0===this._featureCache[e._known[i]]){let r=!1;if(null!==this._layer._mode&&void 0!==this._layer._mode){const t=this._layer._mode;if(void 0!==t._featureMap[e._known[i]]){const s=t._featureMap[e._known[i]];null!==s&&(r=!0,this._featureCache[e._known[i]]=s)}}if(!1===r&&(e._known[i]!==t&&s.push(e._known[i]),s.length>=this._maxProcessingRate()-1))break}if(n>=r&&0===s.length)break}if(0===s.length)return"success";const a=this._createQuery();a.objectIds=s,a.outFields=this._overrideFields??this._fieldsIncludingObjectId(["*"]),a.returnGeometry=!0,!0===this._removeGeometry&&(a.returnGeometry=!1),a.outSpatialReference=this.spatialReference;const l=await this.executeQuery(a,"execute");if(this._checkCancelled(i),void 0!==l.error)throw new c.dr(c.D_.RequestFailed,{reason:l.error});const o=this._layer.objectIdField;for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[o]]=l.features[e];return"success"}async _getDistinctPages(e,t,r,i,s,n,a,l,o){await this._ensureLoaded();const u=await this.databaseType();let d=r.parseTree.column;const h=this._layer.fields??[];for(let e=0;e<h.length;e++)if(h[e].name.toLowerCase()===d.toLowerCase()){d=h[e].name;break}const p=this._createQuery();p.where=(0,P.mA)(p.where,null===n?null===s?"1=1":"":(0,y.YY)(n,u)),p.spatialRelationship=this._makeRelationshipEnum(i),p.relationParameter=this._makeRelationshipParam(i),p.geometry=null===s?null:s,p.returnDistinctValues=!0,p.returnGeometry=!1,p.outFields=[d];const f=await this.executeQuery(p,"execute");if(this._checkCancelled(o),!f.hasOwnProperty("features"))throw new c.dr(c.D_.InvalidStatResponse);let _=!1;for(let e=0;e<h.length;e++)if(h[e].name===d){"date"===h[e].type&&(_=!0);break}for(let e=0;e<f.features.length;e++){if(_){const t=f.features[e].attributes[d];null!==t?l.push(new Date(t)):l.push(t)}else l.push(f.features[e].attributes[d]);if(l.length>=a)break}return 0===f.features.length?l:f.features.length===this._layer.capabilities?.query.maxRecordCount&&l.length<a?{calculated:!0,result:await this._getDistinctPages(e+f.features.length,t,r,i,s,n,a,l,o)}:l}async _distinctStat(e,t,r,i,s,n,a){return{calculated:!0,result:await this._getDistinctPages(0,e,t,r,i,s,n,[],a)}}isTable(){return this._layer.isTable||null===this._layer.geometryType||"table"===this._layer.type||""===this._layer.geometryType||"esriGeometryNull"===this._layer.geometryType}async _countstat(e,t,r,i){const s=await this.databaseType();if(this.isTable()&&r&&null!==t&&""!==t)return{calculated:!0,result:0};const n=this._createQuery();return n.where=(0,P.mA)(n.where,null===i?null===r?"1=1":"":(0,y.YY)(i,s)),n.spatialRelationship=this._makeRelationshipEnum(t),n.relationParameter=this._makeRelationshipParam(t),n.geometry=null===r?null:r,n.returnGeometry=!1,{calculated:!0,result:await this.executeQuery(n,"executeForCount")}}async _stats(e,t,r,i,s,n,a){await this._ensureLoaded();const l=this._layer.capabilities?.query,o=!!l?.supportsSqlExpression,u=!!l?.supportsStatistics,d=!!l?.supportsDistinct;if("count"===e)return d?this._countstat(e,r,i,s):{calculated:!1};if(!1===u||!1===(0,y.DA)(t)&&!1===o||!1===t.isStandardized)return""!==r||null!==s?{calculated:!1}:this._manualStat(e,t,n,a);if("distinct"===e)return!1===d?""!==r||null!==s?{calculated:!1}:this._manualStat(e,t,n,a):this._distinctStat(e,t,r,i,s,n,a);const h=await this.databaseType();if(this.isTable()&&i&&null!==r&&""!==r)return{calculated:!0,result:null};const p=this._createQuery();p.where=(0,P.mA)(p.where,null===s?null===i?"1=1":"":(0,y.YY)(s,h)),p.spatialRelationship=this._makeRelationshipEnum(r),p.relationParameter=this._makeRelationshipParam(r),p.geometry=null===i?null:i;const f=new B.A;f.statisticType=(0,E.Dp)(e),f.onStatisticField=(0,y.YY)(t,h),f.outStatisticFieldName="ARCADE_STAT_RESULT",p.returnGeometry=!1;let _="ARCADE_STAT_RESULT";p.outStatistics=[f];const g=await this.executeQuery(p,"execute");if(!g.hasOwnProperty("features")||0===g.features.length)throw new c.dr(c.D_.InvalidStatResponse);let m=!1;const w=g.fields??[];for(let e=0;e<w.length;e++)if("ARCADE_STAT_RESULT"===w[e].name.toUpperCase()){_=w[e].name,"date"===w[e].type&&(m=!0);break}if(m){let e=g.features[0].attributes[_];return null!==e&&(e=new Date(g.features[0].attributes[_])),{calculated:!0,result:e}}return{calculated:!0,result:g.features[0].attributes[_]}}_stat(e,t,r,i,s,n,a){return this._stats(e,t,r,i,s,n,a)}async _canDoAggregates(e,t){await this._ensureLoaded();let r=!1;const i=this._layer.capabilities?.query,s=!0===i?.supportsSqlExpression;if(null!=i&&!0===i.supportsStatistics&&!0===i.supportsOrderBy&&(r=!0),r)for(let e=0;e<t.length-1;e++)(!1===t[e].workingexpr?.isStandardized||!1===(0,y.DA)(t[e].workingexpr)&&!1===s)&&(r=!1);return!1!==r}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _getAggregatePagesDataSourceDefinition(e,t,r,i,s,n,a){await this._ensureLoaded();const l=await this.databaseType();let o="",u=!1,c=!1;null!==n&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(o=n.constructClause(),c=!0),this._layer.capabilities&&this._layer.capabilities.query&&!1===this._layer.capabilities.query.supportsPagination&&(c=!1,u=!0,o=this._layer.objectIdField);const d=[];for(let e=0;e<t.length;e++){const r=new B.A;r.onStatisticField=null!==t[e].workingexpr?(0,y.YY)(t[e].workingexpr,l):"",r.outStatisticFieldName=t[e].field,r.statisticType=t[e].toStatisticsName(),d.push(r)}""===o&&(o=e.join(","));let p=this._maxQueryRate();const f=this._layer.capabilities?.query.maxRecordCount;null!=f&&f<p&&(p=f);const _=null===s?null===i?"1=1":"":(0,y.YY)(s,l);return new h.A([],["GETPAGES"],c,{groupbypage:!0,spatialRel:this._makeRelationshipEnum(r),relationParam:this._makeRelationshipParam(r),outFields:["*"],useOIDpagination:u,generatedOid:a,resultRecordCount:p,resultOffset:0,groupByFieldsForStatistics:e,outStatistics:d,geometry:null===i?null:i,where:_,orderByFields:o,returnGeometry:!1,returnIdsOnly:!1,internal:{lastMaxId:-1,set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}async _getAgregagtePhysicalPage(e,t,r){let i=e.pagesDefinition.where;!0===e.pagesDefinition.useOIDpagination&&(i=(0,P.mA)(i,e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString()));const s=e.pagesDefinition.internal.lastRetrieved,n=s,a=e.pagesDefinition.internal.lastPage,o=this._createQuery();if(o.where=(0,P.mA)(o.where,i),o.spatialRelationship=e.pagesDefinition.spatialRel,o.relationParameter=e.pagesDefinition.relationParam,o.outFields=e.pagesDefinition.outFields,o.outStatistics=e.pagesDefinition.outStatistics,o.geometry=e.pagesDefinition.geometry,o.groupByFieldsForStatistics=e.pagesDefinition.groupByFieldsForStatistics,o.num=e.pagesDefinition.resultRecordCount,o.start=e.pagesDefinition.internal.lastPage,o.returnGeometry=e.pagesDefinition.returnGeometry,o.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,this.isTable()&&o.geometry&&o.spatialRelationship)return[];const u=await this.executeQuery(o,"execute");if(this._checkCancelled(r),!u.hasOwnProperty("features"))throw new c.dr(c.D_.InvalidStatResponse);const d=[];if(e.pagesDefinition.internal.lastPage!==a)return[];u.features.length>0&&void 0===u.features[0].attributes[e.pagesDefinition.generatedOid]&&(e.pagesDefinition.generatedOid=e.pagesDefinition.generatedOid.toLowerCase());for(let t=0;t<u.features.length;t++)e.pagesDefinition.internal.set[n+t]=u.features[t].attributes[e.pagesDefinition.generatedOid];for(let e=0;e<u.features.length;e++)d.push(new l.A({attributes:u.features[e].attributes,geometry:null}));return!0===e.pagesDefinition.useOIDpagination?0===u.features.length?e.pagesDefinition.internal.fullyResolved=!0:e.pagesDefinition.internal.lastMaxId=u.features[u.features.length-1].attributes[e.pagesDefinition.generatedOid]:(void 0===u.exceededTransferLimit&&u.features.length!==e.pagesDefinition.resultRecordCount||!1===u.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=s+u.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,d}static create(e,t,r,i,s){const n=new j.default({url:e,outFields:null===t?["*"]:t});return new q({layer:n,spatialReference:r,lrucache:i,interceptor:s})}relationshipMetaData(){return this._layer&&this._layer.source&&this._layer.source.sourceJSON?.relationships?this._layer.source.sourceJSON.relationships:[]}serviceUrl(){return(0,f.Qi)(this._layer.parsedUrl.path)}async queryAttachments(e,t,r,i,s){const n=this._layer;if(function(e){const t=e.capabilities;return t?.data.supportsAttachment&&t?.operations.supportsQueryAttachments}(n)){const a={objectIds:[e],returnMetadata:s};(t&&t>0||r&&r>0)&&(a.size=[t&&t>0?t:0,r&&r>0?r:t+1]),i&&i.length>0&&(a.attachmentTypes=i),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:n,query:a,method:"attachments"});const l=await n.queryAttachments(new G.A(a)),o=[];return l&&l[e]&&l[e].forEach((t=>{const r=this._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+t.id.toString();let i=null;s&&t.exifInfo&&(i=N.A.convertJsonToArcade(t.exifInfo,"system",!0)),o.push(new L.A(t.id,t.name,t.contentType,t.size,r,i,t.keywords??null))})),o}return[]}async queryRelatedFeatures(e){const t={f:"json",relationshipId:e.relationshipId.toString(),definitionExpression:e.where,outFields:e.outFields?.join(","),returnGeometry:e.returnGeometry.toString()};void 0!==e.resultOffset&&null!==e.resultOffset&&(t.resultOffset=e.resultOffset.toString()),void 0!==e.resultRecordCount&&null!==e.resultRecordCount&&(t.resultRecordCount=e.resultRecordCount.toString()),e.orderByFields&&(t.orderByFields=e.orderByFields.join(",")),e.objectIds&&e.objectIds.length>0&&(t.objectIds=e.objectIds.join(",")),e.outSpatialReference&&(t.outSR=(0,M.YX)(e.outSpatialReference)),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:t,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const r=await(0,i.A)(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:t});if(r.data){const e={},t=r.data;if(t?.relatedRecordGroups){const r=t.spatialReference;for(const i of t.relatedRecordGroups){const s=i.objectId,n=[];for(const e of i.relatedRecords){e.geometry&&(e.geometry.spatialReference=r);const t=new l.A({geometry:e.geometry?(0,O.rS)(e.geometry):null,attributes:e.attributes});n.push(t)}e[s]={features:n,exceededTransferLimit:!0===t.exceededTransferLimit}}}return e}throw new c.dr(c.D_.InvalidRequest)}async getFeatureByObjectId(e,t){const r=this._createQuery();r.outFields=t,r.returnGeometry=!1,r.outSpatialReference=this.spatialReference,r.where=(0,P.mA)(r.where,this.objectIdField+"="+e.toString()),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:r,method:"execute"});const i=await this._layer.queryFeatures(r);return 1===i.features.length?i.features[0]:null}async getIdentityUser(){await this.load();const e=k.id?.findCredential(this._layer.url);return e?e.userId:null}async getOwningSystemUrl(){await this.load();const e=k.id?.findServerInfo(this._layer.url);if(e)return e.owningSystemUrl;let t=this._layer.url;const r=t.toLowerCase().indexOf("/rest/services");if(t=r>-1?t.slice(0,r):t,t){t+="/rest/info";try{const e=await(0,i.A)(t,{query:{f:"json"}});let r="";return e.data?.owningSystemUrl&&(r=e.data.owningSystemUrl),r}catch(e){return""}}return""}getDataSourceFeatureSet(){const e=new q({layer:this._layer,spatialReference:this.spatialReference??void 0,outFields:this._overrideFields??void 0,includeGeometry:!this._removeGeometry,lrucache:this.recentlyUsedQueries??void 0,interceptor:this.featureSetQueryInterceptor??void 0});return e._useDefinitionExpression=!1,e}get preferredTimeZone(){return this._layer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._layer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._layer.datesInUnknownTimezone??!1}get editFieldsInfo(){return this._layer.editFieldsInfo??null}get timeInfo(){return this._layer.timeInfo??null}async getFeatureSetInfo(){if(this.fsetInfo)return this.fsetInfo;let e=null,t="serviceItemId"in this._layer?this._layer.serviceItemId:null;const r=this._layer.parsedUrl?.path??null;if(r){const s=await(0,i.A)(r,{responseType:"json",query:{f:"json"}});e=s?.data?.name??null,t=s?.data?.serviceItemId??null}const s=this._layer.title&&null!==(this._layer.parent??null);return this.featureSetInfo={layerId:this._layer.layerId,layerName:""===e?null:e,itemId:""===t?null:t,serviceLayerUrl:""===r?null:r,webMapLayerId:s?this._layer.id??null:null,webMapLayerTitle:s?this._layer.title??null:null,className:null,objectClassId:null},this.fsetInfo}}var Z=r(30235),W=r(26591);class Q extends d.A{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerRelated",this._findObjectId=-1,this._requestStandardised=!1,this._removeGeometry=!1,this._overrideFields=null,this.featureObjectId=null,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,this._findObjectId=e.objectId,this.featureObjectId=e.objectId,this.relationship=e.relationship,this._relatedLayer=e.relatedLayer,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return f.gO}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return await Promise.all([this._layer.load(),this._relatedLayer?.load()]),this._initialiseFeatureSet(),this}nativeCapabilities(){return this._relatedLayer.nativeCapabilities()}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._relatedLayer.geometryType,this.fields=this._relatedLayer.fields.slice(),this.hasZ=this._relatedLayer.hasZ,this.hasM=this._relatedLayer.hasM,null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const r of this.fields)if("oid"===r.type)e.push(r),t.push(r.name);else for(const i of this._overrideFields)if(i.toLowerCase()===r.name.toLowerCase()){e.push(r),t.push(r.name);break}this.fields=e,this._overrideFields=t}const e=this._layer.nativeCapabilities();e&&(this._databaseType=e.databaseType,this._requestStandardised=e.requestStandardised),this.objectIdField=this._relatedLayer.objectIdField,this.globalIdField=this._relatedLayer.globalIdField,this.hasM=this._relatedLayer.supportsM,this.hasZ=this._relatedLayer.supportsZ,this.typeIdField=this._relatedLayer.typeIdField,this.types=this._relatedLayer.types,this.subtypeField=this._relatedLayer.subtypeField,this.subtypes=this._relatedLayer.subtypes}async databaseType(){return await this._relatedLayer.databaseType(),this._databaseType=this._relatedLayer._databaseType,this._databaseType}isTable(){return this._relatedLayer.isTable()}_isInFeatureSet(){return f.J6.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const r of this.fields)t[r.name]=e.attributes[r.name];return new l.A({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,r,i,s){if(await this.databaseType(),this.isTable()&&t&&null!==e&&""!==e)return new h.A([],[],!0,null);const n=this._layer.nativeCapabilities();if(!1===n.canQueryRelated)return new h.A([],[],!0,null);if(n.capabilities?.queryRelated.supportsPagination)return this._getFilteredSetUsingPaging(e,t,r,i,s);let a="",l=!1;null!==i&&!0===n.capabilities?.queryRelated.supportsOrderBy&&(a=i.constructClause(),l=!0);const o=new W.default;o.objectIds=[this._findObjectId];const u=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map((e=>e.name)):["*"]);o.outFields=u,o.relationshipId=this.relationship.id,o.where="1=1";let c=!0;!0===this._removeGeometry&&(c=!1),o.returnGeometry=c,this._requestStandardised&&(o.sqlFormat="standard"),o.outSpatialReference=this.spatialReference,o.orderByFields=""!==a?a.split(","):null;const d=await n.source.queryRelatedFeatures(o);this._checkCancelled(s);const p=d[this._findObjectId]?d[this._findObjectId].features:[],f=[];for(let e=0;e<p.length;e++)this._featureCache[p[e].attributes[this._relatedLayer.objectIdField]]=p[e],f.push(p[e].attributes[this._relatedLayer.objectIdField]);const y=t&&null!==e&&""!==e,_=null!=r;return new h.A(y||_?f:[],y||_?[]:f,l,null)}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice();if(t.includes("*"))return t;let r=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){r=!0;break}return!1===r&&t.push(this.objectIdField),t}async _getFilteredSetUsingPaging(e,t,r,i,s){let n="",a=!1;const l=this._layer.nativeCapabilities();null!==i&&!0===l.capabilities?.queryRelated.supportsOrderBy&&(n=i.constructClause(),a=!0),await this.databaseType();let o=this._maxQueryRate();const u=l.capabilities?.query.maxRecordCount;null!=u&&u<o&&(o=u);const c=t&&null!==e&&""!==e,d=null!=r;let p=null,f=!0;!0===this._removeGeometry&&(f=!1);const y=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map((e=>e.name)):["*"]);return p=new h.A(c||d?["GETPAGES"]:[],c||d?[]:["GETPAGES"],a,{outFields:y.join(","),resultRecordCount:o,resultOffset:0,objectIds:[this._findObjectId],where:"1=1",orderByFields:n,returnGeometry:f,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),await this._expandPagedSet(p,o,0,0,s),p}_expandPagedSet(e,t,r,i,s){return this._expandPagedSetFeatureSet(e,t,r,i,s)}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,r){const i=e.pagesDefinition.internal.lastRetrieved,s=i,n=e.pagesDefinition.internal.lastPage,a=this._layer.nativeCapabilities(),l=new W.default;!0===this._requestStandardised&&(l.sqlFormat="standard"),l.relationshipId=this.relationship.id,l.objectIds=e.pagesDefinition.objectIds,l.resultOffset=e.pagesDefinition.internal.lastPage,l.resultRecordCount=e.pagesDefinition.resultRecordCount,l.outFields=e.pagesDefinition.outFields.split(","),l.where=e.pagesDefinition.where,l.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,l.returnGeometry=e.pagesDefinition.returnGeometry,l.outSpatialReference=this.spatialReference;const o=await a.source.queryRelatedFeatures(l);if(this._checkCancelled(r),e.pagesDefinition.internal.lastPage!==n)return 0;const u=o[this._findObjectId]?o[this._findObjectId].features:[];for(let t=0;t<u.length;t++)e.pagesDefinition.internal.set[s+t]=u[t].attributes[this._relatedLayer.objectIdField];for(let e=0;e<u.length;e++)this._featureCache[u[e].attributes[this._relatedLayer.objectIdField]]=u[e];const c=!o[this._findObjectId]||!1===o[this._findObjectId].exceededTransferLimit;return u.length!==e.pagesDefinition.resultRecordCount&&c&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=i+u.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,u.length}async _getFeatures(e,t,r,i){const s=[];-1!==t&&void 0===this._featureCache[t]&&s.push(t);const n=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,n))return await this._expandPagedSet(e,n,0,0,i),this._getFeatures(e,t,r,i);let a=0;for(let i=e._lastFetchedIndex;i<e._known.length&&(a++,a<=r&&(e._lastFetchedIndex+=1),!("GETPAGES"!==e._known[i]&&void 0===this._featureCache[e._known[i]]&&(e._known[i]!==t&&s.push(e._known[i]),s.length>r)))&&!(a>=r&&0===s.length);i++);if(0===s.length)return"success";throw new c.dr(c.D_.MissingFeatures)}async _refineSetBlock(e,t,r){return e}async _stat(e,t,r,i,s,n,a){return{calculated:!1}}get gdbVersion(){return this._relatedLayer.gdbVersion}async _canDoAggregates(e,t,r,i,s){return!1}relationshipMetaData(){return this._relatedLayer.relationshipMetaData()}serviceUrl(){return this._relatedLayer.serviceUrl()}queryAttachments(e,t,r,i,s){return this._relatedLayer.queryAttachments(e,t,r,i,s)}getFeatureByObjectId(e,t){return this._relatedLayer.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this._relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this._relatedLayer}get preferredTimeZone(){return this._relatedLayer?.preferredTimeZone??null}get dateFieldsTimeZone(){return this._relatedLayer?.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._relatedLayer?.datesInUnknownTimezone}get editFieldsInfo(){return this._relatedLayer?.editFieldsInfo??null}get timeInfo(){return this._relatedLayer?.timeInfo??null}async getFeatureSetInfo(){return this.fsetInfo??this._layer.featureSetInfo}}var V=r(23732),J=r(92474),z=r(4146),$=r(80812);function Y(){null===V.A.applicationCache&&(V.A.applicationCache=new V.A)}async function K(e,t,r){if(V.A.applicationCache){const r=V.A.applicationCache.getLayerInfo(e);if(r){const i=await r;return new j.default({url:e,outFields:t,sourceJSON:i})}const i=new j.default({url:e,outFields:t}),s=(async()=>(await i.load(),i.sourceJSON))();if(V.A.applicationCache){V.A.applicationCache.setLayerInfo(e,s);try{return await s,i}catch(t){throw V.A.applicationCache.clearLayerInfo(e),t}}return await s,i}if(null!=r){const i=r.getCachedLayerMetadata(e);if(i){const r=await i;return new j.default({url:e,outFields:t,sourceJSON:r})}const s=new j.default({url:e,outFields:t}),n=(async()=>(await s.load(),s.sourceJSON))();r.setCachedLayerMetadata(e,n);try{return await n,s}catch(t){throw r.removeCachedLayerMetadata(e,n),t}}return new j.default({url:e,outFields:t})}async function H(e,t,r,i,s,n=null){return X(await K(e,["*"],s),t,r,i,s,n)}function X(e,t=null,r=null,i=!0,s=null,n=null){switch(e.type){case"catalog-footprint":return X(e.parent,t,r,i,s,n);case"subtype-sublayer":{const a=X(e.parent,t,r,i,s,n);return a.filter(g.A.create(e.parent.subtypeField+"="+e.subtypeCode.toString(),{fieldsIndex:e.parent.fieldsIndex,timeZone:a.dateFieldsTimeZoneDefaultUTC}))}case"csv":case"geojson":case"knowledge-graph-sublayer":case"wfs":return new Z.A({layer:e,spatialReference:t,outFields:r,includeGeometry:i,lrucache:s,interceptor:n});case"catalog":case"feature":case"oriented-imagery":case"subtype-group":{const a={layer:e,spatialReference:t,outFields:r,includeGeometry:i,lrucache:s,interceptor:n};return!e.url&&e.source?new Z.A(a):new q(a)}default:throw new Error(`Unsupported layer type: ${e.type}`)}}async function ee(e,t){if(null!==V.A.applicationCache){const t=V.A.applicationCache.getLayerInfo(e);if(null!==t)return t}if(null!=t){const r=t.getCachedServiceMetadata(e);if(null!=r)return r}const r=(async()=>{const t=await(0,i.A)(e,{responseType:"json",query:{f:"json"}});if(t.data){const e=t.data;return e.layers||(e.layers=[]),e.tables||(e.tables=[]),e}return{layers:[],tables:[]}})();if(null!==V.A.applicationCache){V.A.applicationCache.setLayerInfo(e,r);try{return await r}catch(t){throw V.A.applicationCache.clearLayerInfo(e),t}}if(null!=t){t.setCachedServiceMetadata(e,r);try{return await r}catch(i){throw t.removeCachedServiceMetadata(e,r),i}}return r}async function te(e,t,r){const s={metadata:null,networkId:-1,unVersion:3,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map,queryelem:null,layerNameLkp:{},lkp:null},n=await ee(e,null);if(s.metadata=n,void 0!==n.controllerDatasetLayers?.utilityNetworkLayerId&&null!==n.controllerDatasetLayers.utilityNetworkLayerId){if(n.layers)for(const e of n.layers)s.layerNameLkp[e.id]=e.name;if(n.tables)for(const e of n.tables)s.layerNameLkp[e.id]=e.name;const a=n.controllerDatasetLayers.utilityNetworkLayerId;s.networkId=a;const l=await async function(e,t){const r="QUERYDATAELEMTS:"+t.toString()+":"+e;if(null!==V.A.applicationCache){const e=V.A.applicationCache.getLayerInfo(r);if(null!==e)return e}const s=(async()=>{const r=await(0,i.A)(e+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([t.toString()]),f:"json"}});if(r.data){const e=r.data;if(e.layerDataElements?.[0])return e.layerDataElements[0]}throw new c.dr(c.D_.DataElementsNotFound)})();if(null!==V.A.applicationCache){V.A.applicationCache.setLayerInfo(r,s);try{return await s}catch(e){throw V.A.applicationCache.clearLayerInfo(r),e}}return s}(e,a);if(l){s.queryelem=l,s.queryelem?.dataElement&&void 0!==s.queryelem.dataElement.schemaGeneration&&(s.unVersion=s.queryelem.dataElement.schemaGeneration),s.lkp={},s.queryelem.dataElement.domainNetworks||(s.queryelem.dataElement.domainNetworks=[]);for(const e of s.queryelem.dataElement.domainNetworks){for(const t of e.edgeSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:s.layerNameLkp[t.layerId]??null};s.layerIdLookup.set(e.layerId,e),s.sourceIdLookup.set(e.sourceId,e),e.className&&(s.lkp[e.className]=e)}for(const t of e.junctionSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:s.layerNameLkp[t.layerId]??null};s.layerIdLookup.set(e.layerId,e),s.sourceIdLookup.set(e.sourceId,e),e.className&&(s.lkp[e.className]=e)}}if(s.queryelem.dataElement.terminalConfigurations)for(const e of s.queryelem.dataElement.terminalConfigurations)for(const t of e.terminals)s.terminals.push({terminalId:t.terminalId,terminalName:t.terminalName});const n=await async function(e){if(null!==V.A.applicationCache){const t=V.A.applicationCache.getLayerInfo(e);if(null!==t)return t}const t=(async()=>{const t=await(0,i.A)(e,{responseType:"json",query:{f:"json"}});return t.data?t.data:null})();if(null!==V.A.applicationCache){V.A.applicationCache.setLayerInfo(e,t);try{return await t}catch(t){throw V.A.applicationCache.clearLayerInfo(e),t}}return t}(e+"/"+a);if(void 0!==n.systemLayers?.associationsTableId&&null!==n.systemLayers.associationsTableId){let i=null;if(r&&s.unVersion<8){const r=[];s.unVersion>=4&&(r.push("STATUS"),r.push("PERCENTALONG")),i=await H(e+"/"+n.systemLayers.associationsTableId,t,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...r],!1,null,null),await i.load(),s.unVersion>=4&&(i=i.filter(g.A.create("STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63)",{fieldsIndex:i.getFieldsIndex(),timeZone:i.dateFieldsTimeZoneDefaultUTC})),await i.load())}return{lkp:s.lkp,associations:i,unVersion:s.unVersion,terminals:s.terminals,layerIdLookup:s.layerIdLookup,sourceIdLookup:s.sourceIdLookup}}return{associations:null,unVersion:s.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}return{associations:null,unVersion:s.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}return{associations:null,unVersion:s.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}async function re(e,t,r,i=null,s=null,n=!0,a=null,l=null){let o=e.serviceUrl();if(!o)return null;o="/"===o.charAt(o.length-1)?o+t.relatedTableId.toString():o+"/"+t.relatedTableId.toString();const u=await H(o,i,s,n,a,l);return new Q({layer:e,relatedLayer:u,relationship:t,objectId:r,spatialReference:i,outFields:s,includeGeometry:n,lrucache:a,interceptor:l})}a.A.registerAction(),C.registerAction(),u.A.registerAction(),D.A.registerAction(),R.A.registerAction();class ie extends s{constructor(e,t=null,r=null,i=null){super(),this._map=e,this._overrideSpatialReference=t,this._lrucache=r,this._interceptor=i,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,r=null){const i=X(e,this._overrideSpatialReference,null===r?["*"]:r,t,this._lrucache,this._interceptor);return this._instantLayers.push({featureset:i,opitem:e,includeGeometry:t,outFields:JSON.stringify(r)}),i}async featureSetByName(e,t=!0,r=null){if(J.A.isLoadable(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetByName(e,t,r);null===r&&(r=["*"]),r=(r=r.slice()).sort();const i=JSON.stringify(r);for(let r=0;r<this._instantLayers.length;r++){const s=this._instantLayers[r];if(s.opitem.title===e&&s.includeGeometry===t&&s.outFields===i)return this._instantLayers[r].featureset}const s=this._map.allLayers.find((t=>(0,f.eB)(t)&&t.title===e));if(null!=s)return this._makeAndAddFeatureSet(s,t,r);if(this._map.allTables){const i=this._map.allTables.find((t=>(0,f.eB)(t)&&t.title===e));if(null!=i)return this._makeAndAddFeatureSet(i,t,r)}return null}async featureSetById(e,t=!0,r=["*"]){if(J.A.isLoadable(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetById(e,t,r);null===r&&(r=["*"]),r=(r=r.slice()).sort();const i=JSON.stringify(r);for(let r=0;r<this._instantLayers.length;r++){const s=this._instantLayers[r];if(s.opitem.id===e&&s.includeGeometry===t&&s.outFields===i)return this._instantLayers[r].featureset}const s=this._map.allLayers.find((t=>(0,f.eB)(t)&&t.id===e));if(s)return this._makeAndAddFeatureSet(s,t,r);if(this._map.allTables){const i=this._map.allTables.find((t=>(0,f.eB)(t)&&t.id===e));if(null!=i)return this._makeAndAddFeatureSet(i,t,r)}return null}}class se extends s{constructor(e,t=null,r=null,i=null){super(),this._url=e,this._overrideSpatialReference=t,this._lrucache=r,this._interceptor=i,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,r=null){const i=X(e,this._overrideSpatialReference,null===r?["*"]:r,t,this._lrucache);return this._instantLayers.push({featureset:i,opitem:e,includeGeometry:t,outFields:JSON.stringify(r)}),i}async _loadMetaData(){const e=await ee(this._url,this._lrucache);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new se(this._url,this._overrideSpatialReference,this._lrucache,this._interceptor)}async featureSetByName(e,t=!0,r=null){null===r&&(r=["*"]),r=(r=r.slice()).sort();const i=JSON.stringify(r);for(let r=0;r<this._instantLayers.length;r++){const s=this._instantLayers[r];if(s.opitem.title===e&&s.includeGeometry===t&&s.outFields===i)return this._instantLayers[r].featureset}const s=await this._loadMetaData();let n=null;for(const t of s.layers??[])t.name===e&&(n=t);if(!n)for(const t of s.tables??[])t.name===e&&(n=t);if(n){const e=await K(this._url+"/"+n.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,r)}return null}async featureSetById(e,t=!0,r=["*"]){null===r&&(r=["*"]),r=(r=r.slice()).sort();const i=JSON.stringify(r);e=null!=e?e.toString():"";for(let r=0;r<this._instantLayers.length;r++){const s=this._instantLayers[r];if(s.opitem.id===e&&s.includeGeometry===t&&s.outFields===i)return this._instantLayers[r].featureset}const s=await this._loadMetaData();let n=null;for(const t of s.layers??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(n=t);if(!n)for(const t of s.tables??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(n=t);if(n){const e=await K(this._url+"/"+n.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,r)}return null}}function ne(e,t,r=null,i=null){return new ie(e,t,r,i)}function ae(e,t,r=null,i=null){return new se(e,t,r,i)}function le(e,t,r,i,s){if(null===e)return null;if((0,n.p)(e)){switch(t){case"datasource":return e.getDataSourceFeatureSet();case"parent":return e;case"root":return e.getRootFeatureSet()}return null}if(e instanceof z.A&&(0,f.NI)(e)){const n=e;switch(t){case"datasource":return X(n,s,"outFields"in n?n.outFields:null,!0,r,i).getDataSourceFeatureSet();case"parent":case"root":return X(n,s,"outFields"in n?n.outFields:null,!0,r,i)}return null}if((0,n.$)(e)){switch(t){case"datasource":return X(e.parent,s,e.parent.outFields,!0,r,i).getDataSourceFeatureSet();case"parent":case"root":return X(e,s,e.parent.outFields,!0,r,i)}return null}return null}async function oe(e,t,r,i,s,n,a,l=null){if(V.A.applicationCache){const o=V.A.applicationCache.getLayerInfo(e+":"+n.url);if(o)return ue(await o,t,r,i,s,a,l)}if(null!=a){const o=a.getCachedPortalItem(n.url,e);if(null!=o)return await ue(await o,t,r,i,s,a,l)}const o=new $.default({id:e,portal:n}).load();V.A.applicationCache?V.A.applicationCache.setLayerInfo(e+":"+n.url,o):null!=a&&a.setCachedPortalItem(n.url,e,o);try{return await ue(await o,t,r,i,s,a,l)}catch(t){throw V.A.applicationCache&&V.A.applicationCache.clearLayerInfo(e+":"+n.url),null!=a&&a.removeCachedPortalItem(n.url,e,o),t}}async function ue(e,t,r,i,s,n,a){let l;if("Feature Service"===e.type||"Map Service"===e.type)l=await K((0,f.Qi)(e.url??"")+"/"+t,["*"],n);else{if(t)throw new Error(`layerId=${t} provided for ${e.type} item`);if(null!=n){const t=n.getCachedPortalItemLayer(e.portal.url,e.id);if(null!=t)l=await t;else{const t=z.A.fromPortalItem(e);n.setCachedPortalItemLayer(e.portal.url,e.id,t);try{l=await t}catch(r){throw n.removeCachedPortalItemLayer(e.portal.url,e.id,t),r}}}else l=await z.A.fromPortalItem(e)}return X(l,r,i,s,n,a)}},41366:(e,t,r)=>{r.d(t,{K:()=>h,Q:()=>u});var i=r(90237),s=r(66552),n=r(53966),a=r(10107),l=(r(44208),r(87811),r(93223)),o=r(40608);const u=(0,s.O)()({naturalLog:"natural-log",squareRoot:"square-root",percentOfTotal:"percent-of-total",log:"log",field:"field"}),c="percent-of-total",d="field",h=e=>{let t=class extends e{constructor(){super(...arguments),this.normalizationField=null,this.normalizationMaxValue=null,this.normalizationMinValue=null,this.normalizationTotal=null}get normalizationType(){let e=this._get("normalizationType");const t=!!this.normalizationField,r=null!=this.normalizationTotal;return t||r?(e=t&&d||r&&c||null,t&&r&&n.A.getLogger(this).warn("warning: both normalizationField and normalizationTotal are set!")):e!==d&&e!==c||(e=null),e}set normalizationType(e){this._set("normalizationType",e)}};return(0,i._)([(0,a.MZ)({type:String,json:{name:"parameters.normalizationField",write:!0}})],t.prototype,"normalizationField",void 0),(0,i._)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationMaxValue",write:!0}})],t.prototype,"normalizationMaxValue",void 0),(0,i._)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationMinValue",write:!0}})],t.prototype,"normalizationMinValue",void 0),(0,i._)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationTotal",write:!0}})],t.prototype,"normalizationTotal",void 0),(0,i._)([(0,l.e)(u,{name:"parameters.normalizationType"})],t.prototype,"normalizationType",null),t=(0,i._)([(0,o.$)("esri.rest.support.NormalizationBinParametersMixin")],t),t}},41560:(e,t,r)=>{r.d(t,{Ch:()=>a,mW:()=>n});var i=r(34727),s=r(39516);function n(e,t){return{...t,filterMode:e.mode}}function a(e,t,r){const n=function(e){if("manual"===u(e))return null;const t=[Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY];for(const{minScale:r,maxScale:i}of e.filters)t[0]=Math.max(t[0],c(r)),t[1]=Math.min(t[1],d(i));return t}(e);if(n&&((0,i.gg)(t,n[0])||(0,i.ZH)(r,n[1])))return"";const a=Array.from(l(e,t,r)),o=function(e,t,r){if(0===e.length)return!0;const s=c(e.at(0)?.minScale),n=d(e.at(-1)?.maxScale);if((0,i.ZH)(s,t)||(0,i.gg)(n,r))return!0;for(let t=0;t<e.length-1;t++){const r=e[t],s=e[t+1];if((0,i.ZH)(c(s.minScale),d(r.maxScale)))return!0}return!1}(a,t,r)?"1=1":a.map((e=>e.where||"1=1")).reduce(((e,t)=>(0,s.IW)(e,t)),"");return o&&"1=1"!==o?o:""}function*l(e,t,r){if("manual"===u(e)){const t=e.filters.find((t=>t.id===e.activeFilterId));t&&(yield t)}else{"object"==typeof t&&(t=t.scale);for(const i of e.filters)o(i.minScale,i.maxScale,t,r)&&(yield i)}}function o(e,t,r,s){return e=c(e),r=c(r),t=d(t),!(!(0,i.Sp)(r,e)&&(s??r)>e||(0,i.Hx)(t,r)||void 0!==s&&(0,i.Sp)(s,e))}function u(e){return"mode"in e?e.mode:e.filterMode}function c(e){return e||Number.POSITIVE_INFINITY}function d(e){return e||0}},46140:(e,t,r)=>{r.d(t,{R:()=>s});var i=r(49186);let s=class e{constructor(e,t,r=""){this.major=e,this.minor=t,this._context=r}lessThan(e,t){return this.major<e||e===this.major&&this.minor<t}greaterEqual(e,t){return!this.lessThan(e,t)}validate(e){if(this.major!==e.major){const t=this._context&&this._context+":",r=this._context&&this._context+" ";throw new i.A(t+"unsupported-version",`Required major ${r}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:e})}}clone(){return new e(this.major,this.minor,this._context)}static parse(t,r=""){const[s,n]=t.split("."),a=/^\s*\d+\s*$/;if(!s?.match||!a.test(s))throw new i.A((r&&r+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:t});if(!n?.match||!a.test(n))throw new i.A((r&&r+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:t});const l=parseInt(s,10),o=parseInt(n,10);return new e(l,o,r)}}},54461:(e,t,r)=>{r.d(t,{A:()=>l});var i=r(87449),s=r(11221),n=r(89169),a=r(33325);class l extends s.A{constructor(e){super(e),this._topnum=0,this.declaredClass="esri.arcade.featureset.actions.Top",this._countedin=0,this._maxProcessing=100,this._topnum=e.topnum,this._parent=e.parentfeatureset}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._parent._getSet(e);return this._wset=new n.A(t._candidates.slice(),t._known.slice(),!1,this._clonePageDefinition(t.pagesDefinition)),this._setKnownLength(this._wset)>this._topnum&&(this._wset._known=this._wset._known.slice(0,this._topnum)),this._setKnownLength(this._wset)>=this._topnum&&(this._wset._candidates=[]),this._wset}return this._wset}_setKnownLength(e){return e._known.length>0&&"GETPAGES"===e._known[e._known.length-1]?e._known.length-1:e._known.length}_isInFeatureSet(e){const t=this._parent._isInFeatureSet(e);if(t===a.J6.NotInFeatureSet)return t;const r=this._idstates[e];return r===a.J6.InFeatureSet||r===a.J6.NotInFeatureSet?r:t===a.J6.InFeatureSet&&void 0===r?this._countedin<this._topnum?(this._idstates[e]=a.J6.InFeatureSet,this._countedin++,a.J6.InFeatureSet):(this._idstates[e]=a.J6.NotInFeatureSet,a.J6.NotInFeatureSet):a.J6.Unknown}async _expandPagedSet(e,t,r,s,n){if(null===this._parent)throw new i.dr(i.D_.NotImplemented);if(t>this._topnum&&(t=this._topnum),this._countedin>=this._topnum&&e.pagesDefinition.internal.set.length<=e.pagesDefinition.resultOffset){let t=e._known.length;return t>0&&"GETPAGES"===e._known[t-1]&&(e._known.length=t-1),t=e._candidates.length,t>0&&"GETPAGES"===e._candidates[t-1]&&(e._candidates.length=t-1),"success"}const a=await this._parent._expandPagedSet(e,t,r,s,n);return this._setKnownLength(e)>this._topnum&&(e._known.length=this._topnum),this._setKnownLength(e)>=this._topnum&&(e._candidates.length=0),a}async _getFeatures(e,t,r,i){const s=[],a=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,a))return await this._expandPagedSet(e,a,0,0,i),this._getFeatures(e,t,r,i);-1!==t&&void 0===this._featureCache[t]&&s.push(t);let l=0;for(let i=e._lastFetchedIndex;i<e._known.length&&(l++,l<=r&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[i]]&&(e._known[i]!==t&&s.push(e._known[i]),s.length>a)));i++);if(0===s.length)return"success";const o=new n.A([],s,!1,null),u=Math.min(s.length,r);await this._parent._getFeatures(o,-1,u,i);for(let e=0;e<u;e++){const t=this._parent._featureFromCache(s[e]);void 0!==t&&(this._featureCache[s[e]]=t)}return"success"}async _getFilteredSet(e,t,r,i,s){await this._ensureLoaded();const a=await this._getSet(s);return new n.A(a._candidates.slice().concat(a._known.slice()),[],!1,this._clonePageDefinition(a.pagesDefinition))}_refineKnowns(e,t){let r=0,i=null;const s=[];for(let n=0;n<e._candidates.length;n++){const l=this._isInFeatureSet(e._candidates[n]);if(l===a.J6.InFeatureSet){if(e._known.push(e._candidates[n]),r+=1,null===i?i={start:n,end:n}:i.end===n-1?i.end=n:(s.push(i),i={start:n,end:n}),e._known.length>=this._topnum)break}else if(l===a.J6.NotInFeatureSet)null===i?i={start:n,end:n}:i.end===n-1?i.end=n:(s.push(i),i={start:n,end:n}),r+=1;else if(l===a.J6.Unknown)break;if(r>=t)break}null!==i&&s.push(i);for(let t=s.length-1;t>=0;t--)e._candidates.splice(s[t].start,s[t].end-s[t].start+1);this._setKnownLength(e)>this._topnum&&(e._known=e._known.slice(0,this._topnum)),this._setKnownLength(e)>=this._topnum&&(e._candidates=[])}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}static registerAction(){s.A._featuresetFunctions.top=function(e){return new l({parentfeatureset:this,topnum:e})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},55674:(e,t,r)=>{r.d(t,{Ad:()=>p,Gj:()=>_,QY:()=>h,lL:()=>g,xR:()=>f});var i=r(66131),s=r(49186),n=(r(44208),r(44729)),a=r(15032),l=r(65864),o=r(95466),u=r(43668),c=r(98623);const d=["geometry","scale","timeProperties"];function h(e,t){if(null!=t)for(const r of d)t.hasArcadeDependency(r)&&e.add(r);return e}function p(e,t){return y.create(e,t,null,["$feature","$view"])}function f(e,t,r){return y.create(e,t,r,["$feature","$view","$config"])}class y{static async create(e,t,r,i){const{arcade:n,Dictionary:a}=await(0,u.l)();let l;try{l=n.parseScript(e)}catch(t){throw new s.A("arcade-bad-expression","Failed to parse arcade script",{script:e,error:t})}const o=n.scriptUsesGeometryEngine(l);o&&await n.enableGeometrySupport(),await n.loadDependentModules(new Set,l,null,!1,o);const c={vars:i.reduce(((e,t)=>({...e,[t]:null})),{}),spatialReference:t,useAsync:!1},d=n.compileScript(l,c);let h=null;null!=r&&(h=new a(r),h.immutable=!0);const p=new a;return p.immutable=!1,p.setField("scale",0),new y(e,n,l,d,t,p,h,a)}constructor(e,t,r,i,s,n,a,l){this.script=e,this._arcade=t,this._syntaxTree=r,this._compiled=i,this._spatialReference=s,this._viewDict=n,this._configDict=a,this._dictionaryCtor=l,this._dependencies=new Map,this._featureReader=new _,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 r=t.$view?.timeZone;if(t.$view){let e;if(this._viewDict.setField("scale",t.$view.scale),null!=t.$view.timeProperties){const{currentStart:s,currentEnd:n}=t.$view.timeProperties;e=new this._dictionaryCtor({currentStart:null!=s?null!=r?i.lY.epochToArcadeDate(s,r):i.lY.unknownEpochToArcadeDate(s):void 0,currentEnd:null!=n?null!=r?i.lY.epochToArcadeDate(n,r):i.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:r})}repurposeFeature(e,t){return this._featureReader.bind(e,t,this._spatialReference),this._featureReader}references(e){return this._dependencies.get(e)??!1}}class _{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,r){const i=t??new o.A(g(e.attributes));this._boundTarget=e,this._boundSchema.fields=i.fields,this._boundSchema.fieldsIndex=i,this._boundSchema.spatialReference=r}_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,l.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}isUnknownDateTimeField(e){return this._boundSchema.fieldsIndex.getTimeZone(e)===c.L5}field(e,t=!0){const r=this._getField(e);if(r)switch(r.type){case"date-only":case"esriFieldTypeDateOnly":return n.n.fromReader(this._boundTarget.attributes[r.name]);case"time-only":case"esriFieldTypeTimeOnly":return a.k.fromReader(this._boundTarget.attributes[r.name]);case"esriFieldTypeTimestampOffset":case"timestamp-offset":return i.lY.fromReaderAsTimeStampOffset(this._boundTarget.attributes[r.name]);case"date":case"esriFieldTypeDate":{const t=this._boundTarget.attributes[r.name];return this.isUnknownDateTimeField(e)?i.lY.unknownEpochToArcadeDate(t):i.lY.epochToArcadeDate(t,this.contextTimeZone??c.qU)}default:return this._boundTarget.attributes[r.name]}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))}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 g(e){const t=[];for(const r in e)t.push({name:r,alias:r,type:"string"==typeof e[r]?"esriFieldTypeString":"esriFieldTypeDouble"});return t}},58501:(e,t,r)=>{r.d(t,{q:()=>s});var i=r(62815);function s(e,t,r){if(!r?.features||!r.hasZ)return;const s=(0,i.N)(r.geometryType,t,e.outSpatialReference);if(null!=s)for(const e of r.features)s(e.geometry)}},60999:(e,t,r)=>{r.d(t,{DZ:()=>f,Ke:()=>p,Tj:()=>c,UT:()=>y,jJ:()=>u});var i=r(90237),s=r(69622),n=r(97768),a=r(74887),l=r(10107),o=r(40608);function u(e,t,r){return(0,a.Lx)(e.map(((e,i)=>t.apply(r,[e,i]))))}async function c(e,t,r){return(await(0,a.Lx)(e.map(((e,i)=>t.apply(r,[e,i]))))).map((e=>e.value))}function d(e){return{ok:!0,value:e}}function h(e){return{ok:!1,error:e}}async function p(e){if(null==e)return{ok:!1,error:new Error("no promise provided")};try{return d(await e)}catch(e){return h(e)}}async function f(e){try{return d(await e)}catch(e){return(0,a.QP)(e),h(e)}}function y(e,t){return new _(e,t)}let _=class extends s.A{get value(){return null!=(e=this._result)&&!0===e.ok?e.value:null;var e}get error(){return null!=(e=this._result)&&!1===e.ok?e.error:null;var e}get finished(){return null!=this._result}constructor(e,t){super({}),this._result=null,this._abortHandle=null,this.abort=()=>{this._abortController=(0,n.DC)(this._abortController)},this.remove=this.abort,this._abortController=new AbortController;const{signal:r}=this._abortController;this.promise=e(r),this.promise.then((e=>{this._result=d(e),this._cleanup()}),(e=>{this._result=h(e),this._cleanup()})),this._abortHandle=(0,a.u7)(t,this.abort)}normalizeCtorArgs(){return{}}destroy(){this.abort()}_cleanup(){this._abortHandle=(0,n.xt)(this._abortHandle),this._abortController=null}};(0,i._)([(0,l.MZ)()],_.prototype,"value",null),(0,i._)([(0,l.MZ)()],_.prototype,"error",null),(0,i._)([(0,l.MZ)()],_.prototype,"finished",null),(0,i._)([(0,l.MZ)()],_.prototype,"promise",void 0),(0,i._)([(0,l.MZ)()],_.prototype,"_result",void 0),_=(0,i._)([(0,o.$)("esri.core.asyncUtils.ReactiveTask")],_)},68423:(e,t,r)=>{r.d(t,{Gr:()=>m,IO:()=>y,a:()=>w,bV:()=>g,p8:()=>_});var i=r(52106),s=r(78502),n=r(87449),a=r(11221),l=r(89169),o=r(33325),u=r(80609),c=r(97768),d=r(1262),h=r(88368),p=r(16930);class f{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class y extends f{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class _ extends f{constructor(e,t,r){super((0,o.ke)(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=r}rewriteSql(e,t){return{rewritten:this.sqlRewritable,where:(0,u.bD)(e,this.field.name,this.originalField.name,t.getFieldsIndex())}}extractValue(e){return e.attributes[this.originalField.name]}}class g extends f{constructor(e,t,r){super(e),this.codefield=t,this.lkp=r,this.reverseLkp={};for(const e in r)this.reverseLkp[r[e]]=e;this.sqlRewritable=!0}static{this.BADNESS="_!!!_BAD_LKP_!!!!"}rewriteSql(e,t){const r=this.evaluateNodeToWhereClause(e.parseTree,o.zl.Standardised,this.field.name,this.codefield instanceof h.A?(0,u.YY)(this.codefield,o.zl.Standardised):this.codefield,e.parameters);return r.includes(g.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:h.A.create(r,{fieldsIndex:t._parent.getFieldsIndex(),timeZone:t.dateFieldsTimeZoneDefaultUTC})}}evaluateNodeToWhereClause(e,t,r=null,i=null,s){let n,a,l,c;switch(e.type){case"interval":return(0,u.oj)(this.evaluateNodeToWhereClause(e.value,t,r,i,s),e.qualifier,e.op);case"case-expression":{let i=" CASE ";"simple"===e.format&&(i+=this.evaluateNodeToWhereClause(e.operand,t,r,g.BADNESS,s));for(let n=0;n<e.clauses.length;n++)i+=" WHEN "+this.evaluateNodeToWhereClause(e.clauses[n].operand,t,r,g.BADNESS,s)+" THEN "+this.evaluateNodeToWhereClause(e.clauses[n].value,t,r,g.BADNESS,s);return null!==e.else&&(i+=" ELSE "+this.evaluateNodeToWhereClause(e.else,t,r,g.BADNESS,s)),i+=" END ",i}case"parameter":{const r=s[e.value.toLowerCase()];if("string"==typeof r)return"'"+r.toString().replaceAll("'","''")+"'";if((0,o.$P)(r))return(0,u.bm)(r,t);if((0,o.Lk)(r))return(0,u.bm)(r,t);if((0,o.eg)(r))return(0,u.F1)(r,t);if((0,o.rX)(r))return(0,u.R8)(r,t);if((0,o.f0)(r))return(0,u.Nf)(r,t);if(Array.isArray(r)){const e=[];for(let i=0;i<r.length;i++)"string"==typeof r[i]?e.push("'"+r[i].toString().replaceAll("'","''")+"'"):(0,o.$P)(r[i])||(0,o.Lk)(r[i])?e.push((0,u.bm)(r[i],t)):(0,o.eg)(r[i])?e.push((0,u.F1)(r[i],t)):(0,o.rX)(r[i])?e.push((0,u.R8)(r[i],t)):(0,o.f0)(r[i])?e.push((0,u.Nf)(r[i],t)):e.push(r[i].toString());return e}return r.toString()}case"expression-list":a=[];for(const n of e.value)a.push(this.evaluateNodeToWhereClause(n,t,r,i,s));return a;case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,t,r,g.BADNESS,s)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" AND "+this.evaluateNodeToWhereClause(e.right,t,r,i,s)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" OR "+this.evaluateNodeToWhereClause(e.right,t,r,i,s)+") ";case"IS":if("null"!==e.right.type)throw new d.L8(d.Z7.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new d.L8(d.Z7.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IS NOT NULL )";case"IN":if(n=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const n=[];let a=!0;for(const t of e.right.value){if("string"!==t.type){a=!1;break}if(void 0===this.lkp[t.value]){a=!1;break}n.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IN ("+n.join(",")+")) "}return n=this.evaluateNodeToWhereClause(e.right,t,r,i,s)," ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IN ("+n.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,t,r,i,s),Array.isArray(c)?" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IN ("+c+")) ";case"NOT IN":if(n=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const n=[];let a=!0;for(const t of e.right.value){if("string"!==t.type){a=!1;break}if(void 0===this.lkp[t.value]){a=!1;break}n.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" NOT IN ("+n.join(",")+")) "}return n=this.evaluateNodeToWhereClause(e.right,t,r,i,s)," ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" NOT IN ("+n.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,t,r,i,s),Array.isArray(c)?" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" NOT IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" NOT IN ("+c+")) ";case"BETWEEN":return l=this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)," ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" BETWEEN "+l[0]+" AND "+l[1]+" ) ";case"NOTBETWEEN":return l=this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)," ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" NOT BETWEEN "+l[0]+" AND "+l[1]+" ) ";case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+") ";case"<>":case"=":if("column-reference"===e.left.type&&"string"===e.right.type){if(e.left.column.toUpperCase()===this.field.name.toUpperCase()&&void 0!==this.lkp[e.right.value.toString()])return" ("+i+" "+e.operator+" "+this.lkp[e.right.value.toString()].toString()+") "}else if("column-reference"===e.right.type&&"string"===e.left.type&&e.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this.lkp[e.right.value.toString()].toString()+" "+e.operator+" "+i+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+") "}case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replaceAll("'","''")+"'";case"timestamp":return`timestamp '${e.value}'`;case"date":return`date '${e.value}'`;case"time":return`time '${e.value}'`;case"number":return e.value.toString();case"current-time":return(0,u.C6)(e.mode,t);case"current-user":return"CURRENT_USER";case"column-reference":return r&&r.toLowerCase()===e.column.toLowerCase()?"("+i+")":(0,u.Kb)(e.column);case"data-type":return e.value;case"function":{const i=this.evaluateNodeToWhereClause(e.args,t,r,g.BADNESS,s);return(0,u.F6)(e.name,i,t)}}throw new d.L8(d.Z7.UnsupportedSyntax,{node:e.type})}extractValue(e){return this.codefield instanceof h.A?this.reverseLkp[h.A.convertValueToStorageFormat(this.codefield.calculateValueCompiled(e))]:this.reverseLkp[e.attributes[this.codefield]]}}class m extends f{constructor(e,t){super(e),this._sql=t}rewriteSql(e,t){return{rewritten:!0,where:(0,u.bD)(e,this.field.name,(0,u.YY)(this._sql,o.zl.Standardised),t.getFieldsIndex())}}extractValue(e){return h.A.convertValueToStorageFormat(this._sql.calculateValueCompiled(e),this.field.type)}}class w extends a.A{static findField(e,t){for(const r of e)if(r.name.toLowerCase()===t.toString().toLowerCase())return r;return null}constructor(e){super(e),this._calcFunc=null,this.declaredClass="esri.arcade.featureset.actions.Adapted",this.adaptedFields=[],this._extraFilter=null,this._extraFilter=e.extraFilter,this._parent=e.parentfeatureset,this._maxProcessing=30,this.adaptedFields=e.adaptedFields}_initialiseFeatureSet(){null!==this._parent?(this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.spatialReference=new p.A({wkid:4326}),this.objectIdField="",this.globalIdField="",this.geometryType=o.ik.point,this.typeIdField="",this.types=null,this.subtypeField=null,this.subtypes=null),this.fields=[];for(const e of this.adaptedFields)e.postInitialization(this,this._parent),this.fields.push(e.field)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();let t=null;return t=this._extraFilter?await this._getFilteredSet("",null,null,null,e):await(this._parent?._getSet(e)),this._checkCancelled(e),(0,c.Lw)(t),this._wset=new l.A(t._candidates.slice(),t._known.slice(),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}async _getFeatures(e,t,r,n){const a=[];-1!==t&&void 0===this._featureCache[t]&&a.push(t);const o=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,o))return await this._expandPagedSet(e,o,0,0,n),this._getFeatures(e,t,r,n);let u=0;for(let i=e._lastFetchedIndex;i<e._known.length&&(u++,u<=r&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[i]]&&(e._known[i]!==t&&a.push(e._known[i]),a.length>=o)));i++);if(0===a.length)return"success";e=new l.A([],a,e._ordered,null);const c=Math.min(a.length,r);await(this._parent?._getFeatures(e,-1,c,n)),this._checkCancelled(n);const d=[];for(let e=0;e<c;e++){const t=this._parent?._featureFromCache(a[e]);void 0!==t&&d.push({geometry:t.geometry,attributes:t.attributes,id:a[e]})}for(const e of d){const t=[];for(const r of this.adaptedFields)t[r.field.name]=r.extractValue(e);this._featureCache[e.id]=new i.A({attributes:t,geometry:(0,s.Yq)(e.geometry)})}return"success"}async _fetchAndRefineFeatures(){throw new n.dr(n.D_.NeverReach)}async _getFilteredSet(e,t,r,i,s){let n=!1;const a=this._reformulateWithoutAdaptions(r);n=a.cannot,r=a.where;let o=!1;if(null!==i){o=!0;const e=[];for(const t of this.adaptedFields)if(!(t instanceof y)&&!0===i.scanForField(t.field.name)){if(!(t instanceof _)){i=null,o=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}i&&e.length>0&&(i=i.replaceFields(e))}null!==r?null!==this._extraFilter&&(r=(0,u.kg)(this._extraFilter,r)):r=this._extraFilter,await this._ensureLoaded();const c=await this._parent._getFilteredSet(e,t,r,i,s);let d;return this._checkCancelled(s),d=!0===n?new l.A(c._candidates.slice().concat(c._known.slice()),[],!0===o&&c._ordered,this._clonePageDefinition(c.pagesDefinition)):new l.A(c._candidates.slice(),c._known.slice(),!0===o&&c._ordered,this._clonePageDefinition(c.pagesDefinition)),d}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(null!==e)for(const r of this.adaptedFields)if(!0===(0,u.Ju)(e,r.field.name)){const i=r.rewriteSql(e,this);if(!0!==i.rewritten){t.cannot=!0,t.where=null;break}t.where=i.where}return t}async _stat(e,t,r,i,s,n,a){let l=!1,o=this._reformulateWithoutAdaptions(t);if(l=o.cannot,t=o.where,o=this._reformulateWithoutAdaptions(s),l=l||o.cannot,null!==(s=o.where)?null!==this._extraFilter&&(s=(0,u.kg)(this._extraFilter,s)):s=this._extraFilter,!0===l)return null===s&&""===r&&null===i?this._manualStat(e,t,n,a):{calculated:!1};const c=await this._parent._stat(e,t,r,i,s,n,a);return!1===c.calculated?null===s&&""===r&&null===i?this._manualStat(e,t,n,a):{calculated:!1}:c}async _canDoAggregates(e,t,r,i,s){if(null===this._parent)return!1;for(let t=0;t<e.length;t++)for(const r of this.adaptedFields)if(e[t].toLowerCase()===r.field.name.toLowerCase()&&!(r instanceof y))return!1;const n=[];for(let e=0;e<t.length;e++){const r=t[e];if(null!==r.workingexpr){const e=this._reformulateWithoutAdaptions(r.workingexpr);if(e.cannot)return!1;const t=r.clone();t.workingexpr=e.where,n.push(t)}else n.push(r)}const a=this._reformulateWithoutAdaptions(s);return!a.cannot&&(null!==(s=a.where)?null!==this._extraFilter&&(s=(0,u.kg)(this._extraFilter,s)):s=this._extraFilter,this._parent._canDoAggregates(e,n,r,i,s))}async _getAggregatePagesDataSourceDefinition(e,t,r,i,s,a,l){if(null===this._parent)throw new n.dr(n.D_.NeverReach);const o=[];for(let e=0;e<t.length;e++){const r=t[e];if(null!==r.workingexpr){const e=this._reformulateWithoutAdaptions(r.workingexpr);if(e.cannot)throw new n.dr(n.D_.NeverReach);const t=r.clone();t.workingexpr=e.where,o.push(t)}else o.push(r)}const c=this._reformulateWithoutAdaptions(s);if(c.cannot)throw new n.dr(n.D_.NeverReach);return null!==(s=c.where)?null!==this._extraFilter&&(s=(0,u.kg)(this._extraFilter,s)):s=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(e,o,r,i,s,a,l)}}},73681:(e,t,r)=>{r.d(t,{n:()=>o});var i=r(49186),s=r(53966),n=r(46140),a=r(95466),l=r(55674);class o{static async from(e,t,r){const a=e.dictionary_version?n.R.parse(e.dictionary_version):null,c=new Set(e.itemsNames),d={};if(t)for(const e in t)d[e]=t[e];if(e.authoringInfo.configuration)for(const t of e.authoringInfo.configuration)d.hasOwnProperty(t.name)||(d[t.name]=t.value);const h=new Set(e.authoringInfo.symbol);for(const e of Object.keys(r))h.delete(e);h.size&&s.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("missing-fields: fieldMap entries for the following symbol fields are missing",{symbolFields:h});const p=await(0,l.xR)(e.expression,null,d);if(!p)throw new i.A("dictionary-renderer:expression-error","Unable to create dictionary renderer expression");const f=!a||!a.greaterEqual(4,0);f&&s.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("Dictionary script does not support native field types. Applying fallback",{version:a});const y=new u(r,f);return new o(f,c,p,y)}constructor(e,t,r,i){this._requiresFieldCoercionToString=e,this._itemNames=t,this._compiled=r,this._reader=i}get itemNames(){return this._itemNames}evaluate(e,t,r,i){try{return this._reader.bind(e,r,i),this._compiled.evaluate(this._reader,{$view:{scale:t}})}catch(e){s.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("arcade: dictionary script evaluation failed",{error:e})}return null}createDictionaryFieldsIndex(e){if(!this._requiresFieldCoercionToString)return new a.A(e);const t=e.map((e=>({...e,type:"esriFieldTypeString"})));return new a.A(t)}}class u extends l.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?"":""+this._boundTarget.attributes[t.name]}}},77548:(e,t,r)=>{r.d(t,{tk:()=>d,BR:()=>c,wI:()=>u,Ov:()=>l,W_:()=>o,TU:()=>a,XX:()=>n});var i=r(70333),s=r(78888);r(5503),r(36563),r(36708),new WeakMap;const n={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function a(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function l(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function o(e){const t=e?.type;return("feature"===t||"subtype-group"===t||"oriented-imagery"===t)&&"feature-layer"===e?.source?.type}async function u(e,t){const r=i.id?.findServerInfo(e);if(null!=r?.currentVersion)return r.owningSystemUrl||null;const n=e.toLowerCase().indexOf("/rest/services");if(-1===n)return null;const a=`${e.slice(0,n)}/rest/info`,l=null!=t?t.signal:null,{data:o}=await(0,s.A)(a,{query:{f:"json"},responseType:"json",signal:l});return o?.owningSystemUrl||null}function c(e){return function(e){if(!("capabilities"in e))return!1;switch(e.type){case"catalog":case"catalog-footprint":case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"sublayer":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function d(e){return!!function(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}},86691:(e,t,r)=>{r.d(t,{A:()=>o});var i=r(78878),s=r(87449),n=r(11221),a=r(89169),l=r(87594);class o extends n.A{constructor(e){super(e),this._orderbyclause=null,this.declaredClass="esri.arcade.featureset.actions.OrderBy",this._maxProcessing=100,this._orderbyclause=e.orderbyclause,this._parent=e.parentfeatureset}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,this._orderbyclause,e);return this._checkCancelled(e),this._wset=t,this._wset}return this._wset}async manualOrderSet(e,t){const r=await this.getIdColumnDictionary(e,[],-1,t);this._orderbyclause?.order(r);const i=new a.A([],[],!0,null);for(let e=0;e<r.length;e++)i._known.push(r[e].id);return i}async getIdColumnDictionary(e,t,r,s){if(r<e._known.length-1){const n=this._maxQueryRate();if("GETPAGES"===e._known[r+1])return await(0,i.a0)(this._parent._expandPagedSet(e,n,0,0,s)),this.getIdColumnDictionary(e,t,r,s);let a=r+1;const l=[];for(;a<e._known.length&&"GETPAGES"!==e._known[a];)l.push(e._known[a]),a++;r+=l.length;const o=await(0,i.a0)(this._parent._getFeatureBatch(l,s));this._checkCancelled(s);for(const e of o)t.push({id:e.attributes[this.objectIdField],feature:e});return this.getIdColumnDictionary(e,t,r,s)}return e._candidates.length>0?(await(0,i.a0)(this._refineSetBlock(e,this._maxProcessingRate(),s)),this._checkCancelled(s),this.getIdColumnDictionary(e,t,r,s)):t}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}_getFeatures(e,t,r,i){return this._parent._getFeatures(e,t,r,i)}_featureFromCache(e){if(void 0===this._featureCache[e]){const t=this._parent._featureFromCache(e);if(void 0===t)return;return null===t?null:(this._featureCache[e]=t,t)}return this._featureCache[e]}async _fetchAndRefineFeatures(){throw new s.dr(s.D_.NeverReach)}async _getFilteredSet(e,t,r,i,s){await this._ensureLoaded();const n=await this._parent._getFilteredSet(e,t,r,null===i?this._orderbyclause:i,s);this._checkCancelled(s);const l=new a.A(n._candidates.slice(),n._known.slice(),n._ordered,this._clonePageDefinition(n.pagesDefinition));let o=!0;if(n._candidates.length>0&&(o=!1),!1===l._ordered){let e=await this.manualOrderSet(l,s);return!1===o&&(null===t&&null===r||(e=new a.A(e._candidates.slice().concat(e._known.slice()),[],e._ordered,this._clonePageDefinition(e.pagesDefinition)))),e}return l}static registerAction(){n.A._featuresetFunctions.orderBy=function(e){return""===e?this:new o({parentfeatureset:this,orderbyclause:new l.A(e)})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},87594:(e,t,r)=>{function i(e,t){return e===t?0:null===e?-1:null===t?1:e<t?-1:1}r.d(t,{A:()=>s});class s{constructor(e){const t=e.split(",");this._fields=[],this._directions=[];for(let e=0;e<t.length;e++){const r=t[e].match(/\S+/g);this._fields.push(r[0]),2===r.length?"asc"===r[1].toLowerCase()?this._directions.push(1):this._directions.push(0):this._directions.push(1)}}constructClause(){let e="";for(let t=0;t<this._fields.length;t++)0!==t&&(e+=","),e+=this._fields[t],1===this._directions[t]?e+=" ASC":e+=" DESC";return e}order(e){e.sort(((e,t)=>{for(let r=0;r<this._fields.length;r++){const s=this.featureValue(e.feature,this._fields[r],r),n=this.featureValue(t.feature,this._fields[r],r);let a=0;if(a=1===this._directions[r]?i(s,n):-1*i(s,n),0!==a)return a}return 0}))}scanForField(e){for(let t=0;t<this._fields.length;t++)if(this._fields[t].toLowerCase().trim()===e.toLowerCase().trim())return!0;return!1}replaceFields(e){let t="";for(let r=0;r<this._fields.length;r++){0!==r&&(t+=",");let i=this._fields[r];for(const t of e)if(i.toLowerCase()===t.field.toLowerCase()){i=t.newfield;break}t+=i,1===this._directions[r]?t+=" ASC":t+=" DESC"}return new s(t)}featureValue(e,t,r){const i=e.attributes[t];if(void 0!==i)return i;for(const i in e.attributes)if(t.toLowerCase()===i.toLowerCase())return this._fields[r]=i,e.attributes[i];return null}}},91880:(e,t,r)=>{r.d(t,{A:()=>c});var i,s=r(90237),n=r(66552),a=r(25482),l=r(10107),o=(r(44208),r(53966),r(87811),r(40608));const u=new n.J({asc:"ascending",desc:"descending"});let c=class extends a.A{static{i=this}constructor(e){super(e),this.field=null,this.valueExpression=null,this.order="ascending"}clone(){return new i({field:this.field,valueExpression:this.valueExpression,order:this.order})}};(0,s._)([(0,l.MZ)({type:String,json:{write:!0}})],c.prototype,"field",void 0),(0,s._)([(0,l.MZ)({type:String,json:{write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],c.prototype,"valueExpression",void 0),(0,s._)([(0,l.MZ)({type:u.apiValues,json:{type:u.jsonValues,read:u.read,write:u.write}})],c.prototype,"order",void 0),c=i=(0,s._)([(0,o.$)("esri.layers.support.OrderByInfo")],c)},92935:(e,t,r)=>{var i;r.d(t,{X:()=>i}),function(e){e[e.SAVE=0]="SAVE",e[e.SAVE_AS=1]="SAVE_AS"}(i||(i={}))}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1806],{2073:(e,t,r)=>{r.d(t,{$n:()=>A,$r:()=>m,EM:()=>f,Ec:()=>N,JJ:()=>h,Mm:()=>M,OC:()=>R,Sr:()=>p,UO:()=>a,Vj:()=>G,WU:()=>E,Y8:()=>s,Z7:()=>l,_6:()=>v,aJ:()=>u,dd:()=>b,dn:()=>d,et:()=>S,fe:()=>w,gD:()=>T,hE:()=>c,hY:()=>o,iM:()=>_,mt:()=>g,ow:()=>y,vS:()=>P});var n=r(66552);const i={esriCentimeters:"centimeters",esriDecimalDegrees:"decimal-degrees",esriDecimeters:"decimeters",esriFeet:"feet",esriInches:"inches",esriKilometers:"kilometers",esriMeters:"meters",esriMiles:"miles",esriMillimeters:"millimeters",esriNauticalMiles:"nautical-miles",esriPoints:"points",esriUnknownUnits:"unknown",esriYards:"yards"},o=(0,n.O)()(i),s=(0,n.O)()({...i,esriIntFeet:"international-feet",esriIntInches:"international-inches",esriIntMiles:"international-miles",esriIntNauticalMiles:"international-nautical-miles",esriIntYards:"international-yards"}),a=(0,n.O)()({esriAcres:"international-acres",esriAcresUS:"us-acres",esriAres:"ares",esriHectares:"hectares",esriSquareCentimeters:"square-centimeters",esriSquareDecimeters:"square-decimeters",esriSquareFeet:"square-international-feet",esriSquareFeetUS:"square-us-feet",esriSquareInches:"square-international-inches",esriSquareInchesUS:"square-us-inches",esriSquareKilometers:"square-kilometers",esriSquareMeters:"square-meters",esriSquareMiles:"square-international-miles",esriSquareMilesUS:"square-us-miles",esriSquareMillimeters:"square-millimeters",esriSquareYards:"square-international-yards",esriSquareYardsUS:"square-us-yards",esriUnknownAreaUnits:"unknown"}),l=(0,n.O)()({esriNAUCentimeters:"centimeters",esriNAUDecimalDegrees:"decimal-degrees",esriNAUDecimeters:"decimeters",esriNAUFeet:"feet",esriNAUInches:"inches",esriNAUKilometers:"kilometers",esriNAUMeters:"meters",esriNAUMiles:"miles",esriNAUMillimeters:"millimeters",esriNAUNauticalMiles:"nautical-miles",esriNAUPoints:"points",esriNAUYards:"yards"}),d=(0,n.O)()({esriNAUCentimeters:"centimeters",esriNAUDecimalDegrees:"decimal-degrees",esriNAUDecimeters:"decimeters",esriNAUFeet:"feet",esriNAUInches:"inches",esriNAUKilometers:"kilometers",esriNAUMeters:"meters",esriNAUMiles:"miles",esriNAUMillimeters:"millimeters",esriNAUNauticalMiles:"nautical-miles",esriNAUPoints:"points",esriNAUYards:"yards",esriNAUDays:"days",esriNAUHours:"hours",esriNAUMinutes:"minutes",esriNAUSeconds:"seconds",esriNAUKilometersPerHour:"kilometers-per-hour",esriNAUMilesPerHour:"miles-per-hour",esriNAUUnknown:"unknown"}),u=(0,n.O)()({esriDOTComplete:"complete",esriDOTCompleteNoEvents:"complete-no-events",esriDOTFeatureSets:"featuresets",esriDOTInstructionsOnly:"instructions-only",esriDOTStandard:"standard",esriDOTSummaryOnly:"summary-only"}),p=(0,n.O)()({esriNAOutputLineNone:"none",esriNAOutputLineStraight:"straight",esriNAOutputLineTrueShape:"true-shape",esriNAOutputLineTrueShapeWithMeasure:"true-shape-with-measure"}),c=((0,n.O)()({esriNAOutputPolygonNone:"none",esriNAOutputPolygonSimplified:"simplified",esriNAOutputPolygonDetailed:"detailed"}),(0,n.O)()({esriNFSBAllowBacktrack:"allow-backtrack",esriNFSBAtDeadEndsOnly:"at-dead-ends-only",esriNFSBNoBacktrack:"no-backtrack",esriNFSBAtDeadEndsAndIntersections:"at-dead-ends-and-intersections"})),y=((0,n.O)()({esriNATravelDirectionFromFacility:"from-facility",esriNATravelDirectionToFacility:"to-facility"}),(0,n.O)()({esriNATimeOfDayNotUsed:"not-used",esriNATimeOfDayUseAsStartTime:"start",esriNATimeOfDayUseAsEndTime:"end"}),(0,n.O)()({AUTOMOBILE:"automobile",TRUCK:"truck",WALK:"walk",OTHER:"other"})),h=(0,n.O)()({0:"either-side-of-vehicle",1:"right-side-of-vehicle",2:"left-side-of-vehicle",3:"no-u-turn"},{useNumericKeys:!0}),f=(0,n.O)()({0:"stop",1:"waypoint",2:"break"},{useNumericKeys:!0}),m=(0,n.O)()({0:"ok",1:"not-located",2:"network-element-not-located",3:"element-not-traversable",4:"invalid-field-values",5:"not-reached",6:"time-window-violation",7:"not-located-on-closest"},{useNumericKeys:!0}),g=(0,n.O)()({1:"right",2:"left"},{useNumericKeys:!0}),_=(0,n.O)()({0:"restriction",1:"scaled-cost",2:"added-cost"},{useNumericKeys:!0}),w=(0,n.O)()({0:"permit",1:"restrict"},{useNumericKeys:!0}),v=(0,n.O)()({1:"header",50:"arrive",51:"depart",52:"straight",100:"on-ferry",101:"off-ferry",102:"central-fork",103:"roundabout",104:"u-turn",150:"door",151:"stairs",152:"elevator",153:"escalator",154:"pedestrian-ramp",200:"left-fork",201:"left-ramp",202:"clockwise-roundabout",203:"left-handed-u-turn",204:"bear-left",205:"left-turn",206:"sharp-left",207:"left-turn-and-immediate-left-turn",208:"left-turn-and-immediate-right-turn",300:"right-fork",301:"right-ramp",302:"counter-clockwise-roundabout",303:"right-handed-u-turn",304:"bear-right",305:"right-turn",306:"sharp-right",307:"right-turn-and-immediate-left-turn",308:"right-turn-and-immediate-right-turn",400:"up-elevator",401:"up-escalator",402:"up-stairs",500:"down-elevator",501:"down-escalator",502:"down-stairs",1e3:"general-event",1001:"landmark",1002:"time-zone-change",1003:"traffic-event",1004:"scaled-cost-barrier-event",1005:"boundary-crossing",1006:"restriction-violation",1007:"lane"},{useNumericKeys:!0}),T=(0,n.O)()({0:"unknown",1:"segment",2:"maneuver-segment",3:"restriction-violation",4:"scaled-cost-barrier",5:"heavy-traffic",6:"slow-traffic",7:"moderate-traffic"},{useNumericKeys:!0}),A=(0,n.O)()({"NA Campus":"campus","NA Desktop":"desktop","NA Navigation":"navigation"}),b=(0,n.O)()({Kilometers:"kilometers",Miles:"miles",Meters:"meters"},{ignoreUnknown:!1}),M=(0,n.O)()({Minutes:"minutes",TimeAt1KPH:"time-at-1-kph",TravelTime:"travel-time",TruckMinutes:"truck-minutes",TruckTravelTime:"truck-travel-time",WalkTime:"walk-time"},{ignoreUnknown:!1}),S=(0,n.O)()({Kilometers:"kilometers",Miles:"miles",Meters:"meters",Minutes:"minutes",TimeAt1KPH:"time-at-1-kph",TravelTime:"travel-time",TruckMinutes:"truck-minutes",TruckTravelTime:"truck-travel-time",WalkTime:"walk-time"},{ignoreUnknown:!1}),R=(0,n.O)()({"Any Hazmat Prohibited":"any-hazmat-prohibited","Avoid Carpool Roads":"avoid-carpool-roads","Avoid Express Lanes":"avoid-express-lanes","Avoid Ferries":"avoid-ferries","Avoid Gates":"avoid-gates","Avoid Limited Access Roads":"avoid-limited-access-roads","Avoid Private Roads":"avoid-private-roads","Avoid Roads Unsuitable for Pedestrians":"avoid-roads-unsuitable-for-pedestrians","Avoid Stairways":"avoid-stairways","Avoid Toll Roads":"avoid-toll-roads","Avoid Toll Roads for Trucks":"avoid-toll-roads-for-trucks","Avoid Truck Restricted Roads":"avoid-truck-restricted-roads","Avoid Unpaved Roads":"avoid-unpaved-roads","Axle Count Restriction":"axle-count-restriction","Driving a Bus":"driving-a-bus","Driving a Taxi":"driving-a-taxi","Driving a Truck":"driving-a-truck","Driving an Automobile":"driving-an-automobile","Driving an Emergency Vehicle":"driving-an-emergency-vehicle","Height Restriction":"height-restriction","Kingpin to Rear Axle Length Restriction":"kingpin-to-rear-axle-length-restriction","Length Restriction":"length-restriction","Preferred for Pedestrians":"preferred-for-pedestrians","Riding a Motorcycle":"riding-a-motorcycle","Roads Under Construction Prohibited":"roads-under-construction-prohibited","Semi or Tractor with One or More Trailers Prohibited":"semi-or-tractor-with-one-or-more-trailers-prohibited","Single Axle Vehicles Prohibited":"single-axle-vehicles-prohibited","Tandem Axle Vehicles Prohibited":"tandem-axle-vehicles-prohibited","Through Traffic Prohibited":"through-traffic-prohibited","Truck with Trailers Restriction":"truck-with-trailers-restriction","Use Preferred Hazmat Routes":"use-preferred-hazmat-routes","Use Preferred Truck Routes":"use-preferred-truck-routes",Walking:"walking","Weight Restriction":"weight-restriction"},{ignoreUnknown:!1}),P=(0,n.O)()({esriSpatialRelIntersects:"intersects",esriSpatialRelContains:"contains",esriSpatialRelCrosses:"crosses",esriSpatialRelEnvelopeIntersects:"envelope-intersects",esriSpatialRelIndexIntersects:"index-intersects",esriSpatialRelOverlaps:"overlaps",esriSpatialRelTouches:"touches",esriSpatialRelWithin:"within",esriSpatialRelRelation:"relation"}),G=(0,n.O)()({esriGeometryPoint:"point",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"envelope",esriGeometryMultipoint:"multipoint"}),E=(0,n.O)()({esriNAUTCost:"cost",esriNAUTDescriptor:"descriptor",esriNAUTRestriction:"restriction",esriNAUTHierarchy:"hierarchy"}),N=(0,n.O)()({esriDSTAltName:"alt-name",esriDSTArrive:"arrive",esriDSTBranch:"branch",esriDSTCrossStreet:"cross-street",esriDSTCumulativeLength:"cumulative-length",esriDSTDepart:"depart",esriDSTEstimatedArrivalTime:"estimated-arrival-time",esriDSTExit:"exit",esriDSTGeneral:"general",esriDSTLength:"length",esriDSTServiceTime:"service-time",esriDSTStreetName:"street-name",esriDSTSummary:"summary",esriDSTTime:"time",esriDSTTimeWindow:"time-window",esriDSTToward:"toward",esriDSTViolationTime:"violation-time",esriDSTWaitTime:"wait-time"})},22671:(e,t,r)=>{r.d(t,{A:()=>_});var n,i=r(90237),o=r(52106),s=r(66552),a=r(25482),l=r(4718),d=r(10107),u=(r(44208),r(53966),r(36005)),p=r(40608),c=r(43937),y=r(16930),h=r(65864),f=r(50498),m=r(20437);const g=new s.J({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let _=n=class extends a.A{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){return this.readFeaturesWithClass(e,t,o.A)}writeGeometryType(e,t,r,n){if(e)return void g.write(e,t,r,n);const{features:i}=this;if(i)for(const e of i)if(null!=e?.geometry)return void g.write(e.geometry.type,t,r,n)}readQueryGeometry(e,t){if(!e)return null;const r=!!e.spatialReference,n=(0,h.rS)(e);return n&&!r&&t.spatialReference&&(n.spatialReference=y.A.fromJSON(t.spatialReference)),n}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:r}=this;if(r)for(const e of r)if(e&&null!=e.geometry&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new n(this.cloneProperties())}cloneProperties(){return(0,l.o8)({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let r=0;r<t.features.length;r++){const n=t.features[r];if(n.geometry){const t=e?.[r];n.geometry=t?.toJSON()||n.geometry}}return t}quantize(e){const{scale:[t,r],translate:[n,i]}=e,o=this.features,s=this._getQuantizationFunction(this.geometryType,(e=>Math.round((e-n)/t)),(e=>Math.round((i-e)/r)));for(let e=0,t=o.length;e<t;e++)s?.(o[e].geometry)||(o.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:r}=this;if(!r)return this;const{translate:[n,i],scale:[o,s]}=r;let a=null,l=null;if(this.hasZ&&null!=r?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=r;a=r=>r*t+e}if(this.hasM&&null!=r?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=r;l=r=>null==r?r:r*t+e}const d=this._getHydrationFunction(e,(e=>e*o+n),(e=>i-e*s),a,l);for(const{geometry:e}of t)null!=e&&d&&d(e);return this.transform=null,this}readFeaturesWithClass(e,t,r){const n=y.A.fromJSON(t.spatialReference),i=[];for(let t=0;t<e.length;t++){const o=e[t],s=r.fromJSON(o),a=o.geometry?.spatialReference;null==s.geometry||a||(s.geometry.spatialReference=n);const l=o.aggregateGeometries,d=s.aggregateGeometries;if(l&&null!=d)for(const e in d){const t=d[e],r=l[e],i=r?.spatialReference;null==t||i||(t.spatialReference=n)}i.push(s)}return i}_quantizePoints(e,t,r){let n,i;const o=[];for(let s=0,a=e.length;s<a;s++){const a=e[s];if(s>0){const e=t(a[0]),s=r(a[1]);e===n&&s===i||(o.push([e-n,s-i]),n=e,i=s)}else n=t(a[0]),i=r(a[1]),o.push([n,i])}return o.length>0?o:null}_getQuantizationFunction(e,t,r){return"point"===e?e=>(e.x=t(e.x),e.y=r(e.y),e):"polyline"===e||"polygon"===e?e=>{const n=(0,h.Bi)(e)?e.rings:e.paths,i=[];for(let e=0,o=n.length;e<o;e++){const o=n[e],s=this._quantizePoints(o,t,r);s&&i.push(s)}return i.length>0?((0,h.Bi)(e)?e.rings=i:e.paths=i,e):null}:"multipoint"===e?e=>{const n=this._quantizePoints(e.points,t,r);return n&&n.length>0?(e.points=n,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,r,n,i){return"point"===e?e=>{e.x=t(e.x),e.y=r(e.y),n&&(e.z=n(e.z))}:"polyline"===e||"polygon"===e?e=>{const o=(0,h.Bi)(e)?e.rings:e.paths;let s,a;for(let e=0,n=o.length;e<n;e++){const n=o[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];e>0?(s+=i[0],a+=i[1]):(s=i[0],a=i[1]),i[0]=t(s),i[1]=r(a)}}if(n&&i)for(let e=0,t=o.length;e<t;e++){const t=o[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=n(r[2]),r[3]=i(r[3])}}else if(n)for(let e=0,t=o.length;e<t;e++){const t=o[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=n(r[2])}}else if(i)for(let e=0,t=o.length;e<t;e++){const t=o[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=i(r[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=r(e.ymin),e.xmax=t(e.xmax),e.ymax=r(e.ymax),n&&null!=e.zmax&&null!=e.zmin&&(e.zmax=n(e.zmax),e.zmin=n(e.zmin)),i&&null!=e.mmax&&null!=e.mmin&&(e.mmax=i(e.mmax),e.mmin=i(e.mmin))}:"multipoint"===e?e=>{const o=e.points;let s,a;for(let e=0,n=o.length;e<n;e++){const n=o[e];e>0?(s+=n[0],a+=n[1]):(s=n[0],a=n[1]),n[0]=t(s),n[1]=r(a)}if(n&&i)for(let e=0,t=o.length;e<t;e++){const t=o[e];t[2]=n(t[2]),t[3]=i(t[3])}else if(n)for(let e=0,t=o.length;e<t;e++){const t=o[e];t[2]=n(t[2])}else if(i)for(let e=0,t=o.length;e<t;e++){const t=o[e];t[2]=i(t[2])}}:null}};(0,i._)([(0,d.MZ)({type:String,json:{write:!0}})],_.prototype,"displayFieldName",void 0),(0,i._)([(0,d.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],_.prototype,"exceededTransferLimit",void 0),(0,i._)([(0,d.MZ)({type:[o.A],json:{write:!0}})],_.prototype,"features",void 0),(0,i._)([(0,u.w)("features")],_.prototype,"readFeatures",null),(0,i._)([(0,d.MZ)({type:[m.A],json:{write:!0}})],_.prototype,"fields",void 0),(0,i._)([(0,d.MZ)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:g.read}}})],_.prototype,"geometryType",void 0),(0,i._)([(0,c.K)("geometryType")],_.prototype,"writeGeometryType",null),(0,i._)([(0,d.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],_.prototype,"hasM",void 0),(0,i._)([(0,d.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],_.prototype,"hasZ",void 0),(0,i._)([(0,d.MZ)({types:f.yR,json:{write:!0}})],_.prototype,"queryGeometry",void 0),(0,i._)([(0,u.w)("queryGeometry")],_.prototype,"readQueryGeometry",null),(0,i._)([(0,d.MZ)({type:y.A,json:{write:!0}})],_.prototype,"spatialReference",void 0),(0,i._)([(0,c.K)("spatialReference")],_.prototype,"writeSpatialReference",null),(0,i._)([(0,d.MZ)({json:{write:!0}})],_.prototype,"transform",void 0),_=n=(0,i._)([(0,p.$)("esri.rest.support.FeatureSet")],_),_.prototype.toJSON.isDefaultToJSON=!0},35448:(e,t,r)=>{var n,i,o,s,a,l,d;r.d(t,{Eq:()=>n,bV:()=>o,nP:()=>a,r5:()=>i,ti:()=>l,vy:()=>d,wr:()=>s}),function(e){e[e.Regular=0]="Regular",e[e.Provenance=1]="Provenance",e[e.Document=2]="Document"}(n||(n={})),function(e){e[e.esriFieldTypeSmallInteger=0]="esriFieldTypeSmallInteger",e[e.esriFieldTypeInteger=1]="esriFieldTypeInteger",e[e.esriFieldTypeSingle=2]="esriFieldTypeSingle",e[e.esriFieldTypeDouble=3]="esriFieldTypeDouble",e[e.esriFieldTypeString=4]="esriFieldTypeString",e[e.esriFieldTypeDate=5]="esriFieldTypeDate",e[e.esriFieldTypeOID=6]="esriFieldTypeOID",e[e.esriFieldTypeGeometry=7]="esriFieldTypeGeometry",e[e.esriFieldTypeBlob=8]="esriFieldTypeBlob",e[e.esriFieldTypeRaster=9]="esriFieldTypeRaster",e[e.esriFieldTypeGUID=10]="esriFieldTypeGUID",e[e.esriFieldTypeGlobalID=11]="esriFieldTypeGlobalID",e[e.esriFieldTypeXML=12]="esriFieldTypeXML",e[e.esriFieldTypeBigInteger=13]="esriFieldTypeBigInteger",e[e.esriFieldTypeDateOnly=14]="esriFieldTypeDateOnly",e[e.esriFieldTypeTimeOnly=15]="esriFieldTypeTimeOnly",e[e.esriFieldTypeTimestampOffset=16]="esriFieldTypeTimestampOffset"}(i||(i={})),function(e){e[e.esriGeometryNull=0]="esriGeometryNull",e[e.esriGeometryPoint=1]="esriGeometryPoint",e[e.esriGeometryMultipoint=2]="esriGeometryMultipoint",e[e.esriGeometryPolyline=3]="esriGeometryPolyline",e[e.esriGeometryPolygon=4]="esriGeometryPolygon",e[e.esriGeometryEnvelope=5]="esriGeometryEnvelope",e[e.esriGeometryAny=7]="esriGeometryAny",e[e.esriGeometryMultiPatch=9]="esriGeometryMultiPatch"}(o||(o={})),function(e){e[e.esriMethodHintUNSPECIFIED=0]="esriMethodHintUNSPECIFIED",e[e.esriUUIDESRI=1]="esriUUIDESRI",e[e.esriUUIDRFC4122=2]="esriUUIDRFC4122"}(s||(s={})),function(e){e[e.esriTypeUNSPECIFIED=0]="esriTypeUNSPECIFIED",e[e.esriTypeEntity=1]="esriTypeEntity",e[e.esriTypeRelationship=2]="esriTypeRelationship",e[e.esriTypeBoth=4]="esriTypeBoth"}(a||(a={})),function(e){e[e.esriGraphPropertyUNSPECIFIED=0]="esriGraphPropertyUNSPECIFIED",e[e.esriGraphPropertyRegular=1]="esriGraphPropertyRegular",e[e.esriGraphPropertyDocumentName=2]="esriGraphPropertyDocumentName",e[e.esriGraphPropertyDocumentTitle=3]="esriGraphPropertyDocumentTitle",e[e.esriGraphPropertyDocumentUrl=4]="esriGraphPropertyDocumentUrl",e[e.esriGraphPropertyDocumentText=5]="esriGraphPropertyDocumentText",e[e.esriGraphPropertyDocumentKeywords=6]="esriGraphPropertyDocumentKeywords",e[e.esriGraphPropertyDocumentContentType=7]="esriGraphPropertyDocumentContentType",e[e.esriGraphPropertyDocumentMetadata=8]="esriGraphPropertyDocumentMetadata",e[e.esriGraphPropertyDocumentFileExtension=9]="esriGraphPropertyDocumentFileExtension",e[e.esriGraphPropertyProvenanceInstanceId=10]="esriGraphPropertyProvenanceInstanceId",e[e.esriGraphPropertyProvenanceSourceType=11]="esriGraphPropertyProvenanceSourceType",e[e.esriGraphPropertyProvenanceSourceName=12]="esriGraphPropertyProvenanceSourceName",e[e.esriGraphPropertyProvenanceSource=13]="esriGraphPropertyProvenanceSource",e[e.esriGraphPropertyProvenanceComment=14]="esriGraphPropertyProvenanceComment",e[e.esriGraphPropertyProvenanceTypeName=15]="esriGraphPropertyProvenanceTypeName",e[e.esriGraphPropertyProvenancePropertyName=16]="esriGraphPropertyProvenancePropertyName"}(l||(l={})),function(e){e[e.esriIdentifierInfoTypeUNSPECIFIED=0]="esriIdentifierInfoTypeUNSPECIFIED",e[e.esriIdentifierInfoTypeDatabaseNative=1]="esriIdentifierInfoTypeDatabaseNative",e[e.esriIdentifierInfoTypeUniformProperty=2]="esriIdentifierInfoTypeUniformProperty"}(d||(d={}))},37807:(e,t,r)=>{r.d(t,{A:()=>u});var n=r(90237),i=r(66552),o=r(25482),s=r(10107),a=(r(44208),r(53966),r(87811),r(40608));const l=new i.J({esriJobMessageTypeInformative:"informative",esriJobMessageTypeProcessDefinition:"process-definition",esriJobMessageTypeProcessStart:"process-start",esriJobMessageTypeProcessStop:"process-stop",esriJobMessageTypeWarning:"warning",esriJobMessageTypeError:"error",esriJobMessageTypeEmpty:"empty",esriJobMessageTypeAbort:"abort"});let d=class extends o.A{constructor(e){super(e),this.description=null,this.type=null}};(0,n._)([(0,s.MZ)({type:String,json:{write:!0}})],d.prototype,"description",void 0),(0,n._)([(0,s.MZ)({type:String,json:{read:l.read,write:l.write}})],d.prototype,"type",void 0),d=(0,n._)([(0,a.$)("esri.rest.support.GPMessage")],d);const u=d},45724:(e,t,r)=>{r.d(t,{I:()=>l});var n=r(2741),i=r(44208);const o="esri/rest/knowledgeGraph/wasmInterface/";let s,a=null;async function l(){const e=a??s;if(e)return e;const t=!!(0,i.A)("wasm-simd");return s=d(t),s}async function d(e){if(e){const{default:e}=await r.e(5367).then(r.bind(r,15367)).then((e=>e.a));return e({locateFile:e=>(0,n.s)(o+e)})}const{default:t}=await r.e(9013).then(r.bind(r,29013)).then((e=>e.a));return t({locateFile:e=>(0,n.s)(o+e)})}},51806:(e,t,r)=>{r.r(t),r.d(t,{_checkAuthentication:()=>Rt,_esriRequestWrapper:()=>St,_fetchWrapper:()=>bt,_getClientDataCacheCopy:()=>ot,_setMaxQueryParsingDurationForTesting:()=>Nt,_submitJobWrapper:()=>Mt,clearClientDataCache:()=>At,clientDataCache:()=>it,executeAddNamedTypes:()=>lt,executeApplyEdits:()=>at,executeDeleteNamedType:()=>dt,executeFindPaths:()=>vt,executeFindPathsAsynchronous:()=>wt,executeQuery:()=>ut,executeQueryStreaming:()=>pt,executeSearch:()=>ct,executeSearchStreaming:()=>yt,fetchAllClientDataKeys:()=>ht,fetchAsynchronousFindPathsResultData:()=>Tt,fetchClientDataAtKeys:()=>ft,fetchKnowledgeGraph:()=>mt,kgRestServices:()=>st,refreshDataModel:()=>gt,refreshServiceDefinition:()=>_t});var n,i=r(70333),o=r(78888),s=r(49186),a=r(53966),l=r(74887),d=r(91075),u=r(16930),p=r(90237),c=r(69622),y=r(10107),h=r(56507),f=(r(44208),r(87811),r(40608)),m=r(5443);let g=n=class extends c.A{constructor(e){super(e),this.outSpatialReference=null,this.processExtent=null,this.processSpatialReference=null,this.returnColumnName=!1,this.returnFeatureCollection=!1,this.returnM=!1,this.returnZ=!1}static from(e){return(0,h.PZ)(n,e)}};(0,p._)([(0,y.MZ)({type:u.A})],g.prototype,"outSpatialReference",void 0),(0,p._)([(0,y.MZ)({type:m.A})],g.prototype,"processExtent",void 0),(0,p._)([(0,y.MZ)({type:u.A})],g.prototype,"processSpatialReference",void 0),(0,p._)([(0,y.MZ)({nonNullable:!0})],g.prototype,"returnColumnName",void 0),(0,p._)([(0,y.MZ)({nonNullable:!0})],g.prototype,"returnFeatureCollection",void 0),(0,p._)([(0,y.MZ)({nonNullable:!0})],g.prototype,"returnM",void 0),(0,p._)([(0,y.MZ)({nonNullable:!0})],g.prototype,"returnZ",void 0),g=n=(0,p._)([(0,f.$)("esri.rest.geoprocessor.GPOptions")],g);var _=r(17136),w=r(20437),v=r(25482);let T=class extends v.A{constructor(){super(...arguments),this.extent=null,this.height=null,this.href=null,this.opacity=1,this.rotation=0,this.scale=null,this.visible=!0,this.width=null}};(0,p._)([(0,y.MZ)({type:m.A})],T.prototype,"extent",void 0),(0,p._)([(0,y.MZ)()],T.prototype,"height",void 0),(0,p._)([(0,y.MZ)()],T.prototype,"href",void 0),(0,p._)([(0,y.MZ)()],T.prototype,"opacity",void 0),(0,p._)([(0,y.MZ)()],T.prototype,"rotation",void 0),(0,p._)([(0,y.MZ)()],T.prototype,"scale",void 0),(0,p._)([(0,y.MZ)()],T.prototype,"visible",void 0),(0,p._)([(0,y.MZ)()],T.prototype,"width",void 0),T=(0,p._)([(0,f.$)("esri.layers.support.MapImage")],T);var A=r(2272),b=r(93223),M=r(2073);let S=class extends v.A{constructor(e){super(e),this.area=0,this.units=null}};(0,p._)([(0,y.MZ)({json:{write:!0}})],S.prototype,"area",void 0),(0,p._)([(0,b.e)(M.UO)],S.prototype,"units",void 0),S=(0,p._)([(0,f.$)("esri.rest.support.ArealUnit")],S);let R=class extends v.A{constructor(e){super(e),this.itemId=null,this.url=null}};(0,p._)([(0,y.MZ)({type:String,json:{read:{source:"itemID"},write:{target:"itemID"}}})],R.prototype,"itemId",void 0),(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],R.prototype,"url",void 0),R=(0,p._)([(0,f.$)("esri.rest.support.DataFile")],R);var P=r(22671);let G=class extends v.A{constructor(e){super(e),this.distance=0,this.units=null}};(0,p._)([(0,y.MZ)({json:{write:!0}})],G.prototype,"distance",void 0),(0,p._)([(0,b.e)(M.Y8)],G.prototype,"units",void 0),G=(0,p._)([(0,f.$)("esri.rest.support.LinearUnit")],G);var E=r(66552);const N="multi-value-",k=new E.J({GPArealUnit:"areal-unit",GPBoolean:"boolean",GPComposite:"composite",GPDataFile:"data-file",GPDate:"date",GPDouble:"double",GPFeatureRecordSetLayer:"feature-record-set-layer",Field:"field",GPLinearUnit:"linear-unit",GPLong:"long",GPRasterData:"raster-data",GPRasterDataLayer:"raster-data-layer",GPRecordSet:"record-set",GPString:"string",GPValueTable:"value-table","GPMultiValue:GPArealUnit":`${N}areal-unit`,"GPMultiValue:GPBoolean":`${N}boolean`,"GPMultiValue:GPComposite":`${N}composite`,"GPMultiValue:GPDataFile":`${N}data-file`,"GPMultiValue:GPDate":`${N}date`,"GPMultiValue:GPDouble":`${N}double`,"GPMultiValue:GPFeatureRecordSetLayer":`${N}feature-record-set-layer`,"GPMultiValue:Field":`${N}field`,"GPMultiValue:GPLinearUnit":`${N}linear-unit`,"GPMultiValue:GPLong":`${N}long`,"GPMultiValue:GPRasterData":`${N}raster-data`,"GPMultiValue:GPRasterDataLayer":`${N}raster-data-layer`,"GPMultiValue:GPRecordSet":`${N}record-set`,"GPMultiValue:GPString":`${N}string`});let D=class extends v.A{constructor(e){super(e),this.dataType=null,this.paramName=null,this.value=null}};(0,p._)([(0,b.e)(k,{ignoreUnknown:!1})],D.prototype,"dataType",void 0),(0,p._)([(0,y.MZ)()],D.prototype,"paramName",void 0),(0,p._)([(0,y.MZ)()],D.prototype,"value",void 0),D=(0,p._)([(0,f.$)("esri.rest.support.ParameterValue")],D);var I=r(36005);let x=class extends v.A{constructor(e){super(e),this.format=null,this.itemId=null,this.type=null,this.url=null}readType(e){return"ImageService"===e?"image-service":null}};async function O(e,t){switch(e){case"areal-unit":return S.fromJSON(t);case"boolean":case"double":case"long":case"string":case"value-table":return t;case"date":return new Date(t);case"data-file":return R.fromJSON(t);case"linear-unit":return G.fromJSON(t);case"feature-record-set-layer":if("url"in t)return R.fromJSON(t);if("layerDefinition"in t){const e=new(0,(await Promise.all([r.e(6131),r.e(8219),r.e(13),r.e(8988),r.e(1214),r.e(9953),r.e(1956),r.e(4796),r.e(3029),r.e(4111),r.e(8506),r.e(3600),r.e(2470)]).then(r.bind(r,13600))).default),{layerDefinition:n,featureSet:i}=t;return e.read({layerDefinition:n,featureSet:i},{origin:"portal-item"}),e.spatialReference=u.A.fromJSON(i.spatialReference??n.spatialReference??n.extent.spatialReference),e}return P.A.fromJSON(t);case"record-set":return"url"in t?R.fromJSON(t):P.A.fromJSON(t);case"raster-data":case"raster-data-layer":return"mapImage"in t?T.fromJSON(t.mapImage):x.fromJSON(t);case"field":return w.A.fromJSON(t)}}async function j(e){const t=k.fromJSON(e.dataType),{paramName:r}=e,n=function(e){return e.startsWith(N)}(t)?await async function(e,t){const r=function(e){return e.replace(N,"")}(e),n="composite"===r?t.map((e=>O(k.fromJSON(e.dataType),e.value))):t.map((e=>O(r,e)));return Promise.all(n)}(t,e.value):await O(t,e.value);return new D({dataType:t,paramName:r,value:n})}function C(e,t,r){for(const t in e){const r=e[t];Array.isArray(r)?e[t]=JSON.stringify(r.map((e=>C({item:e},!0).item))):r instanceof Date&&(e[t]=r.getTime())}return(0,A.lF)(e,t,r)}(0,p._)([(0,y.MZ)()],x.prototype,"format",void 0),(0,p._)([(0,y.MZ)({json:{name:"itemID",write:!0}})],x.prototype,"itemId",void 0),(0,p._)([(0,y.MZ)()],x.prototype,"type",void 0),(0,p._)([(0,I.w)("type")],x.prototype,"readType",null),(0,p._)([(0,y.MZ)({json:{write:!0}})],x.prototype,"url",void 0),x=(0,p._)([(0,f.$)("esri.rest.support.RasterData")],x);var F,Z=r(37807);const U=(0,E.O)()({esriJobCancelled:"job-cancelled",esriJobCancelling:"job-cancelling",esriJobDeleted:"job-deleted",esriJobDeleting:"job-deleting",esriJobTimedOut:"job-timed-out",esriJobExecuting:"job-executing",esriJobFailed:"job-failed",esriJobNew:"job-new",esriJobSubmitted:"job-submitted",esriJobSucceeded:"job-succeeded",esriJobWaiting:"job-waiting"},{ignoreUnknown:!1}),q=1e3;let L=class extends v.A{static{F=this}constructor(e){super(e),this.jobId=null,this.jobStatus=null,this.messages=null,this.progress=null,this.requestOptions=null,this.sourceUrl=null,this._cancelJobTimer=void 0,this._jobCompletionTimer=void 0}async cancelJob(e){const{jobId:t,sourceUrl:r}=this,{path:n}=(0,A.Dl)(r),i={...this.requestOptions,...e,query:{f:"json"}},s=`${n}/jobs/${t}/cancel`,{data:a}=await(0,o.A)(s,i),{messages:d,jobStatus:u,progress:p}=F.fromJSON(a);return this.set({messages:d,jobStatus:u,progress:p}),"job-cancelled"===u?this:new Promise(((t,r)=>{(0,l.u7)(i.signal,(()=>{this.clearCancelJobTimer(),r((0,l.NK)())})),this.clearCancelJobTimer();const n=()=>{this._cancelJobTimer||r((0,l.NK)()),this.checkJobStatus(e).then((({jobStatus:e})=>{switch(e){case"job-cancelling":default:this._cancelJobTimer=setTimeout(n,q);break;case"job-deleted":case"job-deleting":case"job-executing":case"job-failed":case"job-new":case"job-submitted":case"job-succeeded":case"job-timed-out":case"job-waiting":r(this);break;case"job-cancelled":t(this)}})).catch((e=>{r(e)}))};this._cancelJobTimer=setTimeout(n,q)}))}destroy(){clearInterval(this._cancelJobTimer),clearInterval(this._jobCompletionTimer)}async checkJobStatus(e){const{path:t}=(0,A.Dl)(this.sourceUrl),r={...this.requestOptions,...e,query:{f:"json"}},n=`${t}/jobs/${this.jobId}`,{data:i}=await(0,o.A)(n,r),{messages:s,jobStatus:a,progress:l}=F.fromJSON(i);return this.set({messages:s,jobStatus:a,progress:l}),this}async fetchResultData(e,t,r){t=g.from(t||{});const{returnColumnName:n,returnFeatureCollection:i,returnM:s,returnZ:a,outSpatialReference:l}=t,{path:d}=(0,A.Dl)(this.sourceUrl),u=C({returnColumnName:n||null,returnFeatureCollection:i||null,returnM:s||null,returnZ:a||null,outSR:l,returnType:"data",f:"json"},null),p={...this.requestOptions,...r,query:u},c=`${d}/jobs/${this.jobId}/results/${e}`,{data:y}=await(0,o.A)(c,p);return j(y)}async fetchResultImage(e,t,r){const{path:n}=(0,A.Dl)(this.sourceUrl),i=C({...t.toJSON(),f:"json"}),s={...this.requestOptions,...r,query:i},a=`${n}/jobs/${this.jobId}/results/${e}`,{data:l}=await(0,o.A)(a,s);return j(l)}async fetchResultMapImageLayer(){const{path:e}=(0,A.Dl)(this.sourceUrl),t=e.indexOf("/GPServer/"),n=`${e.slice(0,Math.max(0,t))}/MapServer/jobs/${this.jobId}`;return new(0,(await Promise.all([r.e(6131),r.e(8219),r.e(13),r.e(8988),r.e(1214),r.e(1956),r.e(4796),r.e(4111),r.e(364),r.e(4341),r.e(7656),r.e(788)]).then(r.bind(r,7656))).default)({url:n})}async waitForJobCompletion(e={}){const{interval:t=q,signal:r,statusCallback:n}=e;return new Promise(((e,i)=>{(0,l.u7)(r,(()=>{this.clearJobCompletionTimer(),i((0,l.NK)())})),this.clearJobCompletionTimer();const o=()=>{this._jobCompletionTimer||i((0,l.NK)()),this.checkJobStatus().then((({jobStatus:r})=>{switch(r){case"job-succeeded":e(this);break;case"job-executing":case"job-new":case"job-submitted":case"job-waiting":n&&n(this),this._jobCompletionTimer=setTimeout(o,t);break;case"job-cancelled":case"job-cancelling":case"job-deleted":case"job-deleting":case"job-failed":case"job-timed-out":i(this);break;default:this._jobCompletionTimer=setTimeout(o,t)}})).catch((e=>{i(e)}))};this._jobCompletionTimer=setTimeout(o,t)}))}clearCancelJobTimer(){clearTimeout(this._cancelJobTimer),this._cancelJobTimer=void 0}clearJobCompletionTimer(){clearTimeout(this._jobCompletionTimer),this._jobCompletionTimer=void 0}};(0,p._)([(0,y.MZ)()],L.prototype,"jobId",void 0),(0,p._)([(0,b.e)(U,{ignoreUnknown:!1})],L.prototype,"jobStatus",void 0),(0,p._)([(0,y.MZ)({type:[Z.A]})],L.prototype,"messages",void 0),(0,p._)([(0,y.MZ)()],L.prototype,"progress",void 0),(0,p._)([(0,y.MZ)()],L.prototype,"requestOptions",void 0),(0,p._)([(0,y.MZ)({json:{write:!0}})],L.prototype,"sourceUrl",void 0),L=F=(0,p._)([(0,f.$)("esri.rest.support.JobInfo")],L);let z=class extends c.A{constructor(e){super(e),this.headerKeys=[],this.outSpatialReference=null,this.exceededTransferLimit=!1}};(0,p._)([(0,y.MZ)()],z.prototype,"headerKeys",void 0),(0,p._)([(0,y.MZ)()],z.prototype,"outSpatialReference",void 0),(0,p._)([(0,y.MZ)()],z.prototype,"exceededTransferLimit",void 0),z=(0,p._)([(0,f.$)("esri.rest.knowledgeGraph.GraphQueryResultHeader")],z);let J=class extends c.A{constructor(e){super(e),this.resultRows=[],this.resultHeader=new z}};(0,p._)([(0,y.MZ)()],J.prototype,"resultRows",void 0),(0,p._)([(0,y.MZ)()],J.prototype,"resultHeader",void 0),J=(0,p._)([(0,f.$)("esri.rest.knowledgeGraph.GraphQueryResult")],J);let K=class extends c.A{constructor(e){super(e),this.resultRowsStream=new ReadableStream,this.resultHeader=new z}};(0,p._)([(0,y.MZ)()],K.prototype,"resultRowsStream",void 0),(0,p._)([(0,y.MZ)()],K.prototype,"resultHeader",void 0),K=(0,p._)([(0,f.$)("esri.rest.knowledgeGraph.GraphQueryStreamingResult")],K);let $=class extends v.A{constructor(e){super(e),this.name=null,this.unique=null,this.ascending=!0,this.description="",this.fieldNames=[]}};(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],$.prototype,"name",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],$.prototype,"unique",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],$.prototype,"ascending",void 0),(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],$.prototype,"description",void 0),(0,p._)([(0,y.MZ)({type:[String],json:{write:!0}})],$.prototype,"fieldNames",void 0),$=(0,p._)([(0,f.$)("esri.rest.knowledgeGraph.FieldIndex")],$);let B=class extends v.A{constructor(e){super(e),this.name=null,this.alias=null,this.fieldType=null,this.geometryType=null,this.hasM=null,this.hasZ=null,this.nullable=null,this.editable=!0,this.required=!1,this.defaultVisibility=!0,this.systemMaintained=null,this.role="esriGraphPropertyUNSPECIFIED",this.defaultValue=null}};(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],B.prototype,"name",void 0),(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],B.prototype,"alias",void 0),(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],B.prototype,"fieldType",void 0),(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],B.prototype,"geometryType",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],B.prototype,"hasM",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],B.prototype,"hasZ",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],B.prototype,"nullable",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],B.prototype,"editable",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],B.prototype,"required",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],B.prototype,"defaultVisibility",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],B.prototype,"systemMaintained",void 0),(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],B.prototype,"role",void 0),(0,p._)([(0,y.MZ)({json:{write:!0}})],B.prototype,"defaultValue",void 0),B=(0,p._)([(0,f.$)("esri.rest.knowledgeGraph.GraphProperty")],B);let V=class extends v.A{constructor(e){super(e),this.name=null,this.alias=null,this.role="Regular",this.strict=null,this.properties=[],this.fieldIndexes=[],this.type=null}};(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],V.prototype,"name",void 0),(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],V.prototype,"alias",void 0),(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],V.prototype,"role",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],V.prototype,"strict",void 0),(0,p._)([(0,y.MZ)({type:[B],json:{write:!0}})],V.prototype,"properties",void 0),(0,p._)([(0,y.MZ)({type:[$],json:{write:!0}})],V.prototype,"fieldIndexes",void 0),V=(0,p._)([(0,f.$)("esri.rest.knowledgeGraph.GraphObjectType")],V);let Y=class extends V{constructor(e){super(e),this.type="entity"}};Y=(0,p._)([(0,f.$)("esri.rest.knowledgeGraph.EntityType")],Y);let H=class extends V{constructor(e){super(e),this.endPoints=[],this.type="relationship"}};(0,p._)([(0,y.MZ)({json:{write:!0}})],H.prototype,"endPoints",void 0),H=(0,p._)([(0,f.$)("esri.rest.knowledgeGraph.RelationshipType")],H);let Q=class extends v.A{constructor(e){super(e),this.value=null,this.behavior=null}};(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],Q.prototype,"value",void 0),(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],Q.prototype,"behavior",void 0),Q=(0,p._)([(0,f.$)("esri.rest.knowledgeGraph.SourceTypeValueBehavior")],Q);let W=class extends v.A{constructor(e){super(e),this.timestamp=null,this.spatialReference=null,this.strict=null,this.objectIdField=null,this.globalIdField=null,this.arcgisManaged=null,this.identifierInfo=null,this.searchIndexes=[],this.entityTypes=[],this.relationshipTypes=[],this.metaEntityTypes=[],this.provenanceSourceTypeValues=[]}};(0,p._)([(0,y.MZ)({type:Date,json:{type:Number,write:{writer:(e,t)=>{t.timestamp=e?.getTime()}}}})],W.prototype,"timestamp",void 0),(0,p._)([(0,y.MZ)({type:u.A,json:{write:!0}})],W.prototype,"spatialReference",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],W.prototype,"strict",void 0),(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],W.prototype,"objectIdField",void 0),(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],W.prototype,"globalIdField",void 0),(0,p._)([(0,y.MZ)()],W.prototype,"arcgisManaged",void 0),(0,p._)([(0,y.MZ)()],W.prototype,"identifierInfo",void 0),(0,p._)([(0,y.MZ)()],W.prototype,"searchIndexes",void 0),(0,p._)([(0,y.MZ)({type:[Y],json:{write:!0}})],W.prototype,"entityTypes",void 0),(0,p._)([(0,y.MZ)({type:[H],json:{write:!0}})],W.prototype,"relationshipTypes",void 0),(0,p._)([(0,y.MZ)({type:[Y],json:{write:!0}})],W.prototype,"metaEntityTypes",void 0),(0,p._)([(0,y.MZ)({type:[Q],json:{write:!0}})],W.prototype,"provenanceSourceTypeValues",void 0),W=(0,p._)([(0,f.$)("esri.rest.knowledgeGraph.DataModel")],W);let X=class extends v.A{constructor(e){super(e),this.capabilities=[],this.supportsSearch=!1,this.supportedQueryFormats=[],this.allowGeometryUpdates=!1,this.searchMaxRecordCount=null,this.serviceCapabilities=null,this.maxRecordCount=null,this.description="",this.copyrightText="",this.units="",this.spatialReference=null,this.currentVersion=null,this.dateFieldsTimeReference=null,this.serviceItemId="",this.supportsDocuments=!1,this.dataEditingNotSupported=!1,this.schemaEditingNotSupported=!1,this.supportsProvenance=!1}};(0,p._)([(0,y.MZ)({type:[String],json:{write:!0}})],X.prototype,"capabilities",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],X.prototype,"supportsSearch",void 0),(0,p._)([(0,y.MZ)({type:[String],json:{write:!0}})],X.prototype,"supportedQueryFormats",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],X.prototype,"allowGeometryUpdates",void 0),(0,p._)([(0,y.MZ)({type:Number,json:{write:!0}})],X.prototype,"searchMaxRecordCount",void 0),(0,p._)([(0,y.MZ)({type:Object,json:{write:!0}})],X.prototype,"serviceCapabilities",void 0),(0,p._)([(0,y.MZ)({type:Number,json:{write:!0}})],X.prototype,"maxRecordCount",void 0),(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],X.prototype,"description",void 0),(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],X.prototype,"copyrightText",void 0),(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],X.prototype,"units",void 0),(0,p._)([(0,y.MZ)({type:u.A,json:{write:!0}})],X.prototype,"spatialReference",void 0),(0,p._)([(0,y.MZ)({type:Number,json:{write:!0}})],X.prototype,"currentVersion",void 0),(0,p._)([(0,y.MZ)({type:Object,json:{write:!0}})],X.prototype,"dateFieldsTimeReference",void 0),(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],X.prototype,"serviceItemId",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],X.prototype,"supportsDocuments",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],X.prototype,"dataEditingNotSupported",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],X.prototype,"schemaEditingNotSupported",void 0),(0,p._)([(0,y.MZ)({type:Boolean,json:{write:!0}})],X.prototype,"supportsProvenance",void 0),X=(0,p._)([(0,f.$)("esri.rest.knowledgeGraph.ServiceDefinition")],X);let ee=class extends v.A{constructor(e){super(e),this.url=null,this.dataModel=null,this.serviceDefinition=null}};function te(e,t,r){if(0!==e.error_code)throw new s.A(t,r,{errorCode:e.error_code,errorMessage:e.error_message})}function re(e){return e?.error_code?new s.A("knowledgeGraphService:server-or-decoding-error",e.error_message,{errorCode:e.error_code}):void 0}function ne(e,t,r,n){const i=new r.ClientDataKey;i.deleteLater(),i.key_string=e;const o=new r.ClientDataFetchRequestParameter;o.deleteLater(),o.set_key(i);const s=t.get(e);return s&&!n&&(o.v_tag={v_tag:s.version}),o}(0,p._)([(0,y.MZ)({type:String,json:{write:!0}})],ee.prototype,"url",void 0),(0,p._)([(0,y.MZ)({type:W,json:{write:!0}})],ee.prototype,"dataModel",void 0),(0,p._)([(0,y.MZ)({type:X,json:{write:!0}})],ee.prototype,"serviceDefinition",void 0),ee=(0,p._)([(0,f.$)("esri.rest.knowledgeGraph.KnowledgeGraph")],ee);var ie,oe,se,ae=r(45724),le=r(48526),de=r(86738),ue=r(39829),pe=r(82799);function ce(e,t){const r=new t.ArrayValue;return r.deleteLater(),e.forEach((e=>{r.add_value(fe(e,t))})),r}function ye(e,t){const r=new t.ObjectValue;r.deleteLater();for(const[n,i]of Object.entries(e))r.set_key_value(n,fe(i,t));return r}function he(e,t){if(e instanceof le.A)return function(e,t){const r=new t.GeometryValue;r.deleteLater(),r.geometry_type=r.geometry_type=t.esriGeometryType.esriGeometryMultipoint,r.has_z=e.hasZ,r.has_m=e.hasM;const n=[],i=[];i[0]=e.points.length;let o=0;return e.points.forEach((e=>{e.forEach((e=>{n[o]=e,o++}))})),r.coords=new Float64Array(n),r.lengths=new Uint32Array(i),r}(e,t);if(e instanceof de.A)return function(e,t){const r=new t.GeometryValue;r.deleteLater(),r.geometry_type=t.esriGeometryType.esriGeometryPoint,r.has_z=e.hasZ,r.has_m=e.hasM;const n=[],i=[];i[0]=1,n[0]=e.x,n[1]=e.y;let o=2;return e.hasZ&&(n[o]=e.z,o++),e.hasM&&(n[o]=e.m,o++),r.coords=new Float64Array(n),r.lengths=new Uint32Array(i),r}(e,t);if(e instanceof pe.A||e instanceof ue.A)return function(e,t){const r=new t.GeometryValue;r.deleteLater(),r.has_z=e.hasZ,r.has_m=e.hasM;const n=[],i=[];let o=[];e instanceof pe.A?(r.geometry_type=t.esriGeometryType.esriGeometryPolyline,o=e.paths):e instanceof ue.A&&(r.geometry_type=t.esriGeometryType.esriGeometryPolygon,o=e.rings);let s=0,a=0;return o.forEach((e=>{let t=0;e.forEach((e=>{t++,e.forEach((e=>{n[a]=e,a++}))})),i[s]=t,s++})),r.coords=new Float64Array(n),r.lengths=new Uint32Array(i),r}(e,t);throw new s.A("knowledge-graph:unsupported-geometry","Only Point, Multipoint, Polyline, and Polygon geometry are supported by ArcGIS Knowledge",{geometry:e})}function fe(e,t){if(null==e)return"";if("object"!=typeof e)return e;if(e instanceof Date)return e;if(e instanceof d.A)return he(e,t);if(Array.isArray(e)){const r=new t.ArrayValue;return r.deleteLater(),e.forEach((e=>{r.add_value(fe(e,t))})),r}return ye(e,t)}!function(e){e[e.OBJECT=0]="OBJECT",e[e.ENTITY=1]="ENTITY",e[e.RELATIONSHIP=2]="RELATIONSHIP",e[e.PATH=3]="PATH",e[e.ARRAY=4]="ARRAY"}(ie||(ie={})),function(e){e[e.view=0]="view",e[e.edit=1]="edit"}(oe||(oe={})),function(e){e[e.exclude=0]="exclude",e[e.include=1]="include"}(se||(se={}));var me,ge,_e,we,ve=r(35448);function Te(e,t){if(!e.typeName)throw new s.A("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits");if(!("originId"in e)){const r=new t.EntityValue;r.deleteLater(),r.type_name=e.typeName;for(const[n,i]of Object.entries(e.properties))r.set_key_value(n,Me(i,t));return e.id&&r.set_id(e.id),r}if("originId"in e&&"destinationId"in e){const r=new t.RelationshipValue;r.deleteLater(),r.type_name=e.typeName;for(const[n,i]of Object.entries(e.properties))r.set_key_value(n,Me(i,t));return e.id&&r.set_id(e.id),e.originId&&e.destinationId&&r.set_related_entity_ids(e.originId,e.destinationId),r}throw new s.A("knowledge-graph:applyEdits-encoding-failure","Could not determine the type of a named graph object passed to the encoder")}function Ae(e,t){const r=new t.GraphProperty;return r.deleteLater(),r.name=e.name,r.alias=e.alias??"",r.field_type={value:ve.r5[e.fieldType]},r.geometry_type={value:e.geometryType?ve.bV[e.geometryType]:ve.bV.esriGeometryNull},r.has_m=e.hasM??!1,r.has_z=e.hasZ??!1,r.nullable=e.nullable??!1,r.editable=e.editable,r.required=e.required,r.default_visibility=e.defaultVisibility,r.system_maintained=e.systemMaintained??!1,r.role={value:ve.ti[e.role]},r.default_value=Me(e.defaultValue,t),r}function be(e,t,r){r.name=e.name,r.alias=e.alias??"",r.role={value:ve.Eq[e.role]},r.strict=e.strict;for(const n of e.properties){const e=Ae(n,t);r.add_property(e)}return r}function Me(e,t){return null==e?null:"object"!=typeof e||e instanceof Date?e:e instanceof d.A?he(e,t):null}function Se(e){const t=e.get_keys(),r=new Array;for(let e=0;e<t.get_keys_count();e++){const n=t.get_key_at(e);n.get_client_data_key_type().value===me.ClientDataKeyTypeString&&r.push(n.key_string)}return r}!function(e){e[e.ClientDataKeyTypeUNSPECIFIED=0]="ClientDataKeyTypeUNSPECIFIED",e[e.ClientDataKeyTypeString=1]="ClientDataKeyTypeString"}(me||(me={})),function(e){e[e.ClientDataTypeUNSPECIFIED=0]="ClientDataTypeUNSPECIFIED",e[e.ClientDataTypeString=1]="ClientDataTypeString"}(ge||(ge={})),function(e){e[e.Unspecified=0]="Unspecified",e[e.ClientData=1]="ClientData",e[e.NotModified=2]="NotModified"}(_e||(_e={})),function(e){e[e.Unspecified=0]="Unspecified",e[e.Error=1]="Error",e[e.ClientDataValue=2]="ClientDataValue"}(we||(we={}));let Re=class extends c.A{constructor(e){super(e),this.entityAddResultsCount=0,this.relationshipAddResultsCount=0,this.decoderError=null,this.entityAddResults=[],this.relationshipAddResults=[],this.updatedKnowledgeGraph=null}};(0,p._)([(0,y.MZ)()],Re.prototype,"entityAddResultsCount",void 0),(0,p._)([(0,y.MZ)()],Re.prototype,"relationshipAddResultsCount",void 0),(0,p._)([(0,y.MZ)()],Re.prototype,"decoderError",void 0),(0,p._)([(0,y.MZ)()],Re.prototype,"entityAddResults",void 0),(0,p._)([(0,y.MZ)()],Re.prototype,"relationshipAddResults",void 0),(0,p._)([(0,y.MZ)()],Re.prototype,"updatedKnowledgeGraph",void 0),Re=(0,p._)([(0,f.$)("esri.rest.knowledgeGraph.GraphAddNamedTypesResult")],Re);let Pe=class extends c.A{constructor(e){super(e),this.decoderError=null,this.updatedKnowledgeGraph=null}};function Ge(e){const t=e.get_entity_type_add_results_count(),r=e.get_relationship_type_add_results_count(),n=new Re({decoderError:re(e.error),entityAddResultsCount:t,relationshipAddResultsCount:r});for(let r=0;r<t;r++){const t=e.get_entity_type_add_results_at(r),i=t.get_name(),o=t.get_error();n.entityAddResults.push({typeName:i,error:re(o)})}for(let t=0;t<r;t++){const r=e.get_relationship_type_add_results_at(t),i=r.get_name(),o=r.get_error();n.relationshipAddResults.push({typeName:i,error:re(o)})}return n}(0,p._)([(0,y.MZ)()],Pe.prototype,"decoderError",void 0),(0,p._)([(0,y.MZ)()],Pe.prototype,"updatedKnowledgeGraph",void 0),Pe=(0,p._)([(0,f.$)("esri.rest.knowledgeGraph.GraphDeleteNamedTypeResult")],Pe);let Ee=class extends c.A{constructor(e){super(e),this.name=null,this.supportedCategory="esriTypeUNSPECIFIED",this.analyzers=[],this.searchProperties=new Map}};(0,p._)([(0,y.MZ)()],Ee.prototype,"name",void 0),(0,p._)([(0,y.MZ)()],Ee.prototype,"supportedCategory",void 0),(0,p._)([(0,y.MZ)()],Ee.prototype,"analyzers",void 0),(0,p._)([(0,y.MZ)()],Ee.prototype,"searchProperties",void 0),Ee=(0,p._)([(0,f.$)("esri.rest.knowledgeGraph.SearchIndex")],Ee);let Ne=!1;function ke(e){return e.deleteLater(),new Y(Ie(e))}function De(e){return e.deleteLater(),new $({name:e.name,unique:e.unique,ascending:e.ascending,description:e.description,fieldNames:Fe(e.fields)})}function Ie(e){return{name:e.name,alias:e.alias,role:ve.Eq[e.role.value],strict:e.strict,properties:Ze(e.properties),fieldIndexes:Ue(e.field_indexes)}}function xe(e){return e.deleteLater(),new B({alias:e.alias,name:e.name,fieldType:ve.r5[e.field_type.value]?ve.r5[e.field_type.value]:void 0,geometryType:ve.bV[e.geometry_type.value]?ve.bV[e.geometry_type.value]:null,hasM:e.has_m,hasZ:e.has_z,nullable:e.nullable,editable:e.editable,required:e.required,defaultVisibility:e.default_visibility,systemMaintained:e.system_maintained,role:ve.ti[e.role.value],defaultValue:e.default_value})}function Oe(e){e.deleteLater();const t=Ie(e),r=[];for(let t=0;t<e.end_points.size();t++){const n=e.end_points.get(t);r.push({originEntityType:n.origin_entity_type,destinationEntityType:n.dest_entity_type})}return e.end_points.delete(),new H(Object.assign({endPoints:r},t))}function je(e){return new Q({behavior:e.behavior,value:e.value})}function Ce(e){const t=[];for(let r=0;r<e.size();r++)t.push(ke(e.get(r)));return e.delete(),t}function Fe(e){const t=[];for(let r=0;r<e.size();r++)t.push(e.get(r));return e.delete(),t}function Ze(e){const t=[];for(let r=0;r<e.size();r++){const n=xe(e.get(r));"esriFieldTypeBigInteger"===n.fieldType&&(Ne=!0),t.push(n)}return e.delete(),t}function Ue(e){const t=[];for(let r=0;r<e.size();r++)t.push(De(e.get(r)));return e.delete(),t}function qe(e){const t=[];for(let r=0;r<e.size();r++)t.push(Oe(e.get(r)));return e.delete(),t}function Le(e){const t=[];for(let r=0;r<e.size();r++){const n=e.get(r);n.deleteLater(),t.push(je(n))}return e.delete(),t}function ze(e){const t=[];for(let r=0;r<e.size();r++){const r=new Ee,n=e.get(0);r.name=n.name,r.supportedCategory=ve.nP[n.supported_category.value];const i=n.analyzers.size();for(let e=0;e<i;e++)r.analyzers.push({name:n.analyzers.get(e).name});n.analyzers.delete();for(let e=0;e<n.search_properties.keys().size();e++){const t=n.search_properties.keys().get(e),i=n.search_properties.get(t),o=[];for(let e=0;e<i.property_names.size();e++)o.push(i.property_names.get(e));r.searchProperties.set(t,{propertyNames:o})}t.push(r)}return e.delete(),t}var Je,Ke=r(25927),$e=(r(77901),r(40662)),Be=r(42095),Ve=r(23150);function Ye(e,t){const r={paths:[],hasM:!1,hasZ:!1},n=He(e,r),{coords:i,geometry_type:o,lengths:a}=e;if(o.value!==t)throw new s.A("KnowledgeGraph:illegal-geometry-type","Illegal Geometry type for multipath conversion");let l=0;return a.forEach((e=>{const t=[];for(let r=0;r<e;r++){const e=[];for(let t=0;t<n;t++)e[t]=i[l],l++;t.push(e)}r.paths.push(t)})),r}function He(e,t){let r=2;return e.has_z?(t.hasZ=e.has_z,r++):t.hasZ=!1,e.has_m?(t.hasM=e.has_m,r++):t.hasM=!1,r}!function(e){e[e.ESRI_GEOMETRY_NULL=0]="ESRI_GEOMETRY_NULL",e[e.ESRI_GEOMETRY_POINT=1]="ESRI_GEOMETRY_POINT",e[e.ESRI_GEOMETRY_MULTIPOINT=2]="ESRI_GEOMETRY_MULTIPOINT",e[e.ESRI_GEOMETRY_POLYLINE=3]="ESRI_GEOMETRY_POLYLINE",e[e.ESRI_GEOMETRY_POLYGON=4]="ESRI_GEOMETRY_POLYGON",e[e.ESRI_GEOMETRY_ENVELOPE=5]="ESRI_GEOMETRY_ENVELOPE",e[e.ESRI_GEOMETRY_ANY=6]="ESRI_GEOMETRY_ANY",e[e.ESRI_GEOMETRY_MULTI_PATCH=7]="ESRI_GEOMETRY_MULTI_PATCH"}(Je||(Je={}));const Qe=()=>a.A.getLogger("esri.rest.knowledgeGraph.WasmToQueryResponseObjConstructors");function We(e,t,r){return((e,t,r)=>{if(null==e)return null;if("object"!=typeof e)return e;if("getDate"in e)return e;if("geometry_type"in e)switch(e.geometry_type.value){case null:return null;case Je.ESRI_GEOMETRY_POINT:return function(e,t){const r={spatialReference:t};let n=2;He(e,r);const i=e.coords;return r.x=i[0],r.y=i[1],e.has_z&&(r.z=i[n],n++),e.has_m&&(r.m=i[n]),new de.A(r)}(e,r);case Je.ESRI_GEOMETRY_MULTIPOINT:return function(e,t){const r={spatialReference:t},n=He(e,r),i=e.lengths,o=e.coords,s=i[0];r.points=[];let a=0;for(let e=0;e<s;e++){const e=[];for(let t=0;t<n;t++)e[t]=o[a],a++;r.points.push(e)}return new le.A(r)}(e,r);case Je.ESRI_GEOMETRY_POLYLINE:return function(e,t){const{paths:r,hasM:n,hasZ:i}=Ye(e,Je.ESRI_GEOMETRY_POLYLINE);return new pe.A({paths:r,hasM:n,hasZ:i,spatialReference:t})}(e,r);case Je.ESRI_GEOMETRY_POLYGON:return function(e,t){const{paths:r,hasM:n,hasZ:i}=Ye(e,Je.ESRI_GEOMETRY_POLYGON);return new ue.A({rings:r,hasM:n,hasZ:i,spatialReference:t})}(e,r);case Je.ESRI_GEOMETRY_ENVELOPE:case Je.ESRI_GEOMETRY_MULTI_PATCH:return Qe().warnOnce("Envelope and Multipatch are not supported on knowledge entities, but one of those geometry types was detected. Result interpreted as null"),null;case Je.ESRI_GEOMETRY_NULL:case Je.ESRI_GEOMETRY_ANY:default:return Qe().warnOnce("Unknown or blank geometry type returned - Result interpreted as null"),null}else{if(!("object_value_type"in e))return Qe().warnOnce("A decoded value came back of a type that is not supported. Result interpreted as null"),null;switch(e.object_value_type.value){case ie.OBJECT:return function(e,t,r){return new $e.A(et(e,t,r))}(e,t,r);case ie.ENTITY:return Xe(e,t,r);case ie.RELATIONSHIP:return tt(e,t,r);case ie.PATH:return function(e,t,r){const n=e.entity_count(),i=e.relationship_count(),o=[];for(let s=0;s<n;s++)o.push(Xe(e.get_entity_at(s),t,r)),s<i&&o.push(tt(e.get_relationship_at(s),t,r));return new Be.A({path:o})}(e,t,r);case ie.ARRAY:return function(e,t,r){const n=[],i=e.count();for(let o=0;o<i;o++){const i=e.get_value_at(o);n.push(We(i,t,r))}return n}(e,t,r);default:return Qe().warnOnce("Unknown graph object type detected! Result interpreted as null"),null}}})(e,t,r)}function Xe(e,t,r){const n=e.type_name,i=et(e,t,r),o=e.get_id();return new Ke.A(Object.assign({typeName:n,id:o},i))}function et(e,t,r){const n={},i=e.key_count();for(let o=0;o<i;o++)n[e.get_key_at(o)]=We(e.get_value_at(o),t,r);return{properties:n}}function tt(e,t,r){const n=e.type_name,i=et(e,t,r);return new Ve.A(Object.assign({typeName:n,id:e.get_id(),originId:e.get_origin_entity_id(),destinationId:e.get_destination_entity_id()},i))}function rt(e){const t=[];for(let r=0;r<e.get_header_keys().size();r++)t.push(e.get_header_keys().get(r));const r=new u.A(e.get_out_sr());return new z({headerKeys:t,outSpatialReference:r,exceededTransferLimit:e.exceeded_transfer_limit()})}let nt=class extends c.A{constructor(e){super(e),this.hasError=!1,this.error=null,this.editResults=[]}};(0,p._)([(0,y.MZ)()],nt.prototype,"hasError",void 0),(0,p._)([(0,y.MZ)()],nt.prototype,"error",void 0),(0,p._)([(0,y.MZ)()],nt.prototype,"editResults",void 0),nt=(0,p._)([(0,f.$)("esri.rest.knowledgeGraph.GraphApplyEditsResult")],nt);const it=new Map,ot=()=>new Map(it.entries()),st={fetchKnowledgeGraph:async e=>{const t=new ee({url:e}),r=[];return r.push(gt(t)),r.push(_t(t)),await Promise.all(r),t},refreshDataModel:async e=>{e.dataModel=await It(e)},refreshServiceDefinition:async e=>{const t=(await(0,o.A)(e.url,{query:{f:"json"}})).data;return t.capabilities=t?.capabilities?.split(","),t.supportedQueryFormats=t?.supportedQueryFormats?.split(","),e.serviceDefinition=new X(t),e.serviceDefinition},executeFindPathsAsynchronous:async(e,t)=>{const r=e.inKnowledgeGraphUrl.split("/rest/services");if(r.length<2)throw new s.A("knowledge-graph:invalid-tool-url","The URL for the KG Service was not correctly formatted. It should contain /reset/services/");const n=r[0];return await Mt(`${n}/rest/services/System/KnowledgeGraphServerToolsAsync/GPServer/ServerFilteredFindPaths`,{in_knowledge_graph_url:e.inKnowledgeGraphUrl,config_type:"STRING",config_string:e.config.toJSON(),result_type:"STRING"},{},t)},executeFindPaths:async(e,t)=>{const r=e.inKnowledgeGraphUrl.split("/rest/services");if(r.length<2)throw new s.A("knowledge-graph:invalid-tool-url","The URL for the KG Service was not correctly formatted. It should contain /reset/services/");const n=r[0],i=await St(`${n}/rest/services/System/KnowledgeGraphServerTools/GPServer/ServerFilteredFindPaths/execute`,{method:"post",query:{f:"pjson",in_knowledge_graph_url:e.inKnowledgeGraphUrl,config_type:"STRING",config_string:JSON.stringify(e.config),result_type:"STRING"},...t});if(i.data.results.length<1)throw new s.A("knowledge-graph:no-results","No results were returned from the FindPaths tool - no results returned",i);let o;for(const e of i.data.results)if("out_results_string"===e.paramName){o=e.value;break}if(!o)throw new s.A("knowledge-graph:no-results","No results were returned from the FindPaths tool - no results were returned on the expected paramater out_results_string",i);return o},fetchAsynchronousFindPathsResultData:async(e,t)=>(await e.fetchResultData("out_results_string",null,t)).value,executeQueryStreaming:async(e,t,r)=>{const n=`${e.url}/graph/query`;await Rt(e);const i=await Gt(n,r);if(!e.serviceDefinition?.supportsProvenance&&"include"===t.provenanceBehavior)throw new s.A("knowledge-graph:provenance-not-supported","The Knowledge Graph Service definition indicated that provenance is not supported");i.data.body=await async function(e,t){const r=await(0,ae.I)(),n=new r.GraphQueryRequestEncoder;if(n.deleteLater(),e.outputSpatialReference?n.output_spatial_reference={wkid:e.outputSpatialReference.wkid,latestWkid:e.outputSpatialReference.latestWkid,vcsWkid:e.outputSpatialReference.vcsWkid,latestVcsWkid:e.outputSpatialReference.latestVcsWkid,wkt:e.outputSpatialReference.wkt??""}:n.output_spatial_reference=r.SpatialReferenceUtil.WGS84(),n.open_cypher_query=e.openCypherQuery,e.bindParameters)for(const[t,i]of Object.entries(e.bindParameters))Pt(t,i,n,r);if(e.bindGeometryQuantizationParameters)!function(e,t){t.input_quantization_parameters={xy_resolution:e.xyResolution,x_false_origin:e.xFalseOrigin,y_false_origin:e.yFalseOrigin,z_resolution:e.zResolution,z_false_origin:e.zFalseOrigin,m_resolution:e.mResolution,m_false_origin:e.mFalseOrigin}}(e.bindGeometryQuantizationParameters,n);else{if(t.dataModel||await gt(t),4326!==t.dataModel?.spatialReference?.wkid)throw new s.A("knowledge-graph:SR-quantization-mismatch","If the DataModel indicates a coordinate system other than WGS84, inputQuantizationParameters must be provided to the query encoder");n.input_quantization_parameters=r.InputQuantizationUtil.WGS84_lossless()}e.outputQuantizationParameters&&function(e,t,r){if(!e.extent)throw new s.A("knowledge-graph:illegal-output-quantization","The Output quantization provided to the encoder had an illegal value as part of its extent",e.extent);if(!e.quantizeMode)throw new s.A("knowledge-graph:illegal-output-quantization","The Output quantization contained an illegal mode setting",e.quantizeMode);if(!e.tolerance)throw new s.A("knowledge-graph:illegal-output-quantization","The Output quantization contained an illegal tolerance setting",e.quantizeMode);t.output_quantization_parameters={extent:{xmax:e.extent.xmax,ymax:e.extent.ymax,xmin:e.extent.xmin,ymin:e.extent.ymin},quantize_mode:r.esriQuantizeMode[e.quantizeMode],tolerance:e.tolerance}}(e.outputQuantizationParameters,n,r),e.provenanceBehavior&&function(e,t){t.provenance_behavior={value:se[e]}}(e.provenanceBehavior,n);try{n.encode()}catch(e){throw new s.A("knowledge-graph:query-encoding-failed","Attempting to encode the query failed",{error:e})}const i=n.get_encoding_result();if(0!==i.error.error_code)throw new s.A("knowledge-graph:query-encoding-failed","Attempting to encode the query failed",{errorCode:i.error.error_code,errorMessage:i.error.error_message});return structuredClone(i.get_byte_buffer())}(t,e);const o=await bt(i.data.url,i.data);if(e.dataModel){const t=await Dt(o,e.dataModel);return new K({resultRowsStream:t.readableStream,resultHeader:t.resultHeader})}throw new s.A("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")},executeApplyEdits:async(e,t,r)=>{if(e.serviceDefinition?.dataEditingNotSupported)throw new s.A("knowledge-graph:data-editing-not-supported","The Knowledge Graph Service definition indicated that data editing is not supported");const n=`${e.url}/graph/applyEdits`;await Rt(e);const i=await Gt(n,r);return i.data.body=await async function(e,t){if(t.dataModel||await gt(t),!t.dataModel)throw new s.A("knowledge-graph:data-model-undefined","Encoding could not proceed because a data model was not provided and it could not be determined from the service");const r=await(0,ae.I)(),n=!!e.options?.cascadeDelete,i=new r.GraphApplyEditsEncoder(r.SpatialReferenceUtil.WGS84(),e.options?.inputQuantizationParameters?function(e){return{xy_resolution:e.xyResolution,x_false_origin:e.xFalseOrigin,y_false_origin:e.yFalseOrigin,z_resolution:e.zResolution,z_false_origin:e.zFalseOrigin,m_resolution:e.mResolution,m_false_origin:e.mFalseOrigin}}(e.options?.inputQuantizationParameters):r.InputQuantizationUtil.WGS84_lossless());i.deleteLater(),i.cascade_delete=n;try{let t;e.entityAdds?.forEach((e=>{t=i.add_entity(Te(e,r)),te(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - an entity failed to be added to the encoder")})),e.relationshipAdds?.forEach((e=>{if(!e.originId||!e.destinationId)throw new s.A("knowledge-graph:relationship-origin-destination-missing","When adding a new relationship, you must provide both an origin and destination id on the appropriate class property");t=i.add_relationship(Te(e,r)),te(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - a relationship failed to be added to the encoder")})),e.entityUpdates?.forEach((e=>{if(!e.id)throw new s.A("knowledge-graph:entity-id-missing","When updating an entity or relationship, you must specify the id on the class level property");t=i.update_entity(Te(e,r)),te(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - an entity failed to be added to the encoder")})),e.relationshipUpdates?.forEach((e=>{if(!e.id)throw new s.A("knowledge-graph:relationship-id-missing","When updating an entity or relationship, you must specify the id on the class level property");t=i.update_relationship(Te(e,r)),te(t,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - a relationship failed to be added to the encoder")})),e.entityDeletes?.forEach((e=>{if(!e.typeName)throw new s.A("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits - delete");const t=i.make_delete_helper(e.typeName,!0);t.deleteLater(),e.ids?.forEach((e=>{t.delete_by_id(e)}))})),e.relationshipDeletes?.forEach((e=>{if(!e.typeName)throw new s.A("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits - delete");const t=i.make_delete_helper(e.typeName,!1);e.ids?.forEach((e=>{t.delete_by_id(e)}))})),i.encode()}catch(e){throw new s.A("knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed",{error:e})}const o=i.get_encoding_result();return te(o.error,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed"),structuredClone(o.get_byte_buffer())}(t,e),async function(e){const t=e.headers.get("content-type");if(t?.includes("application/x-protobuf")){const t=await e.arrayBuffer(),r=new((await(0,ae.I)()).GraphApplyEditsDecoder);return r.deleteLater(),r.decode(new Uint8Array(t)),function(e){const t=e.has_error(),r=new nt({hasError:t,error:t?{errorCode:e.error.error_code,errorMessage:e.error.error_message}:null}),n=e.get_edit_results_count();for(let t=0;t<n;t++){const n=e.get_edit_results_at(t),i=e.get_edit_results_type_name_at(t),o=[],s=[],a=[],l=n.get_add_results_count(),d=n.get_update_results_count(),u=n.get_delete_results_count();for(let e=0;e<l;e++){const t=n.get_add_result_at(e);o.push({id:t.id,error:{errorCode:t.error.error_code,errorMessage:t.error.error_message}})}for(let e=0;e<d;e++){const t=n.get_update_result_at(e);s.push({id:t.id,error:{errorCode:t.error.error_code,errorMessage:t.error.error_message}})}for(let e=0;e<u;e++){const t=n.get_delete_result_at(e);a.push({id:t.id,error:{errorCode:t.error.error_code,errorMessage:t.error.error_message}})}r.editResults.push({typeName:i,adds:o,updates:s,deletes:a})}return r}(r)}throw new s.A("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:t,data:e.text()})}(await bt(i.data.url,i.data))},executeAddNamedTypes:async(e,t,r)=>{if(!t.newEntityTypes?.length&&!t.newRelationshipTypes?.length)throw new s.A("knowledge-graph:no-arguments","The operation to add types to the data model contained no values");const n=`${e.url}/dataModel/edit/namedTypes/add`;await Rt(e);const i=await Gt(n,r);i.data.body=await async function(e){const t=await(0,ae.I)(),r=new t.GraphNamedObjectTypeAddsRequestEncoder;r.deleteLater(),e.newEntityTypes?.forEach((e=>{r.add_entity_type(function(e,t){const r=new t.EntityType;return r.deleteLater(),be(e,t,r)}(e,t))})),e.newRelationshipTypes?.forEach((e=>{r.add_relationship_type(function(e,t){const r=new t.RelationshipType;r.deleteLater();for(const n of e.endPoints){const e=new t.EndPoint;e.deleteLater(),e.origin_entity_type=n.originEntityType,e.dest_entity_type=n.destinationEntityType,r.add_end_point(e)}return be(e,t,r)}(e,t))}));try{r.encode()}catch(e){throw new s.A("knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed",{error:e})}const n=r.get_encoding_result();return te(n.error,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed"),structuredClone(n.get_byte_buffer())}(t);const o=await bt(i.data.url,i.data),a=await async function(e){const t=e.headers.get("content-type");if(t?.includes("application/x-protobuf")){const t=await e.arrayBuffer(),r=new((await(0,ae.I)()).GraphNamedObjectTypeAddsResponseDecoder);return r.deleteLater(),r.decode(new Uint8Array(t)),Ge(r)}throw new s.A("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:t,data:e.text()})}(o);return a.updatedKnowledgeGraph=await mt(e.url),a},executeDeleteNamedType:async(e,t,r)=>{if(!t)throw new s.A("knowledge-graph:no-arguments","The operation to delete a named type from the data model contained no value");const n=`${e.url}/dataModel/edit/namedTypes/${t}/delete`;await Rt(e);const i=await Gt(n,r);i.data.body="";const o=await bt(i.data.url,i.data),a=await async function(e){const t=e.headers.get("content-type");if(t?.includes("application/x-protobuf")){const t=await e.arrayBuffer(),r=new((await(0,ae.I)()).GraphNamedObjectTypeDeleteResponseDecoder);return r.deleteLater(),r.decode(new Uint8Array(t)),function(e){return new Pe({decoderError:re(e.error)})}(r)}throw new s.A("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:t,data:e.text()})}(o);return a.updatedKnowledgeGraph=await mt(e.url),a},executeQuery:async(e,t,r)=>{const n=`${e.url}/graph/query`,i=await(0,o.A)(n,{responseType:"array-buffer",query:{f:"pbf",openCypherQuery:t.openCypherQuery,...r?.query},signal:r?.signal,timeout:r?.timeout}),a=i.getHeader?.("content-type"),l=i.data;if(a?.includes("application/x-protobuf")){const t=new((await(0,ae.I)()).GraphQueryDecoder);if(t.deleteLater(),e.dataModel){const r=kt({wasmQueryDecoder:t,newArrayBufferToParse:l,dataModel:e.dataModel});return new J({resultRows:r.resultRows,resultHeader:r.resultHeader})}throw new s.A("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")}throw new s.A("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:a,data:i.data})},executeSearch:async(e,t,r)=>{const n=t.typeCategoryFilter,i=`${e.url}/graph/search`,a=await(0,o.A)(i,{responseType:"array-buffer",query:{f:"pbf",searchQuery:`"${t.searchQuery}"`,typeCategoryFilter:n,...r?.query},signal:r?.signal,timeout:r?.timeout}),l=a.getHeader?.("content-type"),d=a.data;if(l?.includes("application/x-protobuf")){const t=new((await(0,ae.I)()).GraphQueryDecoder);if(t.deleteLater(),e.dataModel){const r=kt({wasmQueryDecoder:t,newArrayBufferToParse:d,dataModel:e.dataModel});return new J({resultRows:r.resultRows,resultHeader:r.resultHeader})}throw new s.A("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")}throw new s.A("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:l,data:a.data})},executeSearchStreaming:async(e,t,r)=>{const n=`${e.url}/graph/search`;await Rt(e);const i=await Gt(n,r);i.data.body=await async function(e){const t=await(0,ae.I)(),r=new t.GraphSearchRequestEncoder;if(r.deleteLater(),r.search_query=e.searchQuery,r.type_category_filter=t.esriNamedTypeCategory[e.typeCategoryFilter],!0===e.returnSearchContext&&(r.return_search_context=e.returnSearchContext),null!=e.start&&e.start>0&&(r.start_index=e.start),null!=e.num&&(r.max_num_results=e.num),null!=e.idsFilter&&Array.isArray(e.idsFilter)&&e.idsFilter.length>0)try{r.set_ids_filter(ce(e.idsFilter,t))}catch(e){throw new s.A("knowledge-graph:ids-format-error","Attempting to set ids filter failed. This is usually caused by an incorrectly formatted UUID string",{error:e})}e.namedTypesFilter?.forEach((e=>{r.add_named_type_filter(e)}));try{r.encode()}catch(e){throw new s.A("knowledge-graph:search-encoding-failed","Attempting to encode the search failed",{error:e})}const n=r.get_encoding_result();if(0!==n.error.error_code)throw new s.A("knowledge-graph:search-encoding-failed","Attempting to get encoding result from the query failed",{errorCode:n.error.error_code,errorMessage:n.error.error_message});return structuredClone(n.get_byte_buffer())}(t);const o=await bt(i.data.url,i.data);if(e.dataModel){const t=await Dt(o,e.dataModel);return new K({resultRowsStream:t.readableStream,resultHeader:t.resultHeader})}throw new s.A("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")},fetchClientDataAtKeys:async(e,t,r={ignoreCache:!1})=>{if(!t.length)return new Map;let n=it.get(e.url||"");n||(n=new Map,it.set(e.url||"",n));const i=new Map(n.entries()),o=`${e.url}/clientData/fetch`;t=Array.from(new Set(t));const a=await(0,ae.I)(),l=function(e,t,r,n=!1){const i=new r.ClientDataFetchRequestEncoder;i.deleteLater();for(const o of e){const e=ne(o,t,r,n);i.add_client_data_fetch_request_parameter(e)}i.encode();const o=i.get_encoding_result();return te(o.error,"knowledge-graph:fetchClientDataAtKeys-encoding-failed","Attempting to encode the fetchClientDataAtKeys failed"),structuredClone(o.get_byte_buffer())}(t,n,a,r.ignoreCache),d=await Gt(o,r.requestOptions);d.data.body=l;const u=await bt(d.data.url,d.data),p=u.headers.get("content-type");if(p?.includes("application/x-protobuf")){const e=new a.ClientDataFetchResponseDecoder;e.deleteLater();const t=await u.arrayBuffer();return e.decode(new Uint8Array(t)),e.has_error()&&te(e.error,"knowledge-graph:fetchClientDataAtKeys-decoding-error","An error occurred while decoding the client data keys response"),function(e,t,r,n=!1){const i=new Map;for(let o=0;o<e.get_results_count();o++){const s=e.get_result_at(o);if(s.get_fetch_result_case().value!==we.ClientDataValue||0!==s.error().error_code){const e=s.get_key().key_string;r.has(e)&&t.delete(e);continue}const a=s.get_value(),l=s.get_key().key_string,d=r.get(l);let u;if(a.get_data_case().value===_e.NotModified&&d)u=d.value;else{if(a.get_data_case().value!==_e.ClientData)continue;{u=a.get_data().client_data_string;const e=s.get_value().get_v_tag().v_tag;n||t.set(l,{key:l,version:e,value:u})}}i.set(l,u)}return i}(e,n,i,r.ignoreCache)}throw new s.A("knowledge-graph:unexpected-server-response","server returned an unexpected response when fetching client data",{responseType:p,data:u})},fetchAllClientDataKeys:async(e,t)=>{const r=`${e.url}/clientData`,n=await(0,o.A)(r,{responseType:"array-buffer",query:{f:"pbf"},signal:t?.signal,timeout:t?.timeout}),i=n.getHeader?.("content-type"),a=n.data;if(i?.includes("application/x-protobuf")){const e=new((await(0,ae.I)()).ClientDataKeysResponseDecoder);return e.deleteLater(),e.decode(new Uint8Array(a)),e.has_error()&&te(e.error,"knowledge-graph:fetchAllClientDataKeys-decoding-error","An error occurred while decoding the client data keys response"),Se(e)}throw new s.A("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:i,data:n.data})},clearClientDataCache:()=>it.clear(),_fetchWrapper:async(e,t)=>fetch(e,t),_submitJobWrapper:async(e,t,r,n)=>async function(e,t,r,n){return r=g.from(r||{}),async function(e,t,r,n,i){const s={},a={},l=[];return function(e,t,r){for(const n in e){const i=e[n];if(i&&"object"==typeof i&&i instanceof P.A){const{features:e}=i;r[n]=[t.length,t.length+e.length],e.forEach((e=>{t.push(e.geometry)}))}}}(n,l,s),(0,_.el)(l).then((l=>{const{outSpatialReference:d,processExtent:u,processSpatialReference:p,returnColumnName:c,returnFeatureCollection:y,returnM:h,returnZ:f}=r,{path:m}=(0,A.Dl)(e);for(const e in s){const[t,r]=s[e];a[e]=l.slice(t,r)}const g=d?d.wkid||d:null,_=p?p.wkid||p:null,w="execute"===t?{returnColumnName:c||void 0,returnFeatureCollection:y||void 0,returnM:h||void 0,returnZ:f||void 0}:null,v=C({...u?{context:{extent:u,outSR:g,processSR:_}}:{"env:outSR":g,"env:processSR":_},...n,...w,f:"json"},null,a),T={...i,query:v};return(0,o.A)(`${m}/${t}`,T)}))}(e,"submitJob",r,t??{},n).then((({data:t})=>{const r=L.fromJSON(t);return r.sourceUrl=e,r}))}(e,t,r,n),_esriRequestWrapper:async(e,t)=>(0,o.A)(e,t)};async function at(e,t,r){return st.executeApplyEdits(e,t,r)}async function lt(e,t,r){return st.executeAddNamedTypes(e,t,r)}async function dt(e,t,r){return st.executeDeleteNamedType(e,t,r)}async function ut(e,t,r){return st.executeQuery(e,t,r)}async function pt(e,t,r){return st.executeQueryStreaming(e,t,r)}async function ct(e,t,r){return st.executeSearch(e,t,r)}async function yt(e,t,r){return st.executeSearchStreaming(e,t,r)}function ht(e,t){return st.fetchAllClientDataKeys(e,t)}function ft(e,t,r){return st.fetchClientDataAtKeys(e,t,r)}async function mt(e){return st.fetchKnowledgeGraph(e)}async function gt(e){return st.refreshDataModel(e)}async function _t(e){return st.refreshServiceDefinition(e)}async function wt(e,t){return st.executeFindPathsAsynchronous(e,t)}async function vt(e,t){return st.executeFindPaths(e,t)}async function Tt(e,t){return st.fetchAsynchronousFindPathsResultData(e,t)}function At(){return st.clearClientDataCache()}async function bt(e,t){return st._fetchWrapper(e,t)}async function Mt(e,t,r,n){return st._submitJobWrapper(e,t,r,n)}async function St(e,t){return st._esriRequestWrapper(e,t)}async function Rt(e){const t=i.id?.findCredential(e.url);t||(e.dataModel?await It(e):await gt(e))}function Pt(e,t,r,n){null==t?r.set_param_key_value(e,""):"object"!=typeof t||t instanceof Date?r.set_param_key_value(e,t):t instanceof d.A?r.set_param_key_value(e,he(t,n)):Array.isArray(t)?r.set_param_key_value(e,ce(t,n)):r.set_param_key_value(e,ye(t,n))}async function Gt(e,t){return(0,o.A)(e,{responseType:"native-request-init",method:"post",query:{f:"pbf",...t?.query},body:"x",headers:{"Content-Type":"application/octet-stream"},signal:t?.signal,timeout:t?.timeout})}let Et=50;function Nt(e){Et=e}function kt({wasmQueryDecoder:e,newArrayBufferToParse:t,dataModel:r,decodedHeader:n,limitMaxProcessingTime:i=!1}){t&&e.push_buffer(new Uint8Array(t));const o=[];let a,l,d=0;const p=Date.now();let c=!0;for(;e.next_row();){a&&l||(a=n??rt(e),l=a.outSpatialReference??new u.A({wkid:4326})),d||(d=e.get_header_keys().size());const t=new Array(d);for(let n=0;n<d;n++){const i=e.get_value(n);t[n]=We(i,r,l)}if(o.push(t),i&&Date.now()-p>Et){c=!1;break}}if(e.has_error())throw new s.A("knowledge-graph:stream-decoding-error","One or more result rows were not successfully decoded - inner row decoding",{errorCode:e.error.error_code,errorMessage:e.error.error_message});return{resultHeader:a,resultRows:o,parsedAllResultsFromBuffer:c}}async function Dt(e,t){const r=e.headers.get("content-type");if(e.headers.get("content-length")&&a.A.getLogger("esri.rest.knowledgeGraph.knowledgeGraphService").warnOnce("Found `Content-Length` header when expecting a streaming HTTP response! Please investigate whether all intermediate HTTP proxies and/or load balancers are configured such that they don't forcefully buffer the entire response before returning it to the client. A valid HTTP streaming response should use Chunked Transfer Encoding and not have a Content Length defined."),r?.includes("application/x-protobuf")){const r=e.body?.getReader(),n=new((await(0,ae.I)()).GraphQueryDecoder);let i,o,d;n.deleteLater();const u=new Promise(((e,t)=>{o=e,d=t}));let p=!1,c=null;const y=new ReadableStream({pull:async function e(u){if(!r){const e=new s.A("knowledge-graph:stream-decoding-error","Error reading from stream - reader is undefined");throw d(e),e}const{done:y,value:h}=c?{done:!1,value:null}:await r.read().catch((e=>{throw d(e),r.releaseLock(),e}));h&&(c=h);try{if(y){let e;if(n.has_error()?e=new s.A("knowledge-graph:stream-decoding-error","One or more result rows were not successfully decoded - query stream done",{errorCode:n.error.error_code,errorMessage:n.error.error_message}):p||o(new z),r.releaseLock(),e)throw u.error(e),d(e),e;return void u.close()}const{resultHeader:a,resultRows:l,parsedAllResultsFromBuffer:f}=kt({wasmQueryDecoder:n,newArrayBufferToParse:h,dataModel:t,decodedHeader:i,limitMaxProcessingTime:!0});return f&&(c=null),!i&&a&&(i=a,o(a),p=!0),l.length>0?void u.enqueue(l):await e(u)}catch(e){throw a.A.getLogger("esri.rest.knowledgeGraph.knowledgeGraphService").error(e),d(e),r.releaseLock(),(0,l.zf)(e)?e:new s.A("knowledge-graph:unexpected-server-response","Error inside streaming data return parsing",{error:e})}}});return{readableStream:y,resultHeader:await u}}throw new s.A("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:r,data:e.text()})}async function It(e){const t=`${e.url}/dataModel/queryDataModel`,r=await(0,o.A)(t,{responseType:"array-buffer",query:{f:"pbf"}}),n=r.getHeader?.("content-type"),i=r.data;if(n?.includes("application/x-protobuf")){const e=(await(0,ae.I)()).decode_data_model_from_protocol_buffer(new Uint8Array(i));if(!e)throw new s.A("knowledge-graph:data-model-decode-failure","The server responded to the data model query, but the response failed to be decoded. This typically occurs when the Knowledge JS API (4.26 or later) is used with an unsupported backend (11.0 or earlier)");return function(e){e.deleteLater(),Ne=!1;const t=new W({timestamp:e.timestamp,spatialReference:new u.A(e.spatial_reference),strict:e.strict,objectIdField:e.objectid_property,globalIdField:e.globalid_property,arcgisManaged:e.arcgis_managed,identifierInfo:{identifierMappingInfo:{identifierInfoType:ve.vy[e.identifier_info?.identifier_mapping_info?.identifier_info_type?.value],databaseNativeIdentifier:e.identifier_info?.identifier_mapping_info?.database_native_identifier,uniformPropertyIdentifier:{identifierPropertyName:e.identifier_info?.identifier_mapping_info?.uniform_property_identifier?.identifier_property_name}},identifierGenerationInfo:{uuidMethodHint:ve.wr[e.identifier_info?.identifier_generation_info?.uuid_method_hint?.value]}},searchIndexes:ze(e.search_indexes),entityTypes:Ce(e.entity_types),relationshipTypes:qe(e.relationship_types),metaEntityTypes:Ce(e.meta_entity_types),provenanceSourceTypeValues:Le(e.provenance_source_type_values.value_behavior_array)});return Ne&&a.A.getLogger("esri.rest.knowledgeGraph.knowledgeGraphService").warnOnce("A big integer field was detected in the retrieved data model. The `big-integer` field type is not fully supported in web clients. Please see https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-Field.html#type"),t}(e)}throw new s.A("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:n,data:r.data})}}}]);