|
2
|
|
-(()=>{"use strict";var e,t={5066:(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(2665),E=n(4547),b=n(3676),w=n(9296),S=n(4461),R=n(6639),T=(window.mwcode_snippet_vault.prefix,window.mwcode_snippet_vault.domain,window.mwcode_snippet_vault.rest_url.replace(/\/+$/,"")),O=window.mwcode_snippet_vault.api_url.replace(/\/+$/,""),x=window.mwcode_snippet_vault.plugin_url.replace(/\/+$/,""),N=("1"===window.mwcode_snippet_vault.is_pro&&window.mwcode_snippet_vault.is_registered,window.mwcode_snippet_vault.rest_nonce),P=window.mwcode_snippet_vault.options,I=n(197),L=n(1686);function A(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var k=L.Ay.div(r||(r=A(["\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"]))),C=(0,L.Ay)(S.z)(o||(o=A(["\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"]))),j=L.Ay.img(a||(a=A(["\n height: 125px;\n width: auto;\n border-radius: 10px;\n background: lightgray;\n"]))),G=L.Ay.div(i||(i=A(["\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"]))),D=L.Ay.ul(c||(c=A(["\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 M(e){return M="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},M(e)}function F(){F=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"==M(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 P(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 _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,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(M(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(_),!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),_(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;_(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 U(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 B(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){U(a,r,o,i,c,"next",e)}function c(e){U(a,r,o,i,c,"throw",e)}i(void 0)}))}}function H(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)||V(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 V(e,t){if(e){if("string"==typeof e)return Y(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)?Y(e,t):void 0}}function Y(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 z=wp.element,W=z.useState,q=z.useEffect,$="".concat(T,"/meow-common/v1"),K=function(e){var t=e.request,n=e.title,r=e.max,o=H(W(!1),2),a=o[0],i=o[1],c=H(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(B(F().mark((function e(){var n,r,o;return F().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(new Date).getTime(),e.next=3,(0,R.IU)("".concat($,"/").concat(t),{method:"POST",nonce:N});case 3:r=(new Date).getTime(),o=r-n,u((function(e){return[].concat(function(e){if(Array.isArray(e))return Y(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||V(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(k,{style:{width:200,textAlign:"center"}},React.createElement(h.s,{h2:!0,style:{color:"white"}},n),React.createElement(I.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 J(e){return J="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},J(e)}function Q(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 X(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)?X(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 X(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 Z(){Z=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"==J(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 P(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 _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,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(J(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(_),!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),_(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;_(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 ee(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 te(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){ee(a,r,o,i,c,"next",e)}function c(e){ee(a,r,o,i,c,"throw",e)}i(void 0)}))}}var ne=wp.element,re=ne.useState,oe=ne.useEffect;O&&T&&x||console.error("[@common/dashboard] apiUrl, restUrl and pluginUrl are mandatory.");var ae="".concat(T,"/meow-common/v1"),ie=React.createElement(k,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",href:"https://jordymeow.com"},"Jordy Meow"),", and a stellar team! 💕 Based in ",React.createElement("a",{target:"_blank",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",target:"_blank"},"Meow Apps")," and let's make magic happen! 🌴🙀")),ce=React.createElement(k,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.")),le=React.createElement(k,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/",target:"_blank"},"SEO Checklist & Optimization")),React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-faster-wordpress-optimize/",target:"_blank"},"Optimize your WordPress Speed")),React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-optimize-images-wordpress/",target:"_blank"},"Optimize Images (CDN, and so on)")),React.createElement("li",null,"⭐️ ",React.createElement("a",{href:"https://meowapps.com/tutorial-hosting-service-wordpress/",target:"_blank"},"The Best Hosting Services for WordPress"))))),ue=function(){var e=te(Z().mark((function e(){var t;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(ae,"/all_settings/"),{method:"POST",nonce:N});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)}}(),se=function(){var e=te(Z().mark((function e(t){var n,r,o;return Z().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(ae,"/update_option"),{method:"POST",nonce:N,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)}}(),fe=function(){var e=te(Z().mark((function e(){var t;return Z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(ae,"/error_logs"),{method:"POST",nonce:N});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)}}(),pe=function(){var e=(0,u.jE)(),t=Q(re(!1),2),n=t[0],r=t[1],o=Q(re(!1),2),a=o[0],i=(o[1],Q(re(""),2)),c=i[0],l=i[1],s=(0,f.I)({queryKey:["all_settings"],queryFn:ue}),R=s.data,T=s.error,O=(s.isLoading,(0,p.n)({mutationFn:se,onSuccess:function(){e.invalidateQueries(["all_settings"])}}).mutate),x=(0,p.n)({mutationFn:fe}),N=x.mutate,P=x.data,_=void 0===P?[]:P,I=null==R?void 0:R.meowapps_hide_meowapps,L=null==R?void 0:R.force_sslverify;oe((function(){T&&!n&&(r(!0),console.error("Error from useQuery",T.message))}),[T]),oe((function(){var e=document.getElementById("meow-common-phpinfo");l(e.innerHTML)}),[]);var A=function(e,t){O({value:e,id:t})},M=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:a,checked:I,onChange:A}))),F=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:a,checked:L,onChange:A})));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"},ie,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(C,{title:"AI Engine",className:"primary"},React.createElement(j,{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/"},"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/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/ai-engine/"},"Meow Apps"))))),React.createElement(C,{title:"Media Cleaner",className:"primary"},React.createElement(j,{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/"},"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/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/media-cleaner/"},"Meow Apps"))))),React.createElement(C,{title:"Database Cleaner",className:"primary"},React.createElement(j,{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/"},"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/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/database-cleaner/"},"Meow Apps"))))),React.createElement(C,{title:"Media File Renamer",className:"primary"},React.createElement(j,{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/"},"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/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/media-file-renamer/"},"Meow Apps"))))),React.createElement(C,{title:"Social Engine",className:"primary"},React.createElement(j,{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/"},"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/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/social-engine/"},"Meow Apps"))))),React.createElement(C,{title:"Meow Analytics",className:"primary"},React.createElement(j,{src:"https://ps.w.org/meow-analytics/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{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",{target:"_blank",href:"https://wordpress.org/plugins/meow-analytics/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/meow-analytics/"},"Meow Apps")))))),React.createElement(E.Y,{minimal:!0},React.createElement(C,{title:"Contact Form Block",className:"primary"},React.createElement(j,{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/"},"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",{target:"_blank",href:"https://wordpress.org/plugins/seo-engine/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/seo-engine/"},"Meow Apps"))))),React.createElement(C,{title:"Meow Gallery",className:"primary"},React.createElement(j,{src:"https://ps.w.org/meow-gallery/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{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",{target:"_blank",href:"https://wordpress.org/plugins/meow-gallery/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/meow-gallery/"},"Meow Apps"))))),React.createElement(C,{title:"Meow Lightbox",className:"primary"},React.createElement(j,{src:"https://ps.w.org/meow-lightbox/assets/icon-256x256.gif"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{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",{target:"_blank",href:"https://wordpress.org/plugins/meow-lightbox/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/meow-lightbox/"},"Meow Apps"))))),React.createElement(C,{title:"Perfect Images (Retina)",className:"primary"},React.createElement(j,{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",{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",{target:"_blank",href:"https://wordpress.org/plugins/wp-retina-2x/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/wp-retina-2x/"},"Meow Apps"))))),React.createElement(C,{title:"Photo Engine",className:"primary"},React.createElement(j,{src:"https://ps.w.org/wplr-sync/assets/icon-256x256.png"}),React.createElement("div",{className:"plugin-desc"},React.createElement("h2",null,React.createElement("a",{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",{target:"_blank",href:"https://wordpress.org/plugins/wplr-sync/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/wplr-sync/"},"Meow Apps"))))),React.createElement(C,{title:"Contact Form Block",className:"primary"},React.createElement(j,{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",{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",{target:"_blank",href:"https://wordpress.org/plugins/contact-form-block/"},"WordPress.org")),React.createElement("div",null,"Pro Version: ",React.createElement("a",{target:"_blank",href:"https://meowapps.com/contact-form-block/"},"Meow Apps")))))))),React.createElement(b.V,{title:"Performance"},ce,React.createElement("div",{style:{display:"flex",justifyContent:"space-around",marginBottom:25}},React.createElement(K,{title:"Empty Request Time",request:"empty_request",max:2500}),React.createElement(K,{title:"File Operation Time",request:"file_operation",max:2600}),React.createElement(K,{title:"SQL Request Time",request:"sql_request",max:2800})),le),React.createElement(b.V,{title:"PHP Info"},React.createElement(G,{dangerouslySetInnerHTML:{__html:c}})),React.createElement(b.V,{title:"PHP Error Logs"},React.createElement(k,null,React.createElement(w.M,{style:{marginBottom:10},color:"#ccb027",onClick:function(){N()},disabled:a,isBusy:"isLoadingErrorLogs"===a},"Load PHP Error Logs"),React.createElement(D,null,_.map((function(e){return React.createElement("li",{class:"log-".concat(e.type)},React.createElement("span",{class:"log-type"},e.type),React.createElement("span",{class:"log-date"},e.date),React.createElement("span",{class:"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"},M,F))))))},he=wp.i18n.__,de={},me="code-engine";de.PENDING=he("Pending",me),de.RENAME=he("Rename",me),de.TITLE=he("Title",me),de.ERROR={SNIPPET_FATAL:he("⚠️ A fatal error occured while running the snippet ",me),SNIPPET_DISABLED:he("This snippet has been disabled. This message will disappear automatically when you refresh the page.",me),UPDATING_OPTIONS:he("An error occured while updating the options.",me),GETTING_OPTIONS:he("An error occured while getting the options.",me),CHECK_YOUR_CONSOLE:he('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>.',me)},de.ALERTS={ARE_YOU_SURE:he("Are you sure?",me)},de.COMMON={YES:he("Yes",me),NO:he("No",me),OK:he("OK",me),CANCEL:he("Cancel",me),CLEAR:he("Clear",me),CLOSE:he("Close",me),SAVE:he("Save",me),SAVE_AND_CLOSE:he("Save & Close",me),UPDATE:he("Update",me),RESET:he("Reset",me),REFRESH:he("Refresh",me),LOADING:he("Loading...",me),RESET_SETTINGS:he("Reset Settings",me),REFRESH_SETTINGS:he("Refresh Settings",me),DELETE:he("Delete",me),CLONE:he("Clone",me),NO_RESULTS:he("There aren't any snippets yet.",me),ADD:he("Add",me),UPLOAD:he("Upload",me),UPLOADING:he("Uploading...",me),EDIT:he("Edit",me),RENAME:he("Rename",me),MAINTENANCE:he("Maintenance",me),SEARCH:he("Search",me),SELECT:he("Select",me),SELECT_ALL:he("Select All",me),UNSELECT_ALL:he("Unselect All",me),ENABLE:he("Enable",me),ENABLE_RECOMMENDED:he("Enable (Recommended)",me),ENABLE_NOT_RECOMMENDED:he("Enable (Not Recommended)",me),DISABLE:he("Disable",me),DASHBOARD:he("Dashboard",me),SETTINGS:he("Settings",me),REFRESH_LOGS:he("Refresh Logs",me),CLEAR_LOGS:he("Clear Logs",me),LOGS:he("Logs",me),HIDE:he("Hide",me),DATA_NOT_AVAILABLE:he("Data not available",me)},de.SETTINGS={TITLE:he("Settings",me),HEADER_TITLE:he("Code Engine | Settings",me),IMPORT_SETTINGS:he("Import Settings & Snippets",me),EXPORT_SETTINGS:he("Export Settings & Snippets",me),SHOW_TUTORIAL:he("Show Tutorial",me),QUICK_START:he("Quick Start",me),QUICK_START_INFO:he("Describe what you are trying to achieve, and Code Engine will generate the code and set up all the parameters for you.",me),QUICK_START_PLACEHOLDER:he("A PHP function that takes a message and send it to an email...",me),AI_PARAMETERS:{TITLE:he("AI Parameters",me),AI_ENGINE_INSTALLED:he("AI Engine",me),AI_ENGINE_REQUIRED:he("AI Engine",me),DOWNLOAD_AI_ENGINE:he("Download AI Engine",me),AI_SUGGESTIONS:he("AI Suggestions",me),AI_SUGGESTIONS_DESCRIPTION:he(" Will add a panel of AI features above the code editor.",me)},DEVELOPERS:{TITLE:he("For Developers",me),SANITIZE_ARGS:he("Sanitize Arguments",me),SANITIZE_ARGS_DESCRIPTION:he("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.",me),LOGS:he("Logs",me),LOGS_DESCRIPTION:he("Enable the server logs for debugging purposes.",me),DATABASE_INSPECTION:he("Database Inspection",me),DATABASE_INSPECTION_DESCRIPTION:he("This will add a new tab in the settings to inspect the plugin's options directly from the databse.",me),BYPASS_SECURITY:he("Bypass REST Security",me),BYPASS_SECURITY_DESCRIPTION:he("Disables REST API security checks. Better to use filters mwcode_rest_whitelist or mwcode_rest_authorized for specific routes.",me),MCP_SUPPORT:he("MCP Support",me),MCP_SUPPORT_DESCRIPTION:he("The internal API of Code Engine will be registered to the MCP server implemented by AI Engine.",me),RAW_EDIT:he("Raw Edit",me)},PREFERENCES:{TITLE:he("Preferences",me),PUBLIC_API:he("Public API",me),SNIPPET_ENDPOINT:he("Snippet Endpoint",me),SNIPPET_ENDPOINT_DESCRIPTION:he("This will let you choose for each snippet an endpoint to call it from the outside.",me),CODE_PREVIEW:he("Code Preview",me),CODE_PREVIEW_DESCRIPTION:he("Display code preview inside the snippets table.",me)},SNIPPETS:he("Snippets",me),SNIPPETS_TABLE_COLUMNS:{SNIPPET:he("Snippet",me),ATTRIBUTES:he("Attributes",me),TYPE:he("Type",me),ACTIVE:he("Active",me),ACTIONS:he("Actions",me),FUNCTION:he("Function",me)},SNIPPET:{PUBLIC_API:he("Public API",me),TOKEN:he("Bearer Token",me),METHOD:he("Method",me),LABEL:he("Snippet",me),TURN_ON:he("On",me),TURN_OFF:he("Off",me),RUN:he("Run",me),CODE:he("Code",me),NAME:he("Name",me),TEST:he("Test",me),BEHAVIOR:he("Behavior",me),TARGET:he("Target",me),BEHAVIOR_DYNAMIC:he("Allows functions to feedback into the AI for ongoing interactions.",me),BEHAVIOR_STATIC:he("Executes tasks independently, suitable for single, definitive actions.",me),DESCRIPTION:he("Description",me),MISSING_TYPE_WARNING:he("Types are missing for the arguments. Add a type to each one to avoid errors.",me),DEFAULT_VALUE:he("Default Value",me),TAGS:he("Tags",me),TAGS_DESCRIPTION:he("Tags separated by commas.",me),HOURS:he("Hours",me),MINUTES:he("Minutes",me),PRIORITY:he("Priority",me),TIMEFRAME:he("Timeframe",me),TARGET_TIME:he("Target Time",me),TYPE:he("Type",me),READ_COMMENTS:he("Query AI (Via Comments)",me),MODIFY_BEFORE_USE:he("Modify before use",me),ENDPOINT:he("Endpoint Slug",me),ENDPOINT_URL:he("The endpoint will be <strong>{0}</strong>",me),PUBLIC_API_DESCRIPTION:he("This feature is in beta. It allows calling this function via the REST API",me),SCOPES:{ALL:he("All",me),GLOBAL_FRONTEND_BACKEND:he("Global (All)",me),GLOBAL_FRONTEND:he("Global (Front)",me),GLOBAL_BACKEND:he("Global (Back)",me),CONTENT_PHP:he("Content (PHP)",me),CONTENT_JS:he("Content (JS)",me),FRONTEND:he("Front",me),BACKEND:he("Back",me),PERSISTENT:he("Global",me),FUNCTION:he("Callable",me),SCHEDULED:he("Scheduled",me)},SELECT_SNIPPET:he("Select a snippet on the left, or click the + button if you want new one.",me),SELECT_ALL_TAGS:he("Select all tags",me),IMPORT_CODE_SNIPPETS:he("Import All Snippets from Code Snippets",me),TEST_PARAMETERS_DESCRIPTION_LOG:he("• Use the <strong>echo (PHP)</strong> or <strong>console.log() (JS)</strong> functions to print anything in the console above.",me),TEST_PARAMETERS_DESCRIPTION_ARG:he("• You can change the default value of the function paramaters in the <strong>Function</strong> tab.",me)},STRING_VALUE_WARNING:he("This value appears to be a string. Ensure to have quotes around it.",me),ADD_QOUTES:he("Add Quotes",me),EDITOR:he("Editor",me),SIDEBAR_EDITOR:he("Sidebar Editor",me),SUCCESSFULLY_RAN:he("Snippet successfully ran: {0}",me)};const ye=de;var ve=n(9794);function ge(e){return ge="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},ge(e)}function Ee(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 be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ee(Object(n),!0).forEach((function(t){we(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function we(e,t,n){return(t=function(e){var t=function(e){if("object"!=ge(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ge(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ge(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Se(){Se=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"==ge(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 P(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 _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,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(ge(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(_),!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),_(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;_(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 Re(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 Te(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Re(a,r,o,i,c,"next",e)}function c(e){Re(a,r,o,i,c,"throw",e)}i(void 0)}))}}var Oe=function(){var e=Te(Se().mark((function e(){var t;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,R.IU)("".concat(O,"/get_logs"),{nonce:N,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=Te(Se().mark((function e(){return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,R.IU)("".concat(O,"/clear_logs"),{nonce:N});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)}}(),Ne=function(){var e=Te(Se().mark((function e(){var t;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/settings/list"),{method:"GET",nonce:N});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)}}(),Pe=function(){var e=Te(Se().mark((function e(t){var n;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/settings/update"),{method:"POST",nonce:N,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)}}(),_e=function(){var e=Te(Se().mark((function e(){var t;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/settings/reset"),{method:"POST",nonce:N});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)}}(),Ie=function(){var e=Te(Se().mark((function e(t){var n,r,o,a,i,c,l,u,s;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t(!0),n=new Date,e.next=5,Ne();case 5:return r=e.sent,e.next=8,je({});case 8:return o=e.sent.snippets,e.next=11,Ge();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)}}(),Le=function(){var e=Te(Se().mark((function e(t){var n;return Se().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=Te(Se().mark((function e(n){var r,o;return Se().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=Te(Se().mark((function e(t){var n,r,o,a;return Se().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,Pe({options:r});case 5:return console.log("Settings updated."),console.log("Updating snippets...",o),e.next=9,Fe(o);case 9:return console.log("Snippets updated."),console.log("Updating functions...",a),e.next=13,De(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)}}(),Ae=function(){var e=Te(Se().mark((function e(){var t;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/settings/functions/raw"),{method:"GET",nonce:N});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)}}(),ke=function(){var e=Te(Se().mark((function e(t){var n;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/settings/functions/raw"),{method:"POST",nonce:N,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)}}(),Ce=!0,je=function(){var e=Te(Se().mark((function e(t){var n;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ce=!0,e.next=3,(0,R.IU)("".concat(O,"/snippets/list"),{method:"POST",nonce:N,json:t});case 3:if(n=e.sent,Ce=!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)}}(),Ge=function(){var e=Te(Se().mark((function e(){var t;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/settings/functions"),{method:"GET",nonce:N});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)}}(),De=function(){var e=Te(Se().mark((function e(t){var n;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/settings/functions/replace"),{method:"POST",nonce:N,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)}}(),Me=function(){var e=Te(Se().mark((function e(){var t;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/snippets/tags"),{method:"POST",nonce:N});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)}}(),Fe=function(){var e=Te(Se().mark((function e(t){var n;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/snippets/replace"),{method:"POST",nonce:N,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)}}(),Ue=function(){var e=Te(Se().mark((function e(){var t;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/snippets/import"),{method:"GET",nonce:N});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)}}(),Be=function(){var e=Te(Se().mark((function e(){var t;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/snippets/stats"),{method:"GET",nonce:N});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)}}(),He=function(){var e=Te(Se().mark((function e(t){var n;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/snippets/add"),{method:"POST",nonce:N,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)}}(),Ve=function(){var e=Te(Se().mark((function e(t){var n;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/snippets/update"),{method:"POST",nonce:N,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)}}(),Ye=function(){var e=Te(Se().mark((function e(t){var n;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/snippets/delete"),{method:"POST",nonce:N,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)}}(),ze=function(){var e=Te(Se().mark((function e(t){var n;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/run/test"),{method:"POST",nonce:N,json:be(be({},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)}}(),We=function(){var e=Te(Se().mark((function e(t){var n;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/run/lint"),{method:"POST",nonce:N,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=Te(Se().mark((function e(t){var n;return Se().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/quick_start"),{method:"POST",nonce:N,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 $e(e){return $e="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},$e(e)}function Ke(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 Je(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ke(Object(n),!0).forEach((function(t){Qe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ke(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Qe(e,t,n){return(t=function(e){var t=function(e){if("object"!=$e(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=$e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==$e(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"==$e(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 P(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 _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,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($e(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(_),!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),_(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;_(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 Ze(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 et(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){Ze(a,r,o,i,c,"next",e)}function c(e){Ze(a,r,o,i,c,"throw",e)}i(void 0)}))}}function tt(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 nt(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)?nt(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 nt(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 rt=wp.element,ot=rt.useContext,at=rt.createContext,it=rt.useState,ct=at(),lt=function(e){var t=e.children,n=tt(it(P),2),r=n[0],o=n[1],a=tt(it({}),2),i=a[0],c=a[1],l=tt(it(null),2),u=l[0],s=l[1],f=tt(it(!1),2),p=f[0],h=f[1],d=function(e){console.error(ye.ERROR.GETTING_OPTIONS,null!=e&&e.message?{message:e.message}:{err:e}),e.message&&s(React.createElement(React.Fragment,null,React.createElement("div",null,ye.ERROR.GETTING_OPTIONS),React.createElement("small",null,(0,R.FE)(ye.ERROR.CHECK_YOUR_CONSOLE))))},m=function(){var e=et(Xe().mark((function e(){var t;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return h(!0),e.prev=1,e.next=4,Ne();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=et(Xe().mark((function e(t,n){var a,i;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=Je(Je({},r),{},Qe({},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,Pe({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=et(Xe().mark((function e(){var t;return Xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.confirm(ye.ALERTS.ARE_YOU_SURE)){e.next=2;break}return e.abrupt("return");case 2:return h(!0),e.prev=3,e.next=6,_e();case 6:t=e.sent,o(t),e.next=14;break;case 10:e.prev=10,e.t0=e.catch(3),console.error(ye.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,ye.ERROR.UPDATING_OPTIONS),React.createElement("small",null,(0,R.FE)(ye.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(ct.Provider,{value:{state:E,actions:g}},t,React.createElement(ve.n,{isOpen:u,title:ye.COMMON.ERROR,content:u,ok:ye.COMMON.CLOSE,onRequestClose:function(){return s(!1)},onOkClick:function(){return s(!1)}}))},ut=function(){var e=ot(ct);if(!e)throw new Error("useCoreContext must be used within a CoreContextProvider");return e},st=n(7213),ft=n(4391),pt=n(8482),ht=n(520),dt=n(8700),mt=n(7494),yt=n(1843),vt=n(6734),gt=n(2557),Et=n(3896),bt=n(7571);function wt(e){return wt="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},wt(e)}function St(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 Rt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?St(Object(n),!0).forEach((function(t){Tt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):St(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"!=wt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=wt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==wt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ot=function(e,t){var n=Rt({},e),r=Rt({},t);return delete n.functionError,delete r.functionError,Object.keys(n).sort(),Object.keys(r).sort(),JSON.stringify(n)!==JSON.stringify(r)},xt=[{value:"all",label:ye.SETTINGS.SNIPPET.SCOPES.ALL,color:"var(--neko-grey)",select_hidden:!0},{value:"global",label:ye.SETTINGS.SNIPPET.SCOPES.PERSISTENT,color:"var(--neko-purple)",childScopes:["frontend","backend","persistent"]},{value:"function",label:ye.SETTINGS.SNIPPET.SCOPES.FUNCTION,color:"var(--neko-green)"},{value:"scheduled",label:ye.SETTINGS.SNIPPET.SCOPES.SCHEDULED,color:"var(--neko-orange)"},{value:"disabled",label:ye.SETTINGS.SNIPPET.TURN_OFF,select_hidden:!0},{value:"content_js",label:ye.SETTINGS.SNIPPET.SCOPES.CONTENT_JS,color:"var(--neko-blue)"},{value:"content_php",label:ye.SETTINGS.SNIPPET.SCOPES.CONTENT_PHP,color:"var(--neko-blue)"}],Nt=[{value:"persistent",label:ye.SETTINGS.SNIPPET.SCOPES.GLOBAL_FRONTEND_BACKEND},{value:"frontend",label:ye.SETTINGS.SNIPPET.SCOPES.GLOBAL_FRONTEND},{value:"backend",label:ye.SETTINGS.SNIPPET.SCOPES.GLOBAL_BACKEND},{value:"function",label:ye.SETTINGS.SNIPPET.SCOPES.FUNCTION},{value:"scheduled",label:ye.SETTINGS.SNIPPET.SCOPES.SCHEDULED},{value:"content_php",label:ye.SETTINGS.SNIPPET.SCOPES.CONTENT_PHP},{value:"content_js",label:ye.SETTINGS.SNIPPET.SCOPES.CONTENT_JS}],Pt={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"},_t={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()},It=[{accessor:"status",width:"40px"},{accessor:"snippet",title:ye.SETTINGS.SNIPPETS_TABLE_COLUMNS.SNIPPET,sortable:!1,filters:{type:"checkbox"}},{accessor:"functionName",title:ye.SETTINGS.SNIPPETS_TABLE_COLUMNS.FUNCTION,sortable:!0,width:"15%"},{accessor:"endpoint",title:ye.SETTINGS.SNIPPETS_TABLE_COLUMNS.ENDPOINT,sortable:!1,width:"15%"},{accessor:"attributes",title:ye.SETTINGS.SNIPPETS_TABLE_COLUMNS.TYPE,sortable:!1,width:"94px"},{accessor:"actions",title:ye.SETTINGS.SNIPPETS_TABLE_COLUMNS.ACTIONS,sortable:!1,width:"10%"},{accessor:"enabled",width:"40px"}],Lt=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"})))),At=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 kt(e){return kt="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},kt(e)}function Ct(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 jt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ct(Object(n),!0).forEach((function(t){Gt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ct(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Gt(e,t,n){return(t=function(e){var t=function(e){if("object"!=kt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=kt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==kt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dt(){Dt=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"==kt(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 P(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 _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,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(kt(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(_),!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),_(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;_(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 Mt(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 Ft(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 Ut(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)?Ut(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 Ut(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 Bt,Ht=wp.element,Vt=Ht.useState,Yt=Ht.useMemo,zt=function(e){var t=e.onCreated,n=e.onUpdated,r=e.onDeleted,o=e.onTestedSnippet,a=(e.onRanSnippet,e.onError),i=Ft(Vt(null),2),c=i[0],l=i[1],s=Ft(Vt(!1),2),f=s[0],h=s[1],d=Ft(Vt({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,bt.E)({queries:[{queryKey:g,queryFn:Me},{queryKey:v,queryFn:function(){return je(m)}},{queryKey:E,queryFn:Be}]}),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,P=void 0===N?0:N,_=(w[2].data||{}).stats,I=void 0===_?{}:_,L=function(){var e,t=(e=Dt().mark((function e(){return Dt().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){Mt(a,r,o,i,c,"next",e)}function c(e){Mt(a,r,o,i,c,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),A=(0,p.n)({mutationFn:He,onSuccess:function(e){L(),l(e.snippet),null==t||t()},onError:function(e){return a(e.message)}}),k=(0,p.n)({mutationFn:Ve,onSuccess:function(){L(),null==n||n()},onError:function(e){return a(e.message)}}),C=(0,p.n)({mutationFn:Ye,onSuccess:function(){L(),l(null),null==r||r()}}),j=(0,p.n)({mutationFn:ze,onSuccess:function(e){var t=e.result;return o(t)},onError:function(e){return a(e.message)}}),G=(0,p.n)({mutationFn:Ue,onSuccess:function(){L(),null==t||t()},onError:function(e){return a(e.message)}}),D=A.isLoading||k.isLoading||C.isLoading||G.isLoading||j.isLoading||f||Ce,M=Yt((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=Ot(t,c);return n||console.log("Snippet is not savable: no changes detected. Snippet:",t,"Edit Snippet:",c),n}),[x,c]),F=Yt((function(){if(!c)return!1;if(null===(null==c?void 0:c.id))return Ot(_t,c);var e=x.find((function(e){return e.id===c.id}));return Ot(e,c)}),[x,c]);return{isProcessing:D,snippets:x,total:P,tags:R,stats:I,onImportCodeSnippets:G.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:_t)},onDuplicate:function(e){return A.mutate(jt(jt({},e),{},{id:null,endpoint:""}))},onRunTestOnFunctionSnippet:j.mutate,onRefresh:function(){return L()},tableFilters:m,setTableFilters:y,editSnippet:c,setEditSnippet:l,isSavable:M,isResetable:F}},Wt=n(8696),qt=n(309),$t=n(8668),Kt=n(1594),Jt=n(4783),Qt=n(106),Xt=n(3720),Zt=n(7967),en=n(1419),tn=n(1638),nn=n(6898),rn=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 an(){an=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"==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 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 P(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 _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,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(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}},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(_),!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),_(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;_(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 cn(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){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){cn(a,r,o,i,c,"next",e)}function c(e){cn(a,r,o,i,c,"throw",e)}i(void 0)}))}}function un(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)||sn(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 sn(e,t){if(e){if("string"==typeof e)return fn(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)?fn(e,t):void 0}}function fn(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 pn,hn,dn=(0,Qt.a)({theme:"light",settings:{background:"#ffffff",foreground:"#75baff",caret:"#5d00ff",selection:"#036dd626",lineHighlight:"#8a91991a",gutterBackground:"#fff",gutterForeground:"#8a919966"},styles:[{tag:Xt._A.comment,color:"#787b8099"},{tag:Xt._A.variableName,color:"#0080ff"},{tag:Xt._A.function(Xt._A.variableName),color:"#daa520"},{tag:[Xt._A.string,Xt._A.special(Xt._A.brace)],color:"#ff4500"},{tag:Xt._A.number,color:"#2e8b57"},{tag:Xt._A.bool,color:"#8b0000"},{tag:Xt._A.null,color:"#8b008b"},{tag:Xt._A.keyword,color:"#00008b"},{tag:Xt._A.operator,color:"#daa520"},{tag:Xt._A.className,color:"#8a2be2"},{tag:Xt._A.definition(Xt._A.typeName),color:"#5f9ea0"},{tag:Xt._A.typeName,color:"#b22222"},{tag:Xt._A.angleBracket,color:"#556b2f"},{tag:Xt._A.tagName,color:"#ff8c00"},{tag:Xt._A.attributeName,color:"#6b8e23"},{tag:Xt._A.comment,color:"#787b8099"}]}),mn=L.Ay.div(Bt||(pn=["\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"],hn||(hn=pn.slice(0)),Bt=Object.freeze(Object.defineProperties(pn,{raw:{value:Object.freeze(hn)}})))),yn=function(e){var t=e.code,n=e.snippet,r=e.setCode,o=e.setFunctionError,a=void 0===o?null:o,i=(e.isModal,un((0,Kt.useState)(t||""),2)),c=i[0],l=i[1],u=un((0,Kt.useState)(!1),2),s=u[0],f=u[1],p=un((0,Kt.useState)(""),2),h=p[0],d=p[1],m=un((0,Kt.useState)([]),2),y=m[0],v=m[1],g=(0,Kt.useRef)(null);(0,Kt.useEffect)((function(){n&&n.externalCode&&n.externalCode!==c&&l(n.externalCode)}),[n]);var E=(0,Kt.useCallback)(function(){var e=ln(an().mark((function e(t){var r,o,i,c,l;return an().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,We({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,Kt.useCallback)((function(e,t){"string"==typeof e&&(l(e),r(e))}),[r]),w=(0,Kt.useMemo)((function(){var e,t=tn.Pe.define(),n=tn.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=sn(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,en.bu)((function(e){return e.state.field(n)}));return[(0,Zt.Q2)(),n,r,nn.w4.of([rn.Yc]),nn.Lz.lineWrapping,nn.Lz.updateListener.of((function(e){e.docChanged&&(g.current=e.view)})),nn.Lz.domEventHandlers({blur:(e=ln(an().mark((function e(n,r){var o;return an().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(mn,null,React.createElement(Jt.Ay,{value:c,onChange:b,onKeyDown:function(e){9===e.keyCode&&e.preventDefault()},theme:dn,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 vn(e){return vn="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},vn(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 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"==vn(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 P(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 _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,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(vn(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(_),!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),_(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;_(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 En(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 bn(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 wn=wp.element.useState,Sn="".concat(x,"/images/wand.png"),Rn=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 bn(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)?bn(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.")}()}(wn(!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(O,"/ai_read_comments"),{method:"POST",json:{code:t},nonce:N});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){En(a,r,o,i,c,"next",e)}function c(e){En(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:Sn,style:{width:"20px",height:"20px",marginRight:"5px"}}),ye.SETTINGS.SNIPPET.READ_COMMENTS)};function Tn(e){return Tn="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},Tn(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 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"==Tn(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 P(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 _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,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(Tn(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(_),!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),_(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;_(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 xn(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 Nn(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 Pn(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)?Pn(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 Pn(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 _n=wp.element.useState,In=("".concat(x,"/images/wand.png"),function(e){var t=e.setCode,n=e.close,r=e.snippet,o=Nn(_n(!1),2),a=o[0],i=o[1],c=Nn(_n(""),2),l=c[0],u=c[1],s=Nn(_n(""),2),f=s[0],p=s[1],h=Nn(_n(!1),2),d=h[0],m=h[1],y=Nn(_n(!1),2),v=y[0],g=y[1],E=function(){var e,t=(e=On().mark((function e(t){var n;return On().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i(!0),e.next=3,(0,R.IU)("".concat(O,"/ai_query"),{method:"POST",json:{code:t,query:l},nonce:N});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){xn(a,r,o,i,c,"next",e)}function c(e){xn(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(Et.m,{value:l,onChange:function(e){return u(e)},disabled:a,rows:2}),React.createElement(vt.g,{tiny:!0}),React.createElement("div",{style:{display:"flex"}},React.createElement(w.M,{style:{flex:1},className:"secondary",onClick:n},ye.COMMON.CANCEL),React.createElement(w.M,{style:{flex:4},className:"primary",isBusy:a,onClick:function(){return E(r.code)}},ye.SETTINGS.SNIPPET.RUN)),React.createElement(ve.n,{isOpen:d,title:ye.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(st.X,{variant:"danger"},"⚠️ It looks like there is an error in your code."),React.createElement(yn,{snippet:r,code:f,setFunctionError:function(e){g(e)},setCode:function(e){return p(e)}})),onRequestClose:function(){return m(!1)},okButton:{label:ye.COMMON.SAVE,disabled:v,onClick:function(){t(f),m(!1),n()}},cancelButton:{label:ye.COMMON.CANCEL,onClick:function(){return m(!1)}}}))});function Ln(e){return Ln="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},Ln(e)}function An(){An=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"==Ln(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 P(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 _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,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(Ln(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(_),!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),_(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;_(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 kn(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,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,Gn=wp.element,Dn=Gn.useState,Mn=Gn.useEffect,Fn=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 Cn(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)?Cn(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.")}()}(Dn("..."),2),t=e[0],n=e[1];Mn((function(){r()}),[]);var r=function(){var e,t=(e=An().mark((function e(){var t;return An().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.IU)("".concat(O,"/server_clock"),{method:"GET",nonce:N});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){kn(a,r,o,i,c,"next",e)}function c(e){kn(a,r,o,i,c,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}();return React.createElement("b",null,t)},Un=n(9985),Bn=n(4756);function Hn(e){return Hn="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},Hn(e)}function Vn(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 Yn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vn(Object(n),!0).forEach((function(t){zn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function zn(e,t,n){return(t=function(e){var t=function(e){if("object"!=Hn(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Hn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Hn(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wn(){Wn=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"==Hn(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 P(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 _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,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(Hn(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(_),!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),_(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;_(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 $n(e){return function(e){if(Array.isArray(e))return Qn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Jn(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 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)||Jn(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 Jn(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}}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 Xn,Zn,er,tr=wp.element,nr=tr.useState,rr=tr.useEffect,or="".concat(x,"/images/wand.png"),ar=(0,L.Ay)(Un.A)(jn||(jn=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"]))),ir=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=zt({onRanSnippet:function(e){return console.log((0,R.g7)(ye.SETTINGS.SUCCESSFULLY_RAN,e))},onTestedSnippet:function(e){return V(e)},onError:N}),g=v.onRunTestOnFunctionSnippet,E=v.isProcessing,T=Kn(nr(!1),2),x=T[0],N=T[1],P=Kn(nr([]),2),I=P[0],L=P[1],A=Kn(nr(null),2),k=A[0],C=A[1],j=Kn(nr(!1),2),G=j[0],D=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($n(I),[{message:"["+t+"] "+e.error,color:"#ffce44"}]));else{var n=e.return.map((function(e){return{message:"["+t+"] "+e,color:"#00ff51"}}));L([].concat($n(I),$n(n)))}},Y=ut().actions.getOption,z=function(){var e,t=(e=Wn().mark((function e(t){return Wn().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)}}();rr((function(){if(M&&null!=m&&m.code){if("js"===(null==m?void 0:m.functionTarget))return;null!=m&&m.functionTarget||y((function(e){return Yn(Yn({},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 N("Invalid PHP Function."),void y((function(e){return Yn(Yn({},e),{},{functionNotValid:!0,functionArgs:[],name:""})}));var n=Kn(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 N("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 Yn(Yn({},e),{},{functionNotValid:!0,functionArgs:[],name:""})}));y((function(e){return Yn(Yn({},e),{},{functionName:r,functionNotValid:!1,functionArgs:a,name:(null==m?void 0:m.name)||r})})),N(!1)}}),[null==m?void 0:m.code,M,null==m?void 0:m.functionTarget]),rr((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=Kn(t,5);_=o[0],_=o[1],n=o[2],r=o[3],o[4]}else{var a=Kn(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 Yn(Yn({},e),{},{functionName:n,functionNotValid:!1,functionArgs:r?r.split(",").map((function(e){return e.trim()})):[],name:(null==m?void 0:m.name)||n})})),N(!1)}else N("Invalid JavaScript Function. Ensure the function is the only code present."),y((function(e){return Yn(Yn({},e),{},{functionNotValid:!0,functionArgs:[],name:""})}))}}),[null==m?void 0:m.code,M,null==m?void 0:m.functionTarget]),rr((function(){M&&y((function(e){return Yn(Yn({},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]),rr((function(){U&&(null==m?void 0:m.intervalTime)<=0&&y((function(e){return Yn(Yn({},e),{},{intervalTime:1})}))}),[null==m?void 0:m.intervalTime,U]);var W,q,$,K=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return React.createElement(d.d,{title:e,style:Yn({flexDirection:"column"},n)},React.createElement(vt.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(st.X,{variant:"warning"},ye.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(Yn(Yn({},m),{},{functionArgsDict:Yn(Yn({},m.functionArgsDict),{},zn({},t,Yn(Yn({},m.functionArgsDict[t]),{},zn({},n,'"'.concat(null===(e=m.functionArgsDict[t])||void 0===e?void 0:e[n],'"')))))}))}}," ",ye.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&&x&&React.createElement(st.X,{variant:"danger"},"⚠️ ",x),React.createElement(yn,{isModal:!l,code:null==m?void 0:m.code,snippet:m,setCode:function(e){y(Yn(Yn({},m),{},{code:e}))},setFunctionError:function(e){y(Yn(Yn({},m),{},{functionError:e}))}})),Y("ai_suggestions",!1)&&React.createElement("div",{style:{flex:1}},G&&React.createElement(S.z,{style:{marginTop:15}},React.createElement(In,{snippet:m,close:function(){return D(!1)},setCode:function(e){y(Yn(Yn({},m),{},{externalCode:e}))}})),!G&&React.createElement(mt.V,{style:{display:"flex",marginTop:15}},React.createElement(w.M,{className:"primary",disabled:s,onClick:function(){return D(!G)}},React.createElement("img",{src:or,alt:"Wand",style:{width:"20px",height:"20px",marginRight:"5px"}}),"Query AI"),React.createElement(Rn,{code:null==m?void 0:m.code,setCode:function(e){return y(Yn(Yn({},m),{},{externalCode:e}))}}))),React.createElement("div",{style:{flex:"1",minWidth:"300px",maxWidth:"100%",maxHeight:"100%"}},React.createElement(gt.A,{style:{flex:"1",minWidth:"300px",maxWidth:"100%",maxHeight:"800px",overflow:"auto"}},React.createElement(b._,{inversed:!0,keepTabOnReload:!0},React.createElement(b.V,{title:ye.SETTINGS.SNIPPET.LABEL,key:"snippet"},React.createElement(React.Fragment,null,K(ye.SETTINGS.SNIPPET.NAME,React.createElement(Wt.A,{name:"name",disabled:s,value:null==m?void 0:m.name,onBlur:function(e){return y(Yn(Yn({},m),{},{name:e}))}})),K(ye.SETTINGS.SNIPPET.DESCRIPTION,React.createElement(Wt.A,{name:"description",value:null==m?void 0:m.description,disabled:s,onBlur:function(e){return y(Yn(Yn({},m),{},{description:e}))}})),React.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px",marginBottom:10}},K(ye.SETTINGS.SNIPPET.TYPE,React.createElement(ft.u,{fullWidth:!0,name:"scope",scrolldown:!0,value:null==m?void 0:m.scope,disabled:s,onChange:function(e){return y(Yn(Yn({},m),{},{scope:e}))}},Nt.map((function(e){return React.createElement(ft.j,{key:e.value,id:e.value,value:e.value,label:e.label})}))),{marginTop:0,flex:"1 1 135px",minWidth:0}),M&&K(ye.SETTINGS.SNIPPET.TARGET,React.createElement(ft.u,{fullWidth:!0,name:"target",scrolldown:!0,value:null==m?void 0:m.functionTarget,onChange:function(e){return y(Yn(Yn({},m),{},{functionTarget:e}))}},React.createElement(ft.j,{id:"php",value:"php",label:"PHP (backend)"}),React.createElement(ft.j,{id:"js",value:"js",label:"JS (frontend)"})),{marginTop:0,flex:"1 1 135px",minWidth:0}),K(ye.SETTINGS.SNIPPET.PRIORITY,React.createElement(Wt.A,{name:"priority",type:"number",value:null==m?void 0:m.priority,disabled:s,onBlur:function(e){y(Yn(Yn({},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}},K(ye.SETTINGS.SNIPPET.TARGET_TIME,React.createElement(Wt.A,{name:"interval_hours",type:"number",value:null==m?void 0:m.intervalHours,disabled:s,max:23,min:0,onBlur:function(e){return y(Yn(Yn({},m),{},{intervalHours:e}))},description:ye.SETTINGS.SNIPPET.HOURS}),{marginTop:0,flex:1}),K(" ",React.createElement(Wt.A,{name:"interval_minutes",type:"number",value:null==m?void 0:m.intervalMinutes,disabled:s,max:59,min:0,onBlur:function(e){return y(Yn(Yn({},m),{},{intervalMinutes:e}))},description:ye.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(Fn,null),". "),React.createElement(vt.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}})),K(ye.SETTINGS.SNIPPET.TAGS,React.createElement(Wt.A,{isCommaSeparatedArray:!0,name:"tags",value:null==m?void 0:m.tags,disabled:s,onFinalChange:function(e){return y(Yn(Yn({},m),{},{tags:e}))},description:ye.SETTINGS.SNIPPET.TAGS_DESCRIPTION})),l&&React.createElement(w.M,{className:"primary",disabled:s||!f,style:{marginTop:"10px"},onClick:function(){return z(m)}},ye.COMMON.SAVE))),M&&React.createElement(b.V,{title:ye.SETTINGS.SNIPPET.SCOPES.FUNCTION,key:"function"},K(ye.SETTINGS.SNIPPET.NAME,React.createElement(Wt.A,{name:"name",disabled:!0,value:null==m?void 0:m.functionName,onChange:function(e){return y(Yn(Yn({},m),{},{functionName:e}))}})),K(ye.SETTINGS.SNIPPET.BEHAVIOR,React.createElement(ft.u,{fullWidth:!0,name:"behavior",scrolldown:!0,value:null==m?void 0:m.functionBehavior,description:ye.SETTINGS.SNIPPET[null!=m&&m.functionBehavior?"BEHAVIOR_".concat(m.functionBehavior.toUpperCase()):"BEHAVIOR_DYNAMIC"],onChange:function(e){return y(Yn(Yn({},m),{},{functionBehavior:e}))}},React.createElement(ft.j,{id:"dynamic",value:"dynamic",label:"Dynamic"}),React.createElement(ft.j,{id:"static",value:"static",label:"Static"}))),React.createElement($t.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($t.YQ,{key:e,title:e},(t=e,React.createElement(React.Fragment,null,K(ye.SETTINGS.SNIPPET.NAME,React.createElement(Wt.A,{disabled:!0,name:"name",value:t})),K(ye.SETTINGS.SNIPPET.TYPE,React.createElement(ft.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(Yn(Yn({},m),{},{functionArgsDict:Yn(Yn({},m.functionArgsDict),{},zn({},t,Yn(Yn({},m.functionArgsDict[t]),{},{type:e})))}))}},React.createElement(ft.j,{id:"string",value:"string",label:"String"}),React.createElement(ft.j,{id:"number",value:"number",label:"Number"}),React.createElement(ft.j,{id:"boolean",value:"boolean",label:"Boolean"}),React.createElement(ft.j,{id:"array",value:"array",label:"Array"}),React.createElement(ft.j,{id:"object",value:"object",label:"Object"}),React.createElement(ft.j,{id:"mixed",value:"mixed",label:"Mixed"}))),K(ye.SETTINGS.SNIPPET.DESCRIPTION,React.createElement(Wt.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(Yn(Yn({},m),{},{functionArgsDict:Yn(Yn({},m.functionArgsDict),{},zn({},t,Yn(Yn({},m.functionArgsDict[t]),{},{desc:e})))}))}})),K(ye.SETTINGS.SNIPPET.DEFAULT_VALUE,React.createElement(Wt.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(Yn(Yn({},m),{},{functionArgsDict:Yn(Yn({},m.functionArgsDict),{},zn({},t,Yn(Yn({},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(st.X,{variant:"info"},"No parameters in the function")),React.createElement(b.V,{title:ye.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,$n(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:Pt},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(vt.g,null),React.createElement(ft.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(ft.j,{key:e,id:e,value:e,label:e})}))),k&&React.createElement(React.Fragment,null,React.createElement(vt.g,{tiny:!0}),React.createElement(Wt.A,{name:"test_arg_value",value:X(),onChange:function(e){return y(Yn(Yn({},m),{},{functionArgsDict:Yn(Yn({},m.functionArgsDict),{},zn({},k,Yn(Yn({},m.functionArgsDict[k]),{},{input:e})))}))}}),!Y("sanitize_arguments",!0)&&J(X())&&React.createElement(React.Fragment,null,React.createElement(vt.g,null),Q({arg:k,key:"input"})))),React.createElement(React.Fragment,null,React.createElement(vt.g,null),React.createElement(st.X,{variant:"info"},(0,R.FE)(ye.SETTINGS.SNIPPET.TEST_PARAMETERS_DESCRIPTION_LOG),H&&React.createElement(React.Fragment,null,React.createElement("br",null),(0,R.FE)(ye.SETTINGS.SNIPPET.TEST_PARAMETERS_DESCRIPTION_ARG))))),Y("api_endpoint",!1)&&M&&!F&&React.createElement(b.V,{title:ye.SETTINGS.SNIPPET.PUBLIC_API,key:"public_api"},(W={},null!=m&&m.functionArgsDict&&Object.entries(m.functionArgsDict).forEach((function(e){var t=Kn(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)})),q=W,$=JSON.stringify(q,null,2),React.createElement(React.Fragment,null,React.createElement(st.X,{variant:"warning"},ye.SETTINGS.SNIPPET.PUBLIC_API_DESCRIPTION),React.createElement(vt.g,null),K(ye.SETTINGS.SNIPPET.ENDPOINT,React.createElement(Wt.A,{name:"endpoint",value:null==m?void 0:m.endpoint,onChange:function(e){return y(Yn(Yn({},m),{},{endpoint:e}))}})),React.createElement("div",null,!(null==m||!m.endpoint)&&React.createElement(h.s,{p:!0},(0,R.FE)((0,R.g7)(ye.SETTINGS.SNIPPET.ENDPOINT_URL,"".concat(O,"/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(vt.g,null),K(ye.SETTINGS.SNIPPET.METHOD,React.createElement(ft.u,{fullWidth:!0,name:"method",scrolldown:!0,value:null==m?void 0:m.method,onChange:function(e){return y(Yn(Yn({},m),{},{method:e}))}},React.createElement(ft.j,{id:"GET",value:"GET",label:"GET"}),React.createElement(ft.j,{id:"POST",value:"POST",label:"POST"}),React.createElement(ft.j,{id:"PUT",value:"PUT",label:"PUT"}),React.createElement(ft.j,{id:"DELETE",value:"DELETE",label:"DELETE"}))),React.createElement(vt.g,null),React.createElement($t.aD,null,React.createElement($t.YQ,{title:"Example (JS Fetch)"},React.createElement(ar,{language:"javascript",style:Bn.A},'fetch("'.concat(O,"/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($,")\n })\n .then(response => response.json())\n .then(data => console.log(data))\n .catch(error => console.error('Error:', error));"))),React.createElement(vt.g,null),React.createElement($t.YQ,{title:"Example (CURL)"},React.createElement(ar,{language:"bash",style:Bn.A},"curl -X ".concat(m.method,' "').concat(O,"/snippets-endpoint/").concat(m.endpoint,'" \\\n -H "Content-Type: application/json" \\\n -H "Authorization: Bearer YOUR_API_TOKEN" \\\n -d \'').concat(JSON.stringify(q),"'"))))))))))))},cr=n(1997),lr=n(7428);function ur(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var sr,fr=L.Ay.div(Xn||(Xn=ur(["\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"})),pr=(0,L.Ay)(Un.A)(Zn||(Zn=ur(["\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%)"})),hr=L.Ay.div(er||(er=ur(["\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%)"})),dr=function(e){var t=e.snippet,n=e.onEditClick,r=ut().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="js"===(null==t?void 0:t.functionTarget)?At:Lt,u="1"===t.active;return React.createElement(fr,{active:u},React.createElement("div",{className:"snippet-header"},React.createElement("div",{className:"snippet-info"},React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement(cr.f,{position:"top",text:null==t?void 0:t.functionName},React.createElement(hr,{active:u},l)),React.createElement("a",{onClick:u?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(pr,{language:"js"===(null==t?void 0:t.functionTarget)?"javascript":"php",style:Bn.A,wrapLines:!0,wrapLongLines:!0,active:u},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(st.X,{variant:"warning",style:{marginTop:5,padding:"8px 15px",opacity:u?1:.7}},"⚠️ ",ye.SETTINGS.SNIPPET.MISSING_TYPE_WARNING))))},mr=function(e){var t=e.scope,n=xt.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)},yr=function(e){var t,n=e.tags;return"string"==typeof n&&(n=n.split(",")),React.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:"3px"}},null===(t=n)||void 0===t?void 0:t.map((function(e,t){if(e)return React.createElement(vr,{key:t,label:e})})))},vr=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 gr(e){return gr="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},gr(e)}function Er(e){return function(e){if(Array.isArray(e))return wr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||br(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 br(e,t){if(e){if("string"==typeof e)return wr(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)?wr(e,t):void 0}}function wr(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 Sr(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 Rr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Sr(Object(n),!0).forEach((function(t){Tr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Tr(e,t,n){return(t=function(e){var t=function(e){if("object"!=gr(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=gr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==gr(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Or=wp.element,xr=Or.useState,Nr=Or.useMemo,Pr="".concat(x,"/images/callable.svg"),_r="".concat(x,"/images/global-back.svg"),Ir="".concat(x,"/images/global-front.svg"),Lr="".concat(x,"/images/global-front-back.svg"),Ar="".concat(x,"/images/scheduled.svg"),kr=L.Ay.span(sr||(sr=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"]))),Cr=function(e){var t=e.snippet,n=e.onClick,r="1"===t.active,o=t.scope,a=Lr,i={width:36,height:36,cursor:"pointer"};return"persistent"===o?a=Lr:"frontend"===o?a=Ir:"backend"===o?a=_r:"function"===o?a=Pr:"scheduled"===o?a=Ar:console.warn('Code Engine: The scope "'.concat(o,'" is not supported.')),r||(i=Rr(Rr({},i),{},{filter:"grayscale(100%)",opacity:.5})),React.createElement("img",{src:a,alt:o,style:i,onClick:n})},jr=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,s=e.onSave,f=e.onDelete,p=e.onDuplicate,h=e.setTableFilters,d=e.currentScope,m=i.sort,y=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)||br(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.")}()}(xr([{accessor:"snippet",value:[]}]),2),v=y[0],g=y[1],E=Nr((function(){return n?n.map((function(e){var t=e.endpoint&&e.method,n=t?React.createElement(React.Fragment,null,O,"/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(Cr,{snippet:e,onClick:function(){return l(e)}})),attributes:React.createElement("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"}},React.createElement(mr,{scope:e.scope}),t&&React.createElement(cr.f,{position:"top",text:e.method+" /"+e.endpoint},React.createElement("div",{style:{marginTop:3,cursor:"pointer"}},React.createElement(kr,null,"API")))),snippet:React.createElement(React.Fragment,null,React.createElement(dr,{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(yr,{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(kr,null,e.method)," ",React.createElement("small",null,n))),enabled:React.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"}},React.createElement(pt.S,{small:!0,onLabel:"",offLabel:"",onValue:"1",offValue:"0",width:"34px",style:{marginRight:2},checked:"1"===e.active,onChange:function(t){return s(Rr(Rr({},e),{},{active:t}))}}),React.createElement(w.M,{rounded:!0,icon:"trash",title:ye.COMMON.DELETE,className:"danger",style:{margin:2},onClick:function(){return f(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:ye.COMMON.EDIT,icon:"pencil",className:"primary",style:{margin:2},onClick:function(){return l(e)}}),React.createElement(w.M,{rounded:!0,icon:"duplicate",title:ye.COMMON.CLONE,className:"primary",style:{margin:2},onClick:function(){return p(e)}})),!c&&React.createElement(React.Fragment,null,React.createElement(w.M,{title:ye.COMMON.EDIT,className:"primary",style:{margin:2},onClick:function(){return l(e)}},ye.COMMON.EDIT),React.createElement(w.M,{title:ye.COMMON.CLONE,className:"primary",style:{margin:2},onClick:function(){return p(e)}},ye.COMMON.CLONE)))}})):[]}),[n,l,s,p,f]),b=Nr((function(){var e=[].concat(Er(a),["all"!==d&&"disabled"!==d?"scope":""]).filter(Boolean);return It.map((function(e){if("snippet"===e.accessor){var t=r.filter(Boolean).map((function(e){return{value:e,label:e}}));return Rr(Rr({},e),{},{filters:Rr(Rr({},e.filters),{},{options:t})})}return e})).filter((function(t){return!e.includes(t.accessor)}))}),[r,a,d]);return React.createElement(React.Fragment,null,React.createElement(gt.A,{busy:t},React.createElement(lr.o,{data:E,columns:b,selectedItems:[],sort:m,emptyMessage:t?ye.COMMON.LOADING:React.createElement(React.Fragment,null,React.createElement(vt.g,null),ye.COMMON.NO_RESULTS,React.createElement(vt.g,null),"all"===d&&React.createElement(w.M,{className:"secondary",onClick:u},ye.SETTINGS.SNIPPET.IMPORT_CODE_SNIPPETS),React.createElement(vt.g,null)),filters:v,onSortChange:function(e,t){h(Rr(Rr({},i),{},{sort:{accessor:e,by:t}}))},onFilterChange:function(e,t){g([].concat(Er(v.filter((function(t){return t.accessor!==e}))),[{accessor:e,value:t}])),h(Rr(Rr({},i),{},{page:1,filters:[].concat(Er(i.filters.filter((function(t){return t.accessor!==e}))),[{accessor:e,value:t}])}))}})))};function Gr(e){return Gr="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},Gr(e)}function Dr(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 Mr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Dr(Object(n),!0).forEach((function(t){Fr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dr(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"!=Gr(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Gr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Gr(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ur(){Ur=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"==Gr(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 P(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 _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,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(Gr(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(_),!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),_(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;_(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 Br(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 Hr(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)||Vr(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 Vr(e,t){if(e){if("string"==typeof e)return Yr(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)?Yr(e,t):void 0}}function Yr(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 zr=wp.element,Wr=zr.useState,qr=zr.useEffect,$r=zr.useMemo;const Kr=function(){var e,t=ut(),n=t.actions,r=t.state,o=(0,s.z)().colors,a=n.getOption,i=n.updateOption,c=n.setError,l=r.isLoading,u=zt({onRanSnippet:function(e){return L((0,R.g7)(ye.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,P=u.onRefresh,_=Hr(Wr(null),2),I=_[0],L=_[1],A=Hr(Wr(!1),2),k=A[0],C=A[1],j=Hr(Wr(!1),2),G=j[0],D=j[1],M=Hr(Wr(!1),2),F=M[0],U=M[1],B=Hr(Wr(""),2),H=B[0],V=B[1],Y=Hr(Wr(!1),2),z=Y[0],W=Y[1],q=Hr(Wr(["functionName"]),2),$=q[0],K=q[1],J=(null===(e=y.filters.find((function(e){return"scope"===e.accessor})))||void 0===e?void 0:e.value)||"all";qr((function(){var e=[];"function"!==J&&(e=["functionName","endpoint"]),"function"===J&&(e=["attributes"]),k&&(e=["attributes","enabled","functionName","endpoint"]),K(e)}),[k,J]);var Q=function(e){confirm(ye.ALERTS.ARE_YOU_SURE)&&T(e)},X=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_t;D(!k),b(e?t:null),e||(D(!1),b(null))},Z=function(){U(!F)},ee=function(){var e,t=(e=Ur().mark((function e(){var t,n;return Ur().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(_t))).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),D(!0),e.next=23;break;case 20:e.prev=20,e.t0=e.catch(0),c(e.t0);case 23:return e.prev=23,Z(),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){Br(a,r,o,i,c,"next",e)}function c(e){Br(a,r,o,i,c,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),te=function(e){L(null),X(!0,e)},ne=y.limit,re=y.page,oe=l||f,ae=React.createElement(React.Fragment,null,I&&React.createElement(st.X,{variant:"success",style:{marginBottom:"16px"}},I),React.createElement(ir,{busy:oe,isInline:!0,editSnippet:g,setEditSnippet:b,isSavable:S,onSave:O})),ie=React.createElement(st.X,{variant:"danger",style:{marginBottom:"16px"}},ye.ERROR.SNIPPET_FATAL,a("fatal_error",""),". ",ye.ERROR.SNIPPET_DISABLED),ce=$r((function(){return React.createElement(jr,{busy:oe,snippets:p,onEditSnippet:te,tableFilters:y,setTableFilters:v,onImportCodeSnippets:x,currentScope:J,useInlineEditor:k,tags:d,stats:m,toHide:$,onSave:O,onDelete:Q,onDuplicate:N})}),[p,oe,y,J,d,m,k,$]),le=$r((function(){return React.createElement("div",{style:{marginTop:"16px",display:"flex",alignItems:"center"}},!k&&React.createElement(ft.u,{style:{marginRight:"10px"},scrolldown:!0,value:ne,onChange:function(e){return v(Mr(Mr({},y),{},{limit:e,offset:0}))}},React.createElement(ft.j,{value:5,label:"5 items / page"}),React.createElement(ft.j,{value:10,label:"10 items / page"}),React.createElement(ft.j,{value:25,label:"25 items / page"}),React.createElement(ft.j,{value:50,label:"50 items / page"}),React.createElement(ft.j,{value:100,label:"100 items / page"})),React.createElement(pt.S,{onLabel:ye.SETTINGS.SIDEBAR_EDITOR,offLabel:ye.SETTINGS.SIDEBAR_EDITOR,width:130,onChange:C,checked:k,onBackgroundColor:o.green}),React.createElement("div",{style:{flex:"auto"}}),React.createElement(ht.Q,{currentPage:re,limit:ne,total:h,onClick:function(e){return v(Mr(Mr({},y),{},{page:e}))}}))}),[ne,re,h,k]),ue=React.createElement(dt.M,{hideText:ye.COMMON.HIDE,hide:a("hide_tutorial",!1),onHide:function(){confirm(ye.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)&&ie,ue,React.createElement(mt.V,null,React.createElement(w.M,{className:"primary",icon:"plus",onClick:function(){return X(!0)}},ye.COMMON.ADD),React.createElement(w.M,{className:"primary",color:"purple",icon:"wand",onClick:function(){return Z()}},ye.SETTINGS.QUICK_START),React.createElement(w.M,{isBusy:oe,className:"secondary",onClick:P},ye.COMMON.REFRESH),React.createElement("div",{style:{flex:"auto"}}),React.createElement(yt.o,{name:"mwcode_scope_filter",value:J,onChange:function(e){var t;xt.some((function(t){return t.value===e}))&&v(Mr(Mr({},y),{},{page:1,filters:[].concat((t=y.filters.filter((function(e){return"scope"!==e.accessor})),function(e){if(Array.isArray(e))return Yr(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||Vr(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}])}))}},xt.map((function(e){return React.createElement(yt.K,{key:e.value,value:e.value,title:e.label,count:null==m?void 0:m[e.value]})})))),React.createElement(vt.g,null),!k&&React.createElement(React.Fragment,null,ce,le),k&&React.createElement(React.Fragment,null,React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},ce,le),React.createElement(E.Y,{minimal:!0,style:{padding:"0 0 0 15px"}},k&&ae))),React.createElement(ve.n,{isOpen:F,title:ye.SETTINGS.QUICK_START,content:React.createElement(gt.A,{busy:z},React.createElement(st.X,{variant:"info",style:{marginBottom:"16px"}},ye.SETTINGS.QUICK_START_INFO),React.createElement(Et.m,{value:H,onBlur:V,placeholder:ye.SETTINGS.QUICK_START_PLACEHOLDER,style:{height:"200px"}})),onRequestClose:Z,okButton:{label:ye.COMMON.RUN,onClick:function(){ee()},disbled:z},cancelButton:{label:ye.COMMON.CANCEL,onClick:Z,disabled:z}}),React.createElement(ve.n,{isOpen:G,size:"full-size",title:ye.SETTINGS.EDITOR,content:React.createElement("div",{style:{background:"var(--neko-main-color)",height:"100%",padding:"15px 15px 0 15px "}},I&&React.createElement(st.X,{variant:"success",style:{marginBottom:"16px"}},I),React.createElement(ir,{busy:oe,onClose:function(){return X(!1)},editSnippet:g,setEditSnippet:b,isSavable:S,onSave:O})),onRequestClose:function(){return X(!1)},customButtons:React.createElement(w.M,{onClick:function(){O(g),X(!1)},disabled:!S},ye.COMMON.SAVE_AND_CLOSE),okButton:{label:ye.COMMON.SAVE,onClick:function(){O(g)},disabled:!S},cancelButton:{label:ye.COMMON.CANCEL,onClick:function(){return X(!1)}}}))};var Jr=n(6031),Qr=n(7392),Xr=n(6842);function Zr(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 eo(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)?eo(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 eo(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 to=wp.element,no=to.useState,ro=to.useEffect,oo=to.useCallback,ao=function(e){!function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(e);var t=Zr(no([]),2),n=t[0],r=t[1],o=Zr(no(!0),2),a=o[0],i=o[1],c=Zr(no(!1),2),l=c[0],u=c[1],s=Zr(no(""),2),f=s[0],p=s[1],h=oo((function(){Ae().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 ro((function(){h()}),[]),React.createElement(React.Fragment,null,l&&React.createElement(Et.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"}},ye.COMMON.DATA_NOT_AVAILABLE),!a&&n&&React.createElement(Xr.p2,{value:n,rootName:"functions",indentWidth:2,displayDataTypes:!1,displayObjectSize:!1,displayArrayKey:!1,enableClipboard:!1,style:{fontSize:12}})),React.createElement(vt.g,null),React.createElement(w.M,{className:"secondary",onClick:function(){return u(!l)}},l?ye.COMMON.CANCEL:ye.SETTINGS.DEVELOPERS.RAW_EDIT),l&&React.createElement(w.M,{onClick:function(){ke(f).then((function(){alert("Functions updated."),h(),u(!1)})).catch((function(e){alert("Error while updating functions. Please check your console."),console.error(e)}))}},ye.COMMON.UPDATE))};function io(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 co=wp.element.useState;const lo=function(){var e=ut(),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 io(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)?io(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.")}()}(co(!1),2),u=l[0],s=l[1],f=zt({onError:function(e){return alert("⚠️ "+e)}}),p=f.onImportCodeSnippets,v=f.isProcessing,g=r("ai_engine_status",!1),R=r("database_inspection",!1),T=c||u||v;return React.createElement(b._,null,React.createElement(b.V,{title:ye.SETTINGS.TITLE},React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(S.z,{busy:T,title:ye.SETTINGS.PREFERENCES.TITLE,className:"primary"},React.createElement(d.d,{title:ye.SETTINGS.PREFERENCES.CODE_PREVIEW},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"ui_show_preview",disabled:T,label:ye.COMMON.ENABLE,description:ye.SETTINGS.PREFERENCES.CODE_PREVIEW_DESCRIPTION,value:"1",checked:r("ui_show_preview",!1),onChange:o})))),React.createElement(S.z,{busy:T,title:ye.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},ye.COMMON.RESET_SETTINGS),React.createElement(w.M,{className:"primary",onClick:i},ye.COMMON.REFRESH_SETTINGS),React.createElement(w.M,{className:"secondary",onClick:function(){return o(!1,"hide_tutorial")}},ye.SETTINGS.SHOW_TUTORIAL)),React.createElement(vt.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 Le(s)}},ye.SETTINGS.IMPORT_SETTINGS),React.createElement(w.M,{className:"primary",onClick:function(){return Ie(s)}},ye.SETTINGS.EXPORT_SETTINGS)),React.createElement(vt.g,{tiny:!0}),React.createElement("div",{style:{display:"flex",gap:"0px"}},React.createElement(w.M,{className:"secondary",onClick:p,busy:T},ye.SETTINGS.SNIPPET.IMPORT_CODE_SNIPPETS)))),React.createElement(E.Y,{minimal:!0},React.createElement(S.z,{busy:T,title:ye.SETTINGS.AI_PARAMETERS.TITLE,className:"primary",action:React.createElement(React.Fragment,null,g&&React.createElement(Jr.B,{className:"success",label:ye.SETTINGS.AI_PARAMETERS.AI_ENGINE_INSTALLED}),!g&&React.createElement(Jr.B,{className:"warning",label:ye.SETTINGS.AI_PARAMETERS.DOWNLOAD_AI_ENGINE,link:"https://meowapps.com/ai-engine/"}))},React.createElement(d.d,{title:ye.SETTINGS.AI_PARAMETERS.AI_SUGGESTIONS},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"ai_suggestions",disabled:T||!g,label:ye.COMMON.ENABLE,description:ye.SETTINGS.AI_PARAMETERS.AI_SUGGESTIONS_DESCRIPTION,value:"1",checked:r("ai_suggestions",!1),onChange:o})))),React.createElement(S.z,{busy:T,title:ye.SETTINGS.DEVELOPERS.TITLE,className:"primary"},React.createElement(d.d,{title:ye.SETTINGS.DEVELOPERS.SANITIZE_ARGS},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"sanitize_arguments",disabled:T,label:ye.COMMON.ENABLE_RECOMMENDED,description:ye.SETTINGS.DEVELOPERS.SANITIZE_ARGS_DESCRIPTION,value:"1",checked:r("sanitize_arguments",!0),onChange:o}))),React.createElement(d.d,{title:ye.SETTINGS.PREFERENCES.PUBLIC_API},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"api_endpoint",disabled:T,label:ye.COMMON.ENABLE,description:ye.SETTINGS.PREFERENCES.SNIPPET_ENDPOINT_DESCRIPTION,value:"1",checked:r("api_endpoint",!1),onChange:o}))),r("api_endpoint",!1)&&React.createElement(d.d,{title:ye.SETTINGS.SNIPPET.TOKEN},React.createElement("div",{style:{display:"flex",gap:"10px"}},React.createElement(Wt.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(d.d,{title:ye.SETTINGS.DEVELOPERS.MCP_SUPPORT},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"mcp_support",disabled:T||!g,label:ye.COMMON.ENABLE,description:ye.SETTINGS.DEVELOPERS.MCP_SUPPORT_DESCRIPTION,value:"1",checked:r("mcp_support",!1),onChange:o}))),React.createElement(d.d,{title:ye.SETTINGS.DEVELOPERS.DATABASE_INSPECTION},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"database_inspection",disabled:T,label:ye.COMMON.ENABLE,description:ye.SETTINGS.DEVELOPERS.DATABASE_INSPECTION_DESCRIPTION,value:"1",checked:r("database_inspection",!1),onChange:o}))),React.createElement(d.d,{title:ye.SETTINGS.DEVELOPERS.LOGS},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"server_debug_mode",disabled:T,label:ye.COMMON.ENABLE,description:ye.SETTINGS.DEVELOPERS.LOGS_DESCRIPTION,value:"1",checked:r("server_debug_mode",!1),onChange:o}))),React.createElement(d.d,{title:ye.SETTINGS.DEVELOPERS.BYPASS_SECURITY},React.createElement(m.E,{max:"1"},React.createElement(y.R,{name:"bypass_rest_security",disabled:T,label:ye.COMMON.ENABLE_NOT_RECOMMENDED,description:ye.SETTINGS.DEVELOPERS.BYPASS_SECURITY_DESCRIPTION,value:"1",checked:r("bypass_rest_security",!1),onChange:o})))),r("server_debug_mode",!1)&&React.createElement(Qr.k,{refreshQuery:Oe,clearQuery:xe,i18n:ye})))),R&&React.createElement(b.V,{title:ye.SETTINGS.DEVELOPERS.DATABASE_INSPECTION},React.createElement(E.N,null,React.createElement(E.Y,{minimal:!0},React.createElement(S.z,{busy:T,title:ye.SETTINGS.SNIPPET.SCOPES.FUNCTION,className:"primary"},React.createElement(ao,null))),React.createElement(E.Y,{minimal:!0}))))};function uo(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 so=wp.element.useState;const fo=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 uo(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)?uo(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.")}()}(so("snippets"),2),t=e[0],n=e[1];return React.createElement(s.A,null,React.createElement(v.z,null,React.createElement(g.n,{title:ye.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(Kr,null),"settings"===t&&React.createElement(lo,null)))))};var po,ho=n(1561),mo=n(6897),yo=["children","type","title","hint","isSelected","isDisplayed"];function vo(){return vo=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},vo.apply(null,arguments)}var go=React.createElement(ho.z,{icon:"cat",style:{width:20,height:20}}),Eo=L.Ay.div(po||(po=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']))),bo=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,mo.gR)("mwcode-block-container","mwcode-".concat(r),{"is-selected":l,"is-meow":!0});return React.createElement(Eo,vo({className:f},s),React.createElement("div",{className:"mwcode-title-container"},go,React.createElement("div",null,a),React.createElement("div",{className:"mwcode-hint"},c)),(l||u)&&React.createElement("div",{className:"mwcode-block-container-content"},t))};function wo(){return wo=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},wo.apply(null,arguments)}var So=wp.i18n.__,Ro=wp.blocks.registerBlockType,To=wp.blockEditor,Oo=To.InspectorControls,xo=To.useBlockProps,No=wp.components,Po=No.PanelBody,_o=No.SelectControl,Io=function(e){var t=e.attributes,n=e.setAttributes,r=e.isSelected,o=t.code,a=t.target,i=xo();return React.createElement(React.Fragment,null,React.createElement(Oo,null,React.createElement(Po,{title:So("Code Block Settings","code-engine")},React.createElement(_o,{label:So("Target Language","code-engine"),value:a,options:[{label:"PHP",value:"php"},{label:"JS",value:"js"}],onChange:function(e){return n({target:e})}}))),React.createElement(bo,wo({},i,{title:So("Content Code Block","code-engine"),isSelected:r,isDisplayed:!0}),React.createElement(_o,{label:So("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(yn,{code:o,snippet:{scope:"content_"+a,functionTarget:a},setCode:function(e){return n({code:e})}}))))},Lo=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 Ao=wp.element.render,ko=new l.E({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnMount:!1,retry:!1,placeholderData:function(e){return e}}}});Ro("code-engine/content",{title:So("Content Code Block","code-engine"),description:So("Container to embed code directly into the post content","code-engine"),icon:go,category:"widgets",keywords:[So("code","code-engine"),So("content","code-engine"),So("block","code-engine")],attributes:{target:{type:"string",default:"php"},code:{type:"string",default:""}},edit:Io,save:Lo}),document.addEventListener("DOMContentLoaded",(function(){var e=document.getElementById("mwcode-admin-settings");e&&Ao(React.createElement(lt,null,React.createElement(u.Ht,{client:ko},React.createElement(fo,null))),e);var t=document.getElementById("meow-common-dashboard");t&&Ao(React.createElement(u.Ht,{client:ko},React.createElement(s.A,null,React.createElement(pe,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(5066)));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)})(); |