@arcgis/core 4.29.0-next.20240207 → 4.29.0-next.20240210
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/{db5d1ec51bddcec1dec8.js → 02a6c43ec17e7223fac5.js} +1 -1
- package/assets/esri/core/workers/chunks/0450120c957dd8adb617.js +1 -0
- package/assets/esri/core/workers/chunks/{fd01eb8839fffa40f95b.js → 062629a9b4695dea8bf8.js} +1 -1
- package/assets/esri/core/workers/chunks/{04031437e7ce5ba9258f.js → 0b47d27d3a716509b873.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d4cef378e27c7a47987.js → 2b7513fe57eca6cff7c3.js} +1 -1
- package/assets/esri/core/workers/chunks/3f4d63436c3de04a6ebb.js +1 -0
- package/assets/esri/core/workers/chunks/{1bfb414bb8f78dd0672f.js → 51eb8df0b189ef5e2ab7.js} +1 -1
- package/assets/esri/core/workers/chunks/655f4560fb36a0d9ff0b.js +1 -0
- package/assets/esri/core/workers/chunks/{f5e2fba0108ea09d3aa5.js → ada5d6fd70bd3e403442.js} +1 -1
- package/assets/esri/core/workers/chunks/{574bf3cea928c6c3076c.js → af0314c2b5b7dc4f5bbd.js} +1 -1
- package/assets/esri/core/workers/chunks/{372bf585d56d1c6b9708.js → b2b8e6a0b3f70ada2799.js} +1 -1
- package/assets/esri/core/workers/chunks/{cbe53647f85905b063a8.js → b95d69d84d60ac9828b9.js} +1 -1
- package/assets/esri/core/workers/chunks/{a0af95b4b9698307426f.js → d2417d179d015f1193a1.js} +1 -1
- package/assets/esri/core/workers/chunks/{c2eae9ae4cd45fd7d42f.js → ddc71fe66c7a49082920.js} +1 -1
- package/assets/esri/core/workers/chunks/{c34493011f8148c43d32.js → eba72ff1726ff6998204.js} +1 -1
- package/assets/esri/core/workers/chunks/f75ec599f53c66cab194.js +1 -0
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/assets/esri/themes/base/_mixins.scss +15 -0
- package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +8 -1
- package/assets/esri/themes/base/widgets/_Features.scss +8 -0
- package/assets/esri/themes/base/widgets/_LayerList.scss +8 -1
- package/assets/esri/themes/base/widgets/_Popup.scss +8 -1
- package/assets/esri/themes/base/widgets/_TableList.scss +6 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/lyr3DMain.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/form/elements/FieldElement.js +1 -1
- package/geometry/Mesh.js +1 -1
- package/geometry/support/meshErrors.js +1 -1
- package/geometry/support/meshUtils/geographicUtils.js +1 -1
- package/interfaces.d.ts +203 -92
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/MediaLayer.js +1 -1
- package/layers/orientedImagery/transformations/groundToImageUtils.js +1 -1
- package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/support/EditingCapabilities.js +1 -1
- package/layers/support/MediaElementBase.js +1 -1
- package/networks/Network.js +1 -1
- package/package.json +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/cim/CIMSymbolHelper.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/support/previewSymbol2D.js +1 -1
- package/symbols/support/symbolUtils.js +1 -1
- package/symbols/support/utils.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/Utils.js +1 -1
- package/views/2d/engine/webgl/mesh/MultiTileMeshData.js +1 -1
- package/views/2d/engine/webgl/mesh/factories/ResourceProxy.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/DisplayIdGenerator.js +1 -1
- package/views/2d/layers/features/support/GraphicsReader.js +1 -1
- package/views/2d/layers/graphics/GraphicStore.js +1 -1
- package/views/3d/interactive/editingTools/geometryUtils.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/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/support/automaticLengthMeasurementUtils.js +1 -1
- package/views/support/extentUtils.js +5 -0
- package/views/support/geometry3dUtils.js +1 -1
- package/webdoc/support/webdocSaveUtils.js +1 -1
- package/widgets/Attribution/AttributionViewModel.js +1 -1
- package/widgets/BasemapLayerList/BasemapLayerListViewModel.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflowData.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflowData.js +1 -1
- package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflowData.js +1 -1
- package/widgets/Editor/support/EditorEditingCapabilities.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/FieldInput.js +1 -1
- package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/LayerList/LayerListViewModel.js +1 -1
- package/widgets/LayerList/support/layerListUtils.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Locate.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/symbols.js +1 -1
- package/widgets/PanoramicViewer/utils.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/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/TableList/TableListViewModel.js +1 -1
- package/widgets/TableList/TableListVisibleElements.js +1 -1
- package/widgets/TableList/css.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/Track.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/assets/esri/core/workers/chunks/0a6e1da8576a6fdcd8ad.js +0 -1
- package/assets/esri/core/workers/chunks/0a91f639039b9d304d92.js +0 -1
- package/assets/esri/core/workers/chunks/2c8f43e3e469edfe7e74.js +0 -1
- package/assets/esri/core/workers/chunks/a8129ae34e9ddfc644dc.js +0 -1
- package/assets/esri/core/workers/chunks/d3a4c582d76500136924.js +0 -1
- package/geometry/support/meshUtils/offset.js +0 -5
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};
|