import{isBuildingComponentSublayer as i}from"../utilities/_layers.js";import{checkArg as p}from"../utilities/checkArg.js";import{LayerDefinition as e}from"./LayerDefinition.js";import{PopupInfo as o}from"./PopupInfo.js";export var BuildingSceneSublayer;!function(t){t.esriBuildingSublayerDefaults={listMode:"show",opacity:1,visible:!0,popupEnabled:!0},t.applyToEsriApiBuildingSublayer=async function(t,l){p("sublayerJson",t).isNotMissing(),p("sublayer",l).isNotMissing(),t.hasOwnProperty("listMode")&&null!=t.listMode&&(l.listMode=t.listMode),t.hasOwnProperty("opacity")&&null!=t.opacity&&(l.opacity=t.opacity),t.hasOwnProperty("title")&&(l.title=t.title),t.hasOwnProperty("visibility")&&null!=t.visibility&&(l.visible=t.visibility),i(l)&&(t.hasOwnProperty("disablePopup")&&(l.popupEnabled=!t.disablePopup),t.hasOwnProperty("layerDefinition")&&null!=t.layerDefinition&&await e.applyToEsriApiLayer(t.layerDefinition,l),t.hasOwnProperty("popupInfo")&&null!=t.popupInfo&&(l.popupTemplate=o.toEsriApiPopupTemplate(t.popupInfo)))},t.fromEsriApiBuildingSublayer=function(t){p("sublayer",t).isNotMissing();const l={};return i(t)&&(null!==t.popupEnabled&&void 0!==t.popupEnabled&&(l.disablePopup=!t.popupEnabled),t.popupTemplate&&(l.popupInfo=o.fromEsriApiPopupTemplate(t.popupTemplate))),t.hasOwnProperty("id")&&(l.id=t.id),l.layerDefinition=e.fromEsriApiLayer(t),t.hasOwnProperty("listMode")&&(l.listMode=t.listMode),t.hasOwnProperty("opacity")&&(l.opacity=t.opacity),t.hasOwnProperty("title")&&(l.title=t.title??void 0),t.hasOwnProperty("visible")&&(l.visibility=t.visible),l}}(BuildingSceneSublayer||(BuildingSceneSublayer={}));