@arcgis/core 4.32.0-next.20250115 → 4.32.0-next.20250116

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 (71) hide show
  1. package/arcade/Feature.js +1 -1
  2. package/arcade/ImmutablePointArray.js +1 -1
  3. package/arcade/functions/geometry.js +1 -1
  4. package/arcade/geometry/constructors.js +5 -0
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/{3571b4f0a776f14649a2.js → 10ddbb50a82deb938d2f.js} +1 -1
  7. package/assets/esri/core/workers/chunks/1f4dd96aacf8c40a1120.js +1 -0
  8. package/assets/esri/core/workers/chunks/335e5ba9161de21b0b5c.js +1 -0
  9. package/assets/esri/core/workers/chunks/{c22ea8e04518989b9e61.js → 336cf437f627c72ff103.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{9334e55e0d70a2fb1599.js → 3376acc1a7bddc999069.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{21278877f91e18011740.js → 4bc7f1eaf88848be7df4.js} +1 -1
  12. package/assets/esri/core/workers/chunks/64e6665732dacc339602.js +1 -0
  13. package/assets/esri/core/workers/chunks/{ae3cc92f8b33568d4eab.js → 79aea5afd12e32914360.js} +1 -1
  14. package/assets/esri/core/workers/chunks/8221448e2e88044d0432.js +1 -0
  15. package/assets/esri/core/workers/chunks/{e7e622b2398697063116.js → 84b15353a5559ad1ded1.js} +1 -1
  16. package/assets/esri/core/workers/chunks/8b74dea0087cac50787b.js +1 -0
  17. package/assets/esri/core/workers/chunks/a182c98dfa4dfb189657.js +1 -0
  18. package/assets/esri/core/workers/chunks/c5338f738e68230fe674.js +1 -0
  19. package/assets/esri/core/workers/chunks/c9741eb7a66ff7ec9184.js +1 -0
  20. package/assets/esri/core/workers/chunks/cc6cf21610dd67b617ae.js +1 -0
  21. package/assets/esri/core/workers/chunks/{1e9d12dc7cd7d153b6ac.js → d539f4cdde241a8de605.js} +1 -1
  22. package/assets/esri/core/workers/chunks/de00150030003de05146.js +1 -0
  23. package/assets/esri/core/workers/chunks/{acfe97b9f86d92e4d6a7.js → ec7e2fc6c4284701396b.js} +1 -1
  24. package/assets/esri/core/workers/chunks/f8e609e8a11cfe5e03d8.js +1 -0
  25. package/geometry/Circle.js +1 -1
  26. package/geometry/asserts.js +5 -0
  27. package/geometry/geometryEngine.js +1 -1
  28. package/geometry/operators/polygonOverlayOperator.js +1 -1
  29. package/geometry/projection.js +1 -1
  30. package/geometry/support/geodesicUtils.js +1 -1
  31. package/geometry/support/webMercatorUtils.js +1 -1
  32. package/interfaces.d.ts +58 -14
  33. package/layers/LinkChartLayer.js +1 -1
  34. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  35. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  36. package/layers/knowledgeGraph/SessionMemoryStorage.js +1 -1
  37. package/layers/knowledgeGraph/constants.js +5 -0
  38. package/layers/knowledgeGraph/layerUtils.js +1 -1
  39. package/layers/knowledgeGraph/supportUtils.js +1 -1
  40. package/layers/mixins/DisplayFilteredLayer.js +1 -1
  41. package/package.json +1 -1
  42. package/rest/print.js +1 -1
  43. package/rest/support/printTaskUtils.js +1 -1
  44. package/support/revision.js +1 -1
  45. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  46. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  47. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  48. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  49. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  50. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  51. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  52. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  53. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  54. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  55. package/views/2d/layers/features/schema/SourceSchema.js +1 -1
  56. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  57. package/views/layers/FeatureLayerView.js +1 -1
  58. package/widgets/Features/FeaturesViewModel.js +1 -1
  59. package/widgets/Popup/actionUtils.js +1 -1
  60. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  61. package/assets/esri/core/workers/chunks/200eb488e95186e7fd25.js +0 -1
  62. package/assets/esri/core/workers/chunks/26d781e06140320f8d64.js +0 -1
  63. package/assets/esri/core/workers/chunks/349b65ace519cbae0841.js +0 -1
  64. package/assets/esri/core/workers/chunks/510cb8647841fec436c8.js +0 -1
  65. package/assets/esri/core/workers/chunks/798351a63da289706084.js +0 -1
  66. package/assets/esri/core/workers/chunks/a918e5728280713d692f.js +0 -1
  67. package/assets/esri/core/workers/chunks/de5c1d54c581407262b2.js +0 -1
  68. package/assets/esri/core/workers/chunks/e9b4cb5288b1aee04f19.js +0 -1
  69. package/assets/esri/core/workers/chunks/f5b57274c3f49ccbcf2e.js +0 -1
  70. package/assets/esri/core/workers/chunks/f5bf92c315c2944863d1.js +0 -1
  71. package/assets/esri/core/workers/chunks/ff4878b79927345fa689.js +0 -1
package/arcade/Feature.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{ArcadeDate as e}from"./ArcadeDate.js";import{configureDeepClone as t}from"./deepClone.js";import i from"./Dictionary.js";import{ArcadeExecutionError as s,ExecutionErrorCodes as r}from"./executionError.js";import o from"./ImmutableArray.js";import{p as a,c as n,s as l,k as u,j as d,g as f,d as h,a as m}from"../chunks/languageUtils.js";import{DateOnly as y}from"../core/sql/DateOnly.js";import{TimeOnly as c}from"../core/sql/TimeOnly.js";import p from"../geometry/Geometry.js";import _ from"../geometry/Point.js";import{fromJSON as b}from"../geometry/support/jsonUtils.js";import{convertToGeometry as T}from"../layers/graphics/featureConversionUtils.js";import g from"../layers/support/FieldsIndex.js";import{isString as F,isNumber as x,isBoolean as D}from"../support/guards.js";class w{constructor(){this.arcadeDeclaredClass="esri.arcade.Feature",this._optimizedGeomDefinition=null,this._geometry=null,this.attributes=null,this._layer=null,this._fieldTypesFixed=!0,this.fieldsIndex=null,this.contextTimeZone=null,this.immutable=!0,this._fieldsToFixDataTypes=null,this.immutable=!0}static createFromGraphic(e,t){const i=new w;return i.contextTimeZone=t??null,i._geometry=null!=e.geometry?e.geometry:null,void 0===e.attributes||null===e.attributes?i.attributes={}:i.attributes=e.attributes,e._sourceLayer?(i._layer=e._sourceLayer,i._fieldTypesFixed=!1):e._layer?(i._layer=e._layer,i._fieldTypesFixed=!1):e.layer&&"fields"in e.layer?(i._layer=e.layer,i._fieldTypesFixed=!1):e.sourceLayer&&"fields"in e.sourceLayer&&(i._layer=e.sourceLayer,i._fieldTypesFixed=!1),i._layer&&!i._fieldTypesFixed&&(i.fieldsIndex=this.hydrateFieldsIndex(i._layer)),i}static createFromArcadeFeature(e){if(e instanceof w){const t=new w;return t._fieldTypesFixed=e._fieldTypesFixed,t.attributes=e.attributes,t._geometry=e._geometry,t._optimizedGeomDefinition=e._optimizedGeomDefinition,e._layer&&(t._layer=e._layer),t.fieldsIndex=e.fieldsIndex,t.contextTimeZone=e.contextTimeZone,t}const t={};for(const i of e.keys())t[i]=e.field(i);return w.createFromGraphicLikeObject(e.geometry(),t,e.fullSchema(),e.contextTimeZone)}static createFromOptimisedFeature(e,t,i){const s=new w;return s._geometry=e.geometry?{geometry:e.geometry}:null,s._optimizedGeomDefinition=i,s.attributes=e.attributes||{},s._layer=t,s._fieldTypesFixed=!1,s}static createFromArcadeDictionary(e,t){const s=new w;return s.attributes=e.field("attributes"),null!==s.attributes&&s.attributes instanceof i?(s.attributes=s.attributes.attributes,null===s.attributes&&(s.attributes={})):s.attributes={},s._geometry=e.field("geometry"),null!==s._geometry&&(s._geometry instanceof i?s._geometry=w.parseGeometryFromDictionary(s._geometry,t):s._geometry instanceof p||(s._geometry=null)),s}static createFromGraphicLikeObject(e,t,i=null,s){const r=new w;return r.contextTimeZone=s??null,null===t&&(t={}),r.attributes=t,r._geometry=null!=e?e:null,r._layer=i,r._layer&&(r._fieldTypesFixed=!1,r.fieldsIndex=this.hydrateFieldsIndex(r._layer)),r}static hydrateFieldsIndex(e){return null===e?null:a(e)?e.getFieldsIndex():e.fieldsIndex?e.fieldsIndex:g.fromLayerJSON({datesInUnknownTimezone:e.datesInUnknownTimezone,fields:e.fields,timeInfo:e.timeInfo,editFieldsInfo:e.editFieldsInfo,dateFieldsTimeReference:e.dateFieldsTimeReference??{timeZone:"UTC",respectsDaylightSaving:!1}})}repurposeFromGraphicLikeObject(e,t,i=null){null===t&&(t={}),this.attributes=t,this._geometry=e??null,this._layer=i,this._layer?this._fieldTypesFixed=!1:this._fieldTypesFixed=!0}castToText(e=!1){!1===this._fieldTypesFixed&&this._fixFieldTypes();const t=n(this.attributes,{useNumbersForDates:e});return'{"geometry":'+(null===this.geometry()?"null":l(this.geometry()))+',"attributes":'+t+"}"}_fixFieldTypes(){if(this._fieldsToFixDataTypes&&this._fieldsToFixDataTypes?.length>0)return this._fixAllFields(this._fieldsToFixDataTypes),void(this._fieldTypesFixed=!0);const e=[],t=this._layer.fields;for(let i=0;i<t.length;i++){const s=t[i],{name:r,type:o}=s;switch(o){case"date":case"esriFieldTypeDate":e.push({field:r,dataType:"date"});break;case"date-only":case"esriFieldTypeDateOnly":e.push({field:r,dataType:"date-only"});break;case"time-only":case"esriFieldTypeTimeOnly":e.push({field:r,dataType:"time-only"});break;case"timestamp-offset":case"esriFieldTypeTimestampOffset":e.push({field:r,dataType:"timestamp-offset"})}}this._fieldsToFixDataTypes=e,e.length>0&&this._fixAllFields(e),this._fieldTypesFixed=!0}isUnknownDateTimeField(e){return"unknown"===this.fieldsIndex?.getTimeZone(e)}_fixAllFields(t){this.attributes={...this.attributes};const i=this.contextTimeZone??"system";for(let s=0;s<t.length;s++){const r=t[s].field,o=t[s].dataType;let a=this.attributes[r];if(void 0===a){for(const t in this.attributes)if(t.toLowerCase()===r.toLowerCase()){if(a=this.attributes[t],null!==a){if("time-only"===o){u(a)||(this.attributes[t]=c.fromReader(a.toString()));break}if("date-only"===o){d(a)||(this.attributes[t]=y.fromReader(a.toString()));break}if("timestamp-offset"===o){f(a)||(this.attributes[t]=e.fromReaderAsTimeStampOffset(a.toString()));break}const s=this.isUnknownDateTimeField(t);a instanceof Date?this.attributes[t]=s?e.unknownDateJSToArcadeDate(a):e.dateJSAndZoneToArcadeDate(a,i):f(a)||(this.attributes[t]=s?e.unknownEpochToArcadeDate(a):e.epochToArcadeDate(a,i))}break}}else if(null!==a){if("time-only"===o){u(a)?this.attributes[r]=a:this.attributes[r]=c.fromReader(a.toString());continue}if("date-only"===o){d(a)?this.attributes[r]=a:this.attributes[r]=y.fromReader(a.toString());continue}if("timestamp-offset"===o){f(a)?this.attributes[r]=a:this.attributes[r]=e.fromReaderAsTimeStampOffset(a.toString());continue}const t=this.isUnknownDateTimeField(r);f(a)?this.attributes[r]=a:a instanceof Date?this.attributes[r]=t?e.unknownDateJSToArcadeDate(a):e.dateJSAndZoneToArcadeDate(a,i):this.attributes[r]=t?e.unknownEpochToArcadeDate(a):e.epochToArcadeDate(a,i)}}}geometry(){return null===this._geometry||this._geometry instanceof p||(this._optimizedGeomDefinition?(this._geometry=b(T(this._geometry,this._optimizedGeomDefinition.geometryType,this._optimizedGeomDefinition.hasZ,this._optimizedGeomDefinition.hasM)),this._geometry.spatialReference=this._optimizedGeomDefinition.spatialReference):this._geometry=b(this._geometry)),this._geometry}field(e){this._fieldTypesFixed||this._fixFieldTypes();const t=this.attributes[e];if(void 0!==t)return t;const i=e.toLowerCase();for(const s in this.attributes)if(s.toLowerCase()===i)return this.attributes[s];if(this._hasFieldDefinition(i))return null;throw new s(null,r.FieldNotFound,null,{key:e})}_hasFieldDefinition(e){if(null===this._layer)return!1;for(let t=0;t<this._layer.fields.length;t++){if(this._layer.fields[t].name.toLowerCase()===e)return!0}return!1}setField(t,i){if(this.immutable)throw new s(null,r.Immutable,null);if(i instanceof Date&&(i=this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(i):e.dateJSToArcadeDate(i)),!1===h(i))throw new s(null,r.TypeNotAllowedInFeature,null);const o=t.toLowerCase();if(void 0===this.attributes[t]){for(const e in this.attributes)if(e.toLowerCase()===o)return void(this.attributes[e]=i);this.attributes[t]=i}else this.attributes[t]=i}hasField(e){const t=e.toLowerCase();if(void 0!==this.attributes[e])return!0;for(const i in this.attributes)if(i.toLowerCase()===t)return!0;return!!this._hasFieldDefinition(t)}keys(){let e=[];const t={};for(const i in this.attributes)e.push(i),t[i.toLowerCase()]=1;if(null!==this._layer)for(let i=0;i<this._layer.fields.length;i++){const s=this._layer.fields[i];1!==t[s.name.toLowerCase()]&&e.push(s.name)}return e=e.sort(),e}static parseGeometryFromDictionary(e,t){const i=w._convertDictionaryToJson(e,!0);return void 0!==i.hasm&&(i.hasM=i.hasm,delete i.hasm),void 0!==i.hasz&&(i.hasZ=i.hasz,delete i.hasz),void 0!==i.spatialreference&&(i.spatialReference=i.spatialreference,delete i.spatialreference),i.spatialReference||(i.spatialReference=t),void 0!==i.rings&&(i.rings=this._fixPathArrays(i.rings,!0===i.hasZ,!0===i.hasZ)),void 0!==i.paths&&(i.paths=this._fixPathArrays(i.paths,!0===i.hasZ,!0===i.hasM)),void 0!==i.points&&(i.points=this._fixPointArrays(i.points,!0===i.hasZ,!0===i.hasM)),b(i)}static _fixPathArrays(e,t,i){const s=[];if(Array.isArray(e))for(let r=0;r<e.length;r++)s.push(this._fixPointArrays(e[r],t,i));else if(e instanceof o)for(let r=0;r<e.length();r++)s.push(this._fixPointArrays(e.get(r),t,i));return s}static _fixPointArrays(e,t,i){const s=[];if(Array.isArray(e))for(let r=0;r<e.length;r++){const a=e[r];a instanceof _?t&&i?s.push([a.x,a.y,a.z,a.m]):t?s.push([a.x,a.y,a.z]):i?s.push([a.x,a.y,a.m]):s.push([a.x,a.y]):a instanceof o?s.push(a.toArray()):s.push(a)}else if(e instanceof o)for(let r=0;r<e.length();r++){const a=e.get(r);a instanceof _?t&&i?s.push([a.x,a.y,a.z,a.m]):t?s.push([a.x,a.y,a.z]):i?s.push([a.x,a.y,a.m]):s.push([a.x,a.y]):a instanceof o?s.push(a.toArray()):s.push(a)}return s}static _convertDictionaryToJson(e,t=!1){const s={};for(const r in e.attributes){let o=e.attributes[r];o instanceof i&&(o=w._convertDictionaryToJson(o)),t?s[r.toLowerCase()]=o:s[r]=o}return s}static parseAttributesFromDictionary(e){const t={};for(const i in e.attributes){const o=e.attributes[i];if(!h(o))throw new s(null,r.InvalidParameter,null);t[i]=o}return t}static fromJson(e,t){let i=null;null!==e.geometry&&void 0!==e.geometry&&(i=b(e.geometry));const o={};if(null!==e.attributes&&void 0!==e.attributes)for(const a in e.attributes){const t=e.attributes[a];if(null===t)o[a]=t;else{if(!(F(t)||x(t)||D(t)||f(t)||u(t)||d(t)))throw new s(null,r.InvalidParameter,null);o[a]=t}}return w.createFromGraphicLikeObject(i,o,null,t??null)}fullSchema(){return this._layer}gdbVersion(){if(null===this._layer)return"";const e=this._layer.gdbVersion;return void 0===e?"":""===e&&this._layer.capabilities?.isVersioned?"SDE.DEFAULT":e}castAsJson(e){const t={attributes:{},geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null};for(const i in this.attributes){const s=this.attributes[i];void 0!==s&&(t.attributes[i]=m(s,e))}return t}async castAsJsonAsync(e=null,t){return this.castAsJson(t)}}t(w);export{w as default};
5
+ import{ArcadeDate as e}from"./ArcadeDate.js";import{configureDeepClone as t}from"./deepClone.js";import i from"./Dictionary.js";import{ArcadeExecutionError as s,ExecutionErrorCodes as r}from"./executionError.js";import{p as o,c as n,s as a,k as l,j as u,g as d,d as m,a as f}from"../chunks/languageUtils.js";import{constructGeometryFromDictionary as y}from"./geometry/constructors.js";import{DateOnly as h}from"../core/sql/DateOnly.js";import{TimeOnly as c}from"../core/sql/TimeOnly.js";import p from"../geometry/Geometry.js";import{fromJSON as _}from"../geometry/support/jsonUtils.js";import{convertToGeometry as b}from"../layers/graphics/featureConversionUtils.js";import T from"../layers/support/FieldsIndex.js";import{isString as g,isNumber as F,isBoolean as x}from"../support/guards.js";class D{constructor(){this.arcadeDeclaredClass="esri.arcade.Feature",this._optimizedGeomDefinition=null,this._geometry=null,this.attributes=null,this._layer=null,this._fieldTypesFixed=!0,this.fieldsIndex=null,this.contextTimeZone=null,this.immutable=!0,this._fieldsToFixDataTypes=null,this.immutable=!0}static createFromGraphic(e,t){const i=new D;return i.contextTimeZone=t??null,i._geometry=null!=e.geometry?e.geometry:null,void 0===e.attributes||null===e.attributes?i.attributes={}:i.attributes=e.attributes,e._sourceLayer?(i._layer=e._sourceLayer,i._fieldTypesFixed=!1):e._layer?(i._layer=e._layer,i._fieldTypesFixed=!1):e.layer&&"fields"in e.layer?(i._layer=e.layer,i._fieldTypesFixed=!1):e.sourceLayer&&"fields"in e.sourceLayer&&(i._layer=e.sourceLayer,i._fieldTypesFixed=!1),i._layer&&!i._fieldTypesFixed&&(i.fieldsIndex=this.hydrateFieldsIndex(i._layer)),i}static createFromArcadeFeature(e){if(e instanceof D){const t=new D;return t._fieldTypesFixed=e._fieldTypesFixed,t.attributes=e.attributes,t._geometry=e._geometry,t._optimizedGeomDefinition=e._optimizedGeomDefinition,e._layer&&(t._layer=e._layer),t.fieldsIndex=e.fieldsIndex,t.contextTimeZone=e.contextTimeZone,t}const t={};for(const i of e.keys())t[i]=e.field(i);return D.createFromGraphicLikeObject(e.geometry(),t,e.fullSchema(),e.contextTimeZone)}static createFromOptimisedFeature(e,t,i){const s=new D;return s._geometry=e.geometry?{geometry:e.geometry}:null,s._optimizedGeomDefinition=i,s.attributes=e.attributes||{},s._layer=t,s._fieldTypesFixed=!1,s}static createFromArcadeDictionary(e,t){const s=new D;return s.attributes=e.field("attributes"),null!==s.attributes&&s.attributes instanceof i?(s.attributes=s.attributes.attributes,null===s.attributes&&(s.attributes={})):s.attributes={},s._geometry=e.field("geometry"),null!==s._geometry&&(s._geometry instanceof i?s._geometry=y(s._geometry,t):s._geometry instanceof p||(s._geometry=null)),s}static createFromGraphicLikeObject(e,t,i=null,s){const r=new D;return r.contextTimeZone=s??null,null===t&&(t={}),r.attributes=t,r._geometry=null!=e?e:null,r._layer=i,r._layer&&(r._fieldTypesFixed=!1,r.fieldsIndex=this.hydrateFieldsIndex(r._layer)),r}static hydrateFieldsIndex(e){return null===e?null:o(e)?e.getFieldsIndex():e.fieldsIndex?e.fieldsIndex:T.fromLayerJSON({datesInUnknownTimezone:e.datesInUnknownTimezone,fields:e.fields,timeInfo:e.timeInfo,editFieldsInfo:e.editFieldsInfo,dateFieldsTimeReference:e.dateFieldsTimeReference??{timeZone:"UTC",respectsDaylightSaving:!1}})}repurposeFromGraphicLikeObject(e,t,i=null){null===t&&(t={}),this.attributes=t,this._geometry=e??null,this._layer=i,this._layer?this._fieldTypesFixed=!1:this._fieldTypesFixed=!0}castToText(e=!1){!1===this._fieldTypesFixed&&this._fixFieldTypes();const t=n(this.attributes,{useNumbersForDates:e});return'{"geometry":'+(null===this.geometry()?"null":a(this.geometry()))+',"attributes":'+t+"}"}_fixFieldTypes(){if(this._fieldsToFixDataTypes&&this._fieldsToFixDataTypes?.length>0)return this._fixAllFields(this._fieldsToFixDataTypes),void(this._fieldTypesFixed=!0);const e=[],t=this._layer.fields;for(let i=0;i<t.length;i++){const s=t[i],{name:r,type:o}=s;switch(o){case"date":case"esriFieldTypeDate":e.push({field:r,dataType:"date"});break;case"date-only":case"esriFieldTypeDateOnly":e.push({field:r,dataType:"date-only"});break;case"time-only":case"esriFieldTypeTimeOnly":e.push({field:r,dataType:"time-only"});break;case"timestamp-offset":case"esriFieldTypeTimestampOffset":e.push({field:r,dataType:"timestamp-offset"})}}this._fieldsToFixDataTypes=e,e.length>0&&this._fixAllFields(e),this._fieldTypesFixed=!0}isUnknownDateTimeField(e){return"unknown"===this.fieldsIndex?.getTimeZone(e)}_fixAllFields(t){this.attributes={...this.attributes};const i=this.contextTimeZone??"system";for(let s=0;s<t.length;s++){const r=t[s].field,o=t[s].dataType;let n=this.attributes[r];if(void 0===n){for(const t in this.attributes)if(t.toLowerCase()===r.toLowerCase()){if(n=this.attributes[t],null!==n){if("time-only"===o){l(n)||(this.attributes[t]=c.fromReader(n.toString()));break}if("date-only"===o){u(n)||(this.attributes[t]=h.fromReader(n.toString()));break}if("timestamp-offset"===o){d(n)||(this.attributes[t]=e.fromReaderAsTimeStampOffset(n.toString()));break}const s=this.isUnknownDateTimeField(t);n instanceof Date?this.attributes[t]=s?e.unknownDateJSToArcadeDate(n):e.dateJSAndZoneToArcadeDate(n,i):d(n)||(this.attributes[t]=s?e.unknownEpochToArcadeDate(n):e.epochToArcadeDate(n,i))}break}}else if(null!==n){if("time-only"===o){l(n)?this.attributes[r]=n:this.attributes[r]=c.fromReader(n.toString());continue}if("date-only"===o){u(n)?this.attributes[r]=n:this.attributes[r]=h.fromReader(n.toString());continue}if("timestamp-offset"===o){d(n)?this.attributes[r]=n:this.attributes[r]=e.fromReaderAsTimeStampOffset(n.toString());continue}const t=this.isUnknownDateTimeField(r);d(n)?this.attributes[r]=n:n instanceof Date?this.attributes[r]=t?e.unknownDateJSToArcadeDate(n):e.dateJSAndZoneToArcadeDate(n,i):this.attributes[r]=t?e.unknownEpochToArcadeDate(n):e.epochToArcadeDate(n,i)}}}geometry(){return null===this._geometry||this._geometry instanceof p||(this._optimizedGeomDefinition?(this._geometry=_(b(this._geometry,this._optimizedGeomDefinition.geometryType,this._optimizedGeomDefinition.hasZ,this._optimizedGeomDefinition.hasM)),this._geometry.spatialReference=this._optimizedGeomDefinition.spatialReference):this._geometry=_(this._geometry)),this._geometry}field(e){this._fieldTypesFixed||this._fixFieldTypes();const t=this.attributes[e];if(void 0!==t)return t;const i=e.toLowerCase();for(const s in this.attributes)if(s.toLowerCase()===i)return this.attributes[s];if(this._hasFieldDefinition(i))return null;throw new s(null,r.FieldNotFound,null,{key:e})}_hasFieldDefinition(e){if(null===this._layer)return!1;for(let t=0;t<this._layer.fields.length;t++){if(this._layer.fields[t].name.toLowerCase()===e)return!0}return!1}setField(t,i){if(this.immutable)throw new s(null,r.Immutable,null);if(i instanceof Date&&(i=this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(i):e.dateJSToArcadeDate(i)),!1===m(i))throw new s(null,r.TypeNotAllowedInFeature,null);const o=t.toLowerCase();if(void 0===this.attributes[t]){for(const e in this.attributes)if(e.toLowerCase()===o)return void(this.attributes[e]=i);this.attributes[t]=i}else this.attributes[t]=i}hasField(e){const t=e.toLowerCase();if(void 0!==this.attributes[e])return!0;for(const i in this.attributes)if(i.toLowerCase()===t)return!0;return!!this._hasFieldDefinition(t)}keys(){let e=[];const t={};for(const i in this.attributes)e.push(i),t[i.toLowerCase()]=1;if(null!==this._layer)for(let i=0;i<this._layer.fields.length;i++){const s=this._layer.fields[i];1!==t[s.name.toLowerCase()]&&e.push(s.name)}return e=e.sort(),e}static parseAttributesFromDictionary(e){const t={};for(const i in e.attributes){const o=e.attributes[i];if(!m(o))throw new s(null,r.InvalidParameter,null);t[i]=o}return t}static fromJson(e,t){let i=null;null!==e.geometry&&void 0!==e.geometry&&(i=_(e.geometry));const o={};if(null!==e.attributes&&void 0!==e.attributes)for(const n in e.attributes){const t=e.attributes[n];if(null===t)o[n]=t;else{if(!(g(t)||F(t)||x(t)||d(t)||l(t)||u(t)))throw new s(null,r.InvalidParameter,null);o[n]=t}}return D.createFromGraphicLikeObject(i,o,null,t??null)}fullSchema(){return this._layer}gdbVersion(){if(null===this._layer)return"";const e=this._layer.gdbVersion;return void 0===e?"":""===e&&this._layer.capabilities?.isVersioned?"SDE.DEFAULT":e}castAsJson(e){const t={attributes:{},geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null};for(const i in this.attributes){const s=this.attributes[i];void 0!==s&&(t.attributes[i]=f(s,e))}return t}async castAsJsonAsync(e=null,t){return this.castAsJson(t)}}t(D);export{D as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import t from"./ImmutableArray.js";import s from"../geometry/Point.js";class i extends t{constructor(t,s,i,e,h,a){super(t),this._lazyPt=[],this._hasZ=!1,this._hasM=!1,this._spRef=s,this._hasZ=i,this._hasM=e,this._cacheId=h,this._partId=a}get(t){if(void 0===this._lazyPt[t]){const i=this._elements[t];if(void 0===i)return;const e=this._hasZ,h=this._hasM;let a;a=e&&!h?new s(i[0],i[1],i[2],void 0,this._spRef):h&&!e?new s(i[0],i[1],void 0,i[2],this._spRef):e&&h?new s(i[0],i[1],i[2],i[3],this._spRef):new s(i[0],i[1],this._spRef),a.cache._arcadeCacheId=this._cacheId.toString()+"-"+this._partId.toString()+"-"+t.toString(),this._lazyPt[t]=a}return this._lazyPt[t]}equalityTest(t){return t===this||null!==t&&(t instanceof i!=!1&&t.getUniqueHash()===this.getUniqueHash())}getUniqueHash(){return this._cacheId.toString()+"-"+this._partId.toString()}}export{i as default};
5
+ import t from"./ImmutableArray.js";import s from"../geometry/Point.js";class i extends t{constructor(t,s,i,h,e,a){super(t),this._lazyPt=[],this._hasZ=!1,this._hasM=!1,this._spRef=s,this._hasZ=i,this._hasM=h,this._cacheId=e,this._partId=a}get(t){if(void 0===this._lazyPt[t]){const i=this._elements[t];if(void 0===i)return;const h=new s(i[0],i[1],this._spRef);this._hasZ&&(h.z=i[2]),this._hasM&&(h.m=this._hasZ?i[3]:i[2]),h.cache._arcadeCacheId=this._cacheId.toString()+"-"+this._partId.toString()+"-"+t.toString(),this._lazyPt[t]=h}return this._lazyPt[t]}equalityTest(t){return t===this||null!==t&&(t instanceof i!=!1&&t.getUniqueHash()===this.getUniqueHash())}getUniqueHash(){return this._cacheId.toString()+"-"+this._partId.toString()}}export{i as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{geometryMember as e,getNestedOptionalValue as t}from"../containerUtils.js";import n from"../Dictionary.js";import{ArcadeExecutionError as r,ExecutionErrorCodes as a}from"../executionError.js";import i from"../Feature.js";import o from"../ImmutablePointArray.js";import{D as l,m as s,u as f,U as c,E as m,n as u,w as p,f as h,g as w,k as y,j as R,i as g,d,K as P,q as v,V as I,z as b,B as F,G as O}from"../../chunks/languageUtils.js";import{angle2D as S,angleBetween2D as j,bearing2D as N,bearingBetween2D as x,pathsSelfIntersecting as J}from"./centroid.js";import D from"../../geometry/Extent.js";import G from"../../geometry/Geometry.js";import k from"../../geometry/Multipoint.js";import Z from"../../geometry/Point.js";import z from"../../geometry/Polygon.js";import W from"../../geometry/Polyline.js";import{isClockwise as q}from"../../geometry/support/coordsUtils.js";import{fromJSON as A}from"../../geometry/support/jsonUtils.js";import{isArray as M,isString as U,isNumber as L,isBoolean as E}from"../../support/guards.js";function _(_,T){_.ringisclockwise=function(e,t){return T(e,t,((n,i,f)=>{l(f,1,1,e,t);let c=[];if(null===f[0])return!1;if(M(f[0]))for(const o of f[0]){if(!(o instanceof Z))throw new r(e,a.InvalidParameter,t);c.push(o.hasZ?o.hasM?[o.x,o.y,o.z,o.m]:[o.x,o.y,o.z]:[o.x,o.y])}else if(f[0]instanceof o)c=f[0]._elements;else{if(!s(f[0]))throw new r(e,a.InvalidParameter,t);for(const n of f[0].toArray()){if(!(n instanceof Z))throw new r(e,a.InvalidParameter,t);c.push(n.hasZ?n.hasM?[n.x,n.y,n.z,n.m]:[n.x,n.y,n.z]:[n.x,n.y])}}return!(c.length<3)&&q(c)}))},_.polygon=function(e,t){return T(e,t,((o,s,m)=>{let u;if(l(m,1,1,e,t),m[0]instanceof n){const n=f(i.parseGeometryFromDictionary(m[0],e.spatialReference),e.spatialReference);if(n instanceof z==!1)throw new r(e,a.InvalidParameter,t);u=n}else if(m[0]instanceof z)u=A(m[0].toJSON());else{const t=JSON.parse(m[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new z(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},_.polyline=function(e,t){return T(e,t,((o,s,m)=>{let u;if(l(m,1,1,e,t),m[0]instanceof n){const n=f(i.parseGeometryFromDictionary(m[0],e.spatialReference),e.spatialReference);if(n instanceof W==!1)throw new r(e,a.InvalidParameter,t);u=n}else if(m[0]instanceof W)u=A(m[0].toJSON());else{const t=JSON.parse(m[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new W(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},_.point=function(e,t){return T(e,t,((o,s,m)=>{let u;if(l(m,1,1,e,t),m[0]instanceof n){const n=f(i.parseGeometryFromDictionary(m[0],e.spatialReference),e.spatialReference);if(n instanceof Z==!1)throw new r(e,a.InvalidParameter,t);u=n}else if(m[0]instanceof Z)u=A(m[0].toJSON());else{const t=JSON.parse(m[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new Z(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},_.multipoint=function(e,t){return T(e,t,((o,s,m)=>{let u;if(l(m,1,1,e,t),m[0]instanceof n){const n=f(i.parseGeometryFromDictionary(m[0],e.spatialReference),e.spatialReference);if(n instanceof k==!1)throw new r(e,a.InvalidParameter,t);u=n}else if(m[0]instanceof k)u=A(m[0].toJSON());else{const t=JSON.parse(m[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new k(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},_.extent=function(e,t){return T(e,t,((o,s,u)=>{u=m(u),l(u,1,1,e,t);let p=null;if(u[0]instanceof n)p=f(i.parseGeometryFromDictionary(u[0],e.spatialReference),e.spatialReference);else if(u[0]instanceof Z){const e={xmin:u[0].x,ymin:u[0].y,xmax:u[0].x,ymax:u[0].y,spatialReference:u[0].spatialReference.toJSON()},t=u[0];t.hasZ&&(e.zmin=t.z,e.zmax=t.z),t.hasM&&(e.mmin=t.m,e.mmax=t.m),p=A(e)}else if(u[0]instanceof z)p=A(u[0].extent?.toJSON());else if(u[0]instanceof W)p=A(u[0].extent?.toJSON());else if(u[0]instanceof k)p=A(u[0].extent?.toJSON());else if(u[0]instanceof D)p=A(u[0].toJSON());else{const t=JSON.parse(u[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),p=f(new D(t),e.spatialReference)}if(null!==p&&!1===p.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(p)}))},_.geometry=function(e,t){return T(e,t,((o,s,m)=>{l(m,1,1,e,t);let p=null;if(null===m[0])return null;if(u(m[0]))p=f(m[0].geometry(),e.spatialReference);else if(m[0]instanceof n)p=f(i.parseGeometryFromDictionary(m[0],e.spatialReference),e.spatialReference);else{const t=JSON.parse(m[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),p=f(A(t),e.spatialReference)}if(null!==p&&!1===p.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(p)}))},_.setgeometry=function(e,t){return T(e,t,((n,i,o)=>{if(l(o,2,2,e,t),!u(o[0]))throw new r(e,a.InvalidParameter,t);if(!0===o[0].immutable)throw new r(e,a.Immutable,t);if(!(o[1]instanceof G||null===o[1]))throw new r(e,a.InvalidParameter,t);return o[0]._geometry=o[1],p}))},_.feature=function(e,t){return T(e,t,((o,l,s)=>{if(0===s.length)throw new r(e,a.WrongNumberOfParameters,t);let c;if(1===s.length)if(U(s[0]))c=i.fromJson(JSON.parse(s[0]),e.timeZone);else if(u(s[0]))c=i.createFromArcadeFeature(s[0]);else if(s[0]instanceof G)c=i.createFromGraphicLikeObject(s[0],null,null,e.timeZone);else{if(!(s[0]instanceof n))throw new r(e,a.InvalidParameter,t);{let t=s[0].hasField("geometry")?s[0].field("geometry"):null,r=s[0].hasField("attributes")?s[0].field("attributes"):null;null!==t&&t instanceof n&&(t=i.parseGeometryFromDictionary(t,e.spatialReference)),null!==r&&(r=i.parseAttributesFromDictionary(r)),c=i.createFromGraphicLikeObject(t,r,null,e.timeZone)}}else if(2===s.length){let o=null,l=null;if(null!==s[0])if(s[0]instanceof G)o=s[0];else{if(!(s[0]instanceof n))throw new r(e,a.InvalidParameter,t);o=i.parseGeometryFromDictionary(s[0],e.spatialReference)}if(null!==s[1]){if(!(s[1]instanceof n))throw new r(e,a.InvalidParameter,t);l=i.parseAttributesFromDictionary(s[1])}c=i.createFromGraphicLikeObject(o,l,null,e.timeZone)}else{let o=null;const l={};if(null!==s[0])if(s[0]instanceof G)o=s[0];else{if(!(s[0]instanceof n))throw new r(e,a.InvalidParameter,t);o=i.parseGeometryFromDictionary(s[0],e.spatialReference)}for(let n=1;n<s.length;n+=2){const i=h(s[n]),o=s[n+1];if(!(null==o||U(o)||isNaN(o)||w(o)||L(o)||y(o)||R(o)||E(o)))throw new r(e,a.InvalidParameter,t);if(g(o)||!1===d(o))throw new r(e,a.InvalidParameter,t);l[i]=o===p?null:o}c=i.createFromGraphicLikeObject(o,l,null,e.timeZone)}return c._geometry=f(c.geometry(),e.spatialReference),c.immutable=!1,c}))},_.dictionary=function(e,t){return T(e,t,((i,o,l)=>{if(0===l.length||1===l.length&&null===l[0]){const e=new n;return e.immutable=!1,e}if(1===l.length&&U(l[0]))try{const t=JSON.parse(l[0]),r=n.convertObjectToArcadeDictionary(t,P(e),!1);return r.immutable=!1,r}catch(m){throw new r(e,a.InvalidParameter,t)}if(1===l.length&&l[0]instanceof G)try{const t=l[0].toJSON();t.hasZ=!0===l[0].hasZ,t.hasM=!0===l[0].hasM;const r=n.convertObjectToArcadeDictionary(t,P(e),!1);return r.immutable=!1,r}catch(m){throw new r(e,a.InvalidParameter,t)}if(1===l.length&&u(l[0]))try{const e=new n;e.immutable=!1,e.setField("geometry",l[0].geometry());const t=new n;t.immutable=!1,e.setField("attributes",t);for(const n of l[0].keys())t.setField(n,l[0].field(n));return e}catch(m){throw new r(e,a.InvalidParameter,t)}if(1===l.length&&(v(l[0])||I(l[0])))try{const e=new n;e.immutable=!1;for(const t of l[0].keys())e.setField(t,l[0].field(t));return e}catch(m){throw new r(e,a.InvalidParameter,t)}if(2===l.length&&l[0]instanceof n&&E(l[1]))try{if(!(!0===l[1])){const e=new n;e.immutable=!1;for(const t of l[0].keys())e.setField(t,l[0].field(t));return e}return l[0].deepClone()}catch(m){throw new r(e,a.InvalidParameter,t)}if(l.length%2!=0)throw new r(e,a.WrongNumberOfParameters,t);const f={};for(let n=0;n<l.length;n+=2){const i=h(l[n]),o=l[n+1];if(!(null==o||U(o)||isNaN(o)||w(o)||L(o)||E(o)||R(o)||y(o)||M(o)||s(o)))throw new r(e,a.InvalidParameter,t);if(g(o))throw new r(e,a.InvalidParameter,t);f[i]=o===p?null:o}const c=new n(f);return c.immutable=!1,c}))},_.haskey=function(t,i){return T(t,i,((o,s,f)=>{l(f,2,2,t,i);const c=h(f[1]);if(b(f[0])||f[0]instanceof n)return f[0].hasField(c);if(f[0]instanceof G){const t=e(f[0],c,null,null,2);return!t||"notfound"!==t.keystate}throw new r(t,a.InvalidParameter,i)}))},_.hasvalue=function(e,n){return T(e,n,((r,a,i)=>(l(i,2,2,e,n),null!=t(i[0],i[1]))))},_.indexof=function(e,t){return T(e,t,((n,i,o)=>{l(o,2,2,e,t);const f=o[1];if(M(o[0])){for(let e=0;e<o[0].length;e++)if(F(f,o[0][e]))return e;return-1}if(s(o[0])){const e=o[0].length();for(let t=0;t<e;t++)if(F(f,o[0].get(t)))return t;return-1}throw new r(e,a.InvalidParameter,t)}))},_.angle=function(e,t){return T(e,t,((n,i,o)=>{if(o=m(o),l(o,2,3,e,t),!(o[0]instanceof Z))throw new r(e,a.InvalidParameter,t);if(!(o[1]instanceof Z))throw new r(e,a.InvalidParameter,t);if(o.length>2&&!(o[2]instanceof Z))throw new r(e,a.InvalidParameter,t);return 2===o.length?S(o[0],o[1]):j(o[0],o[1],o[2])}))},_.bearing=function(e,t){return T(e,t,((n,i,o)=>{if(o=m(o),l(o,2,3,e,t),!(o[0]instanceof Z))throw new r(e,a.InvalidParameter,t);if(!(o[1]instanceof Z))throw new r(e,a.InvalidParameter,t);if(o.length>2&&!(o[2]instanceof Z))throw new r(e,a.InvalidParameter,t);return 2===o.length?N(o[0],o[1]):x(o[0],o[1],o[2])}))},_.isselfintersecting=function(e,t){return T(e,t,((n,r,a)=>{a=m(a),l(a,1,1,e,t);let i=a[0];if(i instanceof z)return i.isSelfIntersecting;if(i instanceof W)return J(i.paths);if(i instanceof k){const e=i.points;for(let t=0;t<e.length;t++)for(let n=0;n<e.length;n++)if(n!==t){let r=!0;for(let a=0;a<e[t].length;a++)if(e[t][a]!==e[n][a]){r=!1;break}if(!0===r)return!0}}if(M(i)||s(i)){const t=O(i,e.spatialReference);return null!==t&&(i=t.paths),J(i)}return!1}))}}export{_ as registerFunctions};
5
+ import{geometryMember as e,getNestedOptionalValue as t}from"../containerUtils.js";import n from"../Dictionary.js";import{ArcadeExecutionError as r,ExecutionErrorCodes as a}from"../executionError.js";import i from"../Feature.js";import l from"../ImmutablePointArray.js";import{D as o,m as s,u as f,U as c,E as u,n as m,w as p,q as h,l as w,f as g,g as R,k as y,j as d,i as P,d as v,K as I,V as b,z as O,B as j,G as S}from"../../chunks/languageUtils.js";import{angle2D as N,angleBetween2D as x,bearing2D as J,bearingBetween2D as F,pathsSelfIntersecting as k}from"./centroid.js";import{constructGeometryFromDictionary as Z}from"../geometry/constructors.js";import z from"../../geometry/Extent.js";import W from"../../geometry/Geometry.js";import q from"../../geometry/Multipoint.js";import A from"../../geometry/Point.js";import D from"../../geometry/Polygon.js";import G from"../../geometry/Polyline.js";import{isClockwise as M}from"../../geometry/support/coordsUtils.js";import{fromJSON as U}from"../../geometry/support/jsonUtils.js";import{isArray as L,isString as E,isNumber as _,isBoolean as T}from"../../support/guards.js";function B(B,C){B.ringisclockwise=function(e,t){return C(e,t,((n,i,f)=>{o(f,1,1,e,t);let c=[];if(null===f[0])return!1;if(L(f[0]))for(const l of f[0]){if(!(l instanceof A))throw new r(e,a.InvalidParameter,t);c.push(l.hasZ?l.hasM?[l.x,l.y,l.z,l.m]:[l.x,l.y,l.z]:[l.x,l.y])}else if(f[0]instanceof l)c=f[0]._elements;else{if(!s(f[0]))throw new r(e,a.InvalidParameter,t);for(const n of f[0].toArray()){if(!(n instanceof A))throw new r(e,a.InvalidParameter,t);c.push(n.hasZ?n.hasM?[n.x,n.y,n.z,n.m]:[n.x,n.y,n.z]:[n.x,n.y])}}return!(c.length<3)&&M(c)}))},B.polygon=function(e,t){return C(e,t,((i,l,s)=>{let u;if(o(s,1,1,e,t),s[0]instanceof n){const t=f(Z(s[0],e.spatialReference,"polygon"),e.spatialReference);if(null==t)return null;u=t}else if(s[0]instanceof D)u=U(s[0].toJSON());else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new D(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},B.polyline=function(e,t){return C(e,t,((i,l,s)=>{let u;if(o(s,1,1,e,t),s[0]instanceof n){const t=f(Z(s[0],e.spatialReference,"polyline"),e.spatialReference);if(null==t)return null;u=t}else if(s[0]instanceof G)u=U(s[0].toJSON());else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new G(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},B.point=function(e,t){return C(e,t,((i,l,s)=>{let u;if(o(s,1,1,e,t),s[0]instanceof n){const t=f(Z(s[0],e.spatialReference,"point"),e.spatialReference);if(null==t)return null;u=t}else if(s[0]instanceof A)u=U(s[0].toJSON());else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new A(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},B.multipoint=function(e,t){return C(e,t,((i,l,s)=>{let u;if(o(s,1,1,e,t),s[0]instanceof n){const t=f(Z(s[0],e.spatialReference,"multipoint"),e.spatialReference);if(null==t)return null;u=t}else if(s[0]instanceof q)u=U(s[0].toJSON());else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new q(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},B.extent=function(e,t){return C(e,t,((i,l,s)=>{s=u(s),o(s,1,1,e,t);let m=null;if(s[0]instanceof n)m=f(Z(s[0],e.spatialReference),e.spatialReference);else if(s[0]instanceof A){const e={xmin:s[0].x,ymin:s[0].y,xmax:s[0].x,ymax:s[0].y,spatialReference:s[0].spatialReference.toJSON()},t=s[0];t.hasZ&&(e.zmin=t.z,e.zmax=t.z),t.hasM&&(e.mmin=t.m,e.mmax=t.m),m=U(e)}else if(s[0]instanceof D)m=U(s[0].extent?.toJSON());else if(s[0]instanceof G)m=U(s[0].extent?.toJSON());else if(s[0]instanceof q)m=U(s[0].extent?.toJSON());else if(s[0]instanceof z)m=U(s[0].toJSON());else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),m=f(new z(t),e.spatialReference)}if(null!==m&&!1===m.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(m)}))},B.geometry=function(e,t){return C(e,t,((i,l,s)=>{o(s,1,1,e,t);let u=null;if(null===s[0])return null;if(m(s[0]))u=f(s[0].geometry(),e.spatialReference);else if(s[0]instanceof n)u=f(Z(s[0],e.spatialReference),e.spatialReference);else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(U(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},B.setgeometry=function(e,t){return C(e,t,((n,i,l)=>{if(o(l,2,2,e,t),!m(l[0]))throw new r(e,a.InvalidParameter,t);if(!0===l[0].immutable)throw new r(e,a.Immutable,t);if(!(l[1]instanceof W||null===l[1]))throw new r(e,a.InvalidParameter,t);return l[0]._geometry=l[1],p}))},B.feature=function(e,t){return C(e,t,((l,o,s)=>{if(0===s.length)throw new r(e,a.WrongNumberOfParameters,t);let c;if(1===s.length)if(E(s[0]))c=i.fromJson(JSON.parse(s[0]),e.timeZone);else if(m(s[0]))c=i.createFromArcadeFeature(s[0]);else if(s[0]instanceof W)c=i.createFromGraphicLikeObject(s[0],null,null,e.timeZone);else{if(!(s[0]instanceof n))throw new r(e,a.InvalidParameter,t);{const n=s[0].hasField("geometry")?s[0].field("geometry"):null,l=s[0].hasField("attributes")?s[0].field("attributes"):null;let o,f;if(h(n))o=Z(n,e.spatialReference);else{if(null!=n&&!w(n))throw new r(e,a.InvalidParameter,t);o=n}if(h(l))f=i.parseAttributesFromDictionary(l);else{if(null!=l)throw new r(e,a.InvalidParameter,t);f=null}c=i.createFromGraphicLikeObject(o,f,null,e.timeZone)}}else if(2===s.length){let l=null,o=null;if(null!==s[0])if(s[0]instanceof W)l=s[0];else{if(!(s[0]instanceof n))throw new r(e,a.InvalidParameter,t);l=Z(s[0],e.spatialReference)}if(null!==s[1]){if(!(s[1]instanceof n))throw new r(e,a.InvalidParameter,t);o=i.parseAttributesFromDictionary(s[1])}c=i.createFromGraphicLikeObject(l,o,null,e.timeZone)}else{let l=null;const o={};if(null!==s[0])if(s[0]instanceof W)l=s[0];else{if(!(s[0]instanceof n))throw new r(e,a.InvalidParameter,t);l=Z(s[0],e.spatialReference)}for(let n=1;n<s.length;n+=2){const i=g(s[n]),l=s[n+1];if(!(null==l||E(l)||isNaN(l)||R(l)||_(l)||y(l)||d(l)||T(l)))throw new r(e,a.InvalidParameter,t);if(P(l)||!1===v(l))throw new r(e,a.InvalidParameter,t);o[i]=l===p?null:l}c=i.createFromGraphicLikeObject(l,o,null,e.timeZone)}return c._geometry=f(c.geometry(),e.spatialReference),c.immutable=!1,c}))},B.dictionary=function(e,t){return C(e,t,((i,l,o)=>{if(0===o.length||1===o.length&&null===o[0]){const e=new n;return e.immutable=!1,e}if(1===o.length&&E(o[0]))try{const t=JSON.parse(o[0]),r=n.convertObjectToArcadeDictionary(t,I(e),!1);return r.immutable=!1,r}catch(u){throw new r(e,a.InvalidParameter,t)}if(1===o.length&&o[0]instanceof W)try{const t=o[0].toJSON();t.hasZ=!0===o[0].hasZ,t.hasM=!0===o[0].hasM;const r=n.convertObjectToArcadeDictionary(t,I(e),!1);return r.immutable=!1,r}catch(u){throw new r(e,a.InvalidParameter,t)}if(1===o.length&&m(o[0]))try{const e=new n;e.immutable=!1,e.setField("geometry",o[0].geometry());const t=new n;t.immutable=!1,e.setField("attributes",t);for(const n of o[0].keys())t.setField(n,o[0].field(n));return e}catch(u){throw new r(e,a.InvalidParameter,t)}if(1===o.length&&(h(o[0])||b(o[0])))try{const e=new n;e.immutable=!1;for(const t of o[0].keys())e.setField(t,o[0].field(t));return e}catch(u){throw new r(e,a.InvalidParameter,t)}if(2===o.length&&o[0]instanceof n&&T(o[1]))try{if(!(!0===o[1])){const e=new n;e.immutable=!1;for(const t of o[0].keys())e.setField(t,o[0].field(t));return e}return o[0].deepClone()}catch(u){throw new r(e,a.InvalidParameter,t)}if(o.length%2!=0)throw new r(e,a.WrongNumberOfParameters,t);const f={};for(let n=0;n<o.length;n+=2){const i=g(o[n]),l=o[n+1];if(!(null==l||E(l)||isNaN(l)||R(l)||_(l)||T(l)||d(l)||y(l)||L(l)||s(l)))throw new r(e,a.InvalidParameter,t);if(P(l))throw new r(e,a.InvalidParameter,t);f[i]=l===p?null:l}const c=new n(f);return c.immutable=!1,c}))},B.haskey=function(t,i){return C(t,i,((l,s,f)=>{o(f,2,2,t,i);const c=g(f[1]);if(O(f[0])||f[0]instanceof n)return f[0].hasField(c);if(f[0]instanceof W){const t=e(f[0],c,null,null,2);return!t||"notfound"!==t.keystate}throw new r(t,a.InvalidParameter,i)}))},B.hasvalue=function(e,n){return C(e,n,((r,a,i)=>(o(i,2,2,e,n),null!=t(i[0],i[1]))))},B.indexof=function(e,t){return C(e,t,((n,i,l)=>{o(l,2,2,e,t);const f=l[1];if(L(l[0])){for(let e=0;e<l[0].length;e++)if(j(f,l[0][e]))return e;return-1}if(s(l[0])){const e=l[0].length();for(let t=0;t<e;t++)if(j(f,l[0].get(t)))return t;return-1}throw new r(e,a.InvalidParameter,t)}))},B.angle=function(e,t){return C(e,t,((n,i,l)=>{if(l=u(l),o(l,2,3,e,t),!(l[0]instanceof A))throw new r(e,a.InvalidParameter,t);if(!(l[1]instanceof A))throw new r(e,a.InvalidParameter,t);if(l.length>2&&!(l[2]instanceof A))throw new r(e,a.InvalidParameter,t);return 2===l.length?N(l[0],l[1]):x(l[0],l[1],l[2])}))},B.bearing=function(e,t){return C(e,t,((n,i,l)=>{if(l=u(l),o(l,2,3,e,t),!(l[0]instanceof A))throw new r(e,a.InvalidParameter,t);if(!(l[1]instanceof A))throw new r(e,a.InvalidParameter,t);if(l.length>2&&!(l[2]instanceof A))throw new r(e,a.InvalidParameter,t);return 2===l.length?J(l[0],l[1]):F(l[0],l[1],l[2])}))},B.isselfintersecting=function(e,t){return C(e,t,((n,r,a)=>{a=u(a),o(a,1,1,e,t);let i=a[0];if(i instanceof D)return i.isSelfIntersecting;if(i instanceof G)return k(i.paths);if(i instanceof q){const e=i.points;for(let t=0;t<e.length;t++)for(let n=0;n<e.length;n++)if(n!==t){let r=!0;for(let a=0;a<e[t].length;a++)if(e[t][a]!==e[n][a]){r=!1;break}if(!0===r)return!0}}if(L(i)||s(i)){const t=S(i,e.spatialReference);return null!==t&&(i=t.paths),k(i)}return!1}))}}export{B as registerFunctions};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
+ */
5
+ import{ArcadeExecutionError as n,ExecutionErrorCodes as r}from"../executionError.js";import t from"../ImmutableArray.js";import{q as s}from"../../chunks/languageUtils.js";import{ensureNumber as e}from"../../core/accessorSupport/ensureType.js";import a from"../../geometry/Point.js";import{fromJSON as o}from"../../geometry/support/jsonUtils.js";function i(t,s,e=null){const a=u(t,!0);if(void 0!==a.hasm&&(a.hasM=a.hasm,delete a.hasm),void 0!==a.hasz&&(a.hasZ=a.hasz,delete a.hasz),void 0!==a.spatialreference&&(a.spatialReference=a.spatialreference,delete a.spatialreference),a.spatialReference||(a.spatialReference=s),void 0!==a.rings){const n=I(f(a.rings),a.hasZ,a.hasM);if(null==n)return null;a.rings=n.arrays,a.hasZ=n.hasZ,a.hasM=n.hasM}if(void 0!==a.paths){const n=I(f(a.paths),a.hasZ,a.hasM);if(null==n)return null;a.paths=n.arrays,a.hasZ=n.hasZ,a.hasM=n.hasM}if(void 0!==a.points){const n=k(a.points,a.hasZ,a.hasM);if(null==n)return null;a.points=n.array,a.hasZ=n.hasZ,a.hasM=n.hasM}const i=o(a);if(null!=e&&i?.type!==e)throw new n(null,r.InvalidParameter,null);return i}function u(n,r=!1){const t={};for(const e of n.keys()){const a=r?e.toLowerCase():e,o=n.attributes[e];t[a]=s(o)?u(o):o}return t}const l=Symbol("NoValue");function h(n){return Array.isArray(n)&&n.length>0?n[0]:n instanceof t&&n.length()>0?n.get(0):l}function f(n){const r=h(h(n));return r===l||Array.isArray(r)||r instanceof t||r instanceof a?n:[n]}const c=0;function p(n){return e(n,c)??c}function y(n){return"number"==typeof n&&!Number.isNaN(n)}const m=null;function g(n){return e(n,m)??m}function M(n){return"number"==typeof n&&!Number.isNaN(n)||null===n}function Z(n){return!(n.length<2)&&("number"==typeof n[0]&&!Number.isNaN(n[0])&&("number"==typeof n[1]&&!Number.isNaN(n[1])))}function d(n){return Z(n)?n.length>2?n.slice(0,2):n:null}function A(n){return Z(n)?y(n[2])?n.length>3?n.slice(0,3):n:[n[0],n[1],p(n[2])]:null}function N(n){return Z(n)?n.length>=3&&!M(n[2])?[n[0],n[1],g(n[2])]:n.length>3?n.slice(0,3):n:null}function b(n){return Z(n)?y(n[2])&&M(n[3])?n.length>4?n.slice(0,4):n:[n[0],n[1],p(n[2]),g(n[3])]:null}function v(n,r){return n?r?b:A:r?N:d}function j(n,r){return n?r?n=>[n.x,n.y,n.z??c,n.m??m]:n=>[n.x,n.y,n.z??c]:r?n=>[n.x,n.y,n.m??m]:n=>[n.x,n.y]}function x(n,r,s){return Array.isArray(n)?s(n):n instanceof a?r(n):n instanceof t?s(n.toArray()):null}function z(n,r,s){return Array.isArray(n)?n.length>=r:n instanceof t?n.length()>=r:n instanceof a&&n[s]}function w(n,r,t){return void 0===n&&void 0===r?{hasZ:z(t,3,"hasZ"),hasM:z(t,4,"hasM")}:void 0===n?!0===r?{hasZ:z(t,4,"hasZ"),hasM:!0}:{hasZ:z(t,3,"hasZ"),hasM:!1}:void 0===r?!0===n?{hasZ:!0,hasM:z(t,4,"hasM")}:{hasZ:!1,hasM:z(t,3,"hasM")}:{hasZ:!0===n,hasM:!0===r}}function R(n,r,s){const e=[];if(Array.isArray(n))for(let t=0;t<n.length;t++){const a=x(n[t],r,s);null!=a&&e.push(a)}else if(n instanceof t)for(let t=0;t<n.length();t++){const a=x(n.get(t),r,s);null!=a&&e.push(a)}return e}function k(n,r,t){const s=h(n);if(s===l)return null;const{hasZ:e,hasM:a}=w(r,t,s);return{array:R(n,j(e,a),v(e,a)),hasZ:e,hasM:a}}function I(n,r,s){const e=h(h(n));if(e===l)return null;const{hasZ:a,hasM:o}=w(r,s,e),i=j(a,o),u=v(a,o),f=[];if(Array.isArray(n))for(let t=0;t<n.length;t++)f.push(R(n[t],i,u));else if(n instanceof t)for(let t=0;t<n.length();t++)f.push(R(n.get(t),i,u));return{arrays:f,hasZ:a,hasM:o}}export{i as constructGeometryFromDictionary};