(()=>{"use strict";const e=window.wp.element;function t(t){let{isActive:l,onToggle:n}=t;const{logoUrl:a,primaryColor:o,strings:i,links:s}=window.tiSDKFloatData;return(0,e.createElement)("div",{className:"ti-float-widget-panel",style:{"--ti-float-primary-color":o}},(0,e.createElement)("div",{className:"ti-float-widget-panel__header"},(0,e.createElement)("img",{src:a,alt:"Site Logo"}),i.panelGreet&&(0,e.createElement)("p",null,i.panelGreet),i.panelTitle&&(0,e.createElement)("h3",null,i.panelTitle)),(0,e.createElement)("div",{className:"ti-float-widget-panel__content"},s&&s.map(((t,l)=>(0,e.createElement)("a",{key:"ti-float_link_"+l,href:t.link,target:!0===(null==t?void 0:t.internal)?"_self":"_blank"},(0,e.createElement)("span",{className:"dashicons "+t.icon}),t.title))),(0,e.createElement)("a",{href:"#ti-toggle-widget-float",className:"screen-reader-shortcut"},i.closeToggle?i.closeToggle:"Close")))}const l=window.wp.components;function n(n){let{isActive:a,onToggle:o,onClose:i}=n;const{logoUrl:s,strings:c}=window.tiSDKFloatData,r=c.toggleButton,m=a?"":"active",d=a?"active":"";return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("button",{id:"ti-toggle-widget-float",tabIndex:"0",className:"ti-float-button",onClick:o,"aria-label":"","aria-pressed":a,"aria-disabled":!1,title:r},(0,e.createElement)("img",{className:"ti-float-logo "+m,src:s}),(0,e.createElement)("span",{className:"dashicons dashicons-no-alt ti-float-close-icon "+d}),(0,e.createElement)("span",{className:"screen-reader-text"},r),a&&(0,e.createElement)(l.Popover,{variant:"unstyled",placement:"top-end",onFocusOutside:()=>{console.log("Focus Outside"),i()}},(0,e.createElement)(t,null))))}function a(){const[t,l]=(0,e.useState)(!1);return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n,{isActive:t,onToggle:()=>{l(!t)},onClose:()=>{l(!1)}}))}document.addEventListener("DOMContentLoaded",(()=>{const t=document.querySelector("#ti-sdk-float-widget");t&&(0,e.render)((0,e.createElement)(a,null),t)}))})();