import t from"@arcgis/core/Basemap";import{createStandardBasemap as e,getStandardBasemapId as a}from"../utilities/basemaps.js";import{applyJsonToLayers as i}from"./LayerJson.js";export async function jsonToBasemap(i){const r=a(i);if(r){const t=await e(r);return t.id=i.id??t.id,t.title=i.title??t.title,t}return t.fromJSON(i)}export async function applyJsonToBasemap(t,e){e.loaded||await e.load(),t.hasOwnProperty("title")&&null!=t.title&&(e.title=t.title);const a=[],r=[];t.baseMapLayers?.forEach((t=>{t.path||(t.isReference?r:a).push(t)})),(a.length||r.length)&&(await i(a,e.baseLayers),await i(r,e.referenceLayers))}