@arcgis/core 4.28.1 → 4.28.2
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{6867ed1860afb7aac536.js → b8f3a1d887c9e054feaa.js} +1 -1
- package/assets/esri/core/workers/chunks/f520f093aa81d8ee1790.js +1 -0
- package/interfaces.d.ts +2 -2
- package/kernel.js +1 -1
- package/layers/support/LayerContingentValuesCache.js +1 -1
- package/layers/support/vectorTileLayerLoader.js +1 -1
- package/package.json +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/support/revision.js +1 -1
- package/versionManagement/VersionManagementService.js +1 -1
- package/views/2d/engine/vectorTiles/TileManager.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/assets/esri/core/workers/chunks/3ac9001b19a90faf5573.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5481],{92835:(t,e,r)=>{r.d(e,{Z:()=>y});var i,s=r(43697),o=r(96674),l=r(35463),n=r(5600),a=(r(75215),r(67676),r(80442),r(71715)),u=r(52011),h=r(30556),c=r(25031);let p=i=class extends o.wq{static get allTime(){return d}static get empty(){return f}constructor(t){super(t),this.end=null,this.start=null}readEnd(t,e){return null!=e.end?new Date(e.end):null}writeEnd(t,e){e.end=t?.getTime()??null}get isAllTime(){return this.equals(i.allTime)}get isEmpty(){return this.equals(i.empty)}readStart(t,e){return null!=e.start?new Date(e.start):null}writeStart(t,e){e.start=t?.getTime()??null}clone(){return new i({end:this.end,start:this.start})}equals(t){if(!t)return!1;const e=this.start?.getTime()??this.start,r=this.end?.getTime()??this.end,i=t.start?.getTime()??t.start,s=t.end?.getTime()??t.end;return e===i&&r===s}expandTo(t,e=c.By){if(this.isEmpty||this.isAllTime)return this.clone();let r=this.start;r&&(r=(0,l.JE)(r,t,e));let s=this.end;if(s){const r=(0,l.JE)(s,t,e);s=s.getTime()===r.getTime()?r:(0,l.Nm)(r,1,t,e)}return new i({start:r,end:s})}intersection(t){if(!t)return this.clone();if(this.isEmpty||t.isEmpty)return i.empty;if(this.isAllTime)return t.clone();if(t.isAllTime)return this.clone();const e=this.start?.getTime()??-1/0,r=this.end?.getTime()??1/0,s=t.start?.getTime()??-1/0,o=t.end?.getTime()??1/0;let l,n;if(s>=e&&s<=r?l=s:e>=s&&e<=o&&(l=e),r>=s&&r<=o?n=r:o>=e&&o<=r&&(n=o),null!=l&&null!=n&&!isNaN(l)&&!isNaN(n)){const t=new i;return t.start=l===-1/0?null:new Date(l),t.end=n===1/0?null:new Date(n),t}return i.empty}offset(t,e,r=c.By){if(this.isEmpty||this.isAllTime)return this.clone();const s=new i,{start:o,end:n}=this;return null!=o&&(s.start=(0,l.Nm)(o,t,e,r)),null!=n&&(s.end=(0,l.Nm)(n,t,e,r)),s}union(t){if(!t||t.isEmpty)return this.clone();if(this.isEmpty)return t.clone();if(this.isAllTime||t.isAllTime)return d.clone();const e=null!=this.start&&null!=t.start?new Date(Math.min(this.start.getTime(),t.start.getTime())):null,r=null!=this.end&&null!=t.end?new Date(Math.max(this.end.getTime(),t.end.getTime())):null;return new i({start:e,end:r})}};(0,s._)([(0,n.Cb)({type:Date,json:{write:{allowNull:!0}}})],p.prototype,"end",void 0),(0,s._)([(0,a.r)("end")],p.prototype,"readEnd",null),(0,s._)([(0,h.c)("end")],p.prototype,"writeEnd",null),(0,s._)([(0,n.Cb)({readOnly:!0,json:{read:!1}})],p.prototype,"isAllTime",null),(0,s._)([(0,n.Cb)({readOnly:!0,json:{read:!1}})],p.prototype,"isEmpty",null),(0,s._)([(0,n.Cb)({type:Date,json:{write:{allowNull:!0}}})],p.prototype,"start",void 0),(0,s._)([(0,a.r)("start")],p.prototype,"readStart",null),(0,s._)([(0,h.c)("start")],p.prototype,"writeStart",null),p=i=(0,s._)([(0,u.j)("esri.TimeExtent")],p);const d=new p,f=new p({start:void 0,end:void 0}),y=p},10699:(t,e,r)=>{r.d(e,{IG:()=>l,iv:()=>n});var i=r(43697),s=r(52011);let o=0;const l=t=>{let e=class extends t{constructor(...t){super(...t),Object.defineProperty(this,"uid",{writable:!1,configurable:!1,value:Date.now().toString(16)+"-object-"+o++})}};return e=(0,i._)([(0,s.j)("esri.core.Identifiable")],e),e},n=t=>{let e=class extends t{constructor(...t){super(...t),Object.defineProperty(this,"uid",{writable:!1,configurable:!1,value:o++})}};return e=(0,i._)([(0,s.j)("esri.core.NumericIdentifiable")],e),e};let a=class extends(l(class{})){};a=(0,i._)([(0,s.j)("esri.core.Identifiable")],a)},13867:(t,e,r)=>{r.d(e,{z:()=>s});var i=r(69801);class s{constructor(t,e){this._storage=new i.WJ,this.id="",this.name="",this.size=0,this._storage.maxSize=t,this._storage.register(this),e&&this._storage.registerRemoveFunc("",e)}destroy(){this._storage.deregister(this),this._storage.destroy()}put(t,e,r=1){this._storage.put(this,t,e,r,1)}pop(t){return this._storage.pop(this,t)}get(t){return this._storage.get(this,t)}clear(){this._storage.clearAll()}get maxSize(){return this._storage.maxSize}set maxSize(t){this._storage.maxSize=t}resetHitRate(){}}},69801:(t,e,r)=>{r.d(e,{WJ:()=>n,Xq:()=>l});var i,s,o=r(44553);(s=i||(i={}))[s.ALL=0]="ALL",s[s.SOME=1]="SOME";class l{constructor(t,e,r){this.name=t,this._storage=e,this.id=a+++":",this.size=0,this.maxSize=0,this._removeFunc=!1,this._hit=0,this._miss=0,this._storage.register(this),r&&(this._storage.registerRemoveFunc(this.id,r),this._removeFunc=!0)}destroy(){this._storage.clear(this),this._removeFunc&&this._storage.deregisterRemoveFunc(this.id),this._storage.deregister(this),this._storage=null}get hitRate(){return this._hit/(this._hit+this._miss)}get sizeAll(){return this._storage.size}resetHitRate(){this._hit=this._miss=0}put(t,e,r,i=0){this._storage.put(this,t,e,r,i)}get(t){const e=this._storage.get(this,t);return void 0===e?++this._miss:++this._hit,e}peek(t){return this._storage.peek(this,t)}pop(t){const e=this._storage.pop(this,t);return void 0===e?++this._miss:++this._hit,e}updateSize(t,e,r){this._storage.updateSize(this,t,e,r)}clear(){this._storage.clear(this)}clearAll(){this._storage.clearAll()}get performanceInfo(){return this._storage.performanceInfo}resetStats(){this._storage.resetStats()}}class n{get size(){return this._size}constructor(t=10485760){this._maxSize=t,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._removeFuncs=new o.Z,this._users=new o.Z}destroy(){this.clearAll(),this._removeFuncs.clear(),this._users.clear(),this._db=null}register(t){this._users.push(t)}deregister(t){this._users.removeUnordered(t)}registerRemoveFunc(t,e){this._removeFuncs.push([t,e])}deregisterRemoveFunc(t){this._removeFuncs.filterInPlace((e=>e[0]!==t))}get maxSize(){return this._maxSize}set maxSize(t){this._maxSize=Math.max(t,0),this._checkSizeLimits()}put(t,e,r,s,o){e=t.id+e;const l=this._db.get(e);if(l&&(this._size-=l.size,t.size-=l.size,this._db.delete(e),l.entry!==r&&this._notifyRemove(e,l.entry,i.ALL)),s>this._maxSize)return void this._notifyRemove(e,r,i.ALL);if(void 0===r)return void console.warn("Refusing to cache undefined entry ");if(!s||s<0)return console.warn(`Refusing to cache entry with size ${s} for key ${e}`),void this._notifyRemove(e,r,i.ALL);const n=1+Math.max(o,-3)- -3;this._db.set(e,{entry:r,size:s,lifetime:n,lives:n}),this._size+=s,t.size+=s,this._checkSizeLimits()}updateSize(t,e,r,s){e=t.id+e;const o=this._db.get(e);if(o&&o.entry===r){for(this._size-=o.size,t.size-=o.size;s>this._maxSize;){const t=this._notifyRemove(e,r,i.SOME);if(!(null!=t&&t>0))return void this._db.delete(e);s=t}o.size=s,this._size+=s,t.size+=s,this._checkSizeLimits()}}pop(t,e){e=t.id+e;const r=this._db.get(e);if(r)return this._size-=r.size,t.size-=r.size,this._db.delete(e),++this._hit,r.entry;++this._miss}get(t,e){e=t.id+e;const r=this._db.get(e);if(void 0!==r)return this._db.delete(e),r.lives=r.lifetime,this._db.set(e,r),++this._hit,r.entry;++this._miss}peek(t,e){const r=this._db.get(t.id+e);return r?++this._hit:++this._miss,r?.entry}get performanceInfo(){const t={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},e={},r=new Array;this._db.forEach(((t,i)=>{const s=t.lifetime;r[s]=(r[s]||0)+t.size,this._users.forAll((r=>{const{id:s,name:o}=r;if(i.startsWith(s)){const r=e[o]||0;e[o]=r+t.size}}))}));const i={};this._users.forAll((t=>{const r=t.name;if("hitRate"in t&&"number"==typeof t.hitRate&&!isNaN(t.hitRate)&&t.hitRate>0){const s=e[r]||0;e[r]=s,i[r]=Math.round(100*t.hitRate)+"%"}else i[r]="0%"}));const s=Object.keys(e);s.sort(((t,r)=>e[r]-e[t])),s.forEach((r=>t[r]=Math.round(e[r]/2**20)+"MB / "+i[r]));for(let e=r.length-1;e>=0;--e){const i=r[e];i&&(t["Priority "+(e+-3-1)]=Math.round(i/this._size*100)+"%")}return t}resetStats(){this._hit=this._miss=0,this._users.forAll((t=>t.resetHitRate()))}clear(t){const e=t.id;this._db.forEach(((t,r)=>{r.startsWith(e)&&(this._size-=t.size,this._db.delete(r),this._notifyRemove(r,t.entry,i.ALL))})),t.size=0}clearAll(){this._db.forEach(((t,e)=>this._notifyRemove(e,t.entry,i.ALL))),this._users.forEach((t=>t.size=0)),this._size=0,this._db.clear()}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(t,e,r){let i;return this._removeFuncs.some((s=>{if(t.startsWith(s[0])){const t=s[1](e,r);return"number"==typeof t&&(i=t),!0}return!1})),i}_checkSizeLimits(){if(this._size>this._maxSize)for(const[t,e]of this._db)if(this._purgeItem(t,e),this._size<=.9*this.maxSize)return;this._users.forEach((t=>{if(t.maxSize>0&&t.size>t.maxSize)for(const[e,r]of this._db)if(e.startsWith(t.id)&&(this._purgeItem(e,r,t),t.size<=.9*t.maxSize))return}))}_purgeItem(t,e,r=this._users.find((e=>t.startsWith(e.id)))){if(this._db.delete(t),e.lives<=1){this._size-=e.size,r&&(r.size-=e.size);const s=this._notifyRemove(t,e.entry,i.SOME);null!=s&&s>0&&(this._size+=s,r&&(r.size+=s),e.lives=e.lifetime,e.size=s,this._db.set(t,e))}else--e.lives,this._db.set(t,e)}}let a=0},17445:(t,e,r)=>{r.d(e,{N1:()=>p,YP:()=>a,Z_:()=>y,gx:()=>u,nn:()=>m,on:()=>c,tX:()=>g}),r(66643),r(46791);var i=r(91460),s=r(50758),o=r(70586),l=r(95330),n=r(26258);function a(t,e,r={}){return h(t,e,r,d)}function u(t,e,r={}){return h(t,e,r,f)}function h(t,e,r={},i){let s=null;const l=r.once?(t,r)=>{i(t)&&((0,o.hw)(s),e(t,r))}:(t,r)=>{i(t)&&e(t,r)};if(s=(0,n.aQ)(t,l,r.sync,r.equals),r.initial){const e=t();l(e,e)}return s}function c(t,e,r,l={}){let n=null,u=null,h=null;function c(){n&&u&&(u.remove(),l.onListenerRemove?.(n),n=null,u=null)}function p(t){l.once&&l.once&&(0,o.hw)(h),r(t)}const d=a(t,((t,r)=>{c(),(0,i.vT)(t)&&(n=t,u=(0,i.on)(t,e,p),l.onListenerAdd?.(t))}),{sync:l.sync,initial:!0});return h=(0,s.kB)((()=>{d.remove(),c()})),h}function p(t,e){return function(t,e,r){if((0,l.Hc)(r))return Promise.reject((0,l.zE)());const i=t();if(e?.(i))return Promise.resolve(i);let n=null;function a(){n=(0,o.hw)(n)}return new Promise(((i,o)=>{n=(0,s.AL)([(0,l.fu)(r,(()=>{a(),o((0,l.zE)())})),h(t,(t=>{a(),i(t)}),{sync:!1,once:!0},e??d)])}))}(t,f,e)}function d(t){return!0}function f(t){return!!t}r(87538);const y={sync:!0},m={initial:!0},g={sync:!0,initial:!0}},87085:(t,e,r)=>{r.d(e,{Z:()=>v});var i=r(43697),s=(r(66577),r(3172)),o=r(20102),l=r(32448),n=r(10699),a=r(83379),u=r(92604),h=r(95330),c=r(17452),p=r(5600),d=(r(75215),r(67676),r(80442),r(52011)),f=r(68773),y=r(6570),m=r(82971);let g=0,_=class extends(l.Z.EventedMixin((0,n.IG)(a.Z))){constructor(){super(...arguments),this.attributionDataUrl=null,this.fullExtent=new y.Z(-180,-90,180,90,m.Z.WGS84),this.id=Date.now().toString(16)+"-layer-"+g++,this.legendEnabled=!0,this.listMode="show",this.opacity=1,this.parent=null,this.persistenceEnabled=!1,this.popupEnabled=!0,this.attributionVisible=!0,this.spatialReference=m.Z.WGS84,this.title=null,this.type=null,this.url=null,this.visible=!0}static async fromArcGISServerUrl(t){const e="string"==typeof t?{url:t}:t;return(await r.e(3529).then(r.bind(r,63529))).fromUrl(e)}static fromPortalItem(t){return async function(t){const e="portalItem"in t?t:{portalItem:t},{fromItem:i}=await r.e(8008).then(r.bind(r,28008));try{return await i(e)}catch(t){const r=e&&e.portalItem,i=r?.id||"unset",s=r&&r.portal&&r.portal.url||f.default.portalUrl;throw u.Z.getLogger("esri.layers.support.fromPortalItem").error("#fromPortalItem()","Failed to create layer from portal item (portal: '"+s+"', id: '"+i+"')",t),t}}(t)}initialize(){this.when().catch((t=>{(0,h.D_)(t)||u.Z.getLogger(this).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:t})}))}destroy(){const t=this.parent;if(t){const e=this;"layers"in t&&t.layers.includes(e)?t.layers.remove(e):"tables"in t&&t.tables.includes(e)?t.tables.remove(e):"baseLayers"in t&&t.baseLayers.includes(e)?t.baseLayers.remove(e):"referenceLayers"in t&&t.referenceLayers.includes(e)&&t.referenceLayers.remove(e),this._set("parent",null)}}get hasAttributionData(){return null!=this.attributionDataUrl}get parsedUrl(){return(0,c.mN)(this.url)}async fetchAttributionData(){const t=this.attributionDataUrl;if(this.hasAttributionData&&t)return(await(0,s.Z)(t,{query:{f:"json"},responseType:"json"})).data;throw new o.Z("layer:no-attribution-data","Layer does not have attribution data")}};(0,i._)([(0,p.Cb)({type:String})],_.prototype,"attributionDataUrl",void 0),(0,i._)([(0,p.Cb)({type:y.Z})],_.prototype,"fullExtent",void 0),(0,i._)([(0,p.Cb)({readOnly:!0})],_.prototype,"hasAttributionData",null),(0,i._)([(0,p.Cb)({type:String,clonable:!1})],_.prototype,"id",void 0),(0,i._)([(0,p.Cb)({type:Boolean,nonNullable:!0})],_.prototype,"legendEnabled",void 0),(0,i._)([(0,p.Cb)({type:["show","hide","hide-children"]})],_.prototype,"listMode",void 0),(0,i._)([(0,p.Cb)({type:Number,range:{min:0,max:1},nonNullable:!0})],_.prototype,"opacity",void 0),(0,i._)([(0,p.Cb)({clonable:!1})],_.prototype,"parent",void 0),(0,i._)([(0,p.Cb)({readOnly:!0})],_.prototype,"parsedUrl",null),(0,i._)([(0,p.Cb)({type:Boolean,readOnly:!0})],_.prototype,"persistenceEnabled",void 0),(0,i._)([(0,p.Cb)({type:Boolean})],_.prototype,"popupEnabled",void 0),(0,i._)([(0,p.Cb)({type:Boolean})],_.prototype,"attributionVisible",void 0),(0,i._)([(0,p.Cb)({type:m.Z})],_.prototype,"spatialReference",void 0),(0,i._)([(0,p.Cb)({type:String})],_.prototype,"title",void 0),(0,i._)([(0,p.Cb)({readOnly:!0,json:{read:!1}})],_.prototype,"type",void 0),(0,i._)([(0,p.Cb)()],_.prototype,"url",void 0),(0,i._)([(0,p.Cb)({type:Boolean,nonNullable:!0})],_.prototype,"visible",void 0),_=(0,i._)([(0,d.j)("esri.layers.Layer")],_);const v=_},94756:(t,e,r)=>{r.r(e),r.d(e,{default:()=>yt});var i=r(43697),s=r(3172),o=r(66643),l=r(20102),n=r(22974),a=r(16453),u=r(95330),h=r(17452),c=r(5600),p=(r(75215),r(71715)),d=r(52011),f=r(30556),y=r(6570),m=r(82971),g=r(87085),_=r(54295),v=r(46486),w=r(17287),S=r(71612),b=r(17017),x=r(38009),A=r(16859),I=r(72965);let E=null;var C=r(92604),R=r(1533);class T{constructor(t,e){this._spriteSource=t,this._maxTextureSize=e,this.devicePixelRatio=1,this._spriteImageFormat="png",this._isRetina=!1,this._spritesData={},this.image=null,this.width=null,this.height=null,this.loadStatus="not-loaded","url"===t.type&&t.spriteFormat&&(this._spriteImageFormat=t.spriteFormat),t.pixelRatio&&(this.devicePixelRatio=t.pixelRatio),this.baseURL=t.spriteUrl}get spriteNames(){const t=[];for(const e in this._spritesData)t.push(e);return t.sort(),t}getSpriteInfo(t){return this._spritesData?this._spritesData[t]:null}async load(t){if(this.baseURL){this.loadStatus="loading";try{await this._loadSprites(t),this.loadStatus="loaded"}catch{this.loadStatus="failed"}}else this.loadStatus="failed"}async _loadSprites(t){this._isRetina=this.devicePixelRatio>1.15;const{width:e,height:r,data:i,json:s}=await this._getSpriteData(this._spriteSource,t),o=Object.keys(s);if(!o||0===o.length||!i)return this._spritesData=this.image=null,void(this.width=this.height=0);this._spritesData=s,this.width=e,this.height=r;const n=Math.max(this._maxTextureSize,4096);if(e>n||r>n){const t=`Sprite resource for style ${this.baseURL} is bigger than the maximum allowed of ${n} pixels}`;throw C.Z.getLogger("esri.layers.support.SpriteSource").error(t),new l.Z("SpriteSource",t)}let a;for(let t=0;t<i.length;t+=4)a=i[t+3]/255,i[t]=i[t]*a,i[t+1]=i[t+1]*a,i[t+2]=i[t+2]*a;this.image=i}async _getSpriteData(t,e){if("image"===t.type){let e,r;if(this.devicePixelRatio<1.15){if(!t.spriteSource1x)throw new l.Z("SpriteSource","no image data provided for low resolution sprites!");e=t.spriteSource1x.image,r=t.spriteSource1x.json}else{if(!t.spriteSource2x)throw new l.Z("SpriteSource","no image data provided for high resolution sprites!");e=t.spriteSource2x.image,r=t.spriteSource2x.json}return"width"in e&&"height"in e&&"data"in e&&((0,R.eP)(e.data)||(0,R.KZ)(e.data))?{width:e.width,height:e.height,data:new Uint8Array(e.data),json:r}:{...z(e),json:r}}const r=(0,h.mN)(this.baseURL),i=r.query?"?"+(0,h.B7)(r.query):"",o=this._isRetina?"@2x":"",n=`${r.path}${o}.${this._spriteImageFormat}${i}`,a=`${r.path}${o}.json${i}`,[u,c]=await Promise.all([(0,s.Z)(a,e),(0,s.Z)(n,{responseType:"image",...e})]);return{...z(c.data),json:u.data}}}function z(t){const e=document.createElement("canvas"),r=e.getContext("2d");e.width=t.width,e.height=t.height,r.drawImage(t,0,0,t.width,t.height);const i=r.getImageData(0,0,t.width,t.height);return{width:t.width,height:t.height,data:new Uint8Array(i.data)}}var L=r(11145),U=r(28589),P=(r(66577),r(8744)),F=r(40488),M=r(55415);class B{constructor(t){this.url=t}destroy(){this._tileIndexPromise=null}async fetchTileIndex(){return this._tileIndexPromise||(this._tileIndexPromise=(0,s.Z)(this.url).then((t=>t.data.index))),this._tileIndexPromise}async dataKey(t,e){const r=await this.fetchTileIndex();return(0,u.k_)(e),this._getIndexedDataKey(r,t)}_getIndexedDataKey(t,e){const r=[e];if(e.level<0||e.row<0||e.col<0||e.row>>e.level>0||e.col>>e.level>0)return null;let i=e;for(;0!==i.level;)i=new M.Z(i.level-1,i.row>>1,i.col>>1,i.world),r.push(i);let s,o,l=t,n=r.pop();if(1===l)return n;for(;r.length;)if(s=r.pop(),o=(1&s.col)+((1&s.row)<<1),l){if(0===l[o]){n=null;break}if(1===l[o]){n=s;break}n=s,l=l[o]}return n}}var O=r(70586);class D{constructor(t,e){this._tilemap=t,this._tileIndexUrl=e}destroy(){this._tilemap=(0,O.SC)(this._tilemap),this._tileIndexPromise=null}async fetchTileIndex(t){return this._tileIndexPromise||(this._tileIndexPromise=(0,s.Z)(this._tileIndexUrl,{query:{...t?.query}}).then((t=>t.data.index))),this._tileIndexPromise}dataKey(t,e){const{level:r,row:i,col:s}=t,o=new M.Z(t);return this._tilemap.fetchAvailabilityUpsample(r,i,s,o,e).then((()=>(o.world=t.world,o))).catch((t=>{if((0,u.D_)(t))throw t;return null}))}}var Z=r(30175);class j{constructor(t){this._tileUrl=t,this._promise=null,this._abortController=null,this._abortOptions=[]}getData(t){null===this._promise&&(this._abortController=new AbortController,this._promise=this._makeRequest(this._tileUrl,this._abortController.signal));const e=this._abortOptions;return e.push(t),(0,u.fu)(t,(()=>{e.every((t=>(0,u.Hc)(t)))&&this._abortController.abort()})),this._promise.then((t=>(0,n.d9)(t)))}async _makeRequest(t,e){const{data:r}=await(0,s.Z)(t,{responseType:"array-buffer",signal:e});return r}}const N=new Map;function W(t,e){return(0,Z.s1)(N,t,(()=>new j(t))).getData(e).then((e=>(N.delete(t),e))).catch((e=>{throw N.delete(t),e}))}class k{constructor(t,e,r){this.tilemap=null,this.tileInfo=null,this.capabilities=null,this.fullExtent=null,this.initialExtent=null,this.name=t,this.sourceUrl=e;const i=(0,h.mN)(this.sourceUrl),s=(0,n.d9)(r),o=s.tiles;if(i)for(let t=0;t<o.length;t++){const e=(0,h.mN)(o[t]);e&&((0,h.YP)(e.path)||(e.path=(0,h.v_)(i.path,e.path)),o[t]=(0,h.fl)(e.path,{...i.query,...e.query}))}this.tileServers=o;const l=r.capabilities&&r.capabilities.split(",").map((t=>t.toLowerCase().trim())),a=!0===r?.exportTilesAllowed,u=!0===l?.includes("tilemap"),c=a&&r.hasOwnProperty("maxExportTilesCount")?r.maxExportTilesCount:0;this.capabilities={operations:{supportsExportTiles:a,supportsTileMap:u},exportTiles:a?{maxExportTilesCount:+c}:null},this.tileInfo=L.Z.fromJSON(s.tileInfo);const p=r.tileMap?(0,h.fl)((0,h.v_)(i.path,r.tileMap),i.query??{}):null;u?(this.type="vector-tile",this.tilemap=new D(new U.y({layer:{parsedUrl:i,tileInfo:this.tileInfo},minLOD:s.minLOD??this.tileInfo.lods[0].level,maxLOD:s.maxLOD??this.tileInfo.lods[this.tileInfo.lods.length-1].level}),p)):p&&(this.tilemap=new B(p)),this.fullExtent=y.Z.fromJSON(r.fullExtent),this.initialExtent=y.Z.fromJSON(r.initialExtent)}destroy(){this.tilemap?.destroy()}async getRefKey(t,e){return await(this.tilemap?.dataKey(t,e))??t}requestTile(t,e,r,i){return function(t,e,r,i,s){const o=(0,h.mN)(t),l=o.query;if(l)for(const[t,s]of Object.entries(l))switch(s){case"{x}":l[t]=i.toString();break;case"{y}":l[t]=r.toString();break;case"{z}":l[t]=e.toString()}const n=o.path;return W((0,h.fl)(n.replaceAll(/\{z\}/gi,e.toString()).replaceAll(/\{y\}/gi,r.toString()).replaceAll(/\{x\}/gi,i.toString()),{...o.query}),s)}(this.tileServers[e%this.tileServers.length],t,e,r,i)}isCompatibleWith(t){const e=this.tileInfo,r=t.tileInfo;if(!e.spatialReference.equals(r.spatialReference))return!1;if(!e.origin.equals(r.origin))return!1;if(Math.round(e.dpi)!==Math.round(r.dpi))return!1;const i=e.lods,s=r.lods,o=Math.min(i.length,s.length);for(let t=0;t<o;t++){const e=i[t],r=s[t];if(e.level!==r.level||Math.round(e.scale)!==Math.round(r.scale))return!1}return!0}}var G=r(83068);function $(...t){let e;for(const r of t)if(null!=r)if((0,h.oC)(r)){if(e){const t=e.split("://")[0];e=t+":"+r.trim()}}else e=(0,h.YP)(r)?r:(0,h.v_)(e,r);return e?(0,h.Qj)(e):void 0}async function q(t,e,r,i,o){let l,n,a;if((0,u.k_)(o),"string"==typeof r){const t=(0,h.Fv)(r);a=await(0,s.Z)(t,{...o,responseType:"json",query:{f:"json",...o?.query}}),a.ssl&&(l&&(l=l.replace(/^http:/i,"https:")),n&&(n=n.replace(/^http:/i,"https:"))),l=t,n=t}else null!=r&&(a={data:r},l=r.jsonUrl||null,n=i);const c=a?.data;if(X(c))return t.styleUrl=l||null,async function(t,e,r,i){const s=r?(0,h.Yd)(r):(0,h.L)();t.styleBase=s,t.style=e,e["sprite-format"]&&"webp"===e["sprite-format"].toLowerCase()&&(t.spriteFormat="webp");const o=[];if(e.sources&&e.sources.esri){const r=e.sources.esri;r.url?await q(t,"esri",$(s,r.url),void 0,i):o.push(q(t,"esri",r,s,i))}for(const r of Object.keys(e.sources))"esri"!==r&&"vector"===e.sources[r].type&&(e.sources[r].url?o.push(q(t,r,$(s,e.sources[r].url),void 0,i)):e.sources[r].tiles&&o.push(q(t,r,e.sources[r],s,i)));await Promise.all(o)}(t,c,n,o);if(!X(c))return t.sourceUrl?K(t,c,n,!1,e,o):(t.sourceUrl=l||null,K(t,c,n,!0,e,o));throw new Error("You must specify the URL or the JSON for a service or for a style.")}function H(t){return"object"==typeof t&&!!t&&"tilejson"in t&&null!=t.tilejson}function X(t){return!!t&&"sources"in t&&!!t.sources}async function K(t,e,r,i,s,o){const l=r?(0,h.Qj)(r)+"/":(0,h.L)(),a=function(t){if(t.hasOwnProperty("tileInfo"))return t;const e={xmin:-20037507.067161843,ymin:-20037507.067161843,xmax:20037507.067161843,ymax:20037507.067161843,spatialReference:{wkid:102100,latestWkid:3857}};let r=null;if(H(t)){const{bounds:e}=t;if(e){const t=(0,F.$)({x:e[0],y:e[1],spatialReference:(0,n.d9)(P.Zn)}),i=(0,F.$)({x:e[2],y:e[3],spatialReference:(0,n.d9)(P.Zn)});r={xmin:t.x,ymin:t.y,xmax:i.x,ymax:i.y,spatialReference:(0,n.d9)(P.R_)}}}null===r&&(r=e);const i=new G.Z(L.Z.create({spatialReference:m.Z.WebMercator,size:512,numLODs:25}));let s=78271.51696400007,o=295828763.7957775;const l=[],a=t.hasOwnProperty("minzoom")&&null!=t.minzoom,u=t.hasOwnProperty("maxzoom")&&null!=t.maxzoom,h=a?+t.minzoom:0,c=u?+t.maxzoom:22;let p=0;a&&h>0&&h<25&&(p=i.getLODInfoAt(h).scale);let d=0;u&&c>0&&c<25&&(d=i.getLODInfoAt(c).scale);for(let t=0;t<=c;t++)l.push({level:t,scale:o,resolution:s}),s/=2,o/=2;return{capabilities:"TilesOnly",initialExtent:r,fullExtent:e,minScale:p,maxScale:d,tiles:t.tiles,tileInfo:{rows:512,cols:512,dpi:96,format:"pbf",origin:{x:-20037508.342787,y:20037508.342787},lods:l,spatialReference:(0,n.d9)(P.R_)}}}(e),u=new k(s,(0,h.fl)(l,o?.query??{}),a);if(!i&&t.primarySourceName in t.sourceNameToSource){const e=t.sourceNameToSource[t.primarySourceName];if(!e.isCompatibleWith(u))return;null!=u.fullExtent&&(null!=e.fullExtent?e.fullExtent.union(u.fullExtent):e.fullExtent=u.fullExtent.clone()),e.tileInfo&&u.tileInfo&&e.tileInfo.lods.length<u.tileInfo.lods.length&&(e.tileInfo=u.tileInfo)}if(i&&(t.sourceBase=l,t.source=e,t.validatedSource=a,t.primarySourceName=s),t.sourceNameToSource[s]=u,!H(t)&&"defaultStyles"in e&&!t.style){if(null==e.defaultStyles)throw new Error;return"string"==typeof e.defaultStyles?q(t,"",$(l,e.defaultStyles,"root.json"),void 0,o):q(t,"",e.defaultStyles,$(l,"root.json"),o)}}var V=r(33516),Q=r(19745),Y=r(25929),J=r(94139),tt=r(39450);const et=1e-6;function rt(t,e){if(t===e)return!0;if(null==t&&null!=e)return!1;if(null!=t&&null==e)return!1;if(null==t||null==e)return!1;if(!t.spatialReference.equals(e.spatialReference)||t.dpi!==e.dpi)return!1;const r=t.origin,i=e.origin;if(Math.abs(r.x-i.x)>=et||Math.abs(r.y-i.y)>=et)return!1;let s,o;t.lods[0].scale>e.lods[0].scale?(s=t,o=e):(o=t,s=e);for(let t=s.lods[0].scale;t>=o.lods[o.lods.length-1].scale-et;t/=2)if(Math.abs(t-o.lods[0].scale)<et)return!0;return!1}function it(t,e){if(t===e)return t;if(null==t&&null!=e)return e;if(null!=t&&null==e)return t;if(null==t||null==e)return null;const r=t.size[0],i=t.format,s=t.dpi,o=new J.Z({x:t.origin.x,y:t.origin.y}),l=t.spatialReference,n=t.lods[0].scale>e.lods[0].scale?t.lods[0]:e.lods[0],a=t.lods[t.lods.length-1].scale<=e.lods[e.lods.length-1].scale?t.lods[t.lods.length-1]:e.lods[e.lods.length-1],u=n.scale,h=n.resolution,c=a.scale,p=[];let d=u,f=h,y=0;for(;d>c;)p.push(new tt.Z({level:y,resolution:f,scale:d})),y++,d/=2,f/=2;return new L.Z({size:[r,r],dpi:s,format:i||"pbf",origin:o,lods:p,spatialReference:l})}var st=r(51785),ot=r(7575);let lt,nt;function at(t){const e=(0,ot.Sh)(t);for(;e.length>1;){const t=ut(e.shift());if(t.available)return t}return ut(e.shift())}function ut(t){switch(t){case ot.zO.WEBGL1:return lt||(lt=function(){const t=new ct,e=dt(ot.zO.WEBGL1,t);return null==e||(t.supportsElementIndexUint=null!==e.getExtension("OES_element_index_uint"),t.supportsStandardDerivatives=null!==e.getExtension("OES_standard_derivatives"),t.supportsInstancedArrays=null!==e.getExtension("ANGLE_instanced_arrays"),t.supportsTextureFloat=null!==e.getExtension("OES_texture_float"),t.supportsTextureHalfFloat=null!==e.getExtension("OES_texture_half_float"),t.supportsColorBufferFloat=null!==e.getExtension("WEBGL_color_buffer_float"),t.supportsColorBufferFloatBlend=null!==e.getExtension("EXT_float_blend"),t.supportsColorBufferHalfFloat=null!==e.getExtension("EXT_color_buffer_half_float")),t}()),lt;case ot.zO.WEBGL2:return nt||(nt=function(){const t=new pt,e=dt(ot.zO.WEBGL2,t);return null==e||(t.supportsColorBufferFloat=null!==e.getExtension("EXT_color_buffer_float"),t.supportsColorBufferFloatBlend=null!==e.getExtension("EXT_float_blend"),t.supportsColorBufferHalfFloat=t.supportsColorBufferFloat||null!==e.getExtension("EXT_color_buffer_half_float")),t}()),nt}}class ht{constructor(){this.available=!1,this.majorPerformanceCaveat=!1,this.maxTextureSize=0,this.supportsVertexShaderSamplers=!1,this.supportsHighPrecisionFragment=!1,this.supportsElementIndexUint=!1,this.supportsStandardDerivatives=!1,this.supportsInstancedArrays=!1,this.supportsTextureFloat=!1,this.supportsTextureHalfFloat=!1,this.supportsColorBufferFloat=!1,this.supportsColorBufferFloatBlend=!1,this.supportsColorBufferHalfFloat=!1}}class ct extends ht{constructor(){super(...arguments),this.type=ot.zO.WEBGL1}}class pt extends ht{constructor(){super(...arguments),this.type=ot.zO.WEBGL2,this.supportsElementIndexUint=!0,this.supportsStandardDerivatives=!0,this.supportsInstancedArrays=!0,this.supportsTextureFloat=!0,this.supportsTextureHalfFloat=!0}}function dt(t,e){if(t===ot.zO.WEBGL1&&"undefined"==typeof WebGLRenderingContext||t===ot.zO.WEBGL2&&"undefined"==typeof WebGL2RenderingContext)return null;const r=document.createElement("canvas");if(!r)return null;let i=(0,ot.kr)(r,t,{failIfMajorPerformanceCaveat:!0});if(null==i&&(i=(0,ot.kr)(r,t),null!=i&&(e.majorPerformanceCaveat=!0)),null==i)return i;if(t===ot.zO.WEBGL1){const t=i.getParameter(i.VERSION),r=t?.match(/^WebGL\s+([\d.]*)/);if(r){const t=parseFloat(r[1]);e.available=t>=.94}}else e.available=!0;e.maxTextureSize=i.getParameter(i.MAX_TEXTURE_SIZE),e.supportsVertexShaderSamplers=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;const s=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT);return s&&(e.supportsHighPrecisionFragment=s.precision>0),i}let ft=class extends((0,S.h)((0,I.M)((0,v.Z)((0,w.Y)((0,x.q)((0,A.I)((0,b.N)((0,_.V)((0,a.R)(g.Z)))))))))){constructor(...t){super(...t),this._spriteSourceMap=new Map,this.currentStyleInfo=null,this.isReference=null,this.operationalLayerType="VectorTileLayer",this.style=null,this.tilemapCache=null,this.type="vector-tile",this.url=null,this.path=null}normalizeCtorArgs(t,e){return"string"==typeof t?{url:t,...e}:t}destroy(){if(this.sourceNameToSource)for(const t of Object.values(this.sourceNameToSource))t?.destroy();this.primarySource?.destroy(),this._spriteSourceMap.clear()}async prefetchResources(t){await this.loadSpriteSource(globalThis.devicePixelRatio||1,t)}load(t){const e=this.loadFromPortal({supportedTypes:["Vector Tile Service"],supportsData:!1},t).catch(u.r9).then((async()=>{if(!this.portalItem?.id)return;const e=`${this.portalItem.itemCdnUrl}/resources/styles/root.json`;(await(0,s.Z)(e,{...t,query:{f:"json",...this.customParameters,token:this.apiKey}})).data&&this.read({url:e},(0,V.ht)(this.portalItem))})).catch(u.r9).then((()=>this._loadStyle(t)));return this.addResolvingPromise(e),Promise.resolve(this)}get attributionDataUrl(){const t=this.currentStyleInfo,e=t?.serviceUrl&&(0,h.mN)(t.serviceUrl);if(!e)return null;const r=this._getDefaultAttribution(e.path);return r?(0,h.fl)(r,{...this.customParameters,token:this.apiKey}):null}get capabilities(){const t=this.primarySource;return t?t.capabilities:{operations:{supportsExportTiles:!1,supportsTileMap:!1},exportTiles:null}}get fullExtent(){return this.primarySource?.fullExtent||null}get initialExtent(){return this.primarySource?.initialExtent||null}get parsedUrl(){return this.serviceUrl?(0,h.mN)(this.serviceUrl):null}get serviceUrl(){return this.currentStyleInfo?.serviceUrl||null}get spatialReference(){return this.tileInfo?.spatialReference??null}get styleUrl(){return this.currentStyleInfo?.styleUrl||null}writeStyleUrl(t,e){t&&(0,h.oC)(t)&&(t=`https:${t}`);const r=(0,Q.a)(t);e.styleUrl=(0,Y.e)(t,r)}get tileInfo(){const t=[];for(const e in this.sourceNameToSource)t.push(this.sourceNameToSource[e]);let e=this.primarySource?.tileInfo||new L.Z;if(t.length>1)for(let r=0;r<t.length;r++)rt(e,t[r].tileInfo)&&(e=it(e,t[r].tileInfo));return e}readTilemapCache(t,e){const r=e.capabilities?.includes("Tilemap");return r?new U.y({layer:this}):null}readVersion(t,e){return e.version?parseFloat(e.version):parseFloat(e.currentVersion)}async loadSpriteSource(t=1,e){if(!this._spriteSourceMap.has(t)){const r=at("2d").maxTextureSize,i=this.currentStyleInfo?.spriteUrl?(0,h.fl)(this.currentStyleInfo.spriteUrl,{...this.customParameters,token:this.apiKey}):null,s=new T({type:"url",spriteUrl:i,pixelRatio:t,spriteFormat:this.currentStyleInfo?.spriteFormat},r);await s.load(e),this._spriteSourceMap.set(t,s)}return this._spriteSourceMap.get(t)}async setSpriteSource(t,e){if(!t)return null;const r=at("2d").maxTextureSize,i=t.spriteUrl,s=i?(0,h.fl)(i,{...this.customParameters,token:this.apiKey}):null;if(!s&&"url"===t.type)return null;const o=new T(t,r);try{await o.load(e);const r=t.pixelRatio||1;return this._spriteSourceMap.clear(),this._spriteSourceMap.set(r,o),s&&this.currentStyleInfo&&(this.currentStyleInfo.spriteUrl=s),this.emit("spriteSource-change",{spriteSource:o}),o}catch(t){(0,u.r9)(t)}return null}async loadStyle(t,e){const r=t||this.style||this.url;return this._loadingTask&&"string"==typeof r&&this.url===r||(this._loadingTask?.abort(),this._loadingTask=(0,o.vr)((t=>(this._spriteSourceMap.clear(),this._getSourceAndStyle(r,{signal:t}))),e)),this._loadingTask.promise}getStyleLayerId(t){return this.styleRepository.getStyleLayerId(t)}getStyleLayerIndex(t){return this.styleRepository.getStyleLayerIndex(t)}getPaintProperties(t){return(0,n.d9)(this.styleRepository?.getPaintProperties(t))}setPaintProperties(t,e){const r=this.styleRepository.isPainterDataDriven(t);this.styleRepository.setPaintProperties(t,e);const i=this.styleRepository.isPainterDataDriven(t);this.emit("paint-change",{layer:t,paint:e,isDataDriven:r||i})}getStyleLayer(t){return(0,n.d9)(this.styleRepository.getStyleLayer(t))}setStyleLayer(t,e){this.styleRepository.setStyleLayer(t,e),this.emit("style-layer-change",{layer:t,index:e})}deleteStyleLayer(t){this.styleRepository.deleteStyleLayer(t),this.emit("delete-style-layer",{layer:t})}getLayoutProperties(t){return(0,n.d9)(this.styleRepository.getLayoutProperties(t))}setLayoutProperties(t,e){this.styleRepository.setLayoutProperties(t,e),this.emit("layout-change",{layer:t,layout:e})}setStyleLayerVisibility(t,e){this.styleRepository.setStyleLayerVisibility(t,e),this.emit("style-layer-visibility-change",{layer:t,visibility:e})}getStyleLayerVisibility(t){return this.styleRepository.getStyleLayerVisibility(t)}write(t,e){return e?.origin&&!this.styleUrl?(e.messages&&e.messages.push(new l.Z("vectortilelayer:unsupported",`VectorTileLayer (${this.title}, ${this.id}) with style defined by JSON only are not supported`,{layer:this})),null):super.write(t,e)}getTileUrl(t,e,r){return null}async _getSourceAndStyle(t,e){if(!t)throw new Error("invalid style!");const r=await async function(t,e){const r={source:null,sourceBase:null,sourceUrl:null,validatedSource:null,style:null,styleBase:null,styleUrl:null,sourceNameToSource:{},primarySourceName:"",spriteFormat:"png"},[i,s]="string"==typeof t?[t,null]:[null,t.jsonUrl];return await q(r,"esri",t,s,e),{layerDefinition:r.validatedSource,url:i,serviceUrl:r.sourceUrl,style:r.style,styleUrl:r.styleUrl,spriteUrl:r.style.sprite&&$(r.styleBase,r.style.sprite),spriteFormat:r.spriteFormat,glyphsUrl:r.style.glyphs&&$(r.styleBase,r.style.glyphs),sourceNameToSource:r.sourceNameToSource,primarySourceName:r.primarySourceName}}(t,{...e,query:{...this.customParameters,token:this.apiKey}});"webp"===r.spriteFormat&&(await function(t){if(E)return E;const e={lossy:"UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",lossless:"UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==",alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"};return E=new Promise((t=>{const r=new Image;r.onload=()=>{r.onload=r.onerror=null,t(r.width>0&&r.height>0)},r.onerror=()=>{r.onload=r.onerror=null,t(!1)},r.src="data:image/webp;base64,"+e.lossy})),E}()||(r.spriteFormat="png")),this._set("currentStyleInfo",{...r}),"string"==typeof t?(this.url=t,this.style=null):(this.url=null,this.style=t),this._set("sourceNameToSource",r.sourceNameToSource),this._set("primarySource",r.sourceNameToSource[r.primarySourceName]),this._set("styleRepository",new st.Z(r.style)),this.read(r.layerDefinition,{origin:"service"}),this.emit("load-style")}_getDefaultAttribution(t){const e=t.match(/^https?:\/\/(?:basemaps|basemapsbeta|basemapsdev)(?:-api)?\.arcgis\.com(\/[^\/]+)?\/arcgis\/rest\/services\/([^\/]+(\/[^\/]+)*)\/vectortileserver/i),r=["OpenStreetMap_v2","OpenStreetMap_Daylight_v2","OpenStreetMap_Export_v2","OpenStreetMap_FTS_v2","OpenStreetMap_GCS_v2","World_Basemap","World_Basemap_v2","World_Basemap_Export_v2","World_Basemap_GCS_v2","World_Basemap_WGS84","World_Contours_v2"];if(!e)return;const i=e[2]&&e[2].toLowerCase();if(!i)return;const s=e[1]||"";for(const t of r)if(t.toLowerCase().includes(i))return(0,h.Fv)(`//static.arcgis.com/attribution/Vector${s}/${t}`)}async _loadStyle(t){return this._loadingTask?.promise??this.loadStyle(null,t)}};(0,i._)([(0,c.Cb)({readOnly:!0})],ft.prototype,"attributionDataUrl",null),(0,i._)([(0,c.Cb)({type:["show","hide"]})],ft.prototype,"listMode",void 0),(0,i._)([(0,c.Cb)({json:{read:!0,write:!0}})],ft.prototype,"blendMode",void 0),(0,i._)([(0,c.Cb)({readOnly:!0,json:{read:!1}})],ft.prototype,"capabilities",null),(0,i._)([(0,c.Cb)({readOnly:!0})],ft.prototype,"currentStyleInfo",void 0),(0,i._)([(0,c.Cb)({json:{read:!1},readOnly:!0,type:y.Z})],ft.prototype,"fullExtent",null),(0,i._)([(0,c.Cb)({json:{read:!1},readOnly:!0,type:y.Z})],ft.prototype,"initialExtent",null),(0,i._)([(0,c.Cb)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],ft.prototype,"isReference",void 0),(0,i._)([(0,c.Cb)({type:["VectorTileLayer"]})],ft.prototype,"operationalLayerType",void 0),(0,i._)([(0,c.Cb)({readOnly:!0})],ft.prototype,"parsedUrl",null),(0,i._)([(0,c.Cb)()],ft.prototype,"style",void 0),(0,i._)([(0,c.Cb)({readOnly:!0})],ft.prototype,"serviceUrl",null),(0,i._)([(0,c.Cb)({type:m.Z,readOnly:!0})],ft.prototype,"spatialReference",null),(0,i._)([(0,c.Cb)({readOnly:!0})],ft.prototype,"styleRepository",void 0),(0,i._)([(0,c.Cb)({readOnly:!0})],ft.prototype,"sourceNameToSource",void 0),(0,i._)([(0,c.Cb)({readOnly:!0})],ft.prototype,"primarySource",void 0),(0,i._)([(0,c.Cb)({type:String,readOnly:!0,json:{write:{ignoreOrigin:!0},origins:{"web-document":{write:{ignoreOrigin:!0,isRequired:!0}}}}})],ft.prototype,"styleUrl",null),(0,i._)([(0,f.c)(["portal-item","web-document"],"styleUrl")],ft.prototype,"writeStyleUrl",null),(0,i._)([(0,c.Cb)({json:{read:!1,origins:{service:{read:!1}}},readOnly:!0,type:L.Z})],ft.prototype,"tileInfo",null),(0,i._)([(0,c.Cb)()],ft.prototype,"tilemapCache",void 0),(0,i._)([(0,p.r)("service","tilemapCache",["capabilities","tileInfo"])],ft.prototype,"readTilemapCache",null),(0,i._)([(0,c.Cb)({json:{read:!1},readOnly:!0,value:"vector-tile"})],ft.prototype,"type",void 0),(0,i._)([(0,c.Cb)({json:{origins:{"web-document":{read:{source:"styleUrl"}},"portal-item":{read:{source:"url"}}},write:!1,read:!1}})],ft.prototype,"url",void 0),(0,i._)([(0,c.Cb)({readOnly:!0})],ft.prototype,"version",void 0),(0,i._)([(0,p.r)("version",["version","currentVersion"])],ft.prototype,"readVersion",null),(0,i._)([(0,c.Cb)({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],ft.prototype,"path",void 0),ft=(0,i._)([(0,d.j)("esri.layers.VectorTileLayer")],ft);const yt=ft},54295:(t,e,r)=>{r.d(e,{V:()=>l});var i=r(43697),s=r(5600),o=(r(75215),r(67676),r(80442),r(52011));const l=t=>{let e=class extends t{get apiKey(){return this._isOverridden("apiKey")?this._get("apiKey"):"portalItem"in this?this.portalItem?.apiKey:null}set apiKey(t){null!=t?this._override("apiKey",t):(this._clearOverride("apiKey"),this.clear("apiKey","user"))}};return(0,i._)([(0,s.Cb)({type:String})],e.prototype,"apiKey",null),e=(0,i._)([(0,o.j)("esri.layers.mixins.APIKeyMixin")],e),e}},17017:(t,e,r)=>{r.d(e,{N:()=>l});var i=r(43697),s=r(5600),o=(r(75215),r(67676),r(80442),r(52011));const l=t=>{let e=class extends t{constructor(){super(...arguments),this.customParameters=null}};return(0,i._)([(0,s.Cb)({type:Object,json:{write:{overridePolicy:t=>({enabled:!!(t&&Object.keys(t).length>0)})}}})],e.prototype,"customParameters",void 0),e=(0,i._)([(0,o.j)("esri.layers.mixins.CustomParametersMixin")],e),e}},16859:(t,e,r)=>{r.d(e,{I:()=>b});var i=r(43697),s=r(68773),o=r(40330),l=r(3172),n=r(66643),a=r(20102),u=r(92604),h=r(70586),c=r(95330),p=r(17452),d=r(5600),f=(r(75215),r(67676),r(80442),r(71715)),y=r(52011),m=r(30556),g=r(84230),_=r(48522),v=r(15235),w=r(86082),S=r(14661);const b=t=>{let e=class extends t{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1}destroy(){this.portalItem=(0,h.SC)(this.portalItem),this.resourceReferences.portalItem=null,this.resourceReferences.paths.length=0}set portalItem(t){t!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",t))}readPortalItem(t,e,r){if(e.itemId)return new v.default({id:e.itemId,portal:r?.portal})}writePortalItem(t,e){t?.id&&(e.itemId=t.id)}async loadFromPortal(t,e){if(this.portalItem?.id)try{const{load:i}=await r.e(8062).then(r.bind(r,18062));return(0,c.k_)(e),await i({instance:this,supportedTypes:t.supportedTypes,validateItem:t.validateItem,supportsData:t.supportsData,layerModuleTypeMap:t.layerModuleTypeMap},e)}catch(t){throw(0,c.D_)(t)||u.Z.getLogger(this).warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id})\n ${t}`),t}}async finishLoadEditablePortalLayer(t){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(t).catch((t=>((0,c.r9)(t),!0))))}async setUserPrivileges(t,e){if(!s.default.userPrivilegesApplied)return this.finishLoadEditablePortalLayer(e);if(this.url)try{const{features:{edit:r,fullEdit:i},content:{updateItem:s}}=await this._fetchUserPrivileges(t,e);this._set("userHasEditingPrivileges",r),this._set("userHasFullEditingPrivileges",i),this._set("userHasUpdateItemPrivileges",s)}catch(t){(0,c.r9)(t)}}async _fetchUserPrivileges(t,e){let r=this.portalItem;if(!t||!r||!r.loaded||r.sourceUrl)return this._fetchFallbackUserPrivileges(e);const i=t===r.id;if(i&&r.portal.user)return(0,S.Ss)(r);let s,l;if(i)s=r.portal.url;else try{s=await(0,g.oP)(this.url,e)}catch(t){(0,c.r9)(t)}if(!s||!(0,p.Zo)(s,r.portal.url))return this._fetchFallbackUserPrivileges(e);try{const t=null!=e?e.signal:null;l=await(o.id?.getCredential(`${s}/sharing`,{prompt:!1,signal:t}))}catch(t){(0,c.r9)(t)}if(!l)return{features:{edit:!0,fullEdit:!1},content:{updateItem:!1}};try{if(i?await r.reload():(r=new v.default({id:t,portal:{url:s}}),await r.load(e)),r.portal.user)return(0,S.Ss)(r)}catch(t){(0,c.r9)(t)}return{features:{edit:!0,fullEdit:!1},content:{updateItem:!1}}}async _fetchFallbackUserPrivileges(t){let e=!0;try{e=await this._fetchUserHasEditingPrivileges(t)}catch(t){(0,c.r9)(t)}return{features:{edit:e,fullEdit:!1},content:{updateItem:!1}}}async _fetchUserHasEditingPrivileges(t){const e=this.url?o.id?.findCredential(this.url):null;if(!e)return!0;const r=x.credential===e?x.user:await this._fetchEditingUser(t);return x.credential=e,x.user=r,null==r?.privileges||r.privileges.includes("features:user:edit")}async _fetchEditingUser(t){const e=this.portalItem?.portal?.user;if(e)return e;const r=o.id.findServerInfo(this.url??"");if(!r?.owningSystemUrl)return null;const i=`${r.owningSystemUrl}/sharing/rest`,s=_.Z.getDefault();if(s&&s.loaded&&(0,p.Fv)(s.restUrl)===(0,p.Fv)(i))return s.user;const a=`${i}/community/self`,u=null!=t?t.signal:null,h=await(0,n.q6)((0,l.Z)(a,{authMode:"no-prompt",query:{f:"json"},signal:u}));return h.ok?w.Z.fromJSON(h.value.data):null}read(t,e){e&&(e.layer=this),super.read(t,e)}write(t,e){const r=e?.portal,i=this.portalItem?.id&&(this.portalItem.portal||_.Z.getDefault());return r&&i&&!(0,p.tm)(i.restUrl,r.restUrl)?(e.messages&&e.messages.push(new a.Z("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save, set layer.portalItem to null or save to the same portal as the item associated with the layer`,{layer:this})),null):super.write(t,{...e,layer:this})}};return(0,i._)([(0,d.Cb)({type:v.default})],e.prototype,"portalItem",null),(0,i._)([(0,f.r)("web-document","portalItem",["itemId"])],e.prototype,"readPortalItem",null),(0,i._)([(0,m.c)("web-document","portalItem",{itemId:{type:String}})],e.prototype,"writePortalItem",null),(0,i._)([(0,d.Cb)({clonable:!1})],e.prototype,"resourceReferences",void 0),(0,i._)([(0,d.Cb)({type:Boolean,readOnly:!0})],e.prototype,"userHasEditingPrivileges",void 0),(0,i._)([(0,d.Cb)({type:Boolean,readOnly:!0})],e.prototype,"userHasFullEditingPrivileges",void 0),(0,i._)([(0,d.Cb)({type:Boolean,readOnly:!0})],e.prototype,"userHasUpdateItemPrivileges",void 0),e=(0,i._)([(0,y.j)("esri.layers.mixins.PortalLayer")],e),e},x={credential:null,user:null}},33516:(t,e,r)=>{r.d(e,{M4:()=>a,Yv:()=>l,ht:()=>o,wk:()=>n});var i=r(17452),s=r(48522);function o(t){return{origin:"portal-item",url:(0,i.mN)(t.itemUrl),portal:t.portal||s.Z.getDefault(),portalItem:t,readResourcePaths:[]}}function l(t){const e=(0,i.mN)(t.itemUrl);return{origin:"portal-item",messages:[],writtenProperties:[],url:e,portal:t.portal||s.Z.getDefault(),portalItem:t,verifyItemRelativeUrls:e?{rootPath:e.path,writtenUrls:[]}:null,blockedRelativeUrls:[]}}function n(t){return{origin:"web-map",url:(0,i.mN)(t.itemUrl),portal:t.portal||s.Z.getDefault(),portalItem:t,readResourcePaths:[]}}function a(t,e){const r=(0,i.mN)(t.itemUrl);return{origin:"web-map",messages:[],writtenProperties:[],url:r,portal:t.portal||s.Z.getDefault(),portalItem:t,initiator:e,verifyItemRelativeUrls:r?{rootPath:r.path,writtenUrls:[]}:null,blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}}}},67524:(t,e,r)=>{r.d(e,{Z:()=>s});var i=r(71143);class s{constructor(){this.spans=[]}acquire(t){this.lodInfo=t}release(){this.lodInfo=null,this.spans.length=0}forEach(t,e){const{spans:r,lodInfo:i}=this,{level:s}=i;if(0!==r.length)for(const{row:o,colFrom:l,colTo:n}of r)for(let r=l;r<=n;r++)t.call(e,s,o,i.normalizeCol(r),i.getWorldForColumn(r))}}s.pool=new i.Z(s)},83068:(t,e,r)=>{r.d(e,{Z:()=>f});var i=r(8744),s=r(55415);function o(t,e){return[t,e]}function l(t,e,r){return t[0]=e,t[1]=r,t}const n=new s.Z("0/0/0/0");class a{static create(t,e,r=null){const s=(0,i.C5)(t.spatialReference),n=e.origin||o(t.origin.x,t.origin.y),u=o(t.size[0]*e.resolution,t.size[1]*e.resolution),h=o(-1/0,-1/0),c=o(1/0,1/0),p=o(1/0,1/0);null!=r&&(l(h,Math.max(0,Math.floor((r.xmin-n[0])/u[0])),Math.max(0,Math.floor((n[1]-r.ymax)/u[1]))),l(c,Math.max(0,Math.floor((r.xmax-n[0])/u[0])),Math.max(0,Math.floor((n[1]-r.ymin)/u[1]))),l(p,c[0]-h[0]+1,c[1]-h[1]+1));const{cols:d,rows:f}=e;let y,m,g,_;return!r&&d&&f&&(l(h,d[0],f[0]),l(c,d[1],f[1]),l(p,d[1]-d[0]+1,f[1]-f[0]+1)),t.isWrappable?(y=o(Math.ceil(Math.round((s.valid[1]-s.valid[0])/e.resolution)/t.size[0]),p[1]),m=o(Math.floor((s.origin[0]-n[0])/u[0]),h[1]),g=o(y[0]+m[0]-1,c[1]),_=!0):(m=h,g=c,y=p,_=!1),new a(e.level,e.resolution,e.scale,n,h,c,p,u,m,g,y,_)}constructor(t,e,r,i,s,o,l,n,a,u,h,c){this.level=t,this.resolution=e,this.scale=r,this.origin=i,this.first=s,this.last=o,this.size=l,this.norm=n,this.worldStart=a,this.worldEnd=u,this.worldSize=h,this.wrap=c}normalizeCol(t){if(!this.wrap)return t;const e=this.worldSize[0];return t<0?e-1-Math.abs((t+1)%e):t%e}denormalizeCol(t,e){return this.wrap?this.worldSize[0]*e+t:t}getWorldForColumn(t){return this.wrap?Math.floor(t/this.worldSize[0]):0}getFirstColumnForWorld(t){return t*this.worldSize[0]+this.first[0]}getLastColumnForWorld(t){return t*this.worldSize[0]+this.first[0]+this.size[0]-1}getColumnForX(t){return(t-this.origin[0])/this.norm[0]}getXForColumn(t){return this.origin[0]+t*this.norm[0]}getRowForY(t){return(this.origin[1]-t)/this.norm[1]}getYForRow(t){return this.origin[1]-t*this.norm[1]}getTileBounds(t,e,r=!1){n.set(e);const i=r?n.col:this.denormalizeCol(n.col,n.world),s=n.row;return function(t,e,r,i,s){t[0]=e,t[1]=r,t[2]=i,t[3]=s}(t,this.getXForColumn(i),this.getYForRow(s+1),this.getXForColumn(i+1),this.getYForRow(s)),t}getTileCoords(t,e,r=!1){n.set(e);const i=r?n.col:this.denormalizeCol(n.col,n.world);return Array.isArray(t)?l(t,this.getXForColumn(i),this.getYForRow(n.row)):(t.x=this.getXForColumn(i),t.y=this.getYForRow(n.row)),t}}var u=r(67524);class h{constructor(t,e,r){this.row=t,this.colFrom=e,this.colTo=r}}const c=new s.Z("0/0/0/0");class p{static create(t,e){t[1]>e[1]&&([t,e]=[e,t]);const[r,i]=t,[s,o]=e,l=s-r,n=o-i,a=0!==n?l/n:0,u=(Math.ceil(i)-i)*a,h=(Math.floor(i)-i)*a;return new p(r,Math.floor(i),Math.ceil(o),a,l<0?u:h,l<0?h:u,l<0?s:r,l<0?r:s)}constructor(t,e,r,i,s,o,l,n){this.x=t,this.ymin=e,this.ymax=r,this.invM=i,this.leftAdjust=s,this.rightAdjust=o,this.leftBound=l,this.rightBound=n}incrRow(){this.x+=this.invM}getLeftCol(){return Math.max(this.x+this.leftAdjust,this.leftBound)}getRightCol(){return Math.min(this.x+this.rightAdjust,this.rightBound)}}const d=[[0,0],[0,0],[0,0],[0,0]];class f{constructor(t,e=null,r=t.lods[0].level,i=t.lods[t.lods.length-1].level){this.tileInfo=t,this.fullExtent=e,this.scales=[],this._infoByScale={},this._infoByLevel={};const s=t.lods.filter((t=>t.level>=r&&t.level<=i));this.minScale=s[0].scale,this.maxScale=s[s.length-1].scale;const o=this._lodInfos=s.map((r=>a.create(t,r,e)));s.forEach(((t,e)=>{this._infoByLevel[t.level]=o[e],this._infoByScale[t.scale]=o[e],this.scales[e]=t.scale}),this),this._wrap=t.isWrappable}get spatialReference(){return this.tileInfo.spatialReference}getLODInfoAt(t){return this._infoByLevel["number"==typeof t?t:t.level]}getTileBounds(t,e,r=!1){c.set(e);const i=this._infoByLevel[c.level];return i?i.getTileBounds(t,c,r):t}getTileCoords(t,e,r=!1){c.set(e);const i=this._infoByLevel[c.level];return i?i.getTileCoords(t,c,r):t}getTileCoverage(t,e=192,r=!0,i="closest"){if(!r&&(t.scale>this.minScale||t.scale<this.maxScale))return null;const s="closest"===i?this.getClosestInfoForScale(t.scale):this.getSmallestInfoForScale(t.scale),o=u.Z.pool.acquire(s),l=this._wrap;let n,a,c,f=1/0,y=-1/0;const m=o.spans;d[0][0]=d[0][1]=d[1][1]=d[3][0]=-e,d[1][0]=d[2][0]=t.size[0]+e,d[2][1]=d[3][1]=t.size[1]+e;for(const e of d)t.toMap(e,e),e[0]=s.getColumnForX(e[0]),e[1]=s.getRowForY(e[1]);const g=[];let _=3;for(let t=0;t<4;t++){if(d[t][1]===d[_][1]){_=t;continue}const e=p.create(d[t],d[_]);f=Math.min(e.ymin,f),y=Math.max(e.ymax,y),void 0===g[e.ymin]&&(g[e.ymin]=[]),g[e.ymin].push(e),_=t}if(null==f||null==y||y-f>100)return null;let v=[];for(n=f;n<y;){null!=g[n]&&(v=v.concat(g[n])),a=1/0,c=-1/0;for(let t=v.length-1;t>=0;t--){const e=v[t];a=Math.min(a,e.getLeftCol()),c=Math.max(c,e.getRightCol())}if(a=Math.floor(a),c=Math.floor(c),n>=s.first[1]&&n<=s.last[1])if(l)if(s.size[0]<s.worldSize[0]){const t=Math.floor(c/s.worldSize[0]);for(let e=Math.floor(a/s.worldSize[0]);e<=t;e++)m.push(new h(n,Math.max(s.getFirstColumnForWorld(e),a),Math.min(s.getLastColumnForWorld(e),c)))}else m.push(new h(n,a,c));else a>s.last[0]||c<s.first[0]||(a=Math.max(a,s.first[0]),c=Math.min(c,s.last[0]),m.push(new h(n,a,c)));n+=1;for(let t=v.length-1;t>=0;t--){const e=v[t];e.ymax>=n?e.incrRow():v.splice(t,1)}}return o}getTileParentId(t){c.set(t);const e=this._infoByLevel[c.level],r=this._lodInfos.indexOf(e)-1;return r<0?null:(this._getTileIdAtLOD(c,this._lodInfos[r],c),c.id)}getTileResolution(t){const e=this._infoByLevel["object"==typeof t?t.level:t];return e?e.resolution:-1}getTileScale(t){const e=this._infoByLevel[t.level];return e?e.scale:-1}intersects(t,e){c.set(e);const r=this._infoByLevel[c.level],i=t.lodInfo;if(i.resolution>r.resolution){this._getTileIdAtLOD(c,i,c);const e=i.denormalizeCol(c.col,c.world);for(const r of t.spans)if(r.row===c.row&&r.colFrom<=e&&r.colTo>=e)return!0}if(i.resolution<r.resolution){const[e,s,o,l]=t.spans.reduce(((t,e)=>(t[0]=Math.min(t[0],e.row),t[1]=Math.max(t[1],e.row),t[2]=Math.min(t[2],e.colFrom),t[3]=Math.max(t[3],e.colTo),t)),[1/0,-1/0,1/0,-1/0]),n=r.denormalizeCol(c.col,c.world),a=i.getColumnForX(r.getXForColumn(n)),u=i.getRowForY(r.getYForRow(c.row)),h=i.getColumnForX(r.getXForColumn(n+1))-1,p=i.getRowForY(r.getYForRow(c.row+1))-1;return!(a>l||h<o||u>s||p<e)}const s=i.denormalizeCol(c.col,c.world);return t.spans.some((t=>t.row===c.row&&t.colFrom<=s&&t.colTo>=s))}normalizeBounds(t,e,r){if(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],this._wrap){const e=(0,i.C5)(this.tileInfo.spatialReference),s=-r*(e.valid[1]-e.valid[0]);t[0]+=s,t[2]+=s}return t}getSmallestInfoForScale(t){const e=this.scales;if(this._infoByScale[t])return this._infoByScale[t];if(t>e[0])return this._infoByScale[e[0]];for(let r=1;r<e.length-1;r++)if(t>e[r]+1e-6)return this._infoByScale[e[r-1]];return this._infoByScale[e[e.length-1]]}getClosestInfoForScale(t){const e=this.scales;return this._infoByScale[t]||(t=e.reduce(((e,r)=>Math.abs(r-t)<Math.abs(e-t)?r:e),e[0])),this._infoByScale[t]}scaleToLevel(t){const e=this.scales;if(this._infoByScale[t])return this._infoByScale[t].level;for(let r=e.length-1;r>=0;r--)if(t<e[r])return r===e.length-1?this._infoByScale[e[e.length-1]].level:this._infoByScale[e[r]].level+(e[r]-t)/(e[r]-e[r+1]);return this._infoByScale[e[0]].level}scaleToZoom(t){return this.tileInfo.scaleToZoom(t)}_getTileIdAtLOD(t,e,r){const i=this._infoByLevel[r.level];return t.set(r),e.resolution<i.resolution?null:(e.resolution===i.resolution||(t.level=e.level,t.col=Math.floor(r.col*i.resolution/e.resolution+.01),t.row=Math.floor(r.row*i.resolution/e.resolution+.01)),t)}}},55415:(t,e,r)=>{r.d(e,{Z:()=>s});var i=r(71143);class s{static getId(t,e,r,i){return"object"==typeof t?`${t.level}/${t.row}/${t.col}/${t.world}`:`${t}/${e}/${r}/${i}`}constructor(t,e,r,i){this.set(t,e,r,i)}get key(){return this}get id(){return this.toString()}set id(t){this.set(t)}get hash(){const t=4095&this.row,e=4095&this.col,r=63&this.level;return(3&this.world)<<30|e<<22|t<<8|r}acquire(t,e,r,i){this.set(t,e,r,i)}contains(t){const e=t.level-this.level;return e>=0&&this.row===t.row>>e&&this.col===t.col>>e&&this.world===t.world}equals(t){return this.level===t.level&&this.row===t.row&&this.col===t.col&&this.world===t.world}clone(){return new s(this)}release(){this.level=0,this.row=0,this.col=0,this.world=0}set(t,e,r,i){if(null==t)this.level=0,this.row=0,this.col=0,this.world=0;else if("object"==typeof t)this.level=t.level||0,this.row=t.row||0,this.col=t.col||0,this.world=t.world||0;else if("string"==typeof t){const[e,r,i,s]=t.split("/");this.level=parseFloat(e),this.row=parseFloat(r),this.col=parseFloat(i),this.world=parseFloat(s)}else this.level=+t,this.row=+e,this.col=+r,this.world=+i||0;return this}toString(){return`${this.level}/${this.row}/${this.col}/${this.world}`}getParentKey(){return this.level<=0?null:new s(this.level-1,this.row>>1,this.col>>1,this.world)}getChildKeys(){const t=this.level+1,e=this.row<<1,r=this.col<<1,i=this.world;return[new s(t,e,r,i),new s(t,e,r+1,i),new s(t,e+1,r,i),new s(t,e+1,r+1,i)]}compareRowMajor(t){return this.row<t.row?-1:this.row>t.row?1:this.col<t.col?-1:this.col>t.col?1:0}}s.pool=new i.Z(s,null,null,25,50)},7575:(t,e,r)=>{r.d(e,{Sh:()=>l,kr:()=>o,zO:()=>i});var i,s=r(80442);function o(t,e,r={}){const s=e===i.WEBGL1?"webgl":"webgl2";return t.getContext(s,r)||null}function l(t){if("3d"===t)return[i.WEBGL2];const e=(0,s.Z)("esri-force-webgl");return e===i.WEBGL1||e===i.WEBGL2?[e]:(0,s.Z)("mac")&&(0,s.Z)("chrome")?[i.WEBGL1,i.WEBGL2]:[i.WEBGL2,i.WEBGL1]}!function(t){t[t.WEBGL1=1]="WEBGL1",t[t.WEBGL2=2]="WEBGL2"}(i||(i={}))}}]);
|
package/interfaces.d.ts
CHANGED
|
@@ -78000,7 +78000,7 @@ declare namespace __esri {
|
|
|
78000
78000
|
*
|
|
78001
78001
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-versionManagement-VersionManagementService.html#changeVersion)
|
|
78002
78002
|
*/
|
|
78003
|
-
changeVersion(input: WebMap | Collection<FeatureLayer> | FeatureLayer[] | Network, fromVersion: Date | VersionIdentifier, toVersion: Date | VersionIdentifier): boolean
|
|
78003
|
+
changeVersion(input: WebMap | Collection<FeatureLayer> | FeatureLayer[] | Network, fromVersion: Date | VersionIdentifier, toVersion: Date | VersionIdentifier): Promise<boolean>;
|
|
78004
78004
|
/**
|
|
78005
78005
|
* Creates a new version given the following parameters.
|
|
78006
78006
|
*
|
|
@@ -81873,7 +81873,7 @@ declare namespace __esri {
|
|
|
81873
81873
|
*/
|
|
81874
81874
|
readonly suspended: boolean;
|
|
81875
81875
|
/**
|
|
81876
|
-
*
|
|
81876
|
+
* Indicates if the layer view is making any updates that will impact what is displayed on the map.
|
|
81877
81877
|
*
|
|
81878
81878
|
* @default false
|
|
81879
81879
|
*
|
package/kernel.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 has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.28";let t,i=r;i="4.28.
|
|
5
|
+
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";import{buildDate as s,commitHash as e}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const r="4.28";let t,i=r;i="4.28.2";function n(o){t=o}function m(s){const e=t?.findCredential(s);return e?.token?o(s,"token",e.token):s}has("host-webworker");export{m as addTokenParameter,s as buildDate,i as fullVersion,t as id,e as revision,n as setId,r as version};
|
|
@@ -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 t from"../../request.js";import{isSome as n}from"../../core/arrayUtils.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import s from"../../core/Loadable.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{parse as a}from"./arcgisLayerUrl.js";import l from"./Contingency.js";import u from"./ContingencyConstraintViolation.js";import c from"./ContingentValue.js";import p from"./ContingentValuesResult.js";import d from"./FieldGroup.js";import{isStringField as f,isDateField as y}from"./fieldUtils.js";import m from"./Subtype.js";var h;let g=h=class extends(i(s)){constructor(e){super(e),this.request=t,this.fieldGroups=null,this.fieldGroupDefinitions=null}initialize(){}get subtypeFieldName(){const{layer:e}=this;return"subtype-group"===e.type?e.subtypeField:e.typeIdField}static async createLoadedLayerContingentValuesCache(e){await e.load();const t=e.sourceJSON;if(void 0===e.layerId)return null;const n=t.hasContingentValuesDefinition;if(n)return new h({layer:e}).load();if(void 0===n){const t=a(e.url);if(null==t)return null;const n=t.url.path;if((await h._staticFetchEnterpriseFeatureRoot(n)).supportsQueryDataElements){const t=e.layerId.toString(),i=await h._staticFetchEnterpriseFieldGroup(n,t);if(i){const t=i.map((e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names})));return new h({layer:e,fieldGroupDefinitions:t}).load()}}}return null}async load(e){const t=this.layer.load(e).then((()=>this._initializeContingentValues(this.fieldGroupDefinitions,e)));return this.addResolvingPromise(t),this}validateContingencyConstraints(e,t){const n=Object.keys(e),i=[],s=[];for(const r of this.fieldGroups){const o=r.isEditingRestrictive?"error":"warning";if(t&&!r.fields.some((e=>t.includes(e))))continue;if(!r.fields.every((e=>n.includes(e)))){s.push(new u({fieldGroup:r,type:o}));continue}let a=!1;const l=e[this.subtypeFieldName],c=r.contingencies.filter((e=>!(!e.isRetired&&e.subtype)||e.subtype.code===l));for(const t of c){let n=!0;for(const i in t.values){const s=t.values[i];if("any"!==s.objectType)if("null"===s.objectType){if(null!=e[i]){n=!1;break}}else if("code"===s.objectType){if(e[i]!==s.codedValue.code){n=!1;break}}else if("range"===s.objectType){const t=e[i];if(t<s.minValue||t>s.maxValue){n=!1;break}}}if(n){a=!0;break}}a||i.push(new u({fieldGroup:r,type:o}))}return{invalid:i,incomplete:s}}getContingentValues(e,t,n=!1){const i=e[this.subtypeFieldName],s=null!=i,r={};let o=[];const a=this.fieldGroups.filter((e=>e.fields.includes(t)));o.push(new c({objectType:"any"}));for(const l of a){let a=[];const u=l.contingencies.filter((e=>!(e.isRetired||e.subtype&&s&&e.subtype.code!==i)));let c=!1;const p={};for(const n of u){let i,s=!0;for(const r in n.values){const o=n.values[r];if(t!==r){if(void 0!==e[r]&&"any"!==o.objectType)if("null"===o.objectType)null!==e[r]&&(s=!1);else if("code"===o.objectType)e[r]!==o.codedValue.code&&(s=!1);else if("range"===o.objectType){const t=e[r];(t<o.minValue||t>o.maxValue)&&(s=!1)}}else i=o,c=c||"range"===o.objectType}if(i&&s){if("any"===i.objectType){a.length=0,a.push(i);break}const e=this._generateKey(i);p[e]||a.push(i),p[e]=!0}}c&&(a=this._joinRange(a)),r[l.name]=a,o=n?this._filterIntersection(o,a):[]}return 1===a.length&&n&&(o=[]),new p({contingentValuesAllGroups:o,contingentValuesByFieldGroup:r})}_generateKey(e){switch(e.objectType){case"any":return"@any@";case"null":return"@null@";case"code":return e.codedValue.name+e.codedValue.code.toString();case"range":return e.minValue.toString()+"-"+e.maxValue.toString()}}_joinRange(e){let t,n;e.sort(((e,t)=>"null"===e.objectType?-1:"null"===t.objectType?1:e.minValue-t.minValue));const i=[];for(const s of e)"null"!==s.objectType?null!=t&&null!=n?n<s.minValue?(i.push(new c({objectType:"range",minValue:t,maxValue:n})),t=s.minValue,n=s.maxValue):n<s.maxValue&&(n=s.maxValue):(t=s.minValue,n=s.maxValue):i.push(s);return i.push(new c({objectType:"range",minValue:t,maxValue:n})),i}_filterIntersection(e,t){if(0===e.length||0===t.length)return[];if("any"===e[0].objectType)return t;if("any"===t[0].objectType)return e;const n="range"===e[0].objectType||"range"===e[1]?.objectType,i="range"===t[0].objectType||"range"===t[1]?.objectType;return n||i?this._intersectRanges(e,t):this._intersectValues(e,t)}_intersectRanges(e,t){const n=[];let i,s=0;for(const r of e)for(;s<t.length;s++){const e=t[s];if("null"===r.objectType&&"null"===e.objectType)n.push(new c({objectType:"null"}));else{if("null"===r.objectType)break;if("null"===e.objectType)continue}if(r.maxValue<e.minValue)break;if(r.maxValue===e.minValue){n.push(new c({objectType:"range",minValue:r.maxValue,maxValue:e.minValue}));break}if(!(r.minValue>e.maxValue))if(r.minValue!==e.maxValue){if(i=r.minValue>e.minValue?r.minValue:e.minValue,r.maxValue<e.maxValue){n.push(new c({objectType:"range",minValue:i,maxValue:r.maxValue}));break}n.push(new c({objectType:"range",minValue:i,maxValue:e.maxValue}))}else n.push(new c({objectType:"range",minValue:r.minValue,maxValue:e.maxValue}))}return n}_intersectValues(e,t){const n=[];for(const i of e)t.some((e=>{if(i.objectType===e.objectType)switch(i.objectType){case"any":case"null":return!0;case"code":return i.codedValue.code===e.codedValue.code&&i.codedValue.name===e.codedValue.name}return!1}))&&n.push(i);return n}static async _staticFetchEnterpriseFeatureRoot(e,n){return t(e,{responseType:"json",query:{f:"json"},...n}).then((e=>e.data))}static async _staticFetchEnterpriseFieldGroup(e,n,i){return t(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then((e=>e.data.layerDataElements?.[0].dataElement.fieldGroups))}async _initializeContingentValues(e,t){const n=e??await this._fetchFieldGroupDefs(t);if(0===n.length)return void(this.fieldGroups=[]);const i=await this._fetchContingentValues(n,t);this.fieldGroups=i}async _fetchFieldGroupDefs(e){if(void 0===this.layer.layerId)return[];const t=this.layer.sourceJSON,n=this.layer.layerId.toString(),i=a(this.layer.url).url.path;if(t.hasContingentValuesDefinition){return(await this._fetchAGOLFieldGroup(i,n,e)).map((e=>({name:e.name,isEditingRestrictive:e.restrictive,fields:e.fields.map((e=>this.layer.fieldsIndex.normalizeFieldName(e)))})))}return void 0!==t.hasContingentValuesDefinition?[]:this._fetchEnterpriseFeatureRoot(i,e).then((async t=>{if(t.supportsQueryDataElements){return(await this._fetchEnterpriseFieldGroup(i,n,e)).map((e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map((e=>this.layer.fieldsIndex.normalizeFieldName(e)))})))}return[]}))}async _fetchAGOLFieldGroup(e,n,i){return t(`${e}/${n}/fieldgroups`,{responseType:"json",query:{f:"json"},...i}).then((e=>e.data.fieldGroups))}async _fetchEnterpriseFieldGroup(e,t,n){return h._staticFetchEnterpriseFieldGroup(e,t,n)}async _fetchEnterpriseFeatureRoot(e,t){return h._staticFetchEnterpriseFeatureRoot(e,t)}async _fetchContingentValues(e,t){if(void 0===this.layer.layerId)return[];const n=this.layer.sourceJSON,i=this.layer.layerId.toString(),s=a(this.layer.url).url.path;if(n.hasContingentValuesDefinition){const n=await this._fetchAGOLContingentValues(s,i,t);return this._constructFieldGroupsAGOL(e,n)}const r=await this._fetchEnterpriseContingentValues(s,i,t);return this._constructFieldGroupsEnterprise(e,r)}_constructFieldGroupsAGOL(e,t){return e.map((e=>{const n=t.contingentValuesDefinition.fieldGroups.find((t=>t.name===e.name));if(n){let i=[];return i=t.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(e,t,n.subTypes):this._parseAGOLFieldGroup(e,t,n.contingentValues),new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null})).filter(n)}_parseAGOLFieldGroupSubtype(e,t,n){let i=[];return n?.forEach((n=>{const s=this._getSubtypeAGOL(n.name);i=i.concat(this._parseAGOLFieldGroup(e,t,n.contingentValues,s))})),i}_parseAGOLFieldGroup(e,t,n,i=null){const s=[];for(const r of n??[]){const n=this._parseAGOLContingency(r,e,t,i);s.push(n)}return s}_parseAGOLContingency(e,t,n,i){const s=e.id,r=!!e.retired&&1===e.retired,o={};for(let a=0,l=0;a<t.fields.length;a++){const s=t.fields[a],r=n.typeCodes[e.types[a]];if("Code"===r){let t=e.values[l];l++;const r=this._getDomain(i,s),a=this.layer.getField(s);if("string"===a?.type){const e=n.stringDicts.find((e=>e.domain===r?.name));e&&(t=e.entries[t])}const u=r?.codedValues.find((e=>e.code===t)),p=new c({codedValue:u,objectType:"code"});o[s]=p}else if("Range"===r){const t=e.values[l];l++;const n=t.range[0],i=t.range[1],r=new c({minValue:n,maxValue:i,objectType:"range"});o[s]=r}else if("Any"===r){const e=new c({objectType:"any"});o[s]=e}else{const e=new c({objectType:"null"});o[s]=e}}return new l({id:s,isRetired:r,subtype:i,values:o})}_constructFieldGroupsEnterprise(e,t){const i=t.fieldGroups;return e.map((e=>{const n=i.find((t=>t.name===e.name));if(n){const i=n.contingencies.map((n=>{const i=n.id,s=n.isRetired||!1,r=this._getSubtypeEnterprise(n.subtypeCode),o={};for(let a=0;a<e.fields.length;a++){const i=e.fields[a];let s=n.values[a];if("number"==typeof s||"string"==typeof s){const e=this._getDomain(r,i),n=this.layer.getField(i);if(f(n))s=t.stringDictionary[s];else if(y(n)){const e=new Date(`${s}+00:00`);s=e.getTime()}const a=e?.codedValues.find((e=>e.code===s)),l=new c({codedValue:a,objectType:"code"});o[i]=l}else if("object"==typeof s){const e=s.minValue,t=s.maxValue,n=new c({minValue:e,maxValue:t,objectType:"range"});o[i]=n}else if(s){const e=new c({objectType:"any"});o[i]=e}else{const e=new c({objectType:"null"});o[i]=e}}return new l({id:i,isRetired:s,subtype:r,values:o})}));return new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null})).filter(n)}async _fetchEnterpriseContingentValues(e,n,i){return t(`${e}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then((e=>e.data.contingentValueSets?.[0]))}async _fetchAGOLContingentValues(e,n,i){return t(`${e}/${n}/contingentValues`,{responseType:"json",query:{f:"json"},...i}).then((e=>e.data))}_getSubtypeEnterprise(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find((t=>t.code===e));n=m.fromJSON(i)}return n||null}_getSubtypeAGOL(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find((t=>t.name===e));n=m.fromJSON(i)}return n||null}_findDomainByFieldName(e,t){const n=e.domains;if(n){const[e,i]=Object.entries(n).find((([e])=>e.trim().toLowerCase()===t.trim().toLowerCase()))||[];return i||null}return null}_getDomain(e,t){const n=e?this._findDomainByFieldName(e,t):this.layer.getFieldDomain(t);return"inherited"===n?.type?this.layer.getFieldDomain(t):n}};e([r({constructOnly:!0})],g.prototype,"layer",void 0),e([r({constructOnly:!0})],g.prototype,"request",void 0),e([r({type:[d]})],g.prototype,"fieldGroups",void 0),e([r({constructOnly:!0})],g.prototype,"fieldGroupDefinitions",void 0),e([r()],g.prototype,"subtypeFieldName",null),g=h=e([o("esri.layers.support.LayerContingentValuesCache")],g);const V=g;export{V as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import{isSome as n}from"../../core/arrayUtils.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import s from"../../core/Loadable.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{parse as a}from"./arcgisLayerUrl.js";import l from"./Contingency.js";import u from"./ContingencyConstraintViolation.js";import c from"./ContingentValue.js";import p from"./ContingentValuesResult.js";import d from"./FieldGroup.js";import{isStringField as f,isDateField as y}from"./fieldUtils.js";import m from"./Subtype.js";var h;let g=h=class extends(i(s)){constructor(e){super(e),this.request=t,this.fieldGroups=null,this.fieldGroupDefinitions=null}initialize(){}get subtypeFieldName(){const{layer:e}=this;return"subtype-group"===e.type?e.subtypeField:e.typeIdField}static async createLoadedLayerContingentValuesCache(e){await e.load();const t=e.sourceJSON;if(void 0===e.layerId)return null;const n=t.hasContingentValuesDefinition;if(n)return new h({layer:e}).load();if(void 0===n){const t=a(e.url);if(null==t)return null;const n=t.url.path;if((await h._staticFetchEnterpriseFeatureRoot(n)).supportsQueryDataElements){const t=e.layerId.toString(),i=await h._staticFetchEnterpriseFieldGroup(n,t);if(i){const t=i.map((t=>({name:t.name,isEditingRestrictive:t.isEditingRestrictive,fields:t.fieldNames.names.map((t=>e.fieldsIndex.normalizeFieldName(t)))})));return new h({layer:e,fieldGroupDefinitions:t}).load()}}}return null}async load(e){const t=this.layer.load(e).then((()=>this._initializeContingentValues(this.fieldGroupDefinitions,e)));return this.addResolvingPromise(t),this}validateContingencyConstraints(e,t){const n=Object.keys(e),i=[],s=[];for(const r of this.fieldGroups){const o=r.isEditingRestrictive?"error":"warning";if(t&&!r.fields.some((e=>t.includes(e))))continue;if(!r.fields.every((e=>n.includes(e)))){s.push(new u({fieldGroup:r,type:o}));continue}let a=!1;const l=e[this.subtypeFieldName],c=r.contingencies.filter((e=>!(!e.isRetired&&e.subtype)||e.subtype.code===l));for(const t of c){let n=!0;for(const i in t.values){const s=t.values[i];if("any"!==s.objectType)if("null"===s.objectType){if(null!=e[i]){n=!1;break}}else if("code"===s.objectType){if(e[i]!==s.codedValue.code){n=!1;break}}else if("range"===s.objectType){const t=e[i];if(t<s.minValue||t>s.maxValue){n=!1;break}}}if(n){a=!0;break}}a||i.push(new u({fieldGroup:r,type:o}))}return{invalid:i,incomplete:s}}getContingentValues(e,t,n=!1){const i=e[this.subtypeFieldName],s=null!=i,r={};let o=[];const a=this.fieldGroups.filter((e=>e.fields.includes(t)));o.push(new c({objectType:"any"}));for(const l of a){let a=[];const u=l.contingencies.filter((e=>!(e.isRetired||e.subtype&&s&&e.subtype.code!==i)));let c=!1;const p={};for(const n of u){let i,s=!0;for(const r in n.values){const o=n.values[r];if(t!==r){if(void 0!==e[r]&&"any"!==o.objectType)if("null"===o.objectType)null!==e[r]&&(s=!1);else if("code"===o.objectType)e[r]!==o.codedValue.code&&(s=!1);else if("range"===o.objectType){const t=e[r];(t<o.minValue||t>o.maxValue)&&(s=!1)}}else i=o,c=c||"range"===o.objectType}if(i&&s){if("any"===i.objectType){a.length=0,a.push(i);break}const e=this._generateKey(i);p[e]||a.push(i),p[e]=!0}}c&&(a=this._joinRange(a)),r[l.name]=a,o=n?this._filterIntersection(o,a):[]}return 1===a.length&&n&&(o=[]),new p({contingentValuesAllGroups:o,contingentValuesByFieldGroup:r})}_generateKey(e){switch(e.objectType){case"any":return"@any@";case"null":return"@null@";case"code":return e.codedValue.name+e.codedValue.code.toString();case"range":return e.minValue.toString()+"-"+e.maxValue.toString()}}_joinRange(e){let t,n;e.sort(((e,t)=>"null"===e.objectType?-1:"null"===t.objectType?1:e.minValue-t.minValue));const i=[];for(const s of e)"null"!==s.objectType?null!=t&&null!=n?n<s.minValue?(i.push(new c({objectType:"range",minValue:t,maxValue:n})),t=s.minValue,n=s.maxValue):n<s.maxValue&&(n=s.maxValue):(t=s.minValue,n=s.maxValue):i.push(s);return i.push(new c({objectType:"range",minValue:t,maxValue:n})),i}_filterIntersection(e,t){if(0===e.length||0===t.length)return[];if("any"===e[0].objectType)return t;if("any"===t[0].objectType)return e;const n="range"===e[0].objectType||"range"===e[1]?.objectType,i="range"===t[0].objectType||"range"===t[1]?.objectType;return n||i?this._intersectRanges(e,t):this._intersectValues(e,t)}_intersectRanges(e,t){const n=[];let i,s=0;for(const r of e)for(;s<t.length;s++){const e=t[s];if("null"===r.objectType&&"null"===e.objectType)n.push(new c({objectType:"null"}));else{if("null"===r.objectType)break;if("null"===e.objectType)continue}if(r.maxValue<e.minValue)break;if(r.maxValue===e.minValue){n.push(new c({objectType:"range",minValue:r.maxValue,maxValue:e.minValue}));break}if(!(r.minValue>e.maxValue))if(r.minValue!==e.maxValue){if(i=r.minValue>e.minValue?r.minValue:e.minValue,r.maxValue<e.maxValue){n.push(new c({objectType:"range",minValue:i,maxValue:r.maxValue}));break}n.push(new c({objectType:"range",minValue:i,maxValue:e.maxValue}))}else n.push(new c({objectType:"range",minValue:r.minValue,maxValue:e.maxValue}))}return n}_intersectValues(e,t){const n=[];for(const i of e)t.some((e=>{if(i.objectType===e.objectType)switch(i.objectType){case"any":case"null":return!0;case"code":return i.codedValue.code===e.codedValue.code&&i.codedValue.name===e.codedValue.name}return!1}))&&n.push(i);return n}static async _staticFetchEnterpriseFeatureRoot(e,n){return t(e,{responseType:"json",query:{f:"json"},...n}).then((e=>e.data))}static async _staticFetchEnterpriseFieldGroup(e,n,i){return t(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then((e=>e.data.layerDataElements?.[0].dataElement.fieldGroups))}async _initializeContingentValues(e,t){const n=e??await this._fetchFieldGroupDefs(t);if(0===n.length)return void(this.fieldGroups=[]);const i=await this._fetchContingentValues(n,t);this.fieldGroups=i}async _fetchFieldGroupDefs(e){if(void 0===this.layer.layerId)return[];const t=this.layer.sourceJSON,n=this.layer.layerId.toString(),i=a(this.layer.url).url.path;if(t.hasContingentValuesDefinition){return(await this._fetchAGOLFieldGroup(i,n,e)).map((e=>({name:e.name,isEditingRestrictive:e.restrictive,fields:e.fields.map((e=>this.layer.fieldsIndex.normalizeFieldName(e)))})))}return void 0!==t.hasContingentValuesDefinition?[]:this._fetchEnterpriseFeatureRoot(i,e).then((async t=>{if(t.supportsQueryDataElements){return(await this._fetchEnterpriseFieldGroup(i,n,e)).map((e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map((e=>this.layer.fieldsIndex.normalizeFieldName(e)))})))}return[]}))}async _fetchAGOLFieldGroup(e,n,i){return t(`${e}/${n}/fieldgroups`,{responseType:"json",query:{f:"json"},...i}).then((e=>e.data.fieldGroups))}async _fetchEnterpriseFieldGroup(e,t,n){return h._staticFetchEnterpriseFieldGroup(e,t,n)}async _fetchEnterpriseFeatureRoot(e,t){return h._staticFetchEnterpriseFeatureRoot(e,t)}async _fetchContingentValues(e,t){if(void 0===this.layer.layerId)return[];const n=this.layer.sourceJSON,i=this.layer.layerId.toString(),s=a(this.layer.url).url.path;if(n.hasContingentValuesDefinition){const n=await this._fetchAGOLContingentValues(s,i,t);return this._constructFieldGroupsAGOL(e,n)}const r=await this._fetchEnterpriseContingentValues(s,i,t);return this._constructFieldGroupsEnterprise(e,r)}_constructFieldGroupsAGOL(e,t){return e.map((e=>{const n=t.contingentValuesDefinition.fieldGroups.find((t=>t.name===e.name));if(n){let i=[];return i=t.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(e,t,n.subTypes):this._parseAGOLFieldGroup(e,t,n.contingentValues),new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null})).filter(n)}_parseAGOLFieldGroupSubtype(e,t,n){let i=[];return n?.forEach((n=>{const s=this._getSubtypeAGOL(n.name);i=i.concat(this._parseAGOLFieldGroup(e,t,n.contingentValues,s))})),i}_parseAGOLFieldGroup(e,t,n,i=null){const s=[];for(const r of n??[]){const n=this._parseAGOLContingency(r,e,t,i);s.push(n)}return s}_parseAGOLContingency(e,t,n,i){const s=e.id,r=!!e.retired&&1===e.retired,o={};for(let a=0,l=0;a<t.fields.length;a++){const s=t.fields[a],r=n.typeCodes[e.types[a]];if("Code"===r){let t=e.values[l];l++;const r=this._getDomain(i,s),a=this.layer.getField(s);if("string"===a?.type){const e=n.stringDicts.find((e=>e.domain===r?.name));e&&(t=e.entries[t])}const u=r?.codedValues.find((e=>e.code===t)),p=new c({codedValue:u,objectType:"code"});o[s]=p}else if("Range"===r){const t=e.values[l];l++;const n=t.range[0],i=t.range[1],r=new c({minValue:n,maxValue:i,objectType:"range"});o[s]=r}else if("Any"===r){const e=new c({objectType:"any"});o[s]=e}else{const e=new c({objectType:"null"});o[s]=e}}return new l({id:s,isRetired:r,subtype:i,values:o})}_constructFieldGroupsEnterprise(e,t){const i=t.fieldGroups;return e.map((e=>{const n=i.find((t=>t.name===e.name));if(n){const i=n.contingencies.map((n=>{const i=n.id,s=n.isRetired||!1,r=this._getSubtypeEnterprise(n.subtypeCode),o={};for(let a=0;a<e.fields.length;a++){const i=e.fields[a];let s=n.values[a];if("number"==typeof s||"string"==typeof s){const e=this._getDomain(r,i),n=this.layer.getField(i);if(f(n))s=t.stringDictionary[s];else if(y(n)){const e=new Date(`${s}+00:00`);s=e.getTime()}const a=e?.codedValues.find((e=>e.code===s)),l=new c({codedValue:a,objectType:"code"});o[i]=l}else if("object"==typeof s){const e=s.minValue,t=s.maxValue,n=new c({minValue:e,maxValue:t,objectType:"range"});o[i]=n}else if(s){const e=new c({objectType:"any"});o[i]=e}else{const e=new c({objectType:"null"});o[i]=e}}return new l({id:i,isRetired:s,subtype:r,values:o})}));return new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null})).filter(n)}async _fetchEnterpriseContingentValues(e,n,i){return t(`${e}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then((e=>e.data.contingentValueSets?.[0]))}async _fetchAGOLContingentValues(e,n,i){return t(`${e}/${n}/contingentValues`,{responseType:"json",query:{f:"json"},...i}).then((e=>e.data))}_getSubtypeEnterprise(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find((t=>t.code===e));n=m.fromJSON(i)}return n||null}_getSubtypeAGOL(e){const t=this.layer.sourceJSON;let n;if(t.subtypes){const i=t.subtypes.find((t=>t.name===e));n=m.fromJSON(i)}return n||null}_findDomainByFieldName(e,t){const n=e.domains;if(n){const[e,i]=Object.entries(n).find((([e])=>e.trim().toLowerCase()===t.trim().toLowerCase()))||[];return i||null}return null}_getDomain(e,t){const n=e?this._findDomainByFieldName(e,t):this.layer.getFieldDomain(t);return"inherited"===n?.type?this.layer.getFieldDomain(t):n}};e([r({constructOnly:!0})],g.prototype,"layer",void 0),e([r({constructOnly:!0})],g.prototype,"request",void 0),e([r({type:[d]})],g.prototype,"fieldGroups",void 0),e([r({constructOnly:!0})],g.prototype,"fieldGroupDefinitions",void 0),e([r()],g.prototype,"subtypeFieldName",null),g=h=e([o("esri.layers.support.LayerContingentValuesCache")],g);const V=g;export{V as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../request.js";import{clone as
|
|
5
|
+
import"../../geometry.js";import e from"../../request.js";import{clone as t}from"../../core/lang.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{isProtocolRelative as o,isAbsolute as s,join as l,removeTrailingSlash as n,normalize as i,removeFile as u,getAppBaseUrl as a,addQueryParameters as c}from"../../core/urlUtils.js";import{WGS84 as f,WebMercator as m}from"../../geometry/support/spatialReferenceUtils.js";import{geographicToWebMercator as p}from"../../geometry/support/webMercatorUtils.js";import y from"./TileInfo.js";import d from"../../views/2d/engine/vectorTiles/style/VectorTileSource.js";import x from"../../views/2d/tiling/TileInfoView.js";import S from"../../geometry/SpatialReference.js";async function w(e,t){const r={source:null,sourceBase:null,sourceUrl:null,validatedSource:null,style:null,styleBase:null,styleUrl:null,sourceNameToSource:{},primarySourceName:"",spriteFormat:"png"},[o,s]="string"==typeof e?[e,null]:[null,e.jsonUrl];await j(r,"esri",e,s,t);return{layerDefinition:r.validatedSource,url:o,serviceUrl:r.sourceUrl,style:r.style,styleUrl:r.styleUrl,spriteUrl:r.style.sprite&&h(r.styleBase,r.style.sprite),spriteFormat:r.spriteFormat,glyphsUrl:r.style.glyphs&&h(r.styleBase,r.style.glyphs),sourceNameToSource:r.sourceNameToSource,primarySourceName:r.primarySourceName}}function h(...e){let t;for(const r of e)if(null!=r)if(o(r)){if(t){const e=t.split("://")[0];t=e+":"+r.trim()}}else t=s(r)?r:l(t,r);return t?n(t):void 0}async function j(t,o,s,l,n){let u,a,c;if(r(n),"string"==typeof s){const t=i(s);c=await e(t,{...n,responseType:"json",query:{f:"json",...n?.query}}),c.ssl&&(u&&(u=u.replace(/^http:/i,"https:")),a&&(a=a.replace(/^http:/i,"https:"))),u=t,a=t}else null!=s&&(c={data:s},u=s.jsonUrl||null,a=l);const f=c?.data;if(U(f))return t.styleUrl=u||null,N(t,f,a,n);if(v(f))return t.sourceUrl?I(t,f,a,!1,o,n):(t.sourceUrl=u||null,I(t,f,a,!0,o,n));throw new Error("You must specify the URL or the JSON for a service or for a style.")}function g(e){return"object"==typeof e&&!!e&&"tilejson"in e&&null!=e.tilejson}function U(e){return!!e&&"sources"in e&&!!e.sources}function v(e){return!U(e)}async function N(e,t,r,o){const s=r?u(r):a();e.styleBase=s,e.style=t,t["sprite-format"]&&"webp"===t["sprite-format"].toLowerCase()&&(e.spriteFormat="webp");const l=[];if(t.sources&&t.sources.esri){const r=t.sources.esri;r.url?await j(e,"esri",h(s,r.url),void 0,o):l.push(j(e,"esri",r,s,o))}for(const n of Object.keys(t.sources))"esri"!==n&&"vector"===t.sources[n].type&&(t.sources[n].url?l.push(j(e,n,h(s,t.sources[n].url),void 0,o)):t.sources[n].tiles&&l.push(j(e,n,t.sources[n],s,o)));await Promise.all(l)}async function I(e,t,r,o,s,l){const i=r?n(r)+"/":a(),u=T(t),f=new d(s,c(i,l?.query??{}),u);if(!o&&e.primarySourceName in e.sourceNameToSource){const t=e.sourceNameToSource[e.primarySourceName];if(!t.isCompatibleWith(f))return;null!=f.fullExtent&&(null!=t.fullExtent?t.fullExtent.union(f.fullExtent):t.fullExtent=f.fullExtent.clone()),t.tileInfo&&f.tileInfo&&t.tileInfo.lods.length<f.tileInfo.lods.length&&(t.tileInfo=f.tileInfo)}if(o&&(e.sourceBase=i,e.source=t,e.validatedSource=u,e.primarySourceName=s),e.sourceNameToSource[s]=f,!g(e)&&"defaultStyles"in t&&!e.style){if(null==t.defaultStyles)throw new Error;return"string"==typeof t.defaultStyles?j(e,"",h(i,t.defaultStyles,"root.json"),void 0,l):j(e,"",t.defaultStyles,h(i,"root.json"),l)}}function T(e){if(e.hasOwnProperty("tileInfo"))return e;const r={xmin:-20037507.067161843,ymin:-20037507.067161843,xmax:20037507.067161843,ymax:20037507.067161843,spatialReference:{wkid:102100,latestWkid:3857}};let o=null;if(g(e)){const{bounds:r}=e;if(r){const e=p({x:r[0],y:r[1],spatialReference:t(f)}),s=p({x:r[2],y:r[3],spatialReference:t(f)});o={xmin:e.x,ymin:e.y,xmax:s.x,ymax:s.y,spatialReference:t(m)}}}null===o&&(o=r);const s=new x(y.create({spatialReference:S.WebMercator,size:512,numLODs:25})),l=512;let n=78271.51696400007,i=295828763.7957775;const u=[],a=e.hasOwnProperty("minzoom")&&null!=e.minzoom,c=e.hasOwnProperty("maxzoom")&&null!=e.maxzoom,d=a?+e.minzoom:0,w=c?+e.maxzoom:22;let h=0;a&&d>0&&d<25&&(h=s.getLODInfoAt(d).scale);let j=0;c&&w>0&&w<25&&(j=s.getLODInfoAt(w).scale);for(let t=0;t<=w;t++)u.push({level:t,scale:i,resolution:n}),n/=2,i/=2;return{capabilities:"TilesOnly",initialExtent:o,fullExtent:r,minScale:h,maxScale:j,tiles:e.tiles,tileInfo:{rows:l,cols:l,dpi:96,format:"pbf",origin:{x:-20037508.342787,y:20037508.342787},lods:u,spatialReference:t(m)}}}export{w as loadMetadata};
|
package/package.json
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{toHSV as t}from"../../core/colorUtils.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import s from"../../core/Logger.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import n from"../../layers/support/RasterInfo.js";import{colorize as i,remapColor as l,lookupPixels as u,createColormapLUT as c,isValidPixelBlock as p}from"../../layers/support/rasterFunctions/pixelUtils.js";import{stretch as d,getStretchCutoff as h,createStretchLUT as m,computeGammaValues as f,createHistogramEqualizationLUT as y}from"../../layers/support/rasterFunctions/stretchUtils.js";import{hillshade as g,tintHillshade as b,calculateHillshadeParams as S}from"../../layers/support/rasterFunctions/surfaceUtils.js";import{convertColorRampToColormap as k}from"./colorRampUtils.js";import{isUVRendererSupported as R,isColormapRendererSupported as x,isShadedReliefRendererSupported as I}from"./rasterRendererChecks.js";let C=class extends r{constructor(e){super(e)}bind(){const{rendererJSON:e}=this;if(!e)return{success:!1};let t;switch(this.lookup={rendererJSON:{}},e.type){case"uniqueValue":t=this._updateUVRenderer(e);break;case"rasterColormap":t=this._updateColormapRenderer(e);break;case"rasterStretch":t=this._updateStretchRenderer(e);break;case"classBreaks":t=this._updateClassBreaksRenderer(e);break;case"rasterShadedRelief":t=this._updateShadedReliefRenderer(e);break;case"vectorField":t=this._updateVectorFieldRenderer();break;case"flowRenderer":t=this._updateFlowRenderer()}return t}symbolize(e){let t=e?.pixelBlock;if(!_(t))return t;if(e.simpleStretchParams&&"rasterStretch"===this.rendererJSON.type)return this.simpleStretch(t,e.simpleStretchParams);try{let r;switch(t.pixels.length>3&&(t=t.extractBands([0,1,2])),this.rendererJSON.type){case"uniqueValue":case"rasterColormap":r=this._symbolizeColormap(t);break;case"classBreaks":r=this._symbolizeClassBreaks(t);break;case"rasterStretch":r=this._symbolizeStretch(t,e.bandIds);break;case"rasterShadedRelief":{const s=e.extent,o=s.spatialReference.isGeographic,a={x:(s.xmax-s.xmin)/t.width,y:(s.ymax-s.ymin)/t.height};r=this._symbolizeShadedRelief(t,{isGCS:o,resolution:a});break}}return r}catch(r){return s.getLogger(this).error("symbolize",r.message),t}}simpleStretch(e,t){if(!_(e))return e;try{return e.pixels.length>3&&(e=e.extractBands([0,1,2])),d(e,{...t,isRenderer:!0})}catch(r){return s.getLogger(this).error("symbolize",r.message),e}}generateWebGLParameters(e){if(["uniqueValue","rasterColormap","classBreaks"].includes(this.rendererJSON.type)){const{indexedColormap:e,offset:t}=this.lookup.colormapLut||{};return{colormap:e,colormapOffset:t,type:"lut"}}const{pixelBlock:t,isGCS:r,resolution:s,bandIds:o}=e,{rendererJSON:a}=this;return"rasterStretch"===a.type?this._generateStretchWebGLParams(t,a,o):"rasterShadedRelief"===a.type?this._generateShadedReliefWebGLParams(a,r,s??void 0):"vectorField"===a.type?this._generateVectorFieldWebGLParams(a):null}_isLUTChanged(e){if(!this.lookup||!this.lookup.rendererJSON)return!0;if("colorRamp"in this.rendererJSON){const t=this.rendererJSON.colorRamp;return e?JSON.stringify(t)!==JSON.stringify(this.lookup.rendererJSON.colorRamp):(this.rendererJSON,this.lookup.rendererJSON,JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON))}return JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON)}_symbolizeColormap(e){if(this._isLUTChanged()){if(!this.bind().success)return e}return i(e,this.lookup.colormapLut)}_symbolizeClassBreaks(e){const{canUseIndexedLUT:t}=this._analyzeClassBreaks(this.rendererJSON);if(this._isLUTChanged()){if(!this.bind().success)return e}return t?i(e,this.lookup.colormapLut):l(e,this.lookup.remapLut??[])}_symbolizeStretch(e,t){const{rasterInfo:r}=this,{pixelType:s,bandCount:o}=r,a=this.rendererJSON,n=["u8","u16","s8","s16"].includes(s);let l,c;const{dra:p}=a,{gamma:f}=this.lookup;if("histogramEqualization"===a.stretchType){const s=p?null:this.lookup?.histogramLut,o=h(a,{rasterInfo:r,pixelBlock:e,bandIds:t,returnHistogramLut:!s}),n=d(e,{...o,gamma:f,isRenderer:!0});c=u(n,{lut:p?o.histogramLut:s,offset:0})}else if(n){if(p){const o=h(a,{rasterInfo:r,pixelBlock:e,bandIds:t});l=m({pixelType:s,...o,gamma:f,rounding:"floor"})}else if(this._isLUTChanged()){if(!this.bind().success)return e;l=this.lookup?this.lookup.stretchLut:null}else l=this.lookup?this.lookup.stretchLut:null;if(!l)return e;o>1&&null!=t&&t.length===e?.pixels.length&&l?.lut.length===o&&(l={lut:t.map((e=>l.lut[e])),offset:l.offset}),c=u(e,l)}else{const s=h(a,{rasterInfo:r,pixelBlock:e,bandIds:t});c=d(e,{...s,gamma:f,isRenderer:!0})}if(a.colorRamp){if(this._isLUTChanged(!0)){if(!this.bind().success)return e}c=i(c,this.lookup?.colormapLut)}return c}_symbolizeShadedRelief(e,t){const r=this.rendererJSON,s={...r,...t},o=g(e,s);if(!r.colorRamp)return o;let a;if(this._isLUTChanged(!0)){if(!this.bind().success)return o;a=this.lookup?this.lookup.hsvMap:null}else a=this.lookup?this.lookup.hsvMap:null;if(!a)return o;const n=this.rasterInfo.statistics?.[0]??{min:0,max:8e3};return b(o,e,a,n),o}_isVectorFieldData(){const{bandCount:e,dataType:t}=this.rasterInfo;return 2===e&&("vector-magdir"===t||"vector-uv"===t)}_updateVectorFieldRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".`}}_updateFlowRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".`}}_updateUVRenderer(e){const{bandCount:t,attributeTable:r,pixelType:s}=this.rasterInfo,o=e.field1;if(!o)return{success:!1,error:"Unsupported renderer; missing UniqueValueRenderer.field."};const a=e.defaultSymbol,n=1===t&&["u8","s8"].includes(s);if(!R(this.rasterInfo,o)&&!n)return{success:!1,error:"Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table."};const i=[];if(null!=r){const t=r.fields.find((e=>"value"===e.name.toLowerCase()));if(!t)return{success:!1,error:"Unsupported data; the data's raster attribute table does not have a value field."};r.features.forEach((r=>{const s=e.uniqueValueInfos?.find((e=>String(e.value)===String(r.attributes[o]))),n=s?.symbol?.color;n?i.push([r.attributes[t.name]].concat(n)):a&&i.push([r.attributes[t.name]].concat(a.color))}))}else{if("value"!==o.toLowerCase())return{success:!1,error:'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not availalbe.'};e.uniqueValueInfos?.forEach((e=>{const t=e?.symbol?.color;t?i.push([parseInt(""+e.value,10)].concat(t)):a&&i.push([parseInt(""+e.value,10)].concat(a?.color))}))}if(0===i.length)return{success:!1,error:"Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table."};const l=c({colormap:i});return this.lookup={rendererJSON:e,colormapLut:l},this.canRenderInWebGL=!0,{success:!0}}_updateColormapRenderer(e){if(!x(this.rasterInfo))return{success:!1,error:"Unsupported data; the data source does not have a colormap."};const t=e.colormapInfos.map((e=>[e.value].concat(e.color))).sort(((e,t)=>e[0]-t[0]));if(!t||0===t.length)return{success:!1,error:"Unsupported renderer; ColormapRenderer must have meaningful colormapInfos."};const r=c({colormap:t});return this.lookup={rendererJSON:e,colormapLut:r},this.canRenderInWebGL=!0,{success:!0}}_updateShadedReliefRenderer(e){if(!I(this.rasterInfo))return{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.`};if(e.colorRamp){const r=k(e.colorRamp,{interpolateAlpha:!0}),s=c({colormap:r}),o=[],a=s.indexedColormap;for(let e=0;e<a.length;e+=4){const r=t({r:a[e],g:a[e+1],b:a[e+2]});o.push([r.h/60,r.s/100,255*r.v/100])}this.lookup={rendererJSON:e,colormapLut:s,hsvMap:o}}else this.lookup=null;return this.canRenderInWebGL=!0,{success:!0}}_analyzeClassBreaks(e){const{attributeTable:t,pixelType:r}=this.rasterInfo,s=null!=t?t.fields.find((e=>"value"===e.name.toLowerCase())):null,o=null!=t?t.fields.find((t=>t.name.toLowerCase()===e.field.toLowerCase())):null,a=null!=s&&null!==o;return{canUseIndexedLUT:["u8","u16","s8","s16"].includes(r)||a,tableValueField:s,tableBreakField:o}}_updateClassBreaksRenderer(e){const{attributeTable:t}=this.rasterInfo,{canUseIndexedLUT:r,tableValueField:s,tableBreakField:o}=this._analyzeClassBreaks(e),a=e.classBreakInfos;if(!a?.length)return{success:!1,error:"Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos."};const n=a.sort(((e,t)=>e.classMaxValue-t.classMaxValue)),i=n[n.length-1];let l=e.minValue;if(!r){const t=[];for(let e=0;e<n.length;e++)t.push({value:n[e].classMinValue??l,mappedColor:n[e].symbol.color}),l=n[e].classMaxValue;return t.push({value:i.classMaxValue,mappedColor:i.symbol.color}),this.lookup={rendererJSON:e,remapLut:t},this.canRenderInWebGL=!1,{success:!0}}const u=[];if(null!=t&&null!=s&&null!==o&&s!==o){const r=s.name,a=o.name,i=n[n.length-1],{classMaxValue:c}=i;l=e.minValue;for(const e of t.features){const t=e.attributes[r],s=e.attributes[a],o=s===c?i:s<l?null:n.find((({classMaxValue:e})=>e>s));o&&u.push([t].concat(o.symbol.color))}}else{l=Math.floor(e.minValue);for(let e=0;e<n.length;e++){const t=n[e];for(let e=l;e<t.classMaxValue;e++)u.push([e].concat(t.symbol.color));l=Math.ceil(t.classMaxValue)}i.classMaxValue===l&&u.push([i.classMaxValue].concat(i.symbol.color))}const p=c({colormap:u,fillUnspecified:!1});return this.lookup={rendererJSON:e,colormapLut:p},this.canRenderInWebGL=!0,{success:!0}}_isHistogramRequired(e){return"percentClip"===e||"histogramEqualization"===e}_isValidRasterStatistics(e){return null!=e&&e.length>0&&null!=e[0].min&&null!=e[0].max}_updateStretchRenderer(e){let{stretchType:t,dra:r}=e;if(!("none"===t||e.statistics?.length||this._isValidRasterStatistics(this.rasterInfo.statistics)||r))return{success:!1,error:"Unsupported renderer; StretchRenderer.statistics is required when dynamic range adjustment is not used."};const s=e.histograms||this.rasterInfo.histograms;!this._isHistogramRequired(e.stretchType)||s?.length||r||(t="minMax");const{computeGamma:o,useGamma:a,colorRamp:n}=e;let{gamma:i}=e;if(a&&o&&!i?.length){const t=e.statistics?.length?e.statistics:this.rasterInfo.statistics;i=f(this.rasterInfo.pixelType,t)}const l=this.rasterInfo.pixelType,u=!r&&["u8","u16","s8","s16"].includes(l);if("histogramEqualization"===t){const t=s.map((e=>y(e)));this.lookup={rendererJSON:e,histogramLut:t}}else if(u){const t=h(e,{rasterInfo:this.rasterInfo}),r=m({pixelType:l,...t,gamma:a?i:null,rounding:"floor"});this.lookup={rendererJSON:e,stretchLut:r}}if(n&&!this._isStretchColorRampNoop(n)){const t=k(n,{interpolateAlpha:!0});this.lookup||(this.lookup={rendererJSON:e}),this.lookup.colormapLut=c({colormap:t}),this.lookup.rendererJSON=e}return this.lookup.gamma=a&&i?.length?i:null,this.canRenderInWebGL=!0,{success:!0}}_isStretchColorRampNoop(e){return"algorithmic"===e.type&&["0,0,0,255","0,0,0"].includes(e.fromColor.join(","))&&["255,255,255,255","255,255,255"].includes(e.toColor.join(","))}_generateStretchWebGLParams(e,t,r){let s=null,o=null;const a=this.lookup?.colormapLut;t.colorRamp&&a&&(s=a.indexedColormap,o=a.offset),"histogramEqualization"===t.stretchType&&(t={...t,stretchType:"minMax"});const{gamma:n}=this.lookup,i=!!(t.useGamma&&n&&n.some((e=>1!==e))),{minCutOff:l,maxCutOff:u,outMin:c,outMax:p}=h(t,{rasterInfo:this.rasterInfo,pixelBlock:e,bandIds:r});let d=0;null!=e&&(d=e.getPlaneCount(),2===d&&((e=e.clone()).statistics=[e.statistics[0]],e.pixels=[e.pixels[0]]));const{bandCount:m}=this.rasterInfo,f=Math.min(3,r?.length||d||m,m),y=new Float32Array(f),g=s||i?1:255;let b;for(b=0;b<l.length;b++)y[b]=u[b]===l[b]?0:(p-c)/(u[b]-l[b])/g;const S=new Float32Array(f);if(i&&n)for(b=0;b<f;b++)n[b]>1?n[b]>2?S[b]=6.5+(n[b]-2)**2.5:S[b]=6.5+100*(2-n[b])**4:S[b]=1;return{bandCount:f,outMin:c/g,outMax:p/g,minCutOff:l,maxCutOff:u,factor:y,useGamma:i,gamma:i?n:[1,1,1],gammaCorrection:i?S:[1,1,1],colormap:s,colormapOffset:o,stretchType:t.stretchType,type:"stretch"}}_generateShadedReliefWebGLParams(e,t=!1,r={x:0,y:0}){let s=null,o=null;const a=this.lookup?.colormapLut;e.colorRamp&&a&&(s=a.indexedColormap,o=a.offset);const n={...e,isGCS:t,resolution:r},i=S(n),l=this.rasterInfo.statistics?.[0];return{...i,minValue:l?.min??0,maxValue:l?.max??8e3,hillshadeType:"traditional"===e.hillshadeType?0:1,type:"hillshade",colormap:s,colormapOffset:o}}_generateVectorFieldWebGLParams(e){const{style:t,inputUnit:r,outputUnit:s,visualVariables:o,symbolTileSize:a,flowRepresentation:n}=e;let i;const l=this.rasterInfo.statistics?.[0].min??0,u=this.rasterInfo.statistics?.[0].max??50,c=o?.find((e=>"sizeInfo"===e.type))??{type:"sizeInfo",field:"Magnitude",maxDataValue:u,maxSize:.8*a,minDataValue:l,minSize:.2*a},p=c.minDataValue??l,d=c.maxDataValue??u,h=null!=c.maxSize&&null!=c.minSize?[c.minSize/a,c.maxSize/a]:[.2,.8];if("wind_speed"===t){const e=(h[0]+h[1])/2;h[0]=h[1]=e}const m=null!=p&&null!=d?[p,d]:null;if("classified_arrow"===t)if(null!=p&&null!=d&&null!=c){i=[];const e=(c.maxDataValue-c.minDataValue)/5;for(let t=0;t<6;t++)i.push(c.minDataValue+e*t)}else i=[0,1e-6,3.5,7,10.5,14];const f="flow_to"===n===("ocean_current_kn"===t||"ocean_current_m"===t)?0:Math.PI,y=o?.find((e=>"rotationInfo"===e.type));return{breakValues:i,dataRange:m,inputUnit:r,outputUnit:s,symbolTileSize:a,symbolPercentRange:h,style:t||"single_arrow",rotation:f,rotationType:this.rasterInfo.storageInfo?.tileInfo&&"vector-uv"===this.rasterInfo.dataType?"geographic":y?.rotationType||e.rotationType,type:"vectorField"}}};function _(e){return p(e)&&0!==e.validPixelCount}e([o({json:{write:!0}})],C.prototype,"rendererJSON",void 0),e([o({type:n,json:{write:!0}})],C.prototype,"rasterInfo",void 0),e([o({json:{write:!0}})],C.prototype,"lookup",void 0),e([o()],C.prototype,"canRenderInWebGL",void 0),C=e([a("esri.renderers.support.RasterSymbolizer")],C);const L=C;export{L as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{toHSV as t}from"../../core/colorUtils.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import s from"../../core/Logger.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import n from"../../layers/support/RasterInfo.js";import{colorize as i,remapColor as l,lookupPixels as u,createColormapLUT as c,isValidPixelBlock as p}from"../../layers/support/rasterFunctions/pixelUtils.js";import{stretch as d,getStretchCutoff as h,createStretchLUT as m,computeGammaValues as f,createHistogramEqualizationLUT as y}from"../../layers/support/rasterFunctions/stretchUtils.js";import{hillshade as b,tintHillshade as g,calculateHillshadeParams as S}from"../../layers/support/rasterFunctions/surfaceUtils.js";import{convertColorRampToColormap as k}from"./colorRampUtils.js";import{isUVRendererSupported as x,isColormapRendererSupported as R,isShadedReliefRendererSupported as I}from"./rasterRendererChecks.js";let C=class extends r{constructor(e){super(e)}bind(){const{rendererJSON:e}=this;if(!e)return{success:!1};let t;switch(this.lookup={rendererJSON:{}},e.type){case"uniqueValue":t=this._updateUVRenderer(e);break;case"rasterColormap":t=this._updateColormapRenderer(e);break;case"rasterStretch":t=this._updateStretchRenderer(e);break;case"classBreaks":t=this._updateClassBreaksRenderer(e);break;case"rasterShadedRelief":t=this._updateShadedReliefRenderer(e);break;case"vectorField":t=this._updateVectorFieldRenderer();break;case"flowRenderer":t=this._updateFlowRenderer()}return t}symbolize(e){let t=e?.pixelBlock;if(!_(t))return t;if(e.simpleStretchParams&&"rasterStretch"===this.rendererJSON.type)return this.simpleStretch(t,e.simpleStretchParams);try{let r;switch(t.pixels.length>3&&(t=t.extractBands([0,1,2])),this.rendererJSON.type){case"uniqueValue":case"rasterColormap":r=this._symbolizeColormap(t);break;case"classBreaks":r=this._symbolizeClassBreaks(t);break;case"rasterStretch":r=this._symbolizeStretch(t,e.bandIds);break;case"rasterShadedRelief":{const s=e.extent,o=s.spatialReference.isGeographic,a={x:(s.xmax-s.xmin)/t.width,y:(s.ymax-s.ymin)/t.height};r=this._symbolizeShadedRelief(t,{isGCS:o,resolution:a});break}}return r}catch(r){return s.getLogger(this).error("symbolize",r.message),t}}simpleStretch(e,t){if(!_(e))return e;try{return e.pixels.length>3&&(e=e.extractBands([0,1,2])),d(e,{...t,isRenderer:!0})}catch(r){return s.getLogger(this).error("symbolize",r.message),e}}generateWebGLParameters(e){if(["uniqueValue","rasterColormap","classBreaks"].includes(this.rendererJSON.type)){const{indexedColormap:e,offset:t}=this.lookup.colormapLut||{};return{colormap:e,colormapOffset:t,type:"lut"}}const{pixelBlock:t,isGCS:r,resolution:s,bandIds:o}=e,{rendererJSON:a}=this;return"rasterStretch"===a.type?this._generateStretchWebGLParams(t,a,o):"rasterShadedRelief"===a.type?this._generateShadedReliefWebGLParams(a,r,s??void 0):"vectorField"===a.type?this._generateVectorFieldWebGLParams(a):null}_isLUTChanged(e){if(!this.lookup||!this.lookup.rendererJSON)return!0;if("colorRamp"in this.rendererJSON){const t=this.rendererJSON.colorRamp;return e?JSON.stringify(t)!==JSON.stringify(this.lookup.rendererJSON.colorRamp):(this.rendererJSON,this.lookup.rendererJSON,JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON))}return JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON)}_symbolizeColormap(e){if(this._isLUTChanged()){if(!this.bind().success)return e}return i(e,this.lookup.colormapLut)}_symbolizeClassBreaks(e){const{canUseIndexedLUT:t}=this._analyzeClassBreaks(this.rendererJSON);if(this._isLUTChanged()){if(!this.bind().success)return e}return t?i(e,this.lookup.colormapLut):l(e,this.lookup.remapLut??[])}_symbolizeStretch(e,t){const{rasterInfo:r}=this,{pixelType:s,bandCount:o}=r,a=this.rendererJSON,n=["u8","u16","s8","s16"].includes(s);let l,c;const{dra:p}=a,{gamma:f}=this.lookup;if("histogramEqualization"===a.stretchType){const s=p?null:this.lookup?.histogramLut,o=h(a,{rasterInfo:r,pixelBlock:e,bandIds:t,returnHistogramLut:!s}),n=d(e,{...o,gamma:f,isRenderer:!0});c=u(n,{lut:p?o.histogramLut:s,offset:0})}else if(n){if(p){const o=h(a,{rasterInfo:r,pixelBlock:e,bandIds:t});l=m({pixelType:s,...o,gamma:f,rounding:"floor"})}else if(this._isLUTChanged()){if(!this.bind().success)return e;l=this.lookup?this.lookup.stretchLut:null}else l=this.lookup?this.lookup.stretchLut:null;if(!l)return e;o>1&&null!=t&&t.length===e?.pixels.length&&l?.lut.length===o&&(l={lut:t.map((e=>l.lut[e])),offset:l.offset}),c=u(e,l)}else{const s=h(a,{rasterInfo:r,pixelBlock:e,bandIds:t});c=d(e,{...s,gamma:f,isRenderer:!0})}if(a.colorRamp){if(this._isLUTChanged(!0)){if(!this.bind().success)return e}c=i(c,this.lookup?.colormapLut)}return c}_symbolizeShadedRelief(e,t){const r=this.rendererJSON,s={...r,...t},o=b(e,s);if(!r.colorRamp)return o;let a;if(this._isLUTChanged(!0)){if(!this.bind().success)return o;a=this.lookup?this.lookup.hsvMap:null}else a=this.lookup?this.lookup.hsvMap:null;if(!a)return o;const n=this.rasterInfo.statistics?.[0]??{min:0,max:8e3};return g(o,e,a,n),o}_isVectorFieldData(){const{bandCount:e,dataType:t}=this.rasterInfo;return 2===e&&("vector-magdir"===t||"vector-uv"===t)}_updateVectorFieldRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".`}}_updateFlowRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".`}}_updateUVRenderer(e){const{bandCount:t,attributeTable:r,pixelType:s}=this.rasterInfo,o=e.field1;if(!o)return{success:!1,error:"Unsupported renderer; missing UniqueValueRenderer.field."};const a=e.defaultSymbol,n=1===t&&["u8","s8"].includes(s);if(!x(this.rasterInfo,o)&&!n)return{success:!1,error:"Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table."};const i=[];if(null!=r){const t=r.fields.find((e=>"value"===e.name.toLowerCase()));if(!t)return{success:!1,error:"Unsupported data; the data's raster attribute table does not have a value field."};r.features.forEach((r=>{const s=e.uniqueValueInfos?.find((e=>String(e.value)===String(r.attributes[o]))),n=s?.symbol?.color;n?i.push([r.attributes[t.name]].concat(n)):a&&i.push([r.attributes[t.name]].concat(a.color))}))}else{if("value"!==o.toLowerCase())return{success:!1,error:'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not availalbe.'};e.uniqueValueInfos?.forEach((e=>{const t=e?.symbol?.color;t?i.push([parseInt(""+e.value,10)].concat(t)):a&&i.push([parseInt(""+e.value,10)].concat(a?.color))}))}if(0===i.length)return{success:!1,error:"Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table."};const l=c({colormap:i});return this.lookup={rendererJSON:e,colormapLut:l},this.canRenderInWebGL=this._isColormapSupportedByWebGL(l?.indexedColormap),{success:!0}}_updateColormapRenderer(e){if(!R(this.rasterInfo))return{success:!1,error:"Unsupported data; the data source does not have a colormap."};const t=e.colormapInfos.map((e=>[e.value].concat(e.color))).sort(((e,t)=>e[0]-t[0]));if(!t||0===t.length)return{success:!1,error:"Unsupported renderer; ColormapRenderer must have meaningful colormapInfos."};const r=c({colormap:t});return this.lookup={rendererJSON:e,colormapLut:r},this.canRenderInWebGL=this._isColormapSupportedByWebGL(r?.indexedColormap),{success:!0}}_updateShadedReliefRenderer(e){if(!I(this.rasterInfo))return{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.`};if(e.colorRamp){const r=k(e.colorRamp,{interpolateAlpha:!0}),s=c({colormap:r}),o=[],a=s.indexedColormap;for(let e=0;e<a.length;e+=4){const r=t({r:a[e],g:a[e+1],b:a[e+2]});o.push([r.h/60,r.s/100,255*r.v/100])}this.lookup={rendererJSON:e,colormapLut:s,hsvMap:o}}else this.lookup=null;return this.canRenderInWebGL=!0,{success:!0}}_analyzeClassBreaks(e){const{attributeTable:t,pixelType:r}=this.rasterInfo,s=null!=t?t.fields.find((e=>"value"===e.name.toLowerCase())):null,o=null!=t?t.fields.find((t=>t.name.toLowerCase()===e.field.toLowerCase())):null,a=null!=s&&null!==o;return{canUseIndexedLUT:["u8","u16","s8","s16"].includes(r)||a,tableValueField:s,tableBreakField:o}}_updateClassBreaksRenderer(e){const{attributeTable:t}=this.rasterInfo,{canUseIndexedLUT:r,tableValueField:s,tableBreakField:o}=this._analyzeClassBreaks(e),a=e.classBreakInfos;if(!a?.length)return{success:!1,error:"Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos."};const n=a.sort(((e,t)=>e.classMaxValue-t.classMaxValue)),i=n[n.length-1];let l=e.minValue;if(!r){const t=[];for(let e=0;e<n.length;e++)t.push({value:n[e].classMinValue??l,mappedColor:n[e].symbol.color}),l=n[e].classMaxValue;return t.push({value:i.classMaxValue,mappedColor:i.symbol.color}),this.lookup={rendererJSON:e,remapLut:t},this.canRenderInWebGL=!1,{success:!0}}const u=[];if(null!=t&&null!=s&&null!==o&&s!==o){const r=s.name,a=o.name,i=n[n.length-1],{classMaxValue:c}=i;l=e.minValue;for(const e of t.features){const t=e.attributes[r],s=e.attributes[a],o=s===c?i:s<l?null:n.find((({classMaxValue:e})=>e>s));o&&u.push([t].concat(o.symbol.color))}}else{l=Math.floor(e.minValue);for(let e=0;e<n.length;e++){const t=n[e];for(let e=l;e<t.classMaxValue;e++)u.push([e].concat(t.symbol.color));l=Math.ceil(t.classMaxValue)}i.classMaxValue===l&&u.push([i.classMaxValue].concat(i.symbol.color))}const p=c({colormap:u,fillUnspecified:!1});return this.lookup={rendererJSON:e,colormapLut:p},this.canRenderInWebGL=this._isColormapSupportedByWebGL(p?.indexedColormap),{success:!0}}_isColormapSupportedByWebGL(e){return!!e?.length&&e.length<=16384}_isHistogramRequired(e){return"percentClip"===e||"histogramEqualization"===e}_isValidRasterStatistics(e){return null!=e&&e.length>0&&null!=e[0].min&&null!=e[0].max}_updateStretchRenderer(e){let{stretchType:t,dra:r}=e;if(!("none"===t||e.statistics?.length||this._isValidRasterStatistics(this.rasterInfo.statistics)||r))return{success:!1,error:"Unsupported renderer; StretchRenderer.statistics is required when dynamic range adjustment is not used."};const s=e.histograms||this.rasterInfo.histograms;!this._isHistogramRequired(e.stretchType)||s?.length||r||(t="minMax");const{computeGamma:o,useGamma:a,colorRamp:n}=e;let{gamma:i}=e;if(a&&o&&!i?.length){const t=e.statistics?.length?e.statistics:this.rasterInfo.statistics;i=f(this.rasterInfo.pixelType,t)}const l=this.rasterInfo.pixelType,u=!r&&["u8","u16","s8","s16"].includes(l);if("histogramEqualization"===t){const t=s.map((e=>y(e)));this.lookup={rendererJSON:e,histogramLut:t}}else if(u){const t=h(e,{rasterInfo:this.rasterInfo}),r=m({pixelType:l,...t,gamma:a?i:null,rounding:"floor"});this.lookup={rendererJSON:e,stretchLut:r}}if(n&&!this._isStretchColorRampNoop(n)){const t=k(n,{interpolateAlpha:!0});this.lookup||(this.lookup={rendererJSON:e}),this.lookup.colormapLut=c({colormap:t}),this.lookup.rendererJSON=e}return this.lookup.gamma=a&&i?.length?i:null,this.canRenderInWebGL=!0,{success:!0}}_isStretchColorRampNoop(e){return"algorithmic"===e.type&&["0,0,0,255","0,0,0"].includes(e.fromColor.join(","))&&["255,255,255,255","255,255,255"].includes(e.toColor.join(","))}_generateStretchWebGLParams(e,t,r){let s=null,o=null;const a=this.lookup?.colormapLut;t.colorRamp&&a&&(s=a.indexedColormap,o=a.offset),"histogramEqualization"===t.stretchType&&(t={...t,stretchType:"minMax"});const{gamma:n}=this.lookup,i=!!(t.useGamma&&n&&n.some((e=>1!==e))),{minCutOff:l,maxCutOff:u,outMin:c,outMax:p}=h(t,{rasterInfo:this.rasterInfo,pixelBlock:e,bandIds:r});let d=0;null!=e&&(d=e.getPlaneCount(),2===d&&((e=e.clone()).statistics=[e.statistics[0]],e.pixels=[e.pixels[0]]));const{bandCount:m}=this.rasterInfo,f=Math.min(3,r?.length||d||m,m),y=new Float32Array(f),b=s||i?1:255;let g;for(g=0;g<l.length;g++)y[g]=u[g]===l[g]?0:(p-c)/(u[g]-l[g])/b;const S=new Float32Array(f);if(i&&n)for(g=0;g<f;g++)n[g]>1?n[g]>2?S[g]=6.5+(n[g]-2)**2.5:S[g]=6.5+100*(2-n[g])**4:S[g]=1;return{bandCount:f,outMin:c/b,outMax:p/b,minCutOff:l,maxCutOff:u,factor:y,useGamma:i,gamma:i?n:[1,1,1],gammaCorrection:i?S:[1,1,1],colormap:s,colormapOffset:o,stretchType:t.stretchType,type:"stretch"}}_generateShadedReliefWebGLParams(e,t=!1,r={x:0,y:0}){let s=null,o=null;const a=this.lookup?.colormapLut;e.colorRamp&&a&&(s=a.indexedColormap,o=a.offset);const n={...e,isGCS:t,resolution:r},i=S(n),l=this.rasterInfo.statistics?.[0];return{...i,minValue:l?.min??0,maxValue:l?.max??8e3,hillshadeType:"traditional"===e.hillshadeType?0:1,type:"hillshade",colormap:s,colormapOffset:o}}_generateVectorFieldWebGLParams(e){const{style:t,inputUnit:r,outputUnit:s,visualVariables:o,symbolTileSize:a,flowRepresentation:n}=e;let i;const l=this.rasterInfo.statistics?.[0].min??0,u=this.rasterInfo.statistics?.[0].max??50,c=o?.find((e=>"sizeInfo"===e.type))??{type:"sizeInfo",field:"Magnitude",maxDataValue:u,maxSize:.8*a,minDataValue:l,minSize:.2*a},p=c.minDataValue??l,d=c.maxDataValue??u,h=null!=c.maxSize&&null!=c.minSize?[c.minSize/a,c.maxSize/a]:[.2,.8];if("wind_speed"===t){const e=(h[0]+h[1])/2;h[0]=h[1]=e}const m=null!=p&&null!=d?[p,d]:null;if("classified_arrow"===t)if(null!=p&&null!=d&&null!=c){i=[];const e=(c.maxDataValue-c.minDataValue)/5;for(let t=0;t<6;t++)i.push(c.minDataValue+e*t)}else i=[0,1e-6,3.5,7,10.5,14];const f="flow_to"===n===("ocean_current_kn"===t||"ocean_current_m"===t)?0:Math.PI,y=o?.find((e=>"rotationInfo"===e.type));return{breakValues:i,dataRange:m,inputUnit:r,outputUnit:s,symbolTileSize:a,symbolPercentRange:h,style:t||"single_arrow",rotation:f,rotationType:this.rasterInfo.storageInfo?.tileInfo&&"vector-uv"===this.rasterInfo.dataType?"geographic":y?.rotationType||e.rotationType,type:"vectorField"}}};function _(e){return p(e)&&0!==e.validPixelCount}e([o({json:{write:!0}})],C.prototype,"rendererJSON",void 0),e([o({type:n,json:{write:!0}})],C.prototype,"rasterInfo",void 0),e([o({json:{write:!0}})],C.prototype,"lookup",void 0),e([o()],C.prototype,"canRenderInWebGL",void 0),C=e([a("esri.renderers.support.RasterSymbolizer")],C);const L=C;export{L as default};
|
package/support/revision.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
|
-
const
|
|
5
|
+
const c="20231026",e="312082a124d0009833f072034bebec075f541acc";export{c as buildDate,e as commitHash};
|
|
@@ -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 t from"../request.js";import{JSONSupportMixin as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../request.js";import r from"../core/Error.js";import{JSONSupportMixin as i}from"../core/JSONSupport.js";import s from"../core/Loadable.js";import{removeTrailingSlash as n,Url as o}from"../core/urlUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import"../core/has.js";import{reader as d}from"../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{writer as u}from"../core/accessorSupport/decorators/writer.js";import{onApplyEditsEvent as c,emitUpdateMomentEvent as m}from"../layers/mixins/EditBusLayer.js";import{parseUrl as g}from"../rest/utils.js";import p from"./support/EditMomentStack.js";import{versionCollection as f,versionCollectionCount as h,defaultVersionNameLookup as V,currentSessionId as v}from"./support/versionManagementUtils.js";let w=class extends(i(s)){constructor(e){super(e),this.url=null,this.sourceJSON=null,this.name=null,this.defaultVersionIdentifier=null,this.capabilities=null,this._applyEditsHandler=e=>{const{serviceUrl:t,gdbVersion:r,result:i}=e;t===this._featureServiceUrl&&i.then((e=>{const t=e.historicMoment;t&&this._addMomentToVersionItem(r,t)}))}}initialize(){this.url=n(this.url),this._featureServiceUrl=this.url.replace(/\/VersionManagementServer/i,"/FeatureServer"),f.has(this.url)||f.set(this.url,new Map);const e=(h.get(this.url)??0)+1;h.set(this.url,e),this.when().then((()=>this.addHandles(c(this._applyEditsHandler))),(()=>{}))}destroy(){const e=(h.get(this.url)??1)-1;h.set(this.url,e),0===e&&f.delete(this.url),V.delete(this._featureServiceUrl)}read(e,t){this.sourceJSON=e,super.read(e,t)}readDefaultVersionIdentifier(e,t){return{name:t.defaultVersionName,guid:t.defaultVersionGuid}}writeDefaultVersionIdentifier(e,t){t.defaultVersionName=e.name,t.defaultVersionGuid=e.guid}load(e){return this.addResolvingPromise(this._fetchService(this.url,e)),Promise.resolve(this)}async createVersion(e){const[{createVersion:t},{default:r}]=await Promise.all([import("../rest/versionManagement/createVersion.js"),import("../rest/versionManagement/support/CreateVersionParameters.js")]),i=r.from(e);return t(this.url,i)}async deleteVersion(e){const[{deleteVersion:t},{default:r}]=await Promise.all([import("../rest/versionManagement/deleteVersion.js"),import("../rest/versionManagement/support/DeleteVersionParameters.js")]);let i;e.guid&&f.get(this.url)?.has(e.guid)&&(i=v??void 0);const s=new r({versionName:e.name,sessionId:i});return t(this.url,s)}async getVersionInfoExtended(e){const{getVersion:t}=await import("../rest/versionManagement/getVersion.js");return t(this.url,e.guid)}async getVersionInfos(e={}){const[{getVersionInfos:t},{default:r}]=await Promise.all([import("../rest/versionManagement/getVersionInfos.js"),import("../rest/versionManagement/support/GetVersionInfosParameters.js")]),i=r.from(e);return t(this.url,i)}async reconcile(e,t={}){const[{reconcile:r},{default:i}]=await Promise.all([import("../rest/versionManagement/gdbVersion/reconcile.js"),import("../rest/versionManagement/gdbVersion/support/ReconcileParameters.js")]),s=i.from(t);return s.sessionId=v,r(this.url,e.guid,s)}async post(e){const[{post:t},{default:r}]=await Promise.all([import("../rest/versionManagement/gdbVersion/post.js"),import("../rest/versionManagement/gdbVersion/support/PostParameters.js")]),i=r.from({sessionId:v});return t(this.url,e.guid,i)}async alterVersion(e,t){const[{alterVersion:r},{default:i}]=await Promise.all([import("../rest/versionManagement/gdbVersion/alterVersion.js"),import("../rest/versionManagement/gdbVersion/support/AlterVersionParameters.js")]),s=i.from(t);return r(this.url,e.guid,s)}async startReading(e){const{startReading:t}=await import("../rest/versionManagement/gdbVersion/startReading.js"),r=await t(this.url,e.guid,v);if(r){const t=await this.getVersionInfoExtended(e),r=new Date(t.modifiedDate),i={name:t.versionIdentifier.name,moment:r,lockType:"read"};this._addOrUpdateItem(e.guid,i),m(this._featureServiceUrl,null,e.name,r)}return r}async stopReading(e){const{stopReading:t}=await import("../rest/versionManagement/gdbVersion/stopReading.js"),r=await t(this.url,e.guid,v);return r&&(f.get(this.url)?.delete(e.guid),m(this._featureServiceUrl,null,e.name,null)),r}async startEditing(e){const{startEditing:t}=await import("../rest/versionManagement/gdbVersion/startEditing.js"),r=await t(this.url,e.guid,v);if(r){const t=await this.getVersionInfoExtended(e),r=new Date(t.modifiedDate),i=new p(r),s={name:e.name,moment:r,lockType:"edit",stack:i};this._addOrUpdateItem(e.guid,s),m(this._featureServiceUrl,null,e.name,r)}return r}async stopEditing(e,t){if(t){const t=f.get(this.url)?.get(e.guid);if(t?.stack?.canRedo()){const[{deleteForwardEdits:r},{default:i}]=await Promise.all([import("../rest/versionManagement/gdbVersion/deleteForwardEdits.js"),import("../rest/versionManagement/gdbVersion/support/DeleteForwardEditsParameters.js")]);if(!await r(this.url,e.guid,new i({sessionId:v,moment:t.moment})))return!1}}const{stopEditing:r}=await import("../rest/versionManagement/gdbVersion/stopEditing.js"),i=await r(this.url,e.guid,v,t);if(i){const t=await this.getVersionInfoExtended(e),r=new Date(t.modifiedDate);this._addOrUpdateItem(e.guid,{name:e.name,moment:r,lockType:"read",editMomentStack:void 0}),m(this._featureServiceUrl,null,e.name,r)}return i}getLockType(e){const t=f.get(this.url)?.get(e.guid)?.lockType;return t??"none"}changeVersionInternal(e,t,r){let i=null,s=null,n=null,o=null;const a=e=>!e||e===this.defaultVersionIdentifier.name,d=e=>{const t=f?.get(this.url)?.get(e.guid);n=e.name,o=t?.moment??null},l=(e,t)=>!e&&!t||!(!e||!t)&&e.toISOString()===t.toISOString();if("name"in t){if("none"!==this.getLockType(t))return!1;i=t.name,s=null,"name"in r?d(r):(n=this.defaultVersionIdentifier.name,o=r)}else i=this.defaultVersionIdentifier.name,s=t,"name"in r?d(r):(n=this.defaultVersionIdentifier.name,o=r);return(a(i)&&a(e.gdbVersion)&&l(e.historicMoment,s)||i===e.gdbVersion&&l(e.historicMoment,s))&&(e.gdbVersion=n,e.historicMoment=o),!0}async changeVersion(e,t,i){if("name"in i&&!await this.getVersionInfoExtended(i))throw new r("version-management-service:invalid-version","version does not exist");if("networkServiceUrl"in e){if(this._featureServiceUrl.toLowerCase()===e.featureServiceUrl.toLowerCase())return this.changeVersionInternal(e,t,i)}else{let r;"layers"in e?(r=e.allTables.concat(e.allLayers),e.utilityNetworks&&e.utilityNetworks.forEach((e=>{this._featureServiceUrl.toLowerCase()===e.featureServiceUrl.toLowerCase()&&this.changeVersionInternal(e,t,i)}))):r=e;for(const e of r)if("feature"===e.type){const r=/^(.*\/FeatureServer)\/\d+$/,s=e.url.replace(r,"$1");if(this._featureServiceUrl.toLowerCase()===s.toLowerCase()&&!this.changeVersionInternal(e,t,i))return!1}}return!0}async getVersionIdentifierFromName(e){try{const t=await this.getVersionInfos({includeHidden:!0});return t.find((t=>t.versionIdentifier.name===e))?.versionIdentifier||null}catch{return null}}async getVersionIdentifierFromGuid(e){const{getVersion:t}=await import("../rest/versionManagement/getVersion.js");try{return(await t(this.url,e)).versionIdentifier}catch{return null}}canUndo(e){const t=f.get(this.url)?.get(e.guid);return!!t?.stack?.canUndo()}canRedo(e){const t=f.get(this.url)?.get(e.guid);return!!t?.stack?.canRedo()}undo(e){const t=f.get(this.url)?.get(e.guid),r=t?.stack?.undo()||void 0;if(t&&r){const r=t.stack.peek();m(this._featureServiceUrl,null,e.name,r),f.get(this.url)?.set(e.guid,{...t,moment:r})}}redo(e){const t=f.get(this.url)?.get(e.guid),r=t?.stack?.redo()||void 0;t&&r&&(m(this._featureServiceUrl,null,e.name,r),f.get(this.url)?.set(e.guid,{...t,moment:r}))}_addMomentToVersionItem(e,t){const r=f.get(this.url);if(r)for(const[i,s]of r){s.name===e&&this._addToStack(i,t)}}_canAddToStack(e,t){if(e){return e.getTime()<t.getTime()}return!0}_addToStack(e,t){const r=f.get(this.url),i=r?.get(e);return!!i?.stack&&(this._canAddToStack(i.stack.peek(),t)&&i.stack.push(t),r.set(e,{...i,moment:t}),!0)}_addOrUpdateItem(e,t){const r=f.get(this.url),i=r?.get(e);return i?(r.set(e,{...i,...t}),!0):!(!t.name||!t.lockType)&&(r?.set(e,{...t,lockType:t.lockType}),!0)}async _fetchService(e,r){if(this.sourceJSON){this.read(this.sourceJSON,{origin:"service",url:g(e)});const t=new o(this.url).host;return void V.set(t,this.defaultVersionIdentifier.name)}const i=await t(e,{responseType:"json",query:{f:"json"},...r});this.read(i.data)}};e([a()],w.prototype,"url",void 0),e([a()],w.prototype,"sourceJSON",void 0),e([a({type:String,json:{write:!0}})],w.prototype,"name",void 0),e([a({json:{write:{target:{defaultVersionName:{type:String},defaultVersionGuid:{type:String}}},read:{source:["defaultVersionName","defaultVersionGuid"]}}})],w.prototype,"defaultVersionIdentifier",void 0),e([d("defaultVersionIdentifier",["defaultVersionName","defaultVersionGuid"])],w.prototype,"readDefaultVersionIdentifier",null),e([u("defaultVersionIdentifier",{defaultVersionName:{type:String},defaultVersionGuid:{type:String}})],w.prototype,"writeDefaultVersionIdentifier",null),e([a({json:{write:!0}})],w.prototype,"capabilities",void 0),w=e([l("esri.versionManagement.VersionManagementService")],w);const y=w;export{y as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{LRUCache as e}from"../../../../core/LRUCache.js";import i from"../../tiling/TileCoverage.js";import t from"../../tiling/TileKey.js";const l=512,s=1e-6,r=(e,i)=>e+1/(1<<2*i);class o{constructor(i,t){this._tiles=new Map,this._tileCache=new e(40,(e=>e.dispose())),this._viewSize=[0,0],this._visibleTiles=new Map,this.acquireTile=i.acquireTile,this.releaseTile=i.releaseTile,this.tileInfoView=i.tileInfoView,this._container=t}destroy(){for(const[e,i]of this._tiles)i.dispose();this._tiles=null,this._tileCache.clear(),this._tileCache=null}update(e){this._updateCacheSize(e);const l=this.tileInfoView,s=l.getTileCoverage(e.state,0,!0,"smallest")
|
|
5
|
+
import{LRUCache as e}from"../../../../core/LRUCache.js";import i from"../../tiling/TileCoverage.js";import t from"../../tiling/TileKey.js";const l=512,s=1e-6,r=(e,i)=>e+1/(1<<2*i);class o{constructor(i,t){this._tiles=new Map,this._tileCache=new e(40,(e=>e.dispose())),this._viewSize=[0,0],this._visibleTiles=new Map,this.acquireTile=i.acquireTile,this.releaseTile=i.releaseTile,this.tileInfoView=i.tileInfoView,this._container=t}destroy(){for(const[e,i]of this._tiles)i.dispose();this._tiles=null,this._tileCache.clear(),this._tileCache=null}update(e){this._updateCacheSize(e);const l=this.tileInfoView,s=l.getTileCoverage(e.state,0,!0,"smallest");if(!s)return!0;const{spans:r,lodInfo:o}=s,{level:n}=o,a=this._tiles,c=new Set,h=new Set;for(const{row:i,colFrom:_,colTo:f}of r)for(let e=_;e<=f;e++){const l=t.getId(n,i,o.normalizeCol(e),o.getWorldForColumn(e)),s=this._getOrAcquireTile(l);c.add(l),s.processed()?this._addToContainer(s):h.add(new t(l))}for(const[i,t]of a)t.isCoverage=c.has(i);for(const i of h)this._findPlaceholdersForMissingTiles(i,c);let d=!1;for(const[i,t]of a)t.neededForCoverage=c.has(i),t.neededForCoverage||t.isHoldingForFade&&l.intersects(s,t.key)&&c.add(i),t.isFading&&(d=!0);for(const[i,t]of this._tiles)c.has(i)||this._releaseTile(i);return i.pool.release(s),!d}clear(){this._tiles.clear(),this._tileCache.clear(),this._visibleTiles.clear()}clearCache(){this._tileCache.clear()}_findPlaceholdersForMissingTiles(e,i){const t=[];for(const[s,r]of this._tiles)this._addPlaceholderChild(t,r,e,i);const l=t.reduce(r,0);Math.abs(1-l)<s||this._addPlaceholderParent(e.id,i)}_addPlaceholderChild(e,i,t,l){i.key.level<=t.level||!i.hasData()||a(t,i.key)&&(this._addToContainer(i),l.add(i.id),e.push(i.key.level-t.level))}_addPlaceholderParent(e,i){const t=this._tiles;let l=e;for(;;){if(l=n(l),!l||i.has(l))return;const e=t.get(l);if(e&&e.hasData())return this._addToContainer(e),void i.add(e.id)}}_getOrAcquireTile(e){let i=this._tiles.get(e);return i||(i=this._tileCache.pop(e),i||(i=this.acquireTile(new t(e))),this._tiles.set(e,i),i)}_releaseTile(e){const i=this._tiles.get(e);this.releaseTile(i),this._removeFromContainer(i),this._tiles.delete(e),i.hasData()?this._tileCache.put(e,i,1):i.dispose()}_addToContainer(e){let i;const t=[],l=this._container;if(l.contains(e))return;const s=this._visibleTiles;for(const[r,o]of s)this._canConnectDirectly(e,o)&&t.push(o),null==i&&this._canConnectDirectly(o,e)&&(i=o);if(null!=i){for(const l of t)i.childrenTiles.delete(l),e.childrenTiles.add(l),l.parentTile=e;i.childrenTiles.add(e),e.parentTile=i}else for(const r of t)e.childrenTiles.add(r),r.parentTile=e;s.set(e.id,e),l.addChild(e)}_removeFromContainer(e){if(this._visibleTiles.delete(e.id),this._container.removeChild(e),null!=e.parentTile){e.parentTile.childrenTiles.delete(e);for(const i of e.childrenTiles)null!=e.parentTile&&e.parentTile.childrenTiles.add(i)}for(const i of e.childrenTiles)i.parentTile=e.parentTile;e.parentTile=null,e.childrenTiles.clear()}_canConnectDirectly(e,i){const t=e.key;let{level:l,row:s,col:r,world:o}=i.key;const n=this._visibleTiles;for(;l>0;){if(l--,s>>=1,r>>=1,t.level===l&&t.row===s&&t.col===r&&t.world===o)return!0;if(n.has(`${l}/${s}/${r}/${o}`))return!1}return!1}_updateCacheSize(e){const i=e.state.size;if(i[0]===this._viewSize[0]&&i[1]===this._viewSize[1])return;const t=Math.ceil(i[0]/l)+1,s=Math.ceil(i[1]/l)+1;this._viewSize[0]=i[0],this._viewSize[1]=i[1],this._tileCache.maxSize=5*t*s}}function n(e){const[i,t,l,s]=e.split("/"),r=parseInt(i,10);return 0===r?null:`${r-1}/${parseInt(t,10)>>1}/${parseInt(l,10)>>1}/${parseInt(s,10)}`}function a(e,i){const t=i.level-e.level;return e.row===i.row>>t&&e.col===i.col>>t&&e.world===i.world}export{o as TileManager};
|
|
@@ -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{r as t,d as i}from"../../../chunks/Responsive.js";import"../../../intl.js";import{binaryFindClosest as e}from"../../../core/arrayUtils.js";import{handlesGroup as n,makeHandle as o}from"../../../core/handleUtils.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{signal as a}from"../../../core/signal.js";import{formatDecimal as l,unitName as r}from"../../../core/unitFormatUtils.js";import{convertUnit as d}from"../../../core/unitUtils.js";import{g as c}from"../../../chunks/common.js";import{getConfig as p,notAvailable as m}from"./constants.js";import{getTranslatedLineTitle as u}from"./intlUtils.js";import{niceScale as f}from"./niceScale.js";import{c as x,N as g}from"../../../chunks/chartUtilsAm5.js";import{isRTL as h}from"../../support/widgetUtils.js";import{isDarkTheme as A}from"../../../support/themeUtils.js";import{X as v,V as b,A as y,a as T,b as L,L as M}from"../../../chunks/LineSeries.js";import{aq as S,a6 as F,a4 as k,C as P}from"../../../chunks/Theme.js";import{T as X}from"../../../chunks/Tooltip.js";import{substitute as Y}from"../../../intl/substitute.js";import{formatNumber as z}from"../../../intl/number.js";const C="#f8f8f8",j="#a9a9a9",w="#323232",H="line",B="fill",U=15,D=12,R=.001,O=.1,W=.02,G={fontFamily:"Avenir Next",paddingBottom:D/2,paddingLeft:0,paddingRight:0,paddingTop:0,axisGridStroke:"#f4f4f4",axisLabelsFontSize:9,axisLabelsFontWeight:"400",axisLabelsColor:j,axisTooltipFontSize:12,axisTooltipBackgroundColor:w,axisTooltipLabelColor:C,axisTooltipPaddingTop:Math.round(D/4),axisTooltipPaddingBottom:Math.round(D/4),axisTooltipPaddingHorizontal:Math.round(U/4),xAxisMinGridDistance:50,xAxisLabelsSpacing:Math.round(D/2),xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:Math.round(U/4),yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:C,seriesTooltipLabelColor:w,seriesFillLighten:.9,seriesTooltipSpacing:D/2,seriesTooltipPaddingVertical:Math.round(U/4),seriesTooltipPaddingHorizontal:Math.round(U/4)},V={...G,axisGridStroke:w,axisLabelsColor:j,axisTooltipBackgroundColor:w,axisTooltipLabelColor:C,seriesTooltipBackgroundColor:w,seriesTooltipLabelColor:C,seriesFillLighten:-.75},E={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};async function I(e){const o=await x(e.container);s(e.abortOptions);const l=A(),r=l?V:G;o.setThemes(l?[t.new(o),i.new(o)]:[t.new(o)]);const d=h(e.container),c=o.container.children.push(v.new(o,{panX:!0,panY:!0,paddingTop:r.paddingTop,paddingBottom:r.paddingBottom,paddingLeft:d?r.paddingRight:r.paddingLeft,paddingRight:d?r.paddingLeft:r.paddingRight,maxTooltipDistance:0}));c.zoomOutButton.set("forceHidden",!0);const p=c.xAxes.push(b.new(o,{renderer:y.new(o,{})})),m=c.yAxes.push(b.new(o,{renderer:T.new(o,{})})),u=a(null),f=a("loading"),g={params:e,chart:c,xAxis:p,yAxis:m,seriesInfos:new Map,messages:null,theme:r,pointerIsOver:!1,get state(){return f.value},get data(){return u.value},set data(t){u.value=t}};Z(g),q(g),N(g);const L=n([lt(g,e.onRangeChange),dt(g,e.onCursorPositionChange),yt(o.events.once("frameended",(()=>{f.value="ready"}))),yt(o)]);return{destroy:()=>{L.remove(),f.value="destroyed"},update:t=>{t.data===g.data&&t.messages===g.messages||$(g)||J(g,t)},zoomOut:()=>K(g)}}function $(t){return"destroyed"===t.state}function N({chart:t,xAxis:i,yAxis:e}){const n=L.new(t.root,{behavior:"none",xAxis:i,yAxis:e});n.lineY.set("visible",!1),t.set("cursor",n)}function Z(t){const{chart:i,xAxis:e,theme:n}=t;e.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:gt(t,"distance"),strictMinMax:!0,strictMinMaxSelection:!0}),e.axisHeader.set("forceHidden",!0);const o=e.get("renderer");o.setAll({inside:!1,minGridDistance:n.xAxisMinGridDistance}),o.labels.template.setAll({centerX:S,centerY:S,fill:F(n.axisLabelsColor),fontFamily:n.fontFamily,fontSize:n.axisLabelsFontSize,fontWeight:n.axisLabelsFontWeight,maxPosition:n.xAxisMaxLabelPosition,minPosition:n.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:n.xAxisLabelsSpacing});const s=e.set("tooltip",X.new(i.root,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));s.get("background")?.setAll({fill:F(n.axisTooltipBackgroundColor),stroke:void 0}),s.label.setAll({fill:F(n.axisTooltipLabelColor),fontFamily:n.fontFamily,fontSize:n.axisTooltipFontSize,paddingBottom:n.axisTooltipPaddingBottom,paddingLeft:n.axisTooltipPaddingHorizontal,paddingRight:n.axisTooltipPaddingHorizontal,paddingTop:n.axisTooltipPaddingTop}),o.grid.template.setAll({strokeOpacity:1,stroke:F(n.axisGridStroke)})}function q(t){const{yAxis:i,theme:e}=t;i.setAll({baseValue:p().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:gt(t,"elevation"),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),i.axisHeader.set("visible",!1);const n=h(t.params.container),o=i.get("renderer");o.setAll({minGridDistance:e.yAxisMinGridDistance,opposite:n,inside:!0}),o.labels.template.setAll({centerX:S,centerY:k,fill:F(e.axisLabelsColor),fontFamily:e.fontFamily,fontSize:e.axisLabelsFontSize,fontWeight:e.axisLabelsFontWeight,maxPosition:e.yAxisMaxLabelPosition,minPosition:e.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:n?0:e.yAxisLabelSpacing,paddingRight:n?e.yAxisLabelSpacing:0,paddingTop:0,textAlign:"start"}),o.grid.template.setAll({strokeOpacity:1,stroke:F(e.axisGridStroke)})}function J(t,i){if($(t))return;const e=t.data??void 0,n=i.data??void 0;t.chart.get("cursor")?.set("forceHidden",!n?.refined);const o=e!==n,s=e?.effectiveUnits!==n?.effectiveUnits,a=e?.uniformScaling!==n?.uniformScaling;t.data=n,t.messages=i.messages,(o||s)&&(Q(t),et(t)),a&&K(t),pt(t)}function K(t){$(t)||(t.xAxis.zoom(0,1),t.yAxis.zoom(0,1))}function Q(t){const{chart:i,data:e,xAxis:n,yAxis:o}=t,{minX:s,maxX:a,minY:l,maxY:r}=_({data:e,pixelWidth:n.width(),pixelHeight:o.height()}),d=e?.uniformScaling;i.setAll({panX:!0,panY:d,pinchZoomX:!0,pinchZoomY:d,wheelX:"panX",wheelY:d?"zoomXY":"zoomX"}),n.setAll({max:a,min:s,panX:!0,panY:!1,zoomX:!0,zoomY:d}),o.setAll({max:r,min:l,panX:!1,panY:d,zoomX:d,zoomY:d})}function _({data:t,pixelWidth:i,pixelHeight:e}){if(null==t)return E;const n=t.statistics,o=0,s=n?.maxDistance;let a=n?.minElevation,l=n?.maxElevation;if(null==s||null==a||null==l)return E;const r=Math.max(s-o,R);let c=Math.max(l-a,R);const m=t.effectiveUnits;if(t.dynamicElevationRange){const t=d(r,m.distance,m.elevation);c=Math.max(c,t/p().maxChartRatio)}return a-=W*c,l=a+c+O*c,[a,l]=f(a,l,10),c=l-a,t.uniformScaling?tt({data:t,bounds:{minX:o,maxX:s,minY:a,maxY:l},pixelWidth:i,pixelHeight:e,centered:!0}):{minX:o,maxX:o+r,minY:a,maxY:a+c}}function tt({data:t,bounds:i,pixelWidth:e,pixelHeight:n,centered:o}){if(null==t)return i;let{minX:s,maxX:a,minY:l,maxY:r}=i;if(null==s||null==a||null==l||null==r)return E;const c=a-s,p=r-l,m=t.effectiveUnits,u=d(p,m.elevation,m.distance)/n/(c/e);return u>=1?[s,a]=it([s,a],u,o):[l,r]=it([l,r],1/u,o),{minX:s,maxX:a,minY:l,maxY:r}}function it([t,i],e,n){const o=(i-t)*e;if(n){const e=(t+i)/2-o/2;return[e,e+o]}return[t,t+o]}function et(t){const{chart:i,data:e,seriesInfos:n,xAxis:o,yAxis:s}=t;if(null==e||0===e.lines.length)return void i.series.clear();const a=new Map,l=new Set(i.series.values),r=e.lines.length;for(let d=0;d<r;d++){const o=e.lines[d];let s=n.get(o.id);s?(s.fill&&l.delete(s.fill),l.delete(s.line)):(s=ot(t,o),s.fill&&i.series.push(s.fill),i.series.push(s.line)),a.set(s.id,s);const c=r-d-1;s.fill?.set("layer",c),s.line.set("layer",r+c),nt(t,s,o)}t.seriesInfos=a;for(const d of l)i.series.removeValue(d);o.set("layer",r+1),s.set("layer",r+2)}function nt({theme:t},i,e){const n=F(e.color.toCss()),o=e.samples??[],s=o.length>0,{line:a,fill:l}=i;a.set("visible",s),a.set("stroke",n),l?.set("visible",s),l?.set("fill",P.lighten(n,t.seriesFillLighten)),a.data.setAll(o),l?.data.setAll(o)}function ot(t,i){const{id:e}=i,n=st(t,`${H}-${e}`);n.setAll({dy:i.chartStrokeOffsetY,tooltip:at(t)}),n.strokes.template.setAll({strokeWidth:i.chartStrokeWidth});let o=null;return i.chartFillEnabled&&(o=st(t,`${B}-${e}`),o.fills.template.setAll({fillOpacity:1,visible:!0})),{id:e,line:n,fill:o}}function st(t,i){return M.new(t.chart.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:i,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:t.xAxis,yAxis:t.yAxis})}function at({theme:t,chart:i}){const e=X.new(i.root,{forceHidden:!0,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:"vertical",visible:!1}),n=t.seriesTooltipPaddingHorizontal,o=t.seriesTooltipPaddingVertical;return e.label.setAll({fill:F(t.seriesTooltipLabelColor),fontFamily:t.fontFamily,fontSize:t.seriesTooltipFontSize,paddingBottom:o,paddingLeft:n,paddingRight:n,paddingTop:o,textAlign:"start"}),e.get("background")?.setAll({stroke:void 0,fill:F(t.seriesTooltipBackgroundColor)}),e.adapters.add("dy",(i=>{const n=t.seriesTooltipSpacing,o=e.get("pointTo")?.y??0;return(i??0)+(e.y()>o?n:-n)})),e}function lt(t,i){const{xAxis:e,yAxis:n}=t,o=()=>{i(rt(e),rt(n))},s=t=>[t.on("start",o),t.on("end",o)];return bt([...s(e),...s(n)])}function rt(t){const i=Math.abs((t.get("end")??0)-(t.get("start")??0)),e=0!==i?1/i:1;return Math.abs(1-e)<c()?1:e}function dt(t,i){const{chart:e,xAxis:n,yAxis:o}=t,s=e.get("cursor"),a=e.plotContainer.events,l=i=>{t.pointerIsOver=i,pt(t)},r=()=>{l(!1),i(null,null)};return bt([s?.events.on("cursormoved",(()=>{if(!t.pointerIsOver)return;pt(t);let e=s?.getPrivate("positionX")??0,a=s?.getPrivate("positionY")??0;const l=t.data;if(null!=l?.statistics){const{maxDistance:t,minElevation:i,maxElevation:s}=l.statistics;if(null!=t){e=ct(e,At(n),vt(n),0,t)}if(null!=i&&null!=s){a=ct(a,At(o),vt(o),i,s)}}i(e,a)})),a.on("pointerover",(()=>l(!0))),a.on("pointerout",r),a.on("blur",r)])}function ct(t,i,e,n,o){return(i+t*(e-i)-n)/(o-n)}function pt(t){const i=mt(t);if(!i)return void t.seriesInfos.forEach((t=>{t.line.get("tooltip")?.set("forceHidden",!0)}));t.seriesInfos.forEach((t=>{const e=t.line.get("tooltip");e.set("forceHidden",!1),e.label.set("text",i)}));t.xAxis.getTooltip().setAll({tooltipText:xt(t)})}function mt(t){const{data:i}=t,e=i?.lines.map((i=>({line:i,y:ht(t,i)?.elevation}))).sort(ut);return e&&0!==e.length&&null!=e[0].y?e.map((({y:i,line:e})=>ft(t,e,i))).join("\n"):null}function ut({y:t},{y:i}){return null==t?1:null==i?-1:i-t}function ft(t,i,e){const{data:n,messages:o}=t;if(null==n||null==o)return"";const s=p().formatPrecision,a=Y(o.chartTooltip,{name:u(i,o),elevation:null!=e?l(o,e,n.effectiveUnits.elevation,s):m});return`[${i.color.toHex()}]●[/] ${a}`}function xt(t){const{data:i,messages:e}=t;if(null==i||null==e)return"";const n=i.lines[0],o=n?ht(t,n):null,s=p().formatPrecision;return null!=o?l(e,o.distance,i.effectiveUnits.distance,s):"-"}function gt(t,i){const e=g.new(t.chart.root,{});return e.format=(e,n,o)=>{const{data:s,messages:a}=t;if(null==a||null==s||"string"==typeof e)return"";return`${z(e,{maximumFractionDigits:o})} ${r(a,s.effectiveUnits[i],"abbr")}`},e}function ht({chart:t,xAxis:i},n){const o=n.samples??[];if(0===o.length)return null;const s=t.get("cursor"),a=s?.getPrivate("positionX")??0,l=i.toAxisPosition(a),r=i.positionToValue(l);return e(o,r,(t=>t.distance))}function At(t){return t.positionToValue(t.get("start")??0)}function vt(t){return t.positionToValue(t.get("end")??1)}function bt(t){return n(t.map(yt))}function yt(t){return o((()=>{t?.dispose()}))}export{I as createChart,_ as getAdjustedBounds};
|
|
5
|
+
import{r as t,d as i}from"../../../chunks/Responsive.js";import"../../../intl.js";import{binaryFindClosest as e}from"../../../core/arrayUtils.js";import{handlesGroup as n,makeHandle as o}from"../../../core/handleUtils.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{signal as a}from"../../../core/signal.js";import{formatDecimal as l,unitName as r}from"../../../core/unitFormatUtils.js";import{convertUnit as d}from"../../../core/unitUtils.js";import{g as c}from"../../../chunks/common.js";import{getConfig as p,notAvailable as m}from"./constants.js";import{getTranslatedLineTitle as u}from"./intlUtils.js";import{niceScale as f}from"./niceScale.js";import{c as x,N as g}from"../../../chunks/chartUtilsAm5.js";import{isRTL as h}from"../../support/widgetUtils.js";import{isDarkTheme as A}from"../../../support/themeUtils.js";import{X as v,V as b,A as y,a as T,b as L,L as M}from"../../../chunks/LineSeries.js";import{aq as S,a6 as F,a4 as k,C as P}from"../../../chunks/Theme.js";import{T as X}from"../../../chunks/Tooltip.js";import{substitute as Y}from"../../../intl/substitute.js";import{formatNumber as z}from"../../../intl/number.js";const C="#f8f8f8",j="#a9a9a9",w="#323232",H="line",B="fill",U=15,D=12,R=.001,O=.1,W=.02,G={fontFamily:"Avenir Next",paddingBottom:D/2,paddingLeft:0,paddingRight:0,paddingTop:0,axisGridStroke:"#f4f4f4",axisLabelsFontSize:9,axisLabelsFontWeight:"400",axisLabelsColor:j,axisTooltipFontSize:12,axisTooltipBackgroundColor:w,axisTooltipLabelColor:C,axisTooltipPaddingTop:Math.round(D/4),axisTooltipPaddingBottom:Math.round(D/4),axisTooltipPaddingHorizontal:Math.round(U/4),xAxisMinGridDistance:50,xAxisLabelsSpacing:Math.round(D/2),xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:Math.round(U/4),yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:C,seriesTooltipLabelColor:w,seriesFillLighten:.9,seriesTooltipSpacing:D/2,seriesTooltipPaddingVertical:Math.round(U/4),seriesTooltipPaddingHorizontal:Math.round(U/4)},V={...G,axisGridStroke:w,axisLabelsColor:j,axisTooltipBackgroundColor:w,axisTooltipLabelColor:C,seriesTooltipBackgroundColor:w,seriesTooltipLabelColor:C,seriesFillLighten:-.75},E={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};async function I(e){const o=await x(e.container);s(e.abortOptions);const l=A(),r=l?V:G;o.setThemes(l?[t.new(o),i.new(o)]:[t.new(o)]);const d=h(e.container),c=o.container.children.push(v.new(o,{panX:!0,panY:!0,paddingTop:r.paddingTop,paddingBottom:r.paddingBottom,paddingLeft:d?r.paddingRight:r.paddingLeft,paddingRight:d?r.paddingLeft:r.paddingRight,maxTooltipDistance:0}));c.zoomOutButton.set("forceHidden",!0);const p=c.xAxes.push(b.new(o,{renderer:y.new(o,{})})),m=c.yAxes.push(b.new(o,{renderer:T.new(o,{})})),u=a(null),f=a("loading"),g={params:e,chart:c,xAxis:p,yAxis:m,seriesInfos:new Map,messages:null,theme:r,pointerIsOver:!1,get state(){return f.value},get data(){return u.value},set data(t){u.value=t}};Z(g),q(g),N(g);const L=n([lt(g,e.onRangeChange),dt(g,e.onCursorPositionChange),yt(o.events.once("frameended",(()=>{f.value="ready"}))),yt(o)]);return{destroy:()=>{L.remove(),f.value="destroyed"},update:t=>{t.data===g.data&&t.messages===g.messages||$(g)||J(g,t)},zoomOut:()=>K(g)}}function $(t){return"destroyed"===t.state}function N({chart:t,xAxis:i,yAxis:e}){const n=L.new(t.root,{behavior:"none",xAxis:i,yAxis:e});n.lineY.set("visible",!1),t.set("cursor",n)}function Z(t){const{chart:i,xAxis:e,theme:n}=t;e.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:gt(t,"distance"),strictMinMax:!0,strictMinMaxSelection:!0}),e.axisHeader.set("forceHidden",!0);const o=e.get("renderer");o.setAll({inside:!1,minGridDistance:n.xAxisMinGridDistance}),o.labels.template.setAll({centerX:S,centerY:S,fill:F(n.axisLabelsColor),fontFamily:n.fontFamily,fontSize:n.axisLabelsFontSize,fontWeight:n.axisLabelsFontWeight,maxPosition:n.xAxisMaxLabelPosition,minPosition:n.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:n.xAxisLabelsSpacing});const s=e.set("tooltip",X.new(i.root,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));s.get("background")?.setAll({fill:F(n.axisTooltipBackgroundColor),stroke:void 0}),s.label.setAll({fill:F(n.axisTooltipLabelColor),fontFamily:n.fontFamily,fontSize:n.axisTooltipFontSize,paddingBottom:n.axisTooltipPaddingBottom,paddingLeft:n.axisTooltipPaddingHorizontal,paddingRight:n.axisTooltipPaddingHorizontal,paddingTop:n.axisTooltipPaddingTop}),o.grid.template.setAll({strokeOpacity:1,stroke:F(n.axisGridStroke)})}function q(t){const{yAxis:i,theme:e}=t;i.setAll({baseValue:p().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:gt(t,"elevation"),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),i.axisHeader.set("visible",!1);const n=h(t.params.container),o=i.get("renderer");o.setAll({minGridDistance:e.yAxisMinGridDistance,opposite:n,inside:!0}),o.labels.template.setAll({centerX:S,centerY:k,fill:F(e.axisLabelsColor),fontFamily:e.fontFamily,fontSize:e.axisLabelsFontSize,fontWeight:e.axisLabelsFontWeight,maxPosition:e.yAxisMaxLabelPosition,minPosition:e.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:n?0:e.yAxisLabelSpacing,paddingRight:n?e.yAxisLabelSpacing:0,paddingTop:0,textAlign:"start"}),o.grid.template.setAll({strokeOpacity:1,stroke:F(e.axisGridStroke)})}function J(t,i){if($(t))return;const e=t.data??void 0,n=i.data??void 0;t.chart.get("cursor")?.set("forceHidden",!n?.refined);const o=e!==n,s=e?.effectiveUnits!==n?.effectiveUnits,a=e?.uniformScaling!==n?.uniformScaling;t.data=n,t.messages=i.messages,(o||s)&&(Q(t),et(t)),a&&K(t),pt(t)}function K(t){$(t)||(t.xAxis.zoom(0,1),t.yAxis.zoom(0,1))}function Q(t){const{chart:i,data:e,xAxis:n,yAxis:o}=t,{minX:s,maxX:a,minY:l,maxY:r}=_({data:e,pixelWidth:n.width(),pixelHeight:o.height()}),d=!!e?.uniformScaling,c=!!e?.refined;i.setAll({panX:!0,panY:d,pinchZoomX:c,pinchZoomY:c&&d,wheelX:"panX",wheelY:c?d?"zoomXY":"zoomX":"none"}),n.setAll({max:a,min:s,panX:!0,panY:!1,zoomX:!0,zoomY:d}),o.setAll({max:r,min:l,panX:!1,panY:d,zoomX:d,zoomY:d})}function _({data:t,pixelWidth:i,pixelHeight:e}){if(null==t)return E;const n=t.statistics,o=0,s=n?.maxDistance;let a=n?.minElevation,l=n?.maxElevation;if(null==s||null==a||null==l)return E;const r=Math.max(s-o,R);let c=Math.max(l-a,R);const m=t.effectiveUnits;if(t.dynamicElevationRange){const t=d(r,m.distance,m.elevation);c=Math.max(c,t/p().maxChartRatio)}return a-=W*c,l=a+c+O*c,[a,l]=f(a,l,10),c=l-a,t.uniformScaling?tt({data:t,bounds:{minX:o,maxX:s,minY:a,maxY:l},pixelWidth:i,pixelHeight:e,centered:!0}):{minX:o,maxX:o+r,minY:a,maxY:a+c}}function tt({data:t,bounds:i,pixelWidth:e,pixelHeight:n,centered:o}){if(null==t)return i;let{minX:s,maxX:a,minY:l,maxY:r}=i;if(null==s||null==a||null==l||null==r)return E;const c=a-s,p=r-l,m=t.effectiveUnits,u=d(p,m.elevation,m.distance)/n/(c/e);return u>=1?[s,a]=it([s,a],u,o):[l,r]=it([l,r],1/u,o),{minX:s,maxX:a,minY:l,maxY:r}}function it([t,i],e,n){const o=(i-t)*e;if(n){const e=(t+i)/2-o/2;return[e,e+o]}return[t,t+o]}function et(t){const{chart:i,data:e,seriesInfos:n,xAxis:o,yAxis:s}=t;if(null==e||0===e.lines.length)return void i.series.clear();const a=new Map,l=new Set(i.series.values),r=e.lines.length;for(let d=0;d<r;d++){const o=e.lines[d];let s=n.get(o.id);s?(s.fill&&l.delete(s.fill),l.delete(s.line)):(s=ot(t,o),s.fill&&i.series.push(s.fill),i.series.push(s.line)),a.set(s.id,s);const c=r-d-1;s.fill?.set("layer",c),s.line.set("layer",r+c),nt(t,s,o)}t.seriesInfos=a;for(const d of l)i.series.removeValue(d);o.set("layer",r+1),s.set("layer",r+2)}function nt({theme:t},i,e){const n=F(e.color.toCss()),o=e.samples??[],s=o.length>0,{line:a,fill:l}=i;a.set("visible",s),a.set("stroke",n),l?.set("visible",s),l?.set("fill",P.lighten(n,t.seriesFillLighten)),a.data.setAll(o),l?.data.setAll(o)}function ot(t,i){const{id:e}=i,n=st(t,`${H}-${e}`);n.setAll({dy:i.chartStrokeOffsetY,tooltip:at(t)}),n.strokes.template.setAll({strokeWidth:i.chartStrokeWidth});let o=null;return i.chartFillEnabled&&(o=st(t,`${B}-${e}`),o.fills.template.setAll({fillOpacity:1,visible:!0})),{id:e,line:n,fill:o}}function st(t,i){return M.new(t.chart.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:i,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:t.xAxis,yAxis:t.yAxis})}function at({theme:t,chart:i}){const e=X.new(i.root,{forceHidden:!0,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:"vertical",visible:!1}),n=t.seriesTooltipPaddingHorizontal,o=t.seriesTooltipPaddingVertical;return e.label.setAll({fill:F(t.seriesTooltipLabelColor),fontFamily:t.fontFamily,fontSize:t.seriesTooltipFontSize,paddingBottom:o,paddingLeft:n,paddingRight:n,paddingTop:o,textAlign:"start"}),e.get("background")?.setAll({stroke:void 0,fill:F(t.seriesTooltipBackgroundColor)}),e.adapters.add("dy",(i=>{const n=t.seriesTooltipSpacing,o=e.get("pointTo")?.y??0;return(i??0)+(e.y()>o?n:-n)})),e}function lt(t,i){const{xAxis:e,yAxis:n}=t,o=()=>{i(rt(e),rt(n))},s=t=>[t.on("start",o),t.on("end",o)];return bt([...s(e),...s(n)])}function rt(t){const i=Math.abs((t.get("end")??0)-(t.get("start")??0)),e=0!==i?1/i:1;return Math.abs(1-e)<c()?1:e}function dt(t,i){const{chart:e,xAxis:n,yAxis:o}=t,s=e.get("cursor"),a=e.plotContainer.events,l=i=>{t.pointerIsOver=i,pt(t)},r=()=>{l(!1),i(null,null)};return bt([s?.events.on("cursormoved",(()=>{if(!t.pointerIsOver)return;pt(t);let e=s?.getPrivate("positionX")??0,a=s?.getPrivate("positionY")??0;const l=t.data;if(null!=l?.statistics){const{maxDistance:t,minElevation:i,maxElevation:s}=l.statistics;if(null!=t){e=ct(e,At(n),vt(n),0,t)}if(null!=i&&null!=s){a=ct(a,At(o),vt(o),i,s)}}i(e,a)})),a.on("pointerover",(()=>l(!0))),a.on("pointerout",r),a.on("blur",r)])}function ct(t,i,e,n,o){return(i+t*(e-i)-n)/(o-n)}function pt(t){const i=mt(t);if(!i)return void t.seriesInfos.forEach((t=>{t.line.get("tooltip")?.set("forceHidden",!0)}));t.seriesInfos.forEach((t=>{const e=t.line.get("tooltip");e.set("forceHidden",!1),e.label.set("text",i)}));t.xAxis.getTooltip().setAll({tooltipText:xt(t)})}function mt(t){const{data:i}=t,e=i?.lines.map((i=>({line:i,y:ht(t,i)?.elevation}))).sort(ut);return e&&0!==e.length&&null!=e[0].y?e.map((({y:i,line:e})=>ft(t,e,i))).join("\n"):null}function ut({y:t},{y:i}){return null==t?1:null==i?-1:i-t}function ft(t,i,e){const{data:n,messages:o}=t;if(null==n||null==o)return"";const s=p().formatPrecision,a=Y(o.chartTooltip,{name:u(i,o),elevation:null!=e?l(o,e,n.effectiveUnits.elevation,s):m});return`[${i.color.toHex()}]●[/] ${a}`}function xt(t){const{data:i,messages:e}=t;if(null==i||null==e)return"";const n=i.lines[0],o=n?ht(t,n):null,s=p().formatPrecision;return null!=o?l(e,o.distance,i.effectiveUnits.distance,s):"-"}function gt(t,i){const e=g.new(t.chart.root,{});return e.format=(e,n,o)=>{const{data:s,messages:a}=t;if(null==a||null==s||"string"==typeof e)return"";return`${z(e,{maximumFractionDigits:o})} ${r(a,s.effectiveUnits[i],"abbr")}`},e}function ht({chart:t,xAxis:i},n){const o=n.samples??[];if(0===o.length)return null;const s=t.get("cursor"),a=s?.getPrivate("positionX")??0,l=i.toAxisPosition(a),r=i.positionToValue(l);return e(o,r,(t=>t.distance))}function At(t){return t.positionToValue(t.get("start")??0)}function vt(t){return t.positionToValue(t.get("end")??1)}function bt(t){return n(t.map(yt))}function yt(t){return o((()=>{t?.dispose()}))}export{I as createChart,_ as getAdjustedBounds};
|