!function(){var t={151(t){var e={utf8:{stringToBytes:function(t){return e.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(e.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],n=0;n<t.length;n++)e.push(255&t.charCodeAt(n));return e},bytesToString:function(t){for(var e=[],n=0;n<t.length;n++)e.push(String.fromCharCode(t[n]));return e.join("")}}};t.exports=e},939(t){var e,n;e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(t,e){return t<<e|t>>>32-e},rotr:function(t,e){return t<<32-e|t>>>e},endian:function(t){if(t.constructor==Number)return 16711935&n.rotl(t,8)|4278255360&n.rotl(t,24);for(var e=0;e<t.length;e++)t[e]=n.endian(t[e]);return t},randomBytes:function(t){for(var e=[];t>0;t--)e.push(Math.floor(256*Math.random()));return e},bytesToWords:function(t){for(var e=[],n=0,r=0;n<t.length;n++,r+=8)e[r>>>5]|=t[n]<<24-r%32;return e},wordsToBytes:function(t){for(var e=[],n=0;n<32*t.length;n+=8)e.push(t[n>>>5]>>>24-n%32&255);return e},bytesToHex:function(t){for(var e=[],n=0;n<t.length;n++)e.push((t[n]>>>4).toString(16)),e.push((15&t[n]).toString(16));return e.join("")},hexToBytes:function(t){for(var e=[],n=0;n<t.length;n+=2)e.push(parseInt(t.substr(n,2),16));return e},bytesToBase64:function(t){for(var n=[],r=0;r<t.length;r+=3)for(var o=t[r]<<16|t[r+1]<<8|t[r+2],i=0;i<4;i++)8*r+6*i<=8*t.length?n.push(e.charAt(o>>>6*(3-i)&63)):n.push("=");return n.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],r=0,o=0;r<t.length;o=++r%4)0!=o&&n.push((e.indexOf(t.charAt(r-1))&Math.pow(2,-2*o+8)-1)<<2*o|e.indexOf(t.charAt(r))>>>6-2*o);return n}},t.exports=n},206(t){function e(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}
/*!
 * Determine if an object is a Buffer
 *
 * @author   Feross Aboukhadijeh <https://feross.org>
 * @license  MIT
 */
t.exports=function(t){return null!=t&&(e(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&e(t.slice(0,0))}(t)||!!t._isBuffer)}},503(t,e,n){var r,o,i,a,u;r=n(939),o=n(151).utf8,i=n(206),a=n(151).bin,(u=function(t,e){t.constructor==String?t=e&&"binary"===e.encoding?a.stringToBytes(t):o.stringToBytes(t):i(t)?t=Array.prototype.slice.call(t,0):Array.isArray(t)||t.constructor===Uint8Array||(t=t.toString());for(var n=r.bytesToWords(t),c=8*t.length,s=1732584193,l=-271733879,f=-1732584194,m=271733878,d=0;d<n.length;d++)n[d]=16711935&(n[d]<<8|n[d]>>>24)|4278255360&(n[d]<<24|n[d]>>>8);n[c>>>5]|=128<<c%32,n[14+(c+64>>>9<<4)]=c;var p=u._ff,g=u._gg,y=u._hh,h=u._ii;for(d=0;d<n.length;d+=16){var v=s,b=l,_=f,T=m;s=p(s,l,f,m,n[d+0],7,-680876936),m=p(m,s,l,f,n[d+1],12,-389564586),f=p(f,m,s,l,n[d+2],17,606105819),l=p(l,f,m,s,n[d+3],22,-1044525330),s=p(s,l,f,m,n[d+4],7,-176418897),m=p(m,s,l,f,n[d+5],12,1200080426),f=p(f,m,s,l,n[d+6],17,-1473231341),l=p(l,f,m,s,n[d+7],22,-45705983),s=p(s,l,f,m,n[d+8],7,1770035416),m=p(m,s,l,f,n[d+9],12,-1958414417),f=p(f,m,s,l,n[d+10],17,-42063),l=p(l,f,m,s,n[d+11],22,-1990404162),s=p(s,l,f,m,n[d+12],7,1804603682),m=p(m,s,l,f,n[d+13],12,-40341101),f=p(f,m,s,l,n[d+14],17,-1502002290),s=g(s,l=p(l,f,m,s,n[d+15],22,1236535329),f,m,n[d+1],5,-165796510),m=g(m,s,l,f,n[d+6],9,-1069501632),f=g(f,m,s,l,n[d+11],14,643717713),l=g(l,f,m,s,n[d+0],20,-373897302),s=g(s,l,f,m,n[d+5],5,-701558691),m=g(m,s,l,f,n[d+10],9,38016083),f=g(f,m,s,l,n[d+15],14,-660478335),l=g(l,f,m,s,n[d+4],20,-405537848),s=g(s,l,f,m,n[d+9],5,568446438),m=g(m,s,l,f,n[d+14],9,-1019803690),f=g(f,m,s,l,n[d+3],14,-187363961),l=g(l,f,m,s,n[d+8],20,1163531501),s=g(s,l,f,m,n[d+13],5,-1444681467),m=g(m,s,l,f,n[d+2],9,-51403784),f=g(f,m,s,l,n[d+7],14,1735328473),s=y(s,l=g(l,f,m,s,n[d+12],20,-1926607734),f,m,n[d+5],4,-378558),m=y(m,s,l,f,n[d+8],11,-2022574463),f=y(f,m,s,l,n[d+11],16,1839030562),l=y(l,f,m,s,n[d+14],23,-35309556),s=y(s,l,f,m,n[d+1],4,-1530992060),m=y(m,s,l,f,n[d+4],11,1272893353),f=y(f,m,s,l,n[d+7],16,-155497632),l=y(l,f,m,s,n[d+10],23,-1094730640),s=y(s,l,f,m,n[d+13],4,681279174),m=y(m,s,l,f,n[d+0],11,-358537222),f=y(f,m,s,l,n[d+3],16,-722521979),l=y(l,f,m,s,n[d+6],23,76029189),s=y(s,l,f,m,n[d+9],4,-640364487),m=y(m,s,l,f,n[d+12],11,-421815835),f=y(f,m,s,l,n[d+15],16,530742520),s=h(s,l=y(l,f,m,s,n[d+2],23,-995338651),f,m,n[d+0],6,-198630844),m=h(m,s,l,f,n[d+7],10,1126891415),f=h(f,m,s,l,n[d+14],15,-1416354905),l=h(l,f,m,s,n[d+5],21,-57434055),s=h(s,l,f,m,n[d+12],6,1700485571),m=h(m,s,l,f,n[d+3],10,-1894986606),f=h(f,m,s,l,n[d+10],15,-1051523),l=h(l,f,m,s,n[d+1],21,-2054922799),s=h(s,l,f,m,n[d+8],6,1873313359),m=h(m,s,l,f,n[d+15],10,-30611744),f=h(f,m,s,l,n[d+6],15,-1560198380),l=h(l,f,m,s,n[d+13],21,1309151649),s=h(s,l,f,m,n[d+4],6,-145523070),m=h(m,s,l,f,n[d+11],10,-1120210379),f=h(f,m,s,l,n[d+2],15,718787259),l=h(l,f,m,s,n[d+9],21,-343485551),s=s+v>>>0,l=l+b>>>0,f=f+_>>>0,m=m+T>>>0}return r.endian([s,l,f,m])})._ff=function(t,e,n,r,o,i,a){var u=t+(e&n|~e&r)+(o>>>0)+a;return(u<<i|u>>>32-i)+e},u._gg=function(t,e,n,r,o,i,a){var u=t+(e&r|n&~r)+(o>>>0)+a;return(u<<i|u>>>32-i)+e},u._hh=function(t,e,n,r,o,i,a){var u=t+(e^n^r)+(o>>>0)+a;return(u<<i|u>>>32-i)+e},u._ii=function(t,e,n,r,o,i,a){var u=t+(n^(e|~r))+(o>>>0)+a;return(u<<i|u>>>32-i)+e},u._blocksize=16,u._digestsize=16,t.exports=function(t,e){if(null==t)throw new Error("Illegal argument "+t);var n=r.wordsToBytes(u(t,e));return e&&e.asBytes?n:e&&e.asString?a.bytesToString(n):r.bytesToHex(n)}},942(t,e){var n;
/*!
	Copyright (c) 2018 Jed Watson.
	Licensed under the MIT License (MIT), see
	http://jedwatson.github.io/classnames
*/!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var t="",e=0;e<arguments.length;e++){var n=arguments[e];n&&(t=a(t,i(n)))}return t}function i(t){if("string"==typeof t||"number"==typeof t)return t;if("object"!=typeof t)return"";if(Array.isArray(t))return o.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var e="";for(var n in t)r.call(t,n)&&t[n]&&(e=a(e,n));return e}function a(t,e){return e?t?t+" "+e:t+e:t}t.exports?(o.default=o,t.exports=o):void 0===(n=function(){return o}.apply(e,[]))||(t.exports=n)}()}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,n),i.exports}n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},function(){"use strict";var t=window.wp.i18n,e=window.wp.element,r=window.blocksyOptions,o=window.jQuery,i=n.n(o),a=window.ctEvents,u=n.n(a),c=n(942),s=n.n(c),l=n(503),f=n.n(l);function m(t){if(Array.isArray(t))return`[${t.map(function(t){return m(t)}).join(",")}]`;if("object"==typeof t&&null!==t){let e="";const n=Object.keys(t).sort();e+=`{${JSON.stringify(n)}`;for(let r=0;r<n.length;r++)e+=`${m(t[n[r]])},`;return`${e}}`}return`${JSON.stringify(t)}`}const d=function(t){return f()(m(t))},p={};var g=function(){const[n,o]=(0,e.useState)({itemTitle:"Name",itemId:null,depth:0,data:null,parentData:null}),[i,a]=(0,e.useState)(null),[c,l]=(0,e.useState)(!1),f=(0,e.useMemo)(function(){return i||n.data},[i,n.data]),m=(0,e.useMemo)(function(){return!(!n.itemId||!f)},[n.itemId,f]),g=(0,e.useRef)();(0,e.useEffect)(function(){u().on("blocksy:mega-menu:edit-item-settings",function({itemId:t,depth:e,itemTitle:n}){t&&async function(t,e,n){a(null);let r="";if(e>=1){const e=document.querySelector(`#menu-item-${t}`),n=jQuery(e).prevAll(".menu-item-depth-0")[0];n&&(r=n.id.replace("menu-item-",""))}const i=d({itemId:t,depth:e}),u=d({itemId:r,depth:0});if(p[i])return void o(function(o){return{...o,itemTitle:n,itemId:t,depth:e,data:p[i],...r&&p[u]?{parentData:p[u]}:{}}});o(function(r){return{...r,itemTitle:n,itemId:t,depth:e,data:null,parentData:null}});const c=new FormData;c.append("action","blocksy_ext_mega_menu_get_nav_item_settings"),c.append("item_id",t),r&&c.append("parent_item_id",r);const s=await fetch(wp.ajax.settings.url,{method:"POST",body:c});if(200===s.status){const a=await s.json();a.success&&(a.data.additional_items&&Object.keys(a.data.additional_items).map(function(t){p[d({itemId:t.toString(),depth:0})]=a.data.additional_items[t]}),p[i]=a.data.settings,o(function(o){return{...o,itemTitle:n,itemId:t,depth:e,data:p[i],...r&&p[u]?{parentData:p[u]}:{}}}))}}(t,e,n)})},[]);const y=function(){o(function(t){return{...t,itemId:null}})};return(0,e.createElement)("div",null,(0,e.createElement)(r.Overlay,{items:m,className:"ct-admin-modal ct-mega-menu-modal",initialFocusRef:g,onDismiss:function(){i||y()},onCloseButtonClick:function(){y()},render:function(){return(0,e.createElement)("div",{className:"ct-modal-content",ref:g},(0,e.createElement)("h2",null,n.itemTitle," -"," ",(0,t.__)("Item Settings","blocksy-companion")),null,(0,e.createElement)("div",{className:"ct-options-container ct-tabs-scroll"},(0,e.createElement)(r.OptionsPanel,{onChange:function(t,e){a(function(n){return{...n||f,[t]:e}})},options:blocksy_ext_mega_menu_localization.mega_menu_options,value:{...Array.isArray(f)||!f?{}:f,...n.parentData?{parentData:n.parentData}:{},menu_item_level:n.depth+1},hasRevertButton:!1})),(0,e.createElement)("div",{className:"ct-modal-actions has-divider"},(0,e.createElement)("button",{className:s()("ct-ui-button ct-ui-button-primary"),disabled:c||!i,onClick:function(){!async function(t,e,n){p[d({itemId:t,depth:n})]=e,l(!0),fetch(`${wp.ajax.settings.url}?action=blocksy_ext_mega_menu_update_nav_item_setting&item_id=${t}`,{headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST",body:JSON.stringify(e)}).then(function(){setTimeout(function(){l(!1)},500)})}(n.itemId,f,n.depth),o(function(t){return{...t,data:f}}),a(null)}},c?(0,e.createElement)("svg",{width:"15",height:"15",viewBox:"0 0 100 100"},(0,e.createElement)("g",{transform:"translate(50,50)"},(0,e.createElement)("g",{transform:"scale(1)"},(0,e.createElement)("circle",{cx:"0",cy:"0",r:"50",fill:"#687c93"}),(0,e.createElement)("circle",{cx:"0",cy:"-26",r:"12",fill:"#ffffff",transform:"rotate(161.634)"},(0,e.createElement)("animateTransform",{attributeName:"transform",type:"rotate",calcMode:"linear",values:"0 0 0;360 0 0",keyTimes:"0;1",dur:"1s",begin:"0s",repeatCount:"indefinite"}))))):(0,t.__)("Save Settings","blocksy-companion"))))}}))};(0,r.onDocumentLoaded)(function(){const t=document.createElement("div");document.body.appendChild(t);(0,e.createRoot)(t).render((0,e.createElement)(g,null))}),i()(document).on("click.ctMegaMenu",".blocksy-mega-menu-trigger",function(t){t.preventDefault();const e=t.target.closest(".blocksy-mega-menu-trigger");u().trigger("blocksy:mega-menu:edit-item-settings",{el:e,depth:parseFloat([...t.target.closest(".menu-item").classList].find(function(t){return t.indexOf("menu-item-depth")>-1}).replace("menu-item-depth-","")),itemTitle:t.target.closest(".menu-item").querySelector(".edit-menu-item-title").value,itemId:e.dataset.itemId})})}()}();