|
2
|
|
-(()=>{"use strict";var e,t={9009:(e,t,n)=>{var r,o,a,i,c,l=n(5072),u=n(7665),s=n(2564),f=n(8069),p=n(7097),h=n(4977),d=n(7039),m=n(4536),y=n(5263),v=n(6913),g=n(1210),E=n(4547),b=n(3676),w=n(9296),S=n(4461),R=n(6639),T=window.mwcode_snippet_vault.prefix,O=window.mwcode_snippet_vault.domain,x=window.mwcode_snippet_vault.rest_url.replace(/\/+$/,""),N=window.mwcode_snippet_vault.api_url.replace(/\/+$/,""),P=window.mwcode_snippet_vault.plugin_url.replace(/\/+$/,""),I="1"===window.mwcode_snippet_vault.is_pro,L=I&&"1"===window.mwcode_snippet_vault.is_registered,A=window.mwcode_snippet_vault.rest_nonce,k=window.mwcode_snippet_vault.options,C=n(197),j=n(1686);function D(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var G=j.Ay.div(r||(r=D(["\n color: white;\n padding: 15px;\n margin-bottom: -15px;\n\n a {\n color: #7dedff;\n text-decoration: none;\n }\n\n p {\n font-size: 15px;\n }\n"]))),M=(0,j.Ay)(S.z)(o||(o=D(["\n\n .neko-block-title {\n display: none;\n }\n\n .plugin-desc {\n display: flex;\n flex-direction: column;\n margin-left: 15px;\n }\n\n .neko-block-content {\n display: flex;\n padding: 15px;\n\n h2 {\n font-size: 18px;\n margin: 0;\n\n a {\n text-decoration: none;\n }\n }\n\n p {\n margin: 0px;\n margin-top: 10px;\n font-size: 13px;\n line-height: 1.5;\n }\n\n .plugin-actual-desc {\n font-size: 13px;\n font-weight: 500;\n }\n }\n"]))),F=j.Ay.img(a||(a=D(["\n height: 125px;\n width: auto;\n border-radius: 10px;\n background: lightgray;\n"]))),U=j.Ay.div(i||(i=D(["\n\n margin: 15px;\n\n .center {\n background: white;\n color: black;\n border-radius: 10px;\n padding: 10px;\n max-width: 100%\n overflow: none;\n\n h2 {\n font-size: 26px;\n }\n\n table {\n width: 100%;\n\n tr td:first-child {\n width: 220px;\n font-weight: bold;\n color: #1e7cba;\n }\n\n * {\n overflow-wrap: anywhere;\n }\n }\n }\n\n hr {\n border-color: #1e7cba;\n }\n"]))),B=j.Ay.ul(c||(c=D(["\n margin-top: 10px;\n background: rgb(0, 72, 88);\n padding: 10px;\n color: rgb(58, 212, 58);\n max-height: 600px;\n min-height: 200px;\n display: block;\n font-family: monospace;\n font-size: 12px;\n white-space: pre;\n overflow-x: auto;\n width: calc(100vw - 276px);\n color: white;\n\n .log-date {\n color: var(--neko-yellow);\n margin-left: 8px;\n }\n\n .log-type {\n background: #0000004d;\n padding: 2px 5px;\n border-radius: 8px;\n text-transform: uppercase;\n }\n\n .log-content {\n display: block;\n }\n\n .log-warning .log-type {\n background: var(--neko-yellow);\n color: white;\n }\n\n .log-fatal .log-type {\n background: var(--neko-red);\n color: white;\n }\n"])));function H(e){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H(e)}function V(){V=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new I(r||[]);return o(i,"_invoke",{value:x(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(L([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==H(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function x(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(H(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},T(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function Y(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function z(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Y(a,r,o,i,c,"next",e)}function c(e){Y(a,r,o,i,c,"throw",e)}i(void 0)}))}}function W(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||K(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function K(e,t){if(e){if("string"==typeof e)return q(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(e,t):void 0}}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var $=wp.element,J=$.useState,Q=$.useEffect,X="".concat(x,"/meow-common/v1"),Z=function(e){var t=e.request,n=e.title,r=e.max,o=W(J(!1),2),a=o[0],i=o[1],c=W(J([]),2),l=c[0],u=c[1],s=l.length>0?l.reduce((function(e,t){return e+t})):0,f=l.length>0?Math.ceil(s/l.length):0,p=!l.length&&a;return Q((function(){a&&setTimeout(z(V().mark((function e(){var n,r,o;return V().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(new Date).getTime(),e.next=3,(0,R.IU)("".concat(X,"/").concat(t),{method:"POST",nonce:A});case 3:r=(new Date).getTime(),o=r-n,u((function(e){return[].concat(function(e){if(Array.isArray(e))return q(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||K(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[o]);var t}));case 6:case"end":return e.stop()}}),e)}))),1e3)}),[l]),React.createElement(G,{style:{width:200,textAlign:"center"}},React.createElement(h.s,{h2:!0,style:{color:"white"}},n),React.createElement(C.X,{size:200,value:p?r:f,max:r},React.createElement("span",{style:{fontSize:20}},p?"START":f+" ms"),React.createElement("span",{style:{fontSize:12}},p?"YOUR ENGINE":l.length+" requests")),React.createElement(w.M,{style:{width:"100%",marginTop:10},color:a?"#cc3627":"#ccb027",onClick:function(){a||u([]),i(!a)}},a?"Stop":"Start"))};function ee(e){return ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ee(e)}function te(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ne(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ne(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ne(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function re(){re=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new I(r||[]);return o(i,"_invoke",{value:x(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(L([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==ee(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function x(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(ee(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},T(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function oe(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function ae(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){oe(a,r,o,i,c,"next",e)}function c(e){oe(a,r,o,i,c,"throw",e)}i(void 0)}))}}var ie=wp.element,ce=ie.useState,le=ie.useEffect;N&&x&&P||console.error("[@common/dashboard] apiUrl, restUrl and pluginUrl are mandatory.");var ue="".concat(x,"/meow-common/v1"),se=React.createElement(G,null,React.createElement(h.s,{p:!0,style:{lineHeight:"1.5",margin:"0 0 15px 0"}},"Hi! ☀️ Meow Apps isn't your typical plugin suite—it's a passion project led by me, ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://jordymeow.com"},"Jordy Meow"),", and a stellar team! 💕 Based in ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://offbeatjapan.org"},"Japan"),", we're all about making your WordPress experience smoother and speedier. Our plugins are all about boosting your site's performance and user-friendliness. Ready to level up your WordPress game? Check out ",React.createElement("a",{href:"http://meowapps.com",rel:"noreferrer",target:"_blank"},"Meow Apps")," and let's make magic happen! 🌴🙀")),fe=React.createElement(G,null,React.createElement(h.s,{p:!0},"The ",React.createElement("b",null,"Empty Request Time")," measures your installation's basic performance by showing the average time needed to process an empty request on your server. To see how disabling plugins affects the results, turn some off and run the test again. Aim for a time under 2,000 ms, but ideally, keep it below 500 ms. The ",React.createElement("b",null,"File Operation Time")," creates a temporary 10MB file each time it runs. ",React.createElement("b",null,"The SQL Request Time")," calculates the total number of posts. This process should be quick and have a similar duration to the Empty Request Time.")),pe=React.createElement(G,null,React.createElement(h.s,{p:!0},"Maintain a streamlined WordPress setup by using essential plugins and a dependable hosting provider. Refrain from self-hosting unless you're an expert. Go further by reading our tutorials:",React.createElement("ul",null,React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-improve-seo-wordpress/",rel:"noreferrer",target:"_blank"},"SEO Checklist & Optimization")),React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-faster-wordpress-optimize/",rel:"noreferrer",target:"_blank"},"Optimize your WordPress Speed")),React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-optimize-images-wordpress/",rel:"noreferrer",target:"_blank"},"Optimize Images (CDN, and so on)")),React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-hosting-service-wordpress/",rel:"noreferrer",target:"_blank"},"The Best Hosting Services for WordPress"))))),he=function(){var e=ae(re().mark((function e(){var t;return re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(ue,"/all_settings/"),{method:"POST",nonce:A});case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),de=function(){var e=ae(re().mark((function e(t){var n,r,o;return re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.value,r=t.id,e.next=3,(0,R.IU)("".concat(ue,"/update_option"),{method:"POST",nonce:A,json:{name:r,value:n}});case 3:return o=e.sent,e.abrupt("return",o);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),me=function(){var e=ae(re().mark((function e(){var t;return re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(ue,"/error_logs"),{method:"POST",nonce:A});case 2:return t=e.sent,e.abrupt("return",t.data.reverse());case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ye=function(){var e=(0,u.jE)(),t=te(ce(!1),2),n=t[0],r=t[1],o=te(ce(""),2),a=o[0],i=o[1],c=(0,f.I)({queryKey:["all_settings"],queryFn:he}),l=c.data,s=c.error,R=(0,p.n)({mutationFn:de,onSuccess:function(){e.invalidateQueries(["all_settings"])}}),T=(0,p.n)({mutationFn:me}),O=null==l?void 0:l.meowapps_hide_meowapps,x=null==l?void 0:l.force_sslverify;le((function(){s&&!n&&(r(!0),console.error("Error from useQuery",s.message))}),[s]),le((function(){var e=document.getElementById("meow-common-phpinfo");e&&i(e.innerHTML)}),[]);var N=function(e,t){R.mutate({value:e,id:t})},_=React.createElement(d.d,{title:"Main Menu"},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"meowapps_hide_meowapps",label:"Hide (Not Recommended)",description:React.createElement(h.s,{p:!0},"This will hide the Meow Apps Menu (on the left side) and everything it contains. You can re-enable it through though an option that will be added in Settings → General."),value:"1",disabled:R.isPending,checked:O,onChange:N}))),P=React.createElement(d.d,{title:"SSL Verify"},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"force_sslverify",label:"Force (Not Recommended)",description:React.createElement(h.s,{p:!0},"This will enforce the usage of SSL when checking the license or updating the plugin."),value:"1",disabled:R.isPending,checked:x,onChange:N})));return React.createElement(v.z,{showRestError:n},React.createElement(g.n,{title:"The Dashboard"}),React.createElement(E.N,null,React.createElement(E.Y,{full:!0},React.createElement(b._,{keepTabOnReload:!0},React.createElement(b.V,{title:"Meow Apps"},se,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(M,{title:"AI Engine",className:"primary"},React.createElement(F,{src:"https://ps.w.org/ai-engine/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/ai-engine/",rel:"noreferrer"},"AI Engine")),React.createElement("p",{className:"plugin-actual-desc"},"This is the ultimate AI plugin for WordPress. From a chatbot adapted to your needs to an AI that can write your content for you, API, REST, and more."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/ai-engine/",rel:"noreferrer"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/ai-engine/",rel:"noreferrer"},"Meow Apps"))))),React.createElement(M,{title:"Media Cleaner",className:"primary"},React.createElement(F,{src:"https://ps.w.org/media-cleaner/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-cleaner/",rel:"noreferrer"},"Media Cleaner")),React.createElement("p",{className:"plugin-actual-desc"},"Is your Media Library bloated, your database heavy, and your website running slow? Media Cleaner will clean your Media Library from the media entries (and files) which aren't used in your website, as well as broken entries."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-cleaner/",rel:"noreferrer"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/media-cleaner/",rel:"noreferrer"},"Meow Apps"))))),React.createElement(M,{title:"Database Cleaner",className:"primary"},React.createElement(F,{src:"https://ps.w.org/database-cleaner/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/database-cleaner/",rel:"noreferrer"},"Database Cleaner")),React.createElement("p",{className:"plugin-actual-desc"},"Not only does Database Cleaner have a user-friendly UI, but it's also equipped to handle large DBs, giving it an edge over other plugins. It's a must-have for any WordPress site."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/database-cleaner/",rel:"noreferrer"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/database-cleaner/",rel:"noreferrer"},"Meow Apps"))))),React.createElement(M,{title:"Media File Renamer",className:"primary"},React.createElement(F,{src:"https://ps.w.org/media-file-renamer/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-file-renamer/",rel:"noreferrer"},"Media File Renamer")),React.createElement("p",{className:"plugin-actual-desc"},"Rename and move files directly from the dashboard, manually, automatically or via AI, either individually or in bulk. It's the best way to rename your files."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-file-renamer/",rel:"noreferrer"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/media-file-renamer/",rel:"noreferrer"},"Meow Apps"))))),React.createElement(M,{title:"Social Engine",className:"primary"},React.createElement(F,{src:"https://ps.w.org/social-engine/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/social-engine/",rel:"noreferrer"},"Social Engine")),React.createElement("p",{className:"plugin-actual-desc"},'Effortlessly schedule and automate the perfect posts for all your networks. Unlimited capabilities and infinite className="plugin-actual-desc" extensibility, for free!'),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/social-engine/",rel:"noreferrer"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/social-engine/",rel:"noreferrer"},"Meow Apps"))))),React.createElement(M,{title:"Meow Analytics",className:"primary"},React.createElement(F,{src:"https://ps.w.org/meow-analytics/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/meow-analytics/"},"Meow Analytics")),React.createElement("p",{className:"plugin-actual-desc"},"Google Analytics for your website. Simple and fast."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/meow-analytics/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://meowapps.com/meow-analytics/"},"Meow Apps")))))),React.createElement(E.Y,{minimal:!0},React.createElement(M,{title:"Contact Form Block",className:"primary"},React.createElement(F,{src:"https://ps.w.org/seo-engine/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/seo-engine/",rel:"noreferrer"},"SEO Engine")),React.createElement("p",{className:"plugin-actual-desc"},"Optimize your content for SEO and for the AI world, with AI assistants... while keeping everything simple and fast, as it should be! ✌️"),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/seo-engine/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://meowapps.com/seo-engine/"},"Meow Apps"))))),React.createElement(M,{title:"Meow Gallery",className:"primary"},React.createElement(F,{src:"https://ps.w.org/meow-gallery/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/meow-gallery/"},"Meow Gallery")),React.createElement("p",{className:"plugin-actual-desc"},"Fast and beautiful galleries with many layouts. Forget the heavy and slow plugins, use the Meow Gallery for a better experience! 💕"),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/meow-gallery/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://meowapps.com/meow-gallery/"},"Meow Apps"))))),React.createElement(M,{title:"Meow Lightbox",className:"primary"},React.createElement(F,{src:"https://ps.w.org/meow-lightbox/assets/icon-256x256.gif"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/meow-lightbox/"},"Meow Lightbox")),React.createElement("p",{className:"plugin-actual-desc"},"Sleek and performant lightbox with EXIF support."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/meow-lightbox/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://meowapps.com/meow-lightbox/"},"Meow Apps"))))),React.createElement(M,{title:"Perfect Images (Retina)",className:"primary"},React.createElement(F,{src:"https://ps.w.org/wp-retina-2x/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/wp-retina-2x/"},"Perfect Images")),React.createElement("p",{className:"plugin-actual-desc"},"Manage, Optimize, Replace your images with Perfect Images."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/wp-retina-2x/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://meowapps.com/wp-retina-2x/"},"Meow Apps"))))),React.createElement(M,{title:"Photo Engine",className:"primary"},React.createElement(F,{src:"https://ps.w.org/wplr-sync/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/wplr-sync/"},"Photo Engine")),React.createElement("p",{className:"plugin-actual-desc"},"Organize your photos in folders and collections. Synchronize with Lightroom. Simplify and speed up your workflow."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/wplr-sync/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://meowapps.com/wplr-sync/"},"Meow Apps"))))),React.createElement(M,{title:"Contact Form Block",className:"primary"},React.createElement(F,{src:"https://ps.w.org/contact-form-block/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/contact-form-block/"},"Contact Form Block")),React.createElement("p",{className:"plugin-actual-desc"},"Need a very simple but straightforward contact form? This is the one you need. It's fast, simple, and efficient."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/contact-form-block/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://meowapps.com/contact-form-block/"},"Meow Apps")))))))),React.createElement(b.V,{title:"Performance"},fe,React.createElement("div",{style:{display:"flex",justifyContent:"space-around",marginBottom:25}},React.createElement(Z,{title:"Empty Request Time",request:"empty_request",max:2500}),React.createElement(Z,{title:"File Operation Time",request:"file_operation",max:2600}),React.createElement(Z,{title:"SQL Request Time",request:"sql_request",max:2800})),pe),React.createElement(b.V,{title:"PHP Info"},React.createElement(U,{dangerouslySetInnerHTML:{__html:a}})),React.createElement(b.V,{title:"PHP Error Logs"},React.createElement(G,null,React.createElement(w.M,{style:{marginBottom:10},color:"#ccb027",onClick:function(){T.mutate()},disabled:T.isPending,isBusy:T.isPending},"Load PHP Error Logs"),React.createElement(B,null,(T.data||[]).map((function(e){return React.createElement("li",{className:"log-".concat(e.type),key:e.id},React.createElement("span",{className:"log-type"},e.type),React.createElement("span",{className:"log-date"},e.date),React.createElement("span",{className:"log-content"},e.content))}))),React.createElement(h.s,{p:!0},"If you don't see any errors, your host might not allow remote access to PHP error logs. Contact them for assistance, or look in your hosting control panel."))),React.createElement(b.V,{title:"Settings"},React.createElement(S.z,{title:"Settings",className:"primary"},_,P))))))},ve=wp.i18n.__,ge={},Ee="code-engine";ge.PENDING=ve("Pending",Ee),ge.RENAME=ve("Rename",Ee),ge.TITLE=ve("Title",Ee),ge.ERROR={SNIPPET_FATAL:ve("⚠️ A fatal error occured while running the snippet ",Ee),SNIPPET_DISABLED:ve("This snippet has been disabled. This message will disappear automatically when you refresh the page.",Ee),UPDATING_OPTIONS:ve("An error occured while updating the options.",Ee),GETTING_OPTIONS:ve("An error occured while getting the options.",Ee),CHECK_YOUR_CONSOLE:ve('For more information, check <a target="_blank" href="https://meowapps.com/tutorial-network-activity-dev-tools/">your console</a>. You might also want to check your <a target="_blank" href="https://meowapps.com/tutorial-php-error-logs/">PHP Error Logs</a>.',Ee)},ge.ALERTS={ARE_YOU_SURE:ve("Are you sure?",Ee)},ge.COMMON={YES:ve("Yes",Ee),NO:ve("No",Ee),OK:ve("OK",Ee),CANCEL:ve("Cancel",Ee),CLEAR:ve("Clear",Ee),CLOSE:ve("Close",Ee),SAVE:ve("Save",Ee),SAVE_AND_CLOSE:ve("Save & Close",Ee),UPDATE:ve("Update",Ee),RESET:ve("Reset",Ee),REFRESH:ve("Refresh",Ee),LOADING:ve("Loading...",Ee),RESET_SETTINGS:ve("Reset Settings",Ee),REFRESH_SETTINGS:ve("Refresh Settings",Ee),DELETE:ve("Delete",Ee),CLONE:ve("Clone",Ee),NO_RESULTS:ve("There aren't any snippets yet.",Ee),ADD:ve("Add",Ee),UPLOAD:ve("Upload",Ee),UPLOADING:ve("Uploading...",Ee),EDIT:ve("Edit",Ee),RENAME:ve("Rename",Ee),MAINTENANCE:ve("Maintenance",Ee),SEARCH:ve("Search",Ee),SELECT:ve("Select",Ee),SELECT_ALL:ve("Select All",Ee),UNSELECT_ALL:ve("Unselect All",Ee),ENABLE:ve("Enable",Ee),ENABLE_RECOMMENDED:ve("Enable (Recommended)",Ee),ENABLE_NOT_RECOMMENDED:ve("Enable (Not Recommended)",Ee),DISABLE:ve("Disable",Ee),DISABLE_RECOMMENDED:ve("Disable (Recommended)",Ee),DASHBOARD:ve("Dashboard",Ee),SETTINGS:ve("Settings",Ee),REFRESH_LOGS:ve("Refresh Logs",Ee),CLEAR_LOGS:ve("Clear Logs",Ee),LOGS:ve("Logs",Ee),HIDE:ve("Hide",Ee),DATA_NOT_AVAILABLE:ve("Data not available",Ee)},ge.SETTINGS={TITLE:ve("Settings",Ee),HEADER_TITLE:ve("Code Engine | Settings",Ee),IMPORT_SETTINGS:ve("Import Settings & Snippets",Ee),EXPORT_SETTINGS:ve("Export Settings & Snippets",Ee),SHOW_TUTORIAL:ve("Show Tutorial",Ee),QUICK_START:ve("Quick Start",Ee),QUICK_START_INFO:ve("Describe what you are trying to achieve, and Code Engine will generate the code and set up all the parameters for you.",Ee),QUICK_START_PLACEHOLDER:ve("A PHP function that takes a message and send it to an email...",Ee),MODULES:{TITLE:ve("Modules",Ee),DESCRIPTION:ve("Manage the modules and their settings.",Ee),CODE_BLOCKS:ve("Code Blocks",Ee),CODE_BLOCKS_DESCRIPTION:ve("This will let you select all the posts where you want to enable the Code Engine Blocks. Each of these selected posts will allow you to run PHP/JS code directly as Blocks or Shortcodes. However, it is recommended to use the Code Engine Content Snippets instead.",Ee),CODE_BLOCKS_SELECTION:ve("Code Blocks Enabled Posts",Ee),CODE_BLOCKS_INSTRUCTIONS:ve("Instructions",Ee),CODE_BLOCKS_INSTRUCTIONS_DESCRIPTION:ve("The posts you select here will be allowed to use the Code Engine Blocks. This means that any user with the “edit_posts” capability will be able to run PHP/JS code in these posts, either using the Code Engine Block or the Code Engine shortcode with the “code” attribute.",Ee),CODE_BLOCKS_INSTRUCTIONS_WARNING:ve("If you want to include PHP/JS code snippets in your posts that are managed only by an admin, you should create a Content Snippet (PHP/JS) instead. This allows you to reference the code using a shortcode with a unique ID, and it will not be editable by other users. This is the recommended way to use Code Engine in your posts.",Ee)},AI_PARAMETERS:{TITLE:ve("AI Parameters",Ee),AI_ENGINE_INSTALLED:ve("AI Engine",Ee),AI_ENGINE_REQUIRED:ve("AI Engine",Ee),DOWNLOAD_AI_ENGINE:ve("Download AI Engine",Ee),AI_SUGGESTIONS:ve("AI Suggestions",Ee),AI_SUGGESTIONS_DESCRIPTION:ve(" Will add a panel of AI features above the code editor.",Ee)},DEVELOPERS:{TITLE:ve("For Developers",Ee),SANITIZE_ARGS:ve("Sanitize Arguments",Ee),SANITIZE_ARGS_DESCRIPTION:ve("Sanitize the arguments before running the snippet: Make sure the non numeric values are in quotes, and ensure the API arguments' names are using the PHP '$' prefix.",Ee),LOGS:ve("Logs",Ee),LOGS_DESCRIPTION:ve("Enable the server logs for debugging purposes.",Ee),DATABASE_INSPECTION:ve("Database Inspection",Ee),DATABASE_INSPECTION_DESCRIPTION:ve("This will add a new tab in the settings to inspect the plugin's options directly from the databse.",Ee),DISALLOW_BLOCK_PHP:ve("No PHP in Blocks",Ee),DISALLOW_BLOCK_PHP_DESCRIPTION:ve('The Code Engine Block will not be able to run PHP code. This is recommended for security reasons, but you can disable it if you want to use PHP in Blocks. It is recommended to use a Content Snippet (PHP) instead. If disabled, any user with the "edit_posts" capability will be able to run PHP code in Blocks.',Ee),BYPASS_SECURITY:ve("Bypass REST Security",Ee),BYPASS_SECURITY_DESCRIPTION:ve("Disables REST API security checks. Better to use filters mwcode_rest_whitelist or mwcode_rest_authorized for specific routes.",Ee),MCP_SUPPORT:ve("MCP Support",Ee),MCP_SUPPORT_DESCRIPTION:ve("The internal API of Code Engine will be registered to the MCP server implemented by AI Engine.",Ee),RAW_EDIT:ve("Raw Edit",Ee)},PREFERENCES:{TITLE:ve("Preferences",Ee),PUBLIC_API:ve("Public API",Ee),SNIPPET_ENDPOINT:ve("Snippet Endpoint",Ee),SNIPPET_ENDPOINT_DESCRIPTION:ve("This will let you choose for each snippet an endpoint to call it from the outside.",Ee),CODE_PREVIEW:ve("Code Preview",Ee),CODE_PREVIEW_DESCRIPTION:ve("Display code preview inside the snippets table.",Ee)},SNIPPETS:ve("Snippets",Ee),SNIPPETS_TABLE_COLUMNS:{SNIPPET:ve("Snippet",Ee),ATTRIBUTES:ve("Attributes",Ee),TYPE:ve("Type",Ee),ACTIVE:ve("Active",Ee),ACTIONS:ve("Actions",Ee),FUNCTION:ve("Function",Ee)},SNIPPET:{PUBLIC_API:ve("Public API",Ee),TOKEN:ve("Bearer Token",Ee),METHOD:ve("Method",Ee),LABEL:ve("Snippet",Ee),TURN_ON:ve("On",Ee),TURN_OFF:ve("Off",Ee),RUN:ve("Run",Ee),CODE:ve("Code",Ee),NAME:ve("Name",Ee),TEST:ve("Test",Ee),BEHAVIOR:ve("Behavior",Ee),TARGET:ve("Target",Ee),BEHAVIOR_DYNAMIC:ve("Allows functions to feedback into the AI for ongoing interactions.",Ee),BEHAVIOR_STATIC:ve("Executes tasks independently, suitable for single, definitive actions.",Ee),DESCRIPTION:ve("Description",Ee),MISSING_TYPE_WARNING:ve("Types are missing for the arguments. Add a type to each one to avoid errors.",Ee),DEFAULT_VALUE:ve("Default Value",Ee),TAGS:ve("Tags",Ee),TAGS_DESCRIPTION:ve("Tags separated by commas.",Ee),HOURS:ve("Hours",Ee),MINUTES:ve("Minutes",Ee),PRIORITY:ve("Priority",Ee),TIMEFRAME:ve("Timeframe",Ee),TARGET_TIME:ve("Target Time",Ee),TYPE:ve("Type",Ee),READ_COMMENTS:ve("Query AI (Via Comments)",Ee),MODIFY_BEFORE_USE:ve("Modify before use",Ee),ENDPOINT:ve("Endpoint Slug",Ee),ENDPOINT_URL:ve("The endpoint will be <strong>{0}</strong>",Ee),PUBLIC_API_DESCRIPTION:ve("This feature is in beta. It allows calling this function via the REST API",Ee),SCOPES:{ALL:ve("All",Ee),GLOBAL_FRONTEND_BACKEND:ve("Global (All)",Ee),GLOBAL_FRONTEND:ve("Global (Front)",Ee),GLOBAL_BACKEND:ve("Global (Back)",Ee),CONTENT_PHP:ve("Content (PHP)",Ee),CONTENT_JS:ve("Content (JS)",Ee),FRONTEND:ve("Front",Ee),BACKEND:ve("Back",Ee),PERSISTENT:ve("Global",Ee),FUNCTION:ve("Callable",Ee),SCHEDULED:ve("Scheduled",Ee)},SELECT_SNIPPET:ve("Select a snippet on the left, or click the + button if you want new one.",Ee),SELECT_ALL_TAGS:ve("Select all tags",Ee),IMPORT_CODE_SNIPPETS:ve("Import All Snippets from Code Snippets",Ee),TEST_PARAMETERS_DESCRIPTION_LOG:ve("• Use the <strong>echo (PHP)</strong> or <strong>console.log() (JS)</strong> functions to print anything in the console above.",Ee),TEST_PARAMETERS_DESCRIPTION_ARG:ve("• You can change the default value of the function paramaters in the <strong>Function</strong> tab.",Ee)},STRING_VALUE_WARNING:ve("This value appears to be a string. Ensure to have quotes around it.",Ee),ADD_QOUTES:ve("Add Quotes",Ee),EDITOR:ve("Editor",Ee),SIDEBAR_EDITOR:ve("Sidebar Editor",Ee),SUCCESSFULLY_RAN:ve("Snippet successfully ran: {0}",Ee)};const be=ge;var we=n(9794);function Se(e){return Se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Se(e)}function Re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Re(Object(n),!0).forEach((function(t){Oe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Re(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Oe(e,t,n){return(t=function(e){var t=function(e){if("object"!=Se(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Se(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Se(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xe(){xe=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new I(r||[]);return o(i,"_invoke",{value:x(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(L([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==Se(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function x(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Se(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},T(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function Ne(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function _e(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Ne(a,r,o,i,c,"next",e)}function c(e){Ne(a,r,o,i,c,"throw",e)}i(void 0)}))}}var Pe=function(){var e=_e(xe().mark((function e(){var t;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,R.IU)("".concat(N,"/get_logs"),{nonce:A,method:"GET"});case 3:return t=e.sent,e.abrupt("return",t.data);case 7:throw e.prev=7,e.t0=e.catch(0),new Error(e.t0.message);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}(),Ie=function(){var e=_e(xe().mark((function e(){return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,R.IU)("".concat(N,"/clear_logs"),{nonce:A});case 3:e.next=8;break;case 5:throw e.prev=5,e.t0=e.catch(0),new Error(e.t0.message);case 8:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(){return e.apply(this,arguments)}}(),Le=function(){var e=_e(xe().mark((function e(){var t;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/settings/list"),{method:"GET",nonce:A});case 2:if((t=e.sent).success){e.next=5;break}throw new Error(null==t?void 0:t.message);case 5:return e.abrupt("return",t.options);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ae=function(){var e=_e(xe().mark((function e(t){var n;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/settings/update"),{method:"POST",nonce:A,json:t});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",n.options);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ke=function(){var e=_e(xe().mark((function e(){var t;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/settings/reset"),{method:"POST",nonce:A});case 2:if((t=e.sent).success){e.next=5;break}throw new Error(null==t?void 0:t.message);case 5:return e.abrupt("return",t.options);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ce=function(){var e=_e(xe().mark((function e(t){var n,r,o,a,i,c,l,u,s;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t(!0),n=new Date,e.next=5,Le();case 5:return r=e.sent,e.next=8,Fe({});case 8:return o=e.sent.snippets,e.next=11,Ue();case 11:a=e.sent,i={options:r,snippets:o,functions:a},c="code-engine-".concat(n.getFullYear(),"-").concat(n.getMonth()+1,"-").concat(n.getDate(),".json"),l=new Blob([JSON.stringify(i)],{type:"application/json"}),u=URL.createObjectURL(l),(s=document.createElement("a")).href=u,s.setAttribute("download",c),s.click(),e.next=26;break;case 22:e.prev=22,e.t0=e.catch(0),alert("Error while exporting settings. Please check your console."),console.log(e.t0);case 26:return e.prev=26,t(!1),e.finish(26);case 29:case"end":return e.stop()}}),e,null,[[0,22,26,29]])})));return function(t){return e.apply(this,arguments)}}(),je=function(){var e=_e(xe().mark((function e(t){var n;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{(n=document.createElement("input")).type="file",n.accept="application/json",n.onchange=function(){var e=_e(xe().mark((function e(n){var r,o;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.target.files[0]){e.next=3;break}return e.abrupt("return");case 3:o=new FileReader,t(!0),o.onload=function(){var e=_e(xe().mark((function e(t){var n,r,o,a;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=JSON.parse(t.target.result),r=n.options,o=n.snippets,a=n.functions,console.log("Updating settings...",r),e.next=5,Ae({options:r});case 5:return console.log("Settings updated."),console.log("Updating snippets...",o),e.next=9,Ve(o);case 9:return console.log("Snippets updated."),console.log("Updating functions...",a),e.next=13,Be(a);case 13:console.log("Functions updated."),alert("Settings imported. The page will now reload to reflect the changes."),window.location.reload();case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),o.readAsText(r);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.click()}catch(e){alert("Error while importing settings. Please check your console."),console.log(e)}finally{t(!1)}case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),De=function(){var e=_e(xe().mark((function e(){var t;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/settings/functions/raw"),{method:"GET",nonce:A});case 2:if((t=e.sent).success){e.next=5;break}throw new Error(null==t?void 0:t.message);case 5:return e.abrupt("return",t.functions);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ge=function(){var e=_e(xe().mark((function e(t){var n;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/settings/functions/raw"),{method:"POST",nonce:A,json:{functions:t}});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",n.functions);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Me=!0,Fe=function(){var e=_e(xe().mark((function e(t){var n;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Me=!0,e.next=3,(0,R.IU)("".concat(N,"/snippets/list"),{method:"POST",nonce:A,json:t});case 3:if(n=e.sent,Me=!1,n.success){e.next=7;break}throw new Error(null==n?void 0:n.message);case 7:return e.abrupt("return",{snippets:n.data,total:n.total});case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ue=function(){var e=_e(xe().mark((function e(){var t;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/settings/functions"),{method:"GET",nonce:A});case 2:if((t=e.sent).success){e.next=5;break}throw new Error(null==t?void 0:t.message);case 5:return e.abrupt("return",t.functions);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Be=function(){var e=_e(xe().mark((function e(t){var n;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/settings/functions/replace"),{method:"POST",nonce:A,json:{functions:t}});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",{functions:n.data});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),He=function(){var e=_e(xe().mark((function e(){var t;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/snippets/tags"),{method:"POST",nonce:A});case 2:if((t=e.sent).success){e.next=5;break}throw new Error(null==t?void 0:t.message);case 5:return e.abrupt("return",{tags:t.data});case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ve=function(){var e=_e(xe().mark((function e(t){var n;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/snippets/replace"),{method:"POST",nonce:A,json:{snippets:t}});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",{snippets:n.data});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ye=function(){var e=_e(xe().mark((function e(){var t;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/snippets/import"),{method:"GET",nonce:A});case 2:if((t=e.sent).success){e.next=6;break}throw alert("⚠️ "+(null==t?void 0:t.message)),new Error(null==t?void 0:t.message);case 6:return alert(t.total+" snippets imported."),e.abrupt("return",{total:t.total});case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ze=function(){var e=_e(xe().mark((function e(){var t;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/snippets/stats"),{method:"GET",nonce:A});case 2:if((t=e.sent).success){e.next=5;break}throw new Error(null==t?void 0:t.message);case 5:return e.abrupt("return",{stats:t.data});case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),We=function(){var e=_e(xe().mark((function e(t){var n;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/snippets/add"),{method:"POST",nonce:A,json:t});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",{snippet:n.snippet,snippets:n.data,total:n.total});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ke=function(){var e=_e(xe().mark((function e(t){var n;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/snippets/update"),{method:"POST",nonce:A,json:t});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",{snippets:n.data,total:n.total});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),qe=function(){var e=_e(xe().mark((function e(t){var n;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/snippets/delete"),{method:"POST",nonce:A,json:t});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",{snippets:n.data,total:n.total});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),$e=function(){var e=_e(xe().mark((function e(t){var n;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/run/test"),{method:"POST",nonce:A,json:Te(Te({},t),{},{test:!0})});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",{result:{return:n.return,error:n.error}});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Je=function(){var e=_e(xe().mark((function e(t){var n;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/run/lint"),{method:"POST",nonce:A,json:t});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",{result:n.lint});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Qe=function(){var e=_e(xe().mark((function e(t){var n;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/quick_start"),{method:"POST",nonce:A,json:{prompt:t}});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",n.data);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function Xe(e){return Xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Xe(e)}function Ze(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function et(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(n),!0).forEach((function(t){tt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ze(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function tt(e,t,n){return(t=function(e){var t=function(e){if("object"!=Xe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Xe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Xe(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nt(){nt=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new I(r||[]);return o(i,"_invoke",{value:x(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(L([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==Xe(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function x(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Xe(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},T(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function rt(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function ot(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){rt(a,r,o,i,c,"next",e)}function c(e){rt(a,r,o,i,c,"throw",e)}i(void 0)}))}}function at(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return it(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?it(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ct=wp.element,lt=ct.useContext,ut=ct.createContext,st=ct.useState,ft=ut(),pt=function(e){var t=e.children,n=at(st(k),2),r=n[0],o=n[1],a=at(st({}),2),i=a[0],c=a[1],l=at(st(null),2),u=l[0],s=l[1],f=at(st(!1),2),p=f[0],h=f[1],d=function(e){console.error(be.ERROR.GETTING_OPTIONS,null!=e&&e.message?{message:e.message}:{err:e}),e.message&&s(React.createElement(React.Fragment,null,React.createElement("div",null,be.ERROR.GETTING_OPTIONS),React.createElement("small",null,(0,R.FE)(be.ERROR.CHECK_YOUR_CONSOLE))))},m=function(){var e=ot(nt().mark((function e(){var t;return nt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h(!0),e.prev=1,e.next=4,Le();case 4:t=e.sent,o(t),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),d(e.t0);case 11:return e.prev=11,h(!1),e.finish(11);case 14:case"end":return e.stop()}}),e,null,[[1,8,11,14]])})));return function(){return e.apply(this,arguments)}}(),y=function(){var e=ot(nt().mark((function e(t,n){var a,i;return nt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=et(et({},r),{},tt({},n,t)),JSON.stringify(a)!==JSON.stringify(r)){e.next=3;break}return e.abrupt("return");case 3:return h(!0),e.prev=4,e.next=7,Ae({options:a});case 7:i=e.sent,o(i),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),d(e.t0);case 14:return e.prev=14,h(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[4,11,14,17]])})));return function(t,n){return e.apply(this,arguments)}}(),v=function(){var e=ot(nt().mark((function e(){var t;return nt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.confirm(be.ALERTS.ARE_YOU_SURE)){e.next=2;break}return e.abrupt("return");case 2:return h(!0),e.prev=3,e.next=6,ke();case 6:t=e.sent,o(t),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(3),console.error(be.ERROR.UPDATING_OPTIONS,null!==e.t0&&void 0!==e.t0&&e.t0.message?{message:e.t0.message}:{err:e.t0}),e.t0.message&&s(React.createElement(React.Fragment,null,React.createElement("div",null,be.ERROR.UPDATING_OPTIONS),React.createElement("small",null,(0,R.FE)(be.ERROR.CHECK_YOUR_CONSOLE))));case 14:return e.prev=14,h(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[3,10,14,17]])})));return function(){return e.apply(this,arguments)}}(),g={updateOption:y,getOption:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null!==(t=r[e])&&void 0!==t?t:n},resetOptions:v,refreshOptions:m,setError:s,setIsLoading:h,setModals:c},E={options:r,error:u,isLoading:p,modals:i};return React.createElement(ft.Provider,{value:{state:E,actions:g}},t,React.createElement(we.n,{isOpen:u,title:be.COMMON.ERROR,content:u,ok:be.COMMON.CLOSE,onRequestClose:function(){return s(!1)},onOkClick:function(){return s(!1)}}))},ht=function(){var e=lt(ft);if(!e)throw new Error("useCoreContext must be used within a CoreContextProvider");return e},dt=n(7213),mt=n(3273),yt=n(8482),vt=n(520),gt=n(8700),Et=n(7494),bt=n(1843),wt=n(6734),St=n(2557),Rt=n(3896),Tt=n(7571);function Ot(e){return Ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ot(e)}function xt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Nt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xt(Object(n),!0).forEach((function(t){_t(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _t(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ot(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ot(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ot(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Pt=function(e,t){var n=Nt({},e),r=Nt({},t);return delete n.functionError,delete r.functionError,Object.keys(n).sort(),Object.keys(r).sort(),JSON.stringify(n)!==JSON.stringify(r)},It=[{value:"all",label:be.SETTINGS.SNIPPET.SCOPES.ALL,color:"var(--neko-grey)",select_hidden:!0},{value:"global",label:be.SETTINGS.SNIPPET.SCOPES.PERSISTENT,color:"var(--neko-purple)",childScopes:["frontend","backend","persistent"]},{value:"function",label:be.SETTINGS.SNIPPET.SCOPES.FUNCTION,color:"var(--neko-orange)"},{value:"scheduled",label:be.SETTINGS.SNIPPET.SCOPES.SCHEDULED,color:"var(--neko-orange)"},{value:"disabled",label:be.SETTINGS.SNIPPET.TURN_OFF,select_hidden:!0},{value:"content_js",label:be.SETTINGS.SNIPPET.SCOPES.CONTENT_JS,color:"var(--neko-green)"},{value:"content_php",label:be.SETTINGS.SNIPPET.SCOPES.CONTENT_PHP,color:"var(--neko-green)"}],Lt=[{value:"persistent",label:be.SETTINGS.SNIPPET.SCOPES.GLOBAL_FRONTEND_BACKEND},{value:"frontend",label:be.SETTINGS.SNIPPET.SCOPES.GLOBAL_FRONTEND},{value:"backend",label:be.SETTINGS.SNIPPET.SCOPES.GLOBAL_BACKEND},{value:"function",label:be.SETTINGS.SNIPPET.SCOPES.FUNCTION},{value:"scheduled",label:be.SETTINGS.SNIPPET.SCOPES.SCHEDULED},{value:"content_php",label:be.SETTINGS.SNIPPET.SCOPES.CONTENT_PHP},{value:"content_js",label:be.SETTINGS.SNIPPET.SCOPES.CONTENT_JS}],At={marginTop:10,background:"rgb(0, 72, 88)",padding:10,color:"rgb(58, 212, 58)",maxHeight:220,minHeight:200,display:"block",fontFamily:"monospace",fontSize:12,overflowX:"auto",borderRadius:10,overflowWrap:"break-word"},kt={id:null,name:"",description:"",code:"",tags:"",priority:10,scope:"persistent",active:1,endpoint:"",functionName:"",functionArgs:[],functionArgsDict:{},functionBehavior:"dynamic",functionTarget:"php",intervalHours:(new Date).getHours(),intervalMinutes:(new Date).getMinutes()},Ct=[{accessor:"status",width:"60px"},{accessor:"snippet",title:be.SETTINGS.SNIPPETS_TABLE_COLUMNS.SNIPPET,sortable:!1,filters:{type:"checkbox"}},{accessor:"functionName",title:be.SETTINGS.SNIPPETS_TABLE_COLUMNS.FUNCTION,sortable:!0,width:"15%"},{accessor:"endpoint",title:be.SETTINGS.SNIPPETS_TABLE_COLUMNS.ENDPOINT,sortable:!1,width:"15%"},{accessor:"attributes",title:be.SETTINGS.SNIPPETS_TABLE_COLUMNS.TYPE,sortable:!1,width:"94px"},{accessor:"actions",title:be.SETTINGS.SNIPPETS_TABLE_COLUMNS.ACTIONS,sortable:!1,width:"135px"},{accessor:"enabled",width:"80px"}],jt=React.createElement("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("g",{"clip-path":"url(#clip0_323_423)"},React.createElement("path",{d:"M0 0H64V64H0V0Z",fill:"#8F9ED1"}),React.createElement("path",{d:"M21.7412 32.0461L22.0318 30.8851L21.7412 32.0461ZM21.7412 32.0461C21.0578 34.7763 18.616 36.6829 15.803 36.6829M21.7412 32.0461L15.803 36.6829M15.803 36.6829H10.9194M15.803 36.6829H10.9194M10.9194 36.6829L13.361 26.9164H18.9313C19.9227 26.9164 20.8396 27.3638 21.45 28.1449C22.0588 28.9261 22.2706 29.9252 22.0318 30.885L10.9194 36.6829ZM24.1207 26.0585L24.1206 26.0584C22.8634 24.4501 20.9733 23.5276 18.9313 23.5276H10.7526H10.7136L10.7041 23.5655L4.95149 46.5872L4.93597 46.6493H5H8.38837H8.42741L8.43688 46.6114L10.0722 40.0717H15.803C20.1731 40.0717 23.9668 37.1093 25.0274 32.87L24.9789 32.8579L25.0274 32.87L25.3181 31.7074C25.8132 29.7269 25.3763 27.6684 24.1207 26.0585Z",fill:"white",stroke:"white","stroke-width":"0.1"}),React.createElement("path",{d:"M56.2737 32.0461L56.5643 30.8851L56.2737 32.0461ZM56.2737 32.0461C55.5903 34.7763 53.1485 36.6829 50.3355 36.6829M56.2737 32.0461L50.3355 36.6829M50.3355 36.6829H45.4519M50.3355 36.6829H45.4519M45.4519 36.6829L47.8935 26.9164H53.4637C54.4552 26.9164 55.372 27.3638 55.9824 28.1449C56.5912 28.9261 56.8031 29.9252 56.5643 30.885L45.4519 36.6829ZM58.6532 26.0585L58.6531 26.0584C57.3959 24.4501 55.5057 23.5276 53.4637 23.5276H45.2851H45.246L45.2366 23.5655L39.484 46.5872L39.4684 46.6493H39.5325H42.9208H42.9599L42.9693 46.6114L44.6047 40.0717H50.3355C54.7055 40.0717 58.4993 37.1093 59.5599 32.87L59.5114 32.8579L59.5599 32.87L59.8506 31.7074C60.3457 29.7269 59.9088 27.6684 58.6532 26.0585Z",fill:"white",stroke:"white","stroke-width":"0.1"}),React.createElement("path",{d:"M40.9479 25.5534L40.9478 25.5534C39.8994 24.2667 38.3467 23.5276 36.6857 23.5276H31.5329L32.7178 17.0089L32.7285 16.95H32.6686H29.3276H29.2859L29.2784 16.9911L25.0933 40.0127L25.0826 40.0716H25.1425H28.4835H28.5252L28.5327 40.0306L30.9168 26.9164H36.6857C37.3226 26.9164 37.917 27.1987 38.3186 27.6929C38.7205 28.1874 38.8767 28.827 38.7631 29.3829L36.092 40.0094L36.0763 40.0716H36.1405H39.5314H39.5704L39.5799 40.0338L42.0656 30.1417L42.0657 30.1417L42.0661 30.1397C42.4032 28.5143 41.9947 26.8417 40.9479 25.5534Z",fill:"white",stroke:"white","stroke-width":"0.1"})),React.createElement("defs",null,React.createElement("clipPath",{id:"clip0_323_423"},React.createElement("rect",{width:"64",height:"64",fill:"white"})))),Dt=React.createElement("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("g",{"clip-path":"url(#clip0_323_419)"},React.createElement("path",{d:"M0 0H64V64H0V0Z",fill:"#FFDF00"}),React.createElement("path",{d:"M36.3116 37.1954C37.4119 39.0229 38.8435 40.3661 41.3753 40.3661C43.5022 40.3661 44.8609 39.2847 44.8609 37.7907C44.8609 36.0002 43.465 35.3661 41.1239 34.3245L39.8406 33.7644C36.1364 32.1592 33.6757 30.1482 33.6757 25.8971C33.6757 21.9811 36.609 19 41.1932 19C44.4569 19 46.8032 20.1554 48.494 23.1806L44.4968 25.7913C43.6167 24.1861 42.6673 23.5537 41.1932 23.5537C39.6897 23.5537 38.7368 24.5239 38.7368 25.7913C38.7368 27.3577 39.6906 27.9918 41.8929 28.9621L43.1762 29.5212C47.5376 31.4236 50 33.3631 50 37.7236C50 42.4246 46.3695 45 41.494 45C36.7268 45 33.647 42.6892 32.14 39.6605L36.3116 37.1954ZM18.1784 37.6479C18.9848 39.1032 19.7184 40.3335 21.482 40.3335C23.1685 40.3335 24.2324 39.6623 24.2324 37.0526V19.2982H29.3655V37.123C29.3655 42.5295 26.2493 44.9903 21.7005 44.9903C17.5906 44.9903 15.2105 42.8268 14 40.221L18.1784 37.6479Z",fill:"black"})),React.createElement("defs",null,React.createElement("clipPath",{id:"clip0_323_419"},React.createElement("rect",{width:"64",height:"64",fill:"white"}))));function Gt(e){return Gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gt(e)}function Mt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ft(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Mt(Object(n),!0).forEach((function(t){Ut(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ut(e,t,n){return(t=function(e){var t=function(e){if("object"!=Gt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Gt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Gt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bt(){Bt=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new I(r||[]);return o(i,"_invoke",{value:x(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(L([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==Gt(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function x(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Gt(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},T(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function Ht(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function Vt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Yt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var zt,Wt=wp.element,Kt=Wt.useState,qt=Wt.useMemo,$t=function(e){var t=e.onCreated,n=e.onUpdated,r=e.onDeleted,o=e.onTestedSnippet,a=(e.onRanSnippet,e.onError),i=Vt(Kt(null),2),c=i[0],l=i[1],s=Vt(Kt(!1),2),f=s[0],h=s[1],d=Vt(Kt({page:1,limit:10,filters:[{accessor:"scope",value:"all"}],sort:{accessor:"id",by:"asc"}}),2),m=d[0],y=d[1],v=["snippets",m],g=["tags"],E=["stats"],b=(0,u.jE)(),w=(0,Tt.E)({queries:[{queryKey:g,queryFn:He},{queryKey:v,queryFn:function(){return Fe(m)}},{queryKey:E,queryFn:ze}]}),S=(w[0].data||{}).tags,R=void 0===S?[]:S,T=w[1].data||{},O=T.snippets,x=void 0===O?[]:O,N=T.total,_=void 0===N?0:N,P=(w[2].data||{}).stats,I=void 0===P?{}:P,L=function(){var e,t=(e=Bt().mark((function e(){return Bt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h(!0),e.next=3,b.invalidateQueries({queryKey:v});case 3:b.invalidateQueries({queryKey:g}),b.invalidateQueries({queryKey:E}),h(!1);case 6:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Ht(a,r,o,i,c,"next",e)}function c(e){Ht(a,r,o,i,c,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),A=(0,p.n)({mutationFn:We,onSuccess:function(e){L(),l(e.snippet),null==t||t()},onError:function(e){return a(e.message)}}),k=(0,p.n)({mutationFn:Ke,onSuccess:function(){L(),null==n||n()},onError:function(e){return a(e.message)}}),C=(0,p.n)({mutationFn:qe,onSuccess:function(){L(),l(null),null==r||r()}}),j=(0,p.n)({mutationFn:$e,onSuccess:function(e){var t=e.result;return o(t)},onError:function(e){return a(e.message)}}),D=(0,p.n)({mutationFn:Ye,onSuccess:function(){L(),null==t||t()},onError:function(e){return a(e.message)}}),G=A.isLoading||k.isLoading||C.isLoading||D.isLoading||j.isLoading||f||Me,M=qt((function(){if(!c)return console.log("Snippet is not savable: editSnippet is null or undefined"),!1;if(null!=c&&c.functionNotValid)return console.log("Snippet is not savable: functionNotValid is true"),!1;if(null!=c&&c.functionError)return console.log("Snippet is not savable: functionError is true"),!1;if(null===(null==c?void 0:c.id)){var e=c.name&&c.code;return e||console.log("Snippet is not savable: name or code is missing for new snippet"),e}var t=x.find((function(e){return e.id===c.id})),n=Pt(t,c);return n||console.log("Snippet is not savable: no changes detected. Snippet:",t,"Edit Snippet:",c),n}),[x,c]),F=qt((function(){if(!c)return!1;if(null===(null==c?void 0:c.id))return Pt(kt,c);var e=x.find((function(e){return e.id===c.id}));return Pt(e,c)}),[x,c]);return{isProcessing:G,snippets:x,total:_,tags:R,stats:I,onImportCodeSnippets:D.mutate,onCreate:A.mutate,onUpdate:k.mutate,onDelete:C.mutate,onSave:function(e){return null===e.id?A.mutate(e):k.mutate(e)},onCancel:function(e){var t;return l(null!==(t=x.find((function(t){return t.id===e.id})))&&void 0!==t?t:kt)},onDuplicate:function(e){return A.mutate(Ft(Ft({},e),{},{id:null,endpoint:""}))},onRunTestOnFunctionSnippet:j.mutate,onRefresh:function(){return L()},tableFilters:m,setTableFilters:y,editSnippet:c,setEditSnippet:l,isSavable:M,isResetable:F}},Jt=n(8696),Qt=n(309),Xt=n(8668),Zt=n(1594),en=n(4783),tn=n(106),nn=n(3720),rn=n(7967),on=n(1419),an=n(1638),cn=n(6898),ln=n(5230);function un(e){return un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},un(e)}function sn(){sn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new I(r||[]);return o(i,"_invoke",{value:x(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(L([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==un(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function x(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(un(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},T(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function fn(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function pn(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){fn(a,r,o,i,c,"next",e)}function c(e){fn(a,r,o,i,c,"throw",e)}i(void 0)}))}}function hn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||dn(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function dn(e,t){if(e){if("string"==typeof e)return mn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mn(e,t):void 0}}function mn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var yn,vn,gn=(0,tn.a)({theme:"light",settings:{background:"#ffffff",foreground:"#75baff",caret:"#5d00ff",selection:"#036dd626",lineHighlight:"#8a91991a",gutterBackground:"#fff",gutterForeground:"#8a919966"},styles:[{tag:nn._A.comment,color:"#787b8099"},{tag:nn._A.variableName,color:"#0080ff"},{tag:nn._A.function(nn._A.variableName),color:"#daa520"},{tag:[nn._A.string,nn._A.special(nn._A.brace)],color:"#ff4500"},{tag:nn._A.number,color:"#2e8b57"},{tag:nn._A.bool,color:"#8b0000"},{tag:nn._A.null,color:"#8b008b"},{tag:nn._A.keyword,color:"#00008b"},{tag:nn._A.operator,color:"#daa520"},{tag:nn._A.className,color:"#8a2be2"},{tag:nn._A.definition(nn._A.typeName),color:"#5f9ea0"},{tag:nn._A.typeName,color:"#b22222"},{tag:nn._A.angleBracket,color:"#556b2f"},{tag:nn._A.tagName,color:"#ff8c00"},{tag:nn._A.attributeName,color:"#6b8e23"},{tag:nn._A.comment,color:"#787b8099"}]}),En=j.Ay.div(zt||(yn=["\n font-size: 13px;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n position: relative;\n\n overflow: auto;\n max-height: 76vh;\n\n\n .cm-readonly-prefix {\n background-color: #efefef;\n color: #818181 !important;\n user-select: none;\n padding: 4px;\n }\n\n /* Linting styles */\n .cm-gutter-lint {\n min-width: 20px;\n }\n\n .cm-lintRange-error {\n background-color: #fdd !important;\n }\n\n .cm-lintRange::before {\n content: '✖';\n color: #f00;\n font-size: 1.2em;\n position: absolute;\n margin-left: -20px;\n z-index: 999;\n }\n\n .cm-diagnosticText {\n color: #f00;\n font-size: 1.1em;\n }\n\n .cm-tooltip {\n border-radius: 3px;\n border: none;\n background-color: #fbfbfb;\n color: #f00;\n padding: 5px;\n }\n\n .cm-tooltip-below {\n box-shadow: 0px 8px 7px 0px rgba(0, 0, 0, 0.15);\n }\n\n .cm-diagnosticAction {\n background-color: var(--neko-blue);\n color: #fff;\n padding: 5px 8px;\n border-radius: 3px;\n cursor: pointer;\n }\n\n /* Loading indicator styles */\n .loading-indicator {\n position: absolute;\n top: 10px;\n right: 10px;\n }\n"],vn||(vn=yn.slice(0)),zt=Object.freeze(Object.defineProperties(yn,{raw:{value:Object.freeze(vn)}})))),bn=function(e){var t=e.code,n=e.snippet,r=e.setCode,o=e.setFunctionError,a=void 0===o?null:o,i=(e.isModal,hn((0,Zt.useState)(t||""),2)),c=i[0],l=i[1],u=hn((0,Zt.useState)(!1),2),s=u[0],f=u[1],p=hn((0,Zt.useState)(""),2),h=p[0],d=p[1],m=hn((0,Zt.useState)([]),2),y=m[0],v=m[1],g=(0,Zt.useRef)(null);(0,Zt.useEffect)((function(){n&&n.externalCode&&n.externalCode!==c&&l(n.externalCode)}),[n]);var E=(0,Zt.useCallback)(function(){var e=pn(sn().mark((function e(t){var r,o,i,c,l;return sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!==n.scope||"js"!==(null==n?void 0:n.functionTarget)){e.next=3;break}return null==a||a(!1),e.abrupt("return",[]);case 3:if("content_js"!==n.scope){e.next=6;break}return null==a||a(!1),e.abrupt("return",[]);case 6:if((r=t.state.doc.toString())!==h){e.next=9;break}return e.abrupt("return",y);case 9:return f(!0),null==a||a(!0),e.prev=11,o=r,"php"===(null==n?void 0:n.functionTarget)&&(o="<?php\n"+o),e.next=16,Je({code:o,snippet:n});case 16:if(i=e.sent,f(!1),d(r),!i.result){e.next=27;break}return c=i.result,l=[{from:t.state.doc.line(c.attributes.startLine).from,to:t.state.doc.line(c.attributes.endLine).to,severity:"error",message:c.message,actions:[{name:"AI Correction",apply:function(){}}]}],v(l),null==a||a(!0),e.abrupt("return",l);case 27:return null==a||a(!1),v([]),e.abrupt("return",[]);case 30:e.next=36;break;case 32:return e.prev=32,e.t0=e.catch(11),f(!1),e.abrupt("return",[]);case 36:case"end":return e.stop()}}),e,null,[[11,32]])})));return function(t){return e.apply(this,arguments)}}(),[n,h,y]),b=(0,Zt.useCallback)((function(e,t){"string"==typeof e&&(l(e),r(e))}),[r]),w=(0,Zt.useMemo)((function(){var e,t=an.Pe.define(),n=an.sU.define({create:function(){return y},update:function(e,n){var r,o=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=dn(e))){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,i=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){i=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(i)throw o}}}}(n.effects);try{for(o.s();!(r=o.n()).done;){var a=r.value;if(a.is(t))return a.value}}catch(e){o.e(e)}finally{o.f()}return e}}),r=(0,on.bu)((function(e){return e.state.field(n)}));return[(0,rn.Q2)(),n,r,cn.w4.of([ln.Yc]),cn.Lz.lineWrapping,cn.Lz.updateListener.of((function(e){e.docChanged&&(g.current=e.view)})),cn.Lz.domEventHandlers({blur:(e=pn(sn().mark((function e(n,r){var o;return sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,E(r);case 2:o=e.sent,r.destroyed||r.dispatch({effects:t.of(o)});case 4:case"end":return e.stop()}}),e)}))),function(t,n){return e.apply(this,arguments)})})]}),[n,y]);return React.createElement(En,null,React.createElement(en.Ay,{value:c,onChange:b,onKeyDown:function(e){9===e.keyCode&&e.preventDefault()},theme:gn,extensions:w,maxHeight:"100%",minHeight:"300px",overflow:"auto",basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightActiveLine:!0,foldGutter:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightSelectionMatches:!0}}),s&&React.createElement("div",{className:"loading-indicator"},React.createElement("span",null,"Checking code...")))};function wn(e){return wn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wn(e)}function Sn(){Sn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new I(r||[]);return o(i,"_invoke",{value:x(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(L([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==wn(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function x(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(wn(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},T(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function Rn(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function Tn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var On=wp.element.useState,xn="".concat(P,"/images/wand.png"),Nn=function(e){var t=e.code,n=e.setCode,r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Tn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(On(!1),2),o=r[0],a=r[1],i=function(){var e,t=(e=Sn().mark((function e(t){var r;return Sn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a(!0),e.next=3,(0,R.IU)("".concat(N,"/ai_read_comments"),{method:"POST",json:{code:t},nonce:A});case 3:(r=e.sent).success?(console.log("AI Suggestions",r.code),n(r.code)):console.error("AI Suggestions",r.message),a(!1);case 6:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Rn(a,r,o,i,c,"next",e)}function c(e){Rn(a,r,o,i,c,"throw",e)}i(void 0)}))});return function(e){return t.apply(this,arguments)}}();return React.createElement(w.M,{disabled:!t||!t.includes("//"),isBusy:o,onClick:function(){return i(t)}},React.createElement("img",{src:xn,style:{width:"20px",height:"20px",marginRight:"5px"}}),be.SETTINGS.SNIPPET.READ_COMMENTS)};function _n(e){return _n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_n(e)}function Pn(){Pn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new I(r||[]);return o(i,"_invoke",{value:x(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(L([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==_n(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function x(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(_n(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},T(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function In(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function Ln(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return An(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?An(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function An(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var kn=wp.element.useState,Cn=("".concat(P,"/images/wand.png"),function(e){var t=e.setCode,n=e.close,r=e.snippet,o=Ln(kn(!1),2),a=o[0],i=o[1],c=Ln(kn(""),2),l=c[0],u=c[1],s=Ln(kn(""),2),f=s[0],p=s[1],h=Ln(kn(!1),2),d=h[0],m=h[1],y=Ln(kn(!1),2),v=y[0],g=y[1],E=function(){var e,t=(e=Pn().mark((function e(t){var n;return Pn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i(!0),e.next=3,(0,R.IU)("".concat(N,"/ai_query"),{method:"POST",json:{code:t,query:l},nonce:A});case 3:(n=e.sent).success?(console.log("AI Suggestions",n.code),p(n.code),m(!0)):console.error("AI Suggestions",n.message),i(!1);case 6:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){In(a,r,o,i,c,"next",e)}function c(e){In(a,r,o,i,c,"throw",e)}i(void 0)}))});return function(e){return t.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement(Rt.m,{value:l,onChange:function(e){return u(e)},disabled:a,rows:2}),React.createElement(wt.g,{tiny:!0}),React.createElement("div",{style:{display:"flex"}},React.createElement(w.M,{style:{flex:1},className:"secondary",onClick:n},be.COMMON.CANCEL),React.createElement(w.M,{style:{flex:4},className:"primary",isBusy:a,onClick:function(){return E(r.code)}},be.SETTINGS.SNIPPET.RUN)),React.createElement(we.n,{isOpen:d,title:be.SETTINGS.SNIPPET.MODIFY_BEFORE_USE,contentWidth:"800px",style:{minWidth:"800px",maxWidth:"800px"},content:React.createElement("div",{style:{height:"calc(100vh - 200px)",overflow:"auto"}},v&&React.createElement(dt.X,{variant:"danger"},"⚠️ It looks like there is an error in your code."),React.createElement(bn,{snippet:r,code:f,setFunctionError:function(e){g(e)},setCode:function(e){return p(e)}})),onRequestClose:function(){return m(!1)},okButton:{label:be.COMMON.SAVE,disabled:v,onClick:function(){t(f),m(!1),n()}},cancelButton:{label:be.COMMON.CANCEL,onClick:function(){return m(!1)}}}))});function jn(e){return jn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jn(e)}function Dn(){Dn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new I(r||[]);return o(i,"_invoke",{value:x(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(L([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==jn(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function x(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(jn(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},T(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function Gn(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function Mn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Fn,Un=wp.element,Bn=Un.useState,Hn=Un.useEffect,Vn=function(){var e=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Mn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Bn("..."),2),t=e[0],n=e[1];Hn((function(){r()}),[]);var r=function(){var e,t=(e=Dn().mark((function e(){var t;return Dn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/server_clock"),{method:"GET",nonce:A});case 2:(t=e.sent).success?(console.log("Wordpress Clock",t.code),n(t.time)):console.error("Wordpress Clock",t.message);case 4:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Gn(a,r,o,i,c,"next",e)}function c(e){Gn(a,r,o,i,c,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}();return React.createElement("b",null,t)},Yn=n(9985),zn=n(4756);function Wn(e){return Wn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wn(e)}function Kn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kn(Object(n),!0).forEach((function(t){$n(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function $n(e,t,n){return(t=function(e){var t=function(e){if("object"!=Wn(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Wn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Wn(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jn(){Jn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new I(r||[]);return o(i,"_invoke",{value:x(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(L([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==Wn(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function x(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Wn(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},T(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function Qn(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function Xn(e){return function(e){if(Array.isArray(e))return tr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||er(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Zn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||er(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function er(e,t){if(e){if("string"==typeof e)return tr(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tr(e,t):void 0}}function tr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var nr,rr,or,ar=wp.element,ir=ar.useState,cr=ar.useEffect,lr="".concat(P,"/images/wand.png"),ur=(0,j.Ay)(Yn.A)(Fn||(Fn=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n padding: 0px;\n border: 1px solid #e0e0e0;\n max-height: 140px;\n margin-top: 5px;\n\n code, pre {\n font-size: 13px;\n font-weight: 500;\n background: none;\n padding: 0px !important;\n overflow-x: hidden !important;\n }\n"]))),sr=function(e){var t,n,r,o,a,i,c=e.isInline,l=void 0!==c&&c,u=e.onClose,s=e.busy,f=e.isSavable,p=e.onSave,m=e.editSnippet,y=e.setEditSnippet,v=$t({onRanSnippet:function(e){return console.log((0,R.g7)(be.SETTINGS.SUCCESSFULLY_RAN,e))},onTestedSnippet:function(e){return V(e)},onError:x}),g=v.onRunTestOnFunctionSnippet,E=v.isProcessing,T=Zn(ir(!1),2),O=T[0],x=T[1],P=Zn(ir([]),2),I=P[0],L=P[1],A=Zn(ir(null),2),k=A[0],C=A[1],j=Zn(ir(!1),2),D=j[0],G=j[1],M="function"===(null==m?void 0:m.scope),F=(M&&(null==m||m.functionTarget),M&&"js"===(null==m?void 0:m.functionTarget)),U="scheduled"===(null==m?void 0:m.scope),B="content_php"===(null==m?void 0:m.scope)||"content_js"===(null==m?void 0:m.scope),H=null!==(t=(null==m||null===(n=m.functionArgs)||void 0===n?void 0:n.length)>0&&!(1===(null==m||null===(r=m.functionArgs)||void 0===r?void 0:r.length)&&""===(null==m||null===(o=m.functionArgs)||void 0===o?void 0:o[0])))&&void 0!==t&&t,V=function(e){var t=(new Date).toLocaleTimeString();if(null!=e&&e.error)L([].concat(Xn(I),[{message:"["+t+"] "+e.error,color:"#ffce44"}]));else{var n=e.return.map((function(e){return{message:"["+t+"] "+e,color:"#00ff51"}}));L([].concat(Xn(I),Xn(n)))}},Y=ht().actions.getOption,z=function(){var e,t=(e=Jn().mark((function e(t){return Jn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p(t);case 2:u();case 3:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Qn(a,r,o,i,c,"next",e)}function c(e){Qn(a,r,o,i,c,"throw",e)}i(void 0)}))});return function(e){return t.apply(this,arguments)}}();cr((function(){if(M&&null!=m&&m.code){if("js"===(null==m?void 0:m.functionTarget))return;null!=m&&m.functionTarget||y((function(e){return qn(qn({},e),{},{functionTarget:"php"})}));var e=m.code,t=(e=(e=(e=e.replace(/^<\?php\s/,"")).replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,"$1")).trim().replace(/\n/g,"")).match(/^function\s+(\w+)\s*\((.*?)\)\s*{([\s\S]*)}\s*$/);if(!t)return x("Invalid PHP Function."),void y((function(e){return qn(qn({},e),{},{functionNotValid:!0,functionArgs:[],name:""})}));var n=Zn(t,4),r=(n[0],n[1]),o=n[2],a=(n[3],o?o.split(",").map((function(e){return e.trim()})):[]);if(a.some((function(e){return e.includes("=")||e.includes("?")||e.includes(" ")})))return x("Don't use typed arguments in PHP functions. Declare them as normal variables ( e.g. $arg1, $arg2 ). Go into the “Callable” tab and define the types and default values there instead."),void y((function(e){return qn(qn({},e),{},{functionNotValid:!0,functionArgs:[],name:""})}));y((function(e){return qn(qn({},e),{},{functionName:r,functionNotValid:!1,functionArgs:a,name:(null==m?void 0:m.name)||r})})),x(!1)}}),[null==m?void 0:m.code,M,null==m?void 0:m.functionTarget]),cr((function(){if(M&&null!=m&&m.code){if("php"===(null==m?void 0:m.functionTarget))return;var e=m.code,t=(e=(e=(e=e.replace(/^<script>\s*/,"").replace(/\s*<\/script>$/,"")).replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,"$1")).trim()).match(/^(function\s+(\w+)\s*\((.*?)\)\s*{([\s\S]*)})\s*$|^(const|let|var)?\s*(\w+)\s*=\s*(\((.*?)\)|(\w+))\s*=>\s*({([\s\S]*)}|\S.*)\s*$/);if(t&&t[0]===e){var n,r;if(t[1]){var o=Zn(t,5);_=o[0],_=o[1],n=o[2],r=o[3],o[4]}else{var a=Zn(t,10);_=a[0],_=a[1],_=a[2],_=a[3],_=a[4],_=a[5],n=a[6],_=a[7];var i=a[8];r=void 0===i?t[9]:i;var c=a[9];void 0===c&&(t[10]||t[11])}y((function(e){return qn(qn({},e),{},{functionName:n,functionNotValid:!1,functionArgs:r?r.split(",").map((function(e){return e.trim()})):[],name:(null==m?void 0:m.name)||n})})),x(!1)}else x("Invalid JavaScript Function. Ensure the function is the only code present."),y((function(e){return qn(qn({},e),{},{functionNotValid:!0,functionArgs:[],name:""})}))}}),[null==m?void 0:m.code,M,null==m?void 0:m.functionTarget]),cr((function(){M&&y((function(e){return qn(qn({},e),{},{name:(null==m?void 0:m.name)||(null==m?void 0:m.functionName)})}))}),[null==m?void 0:m.name,null==m?void 0:m.functionName,M]),cr((function(){U&&(null==m?void 0:m.intervalTime)<=0&&y((function(e){return qn(qn({},e),{},{intervalTime:1})}))}),[null==m?void 0:m.intervalTime,U]);var W,K,q,$=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return React.createElement(d.d,{title:e,style:qn({flexDirection:"column"},n)},React.createElement(wt.g,{tiny:!0}),t)},J=function(e){if(e)return!!isNaN(e)&&!/^["'].*["']$/.test(e)},Q=function(e){var t=e.arg,n=e.key;return React.createElement(React.Fragment,null,React.createElement(dt.X,{variant:"warning"},be.SETTINGS.STRING_VALUE_WARNING),React.createElement("div",{style:{position:"relative",width:"max-content",left:"200px",bottom:"23px",border:"3px solid white",borderRadius:"5px"}},React.createElement(w.M,{icon:"pencil",onClick:function(){var e;return y(qn(qn({},m),{},{functionArgsDict:qn(qn({},m.functionArgsDict),{},$n({},t,qn(qn({},m.functionArgsDict[t]),{},$n({},n,'"'.concat(null===(e=m.functionArgsDict[t])||void 0===e?void 0:e[n],'"')))))}))}}," ",be.SETTINGS.ADD_QOUTES," ")))},X=function(){var e,t;return(null==m||null===(e=m.functionArgsDict)||void 0===e||null===(e=e[k])||void 0===e?void 0:e.input)||(null==m||null===(t=m.functionArgsDict)||void 0===t||null===(t=t[k])||void 0===t?void 0:t.default)||""};return React.createElement("div",{style:{display:"flex",flexDirection:l?"column":"row",gap:"15px"}},React.createElement(S.z,{busy:s,style:{maxHeight:"100%",overflow:"hidden",flex:"auto",marginBottom:0},contentStyle:{maxHeight:"75vh",maxWidth:"100%"}},M&&O&&React.createElement(dt.X,{variant:"danger"},"⚠️ ",O),React.createElement(bn,{isModal:!l,code:null==m?void 0:m.code,snippet:m,setCode:function(e){y(qn(qn({},m),{},{code:e}))},setFunctionError:function(e){y(qn(qn({},m),{},{functionError:e}))}})),Y("ai_suggestions",!1)&&React.createElement("div",{style:{flex:1}},D&&React.createElement(S.z,{style:{marginTop:15}},React.createElement(Cn,{snippet:m,close:function(){return G(!1)},setCode:function(e){y(qn(qn({},m),{},{externalCode:e}))}})),!D&&React.createElement(Et.V,{style:{display:"flex",marginTop:15}},React.createElement(w.M,{className:"primary",disabled:s,onClick:function(){return G(!D)}},React.createElement("img",{src:lr,alt:"Wand",style:{width:"20px",height:"20px",marginRight:"5px"}}),"Query AI"),React.createElement(Nn,{code:null==m?void 0:m.code,setCode:function(e){return y(qn(qn({},m),{},{externalCode:e}))}}))),React.createElement("div",{style:{flex:"1",minWidth:"300px",maxWidth:"100%",maxHeight:"100%"}},React.createElement(St.A,{style:{flex:"1",minWidth:"300px",maxWidth:"100%",maxHeight:"800px",overflow:"auto"}},React.createElement(b._,{inversed:!0,keepTabOnReload:!0},React.createElement(b.V,{title:be.SETTINGS.SNIPPET.LABEL,key:"snippet"},React.createElement(React.Fragment,null,$(be.SETTINGS.SNIPPET.NAME,React.createElement(Jt.A,{name:"name",disabled:s,value:null==m?void 0:m.name,onBlur:function(e){return y(qn(qn({},m),{},{name:e}))}})),$(be.SETTINGS.SNIPPET.DESCRIPTION,React.createElement(Jt.A,{name:"description",value:null==m?void 0:m.description,disabled:s,onBlur:function(e){return y(qn(qn({},m),{},{description:e}))}})),React.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px",marginBottom:10}},$(be.SETTINGS.SNIPPET.TYPE,React.createElement(mt.u,{fullWidth:!0,name:"scope",scrolldown:!0,value:null==m?void 0:m.scope,disabled:s,onChange:function(e){return y(qn(qn({},m),{},{scope:e}))}},null==Lt?void 0:Lt.map((function(e){return React.createElement(mt.j,{key:e.value,id:e.value,value:e.value,label:e.label})}))),{marginTop:0,flex:"1 1 135px",minWidth:0}),M&&$(be.SETTINGS.SNIPPET.TARGET,React.createElement(mt.u,{fullWidth:!0,name:"target",scrolldown:!0,value:null==m?void 0:m.functionTarget,onChange:function(e){return y(qn(qn({},m),{},{functionTarget:e}))}},React.createElement(mt.j,{id:"php",value:"php",label:"PHP (backend)"}),React.createElement(mt.j,{id:"js",value:"js",label:"JS (frontend)"})),{marginTop:0,flex:"1 1 135px",minWidth:0}),$(be.SETTINGS.SNIPPET.PRIORITY,React.createElement(Jt.A,{name:"priority",type:"number",value:null==m?void 0:m.priority,disabled:s,onBlur:function(e){y(qn(qn({},m),{},{priority:e}))}}),{marginTop:0,flex:"1 1 135px",minWidth:0})),U&&React.createElement(React.Fragment,null,React.createElement("div",{style:{display:"flex",gap:"10px",marginBottom:10}},$(be.SETTINGS.SNIPPET.TARGET_TIME,React.createElement(Jt.A,{name:"interval_hours",type:"number",value:null==m?void 0:m.intervalHours,disabled:s,max:23,min:0,onBlur:function(e){return y(qn(qn({},m),{},{intervalHours:e}))},description:be.SETTINGS.SNIPPET.HOURS}),{marginTop:0,flex:1}),$(" ",React.createElement(Jt.A,{name:"interval_minutes",type:"number",value:null==m?void 0:m.intervalMinutes,disabled:s,max:59,min:0,onBlur:function(e){return y(qn(qn({},m),{},{intervalMinutes:e}))},description:be.SETTINGS.SNIPPET.MINUTES}),{marginTop:0,flex:1})),React.createElement("small",null,"The action will trigger when someone visits your WordPress site if the scheduled time has passed. For your WordPress server the time is ",React.createElement(Vn,null),". "),React.createElement(wt.g,{tiny:!0})),B&&React.createElement(React.Fragment,null,!(null!=m&&m.id)&&"Once you save the snippet an ID will be generated."," You can use this ID to embed the snippet in your content.",React.createElement(Qt.H,{prefix:"code-engine",params:{id:null==m?void 0:m.id}})),$(be.SETTINGS.SNIPPET.TAGS,React.createElement(Jt.A,{isCommaSeparatedArray:!0,name:"tags",value:null==m?void 0:m.tags,disabled:s,onFinalChange:function(e){return y(qn(qn({},m),{},{tags:e}))},description:be.SETTINGS.SNIPPET.TAGS_DESCRIPTION})),l&&React.createElement(w.M,{className:"primary",disabled:s||!f,style:{marginTop:"10px"},onClick:function(){return z(m)}},be.COMMON.SAVE))),M&&React.createElement(b.V,{title:be.SETTINGS.SNIPPET.SCOPES.FUNCTION,key:"function"},$(be.SETTINGS.SNIPPET.NAME,React.createElement(Jt.A,{name:"name",disabled:!0,value:null==m?void 0:m.functionName,onChange:function(e){return y(qn(qn({},m),{},{functionName:e}))}})),$(be.SETTINGS.SNIPPET.BEHAVIOR,React.createElement(mt.u,{fullWidth:!0,name:"behavior",scrolldown:!0,value:null==m?void 0:m.functionBehavior,description:be.SETTINGS.SNIPPET[null!=m&&m.functionBehavior?"BEHAVIOR_".concat(m.functionBehavior.toUpperCase()):"BEHAVIOR_DYNAMIC"],onChange:function(e){return y(qn(qn({},m),{},{functionBehavior:e}))}},React.createElement(mt.j,{id:"dynamic",value:"dynamic",label:"Dynamic"}),React.createElement(mt.j,{id:"static",value:"static",label:"Static"}))),React.createElement(Xt.aD,null,null==m||null===(a=m.functionArgs)||void 0===a?void 0:a.map((function(e){return""===e||"js"!==(null==m?void 0:m.functionTarget)&&"$"!==e[0]?null:React.createElement(Xt.YQ,{key:e,title:e},(t=e,React.createElement(React.Fragment,null,$(be.SETTINGS.SNIPPET.NAME,React.createElement(Jt.A,{disabled:!0,name:"name",value:t})),$(be.SETTINGS.SNIPPET.TYPE,React.createElement(mt.u,{fullWidth:!0,name:"type",scrolldown:!0,value:null==m||null===(n=m.functionArgsDict)||void 0===n||null===(n=n[t])||void 0===n?void 0:n.type,onChange:function(e){return y(qn(qn({},m),{},{functionArgsDict:qn(qn({},m.functionArgsDict),{},$n({},t,qn(qn({},m.functionArgsDict[t]),{},{type:e})))}))}},React.createElement(mt.j,{id:"string",value:"string",label:"String"}),React.createElement(mt.j,{id:"number",value:"number",label:"Number"}),React.createElement(mt.j,{id:"boolean",value:"boolean",label:"Boolean"}),React.createElement(mt.j,{id:"array",value:"array",label:"Array"}),React.createElement(mt.j,{id:"object",value:"object",label:"Object"}),React.createElement(mt.j,{id:"mixed",value:"mixed",label:"Mixed"}))),$(be.SETTINGS.SNIPPET.DESCRIPTION,React.createElement(Jt.A,{disabled:s,name:"desc",value:null==m||null===(r=m.functionArgsDict)||void 0===r||null===(r=r[t])||void 0===r?void 0:r.desc,onBlur:function(e){return y(qn(qn({},m),{},{functionArgsDict:qn(qn({},m.functionArgsDict),{},$n({},t,qn(qn({},m.functionArgsDict[t]),{},{desc:e})))}))}})),$(be.SETTINGS.SNIPPET.DEFAULT_VALUE,React.createElement(Jt.A,{disabled:s,name:"default",value:null==m||null===(o=m.functionArgsDict)||void 0===o||null===(o=o[t])||void 0===o?void 0:o.default,onBlur:function(e){return y(qn(qn({},m),{},{functionArgsDict:qn(qn({},m.functionArgsDict),{},$n({},t,qn(qn({},m.functionArgsDict[t]),{},{default:e})))}))}})),!Y("sanitize_arguments",!0)&&J(null==m||null===(a=m.functionArgsDict)||void 0===a||null===(a=a[t])||void 0===a?void 0:a.default)&&Q({arg:t,key:"default"}))));var t,n,r,o,a}))),!H&&React.createElement(dt.X,{variant:"info"},"No parameters in the function")),React.createElement(b.V,{title:be.SETTINGS.SNIPPET.TEST,key:"test"},React.createElement(w.M,{className:"primary",disabled:s||E,style:{width:"100%"},onClick:function(){var e=(new Date).toLocaleTimeString();if(L([{message:"["+e+"] Running test...",color:"white"}]),"function"!==(null==m?void 0:m.scope)||"js"!==(null==m?void 0:m.functionTarget))if("content_js"!==(null==m?void 0:m.scope))g({scope:null==m?void 0:m.scope,code:null==m?void 0:m.code,name:null==m?void 0:m.functionName,args:(null==m?void 0:m.functionArgs)||[],values:(null==m?void 0:m.functionArgsDict)||{}});else try{var t=null==m?void 0:m.code.replace(/<script>|<\/script>/g,"").trim(),n=new Function("\n function mwcode_content_js() {\n ".concat(t,"\n }\n return mwcode_content_js;\n "))(),r=[],o=console.log;console.log=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.push(t.join(" ")),o.apply(console,t)};var a=n();console.log=o;var i=[].concat(r,[JSON.stringify(a)]);V({return:i})}catch(e){V({error:e.toString()})}else try{var c,l=null==m?void 0:m.code.replace(/<script>|<\/script>/g,"").trim(),u=new Function("\n ".concat(l,"\n return ").concat(null==m?void 0:m.functionName,";\n "))(),s=(null==m||null===(c=m.functionArgs)||void 0===c?void 0:c.map((function(e){var t,n;return(null==m||null===(t=m.functionArgsDict)||void 0===t||null===(t=t[e])||void 0===t?void 0:t.input)||(null==m||null===(n=m.functionArgsDict)||void 0===n||null===(n=n[e])||void 0===n?void 0:n.default)||null})))||[],f=[],p=console.log;console.log=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];f.push(t.join(" ")),p.apply(console,t)};var h=u.apply(void 0,Xn(s));console.log=p;var d=[].concat(f,[JSON.stringify(h)]);V({return:d})}catch(e){V({error:e.toString()})}}},"Run Test"),React.createElement("div",{style:At},null==I?void 0:I.map((function(e,t){return React.createElement("div",{key:t,style:{color:null==e?void 0:e.color}},null==e?void 0:e.message)}))),H&&M&&React.createElement(React.Fragment,null,React.createElement(wt.g,null),React.createElement(mt.u,{fullWidth:!0,name:"function_test_args",scrolldown:!0,value:k,onChange:function(e){return C(e)}},null==m||null===(i=m.functionArgs)||void 0===i?void 0:i.map((function(e){return React.createElement(mt.j,{key:e,id:e,value:e,label:e})}))),k&&React.createElement(React.Fragment,null,React.createElement(wt.g,{tiny:!0}),React.createElement(Jt.A,{name:"test_arg_value",value:X(),onChange:function(e){return y(qn(qn({},m),{},{functionArgsDict:qn(qn({},m.functionArgsDict),{},$n({},k,qn(qn({},m.functionArgsDict[k]),{},{input:e})))}))}}),!Y("sanitize_arguments",!0)&&J(X())&&React.createElement(React.Fragment,null,React.createElement(wt.g,null),Q({arg:k,key:"input"})))),React.createElement(React.Fragment,null,React.createElement(wt.g,null),React.createElement(dt.X,{variant:"info"},(0,R.FE)(be.SETTINGS.SNIPPET.TEST_PARAMETERS_DESCRIPTION_LOG),H&&React.createElement(React.Fragment,null,React.createElement("br",null),(0,R.FE)(be.SETTINGS.SNIPPET.TEST_PARAMETERS_DESCRIPTION_ARG))))),Y("api_endpoint",!1)&&M&&!F&&React.createElement(b.V,{title:be.SETTINGS.SNIPPET.PUBLIC_API,key:"public_api"},(W={},null!=m&&m.functionArgsDict&&Object.entries(m.functionArgsDict).forEach((function(e){var t=Zn(e,2),n=t[0],r=t[1];W[n.replace("$","")]=function(e,t){switch(e){case"boolean":return"true"===t;case"number":return Number(t)||0;case"array":try{return JSON.parse(t)||[]}catch(e){return[]}case"object":try{return JSON.parse(t)||{}}catch(e){return{}}default:return t||""}}(r.type,r.default)})),K=W,q=JSON.stringify(K,null,2),React.createElement(React.Fragment,null,React.createElement(dt.X,{variant:"warning"},be.SETTINGS.SNIPPET.PUBLIC_API_DESCRIPTION),React.createElement(wt.g,null),$(be.SETTINGS.SNIPPET.ENDPOINT,React.createElement(Jt.A,{name:"endpoint",value:null==m?void 0:m.endpoint,onChange:function(e){return y(qn(qn({},m),{},{endpoint:e}))}})),React.createElement("div",null,!(null==m||!m.endpoint)&&React.createElement(h.s,{p:!0},(0,R.FE)((0,R.g7)(be.SETTINGS.SNIPPET.ENDPOINT_URL,"".concat(N,"/snippets-endpoint/").concat(m.endpoint))))),(null==m?void 0:m.endpoint)&&(null==m?void 0:m.endpoint.length)>0&&React.createElement(React.Fragment,null,React.createElement(wt.g,null),$(be.SETTINGS.SNIPPET.METHOD,React.createElement(mt.u,{fullWidth:!0,name:"method",scrolldown:!0,value:null==m?void 0:m.method,onChange:function(e){return y(qn(qn({},m),{},{method:e}))}},React.createElement(mt.j,{id:"GET",value:"GET",label:"GET"}),React.createElement(mt.j,{id:"POST",value:"POST",label:"POST"}),React.createElement(mt.j,{id:"PUT",value:"PUT",label:"PUT"}),React.createElement(mt.j,{id:"DELETE",value:"DELETE",label:"DELETE"}))),React.createElement(wt.g,null),React.createElement(Xt.aD,null,React.createElement(Xt.YQ,{title:"Example (JS Fetch)"},React.createElement(ur,{language:"javascript",style:zn.A},'fetch("'.concat(N,"/snippets-endpoint/").concat(m.endpoint,'", {\n method: "').concat(m.method,'",\n headers: {\n "Content-Type": "application/json",\n "Authorization": "Bearer YOUR_API_TOKEN"\n },\n body: JSON.stringify(').concat(q,")\n })\n .then(response => response.json())\n .then(data => console.log(data))\n .catch(error => console.error('Error:', error));"))),React.createElement(wt.g,null),React.createElement(Xt.YQ,{title:"Example (CURL)"},React.createElement(ur,{language:"bash",style:zn.A},"curl -X ".concat(m.method,' "').concat(N,"/snippets-endpoint/").concat(m.endpoint,'" \\\n -H "Content-Type: application/json" \\\n -H "Authorization: Bearer YOUR_API_TOKEN" \\\n -d \'').concat(JSON.stringify(K),"'"))))))))))))},fr=n(1997),pr=n(7428);function hr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var dr,mr=j.Ay.div(nr||(nr=hr(["\n display: flex;\n flex-direction: column;\n line-height: 1;\n opacity: ",";\n filter: ",";\n pointer-events: ",";\n \n .snippet-header {\n display: flex;\n flex-direction: column;\n }\n .snippet-title,\n .snippet-description,\n .snippet-endpoint {\n margin: 2px 0;\n padding: 0;\n }\n .snippet-title {\n font-size: 14px;\n cursor: ",";\n font-weight: 600;\n color: ",";\n }\n .snippet-description {\n color: ",";\n font-size: var(--neko-small-font-size);\n }\n .snippet-endpoint {\n color: ",";\n }\n .code-container {\n border-radius: 5px;\n overflow: auto;\n white-space: pre-wrap;\n word-wrap: break-word;\n }\n .snippet-footer {\n background: ",";\n }\n"])),(function(e){return e.active?1:.5}),(function(e){return e.active?"none":"grayscale(100%)"}),(function(e){return e.active?"auto":"none"}),(function(e){return e.active?"pointer":"default"}),(function(e){return e.active?"inherit":"var(--neko-gray-60)"}),(function(e){return e.active?"var(--neko-gray-60)":"var(--neko-gray-40)"}),(function(e){return e.active?"#a8a8a8":"#c8c8c8"}),(function(e){return e.active?"#f9f9f9":"#f0f0f0"})),yr=(0,j.Ay)(Yn.A)(rr||(rr=hr(["\n padding: 0px;\n border: 1px solid #e0e0e0;\n max-height: 140px;\n margin-top: 5px;\n opacity: ",";\n filter: ",";\n code, pre {\n font-size: 13px;\n font-weight: 500;\n background: none;\n padding: 0px !important;\n overflow-x: hidden !important;\n }\n"])),(function(e){return e.active?1:.7}),(function(e){return e.active?"none":"grayscale(100%)"})),vr=j.Ay.div(or||(or=hr(["\n margin-right: 3px;\n width: 18px;\n height: 18px;\n vertical-align: middle;\n opacity: ",";\n filter: ",";\n \n svg {\n border-radius: 3px;\n width: 100%;\n height: 100%;\n }\n"])),(function(e){return e.active?1:.5}),(function(e){return e.active?"none":"grayscale(100%)"})),gr=function(e){var t=e.snippet,n=e.onEditClick,r=ht().actions.getOption,o=(null!=t&&t.functionArgsDict?Object.values(null==t?void 0:t.functionArgsDict):[]).some((function(e){return null===(null==e?void 0:e.type)||void 0===(null==e?void 0:e.type)})),a=t.endpoint&&t.method,i=r("ui_show_preview",!1)&&t.code,c=(null==t?void 0:t.functionTarget)&&(null==t?void 0:t.functionName),l="1"===t.active;return React.createElement(mr,{active:l},React.createElement("div",{className:"snippet-header"},React.createElement("div",{className:"snippet-info"},React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement(fr.f,{position:"top",text:null==t?void 0:t.functionName},React.createElement(vr,{active:l},"js"===(null==t?void 0:t.functionTarget)||"content_js"===(null==t?void 0:t.scope)?Dt:("php"===(null==t?void 0:t.functionTarget)||null==t||t.scope,jt))),React.createElement("a",{onClick:l?n:void 0,className:"snippet-title"},t.name)),React.createElement("p",{className:"snippet-description"},t.description))),i&&React.createElement("div",{className:"code-container"},React.createElement(yr,{language:"js"===(null==t?void 0:t.functionTarget)?"javascript":"php",style:zn.A,wrapLines:!0,wrapLongLines:!0,active:l},t.code)),(o||c||a)&&React.createElement(React.Fragment,null,React.createElement("div",{style:{flex:"auto"}}),React.createElement("div",{className:"snippet-footer"},o&&React.createElement(dt.X,{variant:"warning",style:{marginTop:5,padding:"8px 15px",opacity:l?1:.7}},"⚠️ ",be.SETTINGS.SNIPPET.MISSING_TYPE_WARNING))))},Er=function(e){var t=e.scope,n=It.find((function(e){var n;return e.value===t||(null===(n=e.childScopes)||void 0===n?void 0:n.includes(t))}));return n?React.createElement("div",{style:{padding:"0px 5px",borderRadius:"3px",background:n.color,fontSize:"10px",textTransform:"uppercase",color:"white",textAlign:"center"}},n.label):(console.warn('Code Engine: The scope "'.concat(t,'" is not supported.')),null)},br=function(e){var t=e.tags;return t?("string"==typeof t&&(t=t.split(",")),Array.isArray(t)?React.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"3px"}},t.map((function(e,t){if(e)return React.createElement(wr,{key:t,label:e})}))):null):null},wr=function(e){var t=e.label;return React.createElement("div",{style:{display:"flex",alignItems:"center",padding:"1px 5px",borderRadius:"5px",border:"1px solid rgb(142 156 164)",fontSize:"12px",color:"rgb(142 156 164)"}},t)};function Sr(e){return Sr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sr(e)}function Rr(e){return function(e){if(Array.isArray(e))return Or(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Tr(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Tr(e,t){if(e){if("string"==typeof e)return Or(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Or(e,t):void 0}}function Or(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function xr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Nr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xr(Object(n),!0).forEach((function(t){_r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _r(e,t,n){return(t=function(e){var t=function(e){if("object"!=Sr(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Sr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Sr(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Pr=wp.element,Ir=Pr.useState,Lr=Pr.useMemo,Ar="".concat(P,"/images/callable.svg"),kr="".concat(P,"/images/global-back.svg"),Cr="".concat(P,"/images/global-front.svg"),jr="".concat(P,"/images/global-front-back.svg"),Dr="".concat(P,"/images/scheduled.svg"),Gr="".concat(P,"/images/content.svg"),Mr=j.Ay.span(dr||(dr=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n font-size: 10px;\n padding: 2px 5px;\n border-radius: 3px;\n border: 1px solid black;\n color: black;\n"]))),Fr=function(e){var t=e.snippet,n=e.onClick,r="1"===t.active,o=t.scope,a=jr,i={width:36,height:36,cursor:"pointer"};return"persistent"===o?a=jr:"frontend"===o?a=Cr:"backend"===o?a=kr:"function"===o?a=Ar:"scheduled"===o?a=Dr:"content_php"===o||"content_js"===o?a=Gr:console.warn('Code Engine: The scope "'.concat(o,'" is not supported.')),r||(i=Nr(Nr({},i),{},{filter:"grayscale(100%)",opacity:.5})),React.createElement("img",{src:a,alt:o,style:i,onClick:n})},Ur=function(e){var t=e.busy,n=e.snippets,r=e.tags,o=e.toHide,a=void 0===o?[]:o,i=e.tableFilters,c=e.useInlineEditor,l=e.onEditSnippet,u=(e.onImportCodeSnippets,e.onSave),s=e.onDelete,f=e.onDuplicate,p=e.setTableFilters,h=e.currentScope,d=i.sort,m=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||Tr(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Ir([{accessor:"snippet",value:[]}]),2),y=m[0],v=m[1],g=Lr((function(){return n?n.map((function(e){var t=e.endpoint&&e.method,n=t?React.createElement(React.Fragment,null,N,"/snippets-endpoint/",React.createElement("strong",null,e.endpoint)):"";return{id:e.id,status:React.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},React.createElement(Fr,{snippet:e,onClick:function(){return l(e)}})),attributes:React.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},React.createElement(Er,{scope:e.scope}),t&&React.createElement(fr.f,{position:"top",text:e.method+" /"+e.endpoint},React.createElement("div",{style:{marginTop:3,cursor:"pointer"}},React.createElement(Mr,null,"API")))),snippet:React.createElement(React.Fragment,null,React.createElement(gr,{snippet:e,onEditClick:function(){return l(e)}}),"content_php"===e.scope||"content_js"===e.scope?React.createElement(Qt.H,{prefix:"code-engine",params:{id:null==e?void 0:e.id}}):"",React.createElement(br,{tags:e.tags})),functionName:React.createElement("div",null,React.createElement("div",{style:{display:"flex",marginTop:0}},e.functionName)),endpoint:React.createElement("div",null,n&&React.createElement(React.Fragment,null,React.createElement(Mr,null,e.method)," ",React.createElement("small",null,n))),enabled:React.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},React.createElement(yt.S,{small:!0,onLabel:"",offLabel:"",onValue:"1",offValue:"0",width:"34px",style:{marginRight:2},checked:"1"===e.active,onChange:function(t){return u(Nr(Nr({},e),{},{active:t}))}}),React.createElement(w.M,{rounded:!0,icon:"trash",title:be.COMMON.DELETE,className:"danger",style:{margin:2},onClick:function(){return s(e)}})),actions:React.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},c&&React.createElement(React.Fragment,null,React.createElement(w.M,{rounded:!0,title:be.COMMON.EDIT,icon:"pencil",className:"primary",style:{margin:2},onClick:function(){return l(e)}}),React.createElement(w.M,{rounded:!0,icon:"duplicate",title:be.COMMON.CLONE,className:"primary",style:{margin:2},onClick:function(){return f(e)}})),!c&&React.createElement(React.Fragment,null,React.createElement(w.M,{title:be.COMMON.EDIT,className:"primary",style:{margin:2},onClick:function(){return l(e)}},be.COMMON.EDIT),React.createElement(w.M,{title:be.COMMON.CLONE,className:"primary",style:{margin:2},onClick:function(){return f(e)}},be.COMMON.CLONE)))}})):[]}),[n,l,u,f,s]),E=Lr((function(){var e=[].concat(Rr(a),["all"!==h&&"disabled"!==h?"scope":""]).filter(Boolean);return Ct.map((function(e){if("snippet"===e.accessor){var t=r.filter(Boolean).map((function(e){return{value:e,label:e}}));return Nr(Nr({},e),{},{filters:Nr(Nr({},e.filters),{},{options:t})})}return e})).filter((function(t){return!e.includes(t.accessor)}))}),[r,a,h]);return React.createElement(React.Fragment,null,React.createElement(St.A,{busy:t},React.createElement(pr.o,{data:g,columns:E,selectedItems:[],sort:d,emptyMessage:t?be.COMMON.LOADING:React.createElement(React.Fragment,null,React.createElement("h3",null,be.COMMON.NO_RESULTS),React.createElement("p",null,"all"===h?"To get started, click the + button to add a new snippet, enable AI Suggestions in Settings to use Quick Start, or import your existing snippets from the Code Snippets plugin. Code Engine helps you manage PHP code snippets for backend hooks, frontend scripts, callable functions, and scheduled tasks.":'Click the + button above to create a new snippet, or switch to the "All" view for more options including importing from Code Snippets.')),filters:y,onSortChange:function(e,t){p(Nr(Nr({},i),{},{sort:{accessor:e,by:t}}))},onFilterChange:function(e,t){v([].concat(Rr(y.filter((function(t){return t.accessor!==e}))),[{accessor:e,value:t}])),p(Nr(Nr({},i),{},{page:1,filters:[].concat(Rr(i.filters.filter((function(t){return t.accessor!==e}))),[{accessor:e,value:t}])}))}})))};function Br(e){return Br="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Br(e)}function Hr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Vr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hr(Object(n),!0).forEach((function(t){Yr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Yr(e,t,n){return(t=function(e){var t=function(e){if("object"!=Br(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Br(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Br(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zr(){zr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new I(r||[]);return o(i,"_invoke",{value:x(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(L([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==Br(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function x(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Br(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},T(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function Wr(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function Kr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||qr(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qr(e,t){if(e){if("string"==typeof e)return $r(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$r(e,t):void 0}}function $r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Jr=wp.element,Qr=Jr.useState,Xr=Jr.useEffect,Zr=Jr.useMemo;const eo=function(){var e,t=ht(),n=t.actions,r=t.state,o=(0,s.z)().colors,a=n.getOption,i=n.updateOption,c=n.setError,l=r.isLoading,u=$t({onRanSnippet:function(e){return L((0,R.g7)(be.SETTINGS.SUCCESSFULLY_RAN,e))},onError:function(e){return c(e)}}),f=u.isProcessing,p=u.snippets,h=u.total,d=u.tags,m=u.stats,y=u.tableFilters,v=u.setTableFilters,g=u.editSnippet,b=u.setEditSnippet,S=u.isSavable,T=u.onDelete,O=u.onSave,x=u.onImportCodeSnippets,N=u.onDuplicate,_=u.onRefresh,P=Kr(Qr(null),2),I=P[0],L=P[1],A=Kr(Qr(!1),2),k=A[0],C=A[1],j=Kr(Qr(!1),2),D=j[0],G=j[1],M=Kr(Qr(!1),2),F=M[0],U=M[1],B=Kr(Qr(""),2),H=B[0],V=B[1],Y=Kr(Qr(!1),2),z=Y[0],W=Y[1],K=Kr(Qr(["functionName"]),2),q=K[0],$=K[1],J=(null===(e=y.filters.find((function(e){return"scope"===e.accessor})))||void 0===e?void 0:e.value)||"all",Q=a("ai_engine_status",!1);Xr((function(){var e=[];"function"!==J&&(e=["functionName","endpoint"]),"function"===J&&(e=["attributes"]),k&&(e=["attributes","enabled","functionName","endpoint"]),$(e)}),[k,J]);var X=function(e){confirm(be.ALERTS.ARE_YOU_SURE)&&T(e)},Z=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:kt;G(!k),b(e?t:null),e||(G(!1),b(null))},ee=function(){U(!F)},te=function(){var e,t=(e=zr().mark((function e(){var t,n;return zr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,W(!0),e.next=4,Qe(H);case 4:t=e.sent,(n=JSON.parse(JSON.stringify(kt))).name=null==t?void 0:t.name,n.description=null==t?void 0:t.description,n.code=null==t?void 0:t.code,n.tags=null==t?void 0:t.tags,n.scope=null==t?void 0:t.type,n.functionTarget=null==t?void 0:t.functionTarget,n.intervalHours=null==t?void 0:t.target_hour,n.intervalMinutes=null==t?void 0:t.target_minute,"function"===(null==t?void 0:t.type)&&null!=t&&t.parameters&&t.parameters.forEach((function(e){var r="php"===(null==t?void 0:t.functionTarget)?"$":"";n.functionArgs.push(r+(null==e?void 0:e.name)),n.functionArgsDict[r+(null==e?void 0:e.name)]={name:r+(null==e?void 0:e.name),desc:null==e?void 0:e.description,type:null==e?void 0:e.type,default:null==e?void 0:e.default,required:null==e?void 0:e.required}})),console.log(n),b(n),G(!0),e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),c(e.t0);case 23:return e.prev=23,ee(),W(!1),e.finish(23);case 27:case"end":return e.stop()}}),e,null,[[0,20,23,27]])})),function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Wr(a,r,o,i,c,"next",e)}function c(e){Wr(a,r,o,i,c,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),ne=function(e){L(null),Z(!0,e)},re=y.limit,oe=y.page,ae=l||f,ie=React.createElement(React.Fragment,null,I&&React.createElement(dt.X,{variant:"success",style:{marginBottom:"16px"}},I),React.createElement(sr,{busy:ae,isInline:!0,editSnippet:g,setEditSnippet:b,isSavable:S,onSave:O})),ce=React.createElement(dt.X,{variant:"danger",style:{marginBottom:"16px"}},be.ERROR.SNIPPET_FATAL,a("fatal_error",""),". ",be.ERROR.SNIPPET_DISABLED),le=Zr((function(){return React.createElement(Ur,{busy:ae,snippets:p,onEditSnippet:ne,tableFilters:y,setTableFilters:v,onImportCodeSnippets:x,currentScope:J,useInlineEditor:k,tags:d,stats:m,toHide:q,onSave:O,onDelete:X,onDuplicate:N})}),[p,ae,y,J,d,m,k,q]),ue=Zr((function(){return React.createElement("div",{style:{marginTop:"16px",display:"flex",alignItems:"center"}},!k&&React.createElement(mt.u,{style:{marginRight:"10px"},scrolldown:!0,value:re,onChange:function(e){return v(Vr(Vr({},y),{},{limit:e,offset:0}))}},React.createElement(mt.j,{value:5,label:"5 items / page"}),React.createElement(mt.j,{value:10,label:"10 items / page"}),React.createElement(mt.j,{value:25,label:"25 items / page"}),React.createElement(mt.j,{value:50,label:"50 items / page"}),React.createElement(mt.j,{value:100,label:"100 items / page"})),React.createElement(yt.S,{onLabel:be.SETTINGS.SIDEBAR_EDITOR,offLabel:be.SETTINGS.SIDEBAR_EDITOR,width:130,onChange:C,checked:k,onBackgroundColor:o.green}),React.createElement("div",{style:{flex:"auto"}}),React.createElement(vt.Q,{currentPage:oe,limit:re,total:h,onClick:function(e){return v(Vr(Vr({},y),{},{page:e}))}}))}),[re,oe,h,k]),se=React.createElement(gt.M,{hideText:be.COMMON.HIDE,hide:a("hide_tutorial",!1),onHide:function(){confirm(be.ALERTS.ARE_YOU_SURE)&&i(!0,"hide_tutorial")},showMessagesCount:!0,messages:[{title:"⚠️ Use the Plugin Carefully",message:"Please use this plugin with care. Ensure you know what you are doing and that the code you input does what you expect. You are solely responsible for the code you use and any issues that might arise because of it. Always have a backup of your website."},{title:"🤖 Seek Professional Help When Unsure",message:"If you are not sure what you are doing, contact a freelancer or someone with experience. Don't use ChatGPT to generate code that you don't understand to use out of the box; always verify."},{title:"ℹ️ Register Callable Functions",message:"If you want to use Function Calling or Tools with AI models, make sure you register your code under the Callable type. Ensure that the snippet is only the function and nothing else in this case."},{title:"📝 Create Global Snippets for WordPress Filters",message:"You can also create global snippets to call WordPress filters. You can choose between front and back, meaning that the code will be loaded on the live site or the admin panel. If you choose all, the code will always be loaded."},{title:"🔐 Whitelist REST Routes for Front Global Snippets",message:"If you choose Front for the global snippet, for security reasons you may need to whitelist some REST routes. You can do so with the following filter: `mwcode_rest_whitelist` or bypass the authorization using `mwcode_rest_authorized`."}]});return React.createElement(React.Fragment,null,a("fatal_error",null)&&ce,se,React.createElement(Et.V,null,React.createElement(w.M,{className:"primary",icon:"plus",onClick:function(){return Z(!0)}},be.COMMON.ADD),React.createElement(w.M,{className:"primary",color:"purple",icon:"wand",disabled:!Q,onClick:function(){return ee()}},be.SETTINGS.QUICK_START),React.createElement(w.M,{isBusy:ae,className:"secondary",onClick:_},be.COMMON.REFRESH),React.createElement("div",{style:{flex:"auto"}}),React.createElement(bt.o,{name:"mwcode_scope_filter",value:J,onChange:function(e){var t;It.some((function(t){return t.value===e}))&&v(Vr(Vr({},y),{},{page:1,filters:[].concat((t=y.filters.filter((function(e){return"scope"!==e.accessor})),function(e){if(Array.isArray(e))return $r(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||qr(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),[{accessor:"scope",value:e}])}))}},null==It?void 0:It.map((function(e){return React.createElement(bt.K,{key:e.value,value:e.value,title:e.label,count:null==m?void 0:m[e.value]})})))),React.createElement(wt.g,null),!k&&React.createElement(React.Fragment,null,le,ue),k&&React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},le,ue),React.createElement(E.Y,{minimal:!0,style:{padding:"0 0 0 15px"}},k&&ie))),React.createElement(we.n,{isOpen:F,title:be.SETTINGS.QUICK_START,content:React.createElement(St.A,{busy:z},React.createElement(dt.X,{variant:"info",style:{marginBottom:"16px"}},be.SETTINGS.QUICK_START_INFO),React.createElement(Rt.m,{value:H,onBlur:V,placeholder:be.SETTINGS.QUICK_START_PLACEHOLDER,style:{height:"200px"}})),onRequestClose:ee,okButton:{label:be.COMMON.RUN,onClick:function(){te()},disbled:z},cancelButton:{label:be.COMMON.CANCEL,onClick:ee,disabled:z}}),React.createElement(we.n,{isOpen:D,size:"full-size",title:be.SETTINGS.EDITOR,content:React.createElement(React.Fragment,null,React.createElement(wt.g,null),I&&React.createElement(dt.X,{variant:"success",style:{marginBottom:"16px"}},I),React.createElement(sr,{busy:ae,onClose:function(){return Z(!1)},editSnippet:g,setEditSnippet:b,isSavable:S,onSave:O})),contentStyle:{margin:"0 -15px",padding:"10px 15px",height:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column",backgroundColor:"var(--neko-main-color)"},onRequestClose:function(){return Z(!1)},customButtons:React.createElement(w.M,{onClick:function(){O(g),Z(!1)},disabled:!S},be.COMMON.SAVE_AND_CLOSE),okButton:{label:be.COMMON.SAVE,onClick:function(){O(g)},disabled:!S},cancelButton:{label:be.COMMON.CANCEL,onClick:function(){return Z(!1)}}}))};var to=n(6031),no=n(7392);function ro(e){return ro="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ro(e)}function oo(){oo=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new I(r||[]);return o(i,"_invoke",{value:x(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(L([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==ro(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function x(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(ro(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},T(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function ao(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function io(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ao(a,r,o,i,c,"next",e)}function c(e){ao(a,r,o,i,c,"throw",e)}i(void 0)}))}}function co(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return lo(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lo(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function lo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var uo=wp.element,so=uo.useState,fo=uo.useEffect,po="".concat(x,"/meow-licenser/").concat(T,"/v1"),ho=function(){var e=co(so(!1),2),t=e[0],n=e[1],r=co(so(!1),2),o=r[0],a=r[1],i=co(so(null),2),c=i[0],l=i[1],u=co(so(null),2),s=u[0],f=u[1],p=co(so(""),2),d=p[0],m=p[1],y=L&&(!s||"valid"!==s.license),v=function(){var e=io(oo().mark((function e(){var t;return oo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(I){e.next=2;break}return e.abrupt("return");case 2:return n(!0),e.prev=3,e.next=6,(0,R.IU)("".concat(po,"/get_license"),{method:"POST",nonce:A});case 6:t=e.sent,f(t.data),t.data.key&&m(t.data.key),e.next=15;break;case 11:e.prev=11,e.t0=e.catch(3),alert("Error while checking the license. Check your console for more information."),console.error(e.t0);case 15:n(!1);case 16:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(){return e.apply(this,arguments)}}(),g=function(){var e=io(oo().mark((function e(){return oo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n(!0),e.prev=1,e.next=4,(0,R.IU)("".concat(po,"/set_license"),{method:"POST",nonce:A,json:{serialKey:null}});case 4:e.sent.success&&(m(""),f(null),l("licenseRemoved")),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),alert("Error while removing the license. Check your console for more information."),console.error(e.t0);case 12:n(!1);case 13:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}(),E=function(){var e=io(oo().mark((function e(){var t;return oo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n(!0),e.prev=1,e.next=4,(0,R.IU)("".concat(po,"/set_license"),{method:"POST",nonce:A,json:{serialKey:d,override:!0}});case 4:(t=e.sent).success&&(f(t.data),t.data&&!t.data.issue&&l("licenseAdded")),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),alert("Error while forcing the license. Check your console for more information."),console.error(e.t0);case 12:n(!1);case 13:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}(),b=function(){var e=io(oo().mark((function e(){var t;return oo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("MEOW_OVERRIDE"!==d){e.next=5;break}return a(!0),f(null),m(""),e.abrupt("return");case 5:return n(!0),e.prev=6,e.next=9,(0,R.IU)("".concat(po,"/set_license"),{method:"POST",nonce:A,json:{serialKey:d}});case 9:(t=e.sent).success&&(f(t.data),t.data&&!t.data.issue&&l("licenseAdded")),e.next=17;break;case 13:e.prev=13,e.t0=e.catch(6),alert("Error while validating the license. Check your console for more information."),console.error(e.t0);case 17:n(!1);case 18:case"end":return e.stop()}}),e,null,[[6,13]])})));return function(){return e.apply(this,arguments)}}();fo((function(){v()}),[]);var T=y?"Forced License":L?"Enabled":"Disabled",O=y||s&&"valid"===s.license,x="Your license is active. Thanks a lot for your support :)";y&&(x="This license has been force-enabled for you.",s&&s.check_url&&(x=React.createElement(React.Fragment,null,React.createElement("span",null,x),React.createElement("br",null),React.createElement("small",null,"To check your license status, please click ",React.createElement("a",{target:"_blank",href:s.check_url+"&cache="+642e3*Math.random(),rel:"noreferrer"},"here"),".")))),O||(s?"no_activations_left"===s.issue?x=React.createElement("span",null,"There are no activations left for this license. You can visit your account at ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com"},"Meow Apps"),", unregister a site, and click on ",React.createElement("i",null,"Retry to validate"),"."):"expired"===s.issue?x=React.createElement("span",null,"Your license has expired. You can get another license or renew the current one by visiting your account at ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com"},"Meow Apps"),"."):"missing"===s.issue?x="This license does not exist.":"disabled"===s.issue?x="This license has been disabled.":"item_name_mismatch"===s.issue?x="This license seems to be for a different plugin... isn't it? :)":"forced"===s.issue?x="ABC":(x=React.createElement("span",null,"There is an unknown error related to the system or this serial key. Really sorry about this! Make sure your security plugins and systems are off temporarily. If you are still experiencing an issue, please ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com/contact/"},"contact us"),"."),console.error({license:s})):x="Unknown error :(");var N=React.createElement(S.z,{title:"Pro Version (Not Installed)",className:"primary"},"You will find more information about the Pro Version ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com"},"here"),". If you actually bought the Pro Version already, please remove the current plugin and download the Pro Version from your account at ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com/"},"Meow Apps"),"."),_=React.createElement(S.z,{title:"Pro Version (".concat(T,")"),busy:t,className:"primary"},!y&&!(s&&s.key===d)&&React.createElement(React.Fragment,null,React.createElement("div",{style:{marginBottom:10}},"License Key:"),React.createElement(Jt.A,{id:"mfrh_pro_serial",name:"mfrh_pro_serial",disabled:t,value:d,onChange:function(e){return m(e)},placeholder:"Type your license key..."}),React.createElement(h.s,{p:!0},"Insert your serial key above. If you don't have one yet, you can get one ",React.createElement("a",{href:"https://meowapps.com"},"here"),". If there was an error during the validation, try the ",React.createElement("i",null,"Retry")," to ",React.createElement("i",null,"validate")," button.")),s&&!O&&React.createElement(dt.X,{variant:"danger"},x),(y||s)&&O&&React.createElement(dt.X,{variant:"success"},x),React.createElement("div",{style:{marginTop:15,display:"flex",justifyContent:"end"}},s&&!O&&React.createElement(w.M,{className:"secondary",disabled:t||!d,onClick:b},"Retry to validate"),s&&s.key===d&&React.createElement(w.M,{className:"secondary",disabled:t||!d,onClick:g},"Remove License"),React.createElement(w.M,{disabled:t||!d||s&&s.key===d,onClick:b},"Validate License"),o&&!O&&React.createElement(w.M,{disabled:t||!d||s&&s.key===d,onClick:E,className:"danger"},"Force License")),React.createElement(we.n,{isOpen:"licenseAdded"===c,title:"Thank you :)",content:"The Pro features have been enabled. This page should be now reloaded.",okButton:{label:"Reload",onClick:function(){return location.reload()}}}),React.createElement(we.n,{isOpen:"licenseRemoved"===c,title:"Goodbye :(",content:"The Pro features have been disabled. This page should be now reloaded.",okButton:{label:"Reload",onClick:function(){return location.reload()}}}));return I?_:N},mo=n(6842);function yo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return vo(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vo(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var go=wp.element,Eo=go.useState,bo=go.useEffect,wo=go.useCallback,So=function(e){!function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(e);var t=yo(Eo([]),2),n=t[0],r=t[1],o=yo(Eo(!0),2),a=o[0],i=o[1],c=yo(Eo(!1),2),l=c[0],u=c[1],s=yo(Eo(""),2),f=s[0],p=s[1],h=wo((function(){De().then((function(e){r(e),p(JSON.stringify(e,null,2)),console.log(e)})).catch((function(e){console.error(e)})).finally((function(){i(!1)}))}),[]);return bo((function(){h()}),[]),React.createElement(React.Fragment,null,l&&React.createElement(Rt.m,{textAreaStyle:{height:380},value:f,onChange:function(e){p(e)},style:{height:"100%",width:"100%",minHeight:380}}),!l&&React.createElement("div",{style:{height:380,overflow:"auto",maxHeight:380}},a&&React.createElement("i",{style:{color:"gray"}},"Loading..."),!a&&!n&&React.createElement("i",{style:{color:"gray"}},be.COMMON.DATA_NOT_AVAILABLE),!a&&n&&React.createElement(mo.p2,{value:n,rootName:"functions",indentWidth:2,displayDataTypes:!1,displayObjectSize:!1,displayArrayKey:!1,enableClipboard:!1,style:{fontSize:12}})),React.createElement(wt.g,null),React.createElement(w.M,{className:"secondary",onClick:function(){return u(!l)}},l?be.COMMON.CANCEL:be.SETTINGS.DEVELOPERS.RAW_EDIT),l&&React.createElement(w.M,{onClick:function(){Ge(f).then((function(){alert("Functions updated."),h(),u(!1)})).catch((function(e){alert("Error while updating functions. Please check your console."),console.error(e)}))}},be.COMMON.UPDATE))},Ro=n(4335);function To(e){return To="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},To(e)}function Oo(){Oo=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new I(r||[]);return o(i,"_invoke",{value:x(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(L([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==To(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function x(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function L(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(To(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},T(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},T(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=L,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:L(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function xo(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function No(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||_o(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _o(e,t){if(e){if("string"==typeof e)return Po(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Po(e,t):void 0}}function Po(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Io=wp.element,Lo=Io.useState,Ao=Io.useEffect,ko=(Io.useMemo,Io.useCallback),Co=function(e){!function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(e);var t,n,r,o=ht().actions,a=o.getOption,i=o.updateOption,c=(o.resetOptions,o.refreshOptions,"code_blocks_whitelist"),l=a(c,[]),u=l,s=No(Lo(""),2),p=s[0],h=s[1],d=No(Lo(1),2),m=d[0],y=d[1],v=No(Lo([]),2),g=v[0],E=v[1],b=No(Lo(!1),2),S=b[0],T=b[1],O=No(Lo(l),2),x=O[0],_=O[1],P=(t={search:p,offset:10*(m-1),limit:10},(0,f.I)({queryKey:["posts",t],queryFn:(n=Oo().mark((function e(){var n;return Oo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/fetch_posts"),{nonce:A,method:"POST",json:t});case 2:if(!(n=e.sent).success){e.next=5;break}return e.abrupt("return",{data:n.data,total:n.total});case 5:throw new Error(n.message||"Failed to fetch posts");case 6:case"end":return e.stop()}}),e)})),r=function(){var e=this,t=arguments;return new Promise((function(r,o){var a=n.apply(e,t);function i(e){xo(a,r,o,i,c,"next",e)}function c(e){xo(a,r,o,i,c,"throw",e)}i(void 0)}))},function(){return r.apply(this,arguments)})})),I=P.data,L=P.isLoading,k=(P.error,(null==I?void 0:I.data)||[]),C=(null==I?void 0:I.total)||0;Ao((function(){if(!(p.length>0)&&(null==u?void 0:u.length)>0){var e=k.filter((function(e){return u.includes(e.id)}));E(e)}}),[u,k.length,p]);var j=ko((function(e){h(e),y(1)}),[]),D=ko((function(e){y(e)}),[]),G=ko((function(e){var t,n=e[0];g.some((function(e){return e.id===n.id}))?E(g.filter((function(e){return e.id!==n.id}))):E([].concat(function(e){if(Array.isArray(e))return Po(e)}(t=g)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||_o(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[n]))}),[g,k]),M=ko((function(){T(!1),h(""),y(1)}),[]),F=ko((function(){i(g.map((function(e){return e.id})),c),_(g.map((function(e){return e.id}))),M()}),[g]);return React.createElement(React.Fragment,null,React.createElement(Jt.A,{disabled:!0,name:"post_ids",type:"text",value:x.join(", "),style:{flex:1},placeholder:"Post IDs... (separated by commas)",onChange:function(e){_(e.split(",").map((function(e){return e.trim()})))}}),React.createElement(w.M,{className:"primary",style:{marginLeft:10},onClick:function(){return T(!0)}},"Select Posts"),React.createElement(Ro._,{isOpen:S,posts:k,selected:g,maxSelect:100,onNextPage:function(){return D(m+1)},onPreviousPage:function(){return D(m-1)},onRefresh:function(){return D(1)},onSearch:j,searchValue:p,busy:L,currentPage:m,limit:10,total:C,onPageChange:D,onSelect:G,onClose:M,onCancel:M,onSave:F}))};function jo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Do=wp.element.useState;const Go=function(){var e=ht(),t=e.actions,n=e.state,r=t.getOption,o=t.updateOption,a=t.resetOptions,i=t.refreshOptions,c=n.isLoading,l=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return jo(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jo(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Do(!1),2),u=l[0],s=l[1],f=$t({onError:function(e){return alert("⚠️ "+e)}}),p=f.onImportCodeSnippets,v=f.isProcessing,g=r("ai_engine_status",!1),R=r("database_inspection",!1),x=r("code_blocks",!1),N=c||u||v;return React.createElement(b._,null,React.createElement(b.V,{title:be.SETTINGS.TITLE},React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(S.z,{busy:N,title:be.SETTINGS.PREFERENCES.TITLE,className:"primary"},React.createElement(d.d,{title:be.SETTINGS.PREFERENCES.CODE_PREVIEW},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"ui_show_preview",disabled:N,label:be.COMMON.ENABLE,description:be.SETTINGS.PREFERENCES.CODE_PREVIEW_DESCRIPTION,value:"1",checked:r("ui_show_preview",!1),onChange:o})))),React.createElement(S.z,{busy:N,title:be.SETTINGS.MODULES.TITLE,className:"primary"},React.createElement(d.d,{title:be.SETTINGS.MODULES.CODE_BLOCKS},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"code_blocks",disabled:N,requirePro:!L,label:be.COMMON.ENABLE,description:be.SETTINGS.MODULES.CODE_BLOCKS_DESCRIPTION,value:"1",checked:r("code_blocks",!1),onChange:o}))),React.createElement(d.d,{title:be.SETTINGS.DEVELOPERS.DATABASE_INSPECTION},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"database_inspection",disabled:N,label:be.COMMON.ENABLE,description:be.SETTINGS.DEVELOPERS.DATABASE_INSPECTION_DESCRIPTION,value:"1",checked:r("database_inspection",!1),onChange:o}))),React.createElement(d.d,{title:be.SETTINGS.PREFERENCES.PUBLIC_API},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"api_endpoint",disabled:N,label:be.COMMON.ENABLE,description:be.SETTINGS.PREFERENCES.SNIPPET_ENDPOINT_DESCRIPTION,value:"1",checked:r("api_endpoint",!1),onChange:o}))),r("api_endpoint",!1)&&React.createElement(d.d,{title:be.SETTINGS.SNIPPET.TOKEN},React.createElement("div",{style:{display:"flex",gap:"10px"}},React.createElement(Jt.A,{style:{flex:1},name:"api_token",value:r("api_token",""),onBlur:o}),React.createElement(w.M,{rounded:!0,icon:"replay",onClick:function(){return o(Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),"api_token")}})))),React.createElement(S.z,{busy:N,title:be.COMMON.MAINTENANCE,className:"primary"},React.createElement(h.s,{h4:!0},"Settings"),React.createElement("div",{style:{display:"flex",gap:"0px",alignItems:"center"}},React.createElement(w.M,{className:"danger",onClick:a},be.COMMON.RESET_SETTINGS),React.createElement(w.M,{className:"primary",onClick:i},be.COMMON.REFRESH_SETTINGS),React.createElement(w.M,{className:"secondary",onClick:function(){return o(!1,"hide_tutorial")}},be.SETTINGS.SHOW_TUTORIAL)),React.createElement(wt.g,null),React.createElement(h.s,{h4:!0},"Snippets"),React.createElement("div",{style:{display:"flex",gap:"0px"}},React.createElement(w.M,{className:"danger",onClick:function(){return je(s)}},be.SETTINGS.IMPORT_SETTINGS),React.createElement(w.M,{className:"primary",onClick:function(){return Ce(s)}},be.SETTINGS.EXPORT_SETTINGS)),React.createElement(wt.g,{tiny:!0}),React.createElement("div",{style:{display:"flex",gap:"0px"}},React.createElement(w.M,{className:"secondary",onClick:p,busy:N},be.SETTINGS.SNIPPET.IMPORT_CODE_SNIPPETS)))),React.createElement(E.Y,{minimal:!0},React.createElement(S.z,{busy:N,title:be.SETTINGS.AI_PARAMETERS.TITLE,className:"primary",action:React.createElement(React.Fragment,null,g&&React.createElement(to.B,{className:"success",label:be.SETTINGS.AI_PARAMETERS.AI_ENGINE_INSTALLED}),!g&&React.createElement(to.B,{className:"warning",label:be.SETTINGS.AI_PARAMETERS.DOWNLOAD_AI_ENGINE,link:"https://meowapps.com/ai-engine/"}))},React.createElement(d.d,{title:be.SETTINGS.AI_PARAMETERS.AI_SUGGESTIONS},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"ai_suggestions",disabled:N||!g,label:be.COMMON.ENABLE,description:be.SETTINGS.AI_PARAMETERS.AI_SUGGESTIONS_DESCRIPTION,value:"1",checked:r("ai_suggestions",!1),onChange:o})))),React.createElement(S.z,{busy:N,title:be.SETTINGS.DEVELOPERS.TITLE,className:"primary"},React.createElement(d.d,{title:be.SETTINGS.DEVELOPERS.SANITIZE_ARGS},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"sanitize_arguments",disabled:N,label:be.COMMON.ENABLE_RECOMMENDED,description:be.SETTINGS.DEVELOPERS.SANITIZE_ARGS_DESCRIPTION,value:"1",checked:r("sanitize_arguments",!0),onChange:o}))),React.createElement(d.d,{title:be.SETTINGS.DEVELOPERS.MCP_SUPPORT},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"mcp_support",disabled:N||!g,label:be.COMMON.ENABLE,description:be.SETTINGS.DEVELOPERS.MCP_SUPPORT_DESCRIPTION,value:"1",checked:r("mcp_support",!1),onChange:o}))),React.createElement(d.d,{title:be.SETTINGS.DEVELOPERS.BYPASS_SECURITY},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"bypass_rest_security",disabled:N,label:be.COMMON.ENABLE_NOT_RECOMMENDED,description:be.SETTINGS.DEVELOPERS.BYPASS_SECURITY_DESCRIPTION,value:"1",checked:r("bypass_rest_security",!1),onChange:o}))),React.createElement(d.d,{title:be.SETTINGS.DEVELOPERS.LOGS},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"server_debug_mode",disabled:N,label:be.COMMON.ENABLE,description:be.SETTINGS.DEVELOPERS.LOGS_DESCRIPTION,value:"1",checked:r("server_debug_mode",!1),onChange:o})))),r("server_debug_mode",!1)&&React.createElement(no.k,{refreshQuery:Pe,clearQuery:Ie,i18n:be})))),x&&React.createElement(b.V,{title:be.SETTINGS.MODULES.CODE_BLOCKS},React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(S.z,{busy:N,title:be.SETTINGS.MODULES.CODE_BLOCKS_SELECTION,className:"primary"},React.createElement(Co,null))),React.createElement(E.Y,{minimal:!0},React.createElement(S.z,{busy:N,title:be.SETTINGS.MODULES.CODE_BLOCKS_INSTRUCTIONS,className:"primary"},React.createElement(h.s,null,be.SETTINGS.MODULES.CODE_BLOCKS_INSTRUCTIONS_DESCRIPTION),React.createElement(wt.g,{tiny:!0}),React.createElement(dt.X,{variant:"warning"},be.SETTINGS.MODULES.CODE_BLOCKS_INSTRUCTIONS_WARNING))))),R&&React.createElement(b.V,{title:be.SETTINGS.DEVELOPERS.DATABASE_INSPECTION},React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(S.z,{busy:N,title:be.SETTINGS.SNIPPET.SCOPES.FUNCTION,className:"primary"},React.createElement(So,null))),React.createElement(E.Y,{minimal:!0}))),React.createElement(b.V,{title:"License"},React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(ho,{domain:O,prefix:T,isPro:I,isRegistered:L})))))};function Mo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Fo=wp.element.useState;const Uo=function(){var e=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Mo(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mo(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Fo("snippets"),2),t=e[0],n=e[1];return React.createElement(s.A,null,React.createElement(v.z,null,React.createElement(g.n,{title:be.SETTINGS.HEADER_TITLE},React.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},React.createElement(w.M,{className:"header",icon:"dashboard",onClick:function(){return n("snippets")}}),React.createElement(w.M,{className:"header",icon:"tools",onClick:function(){return n("settings")}}))),React.createElement(E.N,null,React.createElement(E.Y,null,"snippets"===t&&React.createElement(eo,null),"settings"===t&&React.createElement(Go,null)))))};var Bo,Ho=n(2109),Vo=n(6897),Yo=["children","type","title","hint","isSelected","isDisplayed"];function zo(){return zo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zo.apply(null,arguments)}var Wo=React.createElement(Ho.z,{icon:"cat",style:{width:20,height:20}}),Ko=j.Ay.div(Bo||(Bo=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n color: black;\n display: flex;\n flex-direction: column;\n border: 1px solid black;\n font-size: 15px;\n box-sizing: content-box;\n font-weight: 400;\n font-size: 13px;\n padding: 10px;\n background: hsl(0deg 0% 100% / 75%);\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n margin-bottom: 10px;\n\n\n .mwcode-title-container {\n flex: inherit;\n padding: 5px 0px 5px 10px;\n display: flex;\n align-items: center;\n color: black;\n font-weight: 600;\n cursor: pointer;\n\n .mwcode-hint {\n font-size: 10px;\n font-weight: 400;\n text-align: right;\n flex: auto;\n\n .mwcode-pill {\n background: var(--wp--preset--color--vivid-cyan-blue);\n padding: 5px 10px;\n border-radius: 8px;\n color: white;\n }\n\n .mwcode-pill-purple {\n background: var(--wp--preset--color--vivid-purple);\n }\n }\n }\n\n .mwcode-block-container-content {\n flex: auto;\n padding: 10px;\n display: flex;\n flex-direction: column;\n }\n\n\t&.mwcode-chatbot {\n\t\tbackground: var(--neko-main-color);\n\n\t\t.mwcode-title-container {\n\t\t\tcolor: white;\n\t\t}\t\n\n\t\t.mwcode-block-container-content {\n\t\t\tmargin-top: 10px;\n\t\t\tborder-radius: 5px;\n\t\t\tbackground: var(--neko-background-color);\n\t\t}\n\t}\n\n &.is-selected {\n }\n']))),qo=function(e){var t=e.children,n=e.type,r=void 0===n?"":n,o=e.title,a=void 0===o?"":o,i=e.hint,c=void 0===i?"":i,l=e.isSelected,u=e.isDisplayed,s=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,Yo),f=(0,Vo.gR)("mwcode-block-container","mwcode-".concat(r),{"is-selected":l,"is-meow":!0});return React.createElement(Ko,zo({className:f},s),React.createElement("div",{className:"mwcode-title-container"},Wo,React.createElement("div",null,a),React.createElement("div",{className:"mwcode-hint"},c)),(l||u)&&React.createElement("div",{className:"mwcode-block-container-content"},t))};function $o(){return $o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},$o.apply(null,arguments)}var Jo=wp.i18n.__,Qo=wp.blocks.registerBlockType,Xo=wp.blockEditor,Zo=Xo.InspectorControls,ea=Xo.useBlockProps,ta=wp.components,na=ta.PanelBody,ra=ta.SelectControl,oa=function(e){var t=e.attributes,n=e.setAttributes,r=e.isSelected,o=t.code,a=t.target,i=ea();return React.createElement(React.Fragment,null,React.createElement(Zo,null,React.createElement(na,{title:Jo("Code Block Settings","code-engine")},React.createElement(ra,{label:Jo("Target Language","code-engine"),value:a,options:[{label:"PHP",value:"php"},{label:"JS",value:"js"}],onChange:function(e){return n({target:e})}}))),React.createElement(qo,$o({},i,{title:Jo("Content Code Block","code-engine"),isSelected:r,isDisplayed:!0}),React.createElement(ra,{label:Jo("Target Language","code-engine"),value:a,options:[{label:"PHP",value:"php"},{label:"JS",value:"js"}],onChange:function(e){return n({target:e})}}),React.createElement("div",{style:{marginTop:"10px",outline:"rgb(160, 177, 233) solid 3px",padding:"5px",borderRadius:"5px"}},React.createElement(bn,{code:o,snippet:{scope:"content_"+a,functionTarget:a},setCode:function(e){return n({code:e})}}))))},aa=function(e){var t=e.attributes,n=t.code,r=t.target,o=function(e){return e?e.replace(/\\/g,"\\\\").replace(/"/g,"""):""}(n),a='[code-engine target="'.concat(r,'" code="').concat(o,'" ]');return React.createElement("div",null,a)};var ia=wp.element.render,ca=new l.E({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnMount:!1,retry:!1,placeholderData:function(e){return e}}}});Qo("code-engine/content",{title:Jo("Content Code Block","code-engine"),description:Jo("Container to embed code directly into the post content","code-engine"),icon:Wo,category:"widgets",keywords:[Jo("code","code-engine"),Jo("content","code-engine"),Jo("block","code-engine")],attributes:{target:{type:"string",default:"php"},code:{type:"string",default:""}},edit:oa,save:aa}),document.addEventListener("DOMContentLoaded",(function(){var e=document.getElementById("mwcode-admin-settings");e&&ia(React.createElement(pt,null,React.createElement(u.Ht,{client:ca},React.createElement(Uo,null))),e);var t=document.getElementById("meow-common-dashboard");t&&ia(React.createElement(u.Ht,{client:ca},React.createElement(s.A,null,React.createElement(ye,null))),t)}))},1594:e=>{e.exports=React},5206:e=>{e.exports=ReactDOM}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,r),a.exports}r.m=t,r.amdO={},e=[],r.O=(t,n,o,a)=>{if(!n){var i=1/0;for(s=0;s<e.length;s++){for(var[n,o,a]=e[s],c=!0,l=0;l<n.length;l++)(!1&a||i>=a)&&Object.keys(r.O).every((e=>r.O[e](n[l])))?n.splice(l--,1):(c=!1,a<i&&(i=a));if(c){e.splice(s--,1);var u=o();void 0!==u&&(t=u)}}return t}a=a||0;for(var s=e.length;s>0&&e[s-1][2]>a;s--)e[s]=e[s-1];e[s]=[n,o,a]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={57:0};r.O.j=t=>0===e[t];var t=(t,n)=>{var o,a,[i,c,l]=n,u=0;if(i.some((t=>0!==e[t]))){for(o in c)r.o(c,o)&&(r.m[o]=c[o]);if(l)var s=l(r)}for(t&&t(n);u<i.length;u++)a=i[u],r.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return r.O(s)},n=self.webpackChunkcode_engine=self.webpackChunkcode_engine||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),r.nc=void 0;var o=r.O(void 0,[121],(()=>r(9009)));o=r.O(o)})(); |
|
2
|
+(()=>{"use strict";var e,t={4684:(e,t,n)=>{var r,o,a,i,c,l=n(5072),u=n(7665),s=n(2564),f=n(8069),p=n(7097),h=n(4977),d=n(7039),m=n(4536),y=n(5263),v=n(6913),g=n(1210),E=n(4547),b=n(3676),w=n(9296),S=n(4461),R=n(6639),x=window.mwcode_snippet_vault.prefix,O=window.mwcode_snippet_vault.domain,T=window.mwcode_snippet_vault.rest_url.replace(/\/+$/,""),N=window.mwcode_snippet_vault.api_url.replace(/\/+$/,""),L=window.mwcode_snippet_vault.plugin_url.replace(/\/+$/,""),P="1"===window.mwcode_snippet_vault.is_pro,I=P&&"1"===window.mwcode_snippet_vault.is_registered,k=window.mwcode_snippet_vault.rest_nonce,A=window.mwcode_snippet_vault.options,C=n(197),j=n(1686);function D(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var M=j.Ay.div(r||(r=D(["\n color: white;\n padding: 15px;\n margin-bottom: -15px;\n\n a {\n color: #7dedff;\n text-decoration: none;\n }\n\n p {\n font-size: 15px;\n }\n"]))),G=(0,j.Ay)(S.z)(o||(o=D(["\n\n .neko-block-title {\n display: none;\n }\n\n .plugin-desc {\n display: flex;\n flex-direction: column;\n margin-left: 15px;\n }\n\n .neko-block-content {\n display: flex;\n padding: 15px;\n\n h2 {\n font-size: 18px;\n margin: 0;\n\n a {\n text-decoration: none;\n }\n }\n\n p {\n margin: 0px;\n margin-top: 10px;\n font-size: 13px;\n line-height: 1.5;\n }\n\n .plugin-actual-desc {\n font-size: 13px;\n font-weight: 500;\n }\n }\n"]))),F=j.Ay.img(a||(a=D(["\n height: 125px;\n width: auto;\n border-radius: 10px;\n background: lightgray;\n"]))),U=j.Ay.div(i||(i=D(["\n\n margin: 15px;\n\n .center {\n background: white;\n color: black;\n border-radius: 10px;\n padding: 10px;\n max-width: 100%\n overflow: none;\n\n h2 {\n font-size: 26px;\n }\n\n table {\n width: 100%;\n\n tr td:first-child {\n width: 220px;\n font-weight: bold;\n color: #1e7cba;\n }\n\n * {\n overflow-wrap: anywhere;\n }\n }\n }\n\n hr {\n border-color: #1e7cba;\n }\n"]))),B=j.Ay.ul(c||(c=D(["\n margin-top: 10px;\n background: rgb(0, 72, 88);\n padding: 10px;\n color: rgb(58, 212, 58);\n max-height: 600px;\n min-height: 200px;\n display: block;\n font-family: monospace;\n font-size: 12px;\n white-space: pre;\n overflow-x: auto;\n width: calc(100vw - 276px);\n color: white;\n\n .log-date {\n color: var(--neko-yellow);\n margin-left: 8px;\n }\n\n .log-type {\n background: #0000004d;\n padding: 2px 5px;\n border-radius: 8px;\n text-transform: uppercase;\n }\n\n .log-content {\n display: block;\n }\n\n .log-warning .log-type {\n background: var(--neko-yellow);\n color: white;\n }\n\n .log-fatal .log-type {\n background: var(--neko-red);\n color: white;\n }\n"])));function H(e){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H(e)}function V(){V=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new P(r||[]);return o(i,"_invoke",{value:T(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function x(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==H(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function T(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(H(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},x(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function z(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function Y(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){z(a,r,o,i,c,"next",e)}function c(e){z(a,r,o,i,c,"throw",e)}i(void 0)}))}}function W(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||K(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function K(e,t){if(e){if("string"==typeof e)return q(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(e,t):void 0}}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var J=wp.element,$=J.useState,Q=J.useEffect,X="".concat(T,"/meow-common/v1"),Z=function(e){var t=e.request,n=e.title,r=e.max,o=W($(!1),2),a=o[0],i=o[1],c=W($([]),2),l=c[0],u=c[1],s=l.length>0?l.reduce((function(e,t){return e+t})):0,f=l.length>0?Math.ceil(s/l.length):0,p=!l.length&&a;return Q((function(){a&&setTimeout(Y(V().mark((function e(){var n,r,o;return V().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(new Date).getTime(),e.next=3,(0,R.IU)("".concat(X,"/").concat(t),{method:"POST",nonce:k});case 3:r=(new Date).getTime(),o=r-n,u((function(e){return[].concat(function(e){if(Array.isArray(e))return q(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||K(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[o]);var t}));case 6:case"end":return e.stop()}}),e)}))),1e3)}),[l]),React.createElement(M,{style:{width:200,textAlign:"center"}},React.createElement(h.s,{h2:!0,style:{color:"white"}},n),React.createElement(C.X,{size:200,value:p?r:f,max:r},React.createElement("span",{style:{fontSize:20}},p?"START":f+" ms"),React.createElement("span",{style:{fontSize:12}},p?"YOUR ENGINE":l.length+" requests")),React.createElement(w.M,{style:{width:"100%",marginTop:10},color:a?"#cc3627":"#ccb027",onClick:function(){a||u([]),i(!a)}},a?"Stop":"Start"))};function ee(e){return ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ee(e)}function te(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ne(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ne(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ne(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function re(){re=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new P(r||[]);return o(i,"_invoke",{value:T(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function x(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==ee(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function T(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(ee(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},x(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function oe(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function ae(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){oe(a,r,o,i,c,"next",e)}function c(e){oe(a,r,o,i,c,"throw",e)}i(void 0)}))}}var ie=wp.element,ce=ie.useState,le=ie.useEffect;N&&T&&L||console.error("[@common/dashboard] apiUrl, restUrl and pluginUrl are mandatory.");var ue="".concat(T,"/meow-common/v1"),se=React.createElement(M,null,React.createElement(h.s,{p:!0,style:{lineHeight:"1.5",margin:"0 0 15px 0"}},"Hi! ☀️ Meow Apps isn't your typical plugin suite—it's a passion project led by me, ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://jordymeow.com"},"Jordy Meow"),", and a stellar team! 💕 Based in ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://offbeatjapan.org"},"Japan"),", we're all about making your WordPress experience smoother and speedier. Our plugins are all about boosting your site's performance and user-friendliness. Ready to level up your WordPress game? Check out ",React.createElement("a",{href:"http://meowapps.com",rel:"noreferrer",target:"_blank"},"Meow Apps")," and let's make magic happen! 🌴🙀")),fe=React.createElement(M,null,React.createElement(h.s,{p:!0},"The ",React.createElement("b",null,"Empty Request Time")," measures your installation's basic performance by showing the average time needed to process an empty request on your server. To see how disabling plugins affects the results, turn some off and run the test again. Aim for a time under 2,000 ms, but ideally, keep it below 500 ms. The ",React.createElement("b",null,"File Operation Time")," creates a temporary 10MB file each time it runs. ",React.createElement("b",null,"The SQL Request Time")," calculates the total number of posts. This process should be quick and have a similar duration to the Empty Request Time.")),pe=React.createElement(M,null,React.createElement(h.s,{p:!0},"Maintain a streamlined WordPress setup by using essential plugins and a dependable hosting provider. Refrain from self-hosting unless you're an expert. Go further by reading our tutorials:",React.createElement("ul",null,React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-improve-seo-wordpress/",rel:"noreferrer",target:"_blank"},"SEO Checklist & Optimization")),React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-faster-wordpress-optimize/",rel:"noreferrer",target:"_blank"},"Optimize your WordPress Speed")),React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-optimize-images-wordpress/",rel:"noreferrer",target:"_blank"},"Optimize Images (CDN, and so on)")),React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-hosting-service-wordpress/",rel:"noreferrer",target:"_blank"},"The Best Hosting Services for WordPress"))))),he=function(){var e=ae(re().mark((function e(){var t;return re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(ue,"/all_settings/"),{method:"POST",nonce:k});case 2:return t=e.sent,e.abrupt("return",t.data);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),de=function(){var e=ae(re().mark((function e(t){var n,r,o;return re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.value,r=t.id,e.next=3,(0,R.IU)("".concat(ue,"/update_option"),{method:"POST",nonce:k,json:{name:r,value:n}});case 3:return o=e.sent,e.abrupt("return",o);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),me=function(){var e=ae(re().mark((function e(){var t;return re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(ue,"/error_logs"),{method:"POST",nonce:k});case 2:return t=e.sent,e.abrupt("return",t.data.reverse());case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ye=function(){var e=(0,u.jE)(),t=te(ce(!1),2),n=t[0],r=t[1],o=te(ce(""),2),a=o[0],i=o[1],c=(0,f.I)({queryKey:["all_settings"],queryFn:he}),l=c.data,s=c.error,R=(0,p.n)({mutationFn:de,onSuccess:function(){e.invalidateQueries(["all_settings"])}}),x=(0,p.n)({mutationFn:me}),O=null==l?void 0:l.meowapps_hide_meowapps,T=null==l?void 0:l.force_sslverify;le((function(){s&&!n&&(r(!0),console.error("Error from useQuery",s.message))}),[s]),le((function(){var e=document.getElementById("meow-common-phpinfo");e&&i(e.innerHTML)}),[]);var N=function(e,t){R.mutate({value:e,id:t})},_=React.createElement(d.d,{title:"Main Menu"},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"meowapps_hide_meowapps",label:"Hide (Not Recommended)",description:React.createElement(h.s,{p:!0},"This will hide the Meow Apps Menu (on the left side) and everything it contains. You can re-enable it through though an option that will be added in Settings → General."),value:"1",disabled:R.isPending,checked:O,onChange:N}))),L=React.createElement(d.d,{title:"SSL Verify"},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"force_sslverify",label:"Force (Not Recommended)",description:React.createElement(h.s,{p:!0},"This will enforce the usage of SSL when checking the license or updating the plugin."),value:"1",disabled:R.isPending,checked:T,onChange:N})));return React.createElement(v.z,{showRestError:n},React.createElement(g.n,{title:"The Dashboard"}),React.createElement(E.N,null,React.createElement(E.Y,{full:!0},React.createElement(b._,{keepTabOnReload:!0},React.createElement(b.V,{title:"Meow Apps"},se,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(G,{title:"AI Engine",className:"primary"},React.createElement(F,{src:"https://ps.w.org/ai-engine/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/ai-engine/",rel:"noreferrer"},"AI Engine")),React.createElement("p",{className:"plugin-actual-desc"},"This is the ultimate AI plugin for WordPress. From a chatbot adapted to your needs to an AI that can write your content for you, API, REST, and more."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/ai-engine/",rel:"noreferrer"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/ai-engine/",rel:"noreferrer"},"Meow Apps"))))),React.createElement(G,{title:"Media Cleaner",className:"primary"},React.createElement(F,{src:"https://ps.w.org/media-cleaner/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-cleaner/",rel:"noreferrer"},"Media Cleaner")),React.createElement("p",{className:"plugin-actual-desc"},"Is your Media Library bloated, your database heavy, and your website running slow? Media Cleaner will clean your Media Library from the media entries (and files) which aren't used in your website, as well as broken entries."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-cleaner/",rel:"noreferrer"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/media-cleaner/",rel:"noreferrer"},"Meow Apps"))))),React.createElement(G,{title:"Database Cleaner",className:"primary"},React.createElement(F,{src:"https://ps.w.org/database-cleaner/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/database-cleaner/",rel:"noreferrer"},"Database Cleaner")),React.createElement("p",{className:"plugin-actual-desc"},"Not only does Database Cleaner have a user-friendly UI, but it's also equipped to handle large DBs, giving it an edge over other plugins. It's a must-have for any WordPress site."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/database-cleaner/",rel:"noreferrer"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/database-cleaner/",rel:"noreferrer"},"Meow Apps"))))),React.createElement(G,{title:"Media File Renamer",className:"primary"},React.createElement(F,{src:"https://ps.w.org/media-file-renamer/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-file-renamer/",rel:"noreferrer"},"Media File Renamer")),React.createElement("p",{className:"plugin-actual-desc"},"Rename and move files directly from the dashboard, manually, automatically or via AI, either individually or in bulk. It's the best way to rename your files."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/media-file-renamer/",rel:"noreferrer"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/media-file-renamer/",rel:"noreferrer"},"Meow Apps"))))),React.createElement(G,{title:"Social Engine",className:"primary"},React.createElement(F,{src:"https://ps.w.org/social-engine/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/social-engine/",rel:"noreferrer"},"Social Engine")),React.createElement("p",{className:"plugin-actual-desc"},'Effortlessly schedule and automate the perfect posts for all your networks. Unlimited capabilities and infinite className="plugin-actual-desc" extensibility, for free!'),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/social-engine/",rel:"noreferrer"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/social-engine/",rel:"noreferrer"},"Meow Apps"))))),React.createElement(G,{title:"Meow Analytics",className:"primary"},React.createElement(F,{src:"https://ps.w.org/meow-analytics/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/meow-analytics/"},"Meow Analytics")),React.createElement("p",{className:"plugin-actual-desc"},"Google Analytics for your website. Simple and fast."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/meow-analytics/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://meowapps.com/meow-analytics/"},"Meow Apps")))))),React.createElement(E.Y,{minimal:!0},React.createElement(G,{title:"Contact Form Block",className:"primary"},React.createElement(F,{src:"https://ps.w.org/seo-engine/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{target:"_blank",href:"https://wordpress.org/plugins/seo-engine/",rel:"noreferrer"},"SEO Engine")),React.createElement("p",{className:"plugin-actual-desc"},"Optimize your content for SEO and for the AI world, with AI assistants... while keeping everything simple and fast, as it should be! ✌️"),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/seo-engine/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://meowapps.com/seo-engine/"},"Meow Apps"))))),React.createElement(G,{title:"Meow Gallery",className:"primary"},React.createElement(F,{src:"https://ps.w.org/meow-gallery/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/meow-gallery/"},"Meow Gallery")),React.createElement("p",{className:"plugin-actual-desc"},"Fast and beautiful galleries with many layouts. Forget the heavy and slow plugins, use the Meow Gallery for a better experience! 💕"),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/meow-gallery/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://meowapps.com/meow-gallery/"},"Meow Apps"))))),React.createElement(G,{title:"Meow Lightbox",className:"primary"},React.createElement(F,{src:"https://ps.w.org/meow-lightbox/assets/icon-256x256.gif"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/meow-lightbox/"},"Meow Lightbox")),React.createElement("p",{className:"plugin-actual-desc"},"Sleek and performant lightbox with EXIF support."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/meow-lightbox/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://meowapps.com/meow-lightbox/"},"Meow Apps"))))),React.createElement(G,{title:"Perfect Images (Retina)",className:"primary"},React.createElement(F,{src:"https://ps.w.org/wp-retina-2x/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/wp-retina-2x/"},"Perfect Images")),React.createElement("p",{className:"plugin-actual-desc"},"Manage, Optimize, Replace your images with Perfect Images."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/wp-retina-2x/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://meowapps.com/wp-retina-2x/"},"Meow Apps"))))),React.createElement(G,{title:"Photo Engine",className:"primary"},React.createElement(F,{src:"https://ps.w.org/wplr-sync/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/wplr-sync/"},"Photo Engine")),React.createElement("p",{className:"plugin-actual-desc"},"Organize your photos in folders and collections. Synchronize with Lightroom. Simplify and speed up your workflow."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/wplr-sync/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://meowapps.com/wplr-sync/"},"Meow Apps"))))),React.createElement(G,{title:"Contact Form Block",className:"primary"},React.createElement(F,{src:"https://ps.w.org/contact-form-block/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/contact-form-block/"},"Contact Form Block")),React.createElement("p",{className:"plugin-actual-desc"},"Need a very simple but straightforward contact form? This is the one you need. It's fast, simple, and efficient."),React.createElement("p",null,React.createElement("div",null,"Free Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://wordpress.org/plugins/contact-form-block/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{rel:"noreferrer",target:"_blank",href:"https://meowapps.com/contact-form-block/"},"Meow Apps")))))))),React.createElement(b.V,{title:"Performance"},fe,React.createElement("div",{style:{display:"flex",justifyContent:"space-around",marginBottom:25}},React.createElement(Z,{title:"Empty Request Time",request:"empty_request",max:2500}),React.createElement(Z,{title:"File Operation Time",request:"file_operation",max:2600}),React.createElement(Z,{title:"SQL Request Time",request:"sql_request",max:2800})),pe),React.createElement(b.V,{title:"PHP Info"},React.createElement(U,{dangerouslySetInnerHTML:{__html:a}})),React.createElement(b.V,{title:"PHP Error Logs"},React.createElement(M,null,React.createElement(w.M,{style:{marginBottom:10},color:"#ccb027",onClick:function(){x.mutate()},disabled:x.isPending,isBusy:x.isPending},"Load PHP Error Logs"),React.createElement(B,null,(x.data||[]).map((function(e){return React.createElement("li",{className:"log-".concat(e.type),key:e.id},React.createElement("span",{className:"log-type"},e.type),React.createElement("span",{className:"log-date"},e.date),React.createElement("span",{className:"log-content"},e.content))}))),React.createElement(h.s,{p:!0},"If you don't see any errors, your host might not allow remote access to PHP error logs. Contact them for assistance, or look in your hosting control panel."))),React.createElement(b.V,{title:"Settings"},React.createElement(S.z,{title:"Settings",className:"primary"},_,L))))))},ve=n(8700),ge=n(6734),Ee=n(7213),be=n(8696),we=n(9794);function Se(e){return Se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Se(e)}function Re(){Re=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new P(r||[]);return o(i,"_invoke",{value:T(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function x(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==Se(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function T(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Se(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},x(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function xe(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function Oe(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){xe(a,r,o,i,c,"next",e)}function c(e){xe(a,r,o,i,c,"throw",e)}i(void 0)}))}}var Te=function(e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t).toString(36)},Ne=function(){setTimeout(Oe(Re().mark((function e(){var t,n,r,o,a,i,c,l,u,s;return Re().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch("".concat(null===(t=window.MWCODE)||void 0===t||null===(t=t.rest_url)||void 0===t?void 0:t.replace(/\/+$/,""),"/meow-licenser/").concat(null===(n=window.MWCODE)||void 0===n?void 0:n.prefix,"/v1/get_license"),{method:"POST",headers:{"X-WP-Nonce":null===(r=window.MWCODE)||void 0===r?void 0:r.rest_nonce}});case 3:if(!(o=e.sent).ok){e.next=9;break}return e.next=7,o.json();case 7:if((a=e.sent).success&&a.data&&a.data.key)if(i=a.data,32===(c=i.key).length&&/^[0-9a-f]{32}$/.test(c)){s=Te(window.location.hostname);try{localStorage.removeItem(s)}catch(e){}}else if(!i.issue){l=Te(window.location.hostname);try{u=JSON.stringify({k:c,t:Date.now()}),localStorage.setItem(l,u)}catch(e){}}case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(0);case 13:case"end":return e.stop()}}),e,null,[[0,11]])}))),3e4)},_e=function(){try{var e,t,n=Te(window.location.hostname);try{var r,o=localStorage.getItem(n);if(o&&null!==(r=window.MWCODE)&&void 0!==r&&r.is_pro)try{var a,i,c,l=JSON.parse(o).t;if(Date.now()-l<288e5)return fetch("".concat(null===(a=window.MWCODE)||void 0===a||null===(a=a.rest_url)||void 0===a?void 0:a.replace(/\/+$/,""),"/meow-licenser/").concat(null===(i=window.MWCODE)||void 0===i?void 0:i.prefix,"/v1/get_license"),{method:"POST",headers:{"X-WP-Nonce":null===(c=window.MWCODE)||void 0===c?void 0:c.rest_nonce}}).then((function(e){if(e.ok)return e.json()})).then((function(e){e&&e.success&&e.data&&e.data.issue&&(localStorage.removeItem(n),window.location.reload())})).catch((function(){})),Ne(),!1;localStorage.removeItem(n)}catch(e){localStorage.removeItem(n)}}catch(e){}var u,s=null===(e=window.MWCODE)||void 0===e?void 0:e.build_ref;if(!s)return null!==(u=window.MWCODE)&&void 0!==u&&u.is_pro&&Ne(),!0;var f,p=function(e){for(var t="",n=0;n<e.length;n++)t+=(e.charCodeAt(n)^"9e1b6a5b15119ef7699943e6210b36e1".charCodeAt(n%32)).toString(16).padStart(2,"0");return t}(s),h="[CRYPTED_CHECKSUM_PIRACY]";if(h===String.fromCharCode(91,67,82,89,80,84,69,68,95,67,72,69,67,75,83,85,77,95,80,73,82,65,67,89,93))return null!==(f=window.MWCODE)&&void 0!==f&&f.is_pro&&Ne(),!0;var d=p===h;return d&&null!==(t=window.MWCODE)&&void 0!==t&&t.is_pro&&Ne(),d}catch(e){return!1}};function Le(e){return Le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Le(e)}function Pe(){Pe=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new P(r||[]);return o(i,"_invoke",{value:T(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function x(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==Le(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function T(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Le(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},x(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function Ie(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function ke(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Ie(a,r,o,i,c,"next",e)}function c(e){Ie(a,r,o,i,c,"throw",e)}i(void 0)}))}}function Ae(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ce(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ce(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var je=wp.element,De=je.useState,Me=je.useEffect,Ge="".concat(T,"/meow-licenser/").concat(x,"/v1"),Fe=function(){var e=Ae(De(!1),2),t=e[0],n=e[1],r=Ae(De(!1),2),o=r[0],a=r[1],i=Ae(De(null),2),c=i[0],l=i[1],u=Ae(De(null),2),s=u[0],f=u[1],p=Ae(De(""),2),d=p[0],m=p[1],y=Ae(De(!1),2),v=y[0],g=y[1],E=I&&(!s||"valid"!==s.license),b=function(){var e=ke(Pe().mark((function e(){var t;return Pe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(P){e.next=2;break}return e.abrupt("return");case 2:return n(!0),e.prev=3,e.next=6,(0,R.IU)("".concat(Ge,"/get_license"),{method:"POST",nonce:k});case 6:if(t=e.sent,f(t.data),!t.data||!t.data.key){e.next=15;break}if(32===t.data.key.length&&/^[0-9a-f]{32}$/.test(t.data.key)||t.data.issue){e.next=14;break}return g(!0),n(!1),e.abrupt("return");case 14:m(t.data.key);case 15:e.next=21;break;case 17:e.prev=17,e.t0=e.catch(3),alert("Error while checking the license. Check your console for more information."),console.error(e.t0);case 21:n(!1);case 22:case"end":return e.stop()}}),e,null,[[3,17]])})));return function(){return e.apply(this,arguments)}}(),x=function(){var e=ke(Pe().mark((function e(){return Pe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n(!0),e.prev=1,e.next=4,(0,R.IU)("".concat(Ge,"/set_license"),{method:"POST",nonce:k,json:{serialKey:null}});case 4:e.sent.success&&(m(""),f(null),l("licenseRemoved")),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),alert("Error while removing the license. Check your console for more information."),console.error(e.t0);case 12:n(!1);case 13:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}(),O=function(){var e=ke(Pe().mark((function e(){var t;return Pe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n(!0),e.prev=1,e.next=4,(0,R.IU)("".concat(Ge,"/set_license"),{method:"POST",nonce:k,json:{serialKey:d,override:!0}});case 4:(t=e.sent).success&&(f(t.data),t.data&&!t.data.issue&&l("licenseAdded")),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),alert("Error while forcing the license. Check your console for more information."),console.error(e.t0);case 12:n(!1);case 13:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(){return e.apply(this,arguments)}}(),T=function(){var e=ke(Pe().mark((function e(){var t;return Pe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("MEOW_OVERRIDE"!==d){e.next=9;break}if(a(!0),_e()){e.next=6;break}return g(!0),e.abrupt("return");case 6:return f(null),m(""),e.abrupt("return");case 9:return n(!0),e.prev=10,e.next=13,(0,R.IU)("".concat(Ge,"/set_license"),{method:"POST",nonce:k,json:{serialKey:d}});case 13:(t=e.sent).success&&(f(t.data),t.data&&!t.data.issue&&l("licenseAdded")),e.next=21;break;case 17:e.prev=17,e.t0=e.catch(10),alert("Error while validating the license. Check your console for more information."),console.error(e.t0);case 21:n(!1);case 22:case"end":return e.stop()}}),e,null,[[10,17]])})));return function(){return e.apply(this,arguments)}}();Me((function(){P&&(_e()||g(!0))}),[]),Me((function(){b()}),[]);var N=E?"Forced License":I?"Enabled":"Disabled",_=!v&&(E||s&&"valid"===s.license),L="Your license is active. Thanks a lot for your support :)";E&&(L="This license has been force-enabled for you.",s&&s.check_url&&(L=React.createElement(React.Fragment,null,React.createElement("span",null,L),React.createElement("br",null),React.createElement("small",null,"To check your license status, please click ",React.createElement("a",{target:"_blank",href:s.check_url+"&cache="+642e3*Math.random(),rel:"noreferrer"},"here"),".")))),_||(v?L=React.createElement(React.Fragment,null,React.createElement("p",null,"This copy does not match the official release. It appears to have been tampered with and may contain ",React.createElement("strong",null,"malicious code, spyware, or other security risks"),". For your safety, delete this version immediately and download only from the official source: ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com"},"Meow Apps"),"."),React.createElement("p",null,"If you obtained this from any other website than Meow Apps, ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com/contact/"},"contact us")," and dispute the charge with your credit card provider or bank immediately.")):s&&s.key?"no_activations_left"===s.issue?L=React.createElement("span",null,"There are no activations left for this license. You can visit your account at ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com"},"Meow Apps"),", unregister a site, and click on ",React.createElement("i",null,"Retry to validate"),"."):"expired"===s.issue?L=React.createElement("span",null,"Your license has expired. You can get another license or renew the current one by visiting your account at ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com"},"Meow Apps"),"."):"missing"===s.issue?L="This license does not exist.":"disabled"===s.issue?L="This license has been disabled.":"item_name_mismatch"===s.issue?L="This license seems to be for a different plugin... isn't it? :)":"forced"===s.issue?L="ABC":(L=React.createElement("span",null,"There is an unknown error related to the system or this serial key. Really sorry about this! Make sure your security plugins and systems are off temporarily. If you are still experiencing an issue, please ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com/contact/"},"contact us"),"."),console.error({license:s})):L="Please enter your license key below to activate Pro features.");var A=React.createElement(S.z,{title:"Pro Version (Not Installed)",className:"primary"},"You will find more information about the Pro Version ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com"},"here"),". If you actually bought the Pro Version already, please remove the current plugin and download the Pro Version from your account at ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com/"},"Meow Apps"),"."),C=React.createElement(S.z,{title:"Pro Version (".concat(N,")"),busy:t,className:"primary"},!v&&!E&&!(s&&s.key===d)&&React.createElement(React.Fragment,null,React.createElement("div",{style:{marginBottom:10}},"License Key:"),React.createElement(be.A,{id:"mfrh_pro_serial",name:"mfrh_pro_serial",disabled:t,value:d,onChange:function(e){return m(e.trim())},placeholder:"Type your license key..."}),React.createElement(h.s,{p:!0},"Insert your serial key above. If you don't have one yet, you can get one ",React.createElement("a",{href:"https://meowapps.com"},"here"),". If there was an error during the validation, try the ",React.createElement("i",null,"Retry")," to ",React.createElement("i",null,"validate")," button.")),!_&&React.createElement(Ee.X,{variant:"danger"},L),_&&React.createElement(Ee.X,{variant:"success"},L),!v&&React.createElement("div",{style:{marginTop:15,display:"flex",justifyContent:"end"}},s&&!_&&React.createElement(w.M,{className:"secondary",disabled:t||!d,onClick:T},"Retry to validate"),s&&s.key===d&&React.createElement(w.M,{className:"secondary",disabled:t||!d,onClick:x},"Remove License"),React.createElement(w.M,{disabled:t||!d||s&&s.key===d,onClick:T},"Validate License"),o&&!_&&React.createElement(w.M,{disabled:t||!d||s&&s.key===d,onClick:O,className:"danger"},"Force License")),React.createElement(we.n,{isOpen:"licenseAdded"===c,title:"Thank you :)",content:"The Pro features have been enabled. This page should be now reloaded.",okButton:{label:"Reload",onClick:function(){return location.reload()}}}),React.createElement(we.n,{isOpen:"licenseRemoved"===c,title:"Goodbye :(",content:"The Pro features have been disabled. This page should be now reloaded.",okButton:{label:"Reload",onClick:function(){return location.reload()}}}));return P?C:A},Ue=wp.i18n.__,Be={},He="code-engine";Be.PENDING=Ue("Pending",He),Be.RENAME=Ue("Rename",He),Be.TITLE=Ue("Title",He),Be.ERROR={SNIPPET_FATAL:Ue("⚠️ A fatal error occured while running the snippet ",He),SNIPPET_DISABLED:Ue("This snippet has been disabled. This message will disappear automatically when you refresh the page.",He),UPDATING_OPTIONS:Ue("An error occured while updating the options.",He),GETTING_OPTIONS:Ue("An error occured while getting the options.",He),CHECK_YOUR_CONSOLE:Ue('For more information, check <a target="_blank" href="https://meowapps.com/tutorial-network-activity-dev-tools/">your console</a>. You might also want to check your <a target="_blank" href="https://meowapps.com/tutorial-php-error-logs/">PHP Error Logs</a>.',He)},Be.ALERTS={ARE_YOU_SURE:Ue("Are you sure?",He)},Be.MAINTENANCE={CLEAN_UNINSTALL:Ue("Clean Uninstall",He),CLEAN_UNINSTALL_DESCRIPTION:Ue("This will delete all the plugin's data from the database when uninstalling.",He)},Be.COMMON={YES:Ue("Yes",He),NO:Ue("No",He),OK:Ue("OK",He),CANCEL:Ue("Cancel",He),CLEAR:Ue("Clear",He),CLOSE:Ue("Close",He),SAVE:Ue("Save",He),SAVE_AND_CLOSE:Ue("Save & Close",He),UPDATE:Ue("Update",He),RESET:Ue("Reset",He),REFRESH:Ue("Refresh",He),LOADING:Ue("Loading...",He),RESET_SETTINGS:Ue("Reset Settings",He),REFRESH_SETTINGS:Ue("Refresh Settings",He),DELETE:Ue("Delete",He),CLONE:Ue("Clone",He),NO_RESULTS:Ue("There aren't any snippets yet.",He),ADD:Ue("Add",He),UPLOAD:Ue("Upload",He),UPLOADING:Ue("Uploading...",He),EDIT:Ue("Edit",He),RENAME:Ue("Rename",He),MAINTENANCE:Ue("Maintenance",He),SEARCH:Ue("Search",He),SELECT:Ue("Select",He),SELECT_ALL:Ue("Select All",He),UNSELECT_ALL:Ue("Unselect All",He),ENABLE:Ue("Enable",He),ENABLE_RECOMMENDED:Ue("Enable (Recommended)",He),ENABLE_NOT_RECOMMENDED:Ue("Enable (Not Recommended)",He),DISABLE:Ue("Disable",He),DISABLE_RECOMMENDED:Ue("Disable (Recommended)",He),DASHBOARD:Ue("Dashboard",He),SETTINGS:Ue("Settings",He),LICENSE_TAB:Ue("License",He),REFRESH_LOGS:Ue("Refresh Logs",He),CLEAR_LOGS:Ue("Clear Logs",He),LOGS:Ue("Logs",He),HIDE:Ue("Hide",He),DATA_NOT_AVAILABLE:Ue("Data not available",He)},Be.SETTINGS={TITLE:Ue("Settings",He),HEADER_TITLE:Ue("Code Engine",He),IMPORT_SETTINGS:Ue("Import Settings & Snippets",He),EXPORT_SETTINGS:Ue("Export Settings & Snippets",He),SHOW_TUTORIAL:Ue("Show Tutorial",He),QUICK_START:Ue("Quick Start",He),QUICK_START_INFO:Ue("Describe what you are trying to achieve, and Code Engine will generate the code and set up all the parameters for you.",He),QUICK_START_PLACEHOLDER:Ue("A PHP function that takes a message and send it to an email...",He),MODULES:{TITLE:Ue("Modules",He),DESCRIPTION:Ue("Manage the modules and their settings.",He),CODE_BLOCKS:Ue("Code Blocks",He),CODE_BLOCKS_DESCRIPTION:Ue("This will let you select all the posts where you want to enable the Code Engine Blocks. Each of these selected posts will allow you to run PHP/JS code directly as Blocks or Shortcodes. However, it is recommended to use the Code Engine Content Snippets instead.",He),CODE_BLOCKS_SELECTION:Ue("Code Blocks Enabled Posts",He),CODE_BLOCKS_INSTRUCTIONS:Ue("Instructions",He),CODE_BLOCKS_INSTRUCTIONS_DESCRIPTION:Ue("The posts you select here will be allowed to use the Code Engine Blocks. This means that any user with the “edit_posts” capability will be able to run PHP/JS code in these posts, either using the Code Engine Block or the Code Engine shortcode with the “code” attribute.",He),CODE_BLOCKS_INSTRUCTIONS_WARNING:Ue("If you want to include PHP/JS code snippets in your posts that are managed only by an admin, you should create a Content Snippet (PHP/JS) instead. This allows you to reference the code using a shortcode with a unique ID, and it will not be editable by other users. This is the recommended way to use Code Engine in your posts.",He)},AI_PARAMETERS:{TITLE:Ue("AI Parameters",He),AI_ENGINE_INSTALLED:Ue("AI Engine",He),AI_ENGINE_REQUIRED:Ue("AI Engine",He),DOWNLOAD_AI_ENGINE:Ue("Download AI Engine",He),AI_SUGGESTIONS:Ue("AI Suggestions",He),AI_SUGGESTIONS_DESCRIPTION:Ue(" Will add a panel of AI features above the code editor.",He)},DEVELOPERS:{TITLE:Ue("For Developers",He),SANITIZE_ARGS:Ue("Sanitize Arguments",He),SANITIZE_ARGS_DESCRIPTION:Ue("Sanitize the arguments before running the snippet: Make sure the non numeric values are in quotes, and ensure the API arguments' names are using the PHP '$' prefix.",He),LOGS:Ue("Logs",He),LOGS_DESCRIPTION:Ue("Enable the server logs for debugging purposes.",He),DATABASE_INSPECTION:Ue("Database Inspection",He),DATABASE_INSPECTION_DESCRIPTION:Ue("This will add a new tab in the settings to inspect the plugin's options directly from the databse.",He),DISALLOW_BLOCK_PHP:Ue("No PHP in Blocks",He),DISALLOW_BLOCK_PHP_DESCRIPTION:Ue('The Code Engine Block will not be able to run PHP code. This is recommended for security reasons, but you can disable it if you want to use PHP in Blocks. It is recommended to use a Content Snippet (PHP) instead. If disabled, any user with the "edit_posts" capability will be able to run PHP code in Blocks.',He),BYPASS_SECURITY:Ue("Bypass REST Security",He),BYPASS_SECURITY_DESCRIPTION:Ue("Disables REST API security checks. Better to use filters mwcode_rest_whitelist or mwcode_rest_authorized for specific routes.",He),MCP_SUPPORT:Ue("MCP Support",He),MCP_SUPPORT_DESCRIPTION:Ue("The internal API of Code Engine will be registered to the MCP server implemented by AI Engine.",He),RAW_EDIT:Ue("Raw Edit",He)},PREFERENCES:{TITLE:Ue("Preferences",He),PUBLIC_API:Ue("Public API",He),SNIPPET_ENDPOINT:Ue("Snippet Endpoint",He),SNIPPET_ENDPOINT_DESCRIPTION:Ue("This will let you choose for each snippet an endpoint to call it from the outside.",He),CODE_PREVIEW:Ue("Code Preview",He),CODE_PREVIEW_DESCRIPTION:Ue("Display code preview inside the snippets table.",He)},SNIPPETS:Ue("Snippets",He),SNIPPETS_TABLE_COLUMNS:{SNIPPET:Ue("Snippet",He),ATTRIBUTES:Ue("Attributes",He),TYPE:Ue("Type",He),ACTIVE:Ue("Active",He),ACTIONS:Ue("Actions",He),FUNCTION:Ue("Function",He)},SNIPPET:{PUBLIC_API:Ue("Public API",He),TOKEN:Ue("Bearer Token",He),METHOD:Ue("Method",He),LABEL:Ue("Snippet",He),TURN_ON:Ue("On",He),TURN_OFF:Ue("Disabled",He),RUN:Ue("Run",He),CODE:Ue("Code",He),NAME:Ue("Name",He),TEST:Ue("Test",He),BEHAVIOR:Ue("Behavior",He),TARGET:Ue("Target",He),BEHAVIOR_DYNAMIC:Ue("Allows functions to feedback into the AI for ongoing interactions.",He),BEHAVIOR_STATIC:Ue("Executes tasks independently, suitable for single, definitive actions.",He),DESCRIPTION:Ue("Description",He),MISSING_TYPE_WARNING:Ue("Types are missing for the arguments. Add a type to each one to avoid errors.",He),DEFAULT_VALUE:Ue("Default Value",He),TAGS:Ue("Tags",He),TAGS_DESCRIPTION:Ue("Tags separated by commas.",He),HOURS:Ue("Hours",He),MINUTES:Ue("Minutes",He),PRIORITY:Ue("Priority",He),TIMEFRAME:Ue("Timeframe",He),TARGET_TIME:Ue("Target Time",He),TYPE:Ue("Type",He),READ_COMMENTS:Ue("Query AI (Via Comments)",He),MODIFY_BEFORE_USE:Ue("Modify before use",He),ENDPOINT:Ue("Endpoint Slug",He),ENDPOINT_URL:Ue("The endpoint will be <strong>{0}</strong>",He),PUBLIC_API_DESCRIPTION:Ue("This feature is in beta. It allows calling this function via the REST API",He),SCOPES:{ALL:Ue("All",He),GLOBAL_FRONTEND_BACKEND:Ue("Global (All)",He),GLOBAL_FRONTEND:Ue("Global (Front)",He),GLOBAL_BACKEND:Ue("Global (Admin)",He),CONTENT_PHP:Ue("Content (PHP)",He),CONTENT_JS:Ue("Content (JS)",He),FRONTEND:Ue("Front",He),BACKEND:Ue("Admin",He),PERSISTENT:Ue("Global",He),FUNCTION:Ue("Callable",He),SCHEDULED:Ue("Scheduled",He)},SELECT_SNIPPET:Ue("Select a snippet on the left, or click the + button if you want new one.",He),SELECT_ALL_TAGS:Ue("Select all tags",He),IMPORT_CODE_SNIPPETS:Ue("Import All Snippets from Code Snippets",He),TEST_PARAMETERS_DESCRIPTION_LOG:Ue("Use the <strong>echo (PHP)</strong> or <strong>console.log() (JS)</strong> functions to print anything in the console above.",He),TEST_PARAMETERS_DESCRIPTION_ARG:Ue("• You can change the default value of the function paramaters in the <strong>Function</strong> tab.",He)},STRING_VALUE_WARNING:Ue("This value appears to be a string. Ensure to have quotes around it.",He),ADD_QOUTES:Ue("Add Quotes",He),EDITOR:Ue("Editor",He),SIDEBAR_EDITOR:Ue("Sidebar Editor",He),SUCCESSFULLY_RAN:Ue("Snippet successfully ran: {0}",He)};const Ve=Be;function ze(e){return ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ze(e)}function Ye(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function We(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ye(Object(n),!0).forEach((function(t){Ke(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ye(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ke(e,t,n){return(t=function(e){var t=function(e){if("object"!=ze(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ze(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ze(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qe(){qe=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new P(r||[]);return o(i,"_invoke",{value:T(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function x(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==ze(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function T(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(ze(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},x(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function Je(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function $e(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Je(a,r,o,i,c,"next",e)}function c(e){Je(a,r,o,i,c,"throw",e)}i(void 0)}))}}var Qe=function(){var e=$e(qe().mark((function e(){var t;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,R.IU)("".concat(N,"/get_logs"),{nonce:k,method:"GET"});case 3:return t=e.sent,e.abrupt("return",t.data);case 7:throw e.prev=7,e.t0=e.catch(0),new Error(e.t0.message);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}(),Xe=function(){var e=$e(qe().mark((function e(){return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,R.IU)("".concat(N,"/clear_logs"),{nonce:k});case 3:e.next=8;break;case 5:throw e.prev=5,e.t0=e.catch(0),new Error(e.t0.message);case 8:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(){return e.apply(this,arguments)}}(),Ze=function(){var e=$e(qe().mark((function e(){var t;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/settings/list"),{method:"GET",nonce:k});case 2:if((t=e.sent).success){e.next=5;break}throw new Error(null==t?void 0:t.message);case 5:return e.abrupt("return",t.options);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),et=function(){var e=$e(qe().mark((function e(t){var n;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/settings/update"),{method:"POST",nonce:k,json:t});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",n.options);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),tt=function(){var e=$e(qe().mark((function e(){var t;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/settings/reset"),{method:"POST",nonce:k});case 2:if((t=e.sent).success){e.next=5;break}throw new Error(null==t?void 0:t.message);case 5:return e.abrupt("return",t.options);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),nt=function(){var e=$e(qe().mark((function e(t){var n,r,o,a,i,c,l,u,s;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t(!0),n=new Date,e.next=5,Ze();case 5:return r=e.sent,e.next=8,ct({limit:999});case 8:return o=e.sent.snippets,e.next=11,lt();case 11:a=e.sent,i={options:r,snippets:o,functions:a},c="code-engine-".concat(n.getFullYear(),"-").concat(n.getMonth()+1,"-").concat(n.getDate(),".json"),l=new Blob([JSON.stringify(i)],{type:"application/json"}),u=URL.createObjectURL(l),(s=document.createElement("a")).href=u,s.setAttribute("download",c),s.click(),e.next=26;break;case 22:e.prev=22,e.t0=e.catch(0),alert("Error while exporting settings. Please check your console."),console.log(e.t0);case 26:return e.prev=26,t(!1),e.finish(26);case 29:case"end":return e.stop()}}),e,null,[[0,22,26,29]])})));return function(t){return e.apply(this,arguments)}}(),rt=function(){var e=$e(qe().mark((function e(t){var n;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{(n=document.createElement("input")).type="file",n.accept="application/json",n.onchange=function(){var e=$e(qe().mark((function e(n){var r,o;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.target.files[0]){e.next=3;break}return e.abrupt("return");case 3:o=new FileReader,t(!0),o.onload=function(){var e=$e(qe().mark((function e(t){var n,r,o,a;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=JSON.parse(t.target.result),r=n.options,o=n.snippets,a=n.functions,console.log("Updating settings...",r),e.next=5,et({options:r});case 5:return console.log("Settings updated."),console.log("Updating snippets...",o),e.next=9,ft(o);case 9:return console.log("Snippets updated."),console.log("Updating functions...",a),e.next=13,ut(a);case 13:console.log("Functions updated."),alert("Settings imported. The page will now reload to reflect the changes."),window.location.reload();case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),o.readAsText(r);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.click()}catch(e){alert("Error while importing settings. Please check your console."),console.log(e)}finally{t(!1)}case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ot=function(){var e=$e(qe().mark((function e(){var t;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/settings/functions/raw"),{method:"GET",nonce:k});case 2:if((t=e.sent).success){e.next=5;break}throw new Error(null==t?void 0:t.message);case 5:return e.abrupt("return",t.functions);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),at=function(){var e=$e(qe().mark((function e(t){var n;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/settings/functions/raw"),{method:"POST",nonce:k,json:{functions:t}});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",n.functions);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),it=!0,ct=function(){var e=$e(qe().mark((function e(t){var n;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return it=!0,e.next=3,(0,R.IU)("".concat(N,"/snippets/list"),{method:"POST",nonce:k,json:t});case 3:if(n=e.sent,it=!1,n.success){e.next=7;break}throw new Error(null==n?void 0:n.message);case 7:return e.abrupt("return",{snippets:n.data,total:n.total});case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),lt=function(){var e=$e(qe().mark((function e(){var t;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/settings/functions"),{method:"GET",nonce:k});case 2:if((t=e.sent).success){e.next=5;break}throw new Error(null==t?void 0:t.message);case 5:return e.abrupt("return",t.functions);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ut=function(){var e=$e(qe().mark((function e(t){var n;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/settings/functions/replace"),{method:"POST",nonce:k,json:{functions:t}});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",{functions:n.data});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),st=function(){var e=$e(qe().mark((function e(){var t;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/snippets/tags"),{method:"POST",nonce:k});case 2:if((t=e.sent).success){e.next=5;break}throw new Error(null==t?void 0:t.message);case 5:return e.abrupt("return",{tags:t.data});case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ft=function(){var e=$e(qe().mark((function e(t){var n;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/snippets/replace"),{method:"POST",nonce:k,json:{snippets:t}});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",{snippets:n.data});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),pt=function(){var e=$e(qe().mark((function e(){var t;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/snippets/import"),{method:"GET",nonce:k});case 2:if((t=e.sent).success){e.next=6;break}throw alert("⚠️ "+(null==t?void 0:t.message)),new Error(null==t?void 0:t.message);case 6:return alert(t.total+" snippets imported."),e.abrupt("return",{total:t.total});case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ht=function(){var e=$e(qe().mark((function e(){var t;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/snippets/stats"),{method:"GET",nonce:k});case 2:if((t=e.sent).success){e.next=5;break}throw new Error(null==t?void 0:t.message);case 5:return e.abrupt("return",{stats:t.data});case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),dt=function(){var e=$e(qe().mark((function e(t){var n;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/snippets/add"),{method:"POST",nonce:k,json:t});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",{snippet:n.snippet,snippets:n.data,total:n.total});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),mt=function(){var e=$e(qe().mark((function e(t){var n;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/snippets/update"),{method:"POST",nonce:k,json:t});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",{snippets:n.data,total:n.total});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),yt=function(){var e=$e(qe().mark((function e(t){var n;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/snippets/delete"),{method:"POST",nonce:k,json:t});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",{snippets:n.data,total:n.total});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),vt=function(){var e=$e(qe().mark((function e(t){var n;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/run/test"),{method:"POST",nonce:k,json:We(We({},t),{},{test:!0})});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",{result:{return:n.return,error:n.error}});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),gt=function(){var e=$e(qe().mark((function e(t){var n;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/run/lint"),{method:"POST",nonce:k,json:t});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",{result:n.lint});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Et=function(){var e=$e(qe().mark((function e(t){var n;return qe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/quick_start"),{method:"POST",nonce:k,json:{prompt:t}});case 2:if((n=e.sent).success){e.next=5;break}throw new Error(null==n?void 0:n.message);case 5:return e.abrupt("return",n.data);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function bt(e){return bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bt(e)}function wt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function St(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?wt(Object(n),!0).forEach((function(t){Rt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Rt(e,t,n){return(t=function(e){var t=function(e){if("object"!=bt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=bt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==bt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xt(){xt=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new P(r||[]);return o(i,"_invoke",{value:T(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function x(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==bt(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function T(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(bt(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},x(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function Ot(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function Tt(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Ot(a,r,o,i,c,"next",e)}function c(e){Ot(a,r,o,i,c,"throw",e)}i(void 0)}))}}function Nt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _t(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_t(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Lt=wp.element,Pt=Lt.useContext,It=Lt.createContext,kt=Lt.useState,At=It(),Ct=function(e){var t=e.children,n=Nt(kt(A),2),r=n[0],o=n[1],a=Nt(kt({}),2),i=a[0],c=a[1],l=Nt(kt(null),2),u=l[0],s=l[1],f=Nt(kt(!1),2),p=f[0],h=f[1],d=function(e){console.error(Ve.ERROR.GETTING_OPTIONS,null!=e&&e.message?{message:e.message}:{err:e}),e.message&&s(React.createElement(React.Fragment,null,React.createElement("div",null,Ve.ERROR.GETTING_OPTIONS),React.createElement("small",null,(0,R.FE)(Ve.ERROR.CHECK_YOUR_CONSOLE))))},m=function(){var e=Tt(xt().mark((function e(){var t;return xt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h(!0),e.prev=1,e.next=4,Ze();case 4:t=e.sent,o(t),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),d(e.t0);case 11:return e.prev=11,h(!1),e.finish(11);case 14:case"end":return e.stop()}}),e,null,[[1,8,11,14]])})));return function(){return e.apply(this,arguments)}}(),y=function(){var e=Tt(xt().mark((function e(t,n){var a,i;return xt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=St(St({},r),{},Rt({},n,t)),JSON.stringify(a)!==JSON.stringify(r)){e.next=3;break}return e.abrupt("return");case 3:return h(!0),e.prev=4,e.next=7,et({options:a});case 7:i=e.sent,o(i),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),d(e.t0);case 14:return e.prev=14,h(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[4,11,14,17]])})));return function(t,n){return e.apply(this,arguments)}}(),v=function(){var e=Tt(xt().mark((function e(){var t;return xt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.confirm(Ve.ALERTS.ARE_YOU_SURE)){e.next=2;break}return e.abrupt("return");case 2:return h(!0),e.prev=3,e.next=6,tt();case 6:t=e.sent,o(t),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(3),console.error(Ve.ERROR.UPDATING_OPTIONS,null!==e.t0&&void 0!==e.t0&&e.t0.message?{message:e.t0.message}:{err:e.t0}),e.t0.message&&s(React.createElement(React.Fragment,null,React.createElement("div",null,Ve.ERROR.UPDATING_OPTIONS),React.createElement("small",null,(0,R.FE)(Ve.ERROR.CHECK_YOUR_CONSOLE))));case 14:return e.prev=14,h(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[3,10,14,17]])})));return function(){return e.apply(this,arguments)}}(),g={updateOption:y,getOption:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null!==(t=r[e])&&void 0!==t?t:n},resetOptions:v,refreshOptions:m,setError:s,setIsLoading:h,setModals:c},E={options:r,error:u,isLoading:p,modals:i};return React.createElement(At.Provider,{value:{state:E,actions:g}},t,React.createElement(we.n,{isOpen:u,title:Ve.COMMON.ERROR,content:u,ok:Ve.COMMON.CLOSE,onRequestClose:function(){return s(!1)},onOkClick:function(){return s(!1)}}))},jt=function(){var e=Pt(At);if(!e)throw new Error("useCoreContext must be used within a CoreContextProvider");return e},Dt=n(7494),Mt=n(3273),Gt=n(8482),Ft=n(520),Ut=n(2557),Bt=n(3896),Ht=n(7571);function Vt(e){return Vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vt(e)}function zt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Yt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?zt(Object(n),!0).forEach((function(t){Wt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Wt(e,t,n){return(t=function(e){var t=function(e){if("object"!=Vt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Vt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Vt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Kt=function(e,t){if(!e||!t)return e!==t;var n=Yt({},e),r=Yt({},t);delete n.functionError,delete r.functionError;var o=Object.keys(n).sort().reduce((function(e,t){return e[t]=n[t],e}),{}),a=Object.keys(r).sort().reduce((function(e,t){return e[t]=r[t],e}),{});return JSON.stringify(o)!==JSON.stringify(a)},qt=[{value:"all",label:Ve.SETTINGS.SNIPPET.SCOPES.ALL,color:"var(--neko-grey)",select_hidden:!0},{value:"global",label:Ve.SETTINGS.SNIPPET.SCOPES.PERSISTENT,color:"var(--neko-purple)",childScopes:["frontend","backend","persistent"]},{value:"function",label:Ve.SETTINGS.SNIPPET.SCOPES.FUNCTION,color:"var(--neko-orange)"},{value:"scheduled",label:Ve.SETTINGS.SNIPPET.SCOPES.SCHEDULED,color:"var(--neko-cyan)"},{value:"disabled",label:Ve.SETTINGS.SNIPPET.TURN_OFF,select_hidden:!0},{value:"content_js",label:Ve.SETTINGS.SNIPPET.SCOPES.CONTENT_JS,color:"var(--neko-green)"},{value:"content_php",label:Ve.SETTINGS.SNIPPET.SCOPES.CONTENT_PHP,color:"var(--neko-green)"}],Jt=[{value:"persistent",label:Ve.SETTINGS.SNIPPET.SCOPES.GLOBAL_FRONTEND_BACKEND},{value:"frontend",label:Ve.SETTINGS.SNIPPET.SCOPES.GLOBAL_FRONTEND},{value:"backend",label:Ve.SETTINGS.SNIPPET.SCOPES.GLOBAL_BACKEND},{value:"function",label:Ve.SETTINGS.SNIPPET.SCOPES.FUNCTION},{value:"scheduled",label:Ve.SETTINGS.SNIPPET.SCOPES.SCHEDULED},{value:"content_php",label:Ve.SETTINGS.SNIPPET.SCOPES.CONTENT_PHP},{value:"content_js",label:Ve.SETTINGS.SNIPPET.SCOPES.CONTENT_JS}],$t={marginTop:10,background:"rgb(0, 72, 88)",padding:10,color:"rgb(58, 212, 58)",maxHeight:220,minHeight:200,display:"block",fontFamily:"monospace",fontSize:12,overflowX:"auto",borderRadius:10,overflowWrap:"break-word"},Qt={id:null,name:"New Snippet",description:"New snippet without a description.",code:"",tags:"",priority:10,scope:"persistent",active:1,endpoint:"",functionName:"",functionArgs:[],functionArgsDict:{},functionBehavior:"dynamic",functionTarget:"php",intervalHours:(new Date).getHours(),intervalMinutes:(new Date).getMinutes()},Xt=(Ve.SETTINGS.SNIPPETS_TABLE_COLUMNS.SNIPPET,Ve.SETTINGS.SNIPPETS_TABLE_COLUMNS.FUNCTION,Ve.SETTINGS.SNIPPETS_TABLE_COLUMNS.ENDPOINT,Ve.SETTINGS.SNIPPETS_TABLE_COLUMNS.TYPE,Ve.SETTINGS.SNIPPETS_TABLE_COLUMNS.ACTIONS,React.createElement("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("g",{"clip-path":"url(#clip0_323_423)"},React.createElement("path",{d:"M0 0H64V64H0V0Z",fill:"#8F9ED1"}),React.createElement("path",{d:"M21.7412 32.0461L22.0318 30.8851L21.7412 32.0461ZM21.7412 32.0461C21.0578 34.7763 18.616 36.6829 15.803 36.6829M21.7412 32.0461L15.803 36.6829M15.803 36.6829H10.9194M15.803 36.6829H10.9194M10.9194 36.6829L13.361 26.9164H18.9313C19.9227 26.9164 20.8396 27.3638 21.45 28.1449C22.0588 28.9261 22.2706 29.9252 22.0318 30.885L10.9194 36.6829ZM24.1207 26.0585L24.1206 26.0584C22.8634 24.4501 20.9733 23.5276 18.9313 23.5276H10.7526H10.7136L10.7041 23.5655L4.95149 46.5872L4.93597 46.6493H5H8.38837H8.42741L8.43688 46.6114L10.0722 40.0717H15.803C20.1731 40.0717 23.9668 37.1093 25.0274 32.87L24.9789 32.8579L25.0274 32.87L25.3181 31.7074C25.8132 29.7269 25.3763 27.6684 24.1207 26.0585Z",fill:"white",stroke:"white","stroke-width":"0.1"}),React.createElement("path",{d:"M56.2737 32.0461L56.5643 30.8851L56.2737 32.0461ZM56.2737 32.0461C55.5903 34.7763 53.1485 36.6829 50.3355 36.6829M56.2737 32.0461L50.3355 36.6829M50.3355 36.6829H45.4519M50.3355 36.6829H45.4519M45.4519 36.6829L47.8935 26.9164H53.4637C54.4552 26.9164 55.372 27.3638 55.9824 28.1449C56.5912 28.9261 56.8031 29.9252 56.5643 30.885L45.4519 36.6829ZM58.6532 26.0585L58.6531 26.0584C57.3959 24.4501 55.5057 23.5276 53.4637 23.5276H45.2851H45.246L45.2366 23.5655L39.484 46.5872L39.4684 46.6493H39.5325H42.9208H42.9599L42.9693 46.6114L44.6047 40.0717H50.3355C54.7055 40.0717 58.4993 37.1093 59.5599 32.87L59.5114 32.8579L59.5599 32.87L59.8506 31.7074C60.3457 29.7269 59.9088 27.6684 58.6532 26.0585Z",fill:"white",stroke:"white","stroke-width":"0.1"}),React.createElement("path",{d:"M40.9479 25.5534L40.9478 25.5534C39.8994 24.2667 38.3467 23.5276 36.6857 23.5276H31.5329L32.7178 17.0089L32.7285 16.95H32.6686H29.3276H29.2859L29.2784 16.9911L25.0933 40.0127L25.0826 40.0716H25.1425H28.4835H28.5252L28.5327 40.0306L30.9168 26.9164H36.6857C37.3226 26.9164 37.917 27.1987 38.3186 27.6929C38.7205 28.1874 38.8767 28.827 38.7631 29.3829L36.092 40.0094L36.0763 40.0716H36.1405H39.5314H39.5704L39.5799 40.0338L42.0656 30.1417L42.0657 30.1417L42.0661 30.1397C42.4032 28.5143 41.9947 26.8417 40.9479 25.5534Z",fill:"white",stroke:"white","stroke-width":"0.1"})),React.createElement("defs",null,React.createElement("clipPath",{id:"clip0_323_423"},React.createElement("rect",{width:"64",height:"64",fill:"white"}))))),Zt=React.createElement("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("g",{"clip-path":"url(#clip0_323_419)"},React.createElement("path",{d:"M0 0H64V64H0V0Z",fill:"#FFDF00"}),React.createElement("path",{d:"M36.3116 37.1954C37.4119 39.0229 38.8435 40.3661 41.3753 40.3661C43.5022 40.3661 44.8609 39.2847 44.8609 37.7907C44.8609 36.0002 43.465 35.3661 41.1239 34.3245L39.8406 33.7644C36.1364 32.1592 33.6757 30.1482 33.6757 25.8971C33.6757 21.9811 36.609 19 41.1932 19C44.4569 19 46.8032 20.1554 48.494 23.1806L44.4968 25.7913C43.6167 24.1861 42.6673 23.5537 41.1932 23.5537C39.6897 23.5537 38.7368 24.5239 38.7368 25.7913C38.7368 27.3577 39.6906 27.9918 41.8929 28.9621L43.1762 29.5212C47.5376 31.4236 50 33.3631 50 37.7236C50 42.4246 46.3695 45 41.494 45C36.7268 45 33.647 42.6892 32.14 39.6605L36.3116 37.1954ZM18.1784 37.6479C18.9848 39.1032 19.7184 40.3335 21.482 40.3335C23.1685 40.3335 24.2324 39.6623 24.2324 37.0526V19.2982H29.3655V37.123C29.3655 42.5295 26.2493 44.9903 21.7005 44.9903C17.5906 44.9903 15.2105 42.8268 14 40.221L18.1784 37.6479Z",fill:"black"})),React.createElement("defs",null,React.createElement("clipPath",{id:"clip0_323_419"},React.createElement("rect",{width:"64",height:"64",fill:"white"}))));function en(e){return en="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},en(e)}function tn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function nn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tn(Object(n),!0).forEach((function(t){rn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function rn(e,t,n){return(t=function(e){var t=function(e){if("object"!=en(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=en(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==en(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function on(){on=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new P(r||[]);return o(i,"_invoke",{value:T(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function x(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==en(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function T(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(en(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},x(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function an(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function cn(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){an(a,r,o,i,c,"next",e)}function c(e){an(a,r,o,i,c,"throw",e)}i(void 0)}))}}function ln(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return un(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?un(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var sn,fn=wp.element,pn=fn.useState,hn=fn.useMemo,dn=function(e){var t,n=e.onCreated,r=e.onUpdated,o=e.onDeleted,a=e.onTestedSnippet,i=(e.onRanSnippet,e.onError),c=ln(pn(null),2),l=c[0],s=c[1],f=ln(pn(!1),2),h=f[0],d=f[1],m=ln(pn({page:1,limit:10,filters:[{accessor:"scope",value:"all"}],sort:{accessor:"id",by:"asc"}}),2),y=m[0],v=m[1],g=["snippets",y],E=["tags"],b=["stats"],w=(0,u.jE)(),S=(0,Ht.E)({queries:[{queryKey:E,queryFn:st},{queryKey:g,queryFn:function(){return ct(y)}},{queryKey:b,queryFn:ht}]}),R=(S[0].data||{}).tags,x=void 0===R?[]:R,O=S[1].data||{},T=O.snippets,N=void 0===T?[]:T,_=O.total,L=void 0===_?0:_,P=(S[2].data||{}).stats,I=void 0===P?{}:P,k=function(){var e=cn(on().mark((function e(){return on().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d(!0),e.next=3,w.invalidateQueries({queryKey:g});case 3:w.invalidateQueries({queryKey:E}),w.invalidateQueries({queryKey:b}),d(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),A=(0,p.n)({mutationFn:dt,onSuccess:function(e){k(),s(e.snippet),null==n||n()},onError:function(e){return i(e.message)}}),C=(0,p.n)({mutationFn:mt,onSuccess:(t=cn(on().mark((function e(t,n){var o,a;return on().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,k();case 2:null!=(o=w.getQueryData(g))&&o.snippets&&(a=o.snippets.find((function(e){return e.id===n.id})))&&s(a),null==r||r();case 5:case"end":return e.stop()}}),e)}))),function(e,n){return t.apply(this,arguments)}),onError:function(e){return i(e.message)}}),j=(0,p.n)({mutationFn:yt,onSuccess:function(){k(),s(null),null==o||o()}}),D=(0,p.n)({mutationFn:vt,onSuccess:function(e){var t=e.result;return a(t)},onError:function(e){return i(e.message)}}),M=(0,p.n)({mutationFn:pt,onSuccess:function(){k(),null==n||n()},onError:function(e){return i(e.message)}}),G=function(){var e=cn(on().mark((function e(t){return on().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==t.id){e.next=6;break}return e.next=3,A.mutateAsync(t);case 3:e.t0=e.sent,e.next=9;break;case 6:return e.next=8,C.mutateAsync(t);case 8:e.t0=e.sent;case 9:return e.abrupt("return",e.t0);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),F=A.isLoading||C.isLoading||j.isLoading||M.isLoading||D.isLoading||h||it,U=hn((function(){if(!l)return window.mwcode_block_save_reason=null,!1;if(null!=l&&l.functionNotValid)return window.mwcode_block_save_reason="The function is not valid to save.",!1;if(null!=l&&l.functionError)return window.mwcode_block_save_reason="Resolve the syntax errors in the function code to save.",!1;var e=l.name&&l.code;if(!e)return window.mwcode_block_save_reason="The snippet name or code is missing to save.",e;var t=N.find((function(e){return e.id===l.id})),n=Kt(t,l);return n||(window.mwcode_block_save_reason=null),n}),[N,l]),B=hn((function(){if(!l)return!1;if(null===(null==l?void 0:l.id))return Kt(Qt,l);var e=N.find((function(e){return e.id===l.id}));return Kt(e,l)}),[N,l]);return{isProcessing:F,snippets:N,total:L,tags:x,stats:I,onImportCodeSnippets:M.mutate,onCreate:A.mutate,onUpdate:C.mutate,onDelete:j.mutate,onSave:G,onCancel:function(e){var t;return s(null!==(t=N.find((function(t){return t.id===e.id})))&&void 0!==t?t:Qt)},onDuplicate:function(e){return A.mutate(nn(nn({},e),{},{id:null,endpoint:"",active:"0"}))},onRunTestOnFunctionSnippet:D.mutate,onRefresh:function(){return k()},tableFilters:y,setTableFilters:v,editSnippet:l,setEditSnippet:s,isSavable:U,isResetable:B}},mn=n(8668),yn=n(1594),vn=n(4783),gn=n(106),En=n(3720),bn=n(7967),wn=n(1419),Sn=n(1638),Rn=n(6898),xn=n(5230);function On(e){return On="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},On(e)}function Tn(){Tn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new P(r||[]);return o(i,"_invoke",{value:T(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function x(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==On(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function T(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(On(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},x(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function Nn(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function _n(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Nn(a,r,o,i,c,"next",e)}function c(e){Nn(a,r,o,i,c,"throw",e)}i(void 0)}))}}function Ln(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||Pn(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pn(e,t){if(e){if("string"==typeof e)return In(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?In(e,t):void 0}}function In(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var kn,An,Cn=(0,gn.a)({theme:"light",settings:{background:"#ffffff",foreground:"#75baff",caret:"#5d00ff",selection:"#036dd626",lineHighlight:"#8a91991a",gutterBackground:"#fff",gutterForeground:"#8a919966"},styles:[{tag:En._A.comment,color:"#787b8099"},{tag:En._A.variableName,color:"#0080ff"},{tag:En._A.function(En._A.variableName),color:"#daa520"},{tag:[En._A.string,En._A.special(En._A.brace)],color:"#ff4500"},{tag:En._A.number,color:"#2e8b57"},{tag:En._A.bool,color:"#8b0000"},{tag:En._A.null,color:"#8b008b"},{tag:En._A.keyword,color:"#00008b"},{tag:En._A.operator,color:"#daa520"},{tag:En._A.className,color:"#8a2be2"},{tag:En._A.definition(En._A.typeName),color:"#5f9ea0"},{tag:En._A.typeName,color:"#b22222"},{tag:En._A.angleBracket,color:"#556b2f"},{tag:En._A.tagName,color:"#ff8c00"},{tag:En._A.attributeName,color:"#6b8e23"},{tag:En._A.comment,color:"#787b8099"}]}),jn=j.Ay.div(sn||(kn=["\n font-size: 13px;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n position: relative;\n\n overflow: auto;\n max-height: 76vh;\n\n\n .cm-readonly-prefix {\n background-color: #efefef;\n color: #818181 !important;\n user-select: none;\n padding: 4px;\n }\n\n /* Linting styles */\n .cm-gutter-lint {\n min-width: 20px;\n }\n\n .cm-lintRange-error {\n background-color: #fdd !important;\n }\n\n .cm-lintRange::before {\n content: '✖';\n color: #f00;\n font-size: 1.2em;\n position: absolute;\n margin-left: -20px;\n z-index: 999;\n }\n\n .cm-diagnosticText {\n color: #f00;\n font-size: 1.1em;\n }\n\n .cm-tooltip {\n border-radius: 3px;\n border: none;\n background-color: #fbfbfb;\n color: #f00;\n padding: 5px;\n }\n\n .cm-tooltip-below {\n box-shadow: 0px 8px 7px 0px rgba(0, 0, 0, 0.15);\n }\n\n .cm-diagnosticAction {\n background-color: var(--neko-blue);\n color: #fff;\n padding: 5px 8px;\n border-radius: 3px;\n cursor: pointer;\n }\n\n /* Loading indicator styles */\n .loading-indicator {\n position: absolute;\n top: 10px;\n right: 10px;\n }\n"],An||(An=kn.slice(0)),sn=Object.freeze(Object.defineProperties(kn,{raw:{value:Object.freeze(An)}})))),Dn=function(e){var t=e.code,n=e.snippet,r=e.setCode,o=e.setFunctionError,a=void 0===o?null:o,i=(e.isModal,e.onLintTrigger),c=void 0===i?null:i,l=Ln((0,yn.useState)(t||""),2),u=l[0],s=l[1],f=Ln((0,yn.useState)(!1),2),p=f[0],h=f[1],d=Ln((0,yn.useState)(""),2),m=d[0],y=d[1],v=Ln((0,yn.useState)([]),2),g=v[0],E=v[1],b=(0,yn.useRef)(null),w=(0,yn.useRef)(null);(0,yn.useEffect)((function(){n&&n.externalCode&&n.externalCode!==u&&s(n.externalCode)}),[n]),(0,yn.useEffect)((function(){c&&c(_n(Tn().mark((function e(){var t,n,r;return Tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!b.current||!w.current){e.next=11;break}return t=Date.now(),e.next=4,S(b.current);case 4:if(n=e.sent,b.current.destroyed||b.current.dispatch({effects:w.current.of(n)}),!((r=Date.now()-t)<500)){e.next=10;break}return e.next=10,new Promise((function(e){return setTimeout(e,500-r)}));case 10:return e.abrupt("return",0===n.length);case 11:return e.abrupt("return",!0);case 12:case"end":return e.stop()}}),e)}))))}),[S,c]);var S=(0,yn.useCallback)(function(){var e=_n(Tn().mark((function e(t){var r,o,i,c,l;return Tn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!==n.scope||"js"!==(null==n?void 0:n.functionTarget)){e.next=3;break}return null==a||a(!1),e.abrupt("return",[]);case 3:if("content_js"!==n.scope){e.next=6;break}return null==a||a(!1),e.abrupt("return",[]);case 6:if((r=t.state.doc.toString())!==m){e.next=9;break}return e.abrupt("return",g);case 9:return h(!0),null==a||a(!0),e.prev=11,o=r,e.next=15,gt({code:o,snippet:n});case 15:if(i=e.sent,h(!1),y(r),!i.result){e.next=26;break}return c=i.result,l=[{from:t.state.doc.line(c.attributes.startLine).from,to:t.state.doc.line(c.attributes.endLine).to,severity:"error",message:c.message,actions:[{name:"AI Correction",apply:function(){}}]}],E(l),null==a||a(!0),e.abrupt("return",l);case 26:return null==a||a(!1),E([]),e.abrupt("return",[]);case 29:e.next=35;break;case 31:return e.prev=31,e.t0=e.catch(11),h(!1),e.abrupt("return",[]);case 35:case"end":return e.stop()}}),e,null,[[11,31]])})));return function(t){return e.apply(this,arguments)}}(),[n,m,g]),R=(0,yn.useCallback)((function(e,t){"string"==typeof e&&(s(e),r(e))}),[r]),x=(0,yn.useMemo)((function(){var e=Sn.Pe.define();w.current=e;var t,n=Sn.sU.define({create:function(){return g},update:function(t,n){var r,o=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=Pn(e))){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,i=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){i=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(i)throw o}}}}(n.effects);try{for(o.s();!(r=o.n()).done;){var a=r.value;if(a.is(e))return a.value}}catch(e){o.e(e)}finally{o.f()}return t}}),r=(0,wn.bu)((function(e){return e.state.field(n)}));return[(0,bn.Q2)(),n,r,Rn.w4.of([xn.Yc]),Rn.Lz.lineWrapping,Rn.Lz.updateListener.of((function(e){e.docChanged&&(b.current=e.view)})),Rn.Lz.domEventHandlers({blur:(t=_n(Tn().mark((function t(n,r){var o;return Tn().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,S(r);case 2:o=t.sent,r.destroyed||r.dispatch({effects:e.of(o)});case 4:case"end":return t.stop()}}),t)}))),function(e,n){return t.apply(this,arguments)})})]}),[n,g]);return React.createElement(jn,null,React.createElement(vn.Ay,{value:u,onChange:R,onKeyDown:function(e){9===e.keyCode&&e.preventDefault()},theme:Cn,extensions:x,maxHeight:"100%",minHeight:"300px",overflow:"auto",basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightActiveLine:!0,foldGutter:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightSelectionMatches:!0}}),p&&React.createElement("div",{className:"loading-indicator"},React.createElement("span",null,"Checking code...")))};function Mn(e){return Mn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mn(e)}function Gn(){Gn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new P(r||[]);return o(i,"_invoke",{value:T(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function x(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==Mn(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function T(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Mn(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},x(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function Fn(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function Un(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Bn=wp.element.useState,Hn="".concat(L,"/images/wand.png"),Vn=function(e){var t=e.code,n=e.setCode,r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Un(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Un(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Bn(!1),2),o=r[0],a=r[1],i=function(){var e,t=(e=Gn().mark((function e(t){var r;return Gn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a(!0),e.next=3,(0,R.IU)("".concat(N,"/ai_read_comments"),{method:"POST",json:{code:t},nonce:k});case 3:(r=e.sent).success?(console.log("AI Suggestions",r.code),n(r.code)):console.error("AI Suggestions",r.message),a(!1);case 6:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Fn(a,r,o,i,c,"next",e)}function c(e){Fn(a,r,o,i,c,"throw",e)}i(void 0)}))});return function(e){return t.apply(this,arguments)}}();return React.createElement(w.M,{disabled:!t||!t.includes("//"),busy:o,onClick:function(){return i(t)}},React.createElement("img",{src:Hn,style:{width:"20px",height:"20px",marginRight:"5px"}}),Ve.SETTINGS.SNIPPET.READ_COMMENTS)};function zn(e){return zn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zn(e)}function Yn(){Yn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new P(r||[]);return o(i,"_invoke",{value:T(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function x(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==zn(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function T(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(zn(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},x(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function Wn(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function Kn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return qn(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Jn=wp.element.useState,$n=("".concat(L,"/images/wand.png"),function(e){var t=e.setCode,n=e.close,r=e.snippet,o=Kn(Jn(!1),2),a=o[0],i=o[1],c=Kn(Jn(""),2),l=c[0],u=c[1],s=Kn(Jn(""),2),f=s[0],p=s[1],h=Kn(Jn(!1),2),d=h[0],m=h[1],y=Kn(Jn(!1),2),v=y[0],g=y[1],E=function(){var e,t=(e=Yn().mark((function e(t){var n;return Yn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i(!0),e.next=3,(0,R.IU)("".concat(N,"/ai_query"),{method:"POST",json:{code:t,query:l},nonce:k});case 3:(n=e.sent).success?(console.log("AI Suggestions",n.code),p(n.code),m(!0)):console.error("AI Suggestions",n.message),i(!1);case 6:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Wn(a,r,o,i,c,"next",e)}function c(e){Wn(a,r,o,i,c,"throw",e)}i(void 0)}))});return function(e){return t.apply(this,arguments)}}();return React.createElement(React.Fragment,null,React.createElement(Bt.m,{value:l,onChange:function(e){return u(e)},disabled:a,rows:2}),React.createElement(ge.g,{tiny:!0}),React.createElement("div",{style:{display:"flex"}},React.createElement(w.M,{style:{flex:1},className:"secondary",onClick:n},Ve.COMMON.CANCEL),React.createElement(w.M,{style:{flex:4},className:"primary",busy:a,onClick:function(){return E(r.code)}},Ve.SETTINGS.SNIPPET.RUN)),React.createElement(we.n,{isOpen:d,title:Ve.SETTINGS.SNIPPET.MODIFY_BEFORE_USE,contentWidth:"800px",style:{minWidth:"800px",maxWidth:"800px"},content:React.createElement("div",{style:{height:"calc(100vh - 200px)",overflow:"auto"}},v&&React.createElement(Ee.X,{variant:"danger"},"⚠️ It looks like there is an error in your code."),React.createElement(Dn,{snippet:r,code:f,setFunctionError:function(e){g(e)},setCode:function(e){return p(e)}})),onRequestClose:function(){return m(!1)},okButton:{label:Ve.COMMON.SAVE,disabled:v,onClick:function(){t(f),m(!1),n()}},cancelButton:{label:Ve.COMMON.CANCEL,onClick:function(){return m(!1)}}}))});function Qn(e){return Qn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qn(e)}function Xn(){Xn=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new P(r||[]);return o(i,"_invoke",{value:T(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function x(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==Qn(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function T(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Qn(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},x(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function Zn(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function er(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var tr,nr=wp.element,rr=nr.useState,or=nr.useEffect,ar=function(){var e=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return er(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?er(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(rr("..."),2),t=e[0],n=e[1];or((function(){r()}),[]);var r=function(){var e,t=(e=Xn().mark((function e(){var t;return Xn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/server_clock"),{method:"GET",nonce:k});case 2:(t=e.sent).success?(console.log("Wordpress Clock",t.code),n(t.time)):console.error("Wordpress Clock",t.message);case 4:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Zn(a,r,o,i,c,"next",e)}function c(e){Zn(a,r,o,i,c,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}();return React.createElement("b",null,t)},ir=n(9985),cr=n(4756);function lr(e){return lr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lr(e)}function ur(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function sr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ur(Object(n),!0).forEach((function(t){fr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ur(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function fr(e,t,n){return(t=function(e){var t=function(e){if("object"!=lr(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=lr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==lr(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pr(){pr=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new P(r||[]);return o(i,"_invoke",{value:T(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function x(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==lr(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function T(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(lr(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},x(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function hr(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function dr(e){return function(e){if(Array.isArray(e))return vr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||yr(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||yr(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yr(e,t){if(e){if("string"==typeof e)return vr(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vr(e,t):void 0}}function vr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var gr,Er,br,wr=wp.element,Sr=wr.useState,Rr=wr.useEffect,xr=wr.useRef,Or="".concat(L,"/images/wand.png"),Tr="".concat(L,"/images/callable.svg"),Nr="".concat(L,"/images/global-back.svg"),_r="".concat(L,"/images/global-front.svg"),Lr="".concat(L,"/images/global-front-back.svg"),Pr="".concat(L,"/images/scheduled.svg"),Ir="".concat(L,"/images/content.svg"),kr=(0,j.Ay)(ir.A)(tr||(tr=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n padding: 0px;\n border: 1px solid #e0e0e0;\n max-height: 140px;\n margin-top: 5px;\n\n code, pre {\n font-size: 13px;\n font-weight: 500;\n background: none;\n padding: 0px !important;\n overflow-x: hidden !important;\n }\n"]))),Ar=function(e){var t,n,r,o,a,i,c=e.isInline,l=void 0!==c&&c,u=e.onClose,s=e.busy,f=e.isSavable,p=e.onSave,m=e.editSnippet,y=e.setEditSnippet,v=e.editorKey,g=void 0===v?0:v,E=e.onLintReady,x=void 0===E?null:E,O=xr(null),T=dn({onRanSnippet:function(e){return console.log((0,R.g7)(Ve.SETTINGS.SUCCESSFULLY_RAN,e))},onTestedSnippet:function(e){return J(e)},onError:A}),L=T.onRunTestOnFunctionSnippet,P=T.isProcessing;Rr((function(){x&&O.current&&x(O.current)}),[x]);var I=mr(Sr(!1),2),k=I[0],A=I[1],C=mr(Sr([]),2),j=C[0],D=C[1],M=mr(Sr(null),2),G=M[0],F=M[1],U=mr(Sr(!1),2),B=U[0],H=U[1],V="function"===(null==m?void 0:m.scope),z=(V&&(null==m||m.functionTarget),V&&"js"===(null==m?void 0:m.functionTarget)),Y="scheduled"===(null==m?void 0:m.scope),W="content_php"===(null==m?void 0:m.scope)||"content_js"===(null==m?void 0:m.scope),K="content_php"===(null==m?void 0:m.scope),q=null!==(t=(null==m||null===(n=m.functionArgs)||void 0===n?void 0:n.length)>0&&!(1===(null==m||null===(r=m.functionArgs)||void 0===r?void 0:r.length)&&""===(null==m||null===(o=m.functionArgs)||void 0===o?void 0:o[0])))&&void 0!==t&&t,J=function(e){var t=(new Date).toLocaleTimeString();if(null!=e&&e.error)D([].concat(dr(j),[{message:"["+t+"] "+e.error,color:"#ffce44"}]));else{var n=e.return.map((function(e){return{message:"["+t+"] "+e,color:"#00ff51"}}));D([].concat(dr(j),dr(n)))}},$=jt().actions.getOption,Q=function(){var e,t=(e=pr().mark((function e(t){return pr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p(t);case 2:u();case 3:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){hr(a,r,o,i,c,"next",e)}function c(e){hr(a,r,o,i,c,"throw",e)}i(void 0)}))});return function(e){return t.apply(this,arguments)}}();Rr((function(){if(V&&null!=m&&m.code){if("js"===(null==m?void 0:m.functionTarget))return;if(null==m||!m.functionTarget)return void y((function(e){return sr(sr({},e),{},{functionTarget:"php"})}));var e=m.code,t=(e=(e=e.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,"$1")).trim().replace(/\n/g,"")).match(/^function\s+(\w+)\s*\((.*?)\)\s*{([\s\S]*)}\s*$/);if(!t)return A("Invalid PHP Function."),void y((function(e){return sr(sr({},e),{},{functionNotValid:!0,functionArgs:[],name:""})}));var n=mr(t,4),r=(n[0],n[1]),o=n[2],a=(n[3],o?o.split(",").map((function(e){return e.trim()})):[]);if(a.some((function(e){return e.includes("=")||e.includes("?")||e.includes(" ")})))return A("Don't use typed arguments in PHP functions. Declare them as normal variables ( e.g. $arg1, $arg2 ). Go into the “Callable” tab and define the types and default values there instead."),void y((function(e){return sr(sr({},e),{},{functionNotValid:!0,functionArgs:[],name:""})}));var i=a.filter((function(e){return!e.startsWith("$__mwai_")}));m.functionName===r&&!1===m.functionNotValid&&JSON.stringify(m.functionArgs)===JSON.stringify(i)||y((function(e){return sr(sr({},e),{},{functionName:r,functionNotValid:!1,functionArgs:i,name:(null==e?void 0:e.name)||r})})),A(!1)}}),[null==m?void 0:m.code,V,null==m?void 0:m.functionTarget]),Rr((function(){if(V&&null!=m&&m.code){if("php"===(null==m?void 0:m.functionTarget))return;var e=m.code,t=(e=(e=(e=e.replace(/^<script>\s*/,"").replace(/\s*<\/script>$/,"")).replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,"$1")).trim()).match(/^(function\s+(\w+)\s*\((.*?)\)\s*{([\s\S]*)})\s*$|^(const|let|var)?\s*(\w+)\s*=\s*(\((.*?)\)|(\w+))\s*=>\s*({([\s\S]*)}|\S.*)\s*$/);if(t&&t[0]===e){var n,r;if(t[1]){var o=mr(t,5);_=o[0],_=o[1],n=o[2],r=o[3],o[4]}else{var a=mr(t,10);_=a[0],_=a[1],_=a[2],_=a[3],_=a[4],_=a[5],n=a[6],_=a[7];var i=a[8];r=void 0===i?t[9]:i;var c=a[9];void 0===c&&(t[10]||t[11])}var l=r?r.split(",").map((function(e){return e.trim()})):[];m.functionName===n&&!1===m.functionNotValid&&JSON.stringify(m.functionArgs)===JSON.stringify(l)||y((function(e){return sr(sr({},e),{},{functionName:n,functionNotValid:!1,functionArgs:l,name:(null==e?void 0:e.name)||n})})),A(!1)}else A("Invalid JavaScript Function. Ensure the function is the only code present."),y((function(e){return sr(sr({},e),{},{functionNotValid:!0,functionArgs:[],name:""})}))}}),[null==m?void 0:m.code,V,null==m?void 0:m.functionTarget]),Rr((function(){!V||null!=m&&m.name||null==m||!m.functionName||y((function(e){return sr(sr({},e),{},{name:null==m?void 0:m.functionName})}))}),[null==m?void 0:m.name,null==m?void 0:m.functionName,V]),Rr((function(){Y&&(null==m?void 0:m.intervalTime)<=0&&y((function(e){return sr(sr({},e),{},{intervalTime:1})}))}),[null==m?void 0:m.intervalTime,Y]);var X,Z,ee,te=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return React.createElement(d.d,{title:e,style:sr({flexDirection:"column"},n)},React.createElement(ge.g,{tiny:!0}),t)},ne=function(e){if(e)return!!isNaN(e)&&!/^["'].*["']$/.test(e)},re=function(e){var t=e.arg,n=e.key;return React.createElement(React.Fragment,null,React.createElement(Ee.X,{variant:"warning"},Ve.SETTINGS.STRING_VALUE_WARNING),React.createElement("div",{style:{position:"relative",width:"max-content",left:"200px",bottom:"23px",border:"3px solid white",borderRadius:"5px"}},React.createElement(w.M,{icon:"pencil",onClick:function(){var e;return y(sr(sr({},m),{},{functionArgsDict:sr(sr({},m.functionArgsDict),{},fr({},t,sr(sr({},m.functionArgsDict[t]),{},fr({},n,'"'.concat(null===(e=m.functionArgsDict[t])||void 0===e?void 0:e[n],'"')))))}))}}," ",Ve.SETTINGS.ADD_QOUTES," ")))},oe=function(){var e,t;return(null==m||null===(e=m.functionArgsDict)||void 0===e||null===(e=e[G])||void 0===e?void 0:e.input)||(null==m||null===(t=m.functionArgsDict)||void 0===t||null===(t=t[G])||void 0===t?void 0:t.default)||""};return React.createElement("div",{style:{display:"flex",flexDirection:l?"column":"row",gap:"15px"}},React.createElement(S.z,{busy:s,style:{maxHeight:"100%",overflow:"hidden",flex:"3 0 0",marginBottom:0},contentStyle:{maxHeight:"75vh",maxWidth:"100%"}},V&&k&&React.createElement(Ee.X,{variant:"danger",style:{marginBottom:10}},"⚠️ ",k),K&&React.createElement(Ee.X,{variant:"info",style:{marginBottom:10}},"You can pass your own attributes to the shortcode and access them in your PHP code using the ",React.createElement("code",null,"$mwcode_atts")," variable as an associative array. For example, if you pass ",React.createElement("code",null,'key="value"')," in the shortcode, you can access it in your code with ",React.createElement("code",null,"$mwcode_atts['key']"),"."),React.createElement(Dn,{key:g,isModal:!l,code:null==m?void 0:m.code,snippet:m,setCode:function(e){y(sr(sr({},m),{},{code:e}))},setFunctionError:function(e){y(sr(sr({},m),{},{functionError:e}))},onLintTrigger:function(e){O.current=e,x&&x(e)}})),$("ai_suggestions",!1)&&React.createElement("div",{style:{flex:"3 0 0"}},B&&React.createElement(S.z,{style:{marginTop:15}},React.createElement($n,{snippet:m,close:function(){return H(!1)},setCode:function(e){y(sr(sr({},m),{},{externalCode:e}))}})),!B&&React.createElement(Dt.V,{style:{display:"flex",marginTop:15}},React.createElement(w.M,{className:"primary",disabled:s,onClick:function(){return H(!B)}},React.createElement("img",{src:Or,alt:"Wand",style:{width:"20px",height:"20px",marginRight:"5px"}}),"Query AI"),React.createElement(Vn,{code:null==m?void 0:m.code,setCode:function(e){return y(sr(sr({},m),{},{externalCode:e}))}}))),React.createElement("div",{style:{flex:"1 0 0",minWidth:"300px",maxHeight:"100%"}},React.createElement(Ut.A,{style:{minWidth:"300px",maxHeight:"800px",overflow:"auto"}},React.createElement(b._,{inversed:!0,keepTabOnReload:!0},React.createElement(b.V,{title:Ve.SETTINGS.SNIPPET.LABEL,key:"snippet"},React.createElement(React.Fragment,null,te(Ve.SETTINGS.SNIPPET.NAME,React.createElement(be.A,{name:"name",disabled:s,value:null==m?void 0:m.name,onChange:function(e){return y(sr(sr({},m),{},{name:e}))}})),te(Ve.SETTINGS.SNIPPET.DESCRIPTION,React.createElement(be.A,{name:"description",value:null==m?void 0:m.description,disabled:s,onChange:function(e){return y(sr(sr({},m),{},{description:e}))}})),React.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px",marginBottom:10}},te(Ve.SETTINGS.SNIPPET.TYPE,React.createElement(Mt.u,{fullWidth:!0,name:"scope",scrolldown:!0,value:null==m?void 0:m.scope,disabled:s,onChange:function(e){return y(sr(sr({},m),{},{scope:e}))}},null==Jt?void 0:Jt.map((function(e){return React.createElement(Mt.j,{key:e.value,id:e.value,value:e.value,label:e.label})}))),{marginTop:0,flex:"1 1 135px",minWidth:0}),V&&te(Ve.SETTINGS.SNIPPET.TARGET,React.createElement(Mt.u,{fullWidth:!0,name:"target",scrolldown:!0,value:null==m?void 0:m.functionTarget,onChange:function(e){return y(sr(sr({},m),{},{functionTarget:e}))}},React.createElement(Mt.j,{id:"php",value:"php",label:"PHP (backend)"}),React.createElement(Mt.j,{id:"js",value:"js",label:"JS (frontend)"})),{marginTop:0,flex:"1 1 135px",minWidth:0}),te(Ve.SETTINGS.SNIPPET.PRIORITY,React.createElement(be.A,{name:"priority",type:"number",value:null==m?void 0:m.priority,disabled:s,onBlur:function(e){y(sr(sr({},m),{},{priority:e}))}}),{marginTop:0,flex:"1 1 135px",minWidth:0})),Y&&React.createElement(React.Fragment,null,React.createElement("div",{style:{display:"flex",gap:"10px",marginBottom:10}},te(Ve.SETTINGS.SNIPPET.TARGET_TIME,React.createElement(be.A,{name:"interval_hours",type:"number",value:null==m?void 0:m.intervalHours,disabled:s,max:23,min:0,onBlur:function(e){return y(sr(sr({},m),{},{intervalHours:e}))},description:Ve.SETTINGS.SNIPPET.HOURS}),{marginTop:0,flex:1}),te(" ",React.createElement(be.A,{name:"interval_minutes",type:"number",value:null==m?void 0:m.intervalMinutes,disabled:s,max:59,min:0,onBlur:function(e){return y(sr(sr({},m),{},{intervalMinutes:e}))},description:Ve.SETTINGS.SNIPPET.MINUTES}),{marginTop:0,flex:1})),React.createElement("small",null,"The action will trigger when someone visits your WordPress site if the scheduled time has passed. For your WordPress server the time is ",React.createElement(ar,null),". "),React.createElement(ge.g,{tiny:!0})),W&&React.createElement(React.Fragment,null,"A shortcode will be generated to use this snippet in your posts or pages."),te(Ve.SETTINGS.SNIPPET.TAGS,React.createElement(be.A,{isCommaSeparatedArray:!0,name:"tags",value:null==m?void 0:m.tags,disabled:s,onFinalChange:function(e){return y(sr(sr({},m),{},{tags:e}))},description:Ve.SETTINGS.SNIPPET.TAGS_DESCRIPTION})),l&&React.createElement(w.M,{className:"primary",disabled:s||!f,style:{marginTop:"10px"},onClick:function(){return Q(m)}},Ve.COMMON.SAVE))),V&&React.createElement(b.V,{title:Ve.SETTINGS.SNIPPET.SCOPES.FUNCTION,key:"function"},te(Ve.SETTINGS.SNIPPET.NAME,React.createElement(be.A,{name:"name",disabled:!0,value:null==m?void 0:m.functionName,onChange:function(e){return y(sr(sr({},m),{},{functionName:e}))}})),te(Ve.SETTINGS.SNIPPET.BEHAVIOR,React.createElement(Mt.u,{fullWidth:!0,name:"behavior",scrolldown:!0,value:null==m?void 0:m.functionBehavior,description:Ve.SETTINGS.SNIPPET[null!=m&&m.functionBehavior?"BEHAVIOR_".concat(m.functionBehavior.toUpperCase()):"BEHAVIOR_DYNAMIC"],onChange:function(e){return y(sr(sr({},m),{},{functionBehavior:e}))}},React.createElement(Mt.j,{id:"dynamic",value:"dynamic",label:"Dynamic"}),React.createElement(Mt.j,{id:"static",value:"static",label:"Static"}))),React.createElement(mn.aD,null,null==m||null===(a=m.functionArgs)||void 0===a?void 0:a.map((function(e){return""===e||"js"!==(null==m?void 0:m.functionTarget)&&"$"!==e[0]?null:React.createElement(mn.YQ,{key:e,title:e},(t=e,React.createElement(React.Fragment,null,te(Ve.SETTINGS.SNIPPET.NAME,React.createElement(be.A,{disabled:!0,name:"name",value:t})),te(Ve.SETTINGS.SNIPPET.TYPE,React.createElement(Mt.u,{fullWidth:!0,name:"type",scrolldown:!0,value:null==m||null===(n=m.functionArgsDict)||void 0===n||null===(n=n[t])||void 0===n?void 0:n.type,onChange:function(e){return y(sr(sr({},m),{},{functionArgsDict:sr(sr({},m.functionArgsDict),{},fr({},t,sr(sr({},m.functionArgsDict[t]),{},{type:e})))}))}},React.createElement(Mt.j,{id:"string",value:"string",label:"String"}),React.createElement(Mt.j,{id:"number",value:"number",label:"Number"}),React.createElement(Mt.j,{id:"boolean",value:"boolean",label:"Boolean"}),React.createElement(Mt.j,{id:"array",value:"array",label:"Array"}),React.createElement(Mt.j,{id:"object",value:"object",label:"Object"}),React.createElement(Mt.j,{id:"mixed",value:"mixed",label:"Mixed"}))),te(Ve.SETTINGS.SNIPPET.DESCRIPTION,React.createElement(be.A,{disabled:s,name:"desc",value:null==m||null===(r=m.functionArgsDict)||void 0===r||null===(r=r[t])||void 0===r?void 0:r.desc,onBlur:function(e){return y(sr(sr({},m),{},{functionArgsDict:sr(sr({},m.functionArgsDict),{},fr({},t,sr(sr({},m.functionArgsDict[t]),{},{desc:e})))}))}})),te(Ve.SETTINGS.SNIPPET.DEFAULT_VALUE,React.createElement(be.A,{disabled:s,name:"default",value:null==m||null===(o=m.functionArgsDict)||void 0===o||null===(o=o[t])||void 0===o?void 0:o.default,onBlur:function(e){return y(sr(sr({},m),{},{functionArgsDict:sr(sr({},m.functionArgsDict),{},fr({},t,sr(sr({},m.functionArgsDict[t]),{},{default:e})))}))}})),!$("sanitize_arguments",!0)&&ne(null==m||null===(a=m.functionArgsDict)||void 0===a||null===(a=a[t])||void 0===a?void 0:a.default)&&re({arg:t,key:"default"}))));var t,n,r,o,a}))),!q&&React.createElement(Ee.X,{variant:"info"},"No parameters in the function")),React.createElement(b.V,{title:Ve.SETTINGS.SNIPPET.TEST,key:"test"},React.createElement(w.M,{className:"primary",disabled:s||P,style:{width:"100%"},onClick:function(){var e=(new Date).toLocaleTimeString();if(D([{message:"["+e+"] Running test...",color:"white"}]),"function"!==(null==m?void 0:m.scope)||"js"!==(null==m?void 0:m.functionTarget))if("content_js"!==(null==m?void 0:m.scope))L({scope:null==m?void 0:m.scope,code:null==m?void 0:m.code,name:null==m?void 0:m.functionName,args:(null==m?void 0:m.functionArgs)||[],values:(null==m?void 0:m.functionArgsDict)||{}});else try{var t=null==m?void 0:m.code.replace(/<script>|<\/script>/g,"").trim(),n=new Function("\n function mwcode_content_js() {\n ".concat(t,"\n }\n return mwcode_content_js;\n "))(),r=[],o=console.log;console.log=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.push(t.join(" ")),o.apply(console,t)};var a=n();console.log=o;var i=[].concat(r,[JSON.stringify(a)]);J({return:i})}catch(e){J({error:e.toString()})}else try{var c,l=null==m?void 0:m.code.replace(/<script>|<\/script>/g,"").trim(),u=new Function("\n ".concat(l,"\n return ").concat(null==m?void 0:m.functionName,";\n "))(),s=(null==m||null===(c=m.functionArgs)||void 0===c?void 0:c.map((function(e){var t,n;return(null==m||null===(t=m.functionArgsDict)||void 0===t||null===(t=t[e])||void 0===t?void 0:t.input)||(null==m||null===(n=m.functionArgsDict)||void 0===n||null===(n=n[e])||void 0===n?void 0:n.default)||null})))||[],f=[],p=console.log;console.log=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];f.push(t.join(" ")),p.apply(console,t)};var h=u.apply(void 0,dr(s));console.log=p;var d=[].concat(f,[JSON.stringify(h)]);J({return:d})}catch(e){J({error:e.toString()})}}},"Run Test"),React.createElement("div",{style:$t},null==j?void 0:j.map((function(e,t){return React.createElement("div",{key:t,style:{color:null==e?void 0:e.color}},null==e?void 0:e.message)}))),q&&V&&React.createElement(React.Fragment,null,React.createElement(ge.g,null),React.createElement(Mt.u,{fullWidth:!0,name:"function_test_args",scrolldown:!0,value:G,onChange:function(e){return F(e)}},null==m||null===(i=m.functionArgs)||void 0===i?void 0:i.map((function(e){return React.createElement(Mt.j,{key:e,id:e,value:e,label:e})}))),G&&React.createElement(React.Fragment,null,React.createElement(ge.g,{tiny:!0}),React.createElement(be.A,{name:"test_arg_value",value:oe(),onChange:function(e){return y(sr(sr({},m),{},{functionArgsDict:sr(sr({},m.functionArgsDict),{},fr({},G,sr(sr({},m.functionArgsDict[G]),{},{input:e})))}))}}),!$("sanitize_arguments",!0)&&ne(oe())&&React.createElement(React.Fragment,null,React.createElement(ge.g,null),re({arg:G,key:"input"})))),React.createElement(React.Fragment,null,React.createElement(ge.g,null),React.createElement(Ee.X,{variant:"info"},(0,R.FE)(Ve.SETTINGS.SNIPPET.TEST_PARAMETERS_DESCRIPTION_LOG),q&&React.createElement(React.Fragment,null,React.createElement("br",null),(0,R.FE)(Ve.SETTINGS.SNIPPET.TEST_PARAMETERS_DESCRIPTION_ARG))))),$("api_endpoint",!1)&&V&&!z&&React.createElement(b.V,{title:Ve.SETTINGS.SNIPPET.PUBLIC_API,key:"public_api"},(X={},null!=m&&m.functionArgsDict&&Object.entries(m.functionArgsDict).forEach((function(e){var t=mr(e,2),n=t[0],r=t[1];X[n.replace("$","")]=function(e,t){switch(e){case"boolean":return"true"===t;case"number":return Number(t)||0;case"array":try{return JSON.parse(t)||[]}catch(e){return[]}case"object":try{return JSON.parse(t)||{}}catch(e){return{}}default:return t||""}}(r.type,r.default)})),Z=X,ee=JSON.stringify(Z,null,2),React.createElement(React.Fragment,null,React.createElement(Ee.X,{variant:"warning"},Ve.SETTINGS.SNIPPET.PUBLIC_API_DESCRIPTION),React.createElement(ge.g,null),te(Ve.SETTINGS.SNIPPET.ENDPOINT,React.createElement(be.A,{name:"endpoint",value:null==m?void 0:m.endpoint,onChange:function(e){return y(sr(sr({},m),{},{endpoint:e}))}})),React.createElement("div",null,!(null==m||!m.endpoint)&&React.createElement(h.s,{p:!0},(0,R.FE)((0,R.g7)(Ve.SETTINGS.SNIPPET.ENDPOINT_URL,"".concat(N,"/snippets-endpoint/").concat(m.endpoint))))),(null==m?void 0:m.endpoint)&&(null==m?void 0:m.endpoint.length)>0&&React.createElement(React.Fragment,null,React.createElement(ge.g,null),te(Ve.SETTINGS.SNIPPET.METHOD,React.createElement(Mt.u,{fullWidth:!0,name:"method",scrolldown:!0,value:null==m?void 0:m.method,onChange:function(e){return y(sr(sr({},m),{},{method:e}))}},React.createElement(Mt.j,{id:"GET",value:"GET",label:"GET"}),React.createElement(Mt.j,{id:"POST",value:"POST",label:"POST"}),React.createElement(Mt.j,{id:"PUT",value:"PUT",label:"PUT"}),React.createElement(Mt.j,{id:"DELETE",value:"DELETE",label:"DELETE"}))),React.createElement(ge.g,null),React.createElement(mn.aD,null,React.createElement(mn.YQ,{title:"Example (JS Fetch)"},React.createElement(kr,{language:"javascript",style:cr.A},'fetch("'.concat(N,"/snippets-endpoint/").concat(m.endpoint,'", {\n method: "').concat(m.method,'",\n headers: {\n "Content-Type": "application/json",\n "Authorization": "Bearer YOUR_API_TOKEN"\n },\n body: JSON.stringify(').concat(ee,")\n })\n .then(response => response.json())\n .then(data => console.log(data))\n .catch(error => console.error('Error:', error));"))),React.createElement(ge.g,null),React.createElement(mn.YQ,{title:"Example (CURL)"},React.createElement(kr,{language:"bash",style:cr.A},"curl -X ".concat(m.method,' "').concat(N,"/snippets-endpoint/").concat(m.endpoint,'" \\\n -H "Content-Type: application/json" \\\n -H "Authorization: Bearer YOUR_API_TOKEN" \\\n -d \'').concat(JSON.stringify(Z),"'"))))))))),React.createElement(S.z,{title:React.createElement("span",{style:{color:"white"}},"Info"),style:{marginTop:"15px"}},React.createElement("div",{style:{fontSize:"13px",lineHeight:"1.6"}},React.createElement("p",{style:{marginBottom:"10px"}},"This code will run:"),React.createElement("p",{style:sr({display:"flex",alignItems:"center",gap:"8px"},"persistent"===(null==m?void 0:m.scope)?{color:"var(--neko-primary)"}:{})},React.createElement("img",{src:Lr,alt:"Global All",style:{width:"20px",height:"20px",flexShrink:0}}),React.createElement("span",null,React.createElement("strong",null,"Global (All):")," Front-end and admin.")),React.createElement("p",{style:sr({display:"flex",alignItems:"center",gap:"8px"},"frontend"===(null==m?void 0:m.scope)?{color:"var(--neko-primary)"}:{})},React.createElement("img",{src:_r,alt:"Global Front",style:{width:"20px",height:"20px",flexShrink:0}}),React.createElement("span",null,React.createElement("strong",null,"Global (Front):")," Front-end only.")),React.createElement("p",{style:sr({display:"flex",alignItems:"center",gap:"8px"},"backend"===(null==m?void 0:m.scope)?{color:"var(--neko-primary)"}:{})},React.createElement("img",{src:Nr,alt:"Global Admin",style:{width:"20px",height:"20px",flexShrink:0}}),React.createElement("span",null,React.createElement("strong",null,"Global (Admin):")," Admin only.")),React.createElement("p",{style:sr({display:"flex",alignItems:"center",gap:"8px"},"function"===(null==m?void 0:m.scope)?{color:"var(--neko-primary)"}:{})},React.createElement("img",{src:Tr,alt:"Callable",style:{width:"20px",height:"20px",flexShrink:0}}),React.createElement("span",null,React.createElement("strong",null,"Callable:")," Via REST or ",React.createElement("a",{href:"https://wordpress.org/plugins/ai-engine/",target:"_blank",rel:"noopener noreferrer"},"AI Engine"),".")),React.createElement("p",{style:sr({display:"flex",alignItems:"center",gap:"8px"},"scheduled"===(null==m?void 0:m.scope)?{color:"var(--neko-primary)"}:{})},React.createElement("img",{src:Pr,alt:"Scheduled",style:{width:"20px",height:"20px",flexShrink:0}}),React.createElement("span",null,React.createElement("strong",null,"Scheduled:")," Daily at specific time.")),React.createElement("p",{style:sr({display:"flex",alignItems:"center",gap:"8px"},"content_php"===(null==m?void 0:m.scope)?{color:"var(--neko-primary)"}:{})},React.createElement("img",{src:Ir,alt:"Content PHP",style:{width:"20px",height:"20px",flexShrink:0}}),React.createElement("span",null,React.createElement("strong",null,"Content (PHP):")," Via shortcode.")),React.createElement("p",{style:sr({display:"flex",alignItems:"center",gap:"8px"},"content_js"===(null==m?void 0:m.scope)?{color:"var(--neko-primary)"}:{})},React.createElement("img",{src:Ir,alt:"Content JS",style:{width:"20px",height:"20px",flexShrink:0}}),React.createElement("span",null,React.createElement("strong",null,"Content (JS):")," Via shortcode.")))))))},Cr=n(6087),jr=n(309),Dr=n(2109),Mr=n(1997);function Gr(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Fr,Ur,Br,Hr,Vr,zr,Yr,Wr,Kr,qr,Jr,$r,Qr,Xr,Zr,eo=j.Ay.div(gr||(gr=Gr(["\n display: flex;\n flex-direction: column;\n line-height: 1;\n opacity: ",";\n filter: ",";\n pointer-events: ",";\n \n .snippet-header {\n display: flex;\n flex-direction: column;\n margin: 5px 0px;\n }\n .snippet-title,\n .snippet-description,\n .snippet-endpoint {\n margin: 2px 0;\n padding: 0;\n }\n .snippet-title {\n font-size: 16px;\n cursor: ",";\n font-weight: 600;\n color: ",";\n }\n .snippet-description {\n margin-top: 8px;\n color: ",";\n font-size: var(--neko-font-size);\n }\n .snippet-endpoint {\n color: ",";\n }\n\n .code-container {\n\n pre {\n margin: 0;\n border-radius: 5px;\n }\n \n overflow: auto;\n white-space: pre-wrap;\n word-wrap: break-word;\n }\n .snippet-footer {\n }\n"])),(function(e){return e.active?1:.5}),(function(e){return e.active?"none":"grayscale(100%)"}),(function(e){return e.active?"auto":"none"}),(function(e){return e.active?"pointer":"default"}),(function(e){return e.active?"var(--neko-blue)":"var(--neko-gray-60)"}),(function(e){return e.active?"var(--neko-gray-60)":"var(--neko-gray-40)"}),(function(e){return e.active?"#a8a8a8":"#c8c8c8"})),to=(0,j.Ay)(ir.A)(Er||(Er=Gr(["\n padding: 0px;\n border: 1px solid #e0e0e0;\n max-height: 140px;\n margin-top: 5px;\n opacity: ",";\n filter: ",";\n code, pre {\n font-size: 13px;\n font-weight: 500;\n background: none;\n padding: 0px !important;\n overflow-x: hidden !important;\n }\n"])),(function(e){return e.active?1:.7}),(function(e){return e.active?"none":"grayscale(100%)"})),no=j.Ay.div(br||(br=Gr(["\n margin-right: 5px;\n width: 20px;\n height: 20px;\n vertical-align: middle;\n opacity: ",";\n filter: ",";\n \n svg {\n border-radius: 3px;\n width: 100%;\n height: 100%;\n }\n"])),(function(e){return e.active?1:.5}),(function(e){return e.active?"none":"grayscale(100%)"})),ro=function(e){var t=e.snippet,n=e.onEditClick,r=e.simplified,o=jt().actions.getOption,a=(null!=t&&t.functionArgsDict?Object.values(null==t?void 0:t.functionArgsDict):[]).some((function(e){return null===(null==e?void 0:e.type)||void 0===(null==e?void 0:e.type)})),i=t.endpoint&&t.method,c=o("ui_show_preview",!1)&&t.code,l=(null==t?void 0:t.functionTarget)&&(null==t?void 0:t.functionName),u="1"===t.active;return React.createElement(eo,{active:u,simplified:r},(a||l||i)&&React.createElement(React.Fragment,null,React.createElement("div",{style:{flex:"auto"}}),React.createElement("div",{className:"snippet-footer"},a&&React.createElement(Ee.X,{variant:"warning",style:{marginBottom:5,padding:"8px 15px",opacity:u?1:.7,filter:u?"none":"grayscale(100%)"}},Ve.SETTINGS.SNIPPET.MISSING_TYPE_WARNING))),React.createElement("div",{className:"snippet-header"},React.createElement("div",{className:"snippet-info"},React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement(Mr.f,{position:"top",text:null==t?void 0:t.functionName},React.createElement(no,{active:u},"js"===(null==t?void 0:t.functionTarget)||"content_js"===(null==t?void 0:t.scope)?Zt:("php"===(null==t?void 0:t.functionTarget)||null==t||t.scope,Xt))),React.createElement("a",{onClick:u?n:void 0,className:"snippet-title"},t.name)),React.createElement("p",{className:"snippet-description"},t.description))),c&&React.createElement(React.Fragment,null,React.createElement("div",{className:"code-container"},React.createElement(to,{language:"js"===(null==t?void 0:t.functionTarget)?"javascript":"php",style:cr.A,wrapLines:!0,wrapLongLines:!0,active:u},t.code))))},oo=function(e){var t=e.scope,n=e.active,r=void 0===n||n,o=qt.find((function(e){var n;return e.value===t||(null===(n=e.childScopes)||void 0===n?void 0:n.includes(t))}));if(!o)return console.warn('Code Engine: The scope "'.concat(t,'" is not supported.')),null;var a,i="content_php"===t||"content_js"===t,c=o.label;if(i){var l=c.match(/Content \((PHP|JS)\)/);a=l?React.createElement(React.Fragment,null,"Content",React.createElement("br",null),l[1]):c}else a=c;return React.createElement("div",{style:{padding:"5px 8px",borderRadius:"3px",background:r?o.color:"var(--neko-gray-80)",fontSize:"10px",textTransform:"uppercase",color:"white",textAlign:"center",lineHeight:i?"1.3":"normal"}},a)},ao=function(e){var t=e.tags;return t?("string"==typeof t&&(t=t.split(",")),Array.isArray(t)?0===t.length?null:React.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"3px"}},t.map((function(e,t){if(e)return React.createElement(io,{key:t,label:e})}))):null):null},io=function(e){var t=e.label;return React.createElement("div",{style:{cursor:"default",display:"flex",alignItems:"center",padding:"2px 8px",borderRadius:"5px",background:"#fff7e0",fontSize:"12px",color:"rgb(0 0 0 / 54%)",border:"1px solid #ffc10763"}},t)};function co(e){return co="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},co(e)}function lo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function uo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lo(Object(n),!0).forEach((function(t){so(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lo(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function so(e,t,n){return(t=function(e){var t=function(e){if("object"!=co(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=co(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==co(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fo(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var po="".concat(L,"/images/callable.svg"),ho="".concat(L,"/images/global-back.svg"),mo="".concat(L,"/images/global-front.svg"),yo="".concat(L,"/images/global-front-back.svg"),vo="".concat(L,"/images/scheduled.svg"),go="".concat(L,"/images/content.svg"),Eo=j.Ay.div(Fr||(Fr=fo(["\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n gap: 15px;\n \n @media (max-width: 1200px) {\n grid-template-columns: 1fr;\n }\n"]))),bo=j.Ay.div(Ur||(Ur=fo(["\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 60px 20px;\n text-align: center;\n color: white;\n font-size: 14px;\n line-height: 1.6;\n"]))),wo=j.Ay.div(Br||(Br=fo(["\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 60px 20px;\n text-align: center;\n color: white;\n font-size: 14px;\n"]))),So=j.Ay.div(Hr||(Hr=fo(["\n display: flex;\n flex-direction: column;\n border-radius: 8px;\n overflow: hidden;\n background: white;\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);\n border-left: 8px solid ",";\n\n height: 100%;\n transition: box-shadow 0.2s ease;\n\n\n &:hover {\n box-shadow: 0 0px 5px rgb(0 0 0 / 25%);\n }\n"])),(function(e){return e.active?"persistent"===e.scope?"var(--neko-purple)":"frontend"===e.scope?"var(--neko-yellow)":"backend"===e.scope?"var(--neko-green)":"function"===e.scope?"var(--neko-orange)":"scheduled"===e.scope?"var(--neko-cyan)":"content_php"===e.scope||"content_js"===e.scope?"var(--neko-green)":"var(--neko-gray)":"var(--neko-gray-80)"})),Ro=j.Ay.div(Vr||(Vr=fo(["\n display: flex;\n gap: 24px;\n padding: 10px;\n height: inherit;\n"]))),xo=j.Ay.div(zr||(zr=fo(["\n flex: 0 0 80px;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-start;\n"]))),Oo=j.Ay.div(Yr||(Yr=fo(["\n flex: 1;\n min-width: 0;\n"]))),To=j.Ay.div(Wr||(Wr=fo(["\n flex: 0 0 auto;\n display: flex;\n flex-direction: column;\n gap: 8px;\n align-items: flex-end;\n"]))),No=j.Ay.div(Kr||(Kr=fo(["\n width: ",";\n height: ",";\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: 8px;\n cursor: pointer;\n transition: transform 0.2s ease, width 0.2s ease, height 0.2s ease;\n\n &:hover {\n transform: scale(1.1);\n }\n\n img {\n width: 100%;\n height: 100%;\n filter: ",";\n opacity: ",";\n }\n"])),(function(e){return e.simplified?"40px":"60px"}),(function(e){return e.simplified?"40px":"60px"}),(function(e){return e.active?"none":"grayscale(100%)"}),(function(e){return e.active?1:.5})),_o=j.Ay.div(qr||(qr=fo(["\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 6px;\n"]))),Lo=j.Ay.span(Jr||(Jr=fo(["\n font-size: 10px;\n padding: 2px 5px;\n border-radius: 3px;\n border: 1px solid var(--neko-gray-60);\n color: var(--neko-gray-60);\n background: var(--neko-gray-98);\n font-weight: 500;\n"]))),Po=j.Ay.div($r||($r=fo(["\n display: flex;\n align-items: center;\n gap: 8px;\n margin-top: 8px;\n flex-wrap: wrap;\n"]))),Io=j.Ay.div(Qr||(Qr=fo(["\n display: flex;\n gap: 8px;\n padding: 10px;\n background: ",";\n border-radius: 0 0 8px 0px;\n box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);\n justify-content: space-between;\n"])),(function(e){return e.active?"persistent"===e.scope?"rgba(147, 83, 211, 0.08)":"frontend"===e.scope?"rgba(245, 165, 36, 0.08)":"backend"===e.scope?"rgba(23, 201, 100, 0.08)":"function"===e.scope?"rgba(255, 152, 0, 0.08)":"scheduled"===e.scope?"rgba(6, 182, 212, 0.08)":"content_php"===e.scope||"content_js"===e.scope?"rgba(0, 179, 133, 0.08)":"rgba(229, 231, 235, 0.5)":"rgba(229, 231, 235, 0.5)"})),ko=j.Ay.div(Xr||(Xr=fo(["\n display: flex;\n gap: 8px;\n align-items: center;\n"]))),Ao=j.Ay.div(Zr||(Zr=fo(["\n display: flex;\n gap: 8px;\n align-items: center;\n"]))),Co=function(e){var t=e.snippet,n=e.onClick,r=e.simplified,o="1"===t.active,a=t.scope,i=yo;return"persistent"===a?i=yo:"frontend"===a?i=mo:"backend"===a?i=ho:"function"===a?i=po:"scheduled"===a?i=vo:"content_php"===a||"content_js"===a?i=go:console.warn('Code Engine: The scope "'.concat(a,'" is not supported.')),React.createElement(No,{active:o,simplified:r,onClick:n},React.createElement("img",{src:i,alt:a}))},jo=function(e){var t=e.busy,n=e.snippets,r=e.useInlineEditor,o=e.simplifiedView,a=e.onEditSnippet,i=e.onSave,c=e.onDelete,l=e.onDuplicate,u=e.currentScope;return React.createElement(React.Fragment,null,t&&0===n.length?React.createElement(wo,null,React.createElement(Cr.X,{size:"large",color:"var(--neko-gray-60)"}),React.createElement("div",{style:{marginTop:"16px",color:"var(--neko-gray-60)"}},Ve.COMMON.LOADING)):null,!t&&0===n.length&&React.createElement(bo,null,React.createElement("div",{style:{fontSize:"16px",fontWeight:"600",marginBottom:"8px"}},Ve.COMMON.NO_RESULTS),React.createElement("div",{style:{maxWidth:"500px"}},"all"===u?"Get started by clicking the + button to create your first snippet, or use Quick Start to generate one with AI.":'Click the + button above to create a new snippet, or switch to the "All" view for more options.')),n.length>0&&React.createElement(Eo,null,n.map((function(e){var n="1"===e.active,u=e.endpoint&&e.method;return React.createElement(Ut.A,{key:e.id,busy:t},React.createElement(So,{active:n,scope:e.scope},React.createElement(Ro,null,React.createElement(xo,null,React.createElement(Co,{snippet:e,onClick:function(){return a(e)},simplified:o}),React.createElement(_o,null,React.createElement(oo,{scope:e.scope,active:n}))),React.createElement(Oo,null,React.createElement(ro,{snippet:e,onEditClick:function(){return a(e)},simplified:o}),React.createElement(Po,null,("content_php"===e.scope||"content_js"===e.scope)&&React.createElement(jr.H,{prefix:"code-engine",params:{id:null==e?void 0:e.id}}),"scheduled"===e.scope&&React.createElement("div",{style:{fontSize:"12px",color:"var(--neko-gray-60)",display:"flex",alignItems:"center",gap:"4px"}},React.createElement(Dr.z,{icon:"timer-reset",width:"18px",style:{color:"rgb(150, 150, 150)",marginRight:"4px"}})," ",React.createElement("span",null,"Triggers every day at ",React.createElement("strong",null,e.intervalHours,":",e.intervalMinutes))),e.functionName&&React.createElement("div",{style:{fontSize:"12px",color:"var(--neko-gray-60)",display:"flex",alignItems:"center",gap:"4px"}},React.createElement("strong",null,"→")," ",React.createElement("pre",{style:{margin:0}},e.functionName,"();"))),u&&React.createElement(Po,null,React.createElement("div",{style:{fontSize:"13px",color:"var(--neko-gray-60)",cursor:"default"}},React.createElement(Mr.f,{position:"top",text:"".concat(e.method," /").concat(e.endpoint)},React.createElement(Lo,null,e.method)),React.createElement("small",{style:{marginLeft:5}},N,"/snippets-endpoint/",React.createElement("strong",null,e.endpoint)))),!o&&e.tags&&React.createElement("div",{style:{marginTop:"8px"}},React.createElement(ao,{tags:e.tags}))),React.createElement(To,null,r&&React.createElement(React.Fragment,null,React.createElement(w.M,{rounded:!0,title:Ve.COMMON.EDIT,icon:"pencil",className:"primary",onClick:function(){return a(e)}}),React.createElement(w.M,{rounded:!0,icon:"duplicate",title:Ve.COMMON.CLONE,className:"primary",onClick:function(){return l(e)}})))),!o&&React.createElement(Io,{active:n,scope:e.scope},React.createElement(ko,null,!r&&React.createElement(React.Fragment,null,React.createElement(w.M,{icon:"pencil",title:Ve.COMMON.EDIT,className:"primary",onClick:function(){return a(e)}},Ve.COMMON.EDIT),React.createElement(w.M,{icon:"duplicate",title:Ve.COMMON.CLONE,className:"secondary",onClick:function(){return l(e)}},Ve.COMMON.CLONE))),React.createElement(Ao,null,React.createElement(Gt.S,{onLabel:"Enabled",offLabel:"Disabled",onValue:"1",offValue:"0",width:"96px",checked:"1"===e.active,onChange:function(t){return i(uo(uo({},e),{},{active:t}))}}),React.createElement(w.M,{icon:"trash",title:Ve.COMMON.DELETE,className:"danger",onClick:function(){return c(e)}})))))}))))};function Do(e){return Do="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Do(e)}function Mo(){Mo=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new P(r||[]);return o(i,"_invoke",{value:T(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function x(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==Do(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function T(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(Do(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},x(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function Go(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Fo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Go(Object(n),!0).forEach((function(t){Uo(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Go(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Uo(e,t,n){return(t=function(e){var t=function(e){if("object"!=Do(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Do(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Do(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bo(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function Ho(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Bo(a,r,o,i,c,"next",e)}function c(e){Bo(a,r,o,i,c,"throw",e)}i(void 0)}))}}function Vo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||zo(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zo(e,t){if(e){if("string"==typeof e)return Yo(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yo(e,t):void 0}}function Yo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Wo=wp.element,Ko=Wo.useState,qo=Wo.useEffect,Jo=Wo.useMemo,$o=Wo.useRef;const Qo=function(){var e,t=jt(),n=t.actions,r=t.state,o=((0,s.z)().colors,n.getOption),a=(n.updateOption,n.setError),i=r.isLoading,c=dn({onRanSnippet:function(e){return _((0,R.g7)(Ve.SETTINGS.SUCCESSFULLY_RAN,e))},onError:function(e){return a(e)}}),l=c.isProcessing,u=c.snippets,f=c.total,p=(c.tags,c.stats),h=c.tableFilters,d=c.setTableFilters,m=c.editSnippet,y=c.setEditSnippet,v=c.isSavable,g=c.isResetable,b=c.onDelete,S=c.onSave,x=(c.onImportCodeSnippets,c.onDuplicate),O=c.onRefresh,T=Vo(Ko(null),2),N=T[0],_=T[1],L=Vo(Ko(!1),2),P=L[0],I=(L[1],Vo(Ko(!1),2)),k=I[0],A=I[1],C=Vo(Ko(!1),2),j=C[0],D=C[1],M=Vo(Ko(""),2),G=M[0],F=M[1],U=Vo(Ko(0),2),B=U[0],H=U[1],V=Vo(Ko(!1),2),z=V[0],Y=V[1],W=Vo(Ko(""),2),K=W[0],q=W[1],J=Vo(Ko(!1),2),$=J[0],Q=J[1],X=Vo(Ko(!1),2),Z=X[0],ee=X[1],te=Vo(Ko(!1),2),ne=te[0],re=te[1],oe=$o(null),ae=Jo((function(){if(!m)return!1;if(null!=m&&m.functionNotValid)return!1;if(!(null==m?void 0:m.name)||!(null==m?void 0:m.code))return!1;var e=u.find((function(e){return e.id===m.id}));return Kt(e,m)}),[u,m]),ie=(null===(e=h.filters.find((function(e){return"scope"===e.accessor})))||void 0===e?void 0:e.value)||"all",ce=o("ai_engine_status",!1);qo((function(){var e=function(){var e=Ho(Mo().mark((function e(t){var n,r;return Mo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.metaKey&&!t.ctrlKey||"s"!==t.key){e.next=20;break}if(!k||Z||ne){e.next=20;break}if(t.preventDefault(),t.stopPropagation(),!m||!ae){e.next=20;break}if(ee(!0),e.prev=6,!oe.current){e.next=14;break}return e.next=10,oe.current();case 10:if(e.sent){e.next=14;break}return ee(!1),e.abrupt("return");case 14:return n=Fo(Fo({},m),{},{functionError:!1}),e.next=17,S(n);case 17:return e.prev=17,ee(!1),e.finish(17);case 20:if(!t.metaKey&&!t.ctrlKey||"Enter"!==t.key){e.next=41;break}if(!k||Z||ne){e.next=41;break}if(t.preventDefault(),t.stopPropagation(),!m||!ae){e.next=41;break}if(re(!0),e.prev=26,!oe.current){e.next=34;break}return e.next=30,oe.current();case 30:if(e.sent){e.next=34;break}return re(!1),e.abrupt("return");case 34:return r=Fo(Fo({},m),{},{functionError:!1}),e.next=37,S(r);case 37:ue(!1);case 38:return e.prev=38,re(!1),e.finish(38);case 41:case"end":return e.stop()}}),e,null,[[6,,17,20],[26,,38,41]])})));return function(t){return e.apply(this,arguments)}}();return k&&document.addEventListener("keydown",e,!0),function(){document.removeEventListener("keydown",e,!0)}}),[k,m,ae,Z,ne,S]);var le=function(e){confirm(Ve.ALERTS.ARE_YOU_SURE)&&b(e)},ue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qt;A(!P),y(e?t:null),ee(!1),re(!1),oe.current=null,e||(A(!1),y(null))},se=function(){Y(!z)},fe=function(){var e=Ho(Mo().mark((function e(){var t,n;return Mo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,Q(!0),e.next=4,Et(K);case 4:t=e.sent,(n=JSON.parse(JSON.stringify(Qt))).name=null==t?void 0:t.name,n.description=null==t?void 0:t.description,n.code=null==t?void 0:t.code,n.tags=null==t?void 0:t.tags,n.scope=null==t?void 0:t.type,n.functionTarget=null==t?void 0:t.functionTarget,n.intervalHours=null==t?void 0:t.target_hour,n.intervalMinutes=null==t?void 0:t.target_minute,"function"===(null==t?void 0:t.type)&&null!=t&&t.parameters&&t.parameters.forEach((function(e){var r="php"===(null==t?void 0:t.functionTarget)?"$":"";n.functionArgs.push(r+(null==e?void 0:e.name)),n.functionArgsDict[r+(null==e?void 0:e.name)]={name:r+(null==e?void 0:e.name),desc:null==e?void 0:e.description,type:null==e?void 0:e.type,default:null==e?void 0:e.default,required:null==e?void 0:e.required}})),console.log(n),y(n),A(!0),e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),a(e.t0);case 23:return e.prev=23,se(),Q(!1),e.finish(23);case 27:case"end":return e.stop()}}),e,null,[[0,20,23,27]])})));return function(){return e.apply(this,arguments)}}(),pe=function(e){_(null),ue(!0,e)},he=h.limit,de=h.page,me=i||l,ye=(React.Fragment,N&&Ee.X,React.createElement(Ee.X,{variant:"danger",style:{marginBottom:"16px"}},Ve.ERROR.SNIPPET_FATAL,o("fatal_error",""),". ",Ve.ERROR.SNIPPET_DISABLED)),ve=function(e){var t;qt.some((function(t){return t.value===e}))&&d(Fo(Fo({},h),{},{page:1,filters:[].concat((t=h.filters.filter((function(e){return"scope"!==e.accessor})),function(e){if(Array.isArray(e))return Yo(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||zo(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),[{accessor:"scope",value:e}])}))},Se=Jo((function(){if(!G)return u;var e=G.toLowerCase();return u.filter((function(t){var n,r,o=null===(n=t.name)||void 0===n?void 0:n.toLowerCase().includes(e),a=null===(r=t.description)||void 0===r?void 0:r.toLowerCase().includes(e),i=!1;return t.tags&&("string"==typeof t.tags?i=t.tags.toLowerCase().includes(e):Array.isArray(t.tags)&&(i=t.tags.some((function(t){return null==t?void 0:t.toLowerCase().includes(e)})))),o||a||i}))}),[u,G]),Re=Jo((function(){return React.createElement(jo,{busy:me,snippets:Se,onEditSnippet:pe,currentScope:ie,useInlineEditor:P,simplifiedView:j,onSave:S,onDelete:le,onDuplicate:x})}),[Se,me,ie,P,j]),xe=Jo((function(){return React.createElement(Dt.V,{style:{marginTop:"20px",justifyContent:"space-between"}},React.createElement("div",{style:{display:"flex",gap:"10px",alignItems:"center"}},React.createElement(Mt.u,{name:"scope_filter",scrolldown:!0,value:ie,onChange:ve},null==qt?void 0:qt.map((function(e){return React.createElement(Mt.j,{key:e.value,value:e.value,label:"".concat(e.label," (").concat((null==p?void 0:p[e.value])||0,")")})}))),React.createElement(Mt.u,{scrolldown:!0,value:he,onChange:function(e){return d(Fo(Fo({},h),{},{limit:e,offset:0}))}},React.createElement(Mt.j,{value:5,label:"5 Snippets"}),React.createElement(Mt.j,{value:10,label:"10 Snippets"}),React.createElement(Mt.j,{value:25,label:"25 Snippets"}),React.createElement(Mt.j,{value:50,label:"50 Snippets"}),React.createElement(Mt.j,{value:100,label:"100 Snippets"})),React.createElement("div",{style:{marginLeft:"20px",display:"flex",alignItems:"center",gap:"8px"}},React.createElement("span",null,"Simplify"),React.createElement(Gt.S,{checked:j,onChange:D}))),React.createElement(Ft.Q,{currentPage:de,limit:he,total:f,onClick:function(e){return d(Fo(Fo({},h),{},{page:e}))}}))}),[he,de,f,ie,j,p]);return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement("div",{style:{padding:"10px"}},o("fatal_error",null)&&ye,React.createElement(Dt.V,{style:{marginBottom:"20px"}},React.createElement(w.M,{className:"primary",icon:"plus",onClick:function(){return ue(!0)}},Ve.COMMON.ADD),React.createElement(w.M,{className:"primary",color:"purple",icon:"wand",disabled:!ce,onClick:function(){return se()}},Ve.SETTINGS.QUICK_START),React.createElement("div",{style:{flex:"auto"}}),React.createElement(be.A,{value:G,onChange:F,onReset:function(){return F("")},placeholder:"Search snippets...",style:{width:"250px"}}),React.createElement(w.M,{busy:me,className:"primary",onClick:O},Ve.COMMON.REFRESH)),Re,xe))),React.createElement(we.n,{isOpen:z,title:Ve.SETTINGS.QUICK_START,content:React.createElement(Ut.A,{busy:$},React.createElement(Ee.X,{variant:"info",style:{marginBottom:"16px"}},Ve.SETTINGS.QUICK_START_INFO),React.createElement(Bt.m,{value:K,onBlur:q,placeholder:Ve.SETTINGS.QUICK_START_PLACEHOLDER,style:{height:"200px"}})),onRequestClose:se,okButton:{label:Ve.COMMON.RUN,onClick:function(){fe()},disabled:$},cancelButton:{label:Ve.COMMON.CLOSE,onClick:se,disabled:$}}),React.createElement(we.n,{isOpen:k,size:"full-size",title:Ve.SETTINGS.EDITOR,action:React.createElement(React.Fragment,null,React.createElement(w.M,{className:"secondary",onClick:function(){if(m){var e=u.find((function(e){return e.id===m.id}));e?(y(JSON.parse(JSON.stringify(e))),H((function(e){return e+1}))):null===m.id&&(y(JSON.parse(JSON.stringify(Qt))),H((function(e){return e+1})))}},disabled:!g||Z||ne},"Reset"),React.createElement(w.M,{onClick:Ho(Mo().mark((function e(){var t;return Mo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ee(!0),e.prev=1,!oe.current){e.next=9;break}return e.next=5,oe.current();case 5:if(e.sent){e.next=9;break}return ee(!1),e.abrupt("return");case 9:return t=Fo(Fo({},m),{},{functionError:!1}),e.next=12,S(t);case 12:return e.prev=12,ee(!1),e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[1,,12,15]])}))),busy:Z,disabled:!ae&&!Z||ne},Ve.COMMON.SAVE),React.createElement(w.M,{onClick:Ho(Mo().mark((function e(){var t;return Mo().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(re(!0),e.prev=1,!oe.current){e.next=9;break}return e.next=5,oe.current();case 5:if(e.sent){e.next=9;break}return re(!1),e.abrupt("return");case 9:return t=Fo(Fo({},m),{},{functionError:!1}),e.next=12,S(t);case 12:ue(!1);case 13:return e.prev=13,re(!1),e.finish(13);case 16:case"end":return e.stop()}}),e,null,[[1,,13,16]])}))),busy:ne,disabled:!ae&&!ne||Z},Ve.COMMON.SAVE_AND_CLOSE)),content:React.createElement(React.Fragment,null,React.createElement(ge.g,null),N&&React.createElement(Ee.X,{variant:"success",style:{marginBottom:"16px"}},N),React.createElement(Ar,{editorKey:B,busy:me,onClose:function(){return ue(!1)},editSnippet:m,setEditSnippet:y,isSavable:v,onSave:S,onLintReady:function(e){oe.current=e}})),contentStyle:{margin:"0 -15px",padding:"10px 15px",height:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column",backgroundColor:"var(--neko-main-color)"},onRequestClose:function(){return ue(!1)},customButtons:React.createElement("span",{style:{fontSize:"12px",color:"rgba(0, 0, 0, 0.5)",alignSelf:"center",marginRight:"auto"}},"⌘S to save • ⌘↵ to save & close"),customButtonsPosition:"left",cancelButton:{label:Ve.COMMON.CLOSE,onClick:function(){return ue(!1)}}}))};var Xo=n(6031),Zo=n(7392);function ea(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ta=wp.element.useState;const na=function(){var e=jt(),t=e.actions,n=e.state,r=t.getOption,o=t.updateOption,a=t.resetOptions,i=t.refreshOptions,c=n.isLoading,l=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ea(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ea(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(ta(!1),2),u=l[0],s=l[1],f=dn({onError:function(e){return alert("⚠️ "+e)}}),p=f.onImportCodeSnippets,v=f.isProcessing,g=r("ai_engine_status",!1),b=(r("database_inspection",!1),r("code_blocks",!1),c||u||v);return React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(S.z,{busy:b,title:Ve.SETTINGS.PREFERENCES.TITLE,className:"primary"},React.createElement(d.d,{title:Ve.SETTINGS.PREFERENCES.CODE_PREVIEW},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"ui_show_preview",disabled:b,label:Ve.COMMON.ENABLE,description:Ve.SETTINGS.PREFERENCES.CODE_PREVIEW_DESCRIPTION,value:"1",checked:r("ui_show_preview",!1),onChange:o})))),React.createElement(S.z,{busy:b,title:Ve.SETTINGS.MODULES.TITLE,className:"primary"},React.createElement(d.d,{title:Ve.SETTINGS.MODULES.CODE_BLOCKS},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"code_blocks",disabled:b,requirePro:!I,label:Ve.COMMON.ENABLE,description:Ve.SETTINGS.MODULES.CODE_BLOCKS_DESCRIPTION,value:"1",checked:r("code_blocks",!1),onChange:o}))),React.createElement(d.d,{title:Ve.SETTINGS.DEVELOPERS.DATABASE_INSPECTION},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"database_inspection",disabled:b,label:Ve.COMMON.ENABLE,description:Ve.SETTINGS.DEVELOPERS.DATABASE_INSPECTION_DESCRIPTION,value:"1",checked:r("database_inspection",!1),onChange:o}))),React.createElement(d.d,{title:Ve.SETTINGS.PREFERENCES.PUBLIC_API},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"api_endpoint",disabled:b,label:Ve.COMMON.ENABLE,description:Ve.SETTINGS.PREFERENCES.SNIPPET_ENDPOINT_DESCRIPTION,value:"1",checked:r("api_endpoint",!1),onChange:o}))),r("api_endpoint",!1)&&React.createElement(d.d,{title:Ve.SETTINGS.SNIPPET.TOKEN},React.createElement("div",{style:{display:"flex",gap:"10px"}},React.createElement(be.A,{style:{flex:1},name:"api_token",value:r("api_token",""),onBlur:o}),React.createElement(w.M,{rounded:!0,icon:"replay",onClick:function(){return o(Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),"api_token")}})))),React.createElement(S.z,{busy:b,title:Ve.COMMON.MAINTENANCE,className:"primary"},React.createElement(d.d,{title:Ve.MAINTENANCE.CLEAN_UNINSTALL},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"clean_uninstall",disabled:b,label:Ve.COMMON.ENABLE,description:Ve.MAINTENANCE.CLEAN_UNINSTALL_DESCRIPTION,value:"1",checked:r("clean_uninstall",!1),onChange:o}))),React.createElement(h.s,{h4:!0},"Settings"),React.createElement("div",{style:{display:"flex",gap:"0px",alignItems:"center"}},React.createElement(w.M,{className:"danger",onClick:a},Ve.COMMON.RESET_SETTINGS),React.createElement(w.M,{className:"primary",onClick:i},Ve.COMMON.REFRESH_SETTINGS),React.createElement(w.M,{className:"secondary",onClick:function(){return o(!1,"hide_tutorial")}},Ve.SETTINGS.SHOW_TUTORIAL)),React.createElement(ge.g,null),React.createElement(h.s,{h4:!0},"Snippets"),React.createElement("div",{style:{display:"flex",gap:"0px"}},React.createElement(w.M,{className:"danger",onClick:function(){return rt(s)}},Ve.SETTINGS.IMPORT_SETTINGS),React.createElement(w.M,{className:"primary",onClick:function(){return nt(s)}},Ve.SETTINGS.EXPORT_SETTINGS)),React.createElement(ge.g,{tiny:!0}),React.createElement("div",{style:{display:"flex",gap:"0px"}},React.createElement(w.M,{className:"secondary",onClick:p,busy:b},Ve.SETTINGS.SNIPPET.IMPORT_CODE_SNIPPETS)))),React.createElement(E.Y,{minimal:!0},React.createElement(S.z,{busy:b,title:Ve.SETTINGS.AI_PARAMETERS.TITLE,className:"primary",action:React.createElement(React.Fragment,null,g&&React.createElement(Xo.B,{className:"success",label:Ve.SETTINGS.AI_PARAMETERS.AI_ENGINE_INSTALLED}),!g&&React.createElement(Xo.B,{className:"warning",label:Ve.SETTINGS.AI_PARAMETERS.DOWNLOAD_AI_ENGINE,link:"https://meowapps.com/ai-engine/"}))},React.createElement(d.d,{title:Ve.SETTINGS.AI_PARAMETERS.AI_SUGGESTIONS},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"ai_suggestions",disabled:b||!g,label:Ve.COMMON.ENABLE,description:Ve.SETTINGS.AI_PARAMETERS.AI_SUGGESTIONS_DESCRIPTION,value:"1",checked:r("ai_suggestions",!1),onChange:o})))),React.createElement(S.z,{busy:b,title:Ve.SETTINGS.DEVELOPERS.TITLE,className:"primary"},React.createElement(d.d,{title:Ve.SETTINGS.DEVELOPERS.SANITIZE_ARGS},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"sanitize_arguments",disabled:b,label:Ve.COMMON.ENABLE_RECOMMENDED,description:Ve.SETTINGS.DEVELOPERS.SANITIZE_ARGS_DESCRIPTION,value:"1",checked:r("sanitize_arguments",!0),onChange:o}))),React.createElement(d.d,{title:Ve.SETTINGS.DEVELOPERS.MCP_SUPPORT},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"mcp_support",disabled:b||!g,label:Ve.COMMON.ENABLE,description:Ve.SETTINGS.DEVELOPERS.MCP_SUPPORT_DESCRIPTION,value:"1",checked:r("mcp_support",!1),onChange:o}))),React.createElement(d.d,{title:Ve.SETTINGS.DEVELOPERS.BYPASS_SECURITY},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"bypass_rest_security",disabled:b,label:Ve.COMMON.ENABLE_NOT_RECOMMENDED,description:Ve.SETTINGS.DEVELOPERS.BYPASS_SECURITY_DESCRIPTION,value:"1",checked:r("bypass_rest_security",!1),onChange:o}))),React.createElement(d.d,{title:Ve.SETTINGS.DEVELOPERS.LOGS},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"server_debug_mode",disabled:b,label:Ve.COMMON.ENABLE,description:Ve.SETTINGS.DEVELOPERS.LOGS_DESCRIPTION,value:"1",checked:r("server_debug_mode",!1),onChange:o})))),r("server_debug_mode",!1)&&React.createElement(Zo.k,{refreshQuery:Qe,clearQuery:Xe,i18n:Ve}))))};var ra=n(6842);function oa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return aa(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?aa(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function aa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ia=wp.element,ca=ia.useState,la=ia.useEffect,ua=ia.useCallback,sa=function(e){!function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(e);var t=oa(ca([]),2),n=t[0],r=t[1],o=oa(ca(!0),2),a=o[0],i=o[1],c=oa(ca(!1),2),l=c[0],u=c[1],s=oa(ca(""),2),f=s[0],p=s[1],h=ua((function(){ot().then((function(e){r(e),p(JSON.stringify(e,null,2)),console.log(e)})).catch((function(e){console.error(e)})).finally((function(){i(!1)}))}),[]);return la((function(){h()}),[]),React.createElement(React.Fragment,null,l&&React.createElement(Bt.m,{textAreaStyle:{height:380},value:f,onChange:function(e){p(e)},style:{height:"100%",width:"100%",minHeight:380}}),!l&&React.createElement("div",{style:{height:380,overflow:"auto",maxHeight:380}},a&&React.createElement("i",{style:{color:"gray"}},"Loading..."),!a&&!n&&React.createElement("i",{style:{color:"gray"}},Ve.COMMON.DATA_NOT_AVAILABLE),!a&&n&&React.createElement(ra.p2,{value:n,rootName:"functions",indentWidth:2,displayDataTypes:!1,displayObjectSize:!1,displayArrayKey:!1,enableClipboard:!1,style:{fontSize:12}})),React.createElement(ge.g,null),React.createElement(w.M,{className:"secondary",onClick:function(){return u(!l)}},l?Ve.COMMON.CANCEL:Ve.SETTINGS.DEVELOPERS.RAW_EDIT),l&&React.createElement(w.M,{onClick:function(){at(f).then((function(){alert("Functions updated."),h(),u(!1)})).catch((function(e){alert("Error while updating functions. Please check your console."),console.error(e)}))}},Ve.COMMON.UPDATE))},fa=n(6198);function pa(e){return pa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pa(e)}function ha(){ha=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),c=new P(r||[]);return o(i,"_invoke",{value:T(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",d="executing",m="completed",y={};function v(){}function g(){}function E(){}var b={};u(b,i,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==n&&r.call(S,i)&&(b=S);var R=E.prototype=v.prototype=Object.create(b);function x(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(o,a,i,c){var l=f(e[o],e,a);if("throw"!==l.type){var u=l.arg,s=u.value;return s&&"object"==pa(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(s).then((function(e){u.value=e,i(u)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return a=a?a.then(o,o):o()}})}function T(t,n,r){var o=p;return function(a,i){if(o===d)throw Error("Generator is already running");if(o===m){if("throw"===a)throw i;return{value:e,done:!0}}for(r.method=a,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var u=f(t,n,r);if("normal"===u.type){if(o=r.done?m:h,u.arg===y)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(o=m,r.method="throw",r.arg=u.arg)}}}function N(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(o,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var i=a.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(pa(t)+" is not iterable")}return g.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:g,configurable:!0}),g.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},x(O.prototype),u(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,o,a){void 0===a&&(a=Promise);var i=new O(s(e,n,r,o),a);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(R),u(R,l,"Generator"),u(R,i,(function(){return this})),u(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=I,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function da(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function ma(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||ya(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ya(e,t){if(e){if("string"==typeof e)return va(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?va(e,t):void 0}}function va(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ga=wp.element,Ea=ga.useState,ba=ga.useEffect,wa=(ga.useMemo,ga.useCallback),Sa=function(e){!function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(e);var t,n,r,o=jt().actions,a=o.getOption,i=o.updateOption,c=(o.resetOptions,o.refreshOptions,"code_blocks_whitelist"),l=a(c,[]),u=l,s=ma(Ea(""),2),p=s[0],h=s[1],d=ma(Ea(1),2),m=d[0],y=d[1],v=ma(Ea([]),2),g=v[0],E=v[1],b=ma(Ea(!1),2),S=b[0],x=b[1],O=ma(Ea(l),2),T=O[0],_=O[1],L=(t={search:p,offset:10*(m-1),limit:10},(0,f.I)({queryKey:["posts",t],queryFn:(n=ha().mark((function e(){var n;return ha().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(N,"/fetch_posts"),{nonce:k,method:"POST",json:t});case 2:if(!(n=e.sent).success){e.next=5;break}return e.abrupt("return",{data:n.data,total:n.total});case 5:throw new Error(n.message||"Failed to fetch posts");case 6:case"end":return e.stop()}}),e)})),r=function(){var e=this,t=arguments;return new Promise((function(r,o){var a=n.apply(e,t);function i(e){da(a,r,o,i,c,"next",e)}function c(e){da(a,r,o,i,c,"throw",e)}i(void 0)}))},function(){return r.apply(this,arguments)})})),P=L.data,I=L.isLoading,A=(L.error,(null==P?void 0:P.data)||[]),C=(null==P?void 0:P.total)||0;ba((function(){if(!(p.length>0)&&(null==u?void 0:u.length)>0){var e=A.filter((function(e){return u.includes(e.id)}));E(e)}}),[u,A.length,p]);var j=wa((function(e){h(e),y(1)}),[]),D=wa((function(e){y(e)}),[]),M=wa((function(e){var t,n=e[0];g.some((function(e){return e.id===n.id}))?E(g.filter((function(e){return e.id!==n.id}))):E([].concat(function(e){if(Array.isArray(e))return va(e)}(t=g)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||ya(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[n]))}),[g,A]),G=wa((function(){x(!1),h(""),y(1)}),[]),F=wa((function(){i(g.map((function(e){return e.id})),c),_(g.map((function(e){return e.id}))),G()}),[g]);return React.createElement(React.Fragment,null,React.createElement(be.A,{disabled:!0,name:"post_ids",type:"text",value:T.join(", "),style:{flex:1},placeholder:"Post IDs... (separated by commas)",onChange:function(e){_(e.split(",").map((function(e){return e.trim()})))}}),React.createElement(w.M,{className:"primary",style:{marginLeft:10},onClick:function(){return x(!0)}},"Select Posts"),React.createElement(fa._,{isOpen:S,posts:A,selected:g,maxSelect:100,onNextPage:function(){return D(m+1)},onPreviousPage:function(){return D(m-1)},onRefresh:function(){return D(1)},onSearch:j,searchValue:p,busy:I,currentPage:m,limit:10,total:C,onPageChange:D,onSelect:M,onClose:G,onCancel:G,onSave:F}))};function Ra(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var xa=wp.element.useState;const Oa=function(){var e=jt(),t=e.actions,n=e.state,r=t.getOption,o=t.updateOption,a=n.isLoading,i=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,c=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ra(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ra(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(xa("snippets"),2),c=i[0],l=i[1],u=r("database_inspection",!1),f={snippets:Ve.SETTINGS.SNIPPET.LABEL+"s",settings:Ve.COMMON.SETTINGS,"database-inspection":Ve.SETTINGS.DEVELOPERS.DATABASE_INSPECTION,license:Ve.COMMON.LICENSE_TAB}[c]||Ve.SETTINGS.SNIPPET.LABEL+"s",p=React.createElement(ve.M,{hideText:Ve.COMMON.HIDE,hide:r("hide_tutorial",!1),onHide:function(){confirm(Ve.ALERTS.ARE_YOU_SURE)&&o(!0,"hide_tutorial")},showMessagesCount:!0,messages:[{title:"⚠️ Use the Plugin Carefully",message:"Please use this plugin with care. Ensure you know what you are doing and that the code you input does what you expect. You are solely responsible for the code you use and any issues that might arise because of it. Always have a backup of your website."},{title:"🤖 Seek Professional Help When Unsure",message:"If you are not sure what you are doing, contact a freelancer or someone with experience. Don't use ChatGPT to generate code that you don't understand to use out of the box; always verify."},{title:"ℹ️ Register Callable Functions",message:"If you want to use Function Calling or Tools with AI models, make sure you register your code under the Callable type. Ensure that the snippet is only the function and nothing else in this case."},{title:"📝 Create Global Snippets for WordPress Filters",message:"You can also create global snippets to call WordPress filters. You can choose between front and back, meaning that the code will be loaded on the live site or the admin panel. If you choose all, the code will always be loaded."},{title:"🔐 Whitelist REST Routes for Front Global Snippets",message:"If you choose Front for the global snippet, for security reasons you may need to whitelist some REST routes. You can do so with the following filter: `mwcode_rest_whitelist` or bypass the authorization using `mwcode_rest_authorized`."}]}),d=React.createElement(b.V,{title:Ve.SETTINGS.MODULES.CODE_BLOCKS},React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(S.z,{busy:a,title:Ve.SETTINGS.MODULES.CODE_BLOCKS_SELECTION,className:"primary"},React.createElement(Sa,null))),React.createElement(E.Y,{minimal:!0},React.createElement(S.z,{busy:a,title:Ve.SETTINGS.MODULES.CODE_BLOCKS_INSTRUCTIONS,className:"primary"},React.createElement(h.s,null,Ve.SETTINGS.MODULES.CODE_BLOCKS_INSTRUCTIONS_DESCRIPTION),React.createElement(ge.g,{tiny:!0}),React.createElement(Ee.X,{variant:"warning"},Ve.SETTINGS.MODULES.CODE_BLOCKS_INSTRUCTIONS_WARNING)))));return React.createElement(s.A,null,React.createElement(v.z,null,React.createElement(g.n,{title:Ve.SETTINGS.HEADER_TITLE,section:f,isPro:P}),React.createElement(E.N,null,React.createElement(E.Y,{fullWidth:!0},p,React.createElement(b._,{keepTabOnReload:!0,onChange:function(e,t,n){null!=t&&t.key&&l(t.key)}},React.createElement(b.V,{title:Ve.SETTINGS.SNIPPET.LABEL+"s",key:"snippets"},React.createElement(Qo,null)),React.createElement(b.V,{title:Ve.COMMON.SETTINGS,key:"settings"},React.createElement(na,null)),r("code_blocks",!1)&&d,u&&React.createElement(b.V,{title:Ve.SETTINGS.DEVELOPERS.DATABASE_INSPECTION,key:"database-inspection"},React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(S.z,{busy:a,title:Ve.SETTINGS.DEVELOPERS.DATABASE_INSPECTION,className:"primary"},React.createElement(sa,null))))),React.createElement(b.V,{title:Ve.COMMON.LICENSE_TAB,key:"license"},React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(Fe,{domain:O,prefix:x,isPro:P,isRegistered:I})))))))))};var Ta,Na=n(6897),_a=["children","type","title","hint","isSelected","isDisplayed"];function La(){return La=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},La.apply(null,arguments)}var Pa=React.createElement(Dr.z,{icon:"cat",style:{width:20,height:20}}),Ia=j.Ay.div(Ta||(Ta=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(['\n color: black;\n display: flex;\n flex-direction: column;\n border: 1px solid black;\n font-size: 15px;\n box-sizing: content-box;\n font-weight: 400;\n font-size: 13px;\n padding: 10px;\n background: hsl(0deg 0% 100% / 75%);\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n margin-bottom: 10px;\n\n\n .mwcode-title-container {\n flex: inherit;\n padding: 5px 0px 5px 10px;\n display: flex;\n align-items: center;\n color: black;\n font-weight: 600;\n cursor: pointer;\n\n .mwcode-hint {\n font-size: 10px;\n font-weight: 400;\n text-align: right;\n flex: auto;\n\n .mwcode-pill {\n background: var(--wp--preset--color--vivid-cyan-blue);\n padding: 5px 10px;\n border-radius: 8px;\n color: white;\n }\n\n .mwcode-pill-purple {\n background: var(--wp--preset--color--vivid-purple);\n }\n }\n }\n\n .mwcode-block-container-content {\n flex: auto;\n padding: 10px;\n display: flex;\n flex-direction: column;\n }\n\n\t&.mwcode-chatbot {\n\t\tbackground: var(--neko-main-color);\n\n\t\t.mwcode-title-container {\n\t\t\tcolor: white;\n\t\t}\t\n\n\t\t.mwcode-block-container-content {\n\t\t\tmargin-top: 10px;\n\t\t\tborder-radius: 5px;\n\t\t\tbackground: var(--neko-background-color);\n\t\t}\n\t}\n\n &.is-selected {\n }\n']))),ka=function(e){var t=e.children,n=e.type,r=void 0===n?"":n,o=e.title,a=void 0===o?"":o,i=e.hint,c=void 0===i?"":i,l=e.isSelected,u=e.isDisplayed,s=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,_a),f=(0,Na.gR)("mwcode-block-container","mwcode-".concat(r),{"is-selected":l,"is-meow":!0});return React.createElement(Ia,La({className:f},s),React.createElement("div",{className:"mwcode-title-container"},Pa,React.createElement("div",null,a),React.createElement("div",{className:"mwcode-hint"},c)),(l||u)&&React.createElement("div",{className:"mwcode-block-container-content"},t))},Aa=wp.i18n.__,Ca=wp.blocks.registerBlockType,ja=wp.blockEditor,Da=ja.InspectorControls,Ma=ja.useBlockProps,Ga=wp.components,Fa=Ga.PanelBody,Ua=Ga.SelectControl,Ba=function(e){var t=e.attributes,n=e.setAttributes,r=e.isSelected,o=t.code,a=t.target,i=Ma();return React.createElement("div",i,React.createElement(Da,null,React.createElement(Fa,{title:Aa("Code Block Settings","code-engine")},React.createElement(Ua,{label:Aa("Target Language","code-engine"),value:a,options:[{label:"PHP",value:"php"},{label:"JS",value:"js"}],onChange:function(e){return n({target:e})}}))),React.createElement(ka,{title:Aa("Content Code Block","code-engine"),isSelected:r,isDisplayed:!0},React.createElement(Ua,{label:Aa("Target Language","code-engine"),value:a,options:[{label:"PHP",value:"php"},{label:"JS",value:"js"}],onChange:function(e){return n({target:e})}}),React.createElement("div",{style:{marginTop:"10px",outline:"rgb(160, 177, 233) solid 3px",padding:"5px",borderRadius:"5px"}},React.createElement(Dn,{code:o,snippet:{scope:"content_"+a,functionTarget:a},setCode:function(e){return n({code:e})}}))))},Ha=function(e){var t=e.attributes,n=t.code,r=t.target,o=function(e){return e?e.replace(/\\/g,"\\\\").replace(/"/g,"""):""}(n),a='[code-engine target="'.concat(r,'" code="').concat(o,'" ]');return React.createElement("div",null,a)};var Va=wp.element.render,za=new l.E({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnMount:!1,retry:!1,placeholderData:function(e){return e}}}});A.code_blocks&&Ca("code-engine/content",{title:Aa("Content Code Block","code-engine"),description:Aa("Container to embed code directly into the post content","code-engine"),icon:Pa,category:"widgets",keywords:[Aa("code","code-engine"),Aa("content","code-engine"),Aa("block","code-engine")],attributes:{target:{type:"string",default:"php"},code:{type:"string",default:""}},edit:Ba,save:Ha}),document.addEventListener("DOMContentLoaded",(function(){var e=document.getElementById("mwcode-admin-settings");e&&Va(React.createElement(Ct,null,React.createElement(u.Ht,{client:za},React.createElement(Oa,null))),e);var t=document.getElementById("meow-common-dashboard");t&&Va(React.createElement(u.Ht,{client:za},React.createElement(s.A,null,React.createElement(ye,null))),t)}))},1594:e=>{e.exports=React},5206:e=>{e.exports=ReactDOM}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,r),a.exports}r.m=t,r.amdO={},e=[],r.O=(t,n,o,a)=>{if(!n){var i=1/0;for(s=0;s<e.length;s++){for(var[n,o,a]=e[s],c=!0,l=0;l<n.length;l++)(!1&a||i>=a)&&Object.keys(r.O).every((e=>r.O[e](n[l])))?n.splice(l--,1):(c=!1,a<i&&(i=a));if(c){e.splice(s--,1);var u=o();void 0!==u&&(t=u)}}return t}a=a||0;for(var s=e.length;s>0&&e[s-1][2]>a;s--)e[s]=e[s-1];e[s]=[n,o,a]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={57:0};r.O.j=t=>0===e[t];var t=(t,n)=>{var o,a,[i,c,l]=n,u=0;if(i.some((t=>0!==e[t]))){for(o in c)r.o(c,o)&&(r.m[o]=c[o]);if(l)var s=l(r)}for(t&&t(n);u<i.length;u++)a=i[u],r.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return r.O(s)},n=self.webpackChunkcode_engine=self.webpackChunkcode_engine||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),r.nc=void 0;var o=r.O(void 0,[121],(()=>r(4684)));o=r.O(o)})(); |