/home/devfahim/www/fluentlab.devfahim.site/wp-content/plugins/thim-elementor-kit/build/menu.js
(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,n=window.wp.i18n,a=window.wp.url,l=window.wp.mediaUtils,i=window.wp.components,o=window.wp.primitives,m=(0,t.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,t.createElement)(o.Path,{d:"M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"})),c=(0,t.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,t.createElement)(o.Path,{d:"M4 15h11V9H4v6zM18.5 4v16H20V4h-1.5z"})),r=(0,t.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,t.createElement)(o.Path,{d:"M9 15h6V9H9v6zm-5 5h1.5V4H4v16zM18.5 4v16H20V4h-1.5z"})),s=(0,t.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,t.createElement)(o.Path,{d:"M9 9v6h11V9H9zM4 20h1.5V4H4v16z"})),u=window.wp.apiFetch;var _=e.n(u);const h=(0,t.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,t.createElement)(o.Path,{d:"M5 5v1.5h14V5H5zm0 7.8h14v-1.5H5v1.5zM5 19h14v-1.5H5V19z"})),d=(0,t.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,t.createElement)(o.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"})),g="undefined"!=typeof thimEKitMenu?thimEKitMenu.fontAwesome.regular:[],E="undefined"!=typeof thimEKitMenu?thimEKitMenu.fontAwesome.solid:[],k="undefined"!=typeof thimEKitMenu?thimEKitMenu.fontAwesome.brands:[];function p({onChange:e,setOpen:a}){const[l,o]=(0,t.useState)(null),[m,c]=(0,t.useState)(null),[r,s]=(0,t.useState)(null),[u,_]=(0,t.useState)(""),[h,d]=(0,t.useState)(!0);return(0,t.useEffect)((()=>{u&&d(!0),o(g?g.icons.map((n=>!u||n.toLowerCase().includes(u.toLowerCase())?(0,t.createElement)("span",{className:"thim-ekits-menu__icon-component__icon",key:n,onClick:()=>{e(`far fa-${n}`),a(!1)}},(0,t.createElement)("i",{className:`far fa-${n}`})):null)):[]),c(E?E.icons.map((n=>!u||n.toLowerCase().includes(u.toLowerCase())?(0,t.createElement)("span",{className:"thim-ekits-menu__icon-component__icon",key:n,onClick:()=>{e(`fas fa-${n}`),a(!1)}},(0,t.createElement)("i",{className:`fas fa-${n}`})):null)):[]),s(k?k.icons.map((n=>!u||n.toLowerCase().includes(u.toLowerCase())?(0,t.createElement)("span",{className:"thim-ekits-menu__icon-component__icon",key:n,onClick:()=>{e(`fab fa-${n}`),a(!1)}},(0,t.createElement)("i",{className:`fab fa-${n}`})):null)):[]),d(!1)}),[u]),(0,t.createElement)(t.Fragment,null,h?(0,t.createElement)(i.Spinner,null):(0,t.createElement)(t.Fragment,null,(0,t.createElement)(i.TextControl,{value:u,placeholder:(0,n.__)("Search for FontAwesome…","thim-elementor-kit"),onChange:e=>_(e),style:{fontWeight:400}}),(0,t.createElement)("div",{className:"thim-ekits-menu__icon-component__icons"},l,m,r)))}function v({font:e,setFont:a}){const[l,o]=(0,t.useState)(!1);return(0,t.createElement)("div",{className:"thim-ekits-menu__icon-component"},(0,t.createElement)("span",{className:"thim-ekits-menu__icon-component__label"},(0,n.__)("Select Icons","thim-elementor-kit")),(0,t.createElement)("div",null,(0,t.createElement)("div",null,(0,t.createElement)("div",{className:"thim-ekits-menu__icon-component__select"},(0,t.createElement)(i.TextControl,{value:e,onChange:e=>a(e)}),(0,t.createElement)(i.Button,{className:"thim-ekits-menu__icon-component__button",isSecondary:!0,variant:"secondary",icon:l?d:h,onClick:()=>o(!l),"aria-expanded":l,label:"Select Icon"},l?(0,n.__)("CLOSE","thim-elementor-kit"):(0,n.__)("SELECT","thim-elementor-kit"))),l&&(0,t.createElement)("div",{className:"thim-ekits-menu__icon-component__list"},(0,t.createElement)(p,{onChange:a,setOpen:o})))))}function w({label:e,color:n,onChange:a}){const l=(0,t.useRef)(null),[o,m]=(0,t.useState)(!1);return(0,t.useEffect)((()=>{function e(e){l.current&&!l.current.contains(e.target)&&m(!1)}return document.addEventListener("click",e),()=>document.removeEventListener("click",e)}),[l]),(0,t.createElement)("div",{className:"thim-ekits-menu__icon-color",ref:l},(0,t.createElement)("div",{className:"thim-ekits-menu__icon__header"},(0,t.createElement)("span",{className:"thim-ekits-menu__icon-color__label"},e||""),(0,t.createElement)("div",{className:"thim-ekits-menu__icon-color__inner"},(0,t.createElement)("button",{className:"thim-ekits-menu__icon-color__indicator",style:{backgroundColor:n},onClick:()=>m(!o)}),(0,t.createElement)(i.TextControl,{value:n,onChange:e=>a(e),style:{height:30,width:160}}))),o&&(0,t.createElement)("div",{className:"thim-ekits-menu__icon-color__picker",style:{maxWidth:300}},(0,t.createElement)(i.ColorPicker,{color:n,onChangeComplete:e=>{let t;if(void 0===e.rgb||1===e.rgb.a)t=e.hex;else{const{r:n,g:a,b:l,a:i}=e.rgb;t=`rgba(${n}, ${a}, ${l}, ${i})`}a(t)},disableAlpha:!0})))}function C({open:e,setOpen:a,openIframe:l,menuItemID:o}){const[m,c]=(0,t.useState)({}),[r,s]=(0,t.useState)(!1);return(0,t.useEffect)((()=>{s(!0);try{async function e(){const e=await _()({method:"POST",path:"thim-ekits-megamenu/create-megamenu",data:{menu_item_id:o||""}});"success"===e?.status&&c(e.data),s(!1)}l&&e()}catch(t){s(!1)}}),[l]),(0,t.createElement)(i.Modal,{className:"thim-ekits-menu__modal__iframe",focusOnMount:!0,shouldCloseOnEsc:!0,shouldCloseOnClickOutside:!1,onRequestClose:()=>a(!1),title:(0,n.__)("Thim Elementor Editor","thim-elementor-kit")},r?(0,t.createElement)(i.Spinner,null):(0,t.createElement)(t.Fragment,null,m?.url?(0,t.createElement)("div",{className:"thim-ekits-menu__modal__iframe__inner"},(0,t.createElement)("iframe",{src:m.url,title:(0,n.__)("Thim Elementor Editor","thim-elementor-kit"),width:"100%",height:"100%"})):(0,t.createElement)("p",null,(0,n.__)("Can't view Editor","thim-elementor-kit"))))}const S={id:null,name:null,url:null},f={status:"",message:""},b=window.thimEKitMenu.menuContainer;function y({setOpen:e,menuItemID:o}){const[u,h]=(0,t.useState)(!1),[d,g]=(0,t.useState)(!1),[E,k]=(0,t.useState)(!1),[p,y]=(0,t.useState)(f),[M,N]=(0,t.useState)(!1),[T,B]=(0,t.useState)(!1),[x,I]=(0,t.useState)("icon"),[z,P]=(0,t.useState)(""),[O,V]=(0,t.useState)(S),[H,F]=(0,t.useState)(""),[D,G]=(0,t.useState)(""),[L,A]=(0,t.useState)(""),[$,K]=(0,t.useState)(""),[R,U]=(0,t.useState)(!1),[W,j]=(0,t.useState)(""),[q,Q]=(0,t.useState)(""),[J,X]=(0,t.useState)(""),[Y,Z]=(0,t.useState)(""),[ee,te]=(0,t.useState)(""),[ne,ae]=(0,t.useState)("screen"),[le,ie]=(0,t.useState)("right");return(0,t.useEffect)((()=>{g(!0);try{async function e(){const e=await _()({method:"GET",path:(0,a.addQueryArgs)("thim-ekits-megamenu/get",{menu_item_id:o||"",nocache:Date.now()})});"success"===e.status&&e.data&&(N(e.data.enableMegaMenu),B(e.data.enableIcon),I(e.data.iconType),P(e.data.icon),V(e.data.iconUpload),F(e.data.iconColor),G(e.data.iconSize),U(e.data.enableBadge),j(e.data.badgeText),Q(e.data.badgeColor),X(e.data.badgeBgColor),Z(e.data.badgeSize),A(e.data.iconWidth),K(e.data.iconHeight),te(e.data.widthMenu),ie(e.data.menuPosition),ae(e.data.menuType)),g(!1)}e()}catch(t){console.log(t),g(!1)}}),[]),(0,t.createElement)(t.Fragment,null,(0,t.createElement)(i.Modal,{className:"thim-ekits-menu__modal",focusOnMount:!0,shouldCloseOnEsc:!0,shouldCloseOnClickOutside:!1,title:(0,n.__)("Thim Mega Menu Settings","thim-elementor-kit"),onRequestClose:t=>{t&&t.target&&!t.target.classList.contains("thim-ekits-menu__modal__content__edit_ele_button")&&e(!1)}},(0,t.createElement)(i.TabPanel,{tabs:[{name:"general",title:(0,n.__)("General","thim-elementor-kit")},{name:"icon",title:(0,n.__)("Icon","thim-elementor-kit")},{name:"badge",title:(0,n.__)("Badge","thim-elementor-kit")},{name:"settings",title:(0,n.__)("Settings","thim-elementor-kit")}]},(e=>d?(0,t.createElement)("div",{className:"thim-ekits-menu__modal__content"},(0,t.createElement)(i.Spinner,null)):"general"===e.name?(0,t.createElement)("div",{className:"thim-ekits-menu__modal__content"},(0,t.createElement)(i.ToggleControl,{label:(0,n.__)("Enable Mega Menu","thim-elementor-kit"),checked:M,onChange:()=>N(!M)}),M&&(0,t.createElement)(i.Button,{isPrimary:!0,variant:"primary",icon:m,iconSize:20,onClick:()=>h(!u),className:"thim-ekits-menu__modal__content__edit_ele_button"},(0,n.__)("Edit with Elementor","thim-elementor-kit"))):"icon"===e.name?(0,t.createElement)("div",{className:"thim-ekits-menu__modal__content"},(0,t.createElement)(i.ToggleControl,{label:(0,n.__)("Enable Menu Icon","thim-elementor-kit"),checked:T,onChange:()=>B(!T)}),T&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)(i.SelectControl,{label:(0,n.__)("Icon type","thim-elementor-kit"),value:x,options:[{label:(0,n.__)("Icons","thim-elementor-kit"),value:"icon"},{label:(0,n.__)("Upload","thim-elementor-kit"),value:"upload"}],onChange:e=>I(e)}),"icon"===x&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)(v,{font:z,setFont:P}),(0,t.createElement)(w,{label:(0,n.__)("Icon color","thim-elementor-kit"),color:H,onChange:F}),(0,t.createElement)(i.TextControl,{label:(0,n.__)("Icon size","thim-elementor-kit"),placeholder:(0,n.__)("Enter the font size…","thim-elementor-kit"),value:D,onChange:e=>G(e)})),"upload"===x&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)("div",{className:"thim-ekits-menu__icon-upload "+(O.name?"thim-ekits-menu__icon-upload--has":"")},O.name&&(0,t.createElement)("div",{className:"thim-ekits-menu__icon-upload__name"},(0,t.createElement)("img",{src:O.url,alt:""}),(0,t.createElement)("div",null,O.name)),(0,t.createElement)(l.MediaUpload,{onSelect:e=>{V({id:e.id,name:e.filename,url:e.url})},allowedTypes:["image"],value:O.url,render:({open:e})=>(0,t.createElement)(i.ButtonGroup,null,(0,t.createElement)(i.Button,{onClick:e,variant:"primary",isPrimary:!0,style:{height:31,marginRight:10}},O?.url?(0,n.__)("Replace","thim-elementor-kit"):(0,n.__)("Upload","thim-elementor-kit")),O.name&&(0,t.createElement)(i.Button,{onClick:()=>V(S),variant:"secondary",isSecondary:!0,style:{height:31}},(0,n.__)("Remove","thim-elementor-kit")))})),(0,t.createElement)(i.TextControl,{label:(0,n.__)("Icon width","thim-elementor-kit"),value:L,onChange:e=>A(e)}),(0,t.createElement)(i.TextControl,{label:(0,n.__)("Icon height","thim-elementor-kit"),value:$,onChange:e=>K(e)})))):"badge"===e.name?(0,t.createElement)("div",{className:"thim-ekits-menu__modal__content"},(0,t.createElement)(i.ToggleControl,{label:(0,n.__)("Enable Menu Badge","thim-elementor-kit"),checked:R,onChange:()=>U(!R)}),R&&(0,t.createElement)(t.Fragment,null,(0,t.createElement)(i.TextControl,{label:(0,n.__)("Badge text","thim-elementor-kit"),value:W,onChange:e=>j(e)}),(0,t.createElement)(w,{label:(0,n.__)("Badge color","thim-elementor-kit"),color:q,onChange:Q}),(0,t.createElement)(w,{label:(0,n.__)("Badge background color","thim-elementor-kit"),color:J,onChange:X}),(0,t.createElement)(i.TextControl,{label:(0,n.__)("Badge size","thim-elementor-kit"),placeholder:(0,n.__)("Enter the font size…","thim-elementor-kit"),value:Y,onChange:e=>Z(e)}))):"settings"===e.name?(0,t.createElement)("div",{className:"thim-ekits-menu__modal__content"},(0,t.createElement)(i.TextControl,{label:(0,n.__)("Mega menu content width","thim-elementor-kit"),help:(0,n.__)("Set the width of the mega menu content. Example: 1140px, 100vw…","thim-elementor-kit"),value:ee,onChange:e=>te(e)}),b&&(0,t.createElement)(i.SelectControl,{label:(0,n.__)("Mega menu align type","thim-elementor-kit"),value:ne,options:[{label:(0,n.__)("Align with Screen","thim-elementor-kit"),value:"screen"},{label:(0,n.__)("Align with Container","thim-elementor-kit"),value:"container"}],onChange:e=>ae(e)}),(0,t.createElement)("p",{style:{marginBottom:8}},(0,n.__)("Mega menu position","thim-elementor-kit")),(0,t.createElement)(i.ButtonGroup,null,(0,t.createElement)(i.Button,{isPrimary:"left"===le,onClick:()=>ie("left"),icon:c}),(0,t.createElement)(i.Button,{isPrimary:"center"===le,onClick:()=>ie("center"),icon:r}),(0,t.createElement)(i.Button,{icon:s,isPrimary:"right"===le,onClick:()=>ie("right")}))):void 0)),(0,t.createElement)("div",{className:"thim-ekits-menu__modal__footer"},(0,t.createElement)(i.Button,{isPrimary:!0,variant:"primary",icon:E?(0,t.createElement)(i.Spinner,null):"",iconSize:20,onClick:async function(){k(!0);try{const e=await _()({method:"POST",path:"thim-ekits-megamenu/save",data:{menu_item_id:o,options:{enableMegaMenu:M,enableIcon:T,iconType:x,icon:z,iconUpload:O,iconColor:H,iconSize:D,iconWidth:L,iconHeight:$,enableBadge:R,badgeText:W,badgeColor:q,badgeBgColor:J,badgeSize:Y,widthMenu:ee,menuPosition:le,menuType:ne}}});y({...p,...e}),k(!1)}catch(e){y({...p,status:"error",message:e.message||(0,n.__)("Error when saving","thim-elementor-kit")}),k(!1)}const e=setTimeout((()=>{y(f)}),1500);return()=>clearTimeout(e)},style:{marginRight:10}},(0,n.__)("Save","thim-elementor-kit")),(0,t.createElement)(i.Button,{isSecondary:!0,variant:"secondary",iconSize:20,onClick:()=>e(!1)},(0,n.__)("Close","thim-elementor-kit")),p.status&&p.message&&(0,t.createElement)("div",{className:"thim-ekits-menu__modal__notice"},(0,t.createElement)(i.Notice,{status:p.status,isDismissible:!1},p.message)))),u&&(0,t.createElement)(C,{setOpen:h,menuItemID:o,openIframe:u}))}function M({menuItemID:e}){const[a,l]=(0,t.useState)(!1);return(0,t.createElement)(t.Fragment,null,(0,t.createElement)("a",{href:"#",className:"thim-ekits-menu__item button button-primary",onClick:e=>{e.preventDefault(),l(!a)}},(0,n.__)("Thim Mega Menu","thim-elementor-kit")),a&&(0,t.createElement)(y,{setOpen:l,menuItemID:e}))}document.querySelectorAll(".thim-ekits-menu").forEach((e=>{const n=e.dataset.id||"";wp.element.render((0,t.createElement)(M,{menuItemID:n}),e)})),wp.element.render((0,t.createElement)((function(){const[e,l]=(0,t.useState)(""),[o,m]=(0,t.useState)(!1),[c,r]=(0,t.useState)(!1),[s,u]=(0,t.useState)({status:"",message:""});return(0,t.useEffect)((()=>{const e=document.getElementById("nav-menu-meta-object-id");e&&l(e.value)}),[]),(0,t.useEffect)((()=>{e&&async function(){const t=await _()({method:"GET",path:(0,a.addQueryArgs)("thim-ekits-megamenu/get-settings",{menuID:e})});"success"===t.status&&m(t?.data?.enable)}()}),[e]),(0,t.createElement)("div",{className:"thim-ekits-menu__settings"},(0,t.createElement)(i.CheckboxControl,{label:(0,n.__)("Enable Mega Menu","thim-elementor-kit"),checked:o,onChange:()=>m(!o)}),(0,t.createElement)(i.Button,{isPrimary:!0,variant:"primary",icon:c?(0,t.createElement)(i.Spinner,null):"",onClick:async function(){r(!0);try{const t=await _()({method:"POST",path:"thim-ekits-megamenu/save-settings",data:{menuID:e,enableMegaMenu:o}});r(!1),u({status:"success",message:t.message||""})}catch(e){r(!1),u({status:"error",message:e.message||"Error"})}}},(0,n.__)("Save","thim-elementor-kit")),s.status&&(0,t.createElement)(i.Notice,{status:s.status,isDismissible:!1},s.message))}),null),document.getElementById("thim-ekits-menu__settings"))})();