/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["require","../chunks/_rollupPluginBabelHelpers","../chunks/tslib.es6","../core/accessorSupport/decorators/aliasOf","../core/arrayUtils","../core/has","../core/accessorSupport/decorators/cast","../core/accessorSupport/decorators/property","../core/accessorSupport/decorators/subclass","./Widget","./BasemapToggle/BasemapToggleViewModel","./support/decorators/accessibleHandler","./support/decorators/messageBundle","./support/decorators/vmEvent","./support/jsxFactory","./support/widgetUtils"],(function(e,a,s,t,i,l,o,r,n,c,d,p,m,g,u,b){"use strict";const _={base:"esri-basemap-toggle esri-widget",secondaryBasemapImage:"esri-basemap-toggle__image--secondary",container:"esri-basemap-thumbnail esri-basemap-toggle__container",image:"esri-basemap-thumbnail__image esri-basemap-toggle__image",imageLoading:"esri-basemap-toggle__image--loading",overlay:"esri-basemap-thumbnail__overlay esri-basemap-toggle__image-overlay",title:"esri-basemap-thumbnail__title esri-basemap-toggle__title",overlayScrim:"esri-basemap-thumbnail__overlay-scrim",disabled:"esri-disabled",loaderAnimation:"esri-widget__loader-animation"};function v(e){const a=d.getThumbnailUrl(e);return a?{backgroundImage:"url("+a+")"}:{backgroundImage:""}}const y={title:!1};let h=function(s){function t(e,a){var t;return(t=s.call(this,e,a)||this).activeBasemap=null,t.label=void 0,t.messages=null,t.nextBasemap=null,t.view=null,t.viewModel=new d,t.visibleElements={...y},t}a._inheritsLoose(t,s);var i=t.prototype;return i.loadDependencies=function(){return Promise.all([new Promise(((a,s)=>e(["../chunks/calcite-icon"],a,s))),new Promise(((a,s)=>e(["../chunks/calcite-scrim"],a,s)))])},i.castVisibleElements=function(e){return{...y,...e}},i.toggle=function(){return null},i.render=function(){const e=this.viewModel,a="disabled"===e.state?null:e.activeBasemap,s="disabled"===e.state?null:e.nextBasemap,t="loading"===e.state,i="incompatible-next-basemap"===e.state,l=s?s.title:"",o=s&&"loaded"!==s.loadStatus;let r;const n=this.visibleElements.title&&l,c=i;return(n||c)&&(r=u.tsx("div",{class:_.overlay,key:"overlay"},n?u.tsx("span",{class:_.title,title:l},l):null,c?u.tsx("calcite-scrim",{class:_.overlayScrim,title:this.messages.incompatibleSpatialReference},u.tsx("calcite-icon",{icon:"exclamation-mark-triangle"})):null)),u.tsx("div",{class:this.classes(_.base,i?_.disabled:null),role:"button","data-basemap-id":s?s.id:"",bind:this,onclick:this._toggle,onkeydown:this._toggle,tabIndex:i?-1:0,title:this.label},u.tsx("div",{class:this.classes(_.container,_.secondaryBasemapImage)},u.tsx("div",{class:_.image,styles:v(a)})),u.tsx("div",{class:_.container},u.tsx("div",{class:this.classes(_.image,o?_.imageLoading:null),styles:v(s)},o||t?u.tsx("calcite-scrim",null,u.tsx("span",{"aria-hidden":"true",role:"presentation",class:_.loaderAnimation})):null),r))},i._toggle=function(){this.toggle()},t}(c);s.__decorate([t.aliasOf("viewModel.activeBasemap")],h.prototype,"activeBasemap",void 0),s.__decorate([r.property({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],h.prototype,"label",void 0),s.__decorate([r.property(),m.messageBundle("esri/widgets/BasemapToggle/t9n/BasemapToggle")],h.prototype,"messages",void 0),s.__decorate([t.aliasOf("viewModel.nextBasemap")],h.prototype,"nextBasemap",void 0),s.__decorate([t.aliasOf("viewModel.view")],h.prototype,"view",void 0),s.__decorate([g.vmEvent("toggle"),r.property({type:d})],h.prototype,"viewModel",void 0),s.__decorate([r.property()],h.prototype,"visibleElements",void 0),s.__decorate([o.cast("visibleElements")],h.prototype,"castVisibleElements",null),s.__decorate([t.aliasOf("viewModel.toggle")],h.prototype,"toggle",null),s.__decorate([p.accessibleHandler()],h.prototype,"_toggle",null),h=s.__decorate([n.subclass("esri.widgets.BasemapToggle")],h);return h}));
