/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{clone as s}from"../../../core/lang.js";import{defaultBasemapGroups as e,getBasemapId as t,getBasemapGroup as a}from"../../support/utils.js";function p(s,e,p){let m=null,o=null;if(e&&(m=t(e,s,!1),m)){const s=a(m);null!=s&&(o=s)}return!m&&p&&(m="dark"===p?"dark-gray":"gray",o=p),m||o||(m="gray",o="light"),{basemapId:m,basemapTheme:o}}class m{constructor(s){const{name:t,label:a,description:p,schemes:m}=s;this.name=t,this.label=a,this.description=p,this.schemes=m;const o=s.basemapGroups||e;let r=[];o&&Object.keys(o).forEach(s=>{r=r.concat(o[s])}),this.supportedBasemaps=r,this.basemapGroups=o}isBasemapSupported(s){const e=t(s,this.supportedBasemaps);return!(!e||!this.supportedBasemaps.includes(e))}getRawSchemes(e){const{basemapId:t,basemapTheme:m}=p(this.supportedBasemaps,e.basemap,e.basemapTheme);let o=m;if(t){const s=a(t,this.basemapGroups);null!=s&&(o=s)}let r=e.geometryType;"multipoint"===r?r="point":"mesh"===r&&(r="polygon");const i=this.schemes[r]||this.schemes.default;return{schemesInfo:s(i[o]),basemapId:t,basemapTheme:m}}}export{m as default};
