@arcgis/core 5.2.0-next.97 → 5.2.0-next.99

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 (68) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{1201bb22a2bfd7d7ecba.js → 3c0421a4a0ee3a3c63f8.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{d453627894e6e5b02023.js → 53a6bfebf3904dd7cad9.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{ca8061e0a6d78d646ebf.js → 89234e3c7917f1befe10.js} +1 -1
  5. package/assets/esri/core/workers/chunks/8f53053d26210837ec34.js +1 -0
  6. package/assets/esri/core/workers/chunks/{6ceb17eada151230abf7.js → a88aa26a7bee1fe7aea2.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{5d6733dcee9c2ef00072.js → c511af7afe08a78e2a4d.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{6319413b89e23f671487.js → cf49a13522d61da31d8f.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{dd55737fba0a8fe68101.js → d7659d2b2aea0dd1202d.js} +3 -3
  10. package/assets/esri/core/workers/chunks/{5d7625eb9997cd0dff09.js → d785434bbeab89cd64ba.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{471027e4280bd51167b0.js → eb222dc01344ed07719e.js} +1 -1
  12. package/assets/esri/core/workers/chunks/efdb0bcdb8d547868ecb.js +1 -0
  13. package/assets/esri/core/workers/chunks/{374d726fdd0a9848cea5.js → f2cbcd1b0e77e733a8e0.js} +1 -1
  14. package/assets/esri/libs/librust-parquet/pkg/bundle_bg.wasm +0 -0
  15. package/chunks/GlobalIllumination.glsl.js +3 -3
  16. package/chunks/bundle.js +1 -1
  17. package/config.js +1 -1
  18. package/kernel.js +1 -1
  19. package/layers/graphics/sources/parquet/FileProvider.js +1 -1
  20. package/layers/graphics/sources/parquet/ParquetFileInfo.js +1 -1
  21. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  22. package/layers/parquet.js +2 -0
  23. package/libs/{parquet → librust-parquet}/loadParquetModule.js +1 -1
  24. package/libs/{text → librust-text}/loadTextModule.js +1 -1
  25. package/package.json +2 -2
  26. package/rest/featureService/types.d.ts +3 -1
  27. package/rest/featureService/utils.d.ts +3 -1
  28. package/rest/featureService/utils.js +1 -1
  29. package/support/revision.js +1 -1
  30. package/versionManagement/VersionManagementService.js +1 -1
  31. package/versionManagement/VersionManager.js +1 -1
  32. package/versionManagement/versionAdapters/AnnotationFeatureLayerVersionAdapter.js +2 -0
  33. package/versionManagement/versionAdapters/DimensionFeatureLayerVersionAdapter.js +2 -0
  34. package/versionManagement/versionAdapters/types.d.ts +4 -2
  35. package/versionManagement/versionAdapters/utils.d.ts +4 -2
  36. package/versionManagement/versionAdapters/utils.js +1 -1
  37. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  38. package/views/2d/engine/webgl/GlyphWorker.js +1 -1
  39. package/views/2d/engine/webgl/Overlay.js +1 -1
  40. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  41. package/views/2d/layers/VectorTileLayerView2D.js +1 -1
  42. package/views/2d/layers/features/sources/strategies/ParquetSnapshotLoadStrategy.js +1 -1
  43. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  44. package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
  45. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  46. package/views/View.js +1 -1
  47. package/views/support/drapedUtils.js +1 -1
  48. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +12 -3
  49. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  50. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  51. package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
  52. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  53. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  54. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  55. package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +1 -1
  56. package/widgets/Editor/legacy/MergeFeaturesWorkflow.js +1 -1
  57. package/widgets/Editor/legacy/SplitFeatureWorkflow.js +1 -1
  58. package/widgets/Editor/legacy/UpdateFeaturesWorkflow.js +1 -1
  59. package/widgets/Editor/legacy/UpdateRecordWorkflow.js +1 -1
  60. package/widgets/FeatureForm/FeatureFormViewModel.d.ts +15 -3
  61. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  62. package/widgets/Sketch/SelectionToolVisibilityMap.d.ts +2 -2
  63. package/widgets/Sketch/SelectionToolVisibilityMap.js +1 -1
  64. package/assets/esri/core/workers/chunks/6cc03ef97d7731153b9a.js +0 -1
  65. package/assets/esri/core/workers/chunks/93a7cf23f73b23fc7802.js +0 -1
  66. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  67. package/libs/parquet/parquet.js +0 -2
  68. /package/assets/esri/libs/{text → librust-text}/pkg/bundle_bg.wasm +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.2.0-next.97",
3
+ "version": "5.2.0-next.99",
4
4
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
5
5
  "keywords": [
6
6
  "ArcGIS",
@@ -20,7 +20,7 @@
20
20
  "license": "SEE LICENSE IN LICENSE.md",
21
21
  "dependencies": {
22
22
  "@amcharts/amcharts5": "~5.20.4",
23
- "@arcgis/toolkit": "5.2.0-next.97",
23
+ "@arcgis/toolkit": "5.2.0-next.99",
24
24
  "@esri/arcgis-html-sanitizer": "~4.1.0",
25
25
  "@esri/calcite-components": "^5.2.0-next.65",
26
26
  "@vaadin/grid": "~25.2.9",
@@ -1,3 +1,5 @@
1
+ import type AnnotationFeatureLayer from "../../layers/AnnotationFeatureLayer.js";
2
+ import type DimensionFeatureLayer from "../../layers/DimensionFeatureLayer.js";
1
3
  import type FeatureLayer from "../../layers/FeatureLayer.js";
2
4
  import type SubtypeGroupLayer from "../../layers/SubtypeGroupLayer.js";
3
5
  import type FeatureService from "./FeatureService.js";
@@ -294,7 +296,7 @@ export interface FeatureServiceResourcesBundle {
294
296
  *
295
297
  * @since 5.0
296
298
  */
297
- layers: (FeatureLayer | SubtypeGroupLayer)[];
299
+ layers: (FeatureLayer | SubtypeGroupLayer | AnnotationFeatureLayer | DimensionFeatureLayer)[];
298
300
  }
299
301
 
300
302
  /**
@@ -3,6 +3,8 @@
3
3
  *
4
4
  * @since 4.28
5
5
  */
6
+ import type AnnotationFeatureLayer from "../../layers/AnnotationFeatureLayer.js";
7
+ import type DimensionFeatureLayer from "../../layers/DimensionFeatureLayer.js";
6
8
  import type FeatureLayer from "../../layers/FeatureLayer.js";
7
9
  import type GroupLayer from "../../layers/GroupLayer.js";
8
10
  import type SubtypeGroupLayer from "../../layers/SubtypeGroupLayer.js";
@@ -21,4 +23,4 @@ import type { FeatureServiceResourcesBundle } from "./types.js";
21
23
  * //loading featureService from map object.
22
24
  * const featureService = await mapOfServices.get(`yourFeatureServiceLink/arcgis/rest/services/TestService/FeatureServer`).featureService.load();
23
25
  */
24
- export function createFeatureServices(layers: Iterable<FeatureLayer | SubtypeGroupLayer | GroupLayer>): Map<string, FeatureServiceResourcesBundle>;
26
+ export function createFeatureServices(layers: Iterable<FeatureLayer | SubtypeGroupLayer | AnnotationFeatureLayer | DimensionFeatureLayer | GroupLayer>): Map<string, FeatureServiceResourcesBundle>;
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{parse as e}from"../../layers/support/arcgisLayerUrl.js";import r from"./FeatureService.js";const t=(p,o)=>{for(const s of p)if("feature"===s.type||"subtype-group"===s.type){if(!s.url)continue;const t=e(s.url).url.path,p=o.get(t);if(p)p.layers.push(s);else{const e=new r({url:t}),p=[s];o.set(t,{featureService:e,layers:p})}}else"group"===s.type&&t(s.layers.filter(e=>"feature"===e.type||"subtype-group"===e.type||"group"===e.type),o)};function p(e){const r=new Map;return t(e,r),r}export{p as createFeatureServices};
2
+ import{parse as e}from"../../layers/support/arcgisLayerUrl.js";import t from"./FeatureService.js";const r=(o,p)=>{for(const u of o)if("feature"===u.type||"subtype-group"===u.type||"annotation-feature"===u.type||"dimension-feature"===u.type){if(!u.url)continue;const r=e(u.url).url.path,o=p.get(r);if(o)o.layers.push(u);else{const e=new t({url:r}),o=[u];p.set(r,{featureService:e,layers:o})}}else"group"===u.type&&r(u.layers.filter(e=>"feature"===e.type||"subtype-group"===e.type||"annotation-feature"===e.type||"dimension-feature"===e.type||"group"===e.type),p)};function o(e){const t=new Map;return r(e,t),t}export{o as createFeatureServices};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- const e="20260903",d="2f7fe4370d2629a3bfeb0567d89a796eede6e1d5";export{e as buildDate,d as revision};
2
+ const b="20260903",c="82636dc379f23b4b44bc32d2c87a6f30a4ba01f7";export{b as buildDate,c as revision};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../request.js";import r from"../core/Error.js";import{JSONSupportMixin as s}from"../core/JSONSupport.js";import{Loadable as i}from"../core/Loadable.js";import{removeTrailingSlash as n,Url as o}from"../core/urlUtils.js";import{property as a,subclass as u}from"../core/accessorSupport/decorators.js";import{onApplyEditsEvent as l,emitUpdateMomentEvent as d}from"../layers/mixins/EditBusLayer.js";import{parseUrl as c}from"../rest/utils.js";import m from"./support/EditMomentStack.js";import{versionCollection as f,versionCollectionCount as g,defaultVersionNameLookup as h,currentSessionId as p}from"./support/versionManagementUtils.js";import{createVersionAdapters as V}from"./versionAdapters/utils.js";import{reader as v}from"../core/accessorSupport/decorators/reader.js";import{writer as w}from"../core/accessorSupport/decorators/writer.js";let y=class extends(s(i)){constructor(e){super(e),this.url=null,this.sourceJSON=null,this.name=null,this.defaultVersionIdentifier=null,this.capabilities=null,this._isDefault=e=>!e||e===this.defaultVersionIdentifier.name,this._dateEquals=(e,t)=>!e&&!t||!(!e||!t)&&e.toISOString()===t.toISOString(),this._applyEditsHandler=e=>{const{serviceUrl:t,gdbVersion:r,result:s}=e;t===this._featureServiceUrl&&s.then(e=>{const t=e.historicMoment;t&&this._addMomentToVersionItem(r,t)},()=>{})}}initialize(){this.url=n(this.url),this._featureServiceUrl=this.url.replace(/\/VersionManagementServer/i,"/FeatureServer"),f.has(this.url)||f.set(this.url,new Map);const e=(g.get(this.url)??0)+1;g.set(this.url,e),this.when().then(()=>this.addHandles(l(this._applyEditsHandler)),()=>{})}destroy(){const e=(g.get(this.url)??1)-1;g.set(this.url,e),0===e&&f.delete(this.url),h.delete(this._featureServiceUrl)}read(e,t){this.sourceJSON=e,super.read(e,t)}readDefaultVersionIdentifier(e,t){return{name:t.defaultVersionName,guid:t.defaultVersionGuid}}writeDefaultVersionIdentifier(e,t){t.defaultVersionName=e.name,t.defaultVersionGuid=e.guid}get loaded(){return super.loaded}load(e){return this.addResolvingPromise(this._fetchService(this.url,e)),Promise.resolve(this)}async createVersion(e){const[{createVersion:t},{default:r}]=await Promise.all([import("../rest/versionManagement/createVersion.js"),import("../rest/versionManagement/support/CreateVersionParameters.js")]),s=r.from(e);return t(this.url,s)}async deleteVersion(e){const[{deleteVersion:t},{default:r}]=await Promise.all([import("../rest/versionManagement/deleteVersion.js"),import("../rest/versionManagement/support/DeleteVersionParameters.js")]);let s;e.guid&&f.get(this.url)?.has(e.guid)&&(s=p??void 0);const i=new r({versionName:e.name,sessionId:s});return t(this.url,i)}async getVersionInfoExtended(e){const{getVersion:t}=await(import("../rest/versionManagement/getVersion.js"));return t(this.url,e.guid)}async getVersionInfos(e={}){const[{getVersionInfos:t},{default:r}]=await Promise.all([import("../rest/versionManagement/getVersionInfos.js"),import("../rest/versionManagement/support/GetVersionInfosParameters.js")]),s=r.from(e);return t(this.url,s)}async reconcile(e,t={}){const[{reconcile:r},{default:s}]=await Promise.all([import("../rest/versionManagement/gdbVersion/reconcile.js"),import("../rest/versionManagement/gdbVersion/support/ReconcileParameters.js")]),i=s.from(t);i.sessionId=p;const n=await r(this.url,e.guid,i);if(n.success&&n.moment){const t=n.moment;d(this._featureServiceUrl,null,e.name,t),this._addMomentToVersionItem(e.guid,t)}return n}async post(e){const[{post:t},{default:r}]=await Promise.all([import("../rest/versionManagement/gdbVersion/post.js"),import("../rest/versionManagement/gdbVersion/support/PostParameters.js")]),s=r.from({sessionId:p}),i=await t(this.url,e.guid,s);if(i.success&&i.moment){const t=i.moment;d(this._featureServiceUrl,null,e.name,t),this._addMomentToVersionItem(e.guid,t)}return i}async alterVersion(e,t){const[{alterVersion:r},{default:s}]=await Promise.all([import("../rest/versionManagement/gdbVersion/alterVersion.js"),import("../rest/versionManagement/gdbVersion/support/AlterVersionParameters.js")]),i=s.from(t);return r(this.url,e.guid,i)}async startReading(e){return(await this.startReadingWithResult(e)).success}async startReadingWithResult(e){const{startReading:t}=await(import("../rest/versionManagement/gdbVersion/startReading.js")),r=await t(this.url,e.guid,p);if(r.success){const t=await this.getVersionInfoExtended(e),r=new Date(t.modifiedDate),s={name:t.versionIdentifier.name,moment:r,lockType:"read"};this._addOrUpdateItem(e.guid,s),d(this._featureServiceUrl,null,e.name,r)}return r}async stopReading(e){return(await this.stopReadingWithResult(e)).success}async stopReadingWithResult(e){const{stopReading:t}=await(import("../rest/versionManagement/gdbVersion/stopReading.js")),r=await t(this.url,e.guid,p);return r.success&&(f.get(this.url)?.delete(e.guid),d(this._featureServiceUrl,null,e.name,null)),r}async startEditing(e){return(await this.startEditingWithResult(e)).success}async startEditingWithResult(e){const{startEditing:t}=await(import("../rest/versionManagement/gdbVersion/startEditing.js")),r=await t(this.url,e.guid,p);if(r.success){const t=await this.getVersionInfoExtended(e),r=new Date(t.modifiedDate),s=new m(r),i={name:e.name,moment:r,lockType:"edit",stack:s};this._addOrUpdateItem(e.guid,i),d(this._featureServiceUrl,null,e.name,r)}return r}async stopEditing(e,t){return(await this.stopEditingWithResult(e,t)).success}async stopEditingWithResult(e,t){if(t){const t=f.get(this.url)?.get(e.guid);if(t?.stack?.canRedo()){const[{deleteForwardEdits:r},{default:s}]=await Promise.all([import("../rest/versionManagement/gdbVersion/deleteForwardEdits.js"),import("../rest/versionManagement/gdbVersion/support/DeleteForwardEditsParameters.js")]),i=await r(this.url,e.guid,new s({sessionId:p,moment:t.moment}));if(!i.success)return i}}const{stopEditing:r}=await(import("../rest/versionManagement/gdbVersion/stopEditing.js")),s=await r(this.url,e.guid,p,t);if(s.success){const t=await this.getVersionInfoExtended(e),r=new Date(t.modifiedDate);this._addOrUpdateItem(e.guid,{name:e.name,moment:r,lockType:"read",editMomentStack:void 0}),d(this._featureServiceUrl,null,e.name,r)}return s}getLockType(e){const t=f.get(this.url)?.get(e.guid)?.lockType;return t??"none"}async changeVersion(e,t,s){if(s&&"name"in s&&!await this.getVersionInfoExtended(s))throw new r("version-management-service:invalid-version","version does not exist");if("networkServiceUrl"in e){if(this._featureServiceUrl.toLowerCase()===e.featureServiceUrl.toLowerCase())return this._changeVersionInternal(e,t,s)}else{let r;"layers"in e?(r=e.allTables.concat(e.allLayers),e.utilityNetworks&&e.utilityNetworks.forEach(e=>{this._featureServiceUrl.toLowerCase()===e.featureServiceUrl.toLowerCase()&&this._changeVersionInternal(e,t,s)})):r=e;for(const e of r)if("feature"===e.type||"subtype-group"===e.type){const r=/^(.*\/FeatureServer)\/\d+$/,i=e.url.replace(r,"$1");if(this._featureServiceUrl.toLowerCase()===i.toLowerCase()&&!this._changeVersionInternal(e,t,s))return!1}else if("group"===e.type){const r=e.allTables.concat(e.allLayers);for(const e of r)if("feature"===e.type||"subtype-group"===e.type){const r=/^(.*\/FeatureServer)\/\d+$/,i=e.url.replace(r,"$1");if(this._featureServiceUrl.toLowerCase()===i.toLowerCase()&&!this._changeVersionInternal(e,t,s))return!1}}}return!0}async changeVersionWithResult(e,t,r){let s;if("layers"in e){const t=V(e.allTables.concat(e.allLayers).filter(e=>"group"!==e.type).toArray());e.utilityNetworks&&e.utilityNetworks.forEach(e=>{const r=V([e]);t.push(...r)}),s=t}else s=e;if(r&&"name"in r){if(!await this.getVersionInfoExtended(r)){const e=new Map;for(const t of s)e.set(t,{success:!1});return e}}if(t&&"name"in t){if("none"!==this.getLockType(t)){const e=new Map;for(const t of s)e.set(t,{success:!1});return e}}const i=new Map;for(const n of s)if(n)if(n.featureServiceUrl.toLowerCase()===this._featureServiceUrl.toLowerCase()){const e=this._changeVersionInternalWithResult(n,t,r);i.set(n,e)}else i.set(n,{success:!1});return i}async getVersionIdentifierFromName(e){try{const t=await this.getVersionInfos({includeHidden:!0});return t.find(t=>t.versionIdentifier.name.toUpperCase()===e.toUpperCase())?.versionIdentifier||null}catch{return null}}async getVersionIdentifierFromGuid(e){const{getVersion:t}=await(import("../rest/versionManagement/getVersion.js"));try{return(await t(this.url,e)).versionIdentifier}catch{return null}}canUndo(e){const t=f.get(this.url)?.get(e.guid);return!!t?.stack?.canUndo()}canRedo(e){const t=f.get(this.url)?.get(e.guid);return!!t?.stack?.canRedo()}undo(e){const t=f.get(this.url)?.get(e.guid),r=t?.stack?.undo()||void 0;if(t&&r){const r=t.stack.peek();d(this._featureServiceUrl,null,e.name,r),f.get(this.url)?.set(e.guid,{...t,moment:r})}}redo(e){const t=f.get(this.url)?.get(e.guid),r=t?.stack?.redo()||void 0;t&&r&&(d(this._featureServiceUrl,null,e.name,r),f.get(this.url)?.set(e.guid,{...t,moment:r}))}_setUpData(e,t){let s=null,i=null,n=null,o=null;const a=e=>{const t=f?.get(this.url)?.get(e.guid);n=e.name,o=t?.moment??null};if(e&&"name"in e){if("none"!==this.getLockType(e))throw new r("version-management-service:version-locked","version is locked");s=e.name,i=null,t&&"name"in t?a(t):(n=this.defaultVersionIdentifier.name,o=t)}else s=this.defaultVersionIdentifier.name,i=e,t&&"name"in t?a(t):(n=this.defaultVersionIdentifier.name,o=t);return{fromVersionName:s,fromMoment:i,toVersionName:n,toMoment:o}}_changeVersionInternal(e,t,r){try{const{fromVersionName:s,fromMoment:i,toVersionName:n,toMoment:o}=this._setUpData(t,r);(this._isDefault(s)&&this._isDefault(e.gdbVersion)&&this._dateEquals(e.historicMoment,i)||s===e.gdbVersion&&this._dateEquals(e.historicMoment,i))&&(e.gdbVersion=n,e.historicMoment=o)}catch(s){return!1}return!0}_changeVersionInternalWithResult(e,t,r){try{const{fromVersionName:s,fromMoment:i,toVersionName:n,toMoment:o}=this._setUpData(t,r);return this._isDefault(s)&&this._isDefault(e.gdbVersion)&&this._dateEquals(e.historicMoment,i)||s===e.gdbVersion&&this._dateEquals(e.historicMoment,i)?(e.gdbVersion=n,e.historicMoment=o,{success:!0}):{success:!1}}catch(s){return{success:!1}}}_addMomentToVersionItem(e,t){const r=f.get(this.url);if(r)for(const[s,i]of r){i.name===e&&this._addToStack(s,t)}}_addToStack(e,t){const r=f.get(this.url),s=r?.get(e);return!!s?.stack&&(I(s.stack.peek(),t)&&s.stack.push(t),r.set(e,{...s,moment:t}),!0)}_addOrUpdateItem(e,t){const r=f.get(this.url),s=r?.get(e);return s?(r.set(e,{...s,...t}),!0):!(!t.name||!t.lockType)&&(r?.set(e,{...t,lockType:t.lockType}),!0)}async _fetchService(e,r){if(this.sourceJSON){this.read(this.sourceJSON,{origin:"service",url:c(e)});const t=new o(this.url).host;return void h.set(t,this.defaultVersionIdentifier.name)}const s=await t(e,{responseType:"json",query:{f:"json"},...r});this.read(s.data)}};function I(e,t){if(e){return e.getTime()<t.getTime()}return!0}e([a()],y.prototype,"url",void 0),e([a()],y.prototype,"sourceJSON",void 0),e([a({type:String,json:{write:!0}})],y.prototype,"name",void 0),e([a({json:{write:{target:{defaultVersionName:{type:String},defaultVersionGuid:{type:String}}},read:{source:["defaultVersionName","defaultVersionGuid"]}}})],y.prototype,"defaultVersionIdentifier",void 0),e([v("defaultVersionIdentifier",["defaultVersionName","defaultVersionGuid"])],y.prototype,"readDefaultVersionIdentifier",null),e([w("defaultVersionIdentifier",{defaultVersionName:{type:String},defaultVersionGuid:{type:String}})],y.prototype,"writeDefaultVersionIdentifier",null),e([a({json:{write:!0}})],y.prototype,"capabilities",void 0),y=e([u("esri.versionManagement.VersionManagementService")],y);const S=y;export{S as default};
2
+ import{__decorate as e}from"tslib";import t from"../request.js";import r from"../core/Error.js";import{JSONSupportMixin as s}from"../core/JSONSupport.js";import{Loadable as i}from"../core/Loadable.js";import{removeTrailingSlash as n,Url as o}from"../core/urlUtils.js";import{property as a,subclass as u}from"../core/accessorSupport/decorators.js";import{onApplyEditsEvent as l,emitUpdateMomentEvent as d}from"../layers/mixins/EditBusLayer.js";import{parseUrl as c}from"../rest/utils.js";import m from"./support/EditMomentStack.js";import{versionCollection as f,versionCollectionCount as g,defaultVersionNameLookup as h,currentSessionId as p}from"./support/versionManagementUtils.js";import{createVersionAdapters as V}from"./versionAdapters/utils.js";import{reader as v}from"../core/accessorSupport/decorators/reader.js";import{writer as y}from"../core/accessorSupport/decorators/writer.js";let w=class extends(s(i)){constructor(e){super(e),this.url=null,this.sourceJSON=null,this.name=null,this.defaultVersionIdentifier=null,this.capabilities=null,this._isDefault=e=>!e||e===this.defaultVersionIdentifier.name,this._dateEquals=(e,t)=>!e&&!t||!(!e||!t)&&e.toISOString()===t.toISOString(),this._applyEditsHandler=e=>{const{serviceUrl:t,gdbVersion:r,result:s}=e;t===this._featureServiceUrl&&s.then(e=>{const t=e.historicMoment;t&&this._addMomentToVersionItem(r,t)},()=>{})}}initialize(){this.url=n(this.url),this._featureServiceUrl=this.url.replace(/\/VersionManagementServer/i,"/FeatureServer"),f.has(this.url)||f.set(this.url,new Map);const e=(g.get(this.url)??0)+1;g.set(this.url,e),this.when().then(()=>this.addHandles(l(this._applyEditsHandler)),()=>{})}destroy(){const e=(g.get(this.url)??1)-1;g.set(this.url,e),0===e&&f.delete(this.url),h.delete(this._featureServiceUrl)}read(e,t){this.sourceJSON=e,super.read(e,t)}readDefaultVersionIdentifier(e,t){return{name:t.defaultVersionName,guid:t.defaultVersionGuid}}writeDefaultVersionIdentifier(e,t){t.defaultVersionName=e.name,t.defaultVersionGuid=e.guid}get loaded(){return super.loaded}load(e){return this.addResolvingPromise(this._fetchService(this.url,e)),Promise.resolve(this)}async createVersion(e){const[{createVersion:t},{default:r}]=await Promise.all([import("../rest/versionManagement/createVersion.js"),import("../rest/versionManagement/support/CreateVersionParameters.js")]),s=r.from(e);return t(this.url,s)}async deleteVersion(e){const[{deleteVersion:t},{default:r}]=await Promise.all([import("../rest/versionManagement/deleteVersion.js"),import("../rest/versionManagement/support/DeleteVersionParameters.js")]);let s;e.guid&&f.get(this.url)?.has(e.guid)&&(s=p??void 0);const i=new r({versionName:e.name,sessionId:s});return t(this.url,i)}async getVersionInfoExtended(e){const{getVersion:t}=await(import("../rest/versionManagement/getVersion.js"));return t(this.url,e.guid)}async getVersionInfos(e={}){const[{getVersionInfos:t},{default:r}]=await Promise.all([import("../rest/versionManagement/getVersionInfos.js"),import("../rest/versionManagement/support/GetVersionInfosParameters.js")]),s=r.from(e);return t(this.url,s)}async reconcile(e,t={}){const[{reconcile:r},{default:s}]=await Promise.all([import("../rest/versionManagement/gdbVersion/reconcile.js"),import("../rest/versionManagement/gdbVersion/support/ReconcileParameters.js")]),i=s.from(t);i.sessionId=p;const n=await r(this.url,e.guid,i);if(n.success&&n.moment){const t=n.moment;d(this._featureServiceUrl,null,e.name,t),this._addMomentToVersionItem(e.guid,t)}return n}async post(e){const[{post:t},{default:r}]=await Promise.all([import("../rest/versionManagement/gdbVersion/post.js"),import("../rest/versionManagement/gdbVersion/support/PostParameters.js")]),s=r.from({sessionId:p}),i=await t(this.url,e.guid,s);if(i.success&&i.moment){const t=i.moment;d(this._featureServiceUrl,null,e.name,t),this._addMomentToVersionItem(e.guid,t)}return i}async alterVersion(e,t){const[{alterVersion:r},{default:s}]=await Promise.all([import("../rest/versionManagement/gdbVersion/alterVersion.js"),import("../rest/versionManagement/gdbVersion/support/AlterVersionParameters.js")]),i=s.from(t);return r(this.url,e.guid,i)}async startReading(e){return(await this.startReadingWithResult(e)).success}async startReadingWithResult(e){const{startReading:t}=await(import("../rest/versionManagement/gdbVersion/startReading.js")),r=await t(this.url,e.guid,p);if(r.success){const t=await this.getVersionInfoExtended(e),r=new Date(t.modifiedDate),s={name:t.versionIdentifier.name,moment:r,lockType:"read"};this._addOrUpdateItem(e.guid,s),d(this._featureServiceUrl,null,e.name,r)}return r}async stopReading(e){return(await this.stopReadingWithResult(e)).success}async stopReadingWithResult(e){const{stopReading:t}=await(import("../rest/versionManagement/gdbVersion/stopReading.js")),r=await t(this.url,e.guid,p);return r.success&&(f.get(this.url)?.delete(e.guid),d(this._featureServiceUrl,null,e.name,null)),r}async startEditing(e){return(await this.startEditingWithResult(e)).success}async startEditingWithResult(e){const{startEditing:t}=await(import("../rest/versionManagement/gdbVersion/startEditing.js")),r=await t(this.url,e.guid,p);if(r.success){const t=await this.getVersionInfoExtended(e),r=new Date(t.modifiedDate),s=new m(r),i={name:e.name,moment:r,lockType:"edit",stack:s};this._addOrUpdateItem(e.guid,i),d(this._featureServiceUrl,null,e.name,r)}return r}async stopEditing(e,t){return(await this.stopEditingWithResult(e,t)).success}async stopEditingWithResult(e,t){if(t){const t=f.get(this.url)?.get(e.guid);if(t?.stack?.canRedo()){const[{deleteForwardEdits:r},{default:s}]=await Promise.all([import("../rest/versionManagement/gdbVersion/deleteForwardEdits.js"),import("../rest/versionManagement/gdbVersion/support/DeleteForwardEditsParameters.js")]),i=await r(this.url,e.guid,new s({sessionId:p,moment:t.moment}));if(!i.success)return i}}const{stopEditing:r}=await(import("../rest/versionManagement/gdbVersion/stopEditing.js")),s=await r(this.url,e.guid,p,t);if(s.success){const t=await this.getVersionInfoExtended(e),r=new Date(t.modifiedDate);this._addOrUpdateItem(e.guid,{name:e.name,moment:r,lockType:"read",editMomentStack:void 0}),d(this._featureServiceUrl,null,e.name,r)}return s}getLockType(e){const t=f.get(this.url)?.get(e.guid)?.lockType;return t??"none"}async changeVersion(e,t,s){if(s&&"name"in s&&!await this.getVersionInfoExtended(s))throw new r("version-management-service:invalid-version","version does not exist");if("networkServiceUrl"in e){if(this._featureServiceUrl.toLowerCase()===e.featureServiceUrl.toLowerCase())return this._changeVersionInternal(e,t,s)}else{let r;"layers"in e?(r=e.allTables.concat(e.allLayers),e.utilityNetworks&&e.utilityNetworks.forEach(e=>{this._featureServiceUrl.toLowerCase()===e.featureServiceUrl.toLowerCase()&&this._changeVersionInternal(e,t,s)})):r=e;for(const e of r)if("feature"===e.type||"subtype-group"===e.type||"annotation-feature"===e.type||"dimension-feature"===e.type){const r=/^(.*\/FeatureServer)\/\d+$/,i=e.url.replace(r,"$1");if(this._featureServiceUrl.toLowerCase()===i.toLowerCase()&&!this._changeVersionInternal(e,t,s))return!1}else if("group"===e.type){const r=e.allTables.concat(e.allLayers);for(const e of r)if("feature"===e.type||"subtype-group"===e.type||"annotation-feature"===e.type||"dimension-feature"===e.type){const r=/^(.*\/FeatureServer)\/\d+$/,i=e.url.replace(r,"$1");if(this._featureServiceUrl.toLowerCase()===i.toLowerCase()&&!this._changeVersionInternal(e,t,s))return!1}}}return!0}async changeVersionWithResult(e,t,r){let s;if("layers"in e){const t=V(e.allTables.concat(e.allLayers).filter(e=>"group"!==e.type).toArray());e.utilityNetworks&&e.utilityNetworks.forEach(e=>{const r=V([e]);t.push(...r)}),s=t}else s=e;if(r&&"name"in r){if(!await this.getVersionInfoExtended(r)){const e=new Map;for(const t of s)e.set(t,{success:!1});return e}}if(t&&"name"in t){if("none"!==this.getLockType(t)){const e=new Map;for(const t of s)e.set(t,{success:!1});return e}}const i=new Map;for(const n of s)if(n)if(n.featureServiceUrl.toLowerCase()===this._featureServiceUrl.toLowerCase()){const e=this._changeVersionInternalWithResult(n,t,r);i.set(n,e)}else i.set(n,{success:!1});return i}async getVersionIdentifierFromName(e){try{const t=await this.getVersionInfos({includeHidden:!0});return t.find(t=>t.versionIdentifier.name.toUpperCase()===e.toUpperCase())?.versionIdentifier||null}catch{return null}}async getVersionIdentifierFromGuid(e){const{getVersion:t}=await(import("../rest/versionManagement/getVersion.js"));try{return(await t(this.url,e)).versionIdentifier}catch{return null}}canUndo(e){const t=f.get(this.url)?.get(e.guid);return!!t?.stack?.canUndo()}canRedo(e){const t=f.get(this.url)?.get(e.guid);return!!t?.stack?.canRedo()}undo(e){const t=f.get(this.url)?.get(e.guid),r=t?.stack?.undo()||void 0;if(t&&r){const r=t.stack.peek();d(this._featureServiceUrl,null,e.name,r),f.get(this.url)?.set(e.guid,{...t,moment:r})}}redo(e){const t=f.get(this.url)?.get(e.guid),r=t?.stack?.redo()||void 0;t&&r&&(d(this._featureServiceUrl,null,e.name,r),f.get(this.url)?.set(e.guid,{...t,moment:r}))}_setUpData(e,t){let s=null,i=null,n=null,o=null;const a=e=>{const t=f?.get(this.url)?.get(e.guid);n=e.name,o=t?.moment??null};if(e&&"name"in e){if("none"!==this.getLockType(e))throw new r("version-management-service:version-locked","version is locked");s=e.name,i=null,t&&"name"in t?a(t):(n=this.defaultVersionIdentifier.name,o=t)}else s=this.defaultVersionIdentifier.name,i=e,t&&"name"in t?a(t):(n=this.defaultVersionIdentifier.name,o=t);return{fromVersionName:s,fromMoment:i,toVersionName:n,toMoment:o}}_changeVersionInternal(e,t,r){try{const{fromVersionName:s,fromMoment:i,toVersionName:n,toMoment:o}=this._setUpData(t,r);(this._isDefault(s)&&this._isDefault(e.gdbVersion)&&this._dateEquals(e.historicMoment,i)||s===e.gdbVersion&&this._dateEquals(e.historicMoment,i))&&(e.gdbVersion=n,e.historicMoment=o)}catch(s){return!1}return!0}_changeVersionInternalWithResult(e,t,r){try{const{fromVersionName:s,fromMoment:i,toVersionName:n,toMoment:o}=this._setUpData(t,r);return this._isDefault(s)&&this._isDefault(e.gdbVersion)&&this._dateEquals(e.historicMoment,i)||s===e.gdbVersion&&this._dateEquals(e.historicMoment,i)?(e.gdbVersion=n,e.historicMoment=o,{success:!0}):{success:!1}}catch(s){return{success:!1}}}_addMomentToVersionItem(e,t){const r=f.get(this.url);if(r)for(const[s,i]of r){i.name===e&&this._addToStack(s,t)}}_addToStack(e,t){const r=f.get(this.url),s=r?.get(e);return!!s?.stack&&(I(s.stack.peek(),t)&&s.stack.push(t),r.set(e,{...s,moment:t}),!0)}_addOrUpdateItem(e,t){const r=f.get(this.url),s=r?.get(e);return s?(r.set(e,{...s,...t}),!0):!(!t.name||!t.lockType)&&(r?.set(e,{...t,lockType:t.lockType}),!0)}async _fetchService(e,r){if(this.sourceJSON){this.read(this.sourceJSON,{origin:"service",url:c(e)});const t=new o(this.url).host;return void h.set(t,this.defaultVersionIdentifier.name)}const s=await t(e,{responseType:"json",query:{f:"json"},...r});this.read(s.data)}};function I(e,t){if(e){return e.getTime()<t.getTime()}return!0}e([a()],w.prototype,"url",void 0),e([a()],w.prototype,"sourceJSON",void 0),e([a({type:String,json:{write:!0}})],w.prototype,"name",void 0),e([a({json:{write:{target:{defaultVersionName:{type:String},defaultVersionGuid:{type:String}}},read:{source:["defaultVersionName","defaultVersionGuid"]}}})],w.prototype,"defaultVersionIdentifier",void 0),e([v("defaultVersionIdentifier",["defaultVersionName","defaultVersionGuid"])],w.prototype,"readDefaultVersionIdentifier",null),e([y("defaultVersionIdentifier",{defaultVersionName:{type:String},defaultVersionGuid:{type:String}})],w.prototype,"writeDefaultVersionIdentifier",null),e([a({json:{write:!0}})],w.prototype,"capabilities",void 0),w=e([u("esri.versionManagement.VersionManagementService")],w);const S=w;export{S as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import r from"../core/Accessor.js";import o from"../core/Collection.js";import t from"../core/Error.js";import i from"../core/Logger.js";import{watch as s,on as n}from"../core/reactiveUtils.js";import{removeTrailingSlash as a}from"../core/urlUtils.js";import{property as u,subclass as l}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as d}from"../core/support/UpdatingHandles.js";import{getOwningPortalUrl as h}from"../layers/support/layerUtils.js";import p from"../portal/Portal.js";import{hasPrivilege as v}from"../portal/support/utils.js";import m from"../rest/featureService/FeatureService.js";import{createFeatureServices as c}from"../rest/featureService/utils.js";import{getVersioningStates as g}from"./utils.js";import w from"./VersioningState.js";import f from"./VersionManagementService.js";import{createVersionAdapters as _}from"./versionAdapters/utils.js";let E=class extends r{constructor(e){super(e),this._portalLookup=new Map,this._updatingHandlesLoad=new d,this._updatingHandlesExecute=new d,this.executionError=void 0,this.featureServiceLookup=new Map,this.loadError=void 0,this.serverVersionLookup=new Map,this.serviceNameLookup=new Map,this.userLookup=new Map,this.versionAdministratorLookup=new Map,this.versioningStateLookup=new Map,this.view=null,this.versioningStates=null}initialize(){this._viewChangeHandle(),this.addHandles([s(()=>this.view,()=>{this._resetAllLookupProperties(),this._viewChangeHandle()}),s(()=>this.versioningStates,()=>{this._resetVersioningLookupProperties(),this._setVersioningStatesLookups()})])}destroy(){this._updatingHandlesLoad.destroy(),this._updatingHandlesExecute.destroy()}get state(){return this._updatingHandlesLoad.updating?"loading":this.loadError?"disabled":this._updatingHandlesExecute.updating?"executing":this.executionError?"failed":"ready"}async alterVersion(e){return this._updatingHandlesExecute.addPromise(this._alterVersionInternal(e))}async changeVersion(e,r,o){return this._updatingHandlesExecute.addPromise(this._changeVersionInternal(e,r,o))}async createVersion(e){return this._updatingHandlesExecute.addPromise(this._createVersionInternal(e))}async deleteVersion(e,r,o){return this._updatingHandlesExecute.addPromise(this._deleteVersionInternal(e,r,o))}async getVersionInfos(e){return this._updatingHandlesExecute.addPromise(this._getVersionInfosInternal(e))}async _alterVersionInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new t("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=this.versioningStateLookup.get(e.featureServerUrl);if(!r)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new t("version-management-view-model:execution-error",this.executionError??"");if(!this.serverVersionLookup.has(e.featureServerUrl)||this.serverVersionLookup.get(e.featureServerUrl)<=11.1)throw this._logError("version-management-view-model:execution-error","no-valid-enterprise-version"),new t("version-management-view-model:execution-error",this.executionError??"");const{featureServerUrl:o,versionIdentifier:i,...s}=e,n=await r.alterVersion(i,s).catch(e=>{throw this._logExecutionError(e),e});return await this.getVersionInfos(o),n}async _changeVersionInternal(e,r,o){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new t("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const i=this.versioningStateLookup.get(e);if(!i)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new t("version-management-view-model:execution-error",this.executionError??"");const s={name:r,guid:o};return await i.changeVersion(s).catch(e=>{throw this._logExecutionError(e),e})}_updateVersionableItems(e){this._updatingHandlesLoad.consumePromise((async()=>{_(e.added).forEach(e=>{const r=e.featureServiceUrl,o=this.versioningStateLookup.get(r);o&&(o.versionableItems.find(r=>r.versionableItem===e.versionableItem)||o.versionableItems.add(e))});_(e.removed).forEach(e=>{const{allLayers:r,allTables:o}=this.view.map,t=e.featureServiceUrl,i=this.versioningStateLookup.get(t);if(!i)return void this._logError("version-management-view-model:execution-error","no-version-management-service-found");const s=e=>("feature"===e.type||"subtype-group"===e.type)&&(e.url?.includes(t)??!1);[...r.filter(s),...o.filter(s)].length||(this.featureServiceLookup.delete(t),this.serviceNameLookup.delete(t),this.versioningStateLookup.delete(t),this.versioningStates.remove(i));const n=i.versionableItems.find(r=>r.versionableItem===e.versionableItem);n&&i.versionableItems.remove(n)})})())}async _createVersionInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new t("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=e.featureServerUrl,o=this.versioningStateLookup.get(r);if(!o)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new t("version-management-view-model:execution-error",this.executionError??"");const i=this.userLookup.get(r).toUpperCase(),s=this._isEmptyString(e.ownerName)?i:e.ownerName?.trim().toUpperCase();if(s!==i&&this.serverVersionLookup.get(r)<=11.1)throw this._logError("version-management-view-model:execution-error","versioning-api-error"),new t("version-management-view-model:execution-error",this.executionError??"");let n=await(this.versioningStateLookup.get(r)?.getVersionInfos());if("SDE"===s?.toUpperCase()&&"DEFAULT"===e.versionName.toUpperCase()||n?.find(r=>r.versionIdentifier.name.toUpperCase()===(s+"."+e.versionName).toUpperCase()||r.versionIdentifier.name.toUpperCase()===(i+"."+e.versionName).toUpperCase()))throw this._logError("version-management-view-model:execution-error","no-valid-version-name"),new t("version-management-view-model:execution-error",this.executionError??"");const a=await o.versionManagementService.createVersion({versionName:e.versionName,access:s!==i?"public":e.access,description:e.description}).catch(e=>{throw this._logExecutionError(e),e});if(s!==i){const{guid:o,name:t}=a.versionIdentifier,n={featureServerUrl:r,versionIdentifier:{guid:o,name:t},access:e.access,ownerName:s};await this.alterVersion(n)||this.deleteVersion(r,i+"."+e.versionName,a.versionIdentifier.guid).catch(()=>{})}return await this.getVersionInfos(r),n=await(this.versioningStateLookup.get(r)?.getVersionInfos()),n?.find(e=>e.versionIdentifier.guid===a.versionIdentifier.guid)}async _deleteVersionInternal(e,r,o){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new t("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const i=this.versioningStateLookup.get(e);if(!i)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new t("version-management-view-model:execution-error",this.executionError??"");if(this.serverVersionLookup.get(e)<=11.1)throw this._logError("version-management-view-model:execution-error","versioning-api-error"),new t("version-management-view-model:execution-error",this.executionError??"");const s={name:r,guid:o};return await i.deleteVersion(s).catch(e=>{throw this._logExecutionError(e),new t("version-management-view-model:execution-error",this.executionError??"")})}async _getVersionInfosInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new t("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=this.featureServiceLookup.get(e)?.featureService;if(!r)throw this._logError("version-management-view-model:execution-error","no-feature-service-found"),new t("version-management-view-model:execution-error",this.executionError??"");r.loaded||await r.load().catch(e=>{throw this._logExecutionError(e),e});const o=r.url;this.serverVersionLookup.set(o,r.sourceJSON?.currentVersion??0);const i=this.userLookup.get(e);this._portalLookup.get(e)&&i?this.versionAdministratorLookup.set(o,await v(this._portalLookup.get(e),i,"features:user:manageVersions")):this.versionAdministratorLookup.set(o,!1);const s=this.versioningStateLookup.get(e);if(!s)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new t("version-management-view-model:execution-error",this.executionError??"");s.loaded||await s.load().catch(e=>{throw this._logExecutionError(e),e});return await s.getVersionInfos(!0).catch(e=>{throw this._logExecutionError(e),e})}_isEmptyString(e){return!e||0===e.trim().length}_logError(e,r){switch(i.getLogger(this).error(new t(e,r??"")),e){case"version-management-view-model:load-error":this._setLoadError(r);break;case"version-management-view-model:execution-error":this._setExecutionError(r)}}_logExecutionError(e){this._logError("version-management-view-model:execution-error",e.message)}async _viewChangeHandle(){this._updatingHandlesLoad.consumePromise((async()=>{if(this._setLoadError(),!this.view)return void this._setLoadError("no-view-property");if(this.view&&"2d"!==this.view.type)return void this._logError("version-management-view-model:load-error","sceneView-not-supported");this.removeHandles("map-change-handle"),this.addHandles([s(()=>this.view?.map,()=>{this._resetAllLookupProperties(),this._mapChangeHandle(this.versioningStates)})],"map-change-handle");const e=await this._getVersioningStates();await this._mapChangeHandle(e)})())}async _mapChangeHandle(e){this._updatingHandlesLoad.consumePromise((async()=>{this._setLoadError(),this.removeHandles("map-layers-tables-change-handle"),this.addHandles([n(()=>this.view?.map.allLayers,"change",e=>{(e.added.some(({type:e})=>"feature"===e)||e.removed.some(({type:e})=>"feature"===e)||e.added.some(({type:e})=>"subtype-group"===e)||e.removed.some(({type:e})=>"subtype-group"===e))&&(this._resetServiceRelatedLookupProperties(),this._propertiesChangeInternal(this.versioningStates),this._updateVersionableItems(e))}),n(()=>this.view?.map.allTables,"change",e=>{(e.added.some(({type:e})=>"feature"===e)||e.removed.some(({type:e})=>"feature"===e)||e.added.some(({type:e})=>"subtype-group"===e)||e.removed.some(({type:e})=>"subtype-group"===e))&&(this._resetServiceRelatedLookupProperties(),this._propertiesChangeInternal(this.versioningStates),this._updateVersionableItems(e))})],"map-layers-tables-change-handle"),await this._propertiesChangeInternal(e)})())}async _propertiesChangeInternal(e){this._updatingHandlesLoad.consumePromise((async()=>{const r=e=>"feature"===e.type||"subtype-group"===e.type,{allLayers:o,allTables:t}=this.view.map;if(this._setLoadError(),this.featureServiceLookup=c([...o.filter(r),...t.filter(r)]),this.featureServiceLookup.size){this._updateFeatureServiceLookup(e),this.serviceNameLookup=new Map;for(const e of this.featureServiceLookup.values()){const{featureService:r,featureService:{url:o}}=e;if(!this.serviceNameLookup.has(o)){if(r.loaded||await r.load().catch(e=>{i.getLogger(this).error(e)}),!r.versionManagementServiceUrl){this.featureServiceLookup.delete(o);continue}const e=await h(o),t=new p({authMode:"immediate",url:e});await t.load().catch(e=>{i.getLogger(this).error(e)});const s=t.user?.username;if(!r.loaded||!t.loaded||!s)continue;this.serviceNameLookup.set(a(o),o.split("/").at(-2)),this.userLookup.set(o,s),this._portalLookup.set(o,t)}}e.forEach(e=>this._handleVersioningStateLookupUpdate(e)),await this._updateVersioningStates(e),this.versioningStates=e}else this._logError("version-management-view-model:load-error","no-feature-services")})())}_updateFeatureServiceLookup(e){for(const r of e){const e=r.featureServiceUrl;if(!this.featureServiceLookup.has(e)){const o=new m({url:e}),t=r.versionableItems.toArray().flatMap(e=>"network"===e.type?null:e.versionableItem).filter(e=>!!e);this.featureServiceLookup.set(e,{featureService:o,layers:t})}}}async _updateVersioningStates(e){for(const r of this.featureServiceLookup.values()){const t=r.featureService;if(!t.versionManagementServiceUrl)continue;if(!e.find(e=>e.featureServiceUrl===t.url)&&t.versionManagementServiceUrl){const i=new o(_(r.layers)),s=new w({versionManagementService:new f({url:t.versionManagementServiceUrl}),versionableItems:i});e.add(s),this._handleVersioningStateLookupUpdate(s)}await this.getVersionInfos(t.url)}}async _getVersioningStates(){return this.versioningStates&&this.versioningStates.length?this.versioningStates:this.view?await g(this.view,!1):(this._logError("version-management-view-model:load-error","no-view-property"),new o)}_handleVersioningStateLookupUpdate(e){this.versioningStateLookup.set(e.featureServiceUrl,e)}async _setVersioningStatesLookups(){this._updatingHandlesLoad.consumePromise((async()=>{this.versioningStates&&(this._updateFeatureServiceLookup(this.versioningStates),this.versioningStates.forEach(e=>this._handleVersioningStateLookupUpdate(e)),await this._updateVersioningStates(this.versioningStates))})())}_resetVersioningLookupProperties(){this.versioningStateLookup=new Map}_resetAllLookupProperties(){this._portalLookup=new Map,this.serverVersionLookup=new Map,this.userLookup=new Map,this.versioningStates=new o,this._resetVersioningLookupProperties(),this._resetServiceRelatedLookupProperties()}_resetServiceRelatedLookupProperties(){this.featureServiceLookup=new Map,this.serviceNameLookup=new Map}_setExecutionError(e){this._set("executionError",e)}_setLoadError(e){this._set("loadError",e)}};e([u()],E.prototype,"_portalLookup",void 0),e([u({readOnly:!0})],E.prototype,"executionError",void 0),e([u()],E.prototype,"featureServiceLookup",void 0),e([u({readOnly:!0})],E.prototype,"loadError",void 0),e([u()],E.prototype,"serverVersionLookup",void 0),e([u()],E.prototype,"serviceNameLookup",void 0),e([u({readOnly:!0})],E.prototype,"state",null),e([u()],E.prototype,"userLookup",void 0),e([u()],E.prototype,"versionAdministratorLookup",void 0),e([u()],E.prototype,"versioningStateLookup",void 0),e([u()],E.prototype,"view",void 0),e([u()],E.prototype,"versioningStates",void 0),E=e([l("esri.versionManagement.VersionManager")],E);const L=E;export{L as default};
2
+ import{__decorate as e}from"tslib";import r from"../core/Accessor.js";import t from"../core/Collection.js";import o from"../core/Error.js";import i from"../core/Logger.js";import{watch as s,on as n}from"../core/reactiveUtils.js";import{removeTrailingSlash as a}from"../core/urlUtils.js";import{property as d,subclass as u}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as l}from"../core/support/UpdatingHandles.js";import{getOwningPortalUrl as p}from"../layers/support/layerUtils.js";import h from"../portal/Portal.js";import{hasPrivilege as m}from"../portal/support/utils.js";import v from"../rest/featureService/FeatureService.js";import{createFeatureServices as c}from"../rest/featureService/utils.js";import{getVersioningStates as g}from"./utils.js";import w from"./VersioningState.js";import f from"./VersionManagementService.js";import{createVersionAdapters as _}from"./versionAdapters/utils.js";let E=class extends r{constructor(e){super(e),this._portalLookup=new Map,this._updatingHandlesLoad=new l,this._updatingHandlesExecute=new l,this.executionError=void 0,this.featureServiceLookup=new Map,this.loadError=void 0,this.serverVersionLookup=new Map,this.serviceNameLookup=new Map,this.userLookup=new Map,this.versionAdministratorLookup=new Map,this.versioningStateLookup=new Map,this.view=null,this.versioningStates=null}initialize(){this._viewChangeHandle(),this.addHandles([s(()=>this.view,()=>{this._resetAllLookupProperties(),this._viewChangeHandle()}),s(()=>this.versioningStates,()=>{this._resetVersioningLookupProperties(),this._setVersioningStatesLookups()})])}destroy(){this._updatingHandlesLoad.destroy(),this._updatingHandlesExecute.destroy()}get state(){return this._updatingHandlesLoad.updating?"loading":this.loadError?"disabled":this._updatingHandlesExecute.updating?"executing":this.executionError?"failed":"ready"}async alterVersion(e){return this._updatingHandlesExecute.addPromise(this._alterVersionInternal(e))}async changeVersion(e,r,t){return this._updatingHandlesExecute.addPromise(this._changeVersionInternal(e,r,t))}async createVersion(e){return this._updatingHandlesExecute.addPromise(this._createVersionInternal(e))}async deleteVersion(e,r,t){return this._updatingHandlesExecute.addPromise(this._deleteVersionInternal(e,r,t))}async getVersionInfos(e){return this._updatingHandlesExecute.addPromise(this._getVersionInfosInternal(e))}async _alterVersionInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new o("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=this.versioningStateLookup.get(e.featureServerUrl);if(!r)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new o("version-management-view-model:execution-error",this.executionError??"");if(!this.serverVersionLookup.has(e.featureServerUrl)||this.serverVersionLookup.get(e.featureServerUrl)<=11.1)throw this._logError("version-management-view-model:execution-error","no-valid-enterprise-version"),new o("version-management-view-model:execution-error",this.executionError??"");const{featureServerUrl:t,versionIdentifier:i,...s}=e,n=await r.alterVersion(i,s).catch(e=>{throw this._logExecutionError(e),e});return await this.getVersionInfos(t),n}async _changeVersionInternal(e,r,t){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new o("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const i=this.versioningStateLookup.get(e);if(!i)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new o("version-management-view-model:execution-error",this.executionError??"");const s={name:r,guid:t};return await i.changeVersion(s).catch(e=>{throw this._logExecutionError(e),e})}_updateVersionableItems(e){this._updatingHandlesLoad.consumePromise((async()=>{_(e.added).forEach(e=>{const r=e.featureServiceUrl,t=this.versioningStateLookup.get(r);t&&(t.versionableItems.find(r=>r.versionableItem===e.versionableItem)||t.versionableItems.add(e))});_(e.removed).forEach(e=>{const{allLayers:r,allTables:t}=this.view.map,o=e.featureServiceUrl,i=this.versioningStateLookup.get(o);if(!i)return void this._logError("version-management-view-model:execution-error","no-version-management-service-found");const s=e=>("feature"===e.type||"subtype-group"===e.type||"annotation-feature"===e.type||"dimension-feature"===e.type)&&(e.url?.includes(o)??!1);[...r.filter(s),...t.filter(s)].length||(this.featureServiceLookup.delete(o),this.serviceNameLookup.delete(o),this.versioningStateLookup.delete(o),this.versioningStates.remove(i));const n=i.versionableItems.find(r=>r.versionableItem===e.versionableItem);n&&i.versionableItems.remove(n)})})())}async _createVersionInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new o("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=e.featureServerUrl,t=this.versioningStateLookup.get(r);if(!t)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new o("version-management-view-model:execution-error",this.executionError??"");const i=this.userLookup.get(r).toUpperCase(),s=this._isEmptyString(e.ownerName)?i:e.ownerName?.trim().toUpperCase();if(s!==i&&this.serverVersionLookup.get(r)<=11.1)throw this._logError("version-management-view-model:execution-error","versioning-api-error"),new o("version-management-view-model:execution-error",this.executionError??"");let n=await(this.versioningStateLookup.get(r)?.getVersionInfos());if("SDE"===s?.toUpperCase()&&"DEFAULT"===e.versionName.toUpperCase()||n?.find(r=>r.versionIdentifier.name.toUpperCase()===(s+"."+e.versionName).toUpperCase()||r.versionIdentifier.name.toUpperCase()===(i+"."+e.versionName).toUpperCase()))throw this._logError("version-management-view-model:execution-error","no-valid-version-name"),new o("version-management-view-model:execution-error",this.executionError??"");const a=await t.versionManagementService.createVersion({versionName:e.versionName,access:s!==i?"public":e.access,description:e.description}).catch(e=>{throw this._logExecutionError(e),e});if(s!==i){const{guid:t,name:o}=a.versionIdentifier,n={featureServerUrl:r,versionIdentifier:{guid:t,name:o},access:e.access,ownerName:s};await this.alterVersion(n)||this.deleteVersion(r,i+"."+e.versionName,a.versionIdentifier.guid).catch(()=>{})}return await this.getVersionInfos(r),n=await(this.versioningStateLookup.get(r)?.getVersionInfos()),n?.find(e=>e.versionIdentifier.guid===a.versionIdentifier.guid)}async _deleteVersionInternal(e,r,t){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new o("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const i=this.versioningStateLookup.get(e);if(!i)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new o("version-management-view-model:execution-error",this.executionError??"");if(this.serverVersionLookup.get(e)<=11.1)throw this._logError("version-management-view-model:execution-error","versioning-api-error"),new o("version-management-view-model:execution-error",this.executionError??"");const s={name:r,guid:t};return await i.deleteVersion(s).catch(e=>{throw this._logExecutionError(e),new o("version-management-view-model:execution-error",this.executionError??"")})}async _getVersionInfosInternal(e){if("disabled"===this.state)throw this._logError("version-management-view-model:load-error",this.loadError),new o("version-management-view-model:load-error",this.loadError??"");this._setExecutionError();const r=this.featureServiceLookup.get(e)?.featureService;if(!r)throw this._logError("version-management-view-model:execution-error","no-feature-service-found"),new o("version-management-view-model:execution-error",this.executionError??"");r.loaded||await r.load().catch(e=>{throw this._logExecutionError(e),e});const t=r.url;this.serverVersionLookup.set(t,r.sourceJSON?.currentVersion??0);const i=this.userLookup.get(e);this._portalLookup.get(e)&&i?this.versionAdministratorLookup.set(t,await m(this._portalLookup.get(e),i,"features:user:manageVersions")):this.versionAdministratorLookup.set(t,!1);const s=this.versioningStateLookup.get(e);if(!s)throw this._logError("version-management-view-model:execution-error","no-versioning-state-found"),new o("version-management-view-model:execution-error",this.executionError??"");s.loaded||await s.load().catch(e=>{throw this._logExecutionError(e),e});return await s.getVersionInfos(!0).catch(e=>{throw this._logExecutionError(e),e})}_isEmptyString(e){return!e||0===e.trim().length}_logError(e,r){switch(i.getLogger(this).error(new o(e,r??"")),e){case"version-management-view-model:load-error":this._setLoadError(r);break;case"version-management-view-model:execution-error":this._setExecutionError(r)}}_logExecutionError(e){this._logError("version-management-view-model:execution-error",e.message)}async _viewChangeHandle(){this._updatingHandlesLoad.consumePromise((async()=>{if(this._setLoadError(),!this.view)return void this._setLoadError("no-view-property");if(this.view&&"2d"!==this.view.type)return void this._logError("version-management-view-model:load-error","sceneView-not-supported");this.removeHandles("map-change-handle"),this.addHandles([s(()=>this.view?.map,()=>{this._resetAllLookupProperties(),this._mapChangeHandle(this.versioningStates)})],"map-change-handle");const e=await this._getVersioningStates();await this._mapChangeHandle(e)})())}async _mapChangeHandle(e){this._updatingHandlesLoad.consumePromise((async()=>{this._setLoadError(),this.removeHandles("map-layers-tables-change-handle"),this.addHandles([n(()=>this.view?.map.allLayers,"change",e=>{(e.added.some(({type:e})=>"feature"===e)||e.removed.some(({type:e})=>"feature"===e)||e.added.some(({type:e})=>"subtype-group"===e)||e.removed.some(({type:e})=>"subtype-group"===e)||e.added.some(({type:e})=>"annotation-feature"===e)||e.removed.some(({type:e})=>"annotation-feature"===e)||e.added.some(({type:e})=>"dimension-feature"===e)||e.removed.some(({type:e})=>"dimension-feature"===e))&&(this._resetServiceRelatedLookupProperties(),this._propertiesChangeInternal(this.versioningStates),this._updateVersionableItems(e))}),n(()=>this.view?.map.allTables,"change",e=>{(e.added.some(({type:e})=>"feature"===e)||e.removed.some(({type:e})=>"feature"===e)||e.added.some(({type:e})=>"subtype-group"===e)||e.removed.some(({type:e})=>"subtype-group"===e)||e.added.some(({type:e})=>"annotation-feature"===e)||e.removed.some(({type:e})=>"annotation-feature"===e)||e.added.some(({type:e})=>"dimension-feature"===e)||e.removed.some(({type:e})=>"dimension-feature"===e))&&(this._resetServiceRelatedLookupProperties(),this._propertiesChangeInternal(this.versioningStates),this._updateVersionableItems(e))})],"map-layers-tables-change-handle"),await this._propertiesChangeInternal(e)})())}async _propertiesChangeInternal(e){this._updatingHandlesLoad.consumePromise((async()=>{const r=e=>"feature"===e.type||"subtype-group"===e.type||"annotation-feature"===e.type||"dimension-feature"===e.type,{allLayers:t,allTables:o}=this.view.map;if(this._setLoadError(),this.featureServiceLookup=c([...t.filter(r),...o.filter(r)]),this.featureServiceLookup.size){this._updateFeatureServiceLookup(e),this.serviceNameLookup=new Map;for(const e of this.featureServiceLookup.values()){const{featureService:r,featureService:{url:t}}=e;if(!this.serviceNameLookup.has(t)){if(r.loaded||await r.load().catch(e=>{i.getLogger(this).error(e)}),!r.versionManagementServiceUrl){this.featureServiceLookup.delete(t);continue}const e=await p(t),o=new h({authMode:"immediate",url:e});await o.load().catch(e=>{i.getLogger(this).error(e)});const s=o.user?.username;if(!r.loaded||!o.loaded||!s)continue;this.serviceNameLookup.set(a(t),t.split("/").at(-2)),this.userLookup.set(t,s),this._portalLookup.set(t,o)}}e.forEach(e=>this._handleVersioningStateLookupUpdate(e)),await this._updateVersioningStates(e),this.versioningStates=e}else this._logError("version-management-view-model:load-error","no-feature-services")})())}_updateFeatureServiceLookup(e){for(const r of e){const e=r.featureServiceUrl;if(!this.featureServiceLookup.has(e)){const t=new v({url:e}),o=r.versionableItems.toArray().flatMap(e=>"network"===e.type?null:e.versionableItem).filter(e=>!!e);this.featureServiceLookup.set(e,{featureService:t,layers:o})}}}async _updateVersioningStates(e){for(const r of this.featureServiceLookup.values()){const o=r.featureService;if(!o.versionManagementServiceUrl)continue;if(!e.find(e=>e.featureServiceUrl===o.url)&&o.versionManagementServiceUrl){const i=new t(_(r.layers)),s=new w({versionManagementService:new f({url:o.versionManagementServiceUrl}),versionableItems:i});e.add(s),this._handleVersioningStateLookupUpdate(s)}await this.getVersionInfos(o.url)}}async _getVersioningStates(){return this.versioningStates&&this.versioningStates.length?this.versioningStates:this.view?await g(this.view,!1):(this._logError("version-management-view-model:load-error","no-view-property"),new t)}_handleVersioningStateLookupUpdate(e){this.versioningStateLookup.set(e.featureServiceUrl,e)}async _setVersioningStatesLookups(){this._updatingHandlesLoad.consumePromise((async()=>{this.versioningStates&&(this._updateFeatureServiceLookup(this.versioningStates),this.versioningStates.forEach(e=>this._handleVersioningStateLookupUpdate(e)),await this._updateVersioningStates(this.versioningStates))})())}_resetVersioningLookupProperties(){this.versioningStateLookup=new Map}_resetAllLookupProperties(){this._portalLookup=new Map,this.serverVersionLookup=new Map,this.userLookup=new Map,this.versioningStates=new t,this._resetVersioningLookupProperties(),this._resetServiceRelatedLookupProperties()}_resetServiceRelatedLookupProperties(){this.featureServiceLookup=new Map,this.serviceNameLookup=new Map}_setExecutionError(e){this._set("executionError",e)}_setLoadError(e){this._set("loadError",e)}};e([d()],E.prototype,"_portalLookup",void 0),e([d({readOnly:!0})],E.prototype,"executionError",void 0),e([d()],E.prototype,"featureServiceLookup",void 0),e([d({readOnly:!0})],E.prototype,"loadError",void 0),e([d()],E.prototype,"serverVersionLookup",void 0),e([d()],E.prototype,"serviceNameLookup",void 0),e([d({readOnly:!0})],E.prototype,"state",null),e([d()],E.prototype,"userLookup",void 0),e([d()],E.prototype,"versionAdministratorLookup",void 0),e([d()],E.prototype,"versioningStateLookup",void 0),e([d()],E.prototype,"view",void 0),e([d()],E.prototype,"versioningStates",void 0),E=e([u("esri.versionManagement.VersionManager")],E);const L=E;export{L as default};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{property as t}from"../../core/accessorSupport/decorators.js";class r{constructor(e){this.versionableItem=e,this.type="annotation-feature-layer"}get gdbVersion(){return this.versionableItem.gdbVersion}set gdbVersion(e){this.versionableItem.gdbVersion=e}get historicMoment(){return this.versionableItem.historicMoment}set historicMoment(e){this.versionableItem.historicMoment=e}get featureServiceUrl(){const e=/^(.*\/FeatureServer)\/\d+$/;return this.versionableItem.url.replace(e,"$1")}}e([t({readOnly:!0})],r.prototype,"type",void 0),e([t()],r.prototype,"gdbVersion",null),e([t({type:Date})],r.prototype,"historicMoment",null),e([t({readOnly:!0})],r.prototype,"featureServiceUrl",null);export{r as AnnotationFeatureLayerVersionAdapter};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{__decorate as e}from"tslib";import{property as t}from"../../core/accessorSupport/decorators.js";class r{constructor(e){this.versionableItem=e,this.type="dimension-feature-layer"}get gdbVersion(){return this.versionableItem.gdbVersion}set gdbVersion(e){this.versionableItem.gdbVersion=e}get historicMoment(){return this.versionableItem.historicMoment}set historicMoment(e){this.versionableItem.historicMoment=e}get featureServiceUrl(){const e=/^(.*\/FeatureServer)\/\d+$/;return this.versionableItem.url.replace(e,"$1")}}e([t({readOnly:!0})],r.prototype,"type",void 0),e([t()],r.prototype,"gdbVersion",null),e([t({type:Date})],r.prototype,"historicMoment",null),e([t({readOnly:!0})],r.prototype,"featureServiceUrl",null);export{r as DimensionFeatureLayerVersionAdapter};
@@ -1,3 +1,5 @@
1
+ import type AnnotationFeatureLayer from "../../layers/AnnotationFeatureLayer.js";
2
+ import type DimensionFeatureLayer from "../../layers/DimensionFeatureLayer.js";
1
3
  import type FeatureLayer from "../../layers/FeatureLayer.js";
2
4
  import type SubtypeGroupLayer from "../../layers/SubtypeGroupLayer.js";
3
5
  import type Network from "../../networks/Network.js";
@@ -13,13 +15,13 @@ export interface VersionAdapter {
13
15
  *
14
16
  * @since 5.0
15
17
  */
16
- versionableItem: FeatureLayer | Network | SubtypeGroupLayer;
18
+ versionableItem: FeatureLayer | Network | SubtypeGroupLayer | AnnotationFeatureLayer | DimensionFeatureLayer;
17
19
  /**
18
20
  * The type of versionable item.
19
21
  *
20
22
  * @since 5.0
21
23
  */
22
- type: "feature-layer" | "subtype-group-layer" | "network";
24
+ type: "feature-layer" | "subtype-group-layer" | "network" | "annotation-feature-layer" | "dimension-feature-layer";
23
25
  /**
24
26
  * The current gdbVersion of a versionable item.
25
27
  *
@@ -3,6 +3,8 @@
3
3
  *
4
4
  * @since 4.30
5
5
  */
6
+ import type AnnotationFeatureLayer from "../../layers/AnnotationFeatureLayer.js";
7
+ import type DimensionFeatureLayer from "../../layers/DimensionFeatureLayer.js";
6
8
  import type FeatureLayer from "../../layers/FeatureLayer.js";
7
9
  import type GroupLayer from "../../layers/GroupLayer.js";
8
10
  import type SubtypeGroupLayer from "../../layers/SubtypeGroupLayer.js";
@@ -20,7 +22,7 @@ import type { VersionAdapter } from "./types.js";
20
22
  * });
21
23
  * const adapter = utils.createVersionAdapter(layer);
22
24
  */
23
- export function createVersionAdapter(input: Network | FeatureLayer | SubtypeGroupLayer): VersionAdapter | null | undefined;
25
+ export function createVersionAdapter(input: Network | AnnotationFeatureLayer | DimensionFeatureLayer | FeatureLayer | SubtypeGroupLayer): VersionAdapter | null | undefined;
24
26
 
25
27
  /**
26
28
  * Used to create an array of [VersionAdapters](https://developers.arcgis.com/javascript/latest/references/core/versionManagement/versionAdapters/types/#VersionAdapter).
@@ -36,4 +38,4 @@ export function createVersionAdapter(input: Network | FeatureLayer | SubtypeGrou
36
38
  * });
37
39
  * const adapters = utils.createVersionAdapters([layer1, layer2]);
38
40
  */
39
- export function createVersionAdapters(inputs: (Network | FeatureLayer | SubtypeGroupLayer | GroupLayer)[]): VersionAdapter[];
41
+ export function createVersionAdapters(inputs: (Network | AnnotationFeatureLayer | DimensionFeatureLayer | FeatureLayer | SubtypeGroupLayer | GroupLayer)[]): VersionAdapter[];
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isLayerFromCatalog as e}from"../../layers/catalog/catalogUtils.js";import{FeatureLayerVersionAdapter as r}from"./FeatureLayerVersionAdapter.js";import{NetworkVersionAdapter as t}from"./NetworkVersionAdapter.js";import{SubTypeGroupLayerVersionAdapter as o}from"./SubTypeGroupLayerVersionAdapter.js";function n(n){return"networkServiceUrl"in n?new t(n):"feature"!==n.type||e(n)?"subtype-group"!==n.type||e(n)?null:new o(n):new r(n)}function p(e){const r=[];for(const t of e)if("group"===t.type){const e=t,o=e.allTables.concat(e.allLayers);for(const t of o)if("feature"===t.type||"subtype-group"===t.type){const e=n(t);e&&r.push(e)}}else{const e=n(t);e&&r.push(e)}return r}export{n as createVersionAdapter,p as createVersionAdapters};
2
+ import{isLayerFromCatalog as e}from"../../layers/catalog/catalogUtils.js";import{AnnotationFeatureLayerVersionAdapter as t}from"./AnnotationFeatureLayerVersionAdapter.js";import{DimensionFeatureLayerVersionAdapter as r}from"./DimensionFeatureLayerVersionAdapter.js";import{FeatureLayerVersionAdapter as o}from"./FeatureLayerVersionAdapter.js";import{NetworkVersionAdapter as n}from"./NetworkVersionAdapter.js";import{SubTypeGroupLayerVersionAdapter as a}from"./SubTypeGroupLayerVersionAdapter.js";function p(p){return"networkServiceUrl"in p?new n(p):"feature"!==p.type||e(p)?"annotation-feature"!==p.type||e(p)?"dimension-feature"!==p.type||e(p)?"subtype-group"!==p.type||e(p)?null:new a(p):new r(p):new t(p):new o(p)}function s(e){const t=[];for(const r of e)if("group"===r.type){const e=r,o=e.allTables.concat(e.allLayers);for(const r of o)if("feature"===r.type||"subtype-group"===r.type||"annotation-feature"===r.type||"dimension-feature"===r.type){const e=p(r);e&&t.push(e)}}else{const e=p(r);e&&t.push(e)}return t}export{p as createVersionAdapter,s as createVersionAdapters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{open as t}from"../../../../core/workers.js";import{sdfBufferServer as e}from"./definitions.js";import i from"./Rect.js";import s from"../../../webgl/Texture.js";import{TextureDescriptor as r}from"../../../webgl/TextureDescriptor.js";const h={width:5,height:2,left:0,top:0},o=new i(0,0,11,8),a=new i(11,0,11,8);class n{constructor(t,e,i,s){this._snapCoords=i,this._setTextureBinding=s,this.width=0,this.height=0,this._dirties=[],this._pageData=[],this._currentPage=0,this._textures=[],this._worker=this._load(),this.width=t,this.height=e,this._pageData.push(new Uint8Array(t*e)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs()}dispose(){for(const t of this._textures)t&&t.dispose();this._textures.length=0,this._pageData.length=0}async openMessagePorts(){return(await this._worker).connection.openPorts()}async rasterizeText(t,e,i){return(await this._worker).worker.rasterizeText(t,e,i)}getTexture(t,e){if(!this._textures[e]){const i=new r(this.width,this.height);i.pixelFormat=6406,i.wrapMode=33071,this._textures[e]=new s(t,i,new Uint8Array(this.width*this.height))}return this._dirties[e]&&(this._textures[e].setData(this._pageData[e]),this._dirties[e]=!1),this._textures[e]}bind(t,e,i,s){const r=this.getTexture(t,i);r.setSamplingMode(e),t.bindTexture(r,s)}async _load(){const i={getOptions:()=>({width:this.width,height:this.height,snapCoords:!!this._snapCoords}),recordGlyphs:t=>{const i=e;for(const e of t)e.sdf&&this.recordGlyph(e.mosaicItem,e.rect,e.sdf.buffer,i),this._setTextureBinding&&0!==e.mosaicItem.textureBinding&&this._setTextureBinding(e.mosaicItem)}},s=await t("GlyphWorker",{client:i,strategy:"dedicated"});return{worker:s.createInvokeProxy(),connection:s}}_invalidate(){this._dirties[this._currentPage]=!0}recordGlyph(t,e,i,s){const{page:r,rect:h}=t;if(0===e.width)return;const o=e.width+2*s,a=e.height+2*s;this._pageData[r]||this._allocNewPage(r);const n=this._pageData[r];for(let c=0;c<a;c++){const t=o*c,e=this.width*(h.y+c)+h.x;for(let s=0;s<o;s++)n[e+s]=i[t+s]}has("esri-glyph-debug")&&this._showDebugPage(n),this._invalidate()}_allocNewPage(t){this._dirties[this._currentPage]||(this._pageData[this._currentPage]=null),this._currentPage=t,this._pageData[t]=new Uint8Array(this.width*this.height),this._dirties[t]=!0,this._textures[t]=null,this._initDecorationGlyphs()}_initDecorationGlyphs(){const t=[117,149,181,207,207,181,149,117],i=[],s=[];for(let e=0;e<t.length;e++){const r=t[e];for(let t=0;t<11;t++){const h=e>=3&&e<5&&t>=3&&t<8?255:0;i.push(r),s.push(h)}}const r=new Uint8Array(i),n={rect:o,page:this._currentPage,sdf:!0},c=new Uint8Array(s),d={rect:a,page:this._currentPage,sdf:!0};this.recordGlyph(n,h,r,e),this.recordGlyph(d,h,c,e)}_showDebugPage(t){const e=document.createElement("canvas"),i=e.getContext("2d"),s=new ImageData(this.width,this.height),r=s.data;e.width=this.width,e.height=this.height,e.style.border="1px solid black";for(let h=0;h<t.length;++h)r[4*h]=t[h],r[4*h+1]=0,r[4*h+2]=0,r[4*h+3]=255;i.putImageData(s,0,0),document.body.appendChild(e)}}export{n as GlyphMosaic,h as decorGlyphRect};
2
+ import has from"../../../../core/has.js";import{open as t}from"../../../../core/workers.js";import{sdfBufferServer as e}from"./definitions.js";import i from"./Rect.js";import s from"../../../webgl/Texture.js";import{TextureDescriptor as r}from"../../../webgl/TextureDescriptor.js";const h={width:5,height:2,left:0,top:0},o=new i(0,0,11,8),n=new i(11,0,11,8);class a{constructor(t,e,i,s){this._snapCoords=i,this._setTextureBinding=s,this.width=0,this.height=0,this._dirties=[],this._pageData=[],this._currentPage=0,this._textures=[],this._worker=this._load(),this.width=t,this.height=e,this._pageData.push(new Uint8Array(t*e)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs()}dispose(){for(const t of this._textures)t&&t.dispose();this._textures.length=0,this._pageData.length=0,this._worker.then(t=>t.connection.close())}async openMessagePorts(){return(await this._worker).connection.openPorts()}async rasterizeText(t,e,i){return(await this._worker).worker.rasterizeText(t,e,i)}getTexture(t,e){if(!this._textures[e]){const i=new r(this.width,this.height);i.pixelFormat=6406,i.wrapMode=33071,this._textures[e]=new s(t,i,new Uint8Array(this.width*this.height))}return this._dirties[e]&&(this._textures[e].setData(this._pageData[e]),this._dirties[e]=!1),this._textures[e]}bind(t,e,i,s){const r=this.getTexture(t,i);r.setSamplingMode(e),t.bindTexture(r,s)}async _load(){const i={getOptions:()=>({width:this.width,height:this.height,snapCoords:!!this._snapCoords}),recordGlyphs:t=>{const i=e;for(const e of t)e.sdf&&this.recordGlyph(e.mosaicItem,e.rect,e.sdf.buffer,i),this._setTextureBinding&&0!==e.mosaicItem.textureBinding&&this._setTextureBinding(e.mosaicItem)}},s=await t("GlyphWorker",{client:i,strategy:"dedicated"});return{worker:s.createInvokeProxy(),connection:s}}_invalidate(){this._dirties[this._currentPage]=!0}recordGlyph(t,e,i,s){const{page:r,rect:h}=t;if(0===e.width)return;const o=e.width+2*s,n=e.height+2*s;this._pageData[r]||this._allocNewPage(r);const a=this._pageData[r];for(let c=0;c<n;c++){const t=o*c,e=this.width*(h.y+c)+h.x;for(let s=0;s<o;s++)a[e+s]=i[t+s]}has("esri-glyph-debug")&&this._showDebugPage(a),this._invalidate()}_allocNewPage(t){this._dirties[this._currentPage]||(this._pageData[this._currentPage]=null),this._currentPage=t,this._pageData[t]=new Uint8Array(this.width*this.height),this._dirties[t]=!0,this._textures[t]=null,this._initDecorationGlyphs()}_initDecorationGlyphs(){const t=[117,149,181,207,207,181,149,117],i=[],s=[];for(let e=0;e<t.length;e++){const r=t[e];for(let t=0;t<11;t++){const h=e>=3&&e<5&&t>=3&&t<8?255:0;i.push(r),s.push(h)}}const r=new Uint8Array(i),a={rect:o,page:this._currentPage,sdf:!0},c=new Uint8Array(s),d={rect:n,page:this._currentPage,sdf:!0};this.recordGlyph(a,h,r,e),this.recordGlyph(d,h,c,e)}_showDebugPage(t){const e=document.createElement("canvas"),i=e.getContext("2d"),s=new ImageData(this.width,this.height),r=s.data;e.width=this.width,e.height=this.height,e.style.border="1px solid black";for(let h=0;h<t.length;++h)r[4*h]=t[h],r[4*h+1]=0,r[4*h+2]=0,r[4*h+3]=255;i.putImageData(s,0,0),document.body.appendChild(e)}}export{a as GlyphMosaic,h as decorGlyphRect};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../request.js";import{bidiText as t}from"../../../../core/BidiText.js";import{getFullyQualifiedFontName as s}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{throwIfNotAbortError as a}from"../../../../core/promiseUtils.js";import{loadTextModule as r}from"../../../../libs/text/loadTextModule.js";import{parseRichTextRuns as h}from"../../../../symbols/cim/richTextUtils.js";import{sdfRadiusComplex as n,sdfBufferGlyphSDFCreator as o,sdfSizeComplex as c,sdfBufferServer as p,sdfRadiusSimple as l,sdfSizeSimple as f}from"./definitions.js";import{decorGlyphRect as g}from"./GlyphMosaic.js";import{GlyphSDFCreator as d}from"./GlyphSDFCreator.js";import _ from"./GlyphSource.js";import y from"./Rect.js";import u from"./RectangleBinPack.js";import{hashMosaic as m}from"./TextureManager.js";import{charCodes as w}from"./Utils.js";const S=.25,C="arial-unicode-ms-regular",G=/[\u0695\u0698\u06a9\u06af\u06b5\u06be\u06c6\u06cc\u06ce\u06d5\u06ca]|\p{Script=Thai}|\p{Script=Lao}|\p{Script=Tamil}|\p{Script=Khmer}/u,P=new Set(["Noto Sans Khmer","Noto Sans Lao","Noto Sans Myanmar","Noto Sans Thai"]),x=()=>i.getLogger("esri.views.MapView"),b=(e,t="")=>x().warnOnce(e,t);class R{constructor(){this._glyphSources=new Map,this._snapCoords=!0,this._currentPage=0,this._faces=new Map,this._facePromises=new Map,this._pbfRangePromises=new Map,this._glyphCache=new Map,this._pbfGlyphCache=new Map,this._invalidFonts=new Set,this._preloadCache={},this._glyphSDFCreator=new d({sdfSizePx:c,sdfBufferPx:o,radius:n,cutoff:S})}set remoteClient(e){this._client=e.createInvokeProxy();const t=this._client.getOptions();this._inited=this._init(t)}async rasterizeText(e,t,s){await this._inited;const i=t.symbol?h(t):null;if(i){return{type:"rich-glyphs",runs:(await Promise.all(i.map(async t=>({fontSize:t.fontSize,characterSpacing:t.characterSpacing,color:t.color,glyphs:await this._rasterizeTextRun(e,t.font,t.text,s)})))).filter(e=>null!=e.glyphs)}}return this._rasterizeTextRun(e,t.font,t.textString,s)}async _rasterizeTextRun(e,t,i,a){const r=s(t),h=this._invalidFonts.has(r),n=!!has("esri-2d-force-complex-shaping"),o=!!has("esri-2d-complex-shaping")&&G.test(i),c=P.has(t.family),p=n||o||c,l=h?C:r;let f=await this.getGlyphItems(i,p,e,l,!1,a);return f||(b(`Font ${r} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(r),f=await this.getGlyphItems(i,p,e,C,!1,a)),f}async getGlyphItems(e,s,i,a,r,h){await this._inited;const g=this._getSource(i),d=s?c:f,_=s?n:l,y=s?o:p;let u,m,S;if(has("esri-2d-stabilize-glyphs")&&await this.preloadASCIIGlyphCache(g,a).catch(()=>{}),s){const t=await this._getFace(g,a);if(!t)return null;let s=this._glyphCache.get(a);s||(s=new Map,this._glyphCache.set(a,s));const{shaping:i,isRTL:r}=this._shape(t,e);S=r,u=i.map(e=>this._getShapedGlyph(t,s,e)),m={baseline:t.baseline()/d,midline:t.midline()/d}}else{let s=this._pbfGlyphCache.get(a);s||(s=new Map,this._pbfGlyphCache.set(a,s));const[i,n,o]=t(e),c=w(i);try{await this._fetchRanges(g,a,c,h)}catch{return null}S=n,u=c.map(e=>this._getPBFGlyph(s,g,a,e,r)).filter(e=>!!e)}const C=u.filter(e=>e.needsRecord);return C.length>0&&await this._client.recordGlyphs(C),{type:"glyphs",glyphs:u,faceInfo:m,isRightToLeft:S,sdfSize:d,sdfRadius:_,sdfPadding:y}}async _init(e){const{width:t,height:s,snapCoords:i}=await e;this._glyphCache=new Map,this._pbfGlyphCache=new Map,this._binPack=new u(t,s),this._snapCoords=i,this._currentPage=0,this._initDecorationGlyphs()}_getShapedGlyph(e,t,s){let i,a,r=t.get(s.glyphId);if(!r){i=this._glyphSDFCreator.draw(e,s.glyphId);const h=this._glyphSDFCreator.sdfBufferPx;r={mosaicItem:{rect:this._recordGlyph(i?.rect,h),page:this._currentPage,sdf:!0,textureBinding:m(1,this._currentPage,!0)},glyphRect:i?.rect??{width:0,height:0,top:0,left:0}},t.set(s.glyphId,r),a=!0}return{mosaicItem:r.mosaicItem,rect:r.glyphRect,shaping:{xAdvance:s.xAdvance,yAdvance:s.yAdvance,xOffset:s.xOffset,yOffset:s.yOffset},code:s.isNewline?10:s.isWhitespace?32:NaN,sdf:i,needsRecord:a}}_getPBFGlyph(e,t,s,i,a=!1){let r,h,n=e.get(i);if(!n){const c=t.getRange(s,i),p=c?.getRect(i),l=c?.getShaping(i),f=c?.getBitmap(i);if(a&&(!p||!l))return;if(!p||!l)return j(i);r=f&&{buffer:f,rect:p},n={mosaicItem:{rect:f?this._recordGlyph(p,o):new y(0,0,0,0),sdf:!0,page:this._currentPage,textureBinding:m(1,this._currentPage,!0)},rect:p,shaping:l,code:i},h=!0,e.set(i,n)}const{mosaicItem:c,rect:p,shaping:l}=n;return{mosaicItem:c,rect:p,shaping:l,code:i,sdf:r,needsRecord:h}}_shape(e,s){const i=this._glyphSDFCreator.sdfSizePx,[a,r,h]=t(s,!1),n=new Uint32Array(Array.from(a).map((e,t)=>h.levels[h.targetToSource[t]]));return{shaping:e.shape(a,n,i),isRTL:r}}async _getFace(t,s,i){if(this._faces.has(s))return this._faces.get(s);const a=t.woffURL(s);return await M(this._facePromises,s,async()=>{const t=await e(a,{responseType:"array-buffer",...i}),h=(await r()).Face.parseWoff2(new Uint8Array(t.data));this._faces.set(s,h)}),this._faces.get(s)}_getSource(e){return this._glyphSources.has(e)||this._glyphSources.set(e,new _(e)),this._glyphSources.get(e)}async _fetchRanges(e,t,s,i){const a=I(s),r=[];a.forEach(s=>{r.push(this._fetchRange(e,t,s,i))}),await Promise.all(r)}async _fetchRange(e,t,s,i){if(s>256)return;const a=t+s;return M(this._pbfRangePromises,a,()=>e.fetchRange(t,s,i))}_allocNewPage(){this._currentPage++,this._binPack=new u(this._binPack.width,this._binPack.height),this._initDecorationGlyphs()}_recordGlyph(e,t){const s=this._binPack;if(!e||0===e.width)return new y;const i=e.width+2*t,a=e.height+2*t;let r=i,h=a;if(this._snapCoords){r+=i%4?4-i%4:4,h+=a%4?4-a%4:4}const n=s.allocate(r,h);return n.isEmpty?(this._allocNewPage(),s.allocate(r,h)):n}_initDecorationGlyphs(){this._recordGlyph(g,p),this._recordGlyph(g,p)}preloadASCIIGlyphCache(e,t){const s=this._preloadCache[t];if(null!=s)return s;const i=e.preloadASCIIRange(t).then(async()=>{let s=this._pbfGlyphCache.get(t);s||(s=new Map,this._pbfGlyphCache.set(t,s));for(let a=0;a<256;a++)this._getPBFGlyph(s,e,t,a);const i=Array.from(this._pbfGlyphCache.get(t).values());await this._client.recordGlyphs(i)},e=>{throw delete this._preloadCache[t],e});return this._preloadCache[t]=i,i}}function I(e){const t=new Set;for(const s of e)t.add(Math.floor(s/256));return t}function M(e,t,s){return e.has(t)||e.set(t,s().finally(()=>{e.delete(t)}).catch(e=>{a(e)})),e.get(t)}const j=e=>({mosaicItem:{rect:new y(0,0,0,0),sdf:!0,page:0},rect:{left:0,width:0,height:0,top:0},shaping:{xAdvance:0,yAdvance:0,xOffset:0,yOffset:0},code:e});export{R as default};
2
+ import e from"../../../../request.js";import{bidiText as t}from"../../../../core/BidiText.js";import{getFullyQualifiedFontName as s}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{throwIfNotAbortError as a}from"../../../../core/promiseUtils.js";import{loadTextModule as r}from"../../../../libs/librust-text/loadTextModule.js";import{parseRichTextRuns as h}from"../../../../symbols/cim/richTextUtils.js";import{sdfRadiusComplex as n,sdfBufferGlyphSDFCreator as o,sdfSizeComplex as c,sdfBufferServer as p,sdfRadiusSimple as l,sdfSizeSimple as f}from"./definitions.js";import{decorGlyphRect as g}from"./GlyphMosaic.js";import{GlyphSDFCreator as d}from"./GlyphSDFCreator.js";import _ from"./GlyphSource.js";import y from"./Rect.js";import u from"./RectangleBinPack.js";import{hashMosaic as m}from"./TextureManager.js";import{charCodes as w}from"./Utils.js";const S=.25,C="arial-unicode-ms-regular",G=/[\u0695\u0698\u06a9\u06af\u06b5\u06be\u06c6\u06cc\u06ce\u06d5\u06ca]|\p{Script=Thai}|\p{Script=Lao}|\p{Script=Tamil}|\p{Script=Khmer}/u,P=new Set(["Noto Sans Khmer","Noto Sans Lao","Noto Sans Myanmar","Noto Sans Thai"]),b=()=>i.getLogger("esri.views.MapView"),x=(e,t="")=>b().warnOnce(e,t);class R{constructor(){this._glyphSources=new Map,this._snapCoords=!0,this._currentPage=0,this._faces=new Map,this._facePromises=new Map,this._pbfRangePromises=new Map,this._glyphCache=new Map,this._pbfGlyphCache=new Map,this._invalidFonts=new Set,this._preloadCache={},this._glyphSDFCreator=new d({sdfSizePx:c,sdfBufferPx:o,radius:n,cutoff:S})}set remoteClient(e){this._client=e.createInvokeProxy();const t=this._client.getOptions();this._inited=this._init(t)}async rasterizeText(e,t,s){await this._inited;const i=t.symbol?h(t):null;if(i){return{type:"rich-glyphs",runs:(await Promise.all(i.map(async t=>({fontSize:t.fontSize,characterSpacing:t.characterSpacing,color:t.color,glyphs:await this._rasterizeTextRun(e,t.font,t.text,s)})))).filter(e=>null!=e.glyphs)}}return this._rasterizeTextRun(e,t.font,t.textString,s)}async _rasterizeTextRun(e,t,i,a){const r=s(t),h=this._invalidFonts.has(r),n=!!has("esri-2d-force-complex-shaping"),o=!!has("esri-2d-complex-shaping")&&G.test(i),c=P.has(t.family),p=n||o||c,l=h?C:r;let f=await this.getGlyphItems(i,p,e,l,!1,a);return f||(x(`Font ${r} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(r),f=await this.getGlyphItems(i,p,e,C,!1,a)),f}async getGlyphItems(e,s,i,a,r,h){await this._inited;const g=this._getSource(i),d=s?c:f,_=s?n:l,y=s?o:p;let u,m,S;if(has("esri-2d-stabilize-glyphs")&&await this.preloadASCIIGlyphCache(g,a).catch(()=>{}),s){const t=await this._getFace(g,a);if(!t)return null;let s=this._glyphCache.get(a);s||(s=new Map,this._glyphCache.set(a,s));const{shaping:i,isRTL:r}=this._shape(t,e);S=r,u=i.map(e=>this._getShapedGlyph(t,s,e)),m={baseline:t.baseline()/d,midline:t.midline()/d}}else{let s=this._pbfGlyphCache.get(a);s||(s=new Map,this._pbfGlyphCache.set(a,s));const[i,n,o]=t(e),c=w(i);try{await this._fetchRanges(g,a,c,h)}catch{return null}S=n,u=c.map(e=>this._getPBFGlyph(s,g,a,e,r)).filter(e=>!!e)}const C=u.filter(e=>e.needsRecord);return C.length>0&&await this._client.recordGlyphs(C),{type:"glyphs",glyphs:u,faceInfo:m,isRightToLeft:S,sdfSize:d,sdfRadius:_,sdfPadding:y}}async _init(e){const{width:t,height:s,snapCoords:i}=await e;this._glyphCache=new Map,this._pbfGlyphCache=new Map,this._binPack=new u(t,s),this._snapCoords=i,this._currentPage=0,this._initDecorationGlyphs()}_getShapedGlyph(e,t,s){let i,a,r=t.get(s.glyphId);if(!r){i=this._glyphSDFCreator.draw(e,s.glyphId);const h=this._glyphSDFCreator.sdfBufferPx;r={mosaicItem:{rect:this._recordGlyph(i?.rect,h),page:this._currentPage,sdf:!0,textureBinding:m(1,this._currentPage,!0)},glyphRect:i?.rect??{width:0,height:0,top:0,left:0}},t.set(s.glyphId,r),a=!0}return{mosaicItem:r.mosaicItem,rect:r.glyphRect,shaping:{xAdvance:s.xAdvance,yAdvance:s.yAdvance,xOffset:s.xOffset,yOffset:s.yOffset},code:s.isNewline?10:s.isWhitespace?32:NaN,sdf:i,needsRecord:a}}_getPBFGlyph(e,t,s,i,a=!1){let r,h,n=e.get(i);if(!n){const c=t.getRange(s,i),p=c?.getRect(i),l=c?.getShaping(i),f=c?.getBitmap(i);if(a&&(!p||!l))return;if(!p||!l)return j(i);r=f&&{buffer:f,rect:p},n={mosaicItem:{rect:f?this._recordGlyph(p,o):new y(0,0,0,0),sdf:!0,page:this._currentPage,textureBinding:m(1,this._currentPage,!0)},rect:p,shaping:l,code:i},h=!0,e.set(i,n)}const{mosaicItem:c,rect:p,shaping:l}=n;return{mosaicItem:c,rect:p,shaping:l,code:i,sdf:r,needsRecord:h}}_shape(e,s){const i=this._glyphSDFCreator.sdfSizePx,[a,r,h]=t(s,!1),n=new Uint32Array(Array.from(a).map((e,t)=>h.levels[h.targetToSource[t]]));return{shaping:e.shape(a,n,i),isRTL:r}}async _getFace(t,s,i){if(this._faces.has(s))return this._faces.get(s);const a=t.woffURL(s);return await M(this._facePromises,s,async()=>{const t=await e(a,{responseType:"array-buffer",...i}),h=(await r()).Face.parseWoff2(new Uint8Array(t.data));this._faces.set(s,h)}),this._faces.get(s)}_getSource(e){return this._glyphSources.has(e)||this._glyphSources.set(e,new _(e)),this._glyphSources.get(e)}async _fetchRanges(e,t,s,i){const a=I(s),r=[];a.forEach(s=>{r.push(this._fetchRange(e,t,s,i))}),await Promise.all(r)}async _fetchRange(e,t,s,i){if(s>256)return;const a=t+s;return M(this._pbfRangePromises,a,()=>e.fetchRange(t,s,i))}_allocNewPage(){this._currentPage++,this._binPack=new u(this._binPack.width,this._binPack.height),this._initDecorationGlyphs()}_recordGlyph(e,t){const s=this._binPack;if(!e||0===e.width)return new y;const i=e.width+2*t,a=e.height+2*t;let r=i,h=a;if(this._snapCoords){r+=i%4?4-i%4:4,h+=a%4?4-a%4:4}const n=s.allocate(r,h);return n.isEmpty?(this._allocNewPage(),s.allocate(r,h)):n}_initDecorationGlyphs(){this._recordGlyph(g,p),this._recordGlyph(g,p)}preloadASCIIGlyphCache(e,t){const s=this._preloadCache[t];if(null!=s)return s;const i=e.preloadASCIIRange(t).then(async()=>{let s=this._pbfGlyphCache.get(t);s||(s=new Map,this._pbfGlyphCache.set(t,s));for(let a=0;a<256;a++)this._getPBFGlyph(s,e,t,a);const i=Array.from(this._pbfGlyphCache.get(t).values());await this._client.recordGlyphs(i)},e=>{throw delete this._preloadCache[t],e});return this._preloadCache[t]=i,i}}function I(e){const t=new Set;for(const s of e)t.add(Math.floor(s/256));return t}function M(e,t,s){return e.has(t)||e.set(t,s().finally(()=>{e.delete(t)}).catch(e=>{a(e)})),e.get(t)}const j=e=>({mosaicItem:{rect:new y(0,0,0,0),sdf:!0,page:0},rect:{left:0,width:0,height:0,top:0},shaping:{xAdvance:0,yAdvance:0,xOffset:0,yOffset:0},code:e});export{R as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Handles.js";import i from"../../../../core/Logger.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{getProjectiveTransform as n}from"../../../../core/perspectiveUtils.js";import{watch as o,initial as a,when as l}from"../../../../core/reactiveUtils.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{getClosestDenormalizedXToReference as h}from"../../../../geometry/support/normalizeUtils.js";import{isVideoElement as u}from"../../../../support/mediaLayerUtils.js";import{DisplayObject as c}from"../DisplayObject.js";import{createPlayer as f,updateIfNeeded as y}from"./animatedFormats/utils.js";import w from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";const _=[1,1],v=d(),g={none:"None",loop:"Loop",oscillate:"Oscillate"};function A(e){return e?{type:"CIMAnimatedSymbolProperties",...e,playAnimation:e.playing,repeatType:e.repeatType?g[e.repeatType]:void 0}:{type:"CIMAnimatedSymbolProperties"}}class R extends c{constructor(n){super(),this.elementView=n,this.isWrapAround=!1,this.wrapAroundShift=0,this.perspectiveTransform=p(),this._handles=new r,this._vertices=new Float32Array(8),this._indices=new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]),this._playAnimation=!0,this._handles.add([o(()=>this.elementView.element.opacity,e=>this.opacity=e,a),o(()=>[this.elementView.coords],()=>{this.requestRender()},a),o(()=>["animationOptions"in this.elementView.element&&this.elementView.element.animationOptions],()=>{this.texture=s(this.texture),this.requestRender()},a),l(()=>this.elementView.element.loaded,()=>{const e=this.elementView.element;this.ready(),u(e)&&null!=e.content&&(this._handles.add([t(e.content,"play",()=>this.requestRender()),t(e.content,"loadeddata",()=>this.requestRender()),t(e.content,"loaded",()=>this.requestRender())]),"requestVideoFrameCallback"in e.content?e.content.requestVideoFrameCallback(()=>this.requestRender()):this._handles.add([t(e.content,"seeked",()=>this.requestRender())]),this.requestRender())},a)]),n.element.load().catch(t=>{i.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:n,error:t}))})}getMesh(e){throw new Error("Method not implemented.")}destroy(){super.destroy(),this._handles.destroy(),this.texture=s(this.texture)}get textureSize(){return _}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const i=r instanceof HTMLImageElement,s=r instanceof HTMLVideoElement,n=i?r.naturalWidth:s?r.videoWidth:r.width,o=i?r.naturalHeight:s?r.videoHeight:r.height;if(this._updatePerspectiveTransform(n,o),this.texture)if(s)if(r.readyState>=r.HAVE_CURRENT_DATA)e.animationsEnabled&&this._updateTextureAndRequestRender(r);else{const e=()=>{this._updateTextureAndRequestRender(r),r.removeEventListener("canplay",e),r.removeEventListener("seeked",e)};r.addEventListener("canplay",e),r.addEventListener("seeked",e)}else"getFrame"in r&&e.animationsEnabled&&this.requestRender();else{const e=new x(n,o);if(e.wrapMode=33071,e.preMultiplyAlpha=!0,"getFrame"in r){const i=r=>{this.texture?this.texture.setData(r):this.texture=new w(t,e,r)};if("animationOptions"in this.elementView.element){const e=A(this.elementView.element.animationOptions);this._playAnimation=e.playAnimation??!1,this._player=f(r,e,null,i)}}else this.texture=new w(t,e,r);this.texture.generateMipmap(),s&&this._requestVideoFrame(r)}}super.beforeRender(e)}_updateTextureAndRequestRender(e){this.texture.setData(e),this.texture.generateMipmap(),this._requestVideoFrame(e)}_requestVideoFrame(e){"requestVideoFrameCallback"in e?e.requestVideoFrameCallback(()=>this.requestRender()):e.paused||this.requestRender()}_createTransforms(){return null}draw(e,t){this.isReady&&null!=this.texture?(this._playAnimation&&y(e,this._player),t.render(e,{config:{perspective:this.perspectiveTransform,texSize:_,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity},texture:{texture:this.texture,unit:0},position:this._vertices,tex:this._indices})):this.requestRender()}updateDrawCoords(e,t,r,i){const{coords:s,bounds:n}=this.elementView;if(null==s||null==n)return;const[o,a,l,d]=s.rings[0],m=this._vertices,p=(n[0]+n[2])/2,u=h(e.x,p,s.spatialReference),c=e.y,f=e.x-u;m.set([a[0]-u,a[1]-c,o[0]-u,o[1]-c,l[0]-u,l[1]-c,d[0]-u,d[1]-c]);let y=t;if(i){const e=n[0]+f,t=n[2]+f,{worldWidth:r,xBounds:s}=i,[o,a]=s;e<o?y=r:t>a&&(y=-r)}this.wrapAroundShift=y,this.isWrapAround=0!==y}_updatePerspectiveTransform(e,t){const r=this._vertices;n(v,[0,0,e,0,0,t,e,t],[r[0],r[1],r[4],r[5],r[2],r[3],r[6],r[7]]),m(this.perspectiveTransform,v[6]/v[8]*e,v[7]/v[8]*t)}}export{R as default};
2
+ import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import r from"../../../../core/Handles.js";import i from"../../../../core/Logger.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import{getProjectiveTransform as n}from"../../../../core/perspectiveUtils.js";import{watch as o,initial as a,when as l}from"../../../../core/reactiveUtils.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{getClosestDenormalizedXToReference as h}from"../../../../geometry/support/normalizeUtils.js";import{isVideoElement as u}from"../../../../support/mediaLayerUtils.js";import{DisplayObject as c}from"../DisplayObject.js";import{createPlayer as f,updateIfNeeded as y}from"./animatedFormats/utils.js";import w from"../../../webgl/Texture.js";import{TextureDescriptor as x}from"../../../webgl/TextureDescriptor.js";const _=[1,1],v=d(),g={none:"None",loop:"Loop",oscillate:"Oscillate"};function A(e){return e?{type:"CIMAnimatedSymbolProperties",...e,playAnimation:e.playing,repeatType:e.repeatType?g[e.repeatType]:void 0}:{type:"CIMAnimatedSymbolProperties"}}class R extends c{constructor(n){super(),this.elementView=n,this.isWrapAround=!1,this.wrapAroundShift=0,this.perspectiveTransform=p(),this._handles=new r,this._vertices=new Float32Array(8),this._indices=new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]),this._playAnimation=!0,this._handles.add([o(()=>this.elementView.element.opacity,e=>this.opacity=e,a),o(()=>[this.elementView.coords],()=>{this.requestRender()},a),o(()=>["animationOptions"in this.elementView.element&&this.elementView.element.animationOptions],()=>{this.texture=s(this.texture),this.requestRender()},a),l(()=>this.elementView.element.loaded,()=>{const e=this.elementView.element;this.ready(),u(e)&&null!=e.content&&(this._handles.add([t(e.content,"play",()=>this.requestRender()),t(e.content,"loadeddata",()=>this.requestRender()),t(e.content,"loaded",()=>this.requestRender())]),"requestVideoFrameCallback"in e.content?e.content.requestVideoFrameCallback(()=>this.requestRender()):this._handles.add([t(e.content,"seeked",()=>this.requestRender())]),this.requestRender())},a)]),n.element.load().catch(t=>{i.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new e("element-load-error","Element cannot be displayed",{element:n,error:t}))})}getMesh(e){throw new Error("Method not implemented.")}destroy(){super.destroy(),this._handles.destroy(),this.texture=s(this.texture)}get textureSize(){return _}beforeRender(e){const{context:t}=e,r=this.elementView.element.content;if(null!=r){const i=r instanceof HTMLImageElement,s=r instanceof HTMLVideoElement,n=i?r.naturalWidth:s?r.videoWidth:r.width,o=i?r.naturalHeight:s?r.videoHeight:r.height;if(this._updatePerspectiveTransform(n,o),this.texture)if(s)if(r.readyState>=r.HAVE_CURRENT_DATA)e.animationsEnabled&&this._updateTextureAndRequestRender(r);else{const e=()=>{this._updateTextureAndRequestRender(r),r.removeEventListener("canplay",e),r.removeEventListener("seeked",e)};r.addEventListener("canplay",e),r.addEventListener("seeked",e)}else"getFrame"in r&&e.animationsEnabled&&this.requestRender();else{const e=new x(n,o);if(e.wrapMode=33071,e.preMultiplyAlpha=!0,"getFrame"in r){const i=r=>{this.texture?this.texture.setData(r):this.texture=new w(t,e,r)};if("animationOptions"in this.elementView.element){const e=A(this.elementView.element.animationOptions);this._playAnimation=e.playAnimation??!1,this._player=f(r,e,null,i)}}else this.texture=new w(t,e,r);this.texture.generateMipmap(),s&&this._requestVideoFrame(r)}}super.beforeRender(e)}_updateTextureAndRequestRender(e){this.texture.setData(e),this.texture.generateMipmap(),this._requestVideoFrame(e)}_requestVideoFrame(e){"requestVideoFrameCallback"in e?e.requestVideoFrameCallback(()=>this.requestRender()):e.paused||this.requestRender()}_createTransforms(){return null}draw(e,t){this.isReady&&null!=this.texture?(this._playAnimation&&y(e,this._player),t.render(e,{config:{perspective:this.perspectiveTransform,texSize:_,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity},texture:{texture:this.texture,unit:0},position:this._vertices,tex:this._indices})):this.requestRender()}updateDrawCoords(e,t,r,i){const{coords:s,bounds:n}=this.elementView;if(null==s||null==n)return;const[o,a,l,d]=s.rings[0],m=this._vertices,p=(n[0]+n[2])/2,u=h(e.x,p,s.spatialReference),c=e.y;m.set([a[0]-u,a[1]-c,o[0]-u,o[1]-c,l[0]-u,l[1]-c,d[0]-u,d[1]-c]);let f=0;if(i){const{worldWidth:e}=i,t=e/2,r=n[0]-u,s=n[2]-u;r<-t?f=e:s>t&&(f=-e)}this.wrapAroundShift=f,this.isWrapAround=0!==f}_updatePerspectiveTransform(e,t){const r=this._vertices;n(v,[0,0,e,0,0,t,e,t],[r[0],r[1],r[4],r[5],r[2],r[3],r[6],r[7]]),m(this.perspectiveTransform,v[6]/v[8]*e,v[7]/v[8]*t)}}export{R as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import t from"../../../../../core/Handles.js";import{set as i,normalize as e}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as a,scaleAndAdd as s,subtract as n,length as o,dot as l}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as h,a as p}from"../../../../../chunks/boundedPlane.js";import{getInfo as u}from"../../../../../geometry/support/spatialReferenceUtils.js";import{Manipulation as _}from"./Manipulation.js";import{onGrabChangedHandle as d}from"./utils.js";import{createManipulatorDragEventPipeline as m,screenToMap as f}from"../../../../interactive/dragEventPipeline.js";import{GraphicManipulator as g}from"../../../../interactive/GraphicManipulator.js";import{apply as v}from"../../../../interactive/editGeometry/support/editPlaneUtils.js";const b=10,x=1e-6,C=.3;function y(t){const i=o(t.basis1),e=o(t.basis2);return C*Math.min(i,e)}class j extends _{constructor(i){super(),this._handles=new t,this._planeStart=h(),this._displayPlaneStart=h(),this._originCache=c(),this._axisCache=r(),this._renderStartCache=c(),this._renderEndCache=c(),this._resizeOriginCache=c(),this._view=i.view,this._tool=i.tool,this._graphic=i.graphic,this._direction=i.direction,this._preserveAspectRatio=i.preserveAspectRatio,this._manipulator=this._createManipulator(),this._handles.add([this._manipulator.events.on("grab-changed",t=>d(t,this._manipulator))]),this.forEachManipulator(t=>this._tool.manipulators.add(t))}destroy(){this._handles.destroy(),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._graphic=null,this._manipulator=null,this._direction=null,this._handles=null,this._planeStart=null,this._displayPlaneStart=null,this._originCache=null,this._axisCache=null,this._renderStartCache=null,this._renderEndCache=null,this._resizeOriginCache=null,this._preserveAspectRatio=null}forEachManipulator(t){t(this._manipulator,1)}createDragPipeline(t,r){let c=null,h=null,_=null,d=0,g=null,C=null;const j=this._planeStart,w=this._displayPlaneStart,S=this._direction;return m(this._manipulator,(m,E)=>{E.next(i=>{if("start"===i.action){m.cursor="grabbing";const i=t();c=i.plane,h=i.displayPlane,_=i.editGeometryOperations,d=b*this._view.resolution,p(c,j),p(h,w);const e=u(_.data.spatialReference);g=e?e.valid[1]-e.valid[0]-3*b*this._view.resolution:null}return i}).next(f(this._view)).next(t=>{const i=a(this._renderStartCache,[t.mapStart.x,t.mapStart.y,0]),e=a(this._renderEndCache,[t.mapEnd.x,t.mapEnd.y,0]),r=a(this._resizeOriginCache,w.origin);s(r,r,w.basis1,-S[0]),s(r,r,w.basis2,-S[1]),n(e,e,r),n(i,i,r);const c=0!==S[0]&&0!==S[1],p=y(w),u=y(h)/p,_=(t,r)=>{if(0===t)return 1;let a=o(r),s=.5*t*l(r,e)/a;const n=s<0?-1:1;if(c){s+=(a-.5*t*l(r,i)/a)*n*u}const h=a<1.5*d?1:x;return a=Math.max(a-d,x),n>0&&(s-=b*this._view.resolution),n*Math.max(n*(s/a),h)},m=_(S[0],w.basis1),f=_(S[1],w.basis2);return{...t,direction:S,factor1:m,factor2:f}}).next(this._preserveAspectRatio.createDragEventPipelineStep(),this._preserveAspectRatio.next).next(t=>{const n=a(this._originCache,j.origin);s(n,n,j.basis1,-S[0]),s(n,n,j.basis2,-S[1]);const o=i(this._axisCache,j.basis1[0],j.basis1[1]);e(o,o);const l=_.data.allVerticesUnordered,h="start"===t.action?0:1,u=_.scaleVertices(l,n,o,t.factor1,t.factor2,h,1);return g&&g<_.data.geometry.extent.width&&C?_.updateVertices(l,C):(p(j,c),v(u,c),C=u.operation,r(t,u)),t}).next(t=>("end"===t.action&&(m.cursor="grab"),t))})}_createManipulator(){return new g({view:this._view,graphic:this._graphic,selectable:!0,cursor:"grab"})}}export{j as ScaleManipulation,y as calculateDiagonalResizeHandleScale};
2
+ import t from"../../../../../core/Handles.js";import{set as i,normalize as e}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as a,scaleAndAdd as s,subtract as n,length as o,dot as l}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as h,a as p}from"../../../../../chunks/boundedPlane.js";import{getClosestDenormalizedXToReference as u}from"../../../../../geometry/support/normalizeUtils.js";import{getInfo as m}from"../../../../../geometry/support/spatialReferenceUtils.js";import{Manipulation as _}from"./Manipulation.js";import{onGrabChangedHandle as d}from"./utils.js";import{createManipulatorDragEventPipeline as f,screenToMap as g}from"../../../../interactive/dragEventPipeline.js";import{GraphicManipulator as v}from"../../../../interactive/GraphicManipulator.js";import{apply as b}from"../../../../interactive/editGeometry/support/editPlaneUtils.js";const x=10,y=1e-6,C=.3;function S(t){const i=o(t.basis1),e=o(t.basis2);return C*Math.min(i,e)}class j extends _{constructor(i){super(),this._handles=new t,this._planeStart=h(),this._displayPlaneStart=h(),this._originCache=c(),this._axisCache=r(),this._renderStartCache=c(),this._renderEndCache=c(),this._resizeOriginCache=c(),this._view=i.view,this._tool=i.tool,this._graphic=i.graphic,this._direction=i.direction,this._preserveAspectRatio=i.preserveAspectRatio,this._manipulator=this._createManipulator(),this._handles.add([this._manipulator.events.on("grab-changed",t=>d(t,this._manipulator))]),this.forEachManipulator(t=>this._tool.manipulators.add(t))}destroy(){this._handles.destroy(),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._graphic=null,this._manipulator=null,this._direction=null,this._handles=null,this._planeStart=null,this._displayPlaneStart=null,this._originCache=null,this._axisCache=null,this._renderStartCache=null,this._renderEndCache=null,this._resizeOriginCache=null,this._preserveAspectRatio=null}forEachManipulator(t){t(this._manipulator,1)}createDragPipeline(t,r){let c=null,h=null,_=null,d=0,v=null,C=null,j=0;const w=this._planeStart,E=this._displayPlaneStart,M=this._direction;return f(this._manipulator,(f,P)=>{P.next(i=>{if("start"===i.action){f.cursor="grabbing";const i=t();c=i.plane,h=i.displayPlane,_=i.editGeometryOperations,d=x*this._view.resolution,p(c,w),p(h,E);const e=m(_.data.spatialReference);v=e?e.valid[1]-e.valid[0]-3*x*this._view.resolution:null}return i}).next(g(this._view)).next(t=>{if("start"===t.action){const i=E.origin[0]+M[0]*E.basis1[0]+M[1]*E.basis2[0],e=_.data.spatialReference,r=u(t.mapStart.x,i,e);j=r-t.mapStart.x}const i=a(this._renderStartCache,[t.mapStart.x+j,t.mapStart.y,0]),e=a(this._renderEndCache,[t.mapEnd.x+j,t.mapEnd.y,0]),r=a(this._resizeOriginCache,E.origin);s(r,r,E.basis1,-M[0]),s(r,r,E.basis2,-M[1]),n(e,e,r),n(i,i,r);const c=0!==M[0]&&0!==M[1],p=S(E),m=S(h)/p,f=(t,r)=>{if(0===t)return 1;let a=o(r),s=.5*t*l(r,e)/a;const n=s<0?-1:1;if(c){s+=(a-.5*t*l(r,i)/a)*n*m}const h=a<1.5*d?1:y;return a=Math.max(a-d,y),n>0&&(s-=x*this._view.resolution),n*Math.max(n*(s/a),h)},g=f(M[0],E.basis1),v=f(M[1],E.basis2);return{...t,direction:M,factor1:g,factor2:v}}).next(this._preserveAspectRatio.createDragEventPipelineStep(),this._preserveAspectRatio.next).next(t=>{const n=a(this._originCache,w.origin);s(n,n,w.basis1,-M[0]),s(n,n,w.basis2,-M[1]);const o=i(this._axisCache,w.basis1[0],w.basis1[1]);e(o,o);const l=_.data.allVerticesUnordered,h="start"===t.action?0:1,u=_.scaleVertices(l,n,o,t.factor1,t.factor2,h,1);return v&&v<_.data.geometry.extent.width&&C?_.updateVertices(l,C):(p(w,c),b(u,c),C=u.operation,r(t,u)),t}).next(t=>("end"===t.action&&(f.cursor="grab"),t))})}_createManipulator(){return new v({view:this._view,graphic:this._graphic,selectable:!0,cursor:"grab"})}}export{j as ScaleManipulation,S as calculateDiagonalResizeHandleScale};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{clone as t}from"../../../core/lang.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{createScreenPoint as a,isScreenRect as l,pt2px as n}from"../../../core/screenUtils.js";import{property as o,subclass as h}from"../../../core/accessorSupport/decorators.js";import{diff as y,hasDiff as u}from"../../../core/accessorSupport/diffUtils.js";import c from"../../../geometry/Point.js";import{create as d}from"../../../geometry/support/aaBoundingRect.js";import{equals as p}from"../../../geometry/support/spatialReferenceUtils.js";import{isVectorTileGraphicOrigin as _}from"../../../graphic/isVectorTileGraphicOrigin.js";import{tileSizeInTileUnits as f,tileSizeInPixels as g}from"../engine/vectorTiles/constants.js";import{TileHandler as m}from"../engine/vectorTiles/TileHandler.js";import{TileManager as T}from"../engine/vectorTiles/TileManager.js";import{VectorTile as C}from"../engine/vectorTiles/VectorTile.js";import{VectorTileContainer as v}from"../engine/vectorTiles/VectorTileContainer.js";import w from"../engine/vectorTiles/VectorTileFeatureIndex.js";import R from"../engine/vectorTiles/style/StyleRepository.js";import{LayerView2D as H}from"./LayerView2D.js";import I from"../tiling/TileInfoViewPOT.js";import Q from"../tiling/TileQueue.js";import S from"../../layers/VectorTileLayerView.js";import{TaskPriority as P}from"../../support/Scheduler.js";const b=2.5;let V=class extends(H(S)){constructor(){super(...arguments),this._styleChanges=[],this._fetchQueue=null,this._parseQueue=null,this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._styeChanged=!1,this._spriteSourceChanged=!1}get fading(){return(this._vectorTileContainer?.fading||this._tileManager?.isFading())??!1}get hasVisibleFeatures(){const e=this._vectorTileContainer.children;for(const t of e)if(t.hasFeatures())return!0;return!1}get spriteSourceChanged(){return this._spriteSourceChanged}get styleChanged(){return this._styeChanged}async hitTest(e,t){const i=this._tileHandlerPromise,s=this._vectorTileContainer?.symbolFader;if(!i||!this._isTileHandlerReady||!s)return;await i;let r=[];if(l(t)){const e=t;r=[a(e.x,e.y+e.height),a(e.x+e.width,e.y+e.height),a(e.x+e.width,e.y),a(e.x,e.y)]}else r=[t];const o=has("esri-vtl-search-tolerance")??0,h=o>0?o:b,y=this.view.state,{rotation:u,pixelRatio:c}=this.view.state,d=n(h)*c;let p=null;const _=this._vectorTileContainer?.symbolRepository;_&&(p=_.querySymbols(r[0],d,s.decluttererOffset,{}));const f=this._tileManager.getIntersectingTiles(r[0].x,r[0].y,d,y,p);if(p=p?.filter(e=>this._styleRepository.getStyleLayerVisibility(e.styleLayerUID)),(!f||0===f.length)&&0===p?.length)return null;e=e.clone().normalize();const g=[],m=[];for(const a of f)g.push(this._queryTile(m,e,d,u,a,p?.filter(e=>e.tileKey.id===a.id)));return await Promise.all(g),m}update(e){if(this._tileHandlerPromise&&this._isTileHandlerReady)return e.pixelRatio!==this._tileHandler.devicePixelRatio?(this._tileHandler.devicePixelRatio=e.pixelRatio,void this._loadStyle()):void(this._styleChanges.length>0?this._tileHandlerPromise=this._applyStyleChanges():(this._pauseQueues(),this._fetchQueue.state=e.state,this._parseQueue.state=e.state,this._tileManager.update(e)||this.requestUpdate(),this._resumeQueues()))}attach(){const{style:e}=this.layer.currentStyleInfo;this._styleRepository=new R(e),this._tileInfoView=new I(this.layer.tileInfo,this.layer.fullExtent),this._vectorTileContainer=new v(this._tileInfoView),this._tileHandler=new m(this.layer,this._styleRepository,window.devicePixelRatio||1,this.layer.tileInfo.lods.length-1,this.view.glyphMosaic),this.container.addChild(this._vectorTileContainer),this._start(),this.addAttachHandles([this.layer.on("paint-change",e=>{if(this._styeChanged=!0,e.isDataDriven)this._styleChanges.push({type:0,data:e}),this.requestUpdate();else{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=3===i.type;t.setPaintProperties(e.layer,e.paint),s&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender()}}),this.layer.on("layout-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;this._styeChanged=!0;const s=y(i.layout,e.layout);if(null!=s){if(u(s,"visibility")&&1===D(s))return t.setLayoutProperties(e.layer,e.layout),3===i.type&&this._vectorTileContainer?.restartDeclutter(),void this._vectorTileContainer?.requestRender();this._styleChanges.push({type:1,data:e}),this.requestUpdate()}}),this.layer.on("style-layer-visibility-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);i&&(this._styeChanged=!0,t.setStyleLayerVisibility(e.layer,e.visibility),3===i.type&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender())}),this.layer.on("style-layer-change",e=>{this._styleChanges.push({type:2,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("delete-style-layer",e=>{this._styleChanges.push({type:3,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("load-style",()=>this._loadStyle()),this.layer.on("spriteSource-change",e=>{this._spriteSourceChanged=!0,this._styleChanges.push({type:4,data:e});const t=this._styleRepository.layers;for(const i of t)switch(i.type){case 3:i.getLayoutProperty("icon-image")&&this._styleChanges.push({type:1,data:{layer:i.id,layout:i.layout}});break;case 2:i.getPaintProperty("line-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}});break;case 1:i.getLayoutProperty("fill-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}})}this.requestUpdate()})])}detach(){this._stop(),this.container.removeAllChildren(),this._vectorTileContainer=s(this._vectorTileContainer),this._tileHandler=s(this._tileHandler)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return p(this.layer.tileInfo?.spatialReference,e)}canResume(){let e=super.canResume();const{currentStyleInfo:t}=this.layer;if(e&&t?.layerDefinition){const i=this.view.scale,{minScale:s,maxScale:r}=t.layerDefinition;t?.layerDefinition&&(s&&s<i&&(e=!1),r&&r>i&&(e=!1))}return e}isUpdating(){return this.fading||!this._isTileHandlerReady}acquireTile(e){const t=this._createVectorTile(e);return this._updatingHandles.consumePromise(this._fetchQueue.push(t.key).then(e=>this._parseQueue.push({key:t.key,data:e})).then(e=>{t.once("attach",()=>this.requestUpdate()),t.setData(e),this.requestUpdate()}).catch(e=>{r(e)||i.getLogger(this).error(e)})),t}releaseTile(e){const t=e.key.id;this._fetchQueue.abort(t),this._parseQueue.abort(t),this.requestUpdate()}async doRefresh(){if(!this.attached)return;if(this.suspended)return this._tileManager.clear(),void this.requestUpdate();this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache(),this._resumeQueues();const e=this._vectorTileContainer.children,t=[];try{for(const i of e){const e=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(e=>this._parseQueue.push({key:i.key,data:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(e)}await Promise.all(t)}catch(s){i.getLogger(this).error("error refreshing vector-tiles layer-view",s),this._resumeQueues(),this._isTileHandlerReady=!0}this._isTileHandlerReady=!0,this.requestUpdate()}_start(){if(this._stop(),this._tileManager=new T({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),!this.layer.currentStyleInfo)return;const e=new AbortController,t=this._tileHandler.start({signal:e.signal}).then(()=>{this._fetchQueue=new Q({tileInfoView:this._tileInfoView,process:(e,t)=>this._getTileData(e,t),concurrency:15,scheduler:this.scheduler,priority:P.MAPVIEW_FETCH_QUEUE}),this._parseQueue=new Q({tileInfoView:this._tileInfoView,process:(e,t)=>this._parseTileData(e,t),concurrency:8,scheduler:this.scheduler,priority:P.MAPVIEW_VECTOR_TILE_PARSING_QUEUE}),this.requestUpdate(),this._isTileHandlerReady=!0});this._tileHandler.spriteMosaic.then(e=>{this._vectorTileContainer.setStyleResources(e,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this.requestUpdate()}),this._tileHandlerAbortController=e,this._tileHandlerPromise=t}_stop(){if(!this._tileHandlerAbortController||!this._vectorTileContainer)return;const e=this._tileHandlerAbortController;e&&e.abort(),this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._fetchQueue=s(this._fetchQueue),this._parseQueue=s(this._parseQueue),this._tileManager=s(this._tileManager),this._vectorTileContainer.removeAllChildren()}async _getTileData(e,t){return this._tileHandler.fetchTileData(e,t)}async _parseTileData(e,t){return this._tileHandler.parseTileData(e,t)}async _applyStyleChanges(){this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache();const e=this._styleChanges;try{await this._tileHandler.updateStyle(e)}catch(o){i.getLogger(this).error("error applying vector-tiles style update",o.message),this._resumeQueues(),this._isTileHandlerReady=!0}const t=this._styleRepository,s=new Set,r=new Set;for(const i of e){if(3!==i.type&&2!==i.type)continue;const e=2===i.type?i.data.layer.id:i.data.layer,a=t.getLayerById(e);a&&(s.add(a.uid),3===a.type&&r.add(a.uid))}const a=this._vectorTileContainer.children,l=this._vectorTileContainer?.symbolFader?.symbolRepository;l&&r.size>0&&l.deleteStyleLayers(Array.from(r));const n=new Set;if(e.forEach(e=>{let i;switch(e.type){case 0:t.setPaintProperties(e.data.layer,e.data.paint),i=e.data.layer;break;case 1:t.setLayoutProperties(e.data.layer,e.data.layout),i=e.data.layer;break;case 3:return void t.deleteStyleLayer(e.data.layer);case 2:t.setStyleLayer(e.data.layer,e.data.index),i=e.data.layer.id;break;case 4:this._vectorTileContainer.setSpriteMosaic(this._tileHandler.setSpriteSource(e.data.spriteSource))}if(i){const e=t.getLayerById(i);e&&n.add(e.uid)}}),s.size>0){const e=Array.from(s);this._vectorTileContainer.deleteStyleLayers(e);for(const t of a)t.deleteLayerData(e)}if(this._resumeQueues(),n.size>0){const e=Array.from(n),t=[];for(const i of a){const s=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(t=>this._parseQueue.push({key:i.key,data:t,styleLayerUIDs:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(s)}await Promise.all(t)}this._styleChanges=[],this._isTileHandlerReady=!0,this.requestUpdate()}async _loadStyle(){const{style:e}=this.layer.currentStyleInfo,i=t(e);this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._styleRepository=new R(i),this._vectorTileContainer.destroy(),this._tileManager.clear(),this._tileHandlerAbortController.abort(),this._tileHandlerAbortController=new AbortController;const{signal:s}=this._tileHandlerAbortController;try{this._tileHandlerPromise=this._tileHandler.setStyle(this._styleRepository,i,this.layer.tileInfo.lods.length-1),await this._tileHandlerPromise}catch(n){if(!r(n))throw n}if(s.aborted)return this._resumeQueues(),this._isTileHandlerReady=!0,this._styeChanged=!1,this._spriteSourceChanged=!1,void this.requestUpdate();const a=await this._tileHandler.spriteMosaic,l=this._vectorTileContainer;this._tileInfoView=new I(this.layer.tileInfo,this.layer.fullExtent),l.setStyleResources(a,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this._tileManager=new T({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),this._resumeQueues(),this._isTileHandlerReady=!0,this.requestUpdate(),this._styeChanged=!1,this._spriteSourceChanged=!1}_createVectorTile(e){const t=this._tileInfoView.getTileBounds(d(),e),i=this._tileInfoView.getTileResolution(e.level);return new C(e,i,t[0],t[3],512,512,this._styleRepository)}async _queryTile(e,t,i,s,r,a){if(0===r.layerData.size)return;const l=this._ensureTileIndex(r),[n,o,h,y]=this._tileInfoView.getTileBounds(d(),r.key,!0),u=f*((t.x-n)/(h-n)),c=f*(1-(t.y-o)/(y-o)),p=this.view.featuresTilingScheme.tileInfo.scaleToZoom(this.view.state.scale)-r.key.level,m=p>0?2**p:1,T=i/m*(f/g),C=await l.queryAttributes(u,c,T,s,a,m);for(const d of C)d.graphic.geometry=this._tileToMapPoint(d.tilePoint,r.transforms.tileUnitsToPixels),e.push({type:"graphic",layer:this.layer,graphic:d.graphic,mapPoint:t.clone()});e.sort((e,t)=>(_(t.graphic.origin)?t.graphic.origin.layerIndex:0)-(_(e.graphic.origin)?e.graphic.origin.layerIndex:0))}_tileToMapPoint(e,t){if(!e)return null;const i=e[0]*t[0]+e[1]*t[3]+t[6],s=e[0]*t[1]+e[1]*t[4]+t[7],r=this.view.state,a=[0,0];return r.toMap(a,[i,s]),new c({x:a[0],y:a[1],spatialReference:r.spatialReference})}_ensureTileIndex(e){let t=e.featureIndex;return t||(t=w.create(e.key,e.layerData,this._styleRepository,this._tileHandler,this.layer),e.featureIndex=t),t}_pauseQueues(){this._fetchQueue.pause(),this._parseQueue.pause()}_resumeQueues(){this._fetchQueue.resume(),this._parseQueue.resume()}_clearQueues(){this._fetchQueue.clear(),this._parseQueue.clear()}};function D(e){if(null==e)return 0;switch(e.type){case"partial":return Object.keys(e.diff).length;case"complete":return Math.max(Object.keys(e.oldValue).length,Object.keys(e.newValue).length);case"collection":return Object.keys(e.added).length+Object.keys(e.changed).length+Object.keys(e.removed).length}}e([o()],V.prototype,"_isTileHandlerReady",void 0),V=e([h("esri.views.2d.layers.VectorTileLayerView2D")],V);const j=V;export{j as default};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{clone as t}from"../../../core/lang.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{createScreenPoint as a,isScreenRect as l,pt2px as n}from"../../../core/screenUtils.js";import{property as o,subclass as h}from"../../../core/accessorSupport/decorators.js";import{diff as y,hasDiff as u}from"../../../core/accessorSupport/diffUtils.js";import c from"../../../geometry/Point.js";import{create as d}from"../../../geometry/support/aaBoundingRect.js";import{equals as p}from"../../../geometry/support/spatialReferenceUtils.js";import{isVectorTileGraphicOrigin as _}from"../../../graphic/isVectorTileGraphicOrigin.js";import{tileSizeInTileUnits as f,tileSizeInPixels as g}from"../engine/vectorTiles/constants.js";import{TileHandler as m}from"../engine/vectorTiles/TileHandler.js";import{TileManager as T}from"../engine/vectorTiles/TileManager.js";import{VectorTile as C}from"../engine/vectorTiles/VectorTile.js";import{VectorTileContainer as v}from"../engine/vectorTiles/VectorTileContainer.js";import w from"../engine/vectorTiles/VectorTileFeatureIndex.js";import R from"../engine/vectorTiles/style/StyleRepository.js";import{LayerView2D as H}from"./LayerView2D.js";import I from"../tiling/TileInfoViewPOT.js";import Q from"../tiling/TileQueue.js";import S from"../../layers/VectorTileLayerView.js";import{TaskPriority as P}from"../../support/Scheduler.js";const b=2.5;let V=class extends(H(S)){constructor(){super(...arguments),this._styleChanges=[],this._fetchQueue=null,this._parseQueue=null,this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._styeChanged=!1,this._spriteSourceChanged=!1}get fading(){return(this._vectorTileContainer?.fading||this._tileManager?.isFading())??!1}get hasVisibleFeatures(){const e=this._vectorTileContainer.children;for(const t of e)if(t.hasFeatures())return!0;return!1}get spriteSourceChanged(){return this._spriteSourceChanged}get styleChanged(){return this._styeChanged}async hitTest(e,t){const i=this._tileHandlerPromise,s=this._vectorTileContainer?.symbolFader;if(!i||!this._isTileHandlerReady||!s)return;await i;let r=[];if(l(t)){const e=t;r=[a(e.x,e.y+e.height),a(e.x+e.width,e.y+e.height),a(e.x+e.width,e.y),a(e.x,e.y)]}else r=[t];const o=has("esri-vtl-search-tolerance")??0,h=o>0?o:b,y=this.view.state,{rotation:u,pixelRatio:c}=this.view.state,d=n(h)*c;let p=null;const _=this._vectorTileContainer?.symbolRepository;_&&(p=_.querySymbols(r[0],d,s.decluttererOffset,{}));const f=this._tileManager.getIntersectingTiles(r[0].x,r[0].y,d,y,p);if(p=p?.filter(e=>this._styleRepository.getStyleLayerVisibility(e.styleLayerUID)),(!f||0===f.length)&&0===p?.length)return null;e=e.clone().normalize();const g=[],m=[];for(const a of f)g.push(this._queryTile(m,e,d,u,a,p?.filter(e=>e.tileKey.id===a.id)));return await Promise.all(g),m}update(e){if(this._tileHandlerPromise&&this._isTileHandlerReady)return e.pixelRatio!==this._tileHandler.devicePixelRatio?(this._tileHandler.devicePixelRatio=e.pixelRatio,void this._loadStyle()):void(this._styleChanges.length>0?this._tileHandlerPromise=this._applyStyleChanges():(this._pauseQueues(),this._fetchQueue.state=e.state,this._parseQueue.state=e.state,this._tileManager.update(e)||this.requestUpdate(),this._resumeQueues()))}attach(){const{style:e}=this.layer.currentStyleInfo;this._styleRepository=new R(e),this._tileInfoView=new I(this.layer.tileInfo,this.layer.fullExtent),this._vectorTileContainer=new v(this._tileInfoView),this._tileHandler=new m(this.layer,this._styleRepository,window.devicePixelRatio||1,this.layer.tileInfo.lods.length-1,this.view.glyphMosaic()),this.container.addChild(this._vectorTileContainer),this._start(),this.addAttachHandles([this.layer.on("paint-change",e=>{if(this._styeChanged=!0,e.isDataDriven)this._styleChanges.push({type:0,data:e}),this.requestUpdate();else{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;const s=3===i.type;t.setPaintProperties(e.layer,e.paint),s&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender()}}),this.layer.on("layout-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);if(!i)return;this._styeChanged=!0;const s=y(i.layout,e.layout);if(null!=s){if(u(s,"visibility")&&1===D(s))return t.setLayoutProperties(e.layer,e.layout),3===i.type&&this._vectorTileContainer?.restartDeclutter(),void this._vectorTileContainer?.requestRender();this._styleChanges.push({type:1,data:e}),this.requestUpdate()}}),this.layer.on("style-layer-visibility-change",e=>{const t=this._styleRepository,i=t.getLayerById(e.layer);i&&(this._styeChanged=!0,t.setStyleLayerVisibility(e.layer,e.visibility),3===i.type&&this._vectorTileContainer?.restartDeclutter(),this._vectorTileContainer?.requestRender())}),this.layer.on("style-layer-change",e=>{this._styleChanges.push({type:2,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("delete-style-layer",e=>{this._styleChanges.push({type:3,data:e}),this._styeChanged=!0,this.requestUpdate()}),this.layer.on("load-style",()=>this._loadStyle()),this.layer.on("spriteSource-change",e=>{this._spriteSourceChanged=!0,this._styleChanges.push({type:4,data:e});const t=this._styleRepository.layers;for(const i of t)switch(i.type){case 3:i.getLayoutProperty("icon-image")&&this._styleChanges.push({type:1,data:{layer:i.id,layout:i.layout}});break;case 2:i.getPaintProperty("line-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}});break;case 1:i.getLayoutProperty("fill-pattern")&&this._styleChanges.push({type:0,data:{layer:i.id,paint:i.paint,isDataDriven:i.isPainterDataDriven()}})}this.requestUpdate()})])}detach(){this._stop(),this.container.removeAllChildren(),this._vectorTileContainer=s(this._vectorTileContainer),this._tileHandler=s(this._tileHandler)}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}supportsSpatialReference(e){return p(this.layer.tileInfo?.spatialReference,e)}canResume(){let e=super.canResume();const{currentStyleInfo:t}=this.layer;if(e&&t?.layerDefinition){const i=this.view.scale,{minScale:s,maxScale:r}=t.layerDefinition;t?.layerDefinition&&(s&&s<i&&(e=!1),r&&r>i&&(e=!1))}return e}isUpdating(){return this.fading||!this._isTileHandlerReady}acquireTile(e){const t=this._createVectorTile(e);return this._updatingHandles.consumePromise(this._fetchQueue.push(t.key).then(e=>this._parseQueue.push({key:t.key,data:e})).then(e=>{t.once("attach",()=>this.requestUpdate()),t.setData(e),this.requestUpdate()}).catch(e=>{r(e)||i.getLogger(this).error(e)})),t}releaseTile(e){const t=e.key.id;this._fetchQueue.abort(t),this._parseQueue.abort(t),this.requestUpdate()}async doRefresh(){if(!this.attached)return;if(this.suspended)return this._tileManager.clear(),void this.requestUpdate();this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache(),this._resumeQueues();const e=this._vectorTileContainer.children,t=[];try{for(const i of e){const e=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(e=>this._parseQueue.push({key:i.key,data:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(e)}await Promise.all(t)}catch(s){i.getLogger(this).error("error refreshing vector-tiles layer-view",s),this._resumeQueues(),this._isTileHandlerReady=!0}this._isTileHandlerReady=!0,this.requestUpdate()}_start(){if(this._stop(),this._tileManager=new T({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),!this.layer.currentStyleInfo)return;const e=new AbortController,t=this._tileHandler.start({signal:e.signal}).then(()=>{this._fetchQueue=new Q({tileInfoView:this._tileInfoView,process:(e,t)=>this._getTileData(e,t),concurrency:15,scheduler:this.scheduler,priority:P.MAPVIEW_FETCH_QUEUE}),this._parseQueue=new Q({tileInfoView:this._tileInfoView,process:(e,t)=>this._parseTileData(e,t),concurrency:8,scheduler:this.scheduler,priority:P.MAPVIEW_VECTOR_TILE_PARSING_QUEUE}),this.requestUpdate(),this._isTileHandlerReady=!0});this._tileHandler.spriteMosaic.then(e=>{this._vectorTileContainer.setStyleResources(e,this._tileHandler.glyphMosaic,this._styleRepository,this._tileInfoView),this.requestUpdate()}),this._tileHandlerAbortController=e,this._tileHandlerPromise=t}_stop(){if(!this._tileHandlerAbortController||!this._vectorTileContainer)return;const e=this._tileHandlerAbortController;e&&e.abort(),this._tileHandlerPromise=null,this._isTileHandlerReady=!1,this._fetchQueue=s(this._fetchQueue),this._parseQueue=s(this._parseQueue),this._tileManager=s(this._tileManager),this._vectorTileContainer.removeAllChildren()}async _getTileData(e,t){return this._tileHandler.fetchTileData(e,t)}async _parseTileData(e,t){return this._tileHandler.parseTileData(e,t)}async _applyStyleChanges(){this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._tileManager.clearCache();const e=this._styleChanges;try{await this._tileHandler.updateStyle(e)}catch(o){i.getLogger(this).error("error applying vector-tiles style update",o.message),this._resumeQueues(),this._isTileHandlerReady=!0}const t=this._styleRepository,s=new Set,r=new Set;for(const i of e){if(3!==i.type&&2!==i.type)continue;const e=2===i.type?i.data.layer.id:i.data.layer,a=t.getLayerById(e);a&&(s.add(a.uid),3===a.type&&r.add(a.uid))}const a=this._vectorTileContainer.children,l=this._vectorTileContainer?.symbolFader?.symbolRepository;l&&r.size>0&&l.deleteStyleLayers(Array.from(r));const n=new Set;if(e.forEach(e=>{let i;switch(e.type){case 0:t.setPaintProperties(e.data.layer,e.data.paint),i=e.data.layer;break;case 1:t.setLayoutProperties(e.data.layer,e.data.layout),i=e.data.layer;break;case 3:return void t.deleteStyleLayer(e.data.layer);case 2:t.setStyleLayer(e.data.layer,e.data.index),i=e.data.layer.id;break;case 4:this._vectorTileContainer.setSpriteMosaic(this._tileHandler.setSpriteSource(e.data.spriteSource))}if(i){const e=t.getLayerById(i);e&&n.add(e.uid)}}),s.size>0){const e=Array.from(s);this._vectorTileContainer.deleteStyleLayers(e);for(const t of a)t.deleteLayerData(e)}if(this._resumeQueues(),n.size>0){const e=Array.from(n),t=[];for(const i of a){const s=this._updatingHandles.addPromise(this._fetchQueue.push(i.key).then(t=>this._parseQueue.push({key:i.key,data:t,styleLayerUIDs:e})).then(e=>i.setData(e)).finally(()=>i.featureIndex=null));t.push(s)}await Promise.all(t)}this._styleChanges=[],this._isTileHandlerReady=!0,this.requestUpdate()}async _loadStyle(){const{style:e}=this.layer.currentStyleInfo,i=t(e);this._isTileHandlerReady=!1,this._pauseQueues(),this._clearQueues(),this._styleRepository=new R(i),this._vectorTileContainer.destroy(),this._tileManager.clear(),this._tileHandlerAbortController.abort(),this._tileHandlerAbortController=new AbortController;const{signal:s}=this._tileHandlerAbortController;try{this._tileHandlerPromise=this._tileHandler.setStyle(this._styleRepository,i,this.layer.tileInfo.lods.length-1),await this._tileHandlerPromise}catch(n){if(!r(n))throw n}if(s.aborted)return this._resumeQueues(),this._isTileHandlerReady=!0,this._styeChanged=!1,this._spriteSourceChanged=!1,void this.requestUpdate();const a=await this._tileHandler.spriteMosaic,l=this._vectorTileContainer;this._tileInfoView=new I(this.layer.tileInfo,this.layer.fullExtent),l.setStyleResources(a,this.view.glyphMosaic(),this._styleRepository,this._tileInfoView),this._tileManager=new T({acquireTile:e=>this.acquireTile(e),releaseTile:e=>this.releaseTile(e),tileInfoView:this._tileInfoView},this._vectorTileContainer),this._resumeQueues(),this._isTileHandlerReady=!0,this.requestUpdate(),this._styeChanged=!1,this._spriteSourceChanged=!1}_createVectorTile(e){const t=this._tileInfoView.getTileBounds(d(),e),i=this._tileInfoView.getTileResolution(e.level);return new C(e,i,t[0],t[3],512,512,this._styleRepository)}async _queryTile(e,t,i,s,r,a){if(0===r.layerData.size)return;const l=this._ensureTileIndex(r),[n,o,h,y]=this._tileInfoView.getTileBounds(d(),r.key,!0),u=f*((t.x-n)/(h-n)),c=f*(1-(t.y-o)/(y-o)),p=this.view.featuresTilingScheme.tileInfo.scaleToZoom(this.view.state.scale)-r.key.level,m=p>0?2**p:1,T=i/m*(f/g),C=await l.queryAttributes(u,c,T,s,a,m);for(const d of C)d.graphic.geometry=this._tileToMapPoint(d.tilePoint,r.transforms.tileUnitsToPixels),e.push({type:"graphic",layer:this.layer,graphic:d.graphic,mapPoint:t.clone()});e.sort((e,t)=>(_(t.graphic.origin)?t.graphic.origin.layerIndex:0)-(_(e.graphic.origin)?e.graphic.origin.layerIndex:0))}_tileToMapPoint(e,t){if(!e)return null;const i=e[0]*t[0]+e[1]*t[3]+t[6],s=e[0]*t[1]+e[1]*t[4]+t[7],r=this.view.state,a=[0,0];return r.toMap(a,[i,s]),new c({x:a[0],y:a[1],spatialReference:r.spatialReference})}_ensureTileIndex(e){let t=e.featureIndex;return t||(t=w.create(e.key,e.layerData,this._styleRepository,this._tileHandler,this.layer),e.featureIndex=t),t}_pauseQueues(){this._fetchQueue.pause(),this._parseQueue.pause()}_resumeQueues(){this._fetchQueue.resume(),this._parseQueue.resume()}_clearQueues(){this._fetchQueue.clear(),this._parseQueue.clear()}};function D(e){if(null==e)return 0;switch(e.type){case"partial":return Object.keys(e.diff).length;case"complete":return Math.max(Object.keys(e.oldValue).length,Object.keys(e.newValue).length);case"collection":return Object.keys(e.added).length+Object.keys(e.changed).length+Object.keys(e.removed).length}}e([o()],V.prototype,"_isTileHandlerReady",void 0),V=e([h("esri.views.2d.layers.VectorTileLayerView2D")],V);const j=V;export{j as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../../core/has.js";import{notDeepEqual as t}from"../../../../../../core/object.js";import{throwIfAborted as e}from"../../../../../../core/promiseUtils.js";import{difference as s}from"../../../../../../core/SetUtils.js";import{openWithPorts as a}from"../../../../../../core/workers/workers.js";import{loadParquetModule as i}from"../../../../../../libs/parquet/loadParquetModule.js";import{ALoadStrategy as r}from"./ALoadStrategy.js";import{ParquetSnapshotSourceChunk as o}from"./chunks/ParquetSnapshotSourceChunk.js";import{FeatureSetReaderParquet as l}from"../../support/FeatureSetReaderParquet.js";class n extends r{constructor(t,e,s,a){super(t.metadata,e,s),this._service=t,this._loaded=this._load(a)}destroy(){super.destroy(),this._loaded.finally(()=>{this._client.close(),this._client=null;for(const t of this._ports)t.close()}).catch(()=>{})}get about(){return{willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}get availableFields(){return this._schema.partial.availableFields}get definitionExpression(){return this._schema.full.definitionExpression}async tryUpdate(e,s){await this._loaded;let a=!0;return t(this.availableFields,s.availableFields)&&await this._updateFields(s.availableFields),this._schema.partial.dataSourceHash!==s.dataSourceHash&&(a=!1),this._schema.partial=s,a}async load(t){return this._loaded}unload(t){}_onOverride(){}async _load(t){this._ports=await t.layerView.openMemoryPorts(),this._client=await a(this._ports,{maxNumberOfConcurrentJobs:20}),this._proxy=this._client.createInvokeProxy(),this._indexMap=await this._proxy.getIndexMap(),await this._download()}async _updateFields(t){const e=new Set(t),a=s(e,new Set(this.availableFields));if(null!=this._service.metadata.fieldsIndex&&a.size){const t=Array.from(this.store.insertedChunks()).map(t=>t.updateFields(this._proxy,Array.from(a),this._options));await Promise.all(t)}}async _downloadFiles(){const t=await i();e(this._options);const s=await this._proxy.queryStream({type:"snapshot",outFields:Array.from(this.availableFields),returnGeometry:!0,returnZ:this._schema.full.returnZ,returnM:this._schema.full.returnM,outSpatialReference:this.metadata.outSpatialReference.toJSON(),where:this.definitionExpression},this._options);let a=0;for(;;){const i=await this._proxy.getStreamNext(s,this._options);if(e(this._options),null==i)break;const{fileId:r,buffer:n}=i,h=t.ParquetChunk.deserialize(new Uint8Array(n)),d=new l(this.metadata,this._indexMap,h,r),u=new o(this.metadata,d,a++,!1,r);this.store.insert(u)}}async _download(){try{await this._downloadFiles();const t=new o(this.metadata,null,-1,!0,null);this.store.insert(t)}catch(t){throw console.error(t),t}}}export{n as ParquetSnapshotLoadStrategy};
2
+ import"../../../../../../core/has.js";import{notDeepEqual as t}from"../../../../../../core/object.js";import{throwIfAborted as e}from"../../../../../../core/promiseUtils.js";import{difference as s}from"../../../../../../core/SetUtils.js";import{openWithPorts as a}from"../../../../../../core/workers/workers.js";import{loadParquetModule as i}from"../../../../../../libs/librust-parquet/loadParquetModule.js";import{ALoadStrategy as r}from"./ALoadStrategy.js";import{ParquetSnapshotSourceChunk as o}from"./chunks/ParquetSnapshotSourceChunk.js";import{FeatureSetReaderParquet as l}from"../../support/FeatureSetReaderParquet.js";class n extends r{constructor(t,e,s,a){super(t.metadata,e,s),this._service=t,this._loaded=this._load(a)}destroy(){super.destroy(),this._loaded.finally(()=>{this._client.close(),this._client=null;for(const t of this._ports)t.close()}).catch(()=>{})}get about(){return{willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}get availableFields(){return this._schema.partial.availableFields}get definitionExpression(){return this._schema.full.definitionExpression}async tryUpdate(e,s){await this._loaded;let a=!0;return t(this.availableFields,s.availableFields)&&await this._updateFields(s.availableFields),this._schema.partial.dataSourceHash!==s.dataSourceHash&&(a=!1),this._schema.partial=s,a}async load(t){return this._loaded}unload(t){}_onOverride(){}async _load(t){this._ports=await t.layerView.openMemoryPorts(),this._client=await a(this._ports,{maxNumberOfConcurrentJobs:20}),this._proxy=this._client.createInvokeProxy(),this._indexMap=await this._proxy.getIndexMap(),await this._download()}async _updateFields(t){const e=new Set(t),a=s(e,new Set(this.availableFields));if(null!=this._service.metadata.fieldsIndex&&a.size){const t=Array.from(this.store.insertedChunks()).map(t=>t.updateFields(this._proxy,Array.from(a),this._options));await Promise.all(t)}}async _downloadFiles(){const t=await i();e(this._options);const s=await this._proxy.queryStream({type:"snapshot",outFields:Array.from(this.availableFields),returnGeometry:!0,returnZ:this._schema.full.returnZ,returnM:this._schema.full.returnM,outSpatialReference:this.metadata.outSpatialReference.toJSON(),where:this.definitionExpression},this._options);let a=0;for(;;){const i=await this._proxy.getStreamNext(s,this._options);if(e(this._options),null==i)break;const{fileId:r,buffer:n}=i,h=t.ParquetChunk.deserialize(new Uint8Array(n)),d=new l(this.metadata,this._indexMap,h,r),u=new o(this.metadata,d,a++,!1,r);this.store.insert(u)}}async _download(){try{await this._downloadFiles();const t=new o(this.metadata,null,-1,!0,null);this.store.insert(t)}catch(t){throw console.error(t),t}}}export{n as ParquetSnapshotLoadStrategy};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{handlesGroup as t}from"../../../../../../core/handleUtils.js";import"../../../../../../core/has.js";import{getOrCreateMapValue as e}from"../../../../../../core/MapUtils.js";import{notDeepEqual as r}from"../../../../../../core/object.js";import{throwIfAborted as s,onAbort as i}from"../../../../../../core/promiseUtils.js";import{QueueProcessor as a}from"../../../../../../core/QueueProcessor.js";import{difference as o}from"../../../../../../core/SetUtils.js";import{openWithPorts as l}from"../../../../../../core/workers/workers.js";import{isFileProviderChangedError as n}from"../../../../../../layers/graphics/sources/parquet/fileProviderChangedError.js";import{loadParquetModule as d}from"../../../../../../libs/parquet/loadParquetModule.js";import{ALoadStrategy as h}from"./ALoadStrategy.js";import{fetchQueueConcurrency as u}from"./constants.js";import{ParquetSourceChunk as c}from"./chunks/ParquetSourceChunk.js";import{FeatureSetReaderParquet as p}from"../../support/FeatureSetReaderParquet.js";class m{constructor(e,r){this.subscription=e,this.chunks=[],this.ids=[],this._controller=new AbortController,this._handles=t([i(e.signal,()=>this._controller.abort()),i(r,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get options(){return{signal:this._controller.signal}}addBinaryData(t){this.chunks.push(t)}addSourceChunkId(t){this.ids.push(t)}}class _ extends h{constructor(t,e,r,s){if(super(t.metadata,e,r),this._service=t,this._loadStates=new Map,this._queue=new a({concurrency:u,process:t=>this._loadTile(t)}),!t.geometryInfo.displayOptimization)throw new Error("InternalError: ParquetTileLoadStrategy only supports XZ-enabled parquet files");this._loaded=this._load(s)}destroy(){super.destroy(),this._loaded.finally(()=>{this._client.close(),this._client=null;for(const t of this._ports)t.close()}).catch(()=>{})}get about(){return{willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}get availableFields(){return this._schema.partial.availableFields}get definitionExpression(){return this._schema.full.definitionExpression}async tryUpdate(t,e){await this._loaded;let s=!0;return r(this.availableFields,e.availableFields)&&await this._updateFields(e.availableFields),this._schema.partial.dataSourceHash!==e.dataSourceHash&&(s=!1),this._schema.partial=e,s}async load(t){try{return await this._loaded,e(this._loadStates,t.key.id,()=>new m(t,this._options)),await this._queue.push(t)}catch(r){if(!f(r))throw r}}unload(t){const e=this._loadStates.get(t.tile.id);if(null!=e){for(const t of e.ids)this.store.removeById(t);e.destroy(),this._loadStates.delete(t.tile.id)}}async _load(t){this._ports=await t.layerView.openMemoryPorts(),this._client=await l(this._ports,{maxNumberOfConcurrentJobs:20}),this._proxy=this._client.createInvokeProxy(),this._indexMap=await this._proxy.getIndexMap()}_onOverride(){}async _updateFields(t){const e=new Set(t),r=o(e,new Set(this.availableFields));if(null!=this._service.metadata.fieldsIndex&&r.size){const t=Array.from(this.store.insertedChunks()).map(t=>t.updateFields(this._proxy,Array.from(r),this._options));await Promise.all(t)}}async _loadTile(t){const e=t.tile,r=t.signal,i=this._loadStates.get(e.id);await this._downloadTileData(t),s(r);const a=new c(this.metadata,null,e,null,0,!0);i.addSourceChunkId(a.chunkId),this.store.insert(a)}async _downloadTileData(t){const e=await d(),r=t.tile,i=t.signal,a=this._loadStates.get(r.id),o=await this._proxy.queryStream({type:"tile",extent:r.extent,transform:r.normalizedTransform,outFields:Array.from(this.availableFields),returnGeometry:!0,returnZ:this._schema.full.returnZ,returnM:this._schema.full.returnM,outSpatialReference:this.metadata.outSpatialReference.toJSON(),resolution:r.resolution,where:this.definitionExpression},{signal:i});let l=0;for(;;){const t=await this._proxy.getStreamNext(o,{signal:i});if(s(i),null==t)break;const{fileId:n,buffer:d}=t,h=e.ParquetChunk.deserialize(new Uint8Array(d)),u=new p(this.metadata,this._indexMap,h,n,r.transform),m=new c(this.metadata,u,r,n,l++,!1);a.addBinaryData({data:h,fileId:n}),a.addSourceChunkId(m.chunkId),this.store.insert(m)}}}function f(t){return n(t)||y(t)}function y(t){return null!=t&&"object"==typeof t&&"message"in t&&"Protocol Violation: transport error"===t.message}export{_ as ParquetTileLoadStrategy};
2
+ import{handlesGroup as t}from"../../../../../../core/handleUtils.js";import"../../../../../../core/has.js";import{getOrCreateMapValue as e}from"../../../../../../core/MapUtils.js";import{notDeepEqual as r}from"../../../../../../core/object.js";import{throwIfAborted as s,onAbort as i}from"../../../../../../core/promiseUtils.js";import{QueueProcessor as a}from"../../../../../../core/QueueProcessor.js";import{difference as o}from"../../../../../../core/SetUtils.js";import{openWithPorts as l}from"../../../../../../core/workers/workers.js";import{isFileProviderChangedError as n}from"../../../../../../layers/graphics/sources/parquet/fileProviderChangedError.js";import{loadParquetModule as d}from"../../../../../../libs/librust-parquet/loadParquetModule.js";import{ALoadStrategy as h}from"./ALoadStrategy.js";import{fetchQueueConcurrency as u}from"./constants.js";import{ParquetSourceChunk as c}from"./chunks/ParquetSourceChunk.js";import{FeatureSetReaderParquet as p}from"../../support/FeatureSetReaderParquet.js";class m{constructor(e,r){this.subscription=e,this.chunks=[],this.ids=[],this._controller=new AbortController,this._handles=t([i(e.signal,()=>this._controller.abort()),i(r,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get options(){return{signal:this._controller.signal}}addBinaryData(t){this.chunks.push(t)}addSourceChunkId(t){this.ids.push(t)}}class _ extends h{constructor(t,e,r,s){if(super(t.metadata,e,r),this._service=t,this._loadStates=new Map,this._queue=new a({concurrency:u,process:t=>this._loadTile(t)}),!t.geometryInfo.displayOptimization)throw new Error("InternalError: ParquetTileLoadStrategy only supports XZ-enabled parquet files");this._loaded=this._load(s)}destroy(){super.destroy(),this._loaded.finally(()=>{this._client.close(),this._client=null;for(const t of this._ports)t.close()}).catch(()=>{})}get about(){return{willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}get availableFields(){return this._schema.partial.availableFields}get definitionExpression(){return this._schema.full.definitionExpression}async tryUpdate(t,e){await this._loaded;let s=!0;return r(this.availableFields,e.availableFields)&&await this._updateFields(e.availableFields),this._schema.partial.dataSourceHash!==e.dataSourceHash&&(s=!1),this._schema.partial=e,s}async load(t){try{return await this._loaded,e(this._loadStates,t.key.id,()=>new m(t,this._options)),await this._queue.push(t)}catch(r){if(!f(r))throw r}}unload(t){const e=this._loadStates.get(t.tile.id);if(null!=e){for(const t of e.ids)this.store.removeById(t);e.destroy(),this._loadStates.delete(t.tile.id)}}async _load(t){this._ports=await t.layerView.openMemoryPorts(),this._client=await l(this._ports,{maxNumberOfConcurrentJobs:20}),this._proxy=this._client.createInvokeProxy(),this._indexMap=await this._proxy.getIndexMap()}_onOverride(){}async _updateFields(t){const e=new Set(t),r=o(e,new Set(this.availableFields));if(null!=this._service.metadata.fieldsIndex&&r.size){const t=Array.from(this.store.insertedChunks()).map(t=>t.updateFields(this._proxy,Array.from(r),this._options));await Promise.all(t)}}async _loadTile(t){const e=t.tile,r=t.signal,i=this._loadStates.get(e.id);await this._downloadTileData(t),s(r);const a=new c(this.metadata,null,e,null,0,!0);i.addSourceChunkId(a.chunkId),this.store.insert(a)}async _downloadTileData(t){const e=await d(),r=t.tile,i=t.signal,a=this._loadStates.get(r.id),o=await this._proxy.queryStream({type:"tile",extent:r.extent,transform:r.normalizedTransform,outFields:Array.from(this.availableFields),returnGeometry:!0,returnZ:this._schema.full.returnZ,returnM:this._schema.full.returnM,outSpatialReference:this.metadata.outSpatialReference.toJSON(),resolution:r.resolution,where:this.definitionExpression},{signal:i});let l=0;for(;;){const t=await this._proxy.getStreamNext(o,{signal:i});if(s(i),null==t)break;const{fileId:n,buffer:d}=t,h=e.ParquetChunk.deserialize(new Uint8Array(d)),u=new p(this.metadata,this._indexMap,h,n,r.transform),m=new c(this.metadata,u,r,n,l++,!1);a.addBinaryData({data:h,fileId:n}),a.addSourceChunkId(m.chunkId),this.store.insert(m)}}}function f(t){return n(t)||y(t)}function y(t){return null!=t&&"object"==typeof t&&"message"in t&&"Protocol Violation: transport error"===t.message}export{_ as ParquetTileLoadStrategy};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"../../../../../core/has.js";import{baseObjectMemory as t}from"../../../../../core/memoryEstimations.js";import{minInt16 as e}from"../../../../../core/typedArrayUtil.js";import{fromRectValues as r}from"../../../../../geometry/support/aaBoundingBox.js";import i from"../../../../../layers/graphics/OptimizedGeometry.js";import{getParquetObjectId as s}from"../../../../../layers/graphics/sources/support/parquetIdUtils.js";import{readParquetChunkAttribute as n}from"../../../../../libs/parquet/parquet.js";import{FeatureSetReader as o}from"./FeatureSetReader.js";class d extends o{constructor(r,i,s,n,o,d=new Uint32Array(s.size()),h,a,u){if(super(r),this._indexMap=i,this._inner=s,this._fileId=n,this._transform=o,this._displayIds=d,this._points=h,this._rowIds=a,this._emptyNumberValue=u,this._index=-1,this.usedMemory=t,this._size=this._inner.size(),this._coordinateStride=this._inner.coordinateStride(),this._rowIds||(this._rowIds=this._inner.readIdsUnsafe().slice()),!this._points&&"esriGeometryPoint"===this.geometryType){const t=this._inner.readPointCoordsQuantizedUnsafe()?.slice();t?(this._emptyNumberValue=e,this._points=t):(this._emptyNumberValue=NaN,this._points=this._inner.readPointCoordsUnsafe()?.slice())}r.featureIdInfo.type}destroy(){super.destroy(),this._inner.free()}get fields(){return this.metadata.fieldsIndex}get geometryType(){return this.metadata.geometryType}get hasFeatures(){return!0}get hasNext(){throw new Error("Method not implemented.")}get exceededTransferLimit(){return!1}get hasZ(){return this._inner.hasZ()}get hasM(){return this._inner.hasM()}async updateFields(t,e,r,i){const s=this._inner.rowGroup(),n=new Uint32Array(this._inner.readIdsUnsafe()),o=await t.createPatch(e,s,n,r,i);this._inner.insertPatchBytes(new Uint8Array(o))}getInTransform(){return this._transform}getSize(){return this._size}getCursor(){return this.copy()}getAttributeHash(){let t="";for(const e of this.fields.fields)t+=this._readAttribute(e.name,!1)+".";return t}getObjectId(){const t=this._rowIds[this._index];return s(this._fileId,t)}getDisplayId(){return this._displayIds[this._index]}setDisplayId(t){this._displayIds[this._index]=t}setIndex(t){this._index=t}getBoundsXMin(){return this._inner.boundsXMin(this._index)}getBoundsYMin(){return this._inner.boundsYMin(this._index)}getBoundsXMax(){return this._inner.boundsXMax(this._index)}getBoundsYMax(){return this._inner.boundsYMax(this._index)}getBounds(t){const e=this._inner.boundsXMin(this._index);return!!Number.isFinite(e)&&(r(t,e,this._inner.boundsYMin(this._index),this._inner.boundsXMax(this._index),this._inner.boundsYMax(this._index)),!0)}setBoundsXMin(t){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMin(t){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsXMax(t){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMax(t){throw new Error("InternalError: Setting bounds is unsupported")}getIndex(){return this._index}next(){for(;++this._index<this._size&&!this._getExists(););return this._index<this._size}readGeometryArea(){return this.readGeometryForDisplay()?.area()??0}copy(){const t=new d(this.metadata,this._indexMap,this._inner,this._fileId,this._transform,this._displayIds,this._points,this._rowIds,this._emptyNumberValue);return this.copyInto(t),t}copyInto(t){super.copyInto(t),t._index=this._index}_readGeometry(t){const e=this._inner.readCoordsUnsafe(this._index),r=this._inner.readLengthsUnsafe(this._index);return e&&r?new i(r,e,this.hasZ,this.hasM):null}_readX(){if(this._points){const t=this._points[this._coordinateStride*this._index];return t===this._emptyNumberValue?NaN:t}throw new Error("InternalError: readX only supported for points")}_readY(){if(this._points){const t=this._points[this._coordinateStride*this._index+1];return t===this._emptyNumberValue?NaN:t}throw new Error("InternalError: readY only supported for points")}_readServerCentroid(){return null}_readAttribute(t,e){const r=this.fields.get(t);if(!r)return;const i=this._indexMap[r.name];return null==i?this.getObjectId():n(this._inner,this._index,i,r.type,e)}_readAttributes(){const t={};for(const e of this.metadata.fieldsIndex.fields){if(null==this._indexMap[e.name])continue;const r=this._readAttribute(e.name,!1);void 0!==r&&(t[e.name]=r)}return t.__OBJECTID=this.getObjectId(),t}}export{d as FeatureSetReaderParquet};
2
+ import"../../../../../core/has.js";import{baseObjectMemory as t}from"../../../../../core/memoryEstimations.js";import{minInt16 as e}from"../../../../../core/typedArrayUtil.js";import{fromRectValues as r}from"../../../../../geometry/support/aaBoundingBox.js";import{readParquetChunkAttribute as s}from"../../../../../layers/parquet.js";import i from"../../../../../layers/graphics/OptimizedGeometry.js";import{getParquetObjectId as n}from"../../../../../layers/graphics/sources/support/parquetIdUtils.js";import{FeatureSetReader as o}from"./FeatureSetReader.js";class d extends o{constructor(r,s,i,n,o,d=new Uint32Array(i.size()),h,a,u){if(super(r),this._indexMap=s,this._inner=i,this._fileId=n,this._transform=o,this._displayIds=d,this._points=h,this._rowIds=a,this._emptyNumberValue=u,this._index=-1,this.usedMemory=t,this._size=this._inner.size(),this._coordinateStride=this._inner.coordinateStride(),this._rowIds||(this._rowIds=this._inner.readIdsUnsafe().slice()),!this._points&&"esriGeometryPoint"===this.geometryType){const t=this._inner.readPointCoordsQuantizedUnsafe()?.slice();t?(this._emptyNumberValue=e,this._points=t):(this._emptyNumberValue=NaN,this._points=this._inner.readPointCoordsUnsafe()?.slice())}r.featureIdInfo.type}destroy(){super.destroy(),this._inner.free()}get fields(){return this.metadata.fieldsIndex}get geometryType(){return this.metadata.geometryType}get hasFeatures(){return!0}get hasNext(){throw new Error("Method not implemented.")}get exceededTransferLimit(){return!1}get hasZ(){return this._inner.hasZ()}get hasM(){return this._inner.hasM()}async updateFields(t,e,r,s){const i=this._inner.rowGroup(),n=new Uint32Array(this._inner.readIdsUnsafe()),o=await t.createPatch(e,i,n,r,s);this._inner.insertPatchBytes(new Uint8Array(o))}getInTransform(){return this._transform}getSize(){return this._size}getCursor(){return this.copy()}getAttributeHash(){let t="";for(const e of this.fields.fields)t+=this._readAttribute(e.name,!1)+".";return t}getObjectId(){const t=this._rowIds[this._index];return n(this._fileId,t)}getDisplayId(){return this._displayIds[this._index]}setDisplayId(t){this._displayIds[this._index]=t}setIndex(t){this._index=t}getBoundsXMin(){return this._inner.boundsXMin(this._index)}getBoundsYMin(){return this._inner.boundsYMin(this._index)}getBoundsXMax(){return this._inner.boundsXMax(this._index)}getBoundsYMax(){return this._inner.boundsYMax(this._index)}getBounds(t){const e=this._inner.boundsXMin(this._index);return!!Number.isFinite(e)&&(r(t,e,this._inner.boundsYMin(this._index),this._inner.boundsXMax(this._index),this._inner.boundsYMax(this._index)),!0)}setBoundsXMin(t){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMin(t){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsXMax(t){throw new Error("InternalError: Setting bounds is unsupported")}setBoundsYMax(t){throw new Error("InternalError: Setting bounds is unsupported")}getIndex(){return this._index}next(){for(;++this._index<this._size&&!this._getExists(););return this._index<this._size}readGeometryArea(){return this.readGeometryForDisplay()?.area()??0}copy(){const t=new d(this.metadata,this._indexMap,this._inner,this._fileId,this._transform,this._displayIds,this._points,this._rowIds,this._emptyNumberValue);return this.copyInto(t),t}copyInto(t){super.copyInto(t),t._index=this._index}_readGeometry(t){const e=this._inner.readCoordsUnsafe(this._index),r=this._inner.readLengthsUnsafe(this._index);return e&&r?new i(r,e,this.hasZ,this.hasM):null}_readX(){if(this._points){const t=this._points[this._coordinateStride*this._index];return t===this._emptyNumberValue?NaN:t}throw new Error("InternalError: readX only supported for points")}_readY(){if(this._points){const t=this._points[this._coordinateStride*this._index+1];return t===this._emptyNumberValue?NaN:t}throw new Error("InternalError: readY only supported for points")}_readServerCentroid(){return null}_readAttribute(t,e){const r=this.fields.get(t);if(!r)return;const i=this._indexMap[r.name];return null==i?this.getObjectId():s(this._inner,this._index,i,r.type,e)}_readAttributes(){const t={};for(const e of this.metadata.fieldsIndex.fields){if(null==this._indexMap[e.name])continue;const r=this._readAttribute(e.name,!1);void 0!==r&&(t[e.name]=r)}return t.__OBJECTID=this.getObjectId(),t}}export{d as FeatureSetReaderParquet};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import has from"../../../core/has.js";import{disposeMaybe as i,abortMaybe as l,destroyMaybe as r}from"../../../core/maybe.js";import{isAborted as s}from"../../../core/promiseUtils.js";import{whenOnce as a,watch as n,initial as o}from"../../../core/reactiveUtils.js";import{property as h,subclass as c}from"../../../core/accessorSupport/decorators.js";import{SchemaHelper as d}from"../../2d/engine/vectorTiles/SchemaHelper.js";import m from"../../2d/engine/vectorTiles/TileHandler3D.js";import p from"../../2d/engine/vectorTiles/VTLPainter3D.js";import y from"../../2d/engine/vectorTiles/style/StyleRepository.js";import{LayerView3D as g}from"./LayerView3D.js";import{TiledLayerView3D as f}from"./TiledLayerView3D.js";import{vtlAssumes256PixelSizeAsDefault as u,test as v}from"../terrain/terrainUtils.js";import S from"../../layers/VectorTileLayerView.js";let _=class extends(f(g(S))){constructor(){super(...arguments),this._tileHandlerController=null,this.type="vector-tile-3d",this.levelShift=has("disable-feature:vtl-level-shift")?0:1}initialize(){if(null==this.layer.fullExtent)return void this.addResolvingPromise(Promise.reject(new t("vectortilelayerview:full-extent-undefined","This layer view's layer does not define a fullExtent.")));const{basemapTerrain:e,groundView:i,spatialReference:l,state:r,viewingMode:h}=this.view,c="local"===h&&!u(l)||v.force512VTL?this.layer.tileInfo:this.layer.tileInfo.getCompatibleForVTL(256),g=this._getTileInfoSupportError(c,this.layer.fullExtent);if(null!=g)return this.addResolvingPromise(Promise.reject(g));const f=a(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{const t=e.tilingScheme,l=t.pixelSize,r=256===l?1:2,s=i.spatialReference?.isGeographic&&256===l?1:0,a=i.spatialReference?.isGeographic||256!==l?0:1;let n;this.schemaHelper=new d(r,s,this.levelShift+a),n=256===l||512===l?this.layer.tileInfo.getCompatibleForVTL(l):this.layer.tileInfo;const o=this._getTileInfoCompatibilityError(n,t);if(o)throw o;this.tileInfo=n});this._tileHandlerController=new AbortController;const S=this.view.resourceController;this._memCache=S.memoryController.newCache(`vtl-${this.layer.uid}`,e=>e.release()),this.addHandles(n(()=>this.view.qualitySettings.memoryLimit,e=>this._memCache.maxSize=Math.ceil(e/10*1048576),o));const _=new y(this.layer.currentStyleInfo.style),w=this.view.glyphMosaic;this._tileHandler=new m(this.layer,_,r.contentPixelRatio,w,this._memCache);const C=this._tileHandlerController.signal,R=H(S),L=this._tileHandler.start({signal:C,schedule:R}),x=this._tileHandler.spriteMosaic;x.then(e=>{!s(C)&&this._tileHandler&&(this.painter=new p(e,this._tileHandler.glyphMosaic))}),L.then(()=>this._tileHandlerController=null);const T=()=>{this._tileHandlerController&&this._tileHandlerController.abort(),this._tileHandlerController=new AbortController,this._memCache.clear();const e=this.layer.currentStyleInfo.style,t=this.view.state?.contentPixelRatio??1,i=new y(e),l=new m(this.layer,i,t,w,this._memCache),r=l.start({signal:this._tileHandlerController.signal,schedule:R}),s=l.spriteMosaic;r.then(()=>this._tileHandlerController=null),this._updatingHandles.consumePromise(Promise.all([r,s]).then(([,e])=>{const t=this._tileHandler,i=this.painter;this.painter=new p(e,l.glyphMosaic),this._tileHandler=l,this.emit("data-changed"),t.destroy(),i&&i.dispose()}))};this._updatingHandles.add(()=>({style:this.layer.currentStyleInfo.style,pixelRatio:this.view.state?.contentPixelRatio}),T),this.addHandles([this.layer.on("paint-change",()=>this.emit("data-changed")),this.layer.on("style-layer-change",T),this.layer.on("delete-style-layer",T),this.layer.on("spriteSource-change",()=>this.emit("data-changed")),this.layer.on("layout-change",()=>this.emit("data-changed")),this.layer.on("style-layer-visibility-change",()=>this.emit("data-changed"))]);const j=Promise.all([f,L,x]);this.addResolvingPromise(j)}destroy(){this.painter=i(this.painter),this._tileHandlerController=l(this._tileHandlerController),this._tileHandler=r(this._tileHandler),this._memCache=r(this._memCache)}get contentZoom(){return has("disable-feature:vtl-level-shift")?1:this.view.qualitySettings.tiledSurface.vtlContentZoom}get displayLevelRange(){const e=this.tileInfo.lods,t=this.layer.minScale||e[0].scale,i=this.layer.maxScale||e[e.length-1].scale,l=this.levelRangeFromScaleRange(t,i);return this.layer.maxScale?l.maxLevel++:l.maxLevel+=this.levelShift,l}get dataScaleRange(){const e=this.tileInfo.lods;return{minScale:e[0].scale,maxScale:e[e.length-1].scale}}get dataLevelRange(){const{minScale:e,maxScale:t}=this.dataScaleRange,i=this.levelRangeFromScaleRange(e,t);return 1===i.minLevel&&256===this.tileInfo.size[0]&&(i.minLevel=0),i.maxLevel+=this.levelShift,i}async fetchTile(e,t){const i=this.schemaHelper.getLevelRowColumn(e);return this._tileHandler.getVectorTile(i,t)}get hasVisibleFeatures(){return!0}async doRefresh(){this.suspended||this.emit("data-changed")}};e([h()],_.prototype,"levelShift",void 0),e([h()],_.prototype,"contentZoom",null),e([h()],_.prototype,"displayLevelRange",null),e([h()],_.prototype,"tileInfo",void 0),e([h()],_.prototype,"dataScaleRange",null),e([h()],_.prototype,"dataLevelRange",null),e([h()],_.prototype,"updatingProgressValue",void 0),_=e([c("esri.views.3d.layers.VectorTileLayerView3D")],_);const w=_;function H(e){return t=>e.immediate.schedule(t)}export{w as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Error.js";import has from"../../../core/has.js";import{disposeMaybe as i,abortMaybe as l,destroyMaybe as r}from"../../../core/maybe.js";import{isAborted as s}from"../../../core/promiseUtils.js";import{whenOnce as a,watch as n,initial as o}from"../../../core/reactiveUtils.js";import{property as h,subclass as c}from"../../../core/accessorSupport/decorators.js";import{SchemaHelper as d}from"../../2d/engine/vectorTiles/SchemaHelper.js";import m from"../../2d/engine/vectorTiles/TileHandler3D.js";import p from"../../2d/engine/vectorTiles/VTLPainter3D.js";import y from"../../2d/engine/vectorTiles/style/StyleRepository.js";import{LayerView3D as g}from"./LayerView3D.js";import{TiledLayerView3D as f}from"./TiledLayerView3D.js";import{vtlAssumes256PixelSizeAsDefault as u,test as v}from"../terrain/terrainUtils.js";import S from"../../layers/VectorTileLayerView.js";let _=class extends(f(g(S))){constructor(){super(...arguments),this._tileHandlerController=null,this.type="vector-tile-3d",this.levelShift=has("disable-feature:vtl-level-shift")?0:1}initialize(){if(null==this.layer.fullExtent)return void this.addResolvingPromise(Promise.reject(new t("vectortilelayerview:full-extent-undefined","This layer view's layer does not define a fullExtent.")));const{basemapTerrain:e,groundView:i,spatialReference:l,state:r,viewingMode:h}=this.view,c="local"===h&&!u(l)||v.force512VTL?this.layer.tileInfo:this.layer.tileInfo.getCompatibleForVTL(256),g=this._getTileInfoSupportError(c,this.layer.fullExtent);if(null!=g)return this.addResolvingPromise(Promise.reject(g));const f=a(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{const t=e.tilingScheme,l=t.pixelSize,r=256===l?1:2,s=i.spatialReference?.isGeographic&&256===l?1:0,a=i.spatialReference?.isGeographic||256!==l?0:1;let n;this.schemaHelper=new d(r,s,this.levelShift+a),n=256===l||512===l?this.layer.tileInfo.getCompatibleForVTL(l):this.layer.tileInfo;const o=this._getTileInfoCompatibilityError(n,t);if(o)throw o;this.tileInfo=n});this._tileHandlerController=new AbortController;const S=this.view.resourceController;this._memCache=S.memoryController.newCache(`vtl-${this.layer.uid}`,e=>e.release()),this.addHandles(n(()=>this.view.qualitySettings.memoryLimit,e=>this._memCache.maxSize=Math.ceil(e/10*1048576),o));const _=new y(this.layer.currentStyleInfo.style),w=this.view.glyphMosaic();this._tileHandler=new m(this.layer,_,r.contentPixelRatio,w,this._memCache);const C=this._tileHandlerController.signal,R=H(S),L=this._tileHandler.start({signal:C,schedule:R}),x=this._tileHandler.spriteMosaic;x.then(e=>{!s(C)&&this._tileHandler&&(this.painter=new p(e,this._tileHandler.glyphMosaic))}),L.then(()=>this._tileHandlerController=null);const T=()=>{this._tileHandlerController&&this._tileHandlerController.abort(),this._tileHandlerController=new AbortController,this._memCache.clear();const e=this.layer.currentStyleInfo.style,t=this.view.state?.contentPixelRatio??1,i=new y(e),l=new m(this.layer,i,t,w,this._memCache),r=l.start({signal:this._tileHandlerController.signal,schedule:R}),s=l.spriteMosaic;r.then(()=>this._tileHandlerController=null),this._updatingHandles.consumePromise(Promise.all([r,s]).then(([,e])=>{const t=this._tileHandler,i=this.painter;this.painter=new p(e,l.glyphMosaic),this._tileHandler=l,this.emit("data-changed"),t.destroy(),i&&i.dispose()}))};this._updatingHandles.add(()=>({style:this.layer.currentStyleInfo.style,pixelRatio:this.view.state?.contentPixelRatio}),T),this.addHandles([this.layer.on("paint-change",()=>this.emit("data-changed")),this.layer.on("style-layer-change",T),this.layer.on("delete-style-layer",T),this.layer.on("spriteSource-change",()=>this.emit("data-changed")),this.layer.on("layout-change",()=>this.emit("data-changed")),this.layer.on("style-layer-visibility-change",()=>this.emit("data-changed"))]);const j=Promise.all([f,L,x]);this.addResolvingPromise(j)}destroy(){this.painter=i(this.painter),this._tileHandlerController=l(this._tileHandlerController),this._tileHandler=r(this._tileHandler),this._memCache=r(this._memCache)}get contentZoom(){return has("disable-feature:vtl-level-shift")?1:this.view.qualitySettings.tiledSurface.vtlContentZoom}get displayLevelRange(){const e=this.tileInfo.lods,t=this.layer.minScale||e[0].scale,i=this.layer.maxScale||e[e.length-1].scale,l=this.levelRangeFromScaleRange(t,i);return this.layer.maxScale?l.maxLevel++:l.maxLevel+=this.levelShift,l}get dataScaleRange(){const e=this.tileInfo.lods;return{minScale:e[0].scale,maxScale:e[e.length-1].scale}}get dataLevelRange(){const{minScale:e,maxScale:t}=this.dataScaleRange,i=this.levelRangeFromScaleRange(e,t);return 1===i.minLevel&&256===this.tileInfo.size[0]&&(i.minLevel=0),i.maxLevel+=this.levelShift,i}async fetchTile(e,t){const i=this.schemaHelper.getLevelRowColumn(e);return this._tileHandler.getVectorTile(i,t)}get hasVisibleFeatures(){return!0}async doRefresh(){this.suspended||this.emit("data-changed")}};e([h()],_.prototype,"levelShift",void 0),e([h()],_.prototype,"contentZoom",null),e([h()],_.prototype,"displayLevelRange",null),e([h()],_.prototype,"tileInfo",void 0),e([h()],_.prototype,"dataScaleRange",null),e([h()],_.prototype,"dataLevelRange",null),e([h()],_.prototype,"updatingProgressValue",void 0),_=e([c("esri.views.3d.layers.VectorTileLayerView3D")],_);const w=_;function H(e){return t=>e.immediate.schedule(t)}export{w as default};