!function(){var t={151:function(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},206:function(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:function(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,y=u._gg,g=u._hh,b=u._ii;for(d=0;d<n.length;d+=16){var h=s,v=l,_=f,S=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=y(s,l=p(l,f,m,s,n[d+15],22,1236535329),f,m,n[d+1],5,-165796510),m=y(m,s,l,f,n[d+6],9,-1069501632),f=y(f,m,s,l,n[d+11],14,643717713),l=y(l,f,m,s,n[d+0],20,-373897302),s=y(s,l,f,m,n[d+5],5,-701558691),m=y(m,s,l,f,n[d+10],9,38016083),f=y(f,m,s,l,n[d+15],14,-660478335),l=y(l,f,m,s,n[d+4],20,-405537848),s=y(s,l,f,m,n[d+9],5,568446438),m=y(m,s,l,f,n[d+14],9,-1019803690),f=y(f,m,s,l,n[d+3],14,-187363961),l=y(l,f,m,s,n[d+8],20,1163531501),s=y(s,l,f,m,n[d+13],5,-1444681467),m=y(m,s,l,f,n[d+2],9,-51403784),f=y(f,m,s,l,n[d+7],14,1735328473),s=g(s,l=y(l,f,m,s,n[d+12],20,-1926607734),f,m,n[d+5],4,-378558),m=g(m,s,l,f,n[d+8],11,-2022574463),f=g(f,m,s,l,n[d+11],16,1839030562),l=g(l,f,m,s,n[d+14],23,-35309556),s=g(s,l,f,m,n[d+1],4,-1530992060),m=g(m,s,l,f,n[d+4],11,1272893353),f=g(f,m,s,l,n[d+7],16,-155497632),l=g(l,f,m,s,n[d+10],23,-1094730640),s=g(s,l,f,m,n[d+13],4,681279174),m=g(m,s,l,f,n[d+0],11,-358537222),f=g(f,m,s,l,n[d+3],16,-722521979),l=g(l,f,m,s,n[d+6],23,76029189),s=g(s,l,f,m,n[d+9],4,-640364487),m=g(m,s,l,f,n[d+12],11,-421815835),f=g(f,m,s,l,n[d+15],16,530742520),s=b(s,l=g(l,f,m,s,n[d+2],23,-995338651),f,m,n[d+0],6,-198630844),m=b(m,s,l,f,n[d+7],10,1126891415),f=b(f,m,s,l,n[d+14],15,-1416354905),l=b(l,f,m,s,n[d+5],21,-57434055),s=b(s,l,f,m,n[d+12],6,1700485571),m=b(m,s,l,f,n[d+3],10,-1894986606),f=b(f,m,s,l,n[d+10],15,-1051523),l=b(l,f,m,s,n[d+1],21,-2054922799),s=b(s,l,f,m,n[d+8],6,1873313359),m=b(m,s,l,f,n[d+15],10,-30611744),f=b(f,m,s,l,n[d+6],15,-1560198380),l=b(l,f,m,s,n[d+13],21,1309151649),s=b(s,l,f,m,n[d+4],6,-145523070),m=b(m,s,l,f,n[d+11],10,-1120210379),f=b(f,m,s,l,n[d+2],15,718787259),l=b(l,f,m,s,n[d+9],21,-343485551),s=s+h>>>0,l=l+v>>>0,f=f+_>>>0,m=m+S>>>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)}},939:function(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},942:function(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);function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function u(t){var e=function(t,e){if("object"!=a(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==a(e)?e:e+""}function c(t,e,n){return(e=u(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var s=window.ctEvents,l=n.n(s),f=n(942),m=n.n(f),d=n(503),p=n.n(d);function y(t){if(Array.isArray(t))return`[${t.map(function(t){return y(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+=`${y(t[n[r]])},`;return`${e}}`}return`${JSON.stringify(t)}`}const g=function(t){return p()(y(t))};function b(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function h(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?b(Object(n),!0).forEach(function(e){c(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}const v={};var _=function(){const[n,o]=(0,e.useState)({itemTitle:"Name",itemId:null,depth:0,data:null,parentData:null}),[i,a]=(0,e.useState)(null),[u,c]=(0,e.useState)(!1),s=(0,e.useMemo)(function(){return i||n.data},[i,n.data]),f=(0,e.useMemo)(function(){return!(!n.itemId||!s)},[n.itemId,s]),d=(0,e.useRef)();(0,e.useEffect)(function(){l().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=g({itemId:t,depth:e}),u=g({itemId:r,depth:0});if(v[i])return void o(function(o){return h(h({},o),{},{itemTitle:n,itemId:t,depth:e,data:v[i]},r&&v[u]?{parentData:v[u]}:{})});o(function(r){return h(h({},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){v[g({itemId:t.toString(),depth:0})]=a.data.additional_items[t]}),v[i]=a.data.settings,o(function(o){return h(h({},o),{},{itemTitle:n,itemId:t,depth:e,data:v[i]},r&&v[u]?{parentData:v[u]}:{})}))}}(t,e,n)})},[]);const p=function(){o(function(t){return h(h({},t),{},{itemId:null})})};return(0,e.createElement)("div",null,(0,e.createElement)(r.Overlay,{items:f,className:"ct-admin-modal ct-mega-menu-modal",initialFocusRef:d,onDismiss:function(){i||p()},onCloseButtonClick:function(){p()},render:function(){return(0,e.createElement)("div",{className:"ct-modal-content",ref:d},(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 h(h({},n||s),{},{[t]:e})})},options:blocksy_ext_mega_menu_localization.mega_menu_options,value:h(h(h({},Array.isArray(s)||!s?{}:s),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:m()("button-primary ct-large-button"),disabled:u||!i,onClick:function(){!async function(t,e,n){v[g({itemId:t,depth:n})]=e,c(!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(){c(!1)},500)})}(n.itemId,s,n.depth),o(function(t){return h(h({},t),{},{data:s})}),a(null)}},u?(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)(_,null))}),i()(document).on("click.ctMegaMenu",".blocksy-mega-menu-trigger",function(t){t.preventDefault();const e=t.target.closest(".blocksy-mega-menu-trigger");l().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})})}()}();