@arcgis/core 4.28.0-next.20230809 → 4.28.0-next.20230810

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 (104) hide show
  1. package/Basemap.js +1 -1
  2. package/Ground.js +1 -1
  3. package/Map.js +1 -1
  4. package/WebMap.js +1 -1
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/05cefb1ce5b1bf94d5fe.js +1 -0
  7. package/assets/esri/core/workers/chunks/0a3cb3013a6ab8a9c86b.js +1 -0
  8. package/assets/esri/core/workers/chunks/153d90db1892ffa69e21.js +1 -0
  9. package/assets/esri/core/workers/chunks/1b4b928b1721a6834d76.js +1 -0
  10. package/assets/esri/core/workers/chunks/24b2432edc543ffc0200.js +1 -0
  11. package/assets/esri/core/workers/chunks/3310403a8bb8590be350.js +1 -0
  12. package/assets/esri/core/workers/chunks/337a4ab13ed01b6f0753.js +1 -0
  13. package/assets/esri/core/workers/chunks/{80ca70afa729badc04f2.js → 3725dd14c2da0f47198f.js} +1 -1
  14. package/assets/esri/core/workers/chunks/600a4f7c409e13612817.js +1 -0
  15. package/assets/esri/core/workers/chunks/624d427a0cde78b2cb98.js +1 -0
  16. package/assets/esri/core/workers/chunks/{01ecb73fc84b9c1a5d93.js → 63d64bbf86e203e4d317.js} +1 -1
  17. package/assets/esri/core/workers/chunks/6a8b9c63585c4c20cc49.js +1 -0
  18. package/assets/esri/core/workers/chunks/{20545c4f547ecc3fc582.js → 75caa30fd67acd4ca266.js} +1 -1
  19. package/assets/esri/core/workers/chunks/82b51b0bc1d44e3b5256.js +1 -0
  20. package/assets/esri/core/workers/chunks/86d1eaa61aa7411411ed.js +1 -0
  21. package/assets/esri/core/workers/chunks/9b81f520a87f0c78594a.js +1 -0
  22. package/assets/esri/core/workers/chunks/a5cc98762cb32868da91.js +1 -0
  23. package/assets/esri/core/workers/chunks/a5cf16866a2d95858e38.js +1 -0
  24. package/assets/esri/core/workers/chunks/{e3ab93144eede617c897.js → a6459b71dcffbed1127c.js} +1 -1
  25. package/assets/esri/core/workers/chunks/ab66a8dfd7b1e2cf3812.js +1 -0
  26. package/assets/esri/core/workers/chunks/{0452c322dace14e97ae6.js → add6a910b7c4c6f0a031.js} +1 -1
  27. package/assets/esri/core/workers/chunks/b1da2148f4c0f30d170d.js +1 -0
  28. package/assets/esri/core/workers/chunks/{c900e747e9488fdce7e1.js → b2d2e8872d8cfafe7b80.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{455c65bc60c6b997fec3.js → b5937a782b3512377062.js} +2 -2
  30. package/assets/esri/core/workers/chunks/{977b492a7e644724a46c.js → b840abc2f587f94a552e.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{8fae02eacf215aef159a.js → c38dd88f99b4c75c3a85.js} +1 -1
  32. package/assets/esri/core/workers/chunks/c7eb63999dc81acb16ff.js +1 -0
  33. package/assets/esri/core/workers/chunks/{02ab4779c6c8f1950c7d.js → c914e212a8d8e6bacaf4.js} +1 -1
  34. package/assets/esri/core/workers/chunks/d03c87513afdcb4a9ee2.js +1 -0
  35. package/assets/esri/core/workers/chunks/{b93df9fed4d981d281f7.js → d338161197273a7185c5.js} +1 -1
  36. package/assets/esri/core/workers/chunks/d6c29f95f005e0fb1bfe.js +1 -0
  37. package/assets/esri/core/workers/chunks/e0188bd6a46fb80c0d55.js +1 -0
  38. package/assets/esri/core/workers/chunks/{ae8acaf961740fa60769.js → e2dc164845391a3d1d70.js} +1 -1
  39. package/assets/esri/core/workers/chunks/e52cfb2aac16b06ed5d2.js +1 -0
  40. package/assets/esri/core/workers/chunks/e7a879f71f70fefa822b.js +1 -0
  41. package/assets/esri/core/workers/chunks/ea43a8ebb72c7b07a0a9.js +1 -0
  42. package/assets/esri/core/workers/chunks/eb01b5df236ff331e0f3.js +1 -0
  43. package/assets/esri/core/workers/chunks/f470113fcb1f3d8708c2.js +1 -0
  44. package/assets/esri/core/workers/chunks/fb4789ebb3e98a7a0b7a.js +1 -0
  45. package/assets/esri/themes/base/widgets/_Features.scss +4 -0
  46. package/assets/esri/themes/dark/main.css +1 -1
  47. package/assets/esri/themes/light/main.css +1 -1
  48. package/assets/esri/themes/light/view.css +1 -1
  49. package/core/Collection.js +1 -1
  50. package/core/Evented.js +1 -1
  51. package/geometry/Mesh.js +1 -1
  52. package/geometry/support/meshUtils/External.js +1 -1
  53. package/interfaces.d.ts +72 -52
  54. package/layers/SubtypeGroupLayer.js +1 -1
  55. package/layers/mixins/EditBusLayer.js +1 -1
  56. package/layers/mixins/PortalLayer.js +1 -1
  57. package/layers/mixins/refresh.js +1 -1
  58. package/layers/support/infoFor3D.js +1 -1
  59. package/networks/Network.js +1 -1
  60. package/package.json +1 -1
  61. package/support/TablesMixin.js +1 -1
  62. package/support/basemapUtils.js +1 -1
  63. package/support/revision.js +1 -1
  64. package/support/zipUtils.js +1 -1
  65. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  66. package/views/3d/support/LaserLineRenderer.js +1 -1
  67. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  68. package/views/3d/webgl-engine/effects/SmaaRenderPass.js +1 -1
  69. package/views/3d/webgl-engine/lib/Highlight.js +1 -1
  70. package/views/3d/webgl-engine/lib/RenderSlot.js +1 -1
  71. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  72. package/views/3d/webgl-engine/lib/SSAOHelper.js +1 -1
  73. package/widgets/Features/FeaturesRelatedRecords.js +1 -1
  74. package/widgets/Features/FeaturesViewModel.js +1 -1
  75. package/widgets/Features/css.js +1 -1
  76. package/widgets/Features.js +1 -1
  77. package/widgets/Popup/PopupViewModel.js +1 -1
  78. package/assets/esri/core/workers/chunks/1305d22b4483bd26ef55.js +0 -1
  79. package/assets/esri/core/workers/chunks/1ae96fc797d69e76af34.js +0 -1
  80. package/assets/esri/core/workers/chunks/2216e299488d8a5a7cc8.js +0 -1
  81. package/assets/esri/core/workers/chunks/2cdbabcbfe32286ec78d.js +0 -1
  82. package/assets/esri/core/workers/chunks/2e4d550751be7031783f.js +0 -1
  83. package/assets/esri/core/workers/chunks/394f4a86a5c56e6bad20.js +0 -1
  84. package/assets/esri/core/workers/chunks/41b8aad34fd54c88abc6.js +0 -1
  85. package/assets/esri/core/workers/chunks/550a2e7fcb68146e3689.js +0 -1
  86. package/assets/esri/core/workers/chunks/582371fbfb0036b2393d.js +0 -1
  87. package/assets/esri/core/workers/chunks/5b88d3373d34f48f8ce1.js +0 -1
  88. package/assets/esri/core/workers/chunks/5caf803a8de8c577e9a6.js +0 -1
  89. package/assets/esri/core/workers/chunks/7b17ec6d2d2d77c07bae.js +0 -1
  90. package/assets/esri/core/workers/chunks/8489e4834d900bf261ac.js +0 -1
  91. package/assets/esri/core/workers/chunks/861f6a61df0ddd508511.js +0 -1
  92. package/assets/esri/core/workers/chunks/8d324c861a68d45f34f3.js +0 -1
  93. package/assets/esri/core/workers/chunks/93b8526bb5040628c665.js +0 -1
  94. package/assets/esri/core/workers/chunks/9ed16a646f1bf52f5c59.js +0 -1
  95. package/assets/esri/core/workers/chunks/aaebcef4cbc7c84f0120.js +0 -1
  96. package/assets/esri/core/workers/chunks/b6ba935da9884de355d3.js +0 -1
  97. package/assets/esri/core/workers/chunks/bf63349cf57fe2929f3e.js +0 -1
  98. package/assets/esri/core/workers/chunks/c8e656cd470a17f538e9.js +0 -1
  99. package/assets/esri/core/workers/chunks/cd0cdea99c94b420e2e0.js +0 -1
  100. package/assets/esri/core/workers/chunks/d87e09fb8931eb952834.js +0 -1
  101. package/assets/esri/core/workers/chunks/ebc5767685774c8ea8bf.js +0 -1
  102. package/assets/esri/core/workers/chunks/f5fc5ba0f05fce6faad1.js +0 -1
  103. package/assets/esri/core/workers/chunks/fb8843c66641a8842762.js +0 -1
  104. package/assets/esri/core/workers/chunks/fca6e7a72011ebb94f22.js +0 -1
package/Basemap.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"./chunks/tslib.es6.js";import r from"./request.js";import t from"./core/Collection.js";import{referenceSetter as s}from"./core/collectionUtils.js";import{deprecated as a}from"./core/deprecate.js";import{JSONSupportMixin as o}from"./core/JSONSupport.js";import{isClonable as i,clone as n}from"./core/lang.js";import l from"./core/Loadable.js";import{loadAll as p}from"./core/loadAll.js";import c from"./core/Logger.js";import{throwIfAborted as m}from"./core/promiseUtils.js";import{isProtocolRelative as u,urlToObject as y}from"./core/urlUtils.js";import{property as h}from"./core/accessorSupport/decorators/property.js";import"./core/accessorSupport/ensureType.js";import{subclass as d}from"./core/accessorSupport/decorators/subclass.js";import{writer as f}from"./core/accessorSupport/decorators/writer.js";import b from"./geometry/SpatialReference.js";import L from"./portal/Portal.js";import g from"./portal/PortalItem.js";import{getBasemapTitle as w,esriBasemapDefinitions as I}from"./support/basemapDefinitions.js";import S from"./support/BasemapStyle.js";import{getLayerJSON as j}from"./webdoc/support/writeUtils.js";var v;let _=0;const M="esri.Basemap";let U=v=class extends(o(l)){constructor(e){super(e),this.id=null,this.portalItem=null,this.spatialReference=null,this.style=null,this.thumbnailUrl=null,this.title="Basemap",this.id=Date.now().toString(16)+"-basemap-"+_++,this.baseLayers=new t,this.referenceLayers=new t;const r=e=>{e.parent&&e.parent!==this&&"remove"in e.parent&&e.parent.remove(e),e.parent=this,"elevation"===e.type&&c.getLogger(this).error(`Layer '${e.title}, id:${e.id}' of type '${e.type}' is not supported as a basemap layer and will therefore be ignored.`)},s=e=>{e.parent=null};this.addHandles([this.baseLayers.on("after-add",(e=>r(e.item))),this.referenceLayers.on("after-add",(e=>r(e.item))),this.baseLayers.on("after-remove",(e=>s(e.item))),this.referenceLayers.on("after-remove",(e=>s(e.item)))])}initialize(){this.when().catch((e=>{c.getLogger(this).error("#load()",`Failed to load basemap (title: '${this.title}', id: '${this.id}')`,e)})),this.resourceInfo&&this.read(this.resourceInfo.data,this.resourceInfo.context)}destroy(){this.baseLayers.destroy(),this.referenceLayers.destroy(),this.portalItem=null}normalizeCtorArgs(e){return e&&"resourceInfo"in e&&(this._set("resourceInfo",e.resourceInfo),delete(e={...e}).resourceInfo),e}set baseLayers(e){this._set("baseLayers",s(e,this._get("baseLayers")))}_writeBaseLayers(e,r,t){const s=[];e?(t={...t,layerContainerType:"basemap"},this.baseLayers.forEach((e=>{const r=j(e,t.webmap?t.webmap.getLayerJSONFromResourceInfo(e):null,t);null!=r&&s.push(r)})),this.referenceLayers.forEach((e=>{const r=j(e,t.webmap?t.webmap.getLayerJSONFromResourceInfo(e):null,t);null!=r&&("scene"!==e.type&&(r.isReference=!0),s.push(r))})),r.baseMapLayers=s):r.baseMapLayers=s}set referenceLayers(e){this._set("referenceLayers",s(e,this._get("referenceLayers")))}writeTitle(e,r){r.title=e||"Basemap"}load(e){return this.addResolvingPromise(this._loadFromSource(e)),Promise.resolve(this)}loadAll(){return p(this,(e=>{e(this.baseLayers,this.referenceLayers)}))}clone(){const e={id:this.id,title:this.title,portalItem:this.portalItem,baseLayers:this.baseLayers.map((e=>i(e)?e.clone():e)),referenceLayers:this.referenceLayers.map((e=>i(e)?e.clone():e))};return this.loaded&&(e.loadStatus="loaded"),new v({resourceInfo:this.resourceInfo}).set(e)}read(e,r){this.resourceInfo||this._set("resourceInfo",{data:e,context:r}),super.read(e,r)}write(e,r){return e=e||{},r&&r.origin||(r={origin:"web-map",...r}),super.write(e,r),!this.loaded&&this.resourceInfo&&this.resourceInfo.data.baseMapLayers&&(e.baseMapLayers=this.resourceInfo.data.baseMapLayers.map((e=>{const r=n(e);return r.url&&u(r.url)&&(r.url=`https:${r.url}`),r.templateUrl&&u(r.templateUrl)&&(r.templateUrl=`https:${r.templateUrl}`),r}))),e}async _loadFromSource(e){const{resourceInfo:r,portalItem:t,style:s}=this;m(e);const a=[];if(r){const t=r.context?r.context.url:null;if(a.push(this._loadLayersFromJSON(r.data,t,e)),r.data.id&&!r.data.title){const e=r.data.id;a.push(w(e).then((e=>{e&&this.read({title:e},r.context)})))}}else t?a.push(this._loadFromItem(t,e)):s&&a.push(this._loadFromStylesService(s,e));await Promise.all(a)}async _loadLayersFromJSON(e,r,t){const s=this.resourceInfo&&this.resourceInfo.context,a=this.portalItem&&this.portalItem.portal||s&&s.portal||null,o=F[s?.origin||""]??"web-map",{populateOperationalLayers:i}=await import("./layers/support/layersCreator.js"),n=[];if(m(t),e.baseMapLayers&&Array.isArray(e.baseMapLayers)){const t={context:{origin:o,url:r,portal:a,layerContainerType:"basemap"},defaultLayerType:"DefaultTileLayer"},s=e=>"web-scene"===o&&"ArcGISSceneServiceLayer"===e.layerType||e.isReference,l=i(this.baseLayers,e.baseMapLayers.filter((e=>!s(e))),t);n.push(l);const p=i(this.referenceLayers,e.baseMapLayers.filter(s),t);n.push(p)}await Promise.allSettled(n)}async _loadFromItem(e,r){const t=await e.load(r),s=await t.fetchData("json",r),a=y(e.itemUrl??"");return this._set("resourceInfo",{data:s.baseMap??{},context:{origin:x[e.type||""]??"web-map",portal:e.portal||L.getDefault(),url:a}}),this.read(this.resourceInfo.data,this.resourceInfo.context),this.read({spatialReference:s.spatialReference},this.resourceInfo.context),this.read({title:e.title,thumbnailUrl:e.thumbnailUrl},{origin:"portal-item",portal:e.portal||L.getDefault(),url:a}),this._loadLayersFromJSON(this.resourceInfo.data,a,r)}async _loadFromStylesService(e,t){const s=`${e.serviceUrl}/${e.id}`,a=(await r(s,{query:{language:e.getLanguageParamValue()},signal:t?.signal})).data;if(a.baseMap&&Array.isArray(a.baseMap.baseMapLayers))for(const r of a.baseMap.baseMapLayers)if(!r.customParameters&&r.styleUrl?.includes("?")){const e=y(r.styleUrl);e.query&&(r.styleUrl=e.path,r.customParameters=e.query)}const o=y(s);return this._set("resourceInfo",{data:a.baseMap??{},context:{origin:"web-map",url:o}}),this.read(this.resourceInfo.data,this.resourceInfo.context),this.read({spatialReference:a.spatialReference},this.resourceInfo.context),this._loadLayersFromJSON(this.resourceInfo.data,o,t)}static fromId(e){const r=I[e];if(!r)return null;if(r.deprecated){let r=null;"dark-gray"===e?r="dark-gray-vector":"gray"===e?r="gray-vector":"streets"===e?r="streets-vector":"topo"===e&&(r="topo-vector"),a(c.getLogger(M),`The ${e} basemap has entered mature support and is no longer being updated.`,{replacement:r,see:"https://arcg.is/1iq8aD",warnOnce:!0})}return v.fromJSON(r)}};e([h({json:{write:{ignoreOrigin:!0,target:"baseMapLayers",writer(e,r,t,s){this._writeBaseLayers(e,r,s)}},origins:{"web-scene":{write:{ignoreOrigin:!0,target:{baseMapLayers:{type:t}},writer(e,r,t,s){this._writeBaseLayers(e,r,s)}}}}}})],U.prototype,"baseLayers",null),e([h({type:String,json:{origins:{"web-scene":{write:!0}}}})],U.prototype,"id",void 0),e([h({type:g})],U.prototype,"portalItem",void 0),e([h()],U.prototype,"referenceLayers",null),e([h({readOnly:!0})],U.prototype,"resourceInfo",void 0),e([h({type:b})],U.prototype,"spatialReference",void 0),e([h({type:S})],U.prototype,"style",void 0),e([h()],U.prototype,"thumbnailUrl",void 0),e([h({type:String,json:{origins:{"web-scene":{write:{isRequired:!0}}}}})],U.prototype,"title",void 0),e([f("title")],U.prototype,"writeTitle",null),U=v=e([d(M)],U);const x={"Web Scene":"web-scene","Web Map":"web-map","Link Chart":"link-chart"},F={"web-scene":"web-scene","web-map":"web-map","link-chart":"link-chart"},O=U;export{O as default};
5
+ import{_ as e}from"./chunks/tslib.es6.js";import r from"./request.js";import t from"./core/Collection.js";import{referenceSetter as s}from"./core/collectionUtils.js";import{deprecated as a}from"./core/deprecate.js";import{JSONSupportMixin as o}from"./core/JSONSupport.js";import{isClonable as i,clone as n}from"./core/lang.js";import l from"./core/Loadable.js";import{loadAll as p}from"./core/loadAll.js";import c from"./core/Logger.js";import{destroyMaybe as m}from"./core/maybe.js";import{throwIfAborted as y}from"./core/promiseUtils.js";import{isProtocolRelative as u,urlToObject as h}from"./core/urlUtils.js";import{property as d}from"./core/accessorSupport/decorators/property.js";import"./core/accessorSupport/ensureType.js";import{subclass as f}from"./core/accessorSupport/decorators/subclass.js";import{writer as b}from"./core/accessorSupport/decorators/writer.js";import L from"./geometry/SpatialReference.js";import g from"./portal/Portal.js";import w from"./portal/PortalItem.js";import{getBasemapTitle as I,esriBasemapDefinitions as S}from"./support/basemapDefinitions.js";import j from"./support/BasemapStyle.js";import{getLayerJSON as v}from"./webdoc/support/writeUtils.js";var _;let M=0;const U="esri.Basemap";let x=_=class extends(o(l)){constructor(e){super(e),this.id=null,this.portalItem=null,this.spatialReference=null,this.style=null,this.thumbnailUrl=null,this.title="Basemap",this.id=Date.now().toString(16)+"-basemap-"+M++,this.baseLayers=new t,this.referenceLayers=new t;const r=e=>{e.parent&&e.parent!==this&&"remove"in e.parent&&e.parent.remove(e),e.parent=this,"elevation"===e.type&&c.getLogger(this).error(`Layer '${e.title}, id:${e.id}' of type '${e.type}' is not supported as a basemap layer and will therefore be ignored.`)},s=e=>{e.parent=null};this.addHandles([this.baseLayers.on("after-add",(e=>r(e.item))),this.referenceLayers.on("after-add",(e=>r(e.item))),this.baseLayers.on("after-remove",(e=>s(e.item))),this.referenceLayers.on("after-remove",(e=>s(e.item)))])}initialize(){this.when().catch((e=>{c.getLogger(this).error("#load()",`Failed to load basemap (title: '${this.title}', id: '${this.id}')`,e)})),this.resourceInfo&&this.read(this.resourceInfo.data,this.resourceInfo.context)}destroy(){const e=this.baseLayers.toArray();for(const t of e)t.destroy();const r=this.referenceLayers.toArray();for(const t of r)t.destroy();this.baseLayers.destroy(),this.referenceLayers.destroy(),this.portalItem=m(this.portalItem)}normalizeCtorArgs(e){return e&&"resourceInfo"in e&&(this._set("resourceInfo",e.resourceInfo),delete(e={...e}).resourceInfo),e}set baseLayers(e){this._set("baseLayers",s(e,this._get("baseLayers")))}_writeBaseLayers(e,r,t){const s=[];e?(t={...t,layerContainerType:"basemap"},this.baseLayers.forEach((e=>{const r=v(e,t.webmap?t.webmap.getLayerJSONFromResourceInfo(e):null,t);null!=r&&s.push(r)})),this.referenceLayers.forEach((e=>{const r=v(e,t.webmap?t.webmap.getLayerJSONFromResourceInfo(e):null,t);null!=r&&("scene"!==e.type&&(r.isReference=!0),s.push(r))})),r.baseMapLayers=s):r.baseMapLayers=s}set referenceLayers(e){this._set("referenceLayers",s(e,this._get("referenceLayers")))}writeTitle(e,r){r.title=e||"Basemap"}load(e){return this.addResolvingPromise(this._loadFromSource(e)),Promise.resolve(this)}loadAll(){return p(this,(e=>{e(this.baseLayers,this.referenceLayers)}))}clone(){const e={id:this.id,title:this.title,portalItem:this.portalItem,baseLayers:this.baseLayers.map((e=>i(e)?e.clone():e)),referenceLayers:this.referenceLayers.map((e=>i(e)?e.clone():e))};return this.loaded&&(e.loadStatus="loaded"),new _({resourceInfo:this.resourceInfo}).set(e)}read(e,r){this.resourceInfo||this._set("resourceInfo",{data:e,context:r}),super.read(e,r)}write(e,r){return e=e||{},r&&r.origin||(r={origin:"web-map",...r}),super.write(e,r),!this.loaded&&this.resourceInfo&&this.resourceInfo.data.baseMapLayers&&(e.baseMapLayers=this.resourceInfo.data.baseMapLayers.map((e=>{const r=n(e);return r.url&&u(r.url)&&(r.url=`https:${r.url}`),r.templateUrl&&u(r.templateUrl)&&(r.templateUrl=`https:${r.templateUrl}`),r}))),e}async _loadFromSource(e){const{resourceInfo:r,portalItem:t,style:s}=this;y(e);const a=[];if(r){const t=r.context?r.context.url:null;if(a.push(this._loadLayersFromJSON(r.data,t,e)),r.data.id&&!r.data.title){const e=r.data.id;a.push(I(e).then((e=>{e&&this.read({title:e},r.context)})))}}else t?a.push(this._loadFromItem(t,e)):s&&a.push(this._loadFromStylesService(s,e));await Promise.all(a)}async _loadLayersFromJSON(e,r,t){const s=this.resourceInfo&&this.resourceInfo.context,a=this.portalItem&&this.portalItem.portal||s&&s.portal||null,o=O[s?.origin||""]??"web-map",{populateOperationalLayers:i}=await import("./layers/support/layersCreator.js"),n=[];if(y(t),e.baseMapLayers&&Array.isArray(e.baseMapLayers)){const t={context:{origin:o,url:r,portal:a,layerContainerType:"basemap"},defaultLayerType:"DefaultTileLayer"},s=e=>"web-scene"===o&&"ArcGISSceneServiceLayer"===e.layerType||e.isReference,l=i(this.baseLayers,e.baseMapLayers.filter((e=>!s(e))),t);n.push(l);const p=i(this.referenceLayers,e.baseMapLayers.filter(s),t);n.push(p)}await Promise.allSettled(n)}async _loadFromItem(e,r){const t=await e.load(r),s=await t.fetchData("json",r),a=h(e.itemUrl??"");return this._set("resourceInfo",{data:s.baseMap??{},context:{origin:F[e.type||""]??"web-map",portal:e.portal||g.getDefault(),url:a}}),this.read(this.resourceInfo.data,this.resourceInfo.context),this.read({spatialReference:s.spatialReference},this.resourceInfo.context),this.read({title:e.title,thumbnailUrl:e.thumbnailUrl},{origin:"portal-item",portal:e.portal||g.getDefault(),url:a}),this._loadLayersFromJSON(this.resourceInfo.data,a,r)}async _loadFromStylesService(e,t){const s=`${e.serviceUrl}/${e.id}`,a=(await r(s,{query:{language:e.getLanguageParamValue()},signal:t?.signal})).data;if(a.baseMap&&Array.isArray(a.baseMap.baseMapLayers))for(const r of a.baseMap.baseMapLayers)if(!r.customParameters&&r.styleUrl?.includes("?")){const e=h(r.styleUrl);e.query&&(r.styleUrl=e.path,r.customParameters=e.query)}const o=h(s);return this._set("resourceInfo",{data:a.baseMap??{},context:{origin:"web-map",url:o}}),this.read(this.resourceInfo.data,this.resourceInfo.context),this.read({spatialReference:a.spatialReference},this.resourceInfo.context),this._loadLayersFromJSON(this.resourceInfo.data,o,t)}static fromId(e){const r=S[e];if(!r)return null;if(r.deprecated){let r=null;"dark-gray"===e?r="dark-gray-vector":"gray"===e?r="gray-vector":"streets"===e?r="streets-vector":"topo"===e&&(r="topo-vector"),a(c.getLogger(U),`The ${e} basemap has entered mature support and is no longer being updated.`,{replacement:r,see:"https://arcg.is/1iq8aD",warnOnce:!0})}return _.fromJSON(r)}};e([d({json:{write:{ignoreOrigin:!0,target:"baseMapLayers",writer(e,r,t,s){this._writeBaseLayers(e,r,s)}},origins:{"web-scene":{write:{ignoreOrigin:!0,target:{baseMapLayers:{type:t}},writer(e,r,t,s){this._writeBaseLayers(e,r,s)}}}}}})],x.prototype,"baseLayers",null),e([d({type:String,json:{origins:{"web-scene":{write:!0}}}})],x.prototype,"id",void 0),e([d({type:w})],x.prototype,"portalItem",void 0),e([d()],x.prototype,"referenceLayers",null),e([d({readOnly:!0})],x.prototype,"resourceInfo",void 0),e([d({type:L})],x.prototype,"spatialReference",void 0),e([d({type:j})],x.prototype,"style",void 0),e([d()],x.prototype,"thumbnailUrl",void 0),e([d({type:String,json:{origins:{"web-scene":{write:{isRequired:!0}}}}})],x.prototype,"title",void 0),e([b("title")],x.prototype,"writeTitle",null),x=_=e([f(U)],x);const F={"Web Scene":"web-scene","Web Map":"web-map","Link Chart":"link-chart"},O={"web-scene":"web-scene","web-map":"web-map","link-chart":"link-chart"},R=x;export{R as default};
package/Ground.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"./chunks/tslib.es6.js";import e from"./Color.js";import o from"./core/Collection.js";import{referenceSetter as t}from"./core/collectionUtils.js";import{typeCast as s}from"./core/compilerUtils.js";import a from"./core/Error.js";import{JSONSupportMixin as i}from"./core/JSONSupport.js";import{clone as n}from"./core/lang.js";import l from"./core/Loadable.js";import{loadAll as p}from"./core/loadAll.js";import c from"./core/Logger.js";import{isAbortError as y,throwIfAborted as u}from"./core/promiseUtils.js";import{property as d}from"./core/accessorSupport/decorators/property.js";import{Integer as m}from"./core/accessorSupport/ensureType.js";import{subclass as f}from"./core/accessorSupport/decorators/subclass.js";import{writer as h}from"./core/accessorSupport/decorators/writer.js";import{NavigationConstraint as g}from"./ground/NavigationConstraint.js";import{transparencyToOpacity as v,opacityToTransparency as j}from"./webdoc/support/opacityUtils.js";var w;let S=w=class extends(i(l)){constructor(r){super(r),this.opacity=1,this.surfaceColor=null,this.navigationConstraint=null,this.layers=new o;const e=r=>{r.parent&&r.parent!==this&&"remove"in r.parent&&r.parent.remove(r),r.parent=this,"elevation"!==r.type&&"base-elevation"!==r.type&&c.getLogger(this).error(`Layer '${r.title}, id:${r.id}' of type '${r.type}' is not supported as a ground layer and will therefore be ignored. Only layers of type 'elevation' are supported.`)},t=r=>{r.parent=null};this.addHandles([this.layers.on("after-add",(r=>e(r.item))),this.layers.on("after-remove",(r=>t(r.item)))])}initialize(){this.when().catch((r=>{y(r)||c.getLogger(this).error("#load()","Failed to load ground",r)})),this.resourceInfo&&this.read(this.resourceInfo.data,this.resourceInfo.context)}destroy(){const r=this.layers.removeAll();for(const e of r)e.destroy();this.layers.destroy()}normalizeCtorArgs(r){return r&&"resourceInfo"in r&&(this._set("resourceInfo",r.resourceInfo),delete(r={...r}).resourceInfo),r}set layers(r){this._set("layers",t(r,this._get("layers")))}writeLayers(r,e,o,t){const i=[];r?(t={...t,layerContainerType:"ground"},r.forEach((r=>{if("write"in r){const e={};s(r)().write(e,t)&&i.push(e)}else t&&t.messages&&t.messages.push(new a("layer:unsupported",`Layers (${r.title}, ${r.id}) of type '${r.declaredClass}' cannot be persisted in the ground`,{layer:r}))})),e.layers=i):e.layers=i}load(r){return this.addResolvingPromise(this._loadFromSource(r)),Promise.resolve(this)}loadAll(){return p(this,(r=>{r(this.layers)}))}async queryElevation(r,e){await this.load({signal:e?.signal});const{ElevationQuery:o}=await import("./layers/support/ElevationQuery.js");u(e);const t=new o,s=this.layers.filter(I).toArray();return t.queryAll(s,r,e)}async createElevationSampler(r,e){await this.load({signal:e?.signal});const{ElevationQuery:o}=await import("./layers/support/ElevationQuery.js");u(e);const t=new o,s=this.layers.filter(I).toArray();return t.createSamplerAll(s,r,e)}clone(){const r={opacity:this.opacity,surfaceColor:n(this.surfaceColor),navigationConstraint:n(this.navigationConstraint),layers:this.layers.slice()};return this.loaded&&(r.loadStatus="loaded"),new w({resourceInfo:this.resourceInfo}).set(r)}read(r,e){this.resourceInfo||this._set("resourceInfo",{data:r,context:e}),super.read(r,e)}_loadFromSource(r){const e=this.resourceInfo;return e?this._loadLayersFromJSON(e.data,e.context,r):Promise.resolve()}async _loadLayersFromJSON(r,e,o){const t=e&&e.origin||"web-scene",s=e&&e.portal||null,a=e&&e.url||null,{populateOperationalLayers:i}=await import("./layers/support/layersCreator.js");u(o);const n=[];if(r.layers&&Array.isArray(r.layers)){const e={context:{origin:t,url:a,portal:s,layerContainerType:"ground"},defaultLayerType:"ArcGISTiledElevationServiceLayer"};n.push(i(this.layers,r.layers,e))}await Promise.allSettled(n)}};function C(r){return r&&"createElevationSampler"in r}function I(r){return"elevation"===r.type||C(r)}r([d({json:{read:!1}})],S.prototype,"layers",null),r([h("layers")],S.prototype,"writeLayers",null),r([d({readOnly:!0})],S.prototype,"resourceInfo",void 0),r([d({type:Number,nonNullable:!0,range:{min:0,max:1},json:{type:m,read:{reader:v,source:"transparency"},write:{writer:(r,e)=>{e.transparency=j(r)},target:"transparency"}}})],S.prototype,"opacity",void 0),r([d({type:e,json:{type:[m],write:(r,e)=>{e.surfaceColor=r.toJSON().slice(0,3)}}})],S.prototype,"surfaceColor",void 0),r([d({type:g,json:{write:!0}})],S.prototype,"navigationConstraint",void 0),S=w=r([f("esri.Ground")],S);const L=S;export{L as default};
5
+ import{_ as r}from"./chunks/tslib.es6.js";import e from"./Color.js";import o from"./core/Collection.js";import{referenceSetter as t}from"./core/collectionUtils.js";import{typeCast as s}from"./core/compilerUtils.js";import a from"./core/Error.js";import{JSONSupportMixin as i}from"./core/JSONSupport.js";import{clone as n}from"./core/lang.js";import l from"./core/Loadable.js";import{loadAll as p}from"./core/loadAll.js";import c from"./core/Logger.js";import{destroyMaybe as y}from"./core/maybe.js";import{isAbortError as u,throwIfAborted as d}from"./core/promiseUtils.js";import{property as m}from"./core/accessorSupport/decorators/property.js";import{Integer as f}from"./core/accessorSupport/ensureType.js";import{subclass as h}from"./core/accessorSupport/decorators/subclass.js";import{writer as g}from"./core/accessorSupport/decorators/writer.js";import{NavigationConstraint as v}from"./ground/NavigationConstraint.js";import{transparencyToOpacity as j,opacityToTransparency as w}from"./webdoc/support/opacityUtils.js";var S;let C=S=class extends(i(l)){constructor(r){super(r),this.opacity=1,this.surfaceColor=null,this.navigationConstraint=null,this.layers=new o;const e=r=>{r.parent&&r.parent!==this&&"remove"in r.parent&&r.parent.remove(r),r.parent=this,"elevation"!==r.type&&"base-elevation"!==r.type&&c.getLogger(this).error(`Layer '${r.title}, id:${r.id}' of type '${r.type}' is not supported as a ground layer and will therefore be ignored. Only layers of type 'elevation' are supported.`)},t=r=>{r.parent=null};this.addHandles([this.layers.on("after-add",(r=>e(r.item))),this.layers.on("after-remove",(r=>t(r.item)))])}initialize(){this.when().catch((r=>{u(r)||c.getLogger(this).error("#load()","Failed to load ground",r)})),this.resourceInfo&&this.read(this.resourceInfo.data,this.resourceInfo.context)}destroy(){const r=this.layers.removeAll();for(const e of r)y(e);this.layers.destroy()}normalizeCtorArgs(r){return r&&"resourceInfo"in r&&(this._set("resourceInfo",r.resourceInfo),delete(r={...r}).resourceInfo),r}set layers(r){this._set("layers",t(r,this._get("layers")))}writeLayers(r,e,o,t){const i=[];r?(t={...t,layerContainerType:"ground"},r.forEach((r=>{if("write"in r){const e={};s(r)().write(e,t)&&i.push(e)}else t&&t.messages&&t.messages.push(new a("layer:unsupported",`Layers (${r.title}, ${r.id}) of type '${r.declaredClass}' cannot be persisted in the ground`,{layer:r}))})),e.layers=i):e.layers=i}load(r){return this.addResolvingPromise(this._loadFromSource(r)),Promise.resolve(this)}loadAll(){return p(this,(r=>{r(this.layers)}))}async queryElevation(r,e){await this.load({signal:e?.signal});const{ElevationQuery:o}=await import("./layers/support/ElevationQuery.js");d(e);const t=new o,s=this.layers.filter(L).toArray();return t.queryAll(s,r,e)}async createElevationSampler(r,e){await this.load({signal:e?.signal});const{ElevationQuery:o}=await import("./layers/support/ElevationQuery.js");d(e);const t=new o,s=this.layers.filter(L).toArray();return t.createSamplerAll(s,r,e)}clone(){const r={opacity:this.opacity,surfaceColor:n(this.surfaceColor),navigationConstraint:n(this.navigationConstraint),layers:this.layers.slice()};return this.loaded&&(r.loadStatus="loaded"),new S({resourceInfo:this.resourceInfo}).set(r)}read(r,e){this.resourceInfo||this._set("resourceInfo",{data:r,context:e}),super.read(r,e)}_loadFromSource(r){const e=this.resourceInfo;return e?this._loadLayersFromJSON(e.data,e.context,r):Promise.resolve()}async _loadLayersFromJSON(r,e,o){const t=e&&e.origin||"web-scene",s=e&&e.portal||null,a=e&&e.url||null,{populateOperationalLayers:i}=await import("./layers/support/layersCreator.js");d(o);const n=[];if(r.layers&&Array.isArray(r.layers)){const e={context:{origin:t,url:a,portal:s,layerContainerType:"ground"},defaultLayerType:"ArcGISTiledElevationServiceLayer"};n.push(i(this.layers,r.layers,e))}await Promise.allSettled(n)}};function I(r){return r&&"createElevationSampler"in r}function L(r){return"elevation"===r.type||I(r)}r([m({json:{read:!1}})],C.prototype,"layers",null),r([g("layers")],C.prototype,"writeLayers",null),r([m({readOnly:!0})],C.prototype,"resourceInfo",void 0),r([m({type:Number,nonNullable:!0,range:{min:0,max:1},json:{type:f,read:{reader:j,source:"transparency"},write:{writer:(r,e)=>{e.transparency=w(r)},target:"transparency"}}})],C.prototype,"opacity",void 0),r([m({type:e,json:{type:[f],write:(r,e)=>{e.surfaceColor=r.toJSON().slice(0,3)}}})],C.prototype,"surfaceColor",void 0),r([m({type:v,json:{write:!0}})],C.prototype,"navigationConstraint",void 0),C=S=r([h("esri.Ground")],C);const b=C;export{b as default};
package/Map.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as s}from"./chunks/tslib.es6.js";import e from"./Basemap.js";import r from"./Ground.js";import t from"./core/Accessor.js";import o from"./core/CollectionFlattener.js";import a from"./core/Evented.js";import{property as i}from"./core/accessorSupport/decorators/property.js";import{cast as p}from"./core/accessorSupport/decorators/cast.js";import"./core/arrayUtils.js";import"./core/has.js";import{subclass as l}from"./core/accessorSupport/decorators/subclass.js";import{isEditableLayer as n}from"./layers/support/editableLayers.js";import{createCache as d,destroyCache as m,ensureType as c}from"./support/basemapUtils.js";import{createFlattenedTablesCollection as u}from"./support/collectionUtils.js";import{ensureType as y}from"./support/groundUtils.js";import{LayersMixin as h}from"./support/LayersMixin.js";import{TablesMixin as b}from"./support/TablesMixin.js";let f=class extends(b(h(a.EventedMixin(t)))){constructor(s){super(s),this.allLayers=new o({getCollections:()=>[this.basemap?.baseLayers,this.ground?.layers,this.layers,this.basemap?.referenceLayers],getChildrenFunction:s=>"layers"in s?s.layers:null}),this.allTables=u(this),this.basemap=null,this.editableLayers=new o({getCollections:()=>[this.allLayers],itemFilterFunction:n}),this.ground=new r,this._basemapCache=d()}destroy(){this.allLayers.destroy(),this.allTables.destroy(),this.editableLayers.destroy(),this.ground?.destroy(),this.basemap?.destroy(),m(this._basemapCache),this._basemapCache=null,this._set("ground",null),this.basemap=null}castBasemap(s){return c(s,this._basemapCache)}castGround(s){const e=y(s);return e??this._get("ground")}findLayerById(s){return this.allLayers.find((e=>e.id===s))}findTableById(s){return this.allTables.find((e=>e.id===s))}};s([i({readOnly:!0,dependsOn:[]})],f.prototype,"allLayers",void 0),s([i({readOnly:!0})],f.prototype,"allTables",void 0),s([i({type:e,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],f.prototype,"basemap",void 0),s([p("basemap")],f.prototype,"castBasemap",null),s([i({readOnly:!0})],f.prototype,"editableLayers",void 0),s([i({type:r,nonNullable:!0})],f.prototype,"ground",void 0),s([p("ground")],f.prototype,"castGround",null),f=s([l("esri.Map")],f);const j=f;export{j as default};
5
+ import{_ as s}from"./chunks/tslib.es6.js";import e from"./Basemap.js";import r from"./Ground.js";import t from"./core/Accessor.js";import o from"./core/CollectionFlattener.js";import a from"./core/Evented.js";import{destroyMaybe as i}from"./core/maybe.js";import{property as p}from"./core/accessorSupport/decorators/property.js";import{cast as l}from"./core/accessorSupport/decorators/cast.js";import"./core/arrayUtils.js";import"./core/has.js";import{subclass as n}from"./core/accessorSupport/decorators/subclass.js";import{isEditableLayer as m}from"./layers/support/editableLayers.js";import{createCache as d,destroyCache as c,ensureType as u}from"./support/basemapUtils.js";import{createFlattenedTablesCollection as y}from"./support/collectionUtils.js";import{ensureType as h}from"./support/groundUtils.js";import{LayersMixin as b}from"./support/LayersMixin.js";import{TablesMixin as f}from"./support/TablesMixin.js";let j=class extends(f(b(a.EventedMixin(t)))){constructor(s){super(s),this.allLayers=new o({getCollections:()=>[this.basemap?.baseLayers,this.ground?.layers,this.layers,this.basemap?.referenceLayers],getChildrenFunction:s=>"layers"in s?s.layers:null}),this.allTables=y(this),this.basemap=null,this.editableLayers=new o({getCollections:()=>[this.allLayers],itemFilterFunction:m}),this.ground=new r,this._basemapCache=d()}destroy(){c(this._basemapCache),this._basemapCache=null,this.allLayers.destroy(),this.allTables.destroy(),this.editableLayers.destroy(),this.basemap=i(this.basemap),i(this.ground),this._set("ground",null)}castBasemap(s){return u(s,this._basemapCache)}castGround(s){const e=h(s);return e??this._get("ground")}findLayerById(s){return this.allLayers.find((e=>e.id===s))}findTableById(s){return this.allTables.find((e=>e.id===s))}};s([p({readOnly:!0,dependsOn:[]})],j.prototype,"allLayers",void 0),s([p({readOnly:!0})],j.prototype,"allTables",void 0),s([p({type:e,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],j.prototype,"basemap",void 0),s([l("basemap")],j.prototype,"castBasemap",null),s([p({readOnly:!0})],j.prototype,"editableLayers",void 0),s([p({type:r,nonNullable:!0})],j.prototype,"ground",void 0),s([l("ground")],j.prototype,"castGround",null),j=s([n("esri.Map")],j);const g=j;export{g as default};
package/WebMap.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"./chunks/tslib.es6.js";import{version as t}from"./kernel.js";import r from"./Map.js";import i from"./Viewpoint.js";import{isSome as o}from"./core/arrayUtils.js";import s from"./core/Collection.js";import n from"./core/Error.js";import a from"./core/Loadable.js";import{loadAll as p}from"./core/loadAll.js";import l from"./core/Logger.js";import{MultiOriginJSONMixin as u}from"./core/MultiOriginJSONSupport.js";import{EsriPromiseMixin as m}from"./core/Promise.js";import{debounce as h}from"./core/promiseUtils.js";import{whenOnce as c}from"./core/reactiveUtils.js";import{addQueryParameter as d,isDataProtocol as g,dataComponents as f}from"./core/urlUtils.js";import{property as w}from"./core/accessorSupport/decorators/property.js";import"./core/accessorSupport/ensureType.js";import"./core/has.js";import{reader as b}from"./core/accessorSupport/decorators/reader.js";import{subclass as y}from"./core/accessorSupport/decorators/subclass.js";import{writer as A}from"./core/accessorSupport/decorators/writer.js";import{readLoadable as S}from"./core/accessorSupport/read.js";import v from"./geometry/SpatialReference.js";import _ from"./networks/UtilityNetwork.js";import j from"./portal/PortalItem.js";import{TypeKeyword as V}from"./portal/support/portalItemUtils.js";import I from"./support/MapFloorInfo.js";import U from"./webdoc/GeotriggersInfo.js";import{SaveOperationType as P}from"./webdoc/interfaces.js";import O from"./webdoc/RangeInfo.js";import{loadFromSource as L}from"./webdoc/webdocLoadUtils.js";import F from"./webdoc/Widgets.js";import{getOptimalThumbnailSize as k}from"./webdoc/support/thumbnailUtils.js";import{getLayerJSON as R}from"./webdoc/support/writeUtils.js";import N from"./webmap/ApplicationProperties.js";import T from"./webmap/Bookmark.js";import E from"./webmap/InitialViewProperties.js";import{Version as B}from"./webmap/Version.js";import J from"./webmap/background/ColorBackground.js";const x=new B(2,28),M="Web Map",Z="webmap",W="web-map",$=s.ofType(T),C=s.ofType(_),G=new Map([["image/jpeg","jpeg"],["image/jpg","jpg"],["image/png","png"],["image/gif","gif"]]),z="ArcGIS Pro",D=V.JSAPI,q={currentVersion:x,createInitialViewProperties:()=>new E,parseVersion:B.parse,itemType:M,name:Z,origin:W};let H=class extends(u(a.LoadableMixin(m(r)))){constructor(e){super(e),this._isAuthoringAppSetByUser=!1,this._isAuthoringAppVersionSetByUser=!1,this._thumbnailFilename=null,this._updateFromPromise=null,this.resourceReferences={portalItem:null,paths:[]},this.applicationProperties=null,this.bookmarks=new $,this.floorInfo=null,this.geotriggersInfo=null,this.initialViewProperties=new E,this.portalItem=null,this.presentation=null,this.sourceVersion=null,this.widgets=null,this.utilityNetworks=null,this._debouncedSaveOperations=h((async(e,t,r)=>{const{save:i,saveAs:o}=await import("./webdoc/webdocSaveUtils.js");switch(e){case P.SAVE:return i(q,this,t);case P.SAVE_AS:return o(q,this,r,t)}})),this.authoringApp=this.authoringAppVersion=null,this._isAuthoringAppSetByUser=this._isAuthoringAppVersionSetByUser=!1}destroy(){const e=this.portalItem;this.portalItem=null,e?.destroy()}initialize(){if(this.when().catch((e=>{l.getLogger(this).error("#load()","Failed to load web map",e)})),this.resourceInfo){let t;try{t=this._validateJSON(this.resourceInfo)}catch(e){return void this.addResolvingPromise(Promise.reject(e))}this.read(t)}}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,t){e&&this._isAuthoringAppSetByUser?t.authoringApp=e:t.authoringApp=D}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,r){e&&this._isAuthoringAppVersionSetByUser?r.authoringAppVersion=e:r.authoringAppVersion=t}readInitialViewProperties(e,t){const r=new E;t.background&&(r.background=J.fromJSON(t.background));const o=t.initialState?.viewpoint;if(o){if(o.rotation){B.parse(t.version||"","webmap").lessThan(2,20)&&t.authoringApp===z&&(o.rotation*=-1)}r.viewpoint=i.fromJSON(o)}return t.mapRangeInfo&&(r.rangeInfo=O.fromJSON(t.mapRangeInfo)),t.spatialReference&&(r.spatialReference=v.fromJSON(t.spatialReference)),t.timeZone&&(r.timeZone=t.timeZone),r}writeInitialViewProperties(e,t,r,i){e&&(e.background?.color&&(t.background=e.background.write({},i)),e.viewpoint&&(t.initialState={viewpoint:e.viewpoint.write({},i)}),e.rangeInfo&&(t.mapRangeInfo=e.rangeInfo.toJSON(i)),e.spatialReference&&(t.spatialReference=e.spatialReference.write({},i)),t.timeZone=e.timeZone)}writeLayers(e,t,r,i){t[r]=this._writeLayers(e,i,"operational-layers")}readSourceVersion(e,t){const[r,i]=t.version.split(".");return new B(parseInt(r,10),parseInt(i,10))}writeSourceVersion(e,t,r){t[r]=`${x.major}.${x.minor}`}writeTables(e,t,r,i){const o=this._writeLayers(e,i,"tables");o.length&&(t[r]=o)}get thumbnailUrl(){return this.portalItem&&this.portalItem.thumbnailUrl||null}set thumbnailUrl(e){e?(this._override("thumbnailUrl",e),this._thumbnailFilename=this._generateCustomThumbnailFilename(e)):this._clearThumbnailOverride()}get updatingFromView(){return!!this._updateFromPromise}load(e){return this.addResolvingPromise(L(q,this)),Promise.resolve(this)}loadAll(){return p(this,(e=>{e(this.ground,this.basemap,this.layers,this.tables)}))}read(e,t){t={...t,origin:W};const r=this._getAuthoringPropsState();S(this,e,(t=>super.read(e,t)),t),this._restoreAuthoringPropsFromState(r)}write(e,t){if("loaded"!==this.loadStatus){const e=new n("webmap:not-loaded","Web map must be loaded before it can be serialized");throw l.getLogger(this).error("#toJSON()","Web map must be loaded before it can be serialized",this.loadError||this.loadStatus),e}return this._removeDanglingLayerRefs(),t={...t,origin:W,restrictedWebMapWriting:!0,webmap:this},super.write(e,t)}async save(e){return this._debouncedSaveOperations(P.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(P.SAVE_AS,t,e)}async updateFrom(e,t){const r=this._updateFromInternal(e,t);this._updateFromPromise=r,await r;r===this._updateFromPromise&&(this._updateFromPromise=null)}getLayerJSONFromResourceInfo(e){const t=this.resourceInfo;return this._collectAllLayersJSON([...t?.baseMap?.baseMapLayers||[],...t?.operationalLayers||[],...this.basemap?.resourceInfo?.data?.baseMapLayers||[]]).find((t=>t.id===e.id))}async updateItemThumbnail(){this.thumbnailUrl&&this._isOverridden("thumbnailUrl")&&(await(this.portalItem?.updateThumbnail({thumbnail:this.thumbnailUrl,filename:this._thumbnailFilename})),this._clearThumbnailOverride())}getThumbnailState(){let e=this.thumbnailUrl;return e&&(e=this._isOverridden("thumbnailUrl")?e:d(e,"w","8192")),{thumbnailUrl:e,filename:this._thumbnailFilename}}restoreThumbnailFromState(e){this.thumbnailUrl=e.thumbnailUrl,this._thumbnailFilename=e.filename}_collectAllLayersJSON(e){return e.reduce(((e,t)=>(e.push(t),"GroupLayer"===t.layerType&&(e=e.concat(this._collectAllLayersJSON(t.layers||[]))),e)),[])}_writeLayers(e,t,r){t={...t,layerContainerType:r};return e.map((e=>R(e,"tables"===r?null:this.getLayerJSONFromResourceInfo(e),t))).filter(o).toArray()}_validateJSON(e){const t=B.parse(e.version||"","webmap");return x.validate(t),e.version=`${t.major}.${t.minor}`,e}_removeDanglingLayerRefs(){const e=this.applicationProperties,t=e&&e.viewing&&e.viewing.search,r=e=>this.allLayers.some((t=>t.id===e));t&&t.layers&&(t.layers=t.layers.filter((e=>r(e.id)))),t&&t.tables&&(t.tables=t.tables.filter((e=>this.tables.some((t=>t.id===e.id)))));const i=e&&e.editing&&e.editing.locationTracking;i&&i.info&&!r(i.info.layerId)&&(e.editing=null);const o=this.presentation&&this.presentation.slides;o&&o.forEach((e=>{e.visibleLayers&&(e.visibleLayers=e.visibleLayers.filter((e=>r(e.id))))}))}async _updateFromInternal(e,t){if(t??={},await c((()=>e.ready)),this._updateInitialViewProperties(e,t),e.map===this)for(const r of e.allLayerViews)"visible"in r&&"visible"in r.layer&&r._isOverridden("visible")&&(r.layer.visible=r.visible),"featureEffect"in r&&"featureEffect"in r.layer&&r._isOverridden("featureEffect")&&(r.layer.featureEffect=r.featureEffect);await this._updateThumbnailUrl(e,t)}_updateInitialViewProperties(e,t){if(t.backgroundExcluded||(this.initialViewProperties.background=e.background?.clone()),this.initialViewProperties.spatialReference=e.spatialReference?.clone(),this.initialViewProperties.timeZone=e.timeZone,t.viewpointExcluded||(this.initialViewProperties.viewpoint=new i({rotation:e.rotation,scale:t.scalePreserved?e.scale:null,targetGeometry:this._getViewExtent(e)})),!t.widgetsExcluded)for(const r of e.persistableViewModels)r.updateWebDocument(this)}_getViewExtent(e){const t=e.center.clone().normalize(),r=e.extent.clone(),i=r.width/2;return r.xmin=t.x-i,r.xmax=t.x+i,r}async _updateThumbnailUrl(e,t){if(t.thumbnailExcluded)return;const r=k(e,t.thumbnailSize),i=await e.takeScreenshot({format:"png",width:r.width,height:r.height});this._setAutoGeneratedThumbnail(i.dataUrl)}_setAutoGeneratedThumbnail(e){this.thumbnailUrl=e,this._thumbnailFilename=null}_clearThumbnailOverride(){this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"),this._thumbnailFilename=null}_generateCustomThumbnailFilename(e){if(g(e)){const t=f(e),r=t&&t.mediaType,i=r&&G.get(r.toLowerCase())||null,o=`thumbnail${Date.now()}`;return i?`${o}.${i}`:o}return null}_getAuthoringPropsState(){return{authoringApp:this.authoringApp,authoringAppVersion:this.authoringAppVersion,isAuthoringAppSetByUser:this._isAuthoringAppSetByUser,isAuthoringAppVersionSetByUser:this._isAuthoringAppVersionSetByUser}}_restoreAuthoringPropsFromState(e){e.isAuthoringAppSetByUser?this.authoringApp=e.authoringApp:this._isAuthoringAppSetByUser=!1,e.isAuthoringAppVersionSetByUser?this.authoringAppVersion=e.authoringAppVersion:this._isAuthoringAppVersionSetByUser=!1}static fromJSON(e){const t=e;if(!t)throw new n("webmap:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:t})}};H.VERSION=x,e([w()],H.prototype,"_updateFromPromise",void 0),e([w({type:N,json:{write:!0}})],H.prototype,"applicationProperties",void 0),e([w({type:String,json:{write:{allowNull:!0,ignoreOrigin:!0}}})],H.prototype,"authoringApp",null),e([A("authoringApp")],H.prototype,"writeAuthoringApp",null),e([w({type:String,json:{write:{allowNull:!0,ignoreOrigin:!0}}})],H.prototype,"authoringAppVersion",null),e([A("authoringAppVersion")],H.prototype,"writeAuthoringAppVersion",null),e([w({type:$,json:{write:{overridePolicy:e=>({enabled:!!(e&&e.length>0),ignoreOrigin:!0})}}})],H.prototype,"bookmarks",void 0),e([w({type:I,json:{name:"mapFloorInfo",write:!0}})],H.prototype,"floorInfo",void 0),e([w({type:U,json:{write:!0}})],H.prototype,"geotriggersInfo",void 0),e([w({type:E,nonNullable:!0,json:{read:{source:["background","initialState.viewpoint","mapRangeInfo","spatialReference","timeZone"]},write:{ignoreOrigin:!0,target:{background:{type:J},"initialState.viewpoint":{type:i},mapRangeInfo:{type:O},spatialReference:{type:v},"timeZone:":{type:String}}}}})],H.prototype,"initialViewProperties",void 0),e([b("initialViewProperties")],H.prototype,"readInitialViewProperties",null),e([A("initialViewProperties")],H.prototype,"writeInitialViewProperties",null),e([w({json:{read:!1,write:{target:"operationalLayers",ignoreOrigin:!0}}})],H.prototype,"layers",void 0),e([A("layers")],H.prototype,"writeLayers",null),e([w({type:j})],H.prototype,"portalItem",void 0),e([w({json:{write:!0}})],H.prototype,"presentation",void 0),e([w()],H.prototype,"resourceInfo",void 0),e([w({readOnly:!0,type:B,json:{read:{source:"version"},write:{allowNull:!0,ignoreOrigin:!0,target:"version",isRequired:!0}}})],H.prototype,"sourceVersion",void 0),e([b("sourceVersion")],H.prototype,"readSourceVersion",null),e([A("sourceVersion")],H.prototype,"writeSourceVersion",null),e([w({json:{read:!1,write:{ignoreOrigin:!0}}})],H.prototype,"tables",void 0),e([A("tables")],H.prototype,"writeTables",null),e([w()],H.prototype,"thumbnailUrl",null),e([w()],H.prototype,"updatingFromView",null),e([w({type:F,json:{write:!0}})],H.prototype,"widgets",void 0),e([w({type:C,json:{read:!0,write:!0}})],H.prototype,"utilityNetworks",void 0),H=e([y("esri.WebMap")],H);const K=H;export{K as default};
5
+ import{_ as e}from"./chunks/tslib.es6.js";import{version as t}from"./kernel.js";import r from"./Map.js";import i from"./Viewpoint.js";import{isSome as o}from"./core/arrayUtils.js";import s from"./core/Collection.js";import n from"./core/Error.js";import a from"./core/Loadable.js";import{loadAll as p}from"./core/loadAll.js";import l from"./core/Logger.js";import{destroyMaybe as u}from"./core/maybe.js";import{MultiOriginJSONMixin as m}from"./core/MultiOriginJSONSupport.js";import{EsriPromiseMixin as h}from"./core/Promise.js";import{debounce as c}from"./core/promiseUtils.js";import{whenOnce as d}from"./core/reactiveUtils.js";import{addQueryParameter as g,isDataProtocol as f,dataComponents as w}from"./core/urlUtils.js";import{property as y}from"./core/accessorSupport/decorators/property.js";import"./core/accessorSupport/ensureType.js";import"./core/has.js";import{reader as b}from"./core/accessorSupport/decorators/reader.js";import{subclass as A}from"./core/accessorSupport/decorators/subclass.js";import{writer as S}from"./core/accessorSupport/decorators/writer.js";import{readLoadable as v}from"./core/accessorSupport/read.js";import _ from"./geometry/SpatialReference.js";import j from"./networks/UtilityNetwork.js";import V from"./portal/PortalItem.js";import{TypeKeyword as I}from"./portal/support/portalItemUtils.js";import U from"./support/MapFloorInfo.js";import P from"./webdoc/GeotriggersInfo.js";import{SaveOperationType as O}from"./webdoc/interfaces.js";import k from"./webdoc/RangeInfo.js";import{loadFromSource as L}from"./webdoc/webdocLoadUtils.js";import F from"./webdoc/Widgets.js";import{getOptimalThumbnailSize as N}from"./webdoc/support/thumbnailUtils.js";import{getLayerJSON as R}from"./webdoc/support/writeUtils.js";import T from"./webmap/ApplicationProperties.js";import E from"./webmap/Bookmark.js";import B from"./webmap/InitialViewProperties.js";import{Version as J}from"./webmap/Version.js";import x from"./webmap/background/ColorBackground.js";const M=new J(2,28),Z="Web Map",W="webmap",$="web-map",C=s.ofType(E),G=s.ofType(j),z=new Map([["image/jpeg","jpeg"],["image/jpg","jpg"],["image/png","png"],["image/gif","gif"]]),D="ArcGIS Pro",q=I.JSAPI,H={currentVersion:M,createInitialViewProperties:()=>new B,parseVersion:J.parse,itemType:Z,name:W,origin:$};let K=class extends(m(a.LoadableMixin(h(r)))){constructor(e){super(e),this._isAuthoringAppSetByUser=!1,this._isAuthoringAppVersionSetByUser=!1,this._thumbnailFilename=null,this._updateFromPromise=null,this.resourceReferences={portalItem:null,paths:[]},this.applicationProperties=null,this.bookmarks=new C,this.floorInfo=null,this.geotriggersInfo=null,this.initialViewProperties=new B,this.portalItem=null,this.presentation=null,this.sourceVersion=null,this.widgets=null,this.utilityNetworks=null,this._debouncedSaveOperations=c((async(e,t,r)=>{const{save:i,saveAs:o}=await import("./webdoc/webdocSaveUtils.js");switch(e){case O.SAVE:return i(H,this,t);case O.SAVE_AS:return o(H,this,r,t)}})),this.authoringApp=this.authoringAppVersion=null,this._isAuthoringAppSetByUser=this._isAuthoringAppVersionSetByUser=!1}destroy(){if(this.portalItem=u(this.portalItem),this.utilityNetworks){const e=this.utilityNetworks.removeAll();for(const t of e)t.destroy();this.utilityNetworks.destroy()}}initialize(){if(this.when().catch((e=>{l.getLogger(this).error("#load()","Failed to load web map",e)})),this.resourceInfo){let t;try{t=this._validateJSON(this.resourceInfo)}catch(e){return void this.addResolvingPromise(Promise.reject(e))}this.read(t)}}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,t){e&&this._isAuthoringAppSetByUser?t.authoringApp=e:t.authoringApp=q}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,r){e&&this._isAuthoringAppVersionSetByUser?r.authoringAppVersion=e:r.authoringAppVersion=t}readInitialViewProperties(e,t){const r=new B;t.background&&(r.background=x.fromJSON(t.background));const o=t.initialState?.viewpoint;if(o){if(o.rotation){J.parse(t.version||"","webmap").lessThan(2,20)&&t.authoringApp===D&&(o.rotation*=-1)}r.viewpoint=i.fromJSON(o)}return t.mapRangeInfo&&(r.rangeInfo=k.fromJSON(t.mapRangeInfo)),t.spatialReference&&(r.spatialReference=_.fromJSON(t.spatialReference)),t.timeZone&&(r.timeZone=t.timeZone),r}writeInitialViewProperties(e,t,r,i){e&&(e.background?.color&&(t.background=e.background.write({},i)),e.viewpoint&&(t.initialState={viewpoint:e.viewpoint.write({},i)}),e.rangeInfo&&(t.mapRangeInfo=e.rangeInfo.toJSON(i)),e.spatialReference&&(t.spatialReference=e.spatialReference.write({},i)),t.timeZone=e.timeZone)}writeLayers(e,t,r,i){t[r]=this._writeLayers(e,i,"operational-layers")}readSourceVersion(e,t){const[r,i]=t.version.split(".");return new J(parseInt(r,10),parseInt(i,10))}writeSourceVersion(e,t,r){t[r]=`${M.major}.${M.minor}`}writeTables(e,t,r,i){const o=this._writeLayers(e,i,"tables");o.length&&(t[r]=o)}get thumbnailUrl(){return this.portalItem&&this.portalItem.thumbnailUrl||null}set thumbnailUrl(e){e?(this._override("thumbnailUrl",e),this._thumbnailFilename=this._generateCustomThumbnailFilename(e)):this._clearThumbnailOverride()}get updatingFromView(){return!!this._updateFromPromise}load(e){return this.addResolvingPromise(L(H,this)),Promise.resolve(this)}loadAll(){return p(this,(e=>{e(this.ground,this.basemap,this.layers,this.tables)}))}read(e,t){t={...t,origin:$};const r=this._getAuthoringPropsState();v(this,e,(t=>super.read(e,t)),t),this._restoreAuthoringPropsFromState(r)}write(e,t){if("loaded"!==this.loadStatus){const e=new n("webmap:not-loaded","Web map must be loaded before it can be serialized");throw l.getLogger(this).error("#toJSON()","Web map must be loaded before it can be serialized",this.loadError||this.loadStatus),e}return this._removeDanglingLayerRefs(),t={...t,origin:$,restrictedWebMapWriting:!0,webmap:this},super.write(e,t)}async save(e){return this._debouncedSaveOperations(O.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(O.SAVE_AS,t,e)}async updateFrom(e,t){const r=this._updateFromInternal(e,t);this._updateFromPromise=r,await r;r===this._updateFromPromise&&(this._updateFromPromise=null)}getLayerJSONFromResourceInfo(e){const t=this.resourceInfo;return this._collectAllLayersJSON([...t?.baseMap?.baseMapLayers||[],...t?.operationalLayers||[],...this.basemap?.resourceInfo?.data?.baseMapLayers||[]]).find((t=>t.id===e.id))}async updateItemThumbnail(){this.thumbnailUrl&&this._isOverridden("thumbnailUrl")&&(await(this.portalItem?.updateThumbnail({thumbnail:this.thumbnailUrl,filename:this._thumbnailFilename})),this._clearThumbnailOverride())}getThumbnailState(){let e=this.thumbnailUrl;return e&&(e=this._isOverridden("thumbnailUrl")?e:g(e,"w","8192")),{thumbnailUrl:e,filename:this._thumbnailFilename}}restoreThumbnailFromState(e){this.thumbnailUrl=e.thumbnailUrl,this._thumbnailFilename=e.filename}_collectAllLayersJSON(e){return e.reduce(((e,t)=>(e.push(t),"GroupLayer"===t.layerType&&(e=e.concat(this._collectAllLayersJSON(t.layers||[]))),e)),[])}_writeLayers(e,t,r){t={...t,layerContainerType:r};return e.map((e=>R(e,"tables"===r?null:this.getLayerJSONFromResourceInfo(e),t))).filter(o).toArray()}_validateJSON(e){const t=J.parse(e.version||"","webmap");return M.validate(t),e.version=`${t.major}.${t.minor}`,e}_removeDanglingLayerRefs(){const e=this.applicationProperties,t=e&&e.viewing&&e.viewing.search,r=e=>this.allLayers.some((t=>t.id===e));t&&t.layers&&(t.layers=t.layers.filter((e=>r(e.id)))),t&&t.tables&&(t.tables=t.tables.filter((e=>this.tables.some((t=>t.id===e.id)))));const i=e&&e.editing&&e.editing.locationTracking;i&&i.info&&!r(i.info.layerId)&&(e.editing=null);const o=this.presentation&&this.presentation.slides;o&&o.forEach((e=>{e.visibleLayers&&(e.visibleLayers=e.visibleLayers.filter((e=>r(e.id))))}))}async _updateFromInternal(e,t){if(t??={},await d((()=>e.ready)),this._updateInitialViewProperties(e,t),e.map===this)for(const r of e.allLayerViews)"visible"in r&&"visible"in r.layer&&r._isOverridden("visible")&&(r.layer.visible=r.visible),"featureEffect"in r&&"featureEffect"in r.layer&&r._isOverridden("featureEffect")&&(r.layer.featureEffect=r.featureEffect);await this._updateThumbnailUrl(e,t)}_updateInitialViewProperties(e,t){if(t.backgroundExcluded||(this.initialViewProperties.background=e.background?.clone()),this.initialViewProperties.spatialReference=e.spatialReference?.clone(),this.initialViewProperties.timeZone=e.timeZone,t.viewpointExcluded||(this.initialViewProperties.viewpoint=new i({rotation:e.rotation,scale:t.scalePreserved?e.scale:null,targetGeometry:this._getViewExtent(e)})),!t.widgetsExcluded)for(const r of e.persistableViewModels)r.updateWebDocument(this)}_getViewExtent(e){const t=e.center.clone().normalize(),r=e.extent.clone(),i=r.width/2;return r.xmin=t.x-i,r.xmax=t.x+i,r}async _updateThumbnailUrl(e,t){if(t.thumbnailExcluded)return;const r=N(e,t.thumbnailSize),i=await e.takeScreenshot({format:"png",width:r.width,height:r.height});this._setAutoGeneratedThumbnail(i.dataUrl)}_setAutoGeneratedThumbnail(e){this.thumbnailUrl=e,this._thumbnailFilename=null}_clearThumbnailOverride(){this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"),this._thumbnailFilename=null}_generateCustomThumbnailFilename(e){if(f(e)){const t=w(e),r=t&&t.mediaType,i=r&&z.get(r.toLowerCase())||null,o=`thumbnail${Date.now()}`;return i?`${o}.${i}`:o}return null}_getAuthoringPropsState(){return{authoringApp:this.authoringApp,authoringAppVersion:this.authoringAppVersion,isAuthoringAppSetByUser:this._isAuthoringAppSetByUser,isAuthoringAppVersionSetByUser:this._isAuthoringAppVersionSetByUser}}_restoreAuthoringPropsFromState(e){e.isAuthoringAppSetByUser?this.authoringApp=e.authoringApp:this._isAuthoringAppSetByUser=!1,e.isAuthoringAppVersionSetByUser?this.authoringAppVersion=e.authoringAppVersion:this._isAuthoringAppVersionSetByUser=!1}static fromJSON(e){const t=e;if(!t)throw new n("webmap:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:t})}};K.VERSION=M,e([y()],K.prototype,"_updateFromPromise",void 0),e([y({type:T,json:{write:!0}})],K.prototype,"applicationProperties",void 0),e([y({type:String,json:{write:{allowNull:!0,ignoreOrigin:!0}}})],K.prototype,"authoringApp",null),e([S("authoringApp")],K.prototype,"writeAuthoringApp",null),e([y({type:String,json:{write:{allowNull:!0,ignoreOrigin:!0}}})],K.prototype,"authoringAppVersion",null),e([S("authoringAppVersion")],K.prototype,"writeAuthoringAppVersion",null),e([y({type:C,json:{write:{overridePolicy:e=>({enabled:!!(e&&e.length>0),ignoreOrigin:!0})}}})],K.prototype,"bookmarks",void 0),e([y({type:U,json:{name:"mapFloorInfo",write:!0}})],K.prototype,"floorInfo",void 0),e([y({type:P,json:{write:!0}})],K.prototype,"geotriggersInfo",void 0),e([y({type:B,nonNullable:!0,json:{read:{source:["background","initialState.viewpoint","mapRangeInfo","spatialReference","timeZone"]},write:{ignoreOrigin:!0,target:{background:{type:x},"initialState.viewpoint":{type:i},mapRangeInfo:{type:k},spatialReference:{type:_},"timeZone:":{type:String}}}}})],K.prototype,"initialViewProperties",void 0),e([b("initialViewProperties")],K.prototype,"readInitialViewProperties",null),e([S("initialViewProperties")],K.prototype,"writeInitialViewProperties",null),e([y({json:{read:!1,write:{target:"operationalLayers",ignoreOrigin:!0}}})],K.prototype,"layers",void 0),e([S("layers")],K.prototype,"writeLayers",null),e([y({type:V})],K.prototype,"portalItem",void 0),e([y({json:{write:!0}})],K.prototype,"presentation",void 0),e([y()],K.prototype,"resourceInfo",void 0),e([y({readOnly:!0,type:J,json:{read:{source:"version"},write:{allowNull:!0,ignoreOrigin:!0,target:"version",isRequired:!0}}})],K.prototype,"sourceVersion",void 0),e([b("sourceVersion")],K.prototype,"readSourceVersion",null),e([S("sourceVersion")],K.prototype,"writeSourceVersion",null),e([y({json:{read:!1,write:{ignoreOrigin:!0}}})],K.prototype,"tables",void 0),e([S("tables")],K.prototype,"writeTables",null),e([y()],K.prototype,"thumbnailUrl",null),e([y()],K.prototype,"updatingFromView",null),e([y({type:F,json:{write:!0}})],K.prototype,"widgets",void 0),e([y({type:G,json:{read:!0,write:!0}})],K.prototype,"utilityNetworks",void 0),K=e([A("esri.WebMap")],K);const Q=K;export{Q as default};