/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as e}from"tslib";import{isSome as t}from"../../core/arrayUtils.js";import{property as o,subclass as i}from"../../core/accessorSupport/decorators.js";import s from"../../views/interactive/sketch/SketchOptions.js";import{directionModeIcons as l}from"../../views/interactive/tooltip/components/directionModeIcons.js";import n from"../Widget.js";import{loadCalciteComponents as r}from"./componentsUtils.js";import{globalCss as c}from"./globalCss.js";import{loadLabeledSwitchComponents as a,LabeledSwitch as d}from"./LabeledSwitch.js";import{messageBundle as p,tsx as b}from"./widget.js";import h from"./SketchTooltipControls/VisibleElements.js";const m="esri-sketch-tooltip-controls",u={base:m,block:`${m}__block`,blockContent:`${m}__block-content`,radioButtonLabelWrapper:`${m}__radio-button-label-wrapper`};let g=class extends n{constructor(e,t){super(e,t),this.viewModel=null,this.visibleElements=new h,this.sketchOptions=new s,this._onTooltipsEnabledChange=e=>{this.sketchOptions.tooltips.enabled=e},this._onLabelsEnabledChange=e=>{this.sketchOptions.labels.enabled=e},this._onDirectionModeChange=e=>{this.sketchOptions.values.directionMode=e.currentTarget.selectedItem.value}}loadDependencies(){return Promise.all([r({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")}),a()])}render(){const{label:e,visibleElements:t}=this,o=this._renderContent();return b("div",{"aria-label":e,class:this.classes(u.base,c.widget)},o?b("calcite-block",{class:u.block,expanded:!0,heading:t.header?this.label:"",key:"content-block",label:this.label},b("div",{class:u.blockContent,key:"content"},o)):void 0)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}_renderContent(){const{visibleElements:e}=this,o=[e.tooltipsToggle?this._renderTooltipsToggle():null,e.labelsToggle?this._renderLabelsToggle():null,e.directionModePicker?this._renderDirectionModePicker():null].filter(t);return 0===o.length?null:o}_renderTooltipsToggle(){const{messages:e,sketchOptions:t}=this;return b(d,{checked:t.tooltips.effectiveEnabled,hint:e.tooltipsToggleHint,key:`${this.id}__tooltips`,label:e.tooltipsToggle,onChange:this._onTooltipsEnabledChange})}_renderLabelsToggle(){const{messages:e,sketchOptions:t}=this;return b(d,{checked:t.labels.enabled,hint:e.labelsToggleHint,key:`${this.id}__labels`,label:e.labelsToggle,onChange:this._onLabelsEnabledChange})}_renderDirectionModePicker(){const{messages:e,sketchOptions:t}=this,{directionMode:o}=t.values;return b("calcite-label",{key:"direction-mode",layout:"default",scale:"s"},e.directionModePicker,b("calcite-radio-button-group",{key:"radio-button-group",layout:"horizontal",name:this.id,scale:"s",value:o,onCalciteRadioButtonGroupChange:this._onDirectionModeChange},this._renderDirectionModeOption("relative",o,e.directionModeRelative),this._renderDirectionModeOption("absolute",o,e.directionModeAbsolute)))}_renderDirectionModeOption(e,t,o){return b("calcite-label",{key:e,layout:"inline",scale:"s"},b("calcite-radio-button",{checked:e===t,scale:"s",value:e}),b("div",{class:u.radioButtonLabelWrapper,key:"label-wrapper"},b("calcite-icon",{icon:l[e],scale:"s"}),o))}};e([o()],g.prototype,"label",null),e([o({type:h,nonNullable:!0})],g.prototype,"visibleElements",void 0),e([o(),p("esri/widgets/support/SketchTooltipControls/t9n/SketchTooltipControls")],g.prototype,"messages",void 0),e([o({nonNullable:!0,type:s})],g.prototype,"sketchOptions",void 0),g=e([i("esri.widgets.support.SketchTooltipControls")],g);const k=g;export{k as default};
