/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import o from"../../Color.js";import{isSome as t}from"../../core/arrayUtils.js";import{createUniqueColors as a}from"../../core/colorUtils.js";import e from"./support/colors.js";import{createThemes as n,filterSchemesByName as c,getRawSchemes as r,filterSchemesByTag as i,getThemesforBasemap as s}from"./support/symbologyUtils.js";import{toWorldScale as l}from"./support/utils.js";const m={light:{color:[153,153,153,.25],width:"1px"},dark:{color:[153,153,153,.25],width:"1px"},darker:{color:[26,26,26,.25],width:"1px"}},p=["tropical-bliss","desert-blooms","under-the-sea","vibrant-rainbow","ocean-bay","prairie-summer","pastel-chalk"],u=["predominant-v1","predominant-v2","predominant-v3","predominant-v4","predominant-v5","predominance-race","predominance-money","predominance-race-ethnic","predominance-rainbow","predominance-sequence"],d=["cat-symbols-strong","cat-symbols-autumnal","cat-symbols-bright","cat-symbols-midrange","cat-symbols-subdued","cat-symbols-pastel","cat-symbols-red","cat-symbols-blue","cat-symbols-green","cat-symbols-gray"],h=["cat-popup-olympic-sunset"],y="#aaaaaa",g="12px",f=n({themeDictionary:{default:{name:"default",label:"Default",description:"Default theme for visualizing features by their type.",schemes:{point:{light:{common:{noDataColor:y,outline:m.light,size:"8px"},primary:"cat-dark",secondary:["cat-light"].concat(d).concat(p).concat(u).concat(h)},dark:{common:{noDataColor:y,outline:m.darker,size:"8px"},primary:"cat-light",secondary:["cat-dark"].concat(d).concat(p).concat(u).concat(h)}},polyline:{light:{common:{noDataColor:y,width:"2px"},primary:"cat-dark",secondary:["cat-light"].concat(d).concat(p).concat(u).concat(h)},dark:{common:{noDataColor:y,width:"2px"},primary:"cat-light",secondary:["cat-dark"].concat(d).concat(p).concat(u).concat(h)}},polygon:{light:{common:{noDataColor:y,outline:m.light,fillOpacity:.8},primary:"cat-dark",secondary:["cat-light"].concat(d).concat(p).concat(u).concat(h)},dark:{common:{noDataColor:y,outline:m.dark,fillOpacity:.8},primary:"cat-light",secondary:["cat-dark"].concat(d).concat(p).concat(u).concat(h)}}}},"point-cloud-class":{name:"point-cloud-class",label:"Point Cloud Class",description:"Default theme for visualizing point cloud data based on classification.",schemes:{point:{light:{primary:"point-cloud-class-scheme",secondary:[]},dark:{primary:"point-cloud-class-scheme",secondary:[]}}}}}});function w(o){return s(f,o)}function b(o){const a=o.theme||"default",e=r({basemap:o.basemap,geometryType:o.geometryType,basemapTheme:o.basemapTheme,theme:f.get(a)});if(!e)return;const{schemesInfo:n,basemapId:c,basemapTheme:i}=e,s=n.common;return{primaryScheme:z(o,n.primary,s),secondarySchemes:n.secondary.map(t=>z(o,t,s)).filter(t),basemapId:c,basemapTheme:i}}function C(o){return c(o.name,b(o))}function D(o){return i(o.includedTags,o.excludedTags,b(o))}function k(t){if(!t)return;const a={...t};return a.colors=a.colors.map(t=>new o(t)),a.tags=[...a.tags],"noDataColor"in a&&a.noDataColor&&(a.noDataColor=new o(a.noDataColor)),"outline"in a&&a.outline&&(a.outline={color:a.outline.color&&new o(a.outline.color),width:a.outline.width}),a}function z(o,t,n){const{numColors:c}=o,r=o.theme||"default",i=e[t];if(!i)return;const s=c?i[c]??a(i.stops,c):i.stops,l="mesh"!==o.geometryType&&o.worldScale?o.view:null;switch(o.geometryType){case"point":case"multipoint":{if("point-cloud-class"===r)return x({theme:r,name:i.name,tags:i.tags,colors:s});const o=n;return T({name:i.name,tags:i.tags,theme:r,colors:s,noDataColor:o.noDataColor,opacity:1,outline:o.outline,size:o.size},l)}case"polyline":{const o=n;return v({name:i.name,tags:i.tags,theme:r,colors:s,noDataColor:o.noDataColor,opacity:1,width:o.width},l)}case"polygon":{const o=n;return j({name:i.name,tags:i.tags,theme:r,colors:s,noDataColor:o.noDataColor,opacity:o.fillOpacity||1,outline:o.outline,size:g},l)}case"mesh":{const o=n;return O({name:i.name,tags:i.tags,theme:r,colors:s,noDataColor:o.noDataColor,opacity:o.fillOpacity||1})}default:return}}function x(t){return{name:t.name,tags:[...t.tags],theme:t.theme,colors:t.colors.map(t=>new o(t))}}function T(t,a){return{name:t.name,tags:[...t.tags],theme:t.theme,colors:t.colors.map(t=>new o(t)),noDataColor:new o(t.noDataColor),outline:{color:new o(t.outline.color),width:t.outline.width},size:a?l(t.size,a):t.size,opacity:t.opacity}}function v(t,a){return{name:t.name,tags:[...t.tags],theme:t.theme,colors:t.colors.map(t=>new o(t)),noDataColor:new o(t.noDataColor),width:a?l(t.width,a):t.width,opacity:t.opacity}}function j(t,a){return{name:t.name,tags:[...t.tags],theme:t.theme,colors:t.colors.map(t=>new o(t)),noDataColor:new o(t.noDataColor),outline:{color:new o(t.outline.color),width:t.outline.width},opacity:t.opacity,size:a?l(t.size,a):t.size}}function O(t){return{name:t.name,tags:[...t.tags],theme:t.theme,colors:t.colors.map(t=>new o(t)),noDataColor:new o(t.noDataColor),opacity:t.opacity}}export{k as cloneScheme,C as getSchemeByName,b as getSchemes,D as getSchemesByTag,w as getThemes};
