@arcgis/core 4.29.0-next.20240209 → 4.29.0-next.20240212
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.
- package/WebMap.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/00b9e92f8df245a83921.js +1 -0
- package/assets/esri/core/workers/chunks/{5d4cef378e27c7a47987.js → 2b7513fe57eca6cff7c3.js} +1 -1
- package/assets/esri/core/workers/chunks/2d682ee6e5d66f2ea5cd.js +1 -0
- package/assets/esri/core/workers/chunks/{655f4560fb36a0d9ff0b.js → 360abf95067327819dd3.js} +1 -1
- package/assets/esri/core/workers/chunks/{d5484d470121de2b403b.js → 36d091be859bbb1a149b.js} +1 -1
- package/assets/esri/core/workers/chunks/50b41f91be903a0977f9.js +1 -0
- package/assets/esri/core/workers/chunks/{0014635097a32ad38895.js → a854611d1a86b838c6ad.js} +1 -1
- package/assets/esri/core/workers/chunks/{b2b8e6a0b3f70ada2799.js → e4da908079417cc2f495.js} +1 -1
- package/assets/esri/core/workers/chunks/{eba72ff1726ff6998204.js → f03d62ab7806b68d0b62.js} +1 -1
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/interfaces.d.ts +3 -3
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/MediaLayer.js +1 -1
- package/layers/support/MediaElementBase.js +1 -1
- package/package.json +1 -1
- package/portal/support/resourceUtils.js +1 -1
- package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
- package/smartMapping/renderers/dotDensity.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerBinningAdapter.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/previewSymbol2D.js +1 -1
- package/symbols/support/utils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ExtentScale.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/extentUtils.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/support/automaticLengthMeasurementUtils.js +1 -1
- package/views/support/extentUtils.js +5 -0
- package/webdoc/support/webdocSaveUtils.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/Print/CustomTemplate.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print.js +1 -1
- package/assets/esri/core/workers/chunks/0a6e1da8576a6fdcd8ad.js +0 -1
- package/assets/esri/core/workers/chunks/5bfc5ffad705aaaafcd4.js +0 -1
- package/assets/esri/core/workers/chunks/b927b655e955abe00d48.js +0 -1
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.29/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{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/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 L from"./webdoc/Widgets.js";import{getOptimalThumbnailSize as F}from"./webdoc/support/thumbnailUtils.js";import{loadFromSource as N}from"./webdoc/support/webdocLoadUtils.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,30),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/support/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?.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(N(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?.viewing?.search,r=e=>this.allLayers.some((t=>t.id===e));if(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))))),e){const t=e.editing?.locationTracking;t?.info&&!r(t.info.layerId)&&(e.editing=null)}const i=this.presentation?.slides;i&&i.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=F(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?.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:L,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};
|
|
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/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 L from"./webdoc/Widgets.js";import{getOptimalThumbnailSize as F}from"./webdoc/support/thumbnailUtils.js";import{loadFromSource as N}from"./webdoc/support/webdocLoadUtils.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,30),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.ipsInfo=null,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/support/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?.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(N(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?.viewing?.search,r=e=>this.allLayers.some((t=>t.id===e));if(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))))),e){const t=e.editing?.locationTracking;t?.info&&!r(t.info.layerId)&&(e.editing=null)}const i=this.presentation?.slides;i&&i.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=F(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?.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:{write:!0,name:"mapIPSInfo"}})],K.prototype,"ipsInfo",void 0),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:L,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};
|