import{t,p as e,H as i,d as s,h as o}from"./p-ZGVz1_9H.js";const n=e(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.hamburgerMenuClick=s(this,"hamburgerMenuClick",7),this.handleByLiveAgent=s(this,"handleByLiveAgent",7),this.toggledChange=s(this,"toggledChange",7),this.isToggled=!1,this.messages=[],this.isLiveAgentEnabled=!1,this.hasCheckedLiveAgent=!1,this.liveAgentButtonText="Connect to Live Agent",this.boundHandleClickOutside=this.handleClickOutside.bind(this)}handleClickOutside(t){this.isToggled&&this.menuV2Ref&&!this.menuV2Ref.contains(t.target)&&(this.isToggled=!1,this.toggledChange.emit(this.isToggled))}watchToggled(t){!0===t?document.addEventListener("click",this.boundHandleClickOutside):document.removeEventListener("click",this.boundHandleClickOutside)}watchMessages(t){!this.hasCheckedLiveAgent&&t&&2===t.length&&(this.hasCheckedLiveAgent=!0)}watchLiveAgentButtonText(t){t&&""!==t.trim()||(this.liveAgentButtonText="Connect to Live Agent")}componentDidLoad(){this.isToggled&&document.addEventListener("click",this.boundHandleClickOutside)}disconnectedCallback(){document.removeEventListener("click",this.boundHandleClickOutside)}render(){var t,e;return o("div",{key:"fb76552fc3799bef70ebddc3833e99b9058f180d",id:"dropdown-menu",role:"menu",class:`flex flex-col gap-y-1 grow-wrap absolute bg-white border-b border-gray-80 border-solid rounded-lg shadow-lg p-2 mt-4 min-w-[200px] left-5 overflow-hidden ${this.isToggled?"show":""} dropdown-menu`,style:{height:"auto"},ref:t=>this.menuV2Ref=t},null===(e=null===(t=this.botSettings)||void 0===t?void 0:t.buttons)||void 0===e?void 0:e.map((t=>o("div",{class:"w-full dropdown-item"},o("button",{class:"dropdown-item-button",role:"menuitem","aria-label":t.label,onClick:()=>{this.hamburgerMenuClick.emit({button:t,type:"menu"})}},t.label)))),o("div",{key:"e9df71a3d62ac65517854d31816d08bdaff947e6",class:"w-full dropdown-item"},o("button",{key:"f043a9273787790c12e1a8a002982f16a21925b0",class:"dropdown-item-button",role:"menuitem","aria-label":"Start Over","aria-disabled":0===this.messages.length,disabled:0===this.messages.length,style:{opacity:0===this.messages.length?"0.5":"1",cursor:0===this.messages.length?"not-allowed":"pointer"},onClick:t=>{t.preventDefault(),this.hamburgerMenuClick.emit({type:"startover",event:t})}},"Start Over")),o("div",{key:"f434964275c80de42847907f60711eaef0ce0460",class:"w-full dropdown-item"},o("button",{key:"ed23384ef53f9e9b25a8215bafcfda0f51778f6c",class:"dropdown-item-button",role:"menuitem","aria-label":"View Recent Chat",onClick:()=>{this.hamburgerMenuClick.emit({type:"history"})}},"View Recent chat")),this.isLiveAgentEnabled&&this.botSettings.enableHamburgerMenu&&o("div",{key:"d0fdceeb92d6ec7b1754c5e338dddeaf6ca46081",class:"w-full dropdown-item"},o("button",{key:"21d6f48f44898a459b0224cdab3f65ed0b93124c",class:"dropdown-item-button "+(this.isLiveAgentEnabled?"opacity-100 cursor-pointer":"opacity-50 cursor-not-allowed pointer-events-none"),role:"menuitem","aria-label":this.liveAgentButtonText,style:{opacity:this.isLiveAgentEnabled?"1":"0.5",cursor:this.isLiveAgentEnabled?"pointer":"not-allowed"},onClick:t=>{t.preventDefault(),this.isLiveAgentEnabled&&this.handleByLiveAgent.emit()}},this.liveAgentButtonText)))}static get watchers(){return{isToggled:[{watchToggled:0}],messages:[{watchMessages:0}],liveAgentButtonText:[{watchLiveAgentButtonText:0}]}}},[0,"hamburger-menu",{isToggled:[1540,"is-toggled"],messages:[16],botSettings:[8,"bot-settings"],isLiveAgentEnabled:[4,"is-live-agent-enabled"],liveAgentButtonText:[1,"live-agent-button-text"],hasCheckedLiveAgent:[32]},void 0,{isToggled:[{watchToggled:0}],messages:[{watchMessages:0}],liveAgentButtonText:[{watchLiveAgentButtonText:0}]}]);function a(){"undefined"!=typeof customElements&&["hamburger-menu"].forEach((e=>{"hamburger-menu"===e&&(customElements.get(t(e))||customElements.define(t(e),n))}))}a();export{n as H,a as d}