12345 |
- /*
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- See https://js.arcgis.com/4.25/esri/copyright.txt for details.
- */
- import{_ as t}from"../chunks/tslib.es6.js";import e from"../core/Logger.js";import{isSome as r}from"../core/maybe.js";import{throwIfAborted as o}from"../core/promiseUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{enumeration as l}from"../core/accessorSupport/decorators/enumeration.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import p from"../portal/Portal.js";import{r as a,w as c}from"../chunks/persistableUrlUtils.js";import m from"./Symbol.js";import{Thumbnail as n}from"./support/Thumbnail.js";var y;let h=y=class extends m{constructor(t){super(t),this.styleName=null,this.portal=null,this.styleUrl=null,this.thumbnail=null,this.name=null,this.type="web-style"}get _fetchCacheKey(){const t=r(this.portal)?this.portal:p.getDefault(),e=t.user?t.user.username:null;return`${this.styleName}:${this.styleUrl}:${this.name}:${e}:${t.url}`}read(t,e){this.portal=e?e.portal:void 0,super.read(t,e)}clone(){return new y({name:this.name,styleUrl:this.styleUrl,styleName:this.styleName,portal:this.portal})}fetchSymbol(t){return this._fetchSymbol("webRef",t)}fetchCIMSymbol(t){return this._fetchSymbol("cimRef",t)}async _fetchSymbol(t,s){const l=r(s)?s.cache:null,i=l?this._fetchCacheKey:null;if(r(l)){const t=i&&l.get(i);if(t)return t.clone()}const p=await u();o(s);const a=p.resolveWebStyleSymbol(this,{portal:this.portal},t,s);a.catch((t=>{e.getLogger(this.declaredClass).error("#fetchSymbol()","Failed to create symbol from style",t)}));const c=await a;return"webRef"===t&&"point-3d"===c.type||"cimRef"===t&&"cim"===c.type?(r(l)&&l.set(i,c.clone()),c):null}};function u(){return import("./support/webStyleSymbolUtils.js")}t([s({json:{write:!1}})],h.prototype,"color",void 0),t([s({type:String,json:{write:!0}})],h.prototype,"styleName",void 0),t([s({type:p,json:{write:!1}})],h.prototype,"portal",void 0),t([s({type:String,json:{read:a,write:c}})],h.prototype,"styleUrl",void 0),t([s({type:n,json:{read:!1}})],h.prototype,"thumbnail",void 0),t([s({type:String,json:{write:!0}})],h.prototype,"name",void 0),t([l({styleSymbolReference:"web-style"},{readOnly:!0})],h.prototype,"type",void 0),t([s()],h.prototype,"_fetchCacheKey",null),h=y=t([i("esri.symbols.WebStyleSymbol")],h);const f=h;export{f as default};
|