PluginProbe ʕ •ᴥ•ʔ
AI Engine – The Chatbot, AI Framework & MCP for WordPress / 0.4.0
AI Engine – The Chatbot, AI Framework & MCP for WordPress v0.4.0
3.5.8 3.5.7 3.5.6 3.5.5 3.5.4 3.5.3 3.5.2 3.5.1 3.5.0 3.4.9 3.4.8 3.4.7 0.2.1 1.6.91 0.2.2 1.6.92 0.2.3 1.6.93 0.2.4 1.6.94 0.2.5 1.6.95 0.2.6 1.6.96 0.2.7 1.6.97 0.2.8 1.6.98 0.2.9 1.6.99 0.3.0 1.7.0 0.3.1 1.7.1 0.3.2 1.7.2 0.3.3 1.7.3 0.3.4 1.7.4 0.3.5 1.7.5 0.3.6 1.7.6 0.4.0 1.7.7 0.4.1 1.7.8 0.4.2 1.7.9 0.4.3 1.8.0 0.4.4 1.8.1 0.4.5 1.8.2 0.4.6 1.8.3 0.4.7 1.8.4 0.4.8 1.8.5 0.4.9 1.8.6 0.5.0 1.8.7 0.5.1 1.8.8 0.5.2 1.8.9 0.5.3 1.9.0 0.5.4 1.9.1 0.5.5 1.9.2 0.5.6 1.9.3 0.5.7 1.9.4 0.5.8 1.9.5 0.5.9 1.9.6 0.6.0 1.9.7 0.6.1 1.9.8 0.6.2 1.9.81 0.6.3 1.9.82 0.6.4 1.9.83 0.6.5 1.9.84 0.6.6 1.9.85 0.6.7 1.9.86 0.6.8 1.9.87 0.6.9 1.9.88 0.7.0 1.9.89 0.7.1 1.9.90 0.7.2 1.9.91 0.7.3 1.9.92 0.7.4 1.9.93 0.7.5 1.9.94 0.7.6 1.9.95 0.7.7 1.9.96 0.7.8 1.9.97 0.7.9 1.9.98 0.8.0 1.9.99 0.8.1 2.0.0 0.8.2 2.0.1 0.8.3 2.0.2 0.8.4 2.0.3 0.8.5 2.0.4 0.8.6 2.0.5 0.8.7 2.0.6 0.8.8 2.0.7 0.8.9 2.0.8 0.9.0 2.0.9 0.9.2 2.1.0 0.9.3 2.1.1 0.9.4 2.1.2 0.9.5 2.1.3 0.9.6 2.1.4 0.9.7 2.1.5 0.9.8 2.1.6 0.9.81 2.1.7 0.9.82 2.1.8 0.9.83 2.1.9 0.9.84 2.2.0 0.9.85 2.2.1 0.9.86 2.2.2 0.9.87 2.2.3 0.9.88 2.2.4 0.9.89 2.2.5 0.9.9 2.2.51 0.9.91 2.2.52 0.9.92 2.2.53 0.9.93 2.2.54 0.9.94 2.2.56 0.9.95 2.2.57 0.9.96 2.2.6 0.9.97 2.2.60 0.9.98 2.2.61 0.9.99 2.2.62 1.0.0 2.2.63 1.0.01 2.2.70 1.0.1 2.2.80 1.0.2 2.2.81 1.0.3 2.2.90 1.0.4 2.2.91 1.0.5 2.2.92 1.0.6 2.2.93 1.0.7 2.2.94 1.0.8 2.2.95 1.0.9 2.3.0 1.1.0 2.3.1 1.1.1 2.3.2 1.1.2 2.3.3 1.1.3 2.3.4 1.1.4 2.3.5 1.1.5 2.3.6 1.1.6 2.3.7 1.1.7 2.3.8 1.1.8 2.3.9 1.1.9 2.4.0 1.2.0 2.4.1 1.2.1 2.4.2 1.2.2 2.4.3 1.2.21 2.4.4 1.2.3 2.4.5 1.2.30 2.4.6 1.3.0 2.4.7 1.3.1 2.4.8 1.3.2 2.4.9 1.3.3 2.5.0 1.3.31 2.5.1 1.3.32 2.5.2 1.3.33 2.5.3 1.3.34 2.5.4 1.3.35 2.5.5 1.3.36 2.5.6 1.3.37 2.5.7 1.3.38 2.5.8 1.3.39 2.5.9 1.3.40 2.6.0 1.3.41 2.6.1 1.3.42 2.6.2 1.3.43 2.6.3 1.3.44 2.6.5 1.3.45 2.6.6 1.3.46 2.6.7 1.3.47 2.6.8 1.3.48 2.6.9 1.3.49 2.7.0 1.3.50 2.7.1 1.3.51 2.7.2 1.3.52 2.7.3 1.3.53 2.7.4 1.3.54 2.7.5 1.3.56 2.7.6 1.3.57 2.7.7 1.3.58 2.7.8 1.3.59 2.7.9 1.3.60 2.8.0 1.3.61 2.8.1 1.3.62 2.8.2 1.3.63 2.8.3 1.3.64 2.8.4 1.3.65 2.8.5 1.3.66 2.8.6 1.3.67 2.8.7 1.3.68 2.8.8 1.3.69 2.8.9 1.3.70 2.9.0 1.3.71 2.9.1 1.3.72 2.9.2 1.3.73 2.9.3 1.3.74 2.9.4 1.3.75 2.9.5 1.3.76 2.9.6 1.3.77 2.9.7 1.3.78 2.9.8 1.3.79 2.9.9 1.3.80 3.0.0 1.3.81 3.0.1 1.3.82 3.0.2 1.3.83 3.0.3 1.3.84 3.0.4 1.3.85 3.0.5 1.3.86 3.0.6 1.3.87 3.0.7 1.3.88 3.0.8 1.3.89 3.0.9 1.3.90 3.1.0 1.3.91 3.1.1 1.3.92 3.1.2 1.3.93 3.1.3 1.3.94 3.1.4 1.3.95 3.1.5 1.3.96 3.1.6 1.3.97 3.1.7 1.3.98 3.1.8 1.3.99 3.1.9 1.4.0 3.2.0 1.4.1 3.2.1 1.4.2 3.2.2 1.4.3 3.2.3 1.4.4 3.2.4 1.4.5 3.2.5 1.4.6 3.2.6 1.4.7 3.2.7 1.4.8 3.2.8 1.4.9 3.2.9 1.5.0 3.3.0 1.5.1 3.3.1 1.5.2 3.3.2 1.5.3 3.3.3 1.5.4 3.3.4 1.5.5 3.3.5 1.5.6 3.3.6 1.5.7 3.3.7 1.5.8 3.3.8 1.5.9 3.3.9 1.6.0 3.4.0 1.6.1 3.4.1 1.6.2 3.4.2 1.6.3 3.4.3 1.6.5 3.4.4 1.6.51 3.4.5 1.6.52 3.4.6 1.6.53 1.6.54 1.6.55 1.6.56 1.6.57 1.6.58 1.6.59 1.6.60 1.6.61 1.6.62 1.6.63 1.6.64 1.6.65 1.6.66 1.6.67 1.6.68 trunk 1.6.69 0.0.1 1.6.70 0.0.2 1.6.71 0.0.3 1.6.72 0.0.4 1.6.73 0.0.5 1.6.74 0.0.6 1.6.75 0.0.7 1.6.76 0.0.8 1.6.77 0.0.9 1.6.78 0.1.0 1.6.79 0.1.1 1.6.81 0.1.2 1.6.82 0.1.3 1.6.83 0.1.4 1.6.84 0.1.5 1.6.85 0.1.6 1.6.86 0.1.7 1.6.87 0.1.8 1.6.88 0.1.9 1.6.89 0.2.0 1.6.90
ai-engine / app / index.js
ai-engine / app Last commit date
index.js 3 years ago vendor.js 3 years ago
index.js
8 lines
1 /*! For license information please see index.js.LICENSE.txt */
2 (()=>{"use strict";var e,t={6806:(e,t,n)=>{var r,a,o,i,c,l=n(6488),u=n(5945),s=n(3757),f=n(6160),m=n(749),h=n(1630),p=n(4694),d=n(1254),y=n(8168),v=n(5979),g=n(1488),b=n(7818),w=n(537),E=n(8694),R=mwai_meow_plugin.prefix,x=mwai_meow_plugin.domain,k=mwai_meow_plugin.rest_url.replace(/\/+$/,""),_=mwai_meow_plugin.api_url.replace(/\/+$/,""),O=mwai_meow_plugin.plugin_url.replace(/\/+$/,""),S="1"===mwai_meow_plugin.is_pro,L=S&&"1"===mwai_meow_plugin.is_registered,P=mwai_meow_plugin.rest_nonce,j=mwai_meow_plugin.options,T=mwai_meow_plugin.session,C=mwai_meow_plugin.pricing,N=n(8406),I=n(2788);function A(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var F=I.ZP.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"]))),G=(0,I.ZP)(w.v)(a||(a=A(["\n\n .nui-block-title {\n display: none;\n }\n\n .plugin-desc {\n display: flex;\n flex-direction: column;\n justify-content: center;\n margin-left: 20px;\n\n }\n\n .nui-block-content {\n display: flex;\n padding: 10px;\n item-align: center;\n\n h2 {\n color: #055082;\n font-size: 18px;\n margin: 0;\n\n a {\n text-decoration: none;\n }\n }\n\n p {\n margin: 0px;\n font-size: 15px;\n }\n }\n"]))),z=I.ZP.img(o||(o=A(["\n width: 85px;\n height: 85px;\n padding-right: 10px;\n"]))),M=I.ZP.div(i||(i=A(["\n\n margin: 15px;\n\n .center {\n background: white;\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=I.ZP.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\n .log-date {\n color: white;\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: #ccb028;\n color: white;\n }\n\n .log-fatal .log-type {\n background: #cc2828;\n color: white;\n }\n"])));function D(e){return D="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},D(e)}function Y(){Y=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,a){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),c=new _(a||[]);return r(i,"_invoke",{value:E(e,n,c)}),i}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f={};function m(){}function h(){}function p(){}var d={};l(d,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==t&&n.call(v,o)&&(d=v);var g=p.prototype=m.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function a(r,o,i,c){var l=s(e[r],e,o);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==D(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){a("next",e,i,c)}),(function(e){a("throw",e,i,c)})):t.resolve(f).then((function(e){u.value=e,i(u)}),(function(e){return a("throw",e,i,c)}))}c(l.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return{value:void 0,done:!0}}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var c=R(i,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=s(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}function R(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,f;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function O(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:S}}function S(){return{value:void 0,done:!0}}return h.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:h,configurable:!0}),h.displayName=l(p,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,l(e,c,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(w.prototype),l(w.prototype,i,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new w(u(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(g),l(g,c,"Generator"),l(g,o,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.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}},e.values=O,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):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),f},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),k(n),f}},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 a=r.arg;k(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function q(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function W(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){q(o,r,a,i,c,"next",e)}function c(e){q(o,r,a,i,c,"throw",e)}i(void 0)}))}}function Z(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,a,o,i,c=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return c}}(e,t)||H(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 H(e,t){if(e){if("string"==typeof e)return U(e,t);var n=Object.prototype.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)?U(e,t):void 0}}function U(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var V=wp.element,J=V.useState,$=V.useEffect,K="".concat(k,"/meow-common/v1"),Q=function(e){var t=e.request,n=e.title,r=e.max,a=Z(J(!1),2),o=a[0],i=a[1],c=Z(J([]),2),l=c[0],u=c[1],s=l.length>0?l.reduce((function(e,t){return e+t})):0,m=l.length>0?Math.ceil(s/l.length):0,h=!l.length&&o;return $((function(){o&&setTimeout(W(Y().mark((function e(){var n,r,a;return Y().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(new Date).getTime(),e.next=3,(0,E.PV)("".concat(K,"/").concat(t),{method:"POST",nonce:P});case 3:r=(new Date).getTime(),a=r-n,u((function(e){return[].concat(function(e){if(Array.isArray(e))return U(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||H(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.")}(),[a]);var t}));case 6:case"end":return e.stop()}}),e)}))),1e3)}),[l]),React.createElement(F,{style:{width:200,textAlign:"center"}},React.createElement(f.O,{h2:!0,style:{color:"white"}},n),React.createElement(N._,{size:200,value:h?r:m,max:r},React.createElement("span",{style:{fontSize:20}},h?"START":m+" ms"),React.createElement("span",{style:{fontSize:12}},h?"YOUR ENGINE":l.length+" requests")),React.createElement(b._,{style:{width:"100%",marginTop:10},color:o?"#cc3627":"#ccb027",onClick:function(){o||u([]),i(!o)}},o?"Stop":"Start"))};function X(e){return X="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},X(e)}function ee(){ee=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,a){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),c=new _(a||[]);return r(i,"_invoke",{value:E(e,n,c)}),i}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f={};function m(){}function h(){}function p(){}var d={};l(d,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==t&&n.call(v,o)&&(d=v);var g=p.prototype=m.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function a(r,o,i,c){var l=s(e[r],e,o);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==X(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){a("next",e,i,c)}),(function(e){a("throw",e,i,c)})):t.resolve(f).then((function(e){u.value=e,i(u)}),(function(e){return a("throw",e,i,c)}))}c(l.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return{value:void 0,done:!0}}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var c=R(i,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=s(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}function R(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,f;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function O(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:S}}function S(){return{value:void 0,done:!0}}return h.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:h,configurable:!0}),h.displayName=l(p,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,l(e,c,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(w.prototype),l(w.prototype,i,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new w(u(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(g),l(g,c,"Generator"),l(g,o,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.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}},e.values=O,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):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),f},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),k(n),f}},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 a=r.arg;k(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function te(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 ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?te(Object(n),!0).forEach((function(t){re(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function re(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==X(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==X(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===X(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ae(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function oe(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ae(o,r,a,i,c,"next",e)}function c(e){ae(o,r,a,i,c,"throw",e)}i(void 0)}))}}function ie(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,a,o,i,c=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return ce(e,t);var n=Object.prototype.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=new Array(t);n<t;n++)r[n]=e[n];return r}var le=wp.element,ue=le.useState,se=le.useEffect;_&&k&&O||console.error("[@common/dashboard] apiUrl, restUrl and pluginUrl are mandatory.");var fe="".concat(k,"/meow-common/v1"),me=React.createElement(F,null,React.createElement(f.O,{p:!0},"Meow Apps is a suite of plugins for photography, imaging, optimization, and SEO, run by ",React.createElement("a",{target:"_blank",href:"https://offbeatjapan.org"},"Jordy Meow"),", a photographer and developer in Japan. The goal is to improve and speed up your website. Learn more at ",React.createElement("a",{href:"http://meowapps.com",target:"_blank"},"Meow Apps"),".")),he=React.createElement(F,null,React.createElement(f.O,{p:!0},"⭐️ The ",React.createElement("b",null,"Empty Request Time")," helps you analyzing the raw performance of your install by giving you the average time it takes to run an empty request to your server. You can try to disable some plugins then start this again to see how it modifies the results. Keep it absolutely under 2,000 ms! That said, I recommend it to keep it below 500ms."),React.createElement(f.O,{p:!0},"⭐️ ",React.createElement("b",null,"File Operation Time")," creates a temporary size of 10MB every time."),React.createElement(f.O,{p:!0},"⭐️ ",React.createElement("b",null,"SQL Request Time")," counts the number of posts. Those two should be very fast, and almost the same as the ",React.createElement("b",null,"Empty Request Time"),".")),pe=React.createElement(F,null,React.createElement(f.O,{p:!0},"Keep your WordPress install simple and efficient by using only necessary plugins and a reliable hosting service. Avoid trying to self-host unless you have professional experience. Follow best practices and stay up-to-date with the latest recommendations on the Meow Apps website.",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"))))),de=["".concat(fe,"/all_settings/"),{headers:{"X-WP-Nonce":P}}],ye=function(){var e=ie(ue(!1),2),t=e[0],n=e[1],r=(0,s.ZP)(de,E.SG),a=r.data,o=r.mutate,i=r.error,c=null==a?void 0:a.data,l=null==c?void 0:c.meowapps_hide_meowapps,u=null==c?void 0:c.force_sslverify,R=ie(ue(!1),2),x=R[0],k=R[1],_=ie(ue([]),2),S=_[0],L=_[1],j=ie(ue(""),2),T=j[0],C=j[1];se((function(){i&&!t&&(n(!0),console.error("Error from UseSWR",i.message))}),[i]),se((function(){var e=document.getElementById("meow-common-phpinfo");C(e.innerHTML)}),[]);var N=function(){var e=oe(ee().mark((function e(t,n){var r,i;return ee().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=ne({},a.data))[n]=t,o(ne(ne({},a),{},{data:r}),!1),k(!0),e.next=6,(0,E.PV)("".concat(fe,"/update_option"),{method:"POST",nonce:P,json:{name:n,value:t}});case 6:i=e.sent,k(!1),i.success||alert(i.message),o();case 10:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),I=function(){var e=oe(ee().mark((function e(){var t,n;return ee().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return k(!0),e.next=3,(0,E.PV)("".concat(fe,"/error_logs"),{method:"POST",nonce:P});case 3:t=e.sent,n=t&&t.data?t.data:[],L(n.reverse()),k(!1);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),A=React.createElement(m.r,{title:"Main Menu"},React.createElement(h.l,{max:"1"},React.createElement(p.P,{id:"meowapps_hide_meowapps",label:"Hide (Not Recommended)",description:React.createElement(f.O,{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:x,checked:l,onChange:N}))),D=React.createElement(m.r,{title:"SSL Verify"},React.createElement(h.l,{max:"1"},React.createElement(p.P,{id:"force_sslverify",label:"Force (Not Recommended)",description:React.createElement(f.O,{p:!0},"This will enforce the usage of SSL when checking the license or updating the plugin."),value:"1",disabled:x,checked:u,onChange:N})));return React.createElement(d.s,{showRestError:t},React.createElement(y.B,{title:"The Dashboard"}),React.createElement(v.o,null,React.createElement(v.z,{full:!0},React.createElement(g.c,null,React.createElement(g.P,{title:"Meow Apps"},me,React.createElement(v.o,null,React.createElement(v.z,{minimal:!0},React.createElement(G,{title:"Media Cleaner",className:"primary"},React.createElement(z,{src:"".concat(O,"/common/img/media-cleaner.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",null,"Remove the useless media entries and files."))),React.createElement(G,{title:"Database Cleaner",className:"primary"},React.createElement(z,{src:"".concat(O,"/common/img/database-cleaner.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",null,"Clean your database and make it faster."))),React.createElement(G,{title:"Media File Renamer",className:"primary"},React.createElement(z,{src:"".concat(O,"/common/img/media-file-renamer.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",null,"Rename your filenames for a better SEO."))),React.createElement(G,{title:"Social Engine",className:"primary"},React.createElement(z,{src:"".concat(O,"/common/img/social-engine.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",null,"Share your articles and photos on the SNS."))),React.createElement(G,{title:"Meow Analytics",className:"primary"},React.createElement(z,{src:"".concat(O,"/common/img/meow-analytics.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",null,"Google Analytics for your website.")))),React.createElement(v.z,{minimal:!0},React.createElement(G,{title:"Photo Engine",className:"primary"},React.createElement(z,{src:"".concat(O,"/common/img/wplr-sync.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",null,"Organize your photos in folders and collections.",React.createElement("br",null),"Synchronize with Lightroom."))),React.createElement(G,{title:"Meow Gallery",className:"primary"},React.createElement(z,{src:"".concat(O,"/common/img/meow-gallery.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",null,"Fast and beautiful gallery with many layouts."))),React.createElement(G,{title:"Meow Lightbox",className:"primary"},React.createElement(z,{src:"".concat(O,"/common/img/meow-lightbox.png")}),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",null,"Sleek and performant lightbox with EXIF support."))),React.createElement(G,{title:"Perfect Images (Retina)",className:"primary"},React.createElement(z,{src:"".concat(O,"/common/img/wp-retina-2x.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",null,"Optimize your thumbnails, retina, replace images, etc."))),React.createElement(G,{title:"Contact Form Block",className:"primary"},React.createElement(z,{src:"".concat(O,"/common/img/contact-form-block.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",null,"Simple and straightforward contact form, in one block.")))))),React.createElement(g.P,{title:"Performance"},he,React.createElement("div",{style:{display:"flex",justifyContent:"space-around",marginBottom:25}},React.createElement(Q,{title:"Empty Request Time",request:"empty_request",max:2500}),React.createElement(Q,{title:"File Operation Time",request:"file_operation",max:2600}),React.createElement(Q,{title:"SQL Request Time",request:"sql_request",max:2800})),pe),React.createElement(g.P,{title:"PHP Info"},React.createElement(M,{dangerouslySetInnerHTML:{__html:T}})),React.createElement(g.P,{title:"PHP Error Logs"},React.createElement(F,null,React.createElement(b._,{style:{marginBottom:10},color:"#ccb027",onClick:I},"Load PHP Error Logs"),React.createElement(B,null,S.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(f.O,{p:!0},"If nothing appears after loading, it might be that your hosting service does not allow you to access the PHP error logs directly from here. Please contact them directly."))),React.createElement(g.P,{title:"Settings"},React.createElement(w.v,{title:"Settings",className:"primary"},A,D))))))},ve=n(1492),ge=n(9137),be=n(3565),we=n(3506),Ee=n(1203);function Re(e){return Re="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},Re(e)}function xe(){xe=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,a){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),c=new _(a||[]);return r(i,"_invoke",{value:E(e,n,c)}),i}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f={};function m(){}function h(){}function p(){}var d={};l(d,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==t&&n.call(v,o)&&(d=v);var g=p.prototype=m.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function a(r,o,i,c){var l=s(e[r],e,o);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==Re(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){a("next",e,i,c)}),(function(e){a("throw",e,i,c)})):t.resolve(f).then((function(e){u.value=e,i(u)}),(function(e){return a("throw",e,i,c)}))}c(l.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return{value:void 0,done:!0}}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var c=R(i,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=s(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}function R(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,f;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function O(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:S}}function S(){return{value:void 0,done:!0}}return h.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:h,configurable:!0}),h.displayName=l(p,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,l(e,c,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(w.prototype),l(w.prototype,i,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new w(u(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(g),l(g,c,"Generator"),l(g,o,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.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}},e.values=O,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):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),f},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),k(n),f}},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 a=r.arg;k(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function ke(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function _e(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){ke(o,r,a,i,c,"next",e)}function c(e){ke(o,r,a,i,c,"throw",e)}i(void 0)}))}}function Oe(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,a,o,i,c=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Se(e,t);var n=Object.prototype.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)?Se(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 Se(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Le=wp.element,Pe=Le.useState,je=Le.useEffect,Te="".concat(k,"/meow-licenser/").concat(R,"/v1"),Ce=function(){var e=Oe(Pe(!1),2),t=e[0],n=e[1],r=Oe(Pe(!1),2),a=r[0],o=r[1],i=Oe(Pe(null),2),c=i[0],l=i[1],u=Oe(Pe(null),2),s=u[0],h=u[1],p=Oe(Pe(""),2),d=p[0],y=p[1],v=L&&(!s||"valid"!==s.license),g=function(){var e=_e(xe().mark((function e(){var t;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(S){e.next=2;break}return e.abrupt("return");case 2:return n(!0),e.next=5,(0,E.PV)("".concat(Te,"/get_license"),{method:"POST",nonce:P});case 5:t=e.sent,h(t.data),t.data.key&&y(t.data.key),n(!1);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),R=function(){var e=_e(xe().mark((function e(){return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n(!0),e.next=3,(0,E.PV)("".concat(Te,"/set_license"),{method:"POST",nonce:P,json:{serialKey:null}});case 3:e.sent.success&&(y(""),h(null),l("licenseRemoved")),n(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),x=function(){var e=_e(xe().mark((function e(){var t;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n(!0),e.next=3,(0,E.PV)("".concat(Te,"/set_license"),{nonce:P,json:{serialKey:d,override:!0}});case 3:(t=e.sent).success&&(h(t.data),t.data&&!t.data.issue&&l("licenseAdded")),n(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),k=function(){var e=_e(xe().mark((function e(){var t;return xe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("MEOW_OVERRIDE"!==d){e.next=5;break}return o(!0),h(null),y(""),e.abrupt("return");case 5:return n(!0),e.next=8,(0,E.PV)("".concat(Te,"/set_license"),{method:"POST",nonce:P,json:{serialKey:d}});case 8:(t=e.sent).success&&(h(t.data),t.data&&!t.data.issue&&l("licenseAdded")),n(!1);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();je((function(){g()}),[]);var _=v?"Forced License":L?"Enabled":"Disabled",O=v||s&&"valid"===s.license,j="Your license is active. Thanks a lot for your support :)";v&&s&&s.check_url&&(j=React.createElement(React.Fragment,null,React.createElement("span",null,j),React.createElement("br",null),React.createElement("small",null,"This license was enabled manually. To check your license status, please click ",React.createElement("a",{target:"_blank",href:s.check_url+"&cache="+642e3*Math.random()},"here"),"."))),O||(s?"no_activations_left"===s.issue?j=React.createElement("span",null,"There are no activations left for this license. You can visit your account at the ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com"},"Meow Apps Store"),", unregister a site, and click on ",React.createElement("i",null,"Retry to validate"),"."):"expired"===s.issue?j=React.createElement("span",null,"Your license has expired. You can get another license or renew the current one by visiting your account at the ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com"},"Meow Apps Store"),"."):"missing"===s.issue?j="This license does not exist.":"disabled"===s.issue?j="This license has been disabled.":"item_name_mismatch"===s.issue?j="This license seems to be for a different plugin... isn't it? :)":"forced"===s.issue?j="ABC":(j=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})):j="Unknown error :(");var T=React.createElement(w.v,{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 the ",React.createElement("a",{target:"_blank",rel:"noreferrer",href:"https://meowapps.com/"},"Meow Apps Store"),"."),C=React.createElement(w.v,{title:"Pro Version (".concat(_,")"),busy:t,className:"primary"},React.createElement(m.r,{title:"Serial Key",style:{fontWeight:"bold"}},React.createElement(ve.A,{id:"mfrh_pro_serial",name:"mfrh_pro_serial",disabled:t,value:d,onChange:function(e){return y(e)},placeholder:""})),s&&!O&&React.createElement(we.G,null,j),s&&O&&React.createElement(we.C,null,j),!s&&React.createElement(f.O,{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(m.r,{contentAlign:"right"},s&&!O&&React.createElement(b._,{className:"secondary",disabled:t||!d,onClick:k},"Retry to validate"),s&&s.key===d&&React.createElement(b._,{className:"secondary",disabled:t||!d,onClick:R},"Remove License"),React.createElement(b._,{disabled:t||!d||s&&s.key===d,onClick:k},"Validate License"),a&&!O&&React.createElement(b._,{disabled:t||!d||s&&s.key===d,onClick:x,className:"danger"},"Force License")),React.createElement(Ee.L,{isOpen:"licenseAdded"===c,title:"Thank you :)",content:"The Pro features have been enabled. This page should be now reloaded.",ok:"Reload",onOkClick:function(){return location.reload()}}),React.createElement(Ee.L,{isOpen:"licenseRemoved"===c,title:"Goodbye :(",content:"The Pro features have been disabled. This page should be now reloaded.",ok:"Reload",onOkClick:function(){return location.reload()}}));return S?C:T},Ne=[{id:"text-davinci-003",name:"text-davinci-003",short:"davinci",description:"Most capable GPT-3 model. Can do any task the other models can do, often with higher quality, longer output and better instruction-following. Also supports inserting completions within text.",strength:"Complex intent, cause and effect, summarization for audience"},{id:"text-curie-001",name:"text-curie-001",short:"curie",description:"Very capable, but faster and lower cost than Davinci.",strength:"Language translation, complex classification, text sentiment, summarization"},{id:"text-babbage-001",name:"text-babbage-001",short:"babbage",description:"Capable of straightforward tasks, very fast, and lower cost.",strength:"Moderate classification, semantic search classification"},{id:"text-ada-001",name:"text-ada-001",short:"ada",description:"Capable of very simple tasks, usually the fastest model in the GPT-3 series, and lowest cost.",strength:"Parsing text, simple classification, address correction, keywords"}],Ie=[{value:"informative",label:"Informative"},{value:"descriptive",label:"Descriptive"},{value:"creative",label:"Creative"},{value:"narrative",label:"Narrative"},{value:"persuasive",label:"Persuasive"},{value:"reflective",label:"Reflective"},{value:"argumentative",label:"Argumentative"},{value:"analytical",label:"Analytical"},{value:"evaluative",label:"Evaluative"},{value:"journalistic",label:"Journalistic"},{value:"technical",label:"Technical"}],Ae=[{value:"neutral",label:"Neutral"},{value:"formal",label:"Formal"},{value:"assertive",label:"Assertive"},{value:"cheerful",label:"Cheerful"},{value:"humorous",label:"Humorous"},{value:"informal",label:"Informal"},{value:"inspirational",label:"Inspirational"},{value:"professional",label:"Professional"},{value:"confvalueent",label:"Confvalueent"},{value:"emotional",label:"Emotional"},{value:"persuasive",label:"Persuasive"},{value:"supportive",label:"Supportive"},{value:"sarcastic",label:"Sarcastic"},{value:"condescending",label:"Condescending"},{value:"skeptical",label:"Skeptical"},{value:"narrative",label:"Narrative"},{value:"journalistic",label:"Journalistic"}],Fe=[{model:"davinci",price:.02},{model:"curie",price:.002},{model:"babbage",price:5e-4},{model:"ada",price:4e-4},{model:"dall-e",price:.02}];function Ge(e){return function(e){if(Array.isArray(e))return Me(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ze(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 ze(e,t){if(e){if("string"==typeof e)return Me(e,t);var n=Object.prototype.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)?Me(e,t):void 0}}function Me(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Be=wp.element,De=Be.useMemo,Ye=Be.useEffect,qe=Be.useState,We=function(e){var t=e.options.openai_apikey;return t&&t.length>0?null:React.createElement(React.Fragment,null,React.createElement(we.G,{style:{marginTop:0,marginBottom:25}},"To use the features of AI Engine, you need to have an OpenAI account and create an API Key. Visit the ",React.createElement("a",{href:"https://beta.openai.com/account/api-keys",target:"_blank"},"OpenAI")," website."))};function Ze(e){return e.split("\n").map((function(e){return(e=e.replace(/^\d+\.\s/,"")).startsWith('"')&&(e=e.slice(1)).endsWith('"')&&(e=e.slice(0,-1)),e})).join("\n")}var He,Ue,Ve,Je,$e=function(e){var t,n,r=(t=qe(Ne[0].value),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return c}}(t,n)||ze(t,n)||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.")}()),a=r[0],o=r[1],i=De((function(){var t,n=Ne,r="string"==typeof(null==e?void 0:e.extra_models)?null==e?void 0:e.extra_models:"",a=null!=e&&e.openai_finetunes&&(null==e?void 0:e.openai_finetunes.length)>0?null==e?void 0:e.openai_finetunes.filter((function(e){return e.enabled})):[];return a.length&&(n=[].concat(Ge(n),Ge(a.map((function(e){var t=e.model.split(":");return{id:e.model,name:e.suffix,short:"fn-"+t[0],description:"Finetuned",finetuned:!0}}))))),(r=null===(t=r)||void 0===t?void 0:t.split(",").filter((function(e){return e}))).length&&(n=[].concat(Ge(n),Ge(r.map((function(e){return{id:e,name:e,description:"Extra"}}))))),n}),[e]);return Ye((function(){var e=i.find((function(e){return e.name.includes("davinci")}));e&&o(e.name)}),[i]),{model:a,models:i,setModel:o}},Ke=n(3895);function Qe(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Xe=function(e){var t=e.title,n=void 0===t?"Settings":t;return React.createElement(y.B,{title:"AI Engine | ".concat(n),subtitle:"By Jordy Meow"},React.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},React.createElement(b._,{className:"header",icon:"",onClick:function(){return location.href="edit.php?page=mwai_content_generator"}},"Build Content"),React.createElement(b._,{className:"header",icon:"",onClick:function(){return location.href="edit.php?page=mwai_image_generator"}},"Build Images"),React.createElement(b._,{className:"header",icon:"",onClick:function(){return location.href="tools.php?page=mwai_dashboard"}},"Playground"),React.createElement(b._,{className:"header",icon:"tools",onClick:function(){return location.href="admin.php?page=mwai_settings"}},"Settings")))},et=((0,I.ZP)(b._)(He||(He=Qe(["\n"]))),I.ZP.div(Ue||(Ue=Qe(["\n display: flex;\n justify-content: unset;\n align-items: center;\n justify-content: space-between;\n padding: 0 0 2px 0;\n\n h2 {\n margin: 7px 0 0 0;\n padding: 0;\n }\n"])))),tt=I.ZP.div(Ve||(Ve=Qe(["\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(30%, 1fr));\n grid-template-rows: repeat(auto-fit, minmax(30%, 1fr));\n grid-gap: 10px;\n margin-top: 20px;\n\n img, div {\n width: 100%;\n cursor: pointer;\n }\n .empty-image {\n width: 100%;\n padding-bottom: 100%;\n background-color: #f5f5f5;\n }\n"]))),nt=(0,I.ZP)(Ke.l)(Je||(Je=Qe(["\n\n .neko-textarea {\n height: 76px;\n border: 1px solid #eaeaea !important;\n background: #fbfbfb !important;\n font-size: 15px !important;\n }\n"]))),rt=n(477),at=n(7460),ot=n.n(at),it=n(9995),ct=n(8178),lt=n(9378),ut=n(3103),st=n(2625),ft=n(3676),mt=n(776),ht=n(9746);function pt(e){return pt="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},pt(e)}function dt(e){return function(e){if(Array.isArray(e))return Et(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||wt(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 yt(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 vt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yt(Object(n),!0).forEach((function(t){gt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yt(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,t){if("object"!==pt(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==pt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===pt(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bt(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,a,o,i,c=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return c}}(e,t)||wt(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 wt(e,t){if(e){if("string"==typeof e)return Et(e,t);var n=Object.prototype.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)?Et(e,t):void 0}}function Et(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Rt(){Rt=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,a){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),c=new _(a||[]);return r(i,"_invoke",{value:E(e,n,c)}),i}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f={};function m(){}function h(){}function p(){}var d={};l(d,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==t&&n.call(v,o)&&(d=v);var g=p.prototype=m.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function a(r,o,i,c){var l=s(e[r],e,o);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==pt(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){a("next",e,i,c)}),(function(e){a("throw",e,i,c)})):t.resolve(f).then((function(e){u.value=e,i(u)}),(function(e){return a("throw",e,i,c)}))}c(l.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return{value:void 0,done:!0}}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var c=R(i,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=s(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}function R(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,f;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function O(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:S}}function S(){return{value:void 0,done:!0}}return h.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:h,configurable:!0}),h.displayName=l(p,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,l(e,c,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(w.prototype),l(w.prototype,i,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new w(u(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(g),l(g,c,"Generator"),l(g,o,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.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}},e.values=O,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):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),f},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),k(n),f}},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 a=r.arg;k(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function xt(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function kt(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){xt(o,r,a,i,c,"next",e)}function c(e){xt(o,r,a,i,c,"throw",e)}i(void 0)}))}}var _t=wp.element,Ot=_t.useState,St=_t.useMemo,Lt=_t.useRef,Pt=_t.useEffect,jt=[{accessor:"row",title:"#",width:15,verticalAlign:"top"},{accessor:"validPrompt",title:"",width:15,verticalAlign:"top"},{accessor:"prompt",title:"Prompt",width:"42%",verticalAlign:"top"},{accessor:"validCompletion",title:"",width:15,verticalAlign:"top"},{accessor:"completion",title:"Completion",width:"42%",verticalAlign:"top"},{accessor:"actions",title:"",width:55,align:"center"}],Tt=[{accessor:"status",title:"Status",sortable:!0},{accessor:"id",title:"ID"},{accessor:"filename",title:"File"},{accessor:"purpose",title:"Purpose"},{accessor:"filesize",title:"Size",sortable:!0},{accessor:"createdOn",title:"Date",sortable:!0},{accessor:"actions",title:""}],Ct=[{accessor:"status",title:"Status",sortable:!0},{accessor:"id",title:"ID"},{accessor:"suffix",title:"Suffix"},{accessor:"model",title:"Model"},{accessor:"base_model",title:"Based On"},{accessor:"createdOn",title:"Date",sortable:!0},{accessor:"actions",title:""}],Nt="\n\n###\n\n",It="\n\n",At=function(e){var t=e.status,n=e.includeText,r=void 0!==n&&n,a=it.ZP.orange,o=it.ZP.green,i=it.ZP.red,c=null;switch(t){case"pending":case"running":c=React.createElement(ct.J,{title:t,icon:"replay",spinning:!0,width:24,color:a});break;case"succeeded":case"processed":c=React.createElement(ct.J,{title:t,icon:"check-circle",width:24,color:o});break;case"failed":c=React.createElement(ct.J,{title:t,icon:"close",width:24,color:i});break;case"cancelled":c=React.createElement(ct.J,{title:t,icon:"close",width:24,color:a});break;default:c=React.createElement(ct.J,{title:t,icon:"alert",width:24,color:a})}return r?React.createElement("div",{style:{display:"flex",alignItems:"center"}},c,React.createElement("span",{style:{textTransform:"uppercase",fontSize:10,marginLeft:5}},t)):c},Ft=function(){var e=kt(Rt().mark((function e(){var t,n;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,E.PV)("".concat(_,"/openai_files"),{nonce:P});case 2:return n=e.sent,e.abrupt("return",null==n||null===(t=n.files)||void 0===t?void 0:t.data);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Gt=function(){var e=kt(Rt().mark((function e(){var t,n;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,E.PV)("".concat(_,"/openai_finetunes"),{nonce:P});case 2:return n=e.sent,e.abrupt("return",null==n||null===(t=n.finetunes)||void 0===t?void 0:t.data);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),zt=function(e){var t=e.children,n=e.data,r=e.onChange,a=void 0===r?function(){}:r,o=bt(Ot(!1),2),i=o[0],c=o[1],l=function(e){c(!1),e!==n&&a(e)};return i?React.createElement("div",{onKeyUp:function(e){"Escape"===e.key&&l(n)},style:{height:"100%",display:"flex",flexDirection:"column"}},React.createElement(Ke.l,{onBlurForce:!0,autoFocus:!0,fullHeight:!0,rows:3,style:{height:"100%"},onEnter:l,onBlur:l,value:n}),React.createElement(b._,{onClick:l,fullWidth:!0,style:{marginTop:5,height:35}},"Save")):React.createElement("pre",{style:{width:"100%",height:"100%",whiteSpace:"break-spaces",margin:0,padding:0,fontSize:13,fontFamily:"inherit"},onClick:function(){return c(!0)}},t)};const Mt=function(e){var t,n,r=e.options,a=e.updateOption,o=(0,u.NL)(),i=bt(Ot(),2),c=i[0],l=i[1],s=bt(Ot(!1),2),f=s[0],m=s[1],h=bt(Ot("finetunes"),2),p=h[0],d=h[1],y=bt(Ot(!0),2),v=y[0],g=y[1],w=$e(r),R=w.models,x=w.model,k=w.setModel,O=bt(Ot("meow"),2),S=O[0],L=O[1],j=(0,rt.a)({queryKey:["datasets"],queryFn:Ft}),T=j.isLoading,C=(j.error,j.data),N=(0,rt.a)({queryKey:["finetunes"],queryFn:Gt}),I=(N.isLoading,N.error,N.data),A=(null==r?void 0:r.openai_finetunes_deleted)||[],F=10,G=bt(Ot(!0),2),z=G[0],M=G[1],B=bt(Ot(1),2),D=B[0],Y=B[1],q=bt(Ot([]),2),W=q[0],Z=q[1],H=bt(Ot(""),2),U=H[0],V=H[1],J=St((function(){return W.length}),[W]),$=function(){var e=kt(Rt().mark((function e(){return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.invalidateQueries("datasets");case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),K=function(){var e=kt(Rt().mark((function e(){return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return m(!0),e.next=3,$();case 3:m(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Q=function(){var e=kt(Rt().mark((function e(){var t,n,r,a;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=c,n=S,r=R.find((function(e){return e.name===x})),m(!0),e.next=6,(0,E.PV)("".concat(_,"/openai_files_finetune"),{method:"POST",nonce:P,json:{fileId:t,model:r.short,suffix:n}});case 6:if(!(a=e.sent).success){e.next=15;break}return e.next=10,X();case 10:alert("Fine-tuning started! Check its progress in the 'Models' section. Depending on your dataset size, it may take a while (from a few minutes to days)."),d("finetunes"),l(),e.next=16;break;case 15:alert(a.message);case 16:m(!1);case 17:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),X=function(){var e=kt(Rt().mark((function e(){return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.invalidateQueries("finetunes");case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ee=function(){var e=kt(Rt().mark((function e(){return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return m(!0),e.next=3,X();case 3:m(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),te=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];e&&!confirm("This will delete all the rows in the builder. Are you sure?")||(Z([]),re([]))},ne=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=W.map((function(r,a){return a===e-1?vt(vt({},r),{},n?{completion:t}:{prompt:t}):r}));Z(r)};Pt((function(){if(!W||0===W.length){var e=localStorage.getItem("mwai_builder_data");e&&Z(JSON.parse(e))}}),[]);var re=function(e){!function(){var e=new Date,t=e.toLocaleDateString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit"});t=t.replace(/\//g,"."),t+="-"+e.getHours().toString().padStart(2,"0")+"."+e.getMinutes().toString().padStart(2,"0"),V("MEOW-".concat(t,".jsonl"))}();try{e?localStorage.setItem("mwai_builder_data",JSON.stringify(e)):localStorage.removeItem("mwai_builder_data"),M(!0)}catch(e){localStorage.removeItem("mwai_builder_data"),M(!1)}};Pt((function(){W&&W.length>0&&re(W)}),[W]);var ae=St((function(){var e=(D-1)*F,t=null==W?void 0:W.slice((D-1)*F,(D-1)*F+F);return null==t?void 0:t.map((function(t){var n,r,a=++e,o=null===(n=t.prompt)||void 0===n?void 0:n.endsWith(Nt),i=null===(r=t.completion)||void 0===r?void 0:r.endsWith(It);return{row:a,validPrompt:o?"�
3 ":"❌",prompt:React.createElement(zt,{data:t.prompt,onChange:function(e){return ne(a,e)}},o?t.prompt.substring(0,t.prompt.length-Nt.length):t.prompt),validCompletion:i?"�
4 ":"❌",completion:React.createElement(zt,{data:t.completion,onChange:function(e){return ne(a,e,!0)}},i?t.completion.substring(0,t.completion.length-It.length):t.completion),actions:React.createElement(b._,{rounded:!0,icon:"trash",onClick:function(){return function(e){var t=W.filter((function(t,n){return n!==e-1}));Z(t),0===t.length&&re([])}(a)}})}}))}),[W,D,F]),oe=function(){var e=kt(Rt().mark((function e(t){var n;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return m(!0),e.prev=1,e.next=4,(0,E.PV)("".concat(_,"/openai_files"),{method:"DELETE",nonce:P,json:{fileId:t}});case 4:if(!(n=e.sent).success){e.next=10;break}return e.next=8,$();case 8:e.next=11;break;case 10:alert(n.message);case 11:e.next=17;break;case 13:e.prev=13,e.t0=e.catch(1),console.log(e.t0),alert("Error! Check your console.");case 17:m(!1);case 18:case"end":return e.stop()}}),e,null,[[1,13]])})));return function(t){return e.apply(this,arguments)}}(),ie=function(){var e=kt(Rt().mark((function e(t){var n;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(confirm("You are going to delete this fine-tune. Are you sure?\n\nPlease note that it will take a while before it is actually deleted. This might be a temporary issue of OpenAI.")){e.next=2;break}return e.abrupt("return");case 2:return m(!0),e.prev=3,e.next=6,(0,E.PV)("".concat(_,"/openai_finetunes"),{method:"DELETE",nonce:P,json:{modelId:t}});case 6:if(!(n=e.sent).success){e.next=14;break}return e.next=10,a([].concat(dt(A),[t]),"openai_finetunes_deleted");case 10:return e.next=12,X();case 12:e.next=23;break;case 14:if(!(n.message.indexOf("does not exist")>-1)){e.next=22;break}return alert("This fine-tune was already deleted. It will be removed from the list."),e.next=18,a([].concat(dt(A),[t]),"openai_finetunes_deleted");case 18:return e.next=20,X();case 20:e.next=23;break;case 22:alert(n.message);case 23:e.next=29;break;case 25:e.prev=25,e.t0=e.catch(3),console.log(e.t0),alert("Error! Check your console.");case 29:m(!1);case 30:case"end":return e.stop()}}),e,null,[[3,25]])})));return function(t){return e.apply(this,arguments)}}(),ce=function(){var e=kt(Rt().mark((function e(t,n){var r,a,o,i;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return m(!0),e.prev=1,console.log({fileId:t,filename:n}),e.next=5,(0,E.PV)("".concat(_,"/openai_files_download"),{method:"POST",nonce:P,json:{fileId:t}});case 5:(r=e.sent).success?(console.log(r),a=new Blob([r.data],{type:"text/plain"}),o=window.URL.createObjectURL(a),(i=document.createElement("a")).setAttribute("href",o),i.setAttribute("download","".concat(n)),document.body.appendChild(i),i.click(),i.remove()):alert(r.message),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(1),console.log(e.t0),alert("Error! Check your console.");case 13:m(!1);case 14:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t,n){return e.apply(this,arguments)}}(),le=St((function(){return null==C?void 0:C.sort((function(e,t){return t.created_at-e.created_at})).map((function(e){var t=e.id,n=e.filename,r=new Date(1e3*e.created_at),a="fine-tune"===e.purpose;return{status:React.createElement(At,{status:e.status,includeText:!0}),id:t,filename:n,purpose:e.purpose,filesize:(0,E.td)(e.bytes),createdOn:r.toLocaleDateString()+" "+r.toLocaleTimeString(),actions:React.createElement(React.Fragment,null,React.createElement(b._,{disabled:!a,icon:"wand",onClick:function(){return l(t)}},"Train Model"),React.createElement(b._,{rounded:!0,icon:"arrow-down",onClick:function(){return ce(t,n)}}),React.createElement(b._,{className:"danger",rounded:!0,icon:"trash",onClick:function(){return oe(t)}}))}}))}),[C]),ue=St((function(){return I?I.sort((function(e,t){return t.created_at-e.created_at})).map((function(e){var t=e.fine_tuned_model,n=new Date(1e3*e.created_at);return{status:React.createElement(At,{status:e.status,includeText:!0}),id:e.id,suffix:e.suffix,model:e.fine_tuned_model,base_model:e.model,createdOn:n.toLocaleDateString()+" "+n.toLocaleTimeString(),actions:React.createElement(b._,{className:"danger",rounded:!0,icon:"trash",onClick:function(){return ie(t)}})}})):[]}),[I]),se=T||f,fe=function(){var e=kt(Rt().mark((function e(){var t,n;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return m(!0),e.prev=1,t=W.map((function(e){return JSON.stringify(e)})).join("\n"),console.log(t),e.next=6,(0,E.PV)("".concat(_,"/openai_files"),{method:"POST",nonce:P,json:{filename:U,data:t}});case 6:return n=e.sent,e.next=9,$();case 9:n.success?(te(!1),alert("Uploaded successfully! You can now train a model based on this dataset."),d("files"),g(!0)):alert(n.message),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(1),console.log(e.t0),alert("Error! Check your console.");case 16:m(!1);case 17:case"end":return e.stop()}}),e,null,[[1,12]])})));return function(){return e.apply(this,arguments)}}(),me=St((function(){var e=new Date,t=e.getFullYear(),n=e.getMonth()+1,r=e.getDate(),a=e.getHours(),o=e.getMinutes(),i=e.getSeconds(),c=R.find((function(e){return e.name===x}));return"".concat(null==c?void 0:c.short,":ft-your-org:").concat(S,"-").concat(t,"-").concat(n<10?"0"+n:n,"-").concat(r<10?"0"+r:r,"-").concat(a<10?"0"+a:a,"-").concat(o<10?"0"+o:o,"-").concat(i<10?"0"+i:i)}),[S,x]),he=function(){var e=kt(Rt().mark((function e(t){var n,r;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Rt().mark((function e(){var n,a,o,i,c;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t[r],a=new FileReader,o=n.name.endsWith(".json"),i=n.name.endsWith(".jsonl"),c=n.name.endsWith(".csv"),o||i||c){e.next=9;break}return alert("This only supports JSON, JSONL, and CSV files."),console.log(n),e.abrupt("return","continue");case 9:a.onload=function(){var e=kt(Rt().mark((function e(t){var n,r,a,l,u,s,f;return Rt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.target.result,r=[],o?r=JSON.parse(n):i?(a=n.split("\n"),r=a.map((function(e){e=e.trim();try{return JSON.parse(e)}catch(t){return console.log(t,e),null}}))):c&&(console.log("YO"),l=ot().parse(n,{header:!0,skipEmptyLines:!0}),r=l.data,console.log("The CSV was loaded.",r)),u=r.map((function(e){var t=Object.keys(e).reduce((function(t,n){return t[n.toLowerCase()]=e[n],t}),{}),n=["prompt","question","q"].find((function(e){return t[e]})),r=["completion","answer","a"].find((function(e){return t[e]}));return{prompt:t[n],completion:t[r]}})),s=u.filter((function(e){return e.prompt&&e.completion})),u.length!==s.length&&(alert("Some are were empty. Make sure the CSV has a header row and that the columns are named 'prompt' and 'completion'. For debugging, an empty line was logged to the console."),f=u.find((function(e){return!e.prompt||!e.completion})),console.log("Empty line: ",f)),Z(s);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),a.readAsText(n);case 11:case"end":return e.stop()}}),e)})),r=0;case 2:if(!(r<t.length)){e.next=10;break}return e.delegateYield(n(),"t0",4);case 4:if("continue"!==e.t0){e.next=7;break}return e.abrupt("continue",7);case 7:r++,e.next=2;break;case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),pe=Lt(null);return React.createElement(ge.H,{style:{margin:10}},React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement("div",{style:{marginRight:15}},React.createElement(lt.Q,{onLabel:"Model Finetune",offLabel:"Dataset Builder",width:145,onBackgroundColor:it.ZP.purple,offBackgroundColor:it.ZP.green,onChange:g,checked:v})),v&&React.createElement(ut.h,{value:p,busy:se,onChange:function(e){d(e)}},React.createElement(ut.S,{title:"Models",value:"finetunes",count:null!==(t=null==ue?void 0:ue.length)&&void 0!==t?t:null}),React.createElement(ut.S,{title:"Datasets",value:"files",count:null!==(n=null==le?void 0:le.length)&&void 0!==n?n:null})),v&&"finetunes"===p&&React.createElement(React.Fragment,null,React.createElement("div",{style:{flex:"auto"}}),React.createElement(b._,{disabled:f,onClick:ee,className:"primary"},"Refresh Models")),v&&"files"===p&&React.createElement(React.Fragment,null,React.createElement("div",{style:{flex:"auto"}}),React.createElement(b._,{disabled:f,onClick:K,className:"primary"},"Refresh Datasets")),!v&&React.createElement("div",{style:{display:"flex",alignItems:"center",width:"100%"}},React.createElement("div",{style:{display:"flex",alignItems:"center",background:"#ecf3ff",padding:"3px 3px 3px 8px",borderRadius:5,border:"1px solid #cce1ee"}},React.createElement("label",{style:{marginRight:10}},"Filename:"),React.createElement(ve.A,{disabled:!J||f,value:J?U:"",onChange:V,style:{width:210,marginRight:5}}),React.createElement(b._,{disabled:!J||f,icon:"upload",onClick:fe,className:"primary"},"Upload to OpenAI")),React.createElement("div",{style:{flex:"auto"}}),React.createElement(st.b,{ref:pe,onSelectFiles:he,accept:""},React.createElement(b._,{style:{marginLeft:5},onClick:function(){return pe.current.click()}},"Import File")))),v&&"finetunes"===p&&React.createElement(React.Fragment,null,React.createElement("p",null,"The AI models you have fine-tuned. To create more, visit ",React.createElement("b",null,"Datasets"),"."),React.createElement(ft.a,{alternateRowColor:!0,busy:se,data:ue,columns:Ct,emptyMessage:React.createElement(React.Fragment,null,"You do not have any fine-tuned jobs yet.")})),v&&"files"===p&&React.createElement(React.Fragment,null,React.createElement("p",null,"The datasets you have uploaded to OpenAI. To create a new dataset, switch from ",React.createElement("b",null,"Model Finetuner")," to ",React.createElement("b",null,"Dataset Builder"),". To train a new model, click on the ",React.createElement("i",null,"magic wand"),"."),React.createElement(ft.a,{alternateRowColor:!0,busy:se,data:le,columns:Tt,emptyMessage:React.createElement(React.Fragment,null,"You do not have any dataset files yet.")})),!v&&React.createElement(React.Fragment,null,React.createElement("p",null,"You can create your dataset by importing a file (two columns, in the CSV, JSON or JSONL format) or manually by clicking ",React.createElement("b",null,"Add Entry"),". To avoid losing your work, this data is kept in your browser's local storage. ",React.createElement("b",null,"This is actually complex, so learn how to write datasets by studying ",React.createElement("a",{href:"https://beta.openai.com/docs/guides/fine-tuning/conditional-generation",target:"_blank"},"case studies"),".")," Is your dataset ready? Modify the filename to your liking and click ",React.createElement("b",null,"Upload to OpenAI"),"! 😎"),!z&&React.createElement("p",{style:{color:it.ZP.red}},"Caution: The data is too large to be saved in your browser's local storage."),React.createElement("div",{style:{display:"flex"}},React.createElement(b._,{icon:"plus",onClick:function(){Z([].concat(dt(W),[{prompt:"Text...\n\n###\n\n",completion:"Text...\n\n"}]))},style:{paddingLeft:10,paddingRight:10}},"Add Entry"),React.createElement(b._,{icon:"wand",disabled:!0,onClick:function(){return alert("Coming soon! ✌️")}},"Generate Entries"),React.createElement(b._,{disabled:!J,className:"secondary",onClick:function(){var e=W.map((function(e){var t=e.prompt,n=e.completion;return t.endsWith(Nt)||(t+=Nt),n.endsWith(It)||(n+=It),{prompt:t,completion:n}}));Z(e)}},"Format with Defaults"),React.createElement(b._,{disabled:!J,className:"secondary",style:{marginLeft:5},onClick:function(){var e=ot().unparse(W),t=new Blob([e],{type:"text/csv"}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n;var a=new Date,o="".concat(a.getFullYear(),"-").concat(a.getMonth()+1,"-").concat(a.getDate(),"-WP.csv");r.download=o,document.body.appendChild(r),r.click(),document.body.removeChild(r)}},"Export as CSV"),React.createElement(b._,{disabled:!J,onClick:te,className:"danger"},"Reset Entries"),React.createElement("div",{style:{flex:"auto"}}),React.createElement(mt.Q,{currentPage:D,limit:F,total:J,onCurrentPageChanged:Y,onClick:Y})),React.createElement(ht.i,{height:20}),React.createElement(ft.a,{alternateRowColor:!0,busy:f,data:ae,columns:jt,emptyMessage:React.createElement(React.Fragment,null,"You can import a file, or create manually each entry by clicking ",React.createElement("b",null,"Add Entry"),".")}),React.createElement(ht.i,{height:20}),React.createElement("div",{style:{display:"flex",justifyContent:"end"}},React.createElement(mt.Q,{currentPage:D,limit:F,total:J,onCurrentPageChanged:Y,onClick:Y})),React.createElement(ht.i,{height:40,line:!0,style:{marginBottom:0}}),React.createElement("p",null,React.createElement("b",null,"Notes:")),React.createElement("p",null,"• The prompt and the completion should both end with their own special endings. By default, it is ",React.createElement("b",null,"\\n\\n===\\n\\n")," for the prompt, and ",React.createElement("b",null,"\\n\\n")," for the completion. The icon �
5 will be shown next to the prompt and/or completion when this format has been validated, and the ending will be hidden for clarity. I refer to this format (and models trained on it) by the term of ",React.createElement("b",null,"Casually Fine Tuned"),"."),React.createElement("p",null,"• ",React.createElement("b",null,"\\n")," is a line break. You can add line breaks by using ",React.createElement("b",null,"SHIFT+ENTER")," while editing."),React.createElement("p",null,"• The ",React.createElement("b",null,"Format with Defaults")," button will add the ",React.createElement("i",null,"Casually Fine Tuned")," endings format to the prompt and completion, if they are missing."),React.createElement("p",null,"• If you need the chatbot to work with a ",React.createElement("b",null,"Casually Fined Tuned")," model, you can add ",React.createElement("i",null,'casuallyFineTuned="true"')," in the parameter for the shortcode.")),React.createElement(Ee.L,{isOpen:c,title:"Train a new model",onOkClick:Q,onRequestClose:function(){return l()},onCancelClick:function(){return l()},ok:"Start",disabled:f,content:React.createElement(React.Fragment,null,React.createElement("p",null,"Exciting! 🎵 You are about to create your own new model, based on your dataset. You simply need to select a base model, and optionally, to modify the ",React.createElement("a",{href:"https://beta.openai.com/docs/guides/fine-tuning/hyperparameters",target:"_blank"},"hyperparameters"),". Before starting the process, make sure that:"),React.createElement("ul",null,React.createElement("li",null,"�
6 The dataset is well-defined."),React.createElement("li",null,"�
7 You understand ",React.createElement("a",{href:"https://openai.com/api/pricing/#faq-fine-tuning-pricing-calculation",target:"_blank"},"OpenAI pricing")," about fine-tuning.")),React.createElement("label",null,"Base model:"),React.createElement(ht.i,{height:5}),React.createElement(be.N,{id:"models",value:x,scrolldown:!0,onChange:k},R.map((function(e){return React.createElement(be.Z,{value:e.id,label:e.short?e.short:e.name})}))),React.createElement(ht.i,{height:5}),React.createElement("small",null,"For now, the hyperparameters can't be modified - they are set automatically by OpenAI."),React.createElement(ht.i,{height:10}),React.createElement("label",null,"Suffix (for new model name):"),React.createElement(ht.i,{height:5}),React.createElement(ve.A,{value:S,onChange:L}),React.createElement(ht.i,{height:5}),React.createElement("small",null,"The name of the new model name will be decided by OpenAI. You can customize it a bit with this ",React.createElement("a",{href:"https://beta.openai.com/docs/api-reference/fine-tunes/list#fine-tunes/create-suffix",target:"_blank"},"prefix"),". Preview: ",React.createElement("b",null,me),"."))}))};var Bt,Dt,Yt;function qt(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Wt=I.ZP.div(Bt||(Bt=qt(["\n background: white;\n padding: 15px;\n border-radius: 5px;\n\n h2 {\n margin-bottom: 8px;\n }\n \n h3:first-child {\n margin-top: 0;\n }\n\n label {\n display: block;\n margin-bottom: 5px;\n }\n\n label {\n margin-top: 10px;\n }\n\n li {\n margin-bottom: 10px;\n border: 1px solid #e5e5e5;\n padding: 10px;\n background: #f5f5f5;\n border-radius: 5px;\n cursor: pointer;\n transition: all 0.2s ease-in-out;\n }\n\n li.active {\n background: #037cba;\n color: white;\n border-color: #037cba;\n }\n\n .information {\n color: #a3a3a3;\n margin-top: 5px;\n font-size: 12px;\n line-height: 100%;\n }\n"]))),Zt=(0,I.ZP)(ve.A)(Dt||(Dt=qt(["\n flex: auto !important;\n\n input {\n height: 50px !important;\n font-size: 14px !important;\n font-family: monospace !important;\n padding: 20px 20px 20px 45px !important;\n border-color: #333d4e !important;\n background: #333d4e !important;\n color: white !important;\n }\n"]))),Ht=I.ZP.div(Yt||(Yt=qt(["\n display: flex;\n flex-direction: column;\n\n label {\n margin-bottom: 3px;\n }\n\n .mwai-builder-row {\n margin-top: 10px;\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n\n .mwai-builder-col {\n flex: 1;\n display: flex;\n flex-direction: column;\n margin-right: 5px;\n }\n\n .mwai-builder-col:last-child {\n margin-right: 0;\n }\n\n pre {\n white-space: pre-wrap;\n background: #d4f0ff;\n color: #037cba;\n padding: 10px;\n font-size: 13px;\n font-weight: bold;\n margin: 20px 0;\n }\n\n .neko-spacer {\n margin-bottom: 0 !important;\n }\n\n .neko-input {\n border: 1.5px solid #eaeaea !important;\n background: #fbfbfb !important;\n }\n\n .nui-select-option {\n border: 1.5px solid #eaeaea !important;\n background: #fbfbfb !important;\n }\n\n\n"])));function Ut(e){return Ut="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},Ut(e)}function Vt(){Vt=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,a){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),c=new _(a||[]);return r(i,"_invoke",{value:E(e,n,c)}),i}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f={};function m(){}function h(){}function p(){}var d={};l(d,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==t&&n.call(v,o)&&(d=v);var g=p.prototype=m.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function a(r,o,i,c){var l=s(e[r],e,o);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==Ut(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){a("next",e,i,c)}),(function(e){a("throw",e,i,c)})):t.resolve(f).then((function(e){u.value=e,i(u)}),(function(e){return a("throw",e,i,c)}))}c(l.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return{value:void 0,done:!0}}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var c=R(i,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=s(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}function R(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,f;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function O(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:S}}function S(){return{value:void 0,done:!0}}return h.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:h,configurable:!0}),h.displayName=l(p,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,l(e,c,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(w.prototype),l(w.prototype,i,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new w(u(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(g),l(g,c,"Generator"),l(g,o,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.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}},e.values=O,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):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),f},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),k(n),f}},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 a=r.arg;k(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function Jt(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 $t(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Jt(Object(n),!0).forEach((function(t){Kt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Kt(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Ut(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==Ut(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===Ut(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qt(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function Xt(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Qt(o,r,a,i,c,"next",e)}function c(e){Qt(o,r,a,i,c,"throw",e)}i(void 0)}))}}function en(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,a,o,i,c=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return tn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var nn=wp.element,rn=nn.useMemo,an=nn.useState;const on=function(){var e=en(an(j),2),t=e[0],n=e[1],r=en(an(!1),2),a=r[0],o=r[1],i=$e(t).models,c=null==t?void 0:t.shortcode_chat_default_params,l=null==t?void 0:t.shortcode_chat_params,u=null==t?void 0:t.shortcode_chat_params_override,s=null==t?void 0:t.shortcode_chat_inject,y=null==t?void 0:t.module_titles,k=null==t?void 0:t.module_excerpts,O=null==t?void 0:t.module_blocks,T=null==t?void 0:t.module_statistics,N=null==t?void 0:t.shortcode_chat,I=null==t?void 0:t.shortcode_chat_formatting,A=null!=t&&t.openai_apikey?null==t?void 0:t.openai_apikey:"",F=null==t?void 0:t.openai_usage,G=null==t?void 0:t.shortcode_chat_syntax_highlighting,z="chat"===l.mode,M="images"===l.mode,B=a,D=rn((function(){var e={};if(u)return e;for(var t in c)c[t]!==l[t]&&(e[t]=l[t]);return z&&(delete e.mode,delete e.max_results),M&&(delete e.context,delete e.content_aware,delete e.casually_fined_tuned,delete e.model,delete e.max_tokens,delete e.temperature),e}),[u,c,l]),Y=rn((function(){var e=[];for(var t in D)e.push("".concat(t,'="').concat(l[t],'"'));var n=e.join(" ");return"[mwai_chat"+(n?" ".concat(n):"")+"]"}),[D]),q=function(){var e=Xt(Vt().mark((function e(r,a){var i,c;return Vt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=$t($t({},t),{},Kt({},a,r)),o(!0),e.prev=2,e.next=5,(0,E.PV)("".concat(_,"/update_option"),{method:"POST",nonce:P,json:{options:i}});case 5:(c=e.sent).success&&n(c.options),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),e.t0.message&&alert(e.t0.message);case 12:return e.prev=12,o(!1),e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[2,9,12,15]])})));return function(t,n){return e.apply(this,arguments)}}(),W=function(){var e=Xt(Vt().mark((function e(t,n){var r;return Vt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=$t($t({},l),{},Kt({},n,t)),e.next=3,q(r,"shortcode_chat_params");case 3:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Z=function(){var e=Xt(Vt().mark((function e(){return Vt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,q(c,"shortcode_chat_params");case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),H=React.createElement(m.r,{title:"Assistants"},React.createElement(h.l,{max:"1"},React.createElement(p.P,{id:"module_titles",label:"Titles",value:"1",checked:y,description:"Suggest a few titles based on your content.",onChange:q}),React.createElement(p.P,{id:"module_excerpts",label:"Excerpt",value:"1",checked:k,description:"Suggest a few excerpts based on your content.",onChange:q}))),U=React.createElement(m.r,{title:"Blocks"},React.createElement(h.l,{max:"1"},React.createElement(p.P,{id:"module_blocks",label:"Enable",disabled:!0,value:"1",checked:O,description:"AI Forms, and others. Not available yet.",onChange:q}))),V=React.createElement(m.r,{title:"Statistics"},React.createElement(p.P,{id:"module_statistics",label:"Enable",value:"1",checked:T,requirePro:!0,isPro:L,description:"Track interaction with the AI based on the user, session, type, price, and various other factors. This allows to set limits, and more!",onChange:q})),J=React.createElement(m.r,{title:"Chatbot"},React.createElement(h.l,{max:"1"},React.createElement(p.P,{id:"shortcode_chat",label:"Enable",value:"1",checked:N,description:"A chatbot that can be similar to ChatGPT. But it has many features! Check the Chatbot tab.",onChange:q}))),$=React.createElement(m.r,{title:"Formatting"},React.createElement(h.l,{max:"1"},React.createElement(p.P,{id:"shortcode_chat_formatting",label:"Enable",value:"1",checked:I,description:React.createElement(React.Fragment,null,"Convert the reply from the AI into HTML. ",React.createElement("b",null,"Markdown is supported, so it is highly recommended to add 'Use Markdown.' in your context.")),onChange:q}))),K=React.createElement(m.r,{title:"Code"},React.createElement(h.l,{max:"1"},React.createElement(p.P,{id:"shortcode_chat_syntax_highlighting",label:"Use Syntax Highlighting",value:"1",checked:G,description:React.createElement(React.Fragment,null,"Add syntax coloring to the code written by the chatbot."),onChange:q}))),Q=React.createElement(m.r,{title:"API Key"},React.createElement(ve.A,{id:"openai_apikey",name:"openai_apikey",value:A,description:React.createElement(React.Fragment,null,"You can get your API Keys in your ",React.createElement("a",{href:"https://beta.openai.com/account/api-keys",target:"_blank"},"OpenAI Account"),"."),onBlur:q})),X=rn((function(){var e={};try{Object.keys(F).forEach((function(t){var n=F[t];e[t]||(e[t]={totalPrice:0,data:[]}),Object.keys(n).forEach((function(r){var a=n[r],o=0,c=i.find((function(e){return e.id===r}));if("dall-e"===r){var l=C.find((function(e){return"dall-e"===e.model})).options.find((function(e){return"1024x1024"===e.option})),u=a.images*l.price;return e[t].totalPrice+=u,void e[t].data.push({name:"dall-e",isImage:!0,usage:a.images,price:u})}if(c){var s=C.find((function(e){return e.model===c.short}));if(s){o=a.total_tokens/1e3*s.price,e[t].totalPrice+=o;var f=c?c.name:r;e[t].data.push({name:f,isImage:!1,usage:a.total_tokens,price:o})}else console.log("Cannot find price for model ".concat(r,"."))}else console.log("Cannot find model ".concat(r,"."))}))})),Object.keys(e).forEach((function(t){e[t].data.sort((function(e,t){return t.price-e.price}))}))}catch(e){console.log(e)}return React.createElement("ul",{style:{marginTop:2}},Object.keys(e).map((function(t,n){return React.createElement("li",{key:n},React.createElement("strong",null,"🗓️ ",t," (",e[t].totalPrice.toFixed(2),"$)"),React.createElement("ul",null,e[t].data.map((function(e,t){return React.createElement("li",{key:t,style:{marginTop:5,marginLeft:18}},React.createElement("strong",null,"• ",e.name),e.isImage&&": ".concat(e.usage," images"),!e.isImage&&": ".concat(e.usage," tokens"),e.price>0&&" (".concat(e.price.toFixed(2),"$)"))}))))})))}),[F,i]),ee=React.createElement("div",null,React.createElement("h3",null,"Usage"),React.createElement("div",{style:{marginTop:-10,marginBottom:10,fontSize:12}},"For the exact amounts, please check your ",React.createElement("a",{href:"https://beta.openai.com/account/usage",target:"_blank"},"OpenAI account"),". If you would like to have better control on the amounts, add conditions or set limits to the usage of the AI, consider ",React.createElement("a",{href:"https://meowapps.com/ai-engine/",target:"_blank"},"AI Engine Pro"),"."),!Object.keys(F).length&&React.createElement(f.O,{p:!0},"N/A"),F&&React.createElement(React.Fragment,null,X));return React.createElement(d.s,null,React.createElement(Xe,null),React.createElement(v.o,null,React.createElement(v.z,{full:!0},React.createElement(We,{options:t}),React.createElement(ge.H,null,React.createElement(f.O,{p:!0},"Boost your WordPress with AI! Don't forget to visit the ",React.createElement("a",{href:"https://meowapps.com/ai-engine/",target:"_blank"},"AI Engine website")," for more information. Have fun! 🎵")),React.createElement(g.c,{keepTabOnReload:!0},React.createElement(g.P,{title:"Settings"},React.createElement(v.o,null,React.createElement(v.z,{minimal:!0},React.createElement(w.v,{busy:B,title:"Modules",className:"primary"},J,H,V,U)),React.createElement(v.z,{minimal:!0},React.createElement(w.v,{busy:B,title:"Open AI",className:"primary"},Q,ee)))),N&&React.createElement(g.P,{title:"Chatbot"},React.createElement(v.o,null,React.createElement(v.z,{minimal:!0},React.createElement(w.v,{className:"primary"},React.createElement(f.O,{p:!0},React.createElement("p",null,"If you only need one chatbot, set your parameters in the Chatbot Builder, and click on ",React.createElement("b",null,"Set as Default Parameters"),". You can then use the shortcode ",React.createElement("b",null,"[mwai_chat]")," anywhere on your website. You can also add the chatbot everywhere automatically by using ",React.createElement("b",null,"Inject Default Chatbot"),"."),React.createElement("p",null,"Alternatively, you can also play with the params to create different shortcodes. You can have multiple chatbots on your website, or even the same page, each with different parameters. Play with them! 😎"))),React.createElement(w.v,{busy:B,title:"Features",className:"primary"},$,K)),React.createElement(v.z,{minimal:!0},React.createElement(w.v,{busy:B,title:"Chatbot Builder",className:"primary",action:React.createElement(b._,{className:"danger",onClick:Z},"Reset Parameters")},React.createElement(Ht,null,React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,"Mode:"),React.createElement(be.N,{scrolldown:!0,id:"mode",name:"mode",value:l.mode,onChange:W},React.createElement(be.Z,{value:"chat",label:"Chat"}),React.createElement(be.Z,{value:"images",label:"Images"}))),z&&React.createElement("div",{className:"mwai-builder-col",style:{flex:5}},React.createElement("label",null,"Context:"),React.createElement(ve.A,{id:"context",name:"context",value:l.context,onBlur:W})),M&&React.createElement("div",{className:"mwai-builder-col",style:{flex:5}},React.createElement("label",null,"Max Results (= Number of Images):"),React.createElement(ve.A,{id:"max_results",name:"max_results",type:"number",value:l.max_results,onBlur:W}))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,"AI Name:"),React.createElement(ve.A,{id:"ai_name",name:"ai_name",value:l.ai_name,onBlur:W})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,"User Name:"),React.createElement(ve.A,{id:"user_name",name:"user_name",value:l.user_name,onBlur:W})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,"System Name:"),React.createElement(ve.A,{id:"sys_name",name:"sys_name",value:l.sys_name,onBlur:W})),React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("label",null,"Placeholder:"),React.createElement(ve.A,{id:"text_input_placeholder",name:"text_input_placeholder",value:l.text_input_placeholder,onBlur:W})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,"Button:"),React.createElement(ve.A,{id:"text_send",name:"text_send",value:l.text_send,onBlur:W}))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{textAlign:"right",marginRight:10}},React.createElement("br",null),l.ai_name),React.createElement("div",{className:"mwai-builder-col",style:{flex:5}},React.createElement("label",null,"Start Sentence:"),React.createElement(ve.A,{id:"start_sentence",name:"start_sentence",value:l.start_sentence,onBlur:W}))),React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("label",null,"Style:"),React.createElement(be.N,{scrolldown:!0,id:"style",name:"style",value:l.style,description:"",onChange:W},React.createElement(be.Z,{value:"none",label:"None"}),React.createElement(be.Z,{value:"chatgpt",label:"ChatGPT"}))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,"Popup Window:"),React.createElement(p.P,{id:"window",label:"Yes",checked:l.window,value:"1",onChange:W})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,"Full Screen:"),React.createElement(p.P,{id:"fullscreen",label:"Yes",checked:l.fullscreen,value:"1",onChange:W})),z&&React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("label",null,"Content Aware:"),React.createElement(p.P,{id:"content_aware",label:"Yes",requirePro:!0,isPro:L,checked:l.content_aware,value:"1",onChange:W}))),z&&React.createElement("div",{className:"mwai-builder-row"},React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("label",null,"Model:"),React.createElement(be.N,{scrolldown:!0,id:"model",name:"model",value:l.model,description:"",onChange:W},i.map((function(e){return React.createElement(be.Z,{value:e.id,label:e.name})})))),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,"Max Tokens:"),React.createElement(ve.A,{id:"max_tokens",name:"max_tokens",type:"number",value:l.max_tokens,onBlur:W})),React.createElement("div",{className:"mwai-builder-col"},React.createElement("label",null,"Temperature:"),React.createElement(ve.A,{id:"temperature",name:"temperature",type:"number",step:"0.1",min:"0",max:"1",value:l.temperature,onBlur:W})),React.createElement("div",{className:"mwai-builder-col",style:{flex:2}},React.createElement("label",null,"Casually Fine Tuned:"),React.createElement(p.P,{id:"casually_fined_tuned",label:"Yes",checked:l.casually_fined_tuned,value:"1",onChange:W}))),React.createElement("pre",null,Y)),React.createElement(p.P,{id:"shortcode_chat_params_override",label:"Set as Default Parameters",disabled:Object.keys(D).length<1&&!u,value:"1",checked:u,description:"The parameters set above will be used by default. If you are using 'Popup Window' and many chatbots on the same page, be careful, as they will probably appear on top of each other.",onChange:q}),React.createElement(p.P,{id:"shortcode_chat_inject",label:"Inject Default Chatbot in Website",value:"1",checked:s,description:React.createElement(React.Fragment,null,React.createElement("span",null,"Inject the default chatbot automatically on your website. It will be available on every page."),l.window?"":React.createElement("span",null," It's highly recommended to enable 'Window (Popup Mode)'")),onChange:q}))))),React.createElement(g.P,{title:"Fine Tuning: Train your AI"},React.createElement(Mt,{options:t,updateOption:q})),React.createElement(g.P,{title:"License"},React.createElement(Ce,{domain:x,prefix:R,isPro:S,isRegistered:L}))))))};function cn(e){return cn="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},cn(e)}var ln;function un(){un=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,a){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),c=new _(a||[]);return r(i,"_invoke",{value:E(e,n,c)}),i}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f={};function m(){}function h(){}function p(){}var d={};l(d,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==t&&n.call(v,o)&&(d=v);var g=p.prototype=m.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function a(r,o,i,c){var l=s(e[r],e,o);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==cn(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){a("next",e,i,c)}),(function(e){a("throw",e,i,c)})):t.resolve(f).then((function(e){u.value=e,i(u)}),(function(e){return a("throw",e,i,c)}))}c(l.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return{value:void 0,done:!0}}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var c=R(i,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=s(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}function R(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,f;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function O(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:S}}function S(){return{value:void 0,done:!0}}return h.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:h,configurable:!0}),h.displayName=l(p,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,l(e,c,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(w.prototype),l(w.prototype,i,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new w(u(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(g),l(g,c,"Generator"),l(g,o,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.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}},e.values=O,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):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),f},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),k(n),f}},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 a=r.arg;k(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function sn(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function fn(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,a,o,i,c=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return mn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var hn,pn,dn=wp.element,yn=dn.useState,vn=dn.useEffect,gn=dn.useMemo,bn=[{id:"none",name:"None",mode:"query",temperature:.8,stopSequence:"",maxTokens:2048,description:""},{id:"casually_fined_tuned",name:"Casually Fined Tuned",mode:"query",temperature:.4,stopSequence:"\\n\\n",maxTokens:1024,description:"Hello! What's your name?\n\n###\n\n"},{id:"wp_assistant",name:"WordPress Assistant",mode:"chat",temperature:.8,stopSequence:"",maxTokens:150,description:"Converse as a WordPress expert. Be helpful, friendly, concise, avoid external URLs and commercial solutions.\n\n AI: Hi! How can I help you with WP today?"},{id:"article_translator",name:"Article Translator",mode:"query",temperature:.3,stopSequence:"",maxTokens:2048,description:"Translate this article into French:\n\nUchiko is located in Ehime prefecture, in the west of the island. The town was prosperous at the end of the 19th century thanks to its production of very good quality white wax. This economic boom allowed wealthy local merchants to build beautiful properties, whose heritage is still visible throughout the town.\n\n"},{id:"article_writer",name:"Article Writer",mode:"query",temperature:.8,stopSequence:"",maxTokens:2048,description:"Write an article about what to do in Paris, in summer, with a few recommendations of restaurants and cafes.\n\n"},{id:"bulk_articles_writer",name:"Bulk Articles Writer",mode:"query",temperature:.8,stopSequence:"",maxTokens:2048,description:"Write titles (TITLE: ) and very short paragraphs (CONTENT: ) for each following topic. Keywords for each topic will be added between parenthesis.\n\n - When to travel to France (seasons, food, ambiance, celebrations)\n - Why one should visit the French countryside (beach, forest, mountain, food, people)\n - Story of a night at Mont Saint-Michel (hotel, ambiance, sea, light)\n - Differences between South West and South East of France (people, food, beach, ambiance)\n"},{id:"article_corrector",name:"Article Corrector",mode:"query",temperature:.2,stopSequence:"",maxTokens:2048,description:"Fix the grammar and spelling mistakes in this text:\n\nI wake up at eleben yesderday, I will go bed eary tonigt.\n"},{id:"seo_assistant",name:"SEO Assistant",mode:"query",temperature:.6,stopSequence:"",maxTokens:1024,description:"For the following article, write a SEO-friendly and short title, keywords for Google, and a short excerpt to introduce it. Use this format:\n\n Title: \n Keywords: \n Excerpt: \n \n Uchiko is located in Ehime prefecture, in the west of the island. The town was prosperous at the end of the 19th century thanks to its production of very good quality white wax. This economic boom allowed wealthy local merchants to build beautiful properties, whose heritage is still visible throughout the town.\n "}],wn=I.ZP.textarea(ln||(hn=["\n display: block;\n height: 460px;\n width: 100%;\n margin-bottom: 10px;\n background: #333d4e;\n border-radius: 5px;\n border: none;\n color: #d1d5dc;\n font-size: 14px;\n font-family: monospace;\n padding: 20px;\n"],pn||(pn=hn.slice(0)),ln=Object.freeze(Object.defineProperties(hn,{raw:{value:Object.freeze(pn)}}))));const En=function(){var e=fn(yn(),2),t=e[0],n=e[1],r=fn(yn(),2),a=r[0],o=r[1],i=fn(yn("chat"),2),c=i[0],l=i[1],u=fn(yn(""),2),s=u[0],m=u[1],h=$e(j),p=h.models,y=h.model,g=h.setModel,w=fn(yn(1),2),R=w[0],x=w[1],k=fn(yn(!1),2),O=k[0],S=k[1],L=fn(yn({prompt_tokens:0,completion_tokens:0,total_tokens:0}),2),C=L[0],N=L[1],I=fn(yn({prompt_tokens:0,completion_tokens:0,total_tokens:0}),2),A=I[0],F=I[1],G=fn(yn(bn[2]),2),z=G[0],M=G[1],B=fn(yn(""),2),D=B[0],Y=B[1],q=fn(yn(2048),2),W=q[0],Z=q[1];vn((function(){var e=z.description.split("\n").map((function(e){return e.trim()}));e=e.join("\n"),o(e),Y(z.stopSequence),x(z.temperature),Z(z.maxTokens),l(z.mode)}),[z]);var H=function(){var e,t=(e=un().mark((function e(){var t,r,i,c,l=arguments;return un().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]?l[0]:a,S(!0),r=D.replace(/\\n/g,"\n"),e.next=5,(0,E.PV)("".concat(_,"/make_completions"),{method:"POST",nonce:P,json:{env:"playground",session:T,prompt:t,temperature:R,model:y,maxTokens:W,stop:r}});case 5:i=e.sent,console.log("Completions",{prompt:t,result:i}),i.success?(o(t+"\n"+i.data),F(i.usage),c={prompt_tokens:C.prompt_tokens+i.usage.prompt_tokens,completion_tokens:C.completion_tokens+i.usage.completion_tokens,total_tokens:C.total_tokens+i.usage.total_tokens},N(c)):n(i.message),S(!1);case 9:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){sn(o,r,a,i,c,"next",e)}function c(e){sn(o,r,a,i,c,"throw",e)}i(void 0)}))});return function(){return t.apply(this,arguments)}}(),U=gn((function(){var e=0,t=0,n=Fe.find((function(e){return y&&y.includes(e.model)}));return n&&(e=(C.total_tokens/1e3*n.price).toFixed(4),t=(A.total_tokens/1e3*n.price).toFixed(4)),{sessionPrice:e,lastRequestPrice:t}}),[C,A]),V=U.sessionPrice,J=U.lastRequestPrice;return React.createElement(d.s,{nekoErrors:[]},React.createElement(Xe,{title:"Playground"}),React.createElement(v.o,null,React.createElement(v.z,{full:!0},React.createElement(We,{options:j}),React.createElement(ge.H,{style:{marginBottom:0}},React.createElement(f.O,{p:!0},"Welcome to the AI Playground! Here, you can play with different AI models and ask the UI to perform various tasks for you. You can ask it to write, rewrite, or translate an article, categorize words or elements into groups, write an email, etc. ",React.createElement("b",null,"Let me know if there are any new features you would like to see!")," Have fun 🥳"))),React.createElement(v.z,null,React.createElement(Wt,null,React.createElement("h3",{style:{marginTop:0}},"Templates"),React.createElement("ul",null,bn.map((function(e){return React.createElement("li",{className:z.id===e.id?"active":"",onClick:function(){M(e)}},e.name)}))),React.createElement("h3",{style:{marginTop:0}},"Mode"),React.createElement(be.N,{scrolldown:!0,id:"mode",name:"mode",disabled:!0,value:c,description:"",onChange:l},React.createElement(be.Z,{key:"chat",id:"chat",value:"chat",label:"Chat"}),React.createElement(be.Z,{key:"query",id:"query",value:"query",label:"Query"})))),React.createElement(v.z,{style:{flex:3}},React.createElement(wn,{onChange:function(e){o(e.target.value)},value:a}),"chat"===c&&React.createElement("div",{style:{display:"flex"}},React.createElement("span",{class:"dashicons dashicons-format-chat",style:{position:"absolute",color:"white",zIndex:200,fontSize:28,marginTop:12,marginLeft:10}}),React.createElement(Zt,{id:"entry",value:s,onChange:m,onEnter:function(){var e=a+"\nHuman: "+s;o(e),m(""),H(e)},disabled:O})),"chat"!==c&&React.createElement("div",{style:{display:"flex"}},React.createElement(b._,{onClick:function(){o(z.description)},disabled:O,style:{height:50,fontSize:14,flex:1}},"Reset"),React.createElement(b._,{onClick:function(){H()},disabled:O,style:{height:50,fontSize:14,flex:4}},"Submit"))),React.createElement(v.z,null,React.createElement(Wt,null,React.createElement("h3",null,"Settings"),React.createElement("label",null,"Model:"),React.createElement(be.N,{id:"models",value:y,scrolldown:!0,onChange:g},p.map((function(e){return React.createElement(be.Z,{value:e.id,label:e.name})}))),React.createElement("label",null,"Temperature:"),React.createElement(ve.A,{id:"temperature",name:"temperature",value:R,type:"number",onBlur:function(e){return x(parseFloat(e))},description:React.createElement(React.Fragment,null,React.createElement("span",{style:{color:R>=0&&R<=1?"inherit":"red"}},"Between 0 and 1. Higher values means the model will take more risks."))}),React.createElement("label",null,"Max Tokens:"),React.createElement(ve.A,{id:"maxTokens",name:"maxTokens",value:W,type:"number",onBlur:function(e){return Z(parseInt(e))},description:React.createElement(React.Fragment,null,React.createElement("span",null,"The maximum number of tokens to generate. The model will stop generating once it hits this limit."))}),React.createElement("label",null,"Stop Sequence:"),React.createElement(ve.A,{id:"stopSequence",name:"stopSequence",value:D,type:"text",onChange:Y,onBlur:Y,description:React.createElement(React.Fragment,null,React.createElement("span",null,"The sequence of tokens that will cause the model to stop generating text. You absolutely need this with your own models."))})),React.createElement(Wt,{style:{marginTop:20}},React.createElement("h3",null,"Usage"),React.createElement("p",null,"Keeps track of the current usage of the AI."),React.createElement("h4",null,"Session"),React.createElement("div",null,"Tokens: ",C.total_tokens),React.createElement("div",null,"Price: $",V),React.createElement("h4",null,"Last Request"),React.createElement("div",null,"Tokens: ",A.total_tokens),React.createElement("div",null,"Price: $",J),React.createElement(b._,{style:{marginTop:10,width:"100%"},onClick:function(){N({prompt_tokens:0,completion_tokens:0,total_tokens:0}),F({prompt_tokens:0,completion_tokens:0,total_tokens:0})}},"Reset Usage")))),React.createElement(Ee.L,{isOpen:t,onRequestClose:function(){n()},onOkClick:function(){n()},title:"Error",content:React.createElement("p",null,t)}))};var Rn,xn,kn=n(5307);function _n(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var On=I.ZP.div(Rn||(Rn=_n(["\n margin-bottom: 5px;\n"]))),Sn=I.ZP.div(xn||(xn=_n(["\n margin-top: 15px;\n padding: 15px;\n font-size: 14px;\n cursor: pointer;\n border-radius: 15px;\n background: #dbf2ff;\n line-height: 120%;\n\n &:hover {\n background: #037cba;\n color: white;\n }\n"])));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 Pn(){Pn=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,a){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),c=new _(a||[]);return r(i,"_invoke",{value:E(e,n,c)}),i}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f={};function m(){}function h(){}function p(){}var d={};l(d,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==t&&n.call(v,o)&&(d=v);var g=p.prototype=m.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function a(r,o,i,c){var l=s(e[r],e,o);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==Ln(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){a("next",e,i,c)}),(function(e){a("throw",e,i,c)})):t.resolve(f).then((function(e){u.value=e,i(u)}),(function(e){return a("throw",e,i,c)}))}c(l.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return{value:void 0,done:!0}}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var c=R(i,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=s(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}function R(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,f;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function O(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:S}}function S(){return{value:void 0,done:!0}}return h.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:h,configurable:!0}),h.displayName=l(p,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,l(e,c,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(w.prototype),l(w.prototype,i,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new w(u(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(g),l(g,c,"Generator"),l(g,o,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.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}},e.values=O,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):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),f},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),k(n),f}},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 a=r.arg;k(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function jn(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function Tn(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){jn(o,r,a,i,c,"next",e)}function c(e){jn(o,r,a,i,c,"throw",e)}i(void 0)}))}}function Cn(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,a,o,i,c=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Nn(e,t);var n=Object.prototype.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)?Nn(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 Nn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var In=wp.element,An=In.useState,Fn=In.useEffect,Gn=In.useMemo;const zn=function(e){var t=e.post,n=e.onTitleClick,r=void 0===n?{}:n,a=e.onClose,o=void 0===a?{}:a,i=Cn(An([]),2),c=i[0],l=i[1],u=Cn(An(!1),2),s=u[0],f=u[1],m=Cn(An(!1),2),h=m[0],p=m[1];Fn((function(){t&&d(t)}),[t]);var d=function(){var e=Tn(Pn().mark((function e(t){var n,r;return Pn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.postId,t.postTitle,f(!0),e.next=4,(0,E.PV)("".concat(_,"/make_titles"),{method:"POST",nonce:P,json:{postId:n}});case 4:(r=e.sent).success&&l(r.data),f(!1);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),y=function(){var e=Tn(Pn().mark((function e(t){return Pn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.prev=1,e.next=4,r(t);case 4:g(),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),p(e.t0.message);case 10:f(!1);case 11:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(t){return e.apply(this,arguments)}}(),g=function(){var e=Tn(Pn().mark((function e(){return Pn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o(),l([]),p(),f(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),b=Gn((function(){return s?React.createElement(kn.S,{type:"circle",size:"10%"}):h?React.createElement(React.Fragment,null,"Error: ",h):(null==c?void 0:c.length)>0?React.createElement(React.Fragment,null,"Pick a new title by clicking on it.",React.createElement(On,null,c.map((function(e){return React.createElement(Sn,{key:e,onClick:function(){y(e)}},e)})))):React.createElement(React.Fragment,null,"Nothing to display.")}),[s,c,h]);return React.createElement(v.o,null,React.createElement(Ee.L,{isOpen:t,onRequestClose:g,title:'New title for "'.concat(null==t?void 0:t.postTitle,'"'),content:b,ok:"Close",onOkClick:g}))};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 Bn(){Bn=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,a){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),c=new _(a||[]);return r(i,"_invoke",{value:E(e,n,c)}),i}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f={};function m(){}function h(){}function p(){}var d={};l(d,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==t&&n.call(v,o)&&(d=v);var g=p.prototype=m.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function a(r,o,i,c){var l=s(e[r],e,o);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==Mn(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){a("next",e,i,c)}),(function(e){a("throw",e,i,c)})):t.resolve(f).then((function(e){u.value=e,i(u)}),(function(e){return a("throw",e,i,c)}))}c(l.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return{value:void 0,done:!0}}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var c=R(i,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=s(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}function R(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,f;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function O(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:S}}function S(){return{value:void 0,done:!0}}return h.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:h,configurable:!0}),h.displayName=l(p,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,l(e,c,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(w.prototype),l(w.prototype,i,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new w(u(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(g),l(g,c,"Generator"),l(g,o,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.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}},e.values=O,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):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),f},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),k(n),f}},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 a=r.arg;k(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function Dn(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function Yn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var qn=wp.element,Wn=qn.useState,Zn=qn.useEffect;qn.useMemo;const Hn=function(){var e,t,n=(e=Wn(),t=2,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,a,o,i,c=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Yn(e,t);var n=Object.prototype.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)?Yn(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.")}()),r=n[0],a=n[1];Zn((function(){document.querySelectorAll(".mwai-link-title").forEach((function(e){var t=e.getAttribute("data-id"),n=e.getAttribute("data-title");e.addEventListener("click",(function(){a({postId:t,postTitle:n})}),!1)}))}),[]);var o=function(){var e,t=(e=Bn().mark((function e(t){var n,o,i,c;return Bn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,E.PV)("".concat(_,"/update_post_title"),{method:"POST",nonce:P,json:{postId:r.postId,title:t}});case 2:if((n=e.sent).success){e.next=7;break}throw new Error(n.message);case 7:a(),(o=document.querySelector('tr[id="post-'.concat(r.postId,'"]')))&&(i=o.querySelector(".row-title"))&&(i.innerHTML=t),(c=o.querySelector(".hidden .post_title"))&&(c.innerHTML=t);case 12:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Dn(o,r,a,i,c,"next",e)}function c(e){Dn(o,r,a,i,c,"throw",e)}i(void 0)}))});return function(e){return t.apply(this,arguments)}}();return React.createElement(v.o,null,React.createElement(zn,{post:r,onTitleClick:o,onClose:function(){a()}}))};function Un(e){return Un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Un(e)}function Vn(){Vn=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,a){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),c=new _(a||[]);return r(i,"_invoke",{value:E(e,n,c)}),i}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f={};function m(){}function h(){}function p(){}var d={};l(d,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==t&&n.call(v,o)&&(d=v);var g=p.prototype=m.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function a(r,o,i,c){var l=s(e[r],e,o);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==Un(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){a("next",e,i,c)}),(function(e){a("throw",e,i,c)})):t.resolve(f).then((function(e){u.value=e,i(u)}),(function(e){return a("throw",e,i,c)}))}c(l.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return{value:void 0,done:!0}}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var c=R(i,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=s(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}function R(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,f;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function O(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:S}}function S(){return{value:void 0,done:!0}}return h.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:h,configurable:!0}),h.displayName=l(p,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,l(e,c,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(w.prototype),l(w.prototype,i,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new w(u(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(g),l(g,c,"Generator"),l(g,o,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.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}},e.values=O,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):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),f},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),k(n),f}},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 a=r.arg;k(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function Jn(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function $n(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Jn(o,r,a,i,c,"next",e)}function c(e){Jn(o,r,a,i,c,"throw",e)}i(void 0)}))}}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,a,o,i,c=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Qn(e,t);var n=Object.prototype.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=new Array(t);n<t;n++)r[n]=e[n];return r}var Xn=wp.element,er=Xn.useState,tr=Xn.useEffect,nr=Xn.useMemo,rr=[{id:"none",name:"None",model:"text-davinci-003",temperature:.6,maxTokens:2048},{id:"best-villages-france",name:"Best Villages in France",topic:"The best villages in France. Food, spring, summer, beach, wine. Recommendation of activities."}],ar=(null==j?void 0:j.languages)||[],or=Object.keys(ar).map((function(e){return{value:e,label:ar[e]}}));const ir=function(){var e=Kn(er(),2),t=e[0],n=e[1],r=Kn(er(rr[0]),2),a=r[0],o=r[1],i=Kn(er(""),2),c=i[0],l=i[1],u=Kn(er(""),2),s=u[0],m=u[1],h=Kn(er(2),2),p=h[0],y=h[1],g=Kn(er(""),2),w=g[0],R=g[1],x=Kn(er(1),2),k=x[0],O=x[1],S=Kn(er(""),2),L=S[0],C=S[1],N=$e(j),I=N.models,A=N.model,F=N.setModel,G=Kn(er(""),2),z=G[0],M=G[1],B=Kn(er("en"),2),D=B[0],Y=B[1],q=Kn(er("creative"),2),W=q[0],Z=q[1],H=Kn(er("cheerful"),2),U=H[0],V=H[1],J=Kn(er('Write a title for an article about "[**TOPIC**]" in [**LANGUAGE**]. Style: [**WRITING-STYLE**]. Tone: [**WRITING-TONE**]. Must be between 40 and 60 characters.'),2),$=J[0],K=J[1],Q=Kn(er('Write [**HEADING-COUNT**] consecutive headings for an article about "[**TITLE**]", in [**LANGUAGE**]. Style: [**WRITING-STYLE**]. Tone: [**WRITING-TONE**].\n\nEach heading is between 40 and 60 characters.\n\nUse Markdown for the headings (## ).'),2),X=Q[0],ee=Q[1],te=Kn(er('Write an article about "[**TITLE**]" in [**LANGUAGE**]. The article is organized by the following headings:\n\n[**HEADS**]\n\nWrite [**PARAGRAPHS_PER_HEAD**] paragraphs per heading.\n\nUse Markdown for formatting.\n\nAdd an introduction prefixed by "===INTRO: ", and a conclusion prefixed by "===OUTRO: ".\n\nStyle: [**WRITING-STYLE**]. Tone: [**WRITING-TONE**].'),2),ne=te[0],re=te[1],ae=Kn(er('Write a short, SEO-friendly excerpt for en article about "[**TITLE**]"'),2),oe=ae[0],ie=ae[1],ce=Kn(er(.6),2),le=ce[0],ue=ce[1],se=Kn(er(2048),2),fe=se[0],me=se[1],he=Kn(er(!1),2),pe=he[0],de=he[1],ye=Kn(er(!1),2),ge=ye[0],we=ye[1],Re=Kn(er(!1),2),xe=Re[0],ke=Re[1],_e=Kn(er(),2),Oe=_e[0],Se=_e[1],Le=nr((function(){return function(e){var t=e.split(" ").length,n=e.length,r=[];if(n)return t<3?r.push("The title is too short. It should be at least 3 words."):t>8?r.push("The title is too long. It should be no more than 8 words."):n<40?r.push("The title is too short. It should be at least 40 characters."):n>70&&r.push("The title is too long. It should be no more than 70 characters."),r.join(" ")}(c)}),[c]),Pe=nr((function(){return or.find((function(e){return e.value===D})).label}));tr((function(){m(a.topic)}),[a]);var je=function(e){return $.replace("[**TOPIC**]",e).replace("[**LANGUAGE**]",Pe).replace("[**WRITING-STYLE**]",W).replace("[**WRITING-TONE**]",U)},Te=function(e){return X.replace("[**HEADING-COUNT**]",p).replace("[**TITLE**]",e).replace("[**LANGUAGE**]",Pe).replace("[**WRITING-STYLE**]",W).replace("[**WRITING-TONE**]",U)},Ce=function(e,t){return ne.replace("[**TITLE**]",e).replace("[**LANGUAGE**]",Pe).replace("[**HEADS**]",t).replace("[**PARAGRAPHS_PER_HEAD**]",k).replace("[**WRITING-STYLE**]",W).replace("[**WRITING-TONE**]",U)},Ne=function(e){return oe.replace("[**TITLE**]",e)},Fe=function(){var e=$n(Vn().mark((function e(){var t,r,a,o=arguments;return Vn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:prompt,e.next=3,(0,E.PV)("".concat(_,"/make_completions"),{method:"POST",nonce:P,json:{env:"admin-tools",session:T,prompt:t,temperature:le,maxTokens:2048,model:A}});case 3:if(r=e.sent,console.log("Data:",{prompt:t,result:r}),!r.success){e.next=9;break}return(a=r.data).startsWith('"')&&a.endsWith('"')&&(a=a.substring(1,a.length-1)),e.abrupt("return",a);case 9:return n(r.message),e.abrupt("return",null);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ge=function(){var e=$n(Vn().mark((function e(){var t,n,r;return Vn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return de(!0),t=je(s),e.next=4,Fe(t);case 4:if(n=e.sent,de(!1),!n){e.next=18;break}return l(n),e.next=10,ze(n);case 10:if(!(r=e.sent)){e.next=18;break}return e.next=14,Me(n,r);case 14:if(!e.sent){e.next=18;break}return e.next=18,Be(n);case 18:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ze=function(){var e=$n(Vn().mark((function e(){var t,n,r,a=arguments;return Vn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:c){e.next=4;break}return alert("Title is missing!"),e.abrupt("return");case 4:return de(!0),R(""),n=Te(t),e.next=9,Fe(n);case 9:return(r=Ze(r=e.sent))&&R(r),de(!1),e.abrupt("return",r);case 14:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Me=function(){var e=$n(Vn().mark((function e(){var t,n,r,a,o=arguments;return Vn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]?o[0]:c,n=o.length>1&&void 0!==o[1]?o[1]:w,t){e.next=5;break}return alert("Title is missing!"),e.abrupt("return");case 5:if(n){e.next=8;break}return alert("Headings are missing!"),e.abrupt("return");case 8:return de(!0),C(""),r=Ce(t,n),e.next=13,Fe(r);case 13:return(a=e.sent)&&(a=(a=(a=(a=(a=(a=a.replace(/^===INTRO:\n/,"")).replace(/^===INTRO: \n/,"")).replace(/===INTRO: /,"")).replace(/===OUTRO:\n/,"")).replace(/===OUTRO: \n/,"")).replace(/===OUTRO: /,""),C(a)),de(!1),e.abrupt("return",a);case 17:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Be=function(){var e=$n(Vn().mark((function e(){var t,n,r,a=arguments;return Vn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:c){e.next=4;break}return alert("Title is missing!"),e.abrupt("return");case 4:return de(!0),M(""),n=Ne(t),e.next=9,Fe(n);case 9:return(r=e.sent)&&M(r),de(!1),e.abrupt("return",r);case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),De=function(){var e=$n(Vn().mark((function e(){var t;return Vn().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return de(!0),e.next=3,(0,E.PV)("".concat(_,"/create_post"),{method:"POST",nonce:P,json:{title:c,headings:w,content:L,excerpt:z,language:D}});case 3:t=e.sent,de(!1),t.success?Se(t.postId):n(t.message);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ye=function(){l(""),R(""),C(""),M(""),Se()};return React.createElement(d.s,{nekoErrors:[]},React.createElement(Xe,{title:"Content Generator"}),React.createElement(v.o,null,React.createElement(v.z,{full:!0},React.createElement(We,{options:j}),React.createElement(f.O,{p:!0,style:{marginTop:0,marginBottom:0}},React.createElement("b",null,"Write a Topic (followed by a few keywords), and click Generate All. That's it!")," You can also write a Title, generate the Sections, Content, and Excerpt separately (while modifying what was generated previously) to perfect the results. Use the Create Post button when you're happy with the result. You can also modify the prompts that are used by the AI. Don't hesitate to join us on the ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/support/plugin/ai-engine/"},"Support Forums"),". Let's make this better together! 💕")),React.createElement(v.z,{style:{flex:1}},React.createElement(Wt,{style:{marginBottom:25}},React.createElement("h2",{style:{marginTop:0}},"Topic"),React.createElement(Ke.l,{disabled:pe,value:s,onChange:m,rows:5}),React.createElement(ht.i,null),React.createElement(b._,{fullWidth:!0,disabled:!s||pe,onClick:Ge},"Generate All")),React.createElement(Wt,{style:{marginBottom:25}},React.createElement("h3",{style:{marginTop:0}},"Templates"),React.createElement("ul",null,rr.map((function(e){return React.createElement("li",{className:a.id===e.id?"active":"",onClick:function(){o(e)}},e.name)}))),React.createElement("div",null,"Soon, you'll be able to create templates and re-use them easily."))),React.createElement(v.z,{style:{flex:3}},React.createElement(Wt,{style:{marginBottom:25}},React.createElement("h2",{style:{marginTop:0}},"Title"),React.createElement(ve.A,{disabled:pe,value:c,onChange:l}),Le&&React.createElement("div",{className:"information"},"Advice: ",Le),React.createElement(ht.i,{height:20}),React.createElement(et,null,React.createElement("h2",null,"Sections"),React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement("label",{style:{margin:"0 5px 0 0"}},"# of Sections: "),React.createElement(be.N,{scrolldown:!0,id:"headingsCount",disabled:!c||pe,style:{marginRight:10},value:p,description:"",onChange:y},React.createElement(be.Z,{key:2,id:2,value:2,label:2}),React.createElement(be.Z,{key:3,id:3,value:3,label:3}),React.createElement(be.Z,{key:4,id:4,value:4,label:4}),React.createElement(be.Z,{key:6,id:6,value:6,label:6}),React.createElement(be.Z,{key:8,id:8,value:8,label:8}),React.createElement(be.Z,{key:10,id:10,value:10,label:10}),React.createElement(be.Z,{key:12,id:12,value:12,label:12})),React.createElement(b._,{disabled:!c,isBusy:pe,onClick:function(){return ze()}},"Generate Sections"))),React.createElement(ht.i,{height:20}),React.createElement(Ke.l,{disabled:pe,rows:4,value:w,onBlur:R}),React.createElement("div",{className:"information"},'Add, rewrite, remove, or reorganize those sections as you wish before clicking "Generate Content". I recommend using Markdown.'),React.createElement(ht.i,{height:20}),React.createElement(et,null,React.createElement("h2",null,"Content"),React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement("label",{style:{margin:"0 5px 0 0"}},"# of Paragraphs per Section: "),React.createElement(be.N,{scrolldown:!0,id:"paragraphsCount",disabled:!c||pe,style:{marginRight:10},value:k,description:"",onChange:O},React.createElement(be.Z,{key:1,id:1,value:1,label:1}),React.createElement(be.Z,{key:2,id:2,value:2,label:2}),React.createElement(be.Z,{key:3,id:3,value:3,label:3}),React.createElement(be.Z,{key:4,id:4,value:4,label:4}),React.createElement(be.Z,{key:6,id:6,value:6,label:6}),React.createElement(be.Z,{key:8,id:8,value:8,label:8}),React.createElement(be.Z,{key:10,id:10,value:10,label:10})),React.createElement(b._,{disabled:!c,isBusy:pe,onClick:function(){return Me()}},"Generate Content"))),React.createElement(ht.i,{height:20}),React.createElement(Ke.l,{disabled:pe,rows:18,value:L,onBlur:C}),React.createElement("div",{className:"information"},'You can modify the content before using "Create Post". Markdown is supported, and will be converted to HTML when the post is created.'),React.createElement(ht.i,{height:20}),React.createElement(et,null,React.createElement("h2",null,"Excerpt"),React.createElement(b._,{disabled:!c,isBusy:pe,onClick:function(){return Be()}},"Generate Excerpt")),React.createElement(ht.i,{height:20}),React.createElement(Ke.l,{disabled:pe,value:z,onBlur:M,rows:3}),React.createElement(ht.i,{height:20}),React.createElement(b._,{fullWidth:!0,style:{height:60},onClick:De,isBusy:pe,disabled:!c||!L},"Create Post"))),React.createElement(v.z,null,React.createElement(Wt,{style:{marginBottom:25}},React.createElement("h2",{style:{marginTop:0}},"Content Params"),React.createElement("label",null,"Language:"),React.createElement(be.N,{scrolldown:!0,id:"language",name:"language",disabled:pe,value:D,description:"",onChange:Y},or.map((function(e){return React.createElement(be.Z,{key:e.value,id:e.value,value:e.value,label:e.label})}))),React.createElement("label",null,"Writing style:"),React.createElement(be.N,{scrolldown:!0,id:"writingStyle",name:"writingStyle",disabled:pe,value:W,description:"",onChange:Z},Ie.map((function(e){return React.createElement(be.Z,{key:e.value,id:e.value,value:e.value,label:e.label})}))),React.createElement("label",null,"Writing tone:"),React.createElement(be.N,{scrolldown:!0,id:"writingTone",name:"writingTone",disabled:pe,value:U,description:"",onChange:V},Ae.map((function(e){return React.createElement(be.Z,{key:e.value,id:e.value,value:e.value,label:e.label})})))),React.createElement(b._,{fullWidth:!0,onClick:function(){l(""),m(""),R(""),C(""),M(""),Se()}},"Reset"),React.createElement(Wt,{style:{marginTop:25,marginBottom:25}},React.createElement(et,null,React.createElement("h2",null,"Model Params"),React.createElement(b._,{onClick:function(){return we(!ge)}},ge?"Hide":"Show")),ge&&React.createElement(React.Fragment,null,React.createElement("label",null,"Model:"),React.createElement(be.N,{id:"models",value:A,scrolldown:!0,onChange:F},I.map((function(e){return React.createElement(be.Z,{value:e.id,label:e.name})}))),React.createElement("label",null,"Temperature:"),React.createElement(ve.A,{id:"temperature",name:"temperature",value:le,type:"number",onChange:ue,onBlur:ue,description:React.createElement(React.Fragment,null,React.createElement("span",{style:{color:le>=0&&le<=1?"inherit":"red"}},"Between 0 and 1.")," Higher values means the model will take more risks.")}),React.createElement("label",null,"Max Tokens:"),React.createElement(ve.A,{id:"maxTokens",name:"maxTokens",value:fe,type:"number",onChange:me,onBlur:me,description:React.createElement(React.Fragment,null,React.createElement("span",{style:{color:fe>=1&&fe<=4096?"inherit":"red"}},"Between 1 and 2048.")," Higher values means the model will generate more content.")}))),React.createElement(Wt,null,React.createElement(et,null,React.createElement("h2",null,"Prompts"),React.createElement(b._,{onClick:function(){return ke(!xe)}},xe?"Hide":"Show")),xe&&React.createElement(React.Fragment,null,React.createElement("p",null,"The prompts are automatically generated for you, but you can enhance them once the values are set."),React.createElement("label",null,"Prompt for ",React.createElement("b",null,"Title")),React.createElement(Ke.l,{disabled:pe,value:$,onChange:K}),React.createElement("label",null,"Prompt for ",React.createElement("b",null,"Sections")),React.createElement(Ke.l,{disabled:pe,value:X,onChange:ee}),React.createElement("label",null,"Prompt for ",React.createElement("b",null,"Content")),React.createElement(Ke.l,{disabled:pe,value:ne,onChange:re}),React.createElement("label",null,"Prompt for ",React.createElement("b",null,"Excerpt")),React.createElement(Ke.l,{disabled:pe,value:oe,onChange:ie}))))),React.createElement(Ee.L,{isOpen:Oe,onRequestClose:function(){return Se()},onOkClick:function(){window.open("/wp-admin/post.php?post=".concat(Oe,"&action=edit"),"_blank"),Ye()},ok:"Edit the Post",cancel:"Close",onCancelClick:Ye,title:"Post Created!",content:React.createElement("p",null,"The post was created as draft.")}),React.createElement(Ee.L,{isOpen:t,onRequestClose:function(){n()},onOkClick:function(){n()},title:"Error",content:React.createElement("p",null,t)}))};function cr(e){return cr="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},cr(e)}var lr;function ur(){ur=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,a){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),c=new _(a||[]);return r(i,"_invoke",{value:E(e,n,c)}),i}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f={};function m(){}function h(){}function p(){}var d={};l(d,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==t&&n.call(v,o)&&(d=v);var g=p.prototype=m.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function a(r,o,i,c){var l=s(e[r],e,o);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==cr(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){a("next",e,i,c)}),(function(e){a("throw",e,i,c)})):t.resolve(f).then((function(e){u.value=e,i(u)}),(function(e){return a("throw",e,i,c)}))}c(l.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return{value:void 0,done:!0}}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var c=R(i,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=s(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}function R(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,f;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function O(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:S}}function S(){return{value:void 0,done:!0}}return h.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:h,configurable:!0}),h.displayName=l(p,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,l(e,c,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(w.prototype),l(w.prototype,i,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new w(u(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(g),l(g,c,"Generator"),l(g,o,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.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}},e.values=O,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):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),f},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),k(n),f}},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 a=r.arg;k(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function sr(e){return function(e){if(Array.isArray(e))return dr(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||pr(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 fr(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function mr(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){fr(o,r,a,i,c,"next",e)}function c(e){fr(o,r,a,i,c,"throw",e)}i(void 0)}))}}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,a,o,i,c=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return c}}(e,t)||pr(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 pr(e,t){if(e){if("string"==typeof e)return dr(e,t);var n=Object.prototype.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)?dr(e,t):void 0}}function dr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var yr=wp.element,vr=yr.useState,gr=yr.useEffect,br=yr.useMemo,wr=[{id:"none",name:"None",prompt:""},{id:"japan",name:"Ghibli Inspired",prompt:"japan, tokyo, trees, izakaya, anime oil painting, high resolution, ghibli inspired, 4k"},{id:"steampunk",name:"Steampunk Architecture",prompt:"steampunk architecture, exterior view, award-winning architectural photography from magazine, trees, theater"},{id:"modern-illustration",name:"Modern Illustration",prompt:"illustration of a cat, modern design, for the web, cute, happy, 4k, high resolution, trending in artstation"}],Er=[1,2,3,6,9],Rr=I.ZP.div(lr||(lr=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n margin-bottom: 5px;\n\n label {\n margin-bottom: 5px;\n display: block;\n }\n"])));const xr=function(){var e=hr(vr(),2),t=e[0],n=e[1],r=hr(vr(wr[0]),2),a=r[0],o=r[1],i=hr(vr("japan, tokyo, trees, izakaya, anime oil painting, high resolution, ghibli inspired, 4k"),2),c=i[0],l=i[1],u=hr(vr(!0),2),s=u[0],m=u[1],h=hr(vr(3),2),y=h[0],g=h[1],w=hr(vr([]),2),R=w[0],x=w[1],k=hr(vr(),2),O=k[0],S=k[1],L=hr(vr(""),2),C=L[0],N=L[1],I=hr(vr(""),2),A=I[0],F=I[1],G=hr(vr(""),2),z=G[0],M=G[1],B=hr(vr(""),2),D=B[0],Y=B[1],q=hr(vr(""),2),W=q[0],Z=q[1],H=hr(vr(!1),2),U=H[0],V=H[1],J=hr(vr([]),2),$=J[0],K=J[1],Q=br((function(){return R.indexOf(O)}),[O,R]);gr((function(){l(a.prompt)}),[a]),gr((function(){if(O){var e=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:42,n=e.replace(/[\s|,]+/g,"-"),r=(n=n.replace(/--+/g,"-")).split("-"),a=r[0],o=1;a.length+r[o].length<t&&o<r.length;)a+="-"+r[o],o++;return a.length>t+1&&(a=a.slice(0,t+2)),a}(c)+".png";Z(e),N(c),F(c),M(c),Y(c)}}),[O]);var X=function(){var e=mr(ur().mark((function e(){var t;return ur().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V(!0),e.next=3,(0,E.PV)("".concat(_,"/make_images"),{method:"POST",nonce:P,json:{env:"admin-tools",session:T,prompt:c,maxResults:y}});case 3:return t=e.sent,V(!1),t.success&&x(s?[].concat(sr(R),sr(t.data)):t.data),n(t.message),e.abrupt("return",null);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ee=function(){var e=mr(ur().mark((function e(){var t;return ur().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return V(!0),e.next=3,(0,E.PV)("".concat(_,"/create_image"),{method:"POST",nonce:P,json:{url:O,title:C,description:A,caption:z,alt:D,filename:W}});case 3:return t=e.sent,V(!1),t.success&&K([].concat(sr($),[{id:t.attachmentId,url:O}])),n(t.message),e.abrupt("return",null);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),te=br((function(){var e=$.find((function(e){return e.url===O}));return e?e.id:null}),[O,$]);return console.log({createdMediaIds:$,currentCreatedMediaId:te}),React.createElement(d.s,{nekoErrors:[]},React.createElement(Xe,{title:"Image Generator"}),React.createElement(v.o,null,React.createElement(v.z,{full:!0},React.createElement(We,{options:j}),React.createElement(f.O,{p:!0,style:{marginTop:0,marginBottom:0}},"This will also be available in the Post Editor soon. If you have any idea or request, please join us on the ",React.createElement("a",{target:"_blank",href:"https://wordpress.org/support/plugin/ai-engine/"},"Support Forum"),"! 🎵")),React.createElement(v.z,null,React.createElement(Wt,{style:{marginBottom:25}},React.createElement("h3",{style:{marginTop:0}},"Templates"),React.createElement("ul",null,wr.map((function(e){return React.createElement("li",{className:a.id===e.id?"active":"",onClick:function(){o(e)}},e.name)}))),React.createElement("div",null,"Soon, you'll be able to create templates and re-use them easily."))),React.createElement(v.z,{style:{flex:3}},O&&React.createElement(React.Fragment,null,React.createElement(ge.H,null,React.createElement(et,{style:{paddingBottom:10}},React.createElement("h2",null,"Images Generator"),React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement(b._,{disabled:Q<1||U,onClick:function(){Q>0&&S(R[Q-1])}},"<"),React.createElement(b._,{disabled:U,onClick:function(){return S()}},"Back to results"),React.createElement(b._,{disabled:Q>=R.length-1||U,onClick:function(){Q<R.length-1&&S(R[Q+1])}},">"))),React.createElement("div",{style:{display:"flex"}},React.createElement("div",{style:{flex:2}},React.createElement("img",{src:O,style:{width:"100%"}})),React.createElement("div",{style:{flex:1,marginLeft:10,display:"flex",flexDirection:"column"}},React.createElement(Rr,null,React.createElement("label",null,"Title:"),React.createElement(nt,{value:C,onBlur:N})),React.createElement(Rr,null,React.createElement("label",null,"Caption:"),React.createElement(nt,{value:z,onBlur:M})),React.createElement(Rr,null,React.createElement("label",null,"Description:"),React.createElement(nt,{value:A,onBlur:F})),React.createElement(Rr,null,React.createElement("label",null,"Alternative Text:"),React.createElement(nt,{value:D,onBlur:Y})),React.createElement(Rr,null,React.createElement("label",null,"Filename:"),React.createElement(ve.A,{value:W,onChange:Z})),React.createElement(b._,{fullWidth:!0,style:{marginTop:7},isBusy:U,onClick:function(){return ee()}},"Add to Media Library"),React.createElement(b._,{fullWidth:!0,style:{marginLeft:0,marginTop:7},isBusy:U,onClick:function(){return(e=document.createElement("a")).href=O,e.target="_blank",e.download=W,void e.click();var e}},"Download"),te&&React.createElement(we.C,{style:{fontSize:13,padding:"10px 5px"}},"The media has been created! You can edit it here: ",React.createElement("a",{href:"/wp-admin/post.php?post=".concat(te,"&action=edit"),target:"_blank"},"Edit Media #",te),"."))))),!O&&React.createElement(React.Fragment,null,React.createElement(ge.H,null,React.createElement(et,null,React.createElement("h2",null,"Generated Images"),React.createElement("div",{style:{display:"flex",alignItems:"center"}},React.createElement("label",{style:{margin:"0 5px 0 0"}},"# of Images: "),React.createElement(be.N,{scrolldown:!0,id:"maxResults",name:"maxResults",disabled:U,style:{marginRight:10},value:y,description:"",onChange:g},Er.map((function(e){return React.createElement(be.Z,{key:e,id:e,value:e,label:e})}))),React.createElement(b._,{disabled:!c,isBusy:U,onClick:X},"Generate Images"))),React.createElement(nt,{value:c,onBlur:l,style:{marginTop:20}}),React.createElement(tt,null,R.map((function(e){return React.createElement("img",{src:e,onClick:function(){return S(e)}})})),sr(Array(Math.max(3-R.length,0)).keys()).map((function(e){return React.createElement("div",{class:"empty-image"})})))))),React.createElement(v.z,null,React.createElement(ge.H,{style:{marginBottom:25}},React.createElement("h2",{style:{marginTop:0}},"Settings"),React.createElement(p.P,{id:"continuous_mode ",label:"Continuous",value:"1",checked:s,description:"New images will be added to the already generated images.",onChange:m})))),React.createElement(Ee.L,{isOpen:t,onRequestClose:function(){n()},onOkClick:function(){n()},title:"Error",content:React.createElement("p",null,t)}))};function kr(e){return kr="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},kr(e)}function _r(){_r=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,a){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),c=new _(a||[]);return r(i,"_invoke",{value:E(e,n,c)}),i}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f={};function m(){}function h(){}function p(){}var d={};l(d,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==t&&n.call(v,o)&&(d=v);var g=p.prototype=m.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function a(r,o,i,c){var l=s(e[r],e,o);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==kr(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){a("next",e,i,c)}),(function(e){a("throw",e,i,c)})):t.resolve(f).then((function(e){u.value=e,i(u)}),(function(e){return a("throw",e,i,c)}))}c(l.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return{value:void 0,done:!0}}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var c=R(i,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=s(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}function R(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,f;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function O(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:S}}function S(){return{value:void 0,done:!0}}return h.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:h,configurable:!0}),h.displayName=l(p,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,l(e,c,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(w.prototype),l(w.prototype,i,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new w(u(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(g),l(g,c,"Generator"),l(g,o,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.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}},e.values=O,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):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),f},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),k(n),f}},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 a=r.arg;k(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function Or(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function Sr(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Or(o,r,a,i,c,"next",e)}function c(e){Or(o,r,a,i,c,"throw",e)}i(void 0)}))}}function Lr(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,a,o,i,c=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Pr(e,t);var n=Object.prototype.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)?Pr(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 Pr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var jr=wp.element,Tr=jr.useState,Cr=jr.useEffect,Nr=jr.useMemo;const Ir=function(e){var t=e.post,n=e.onExcerptClick,r=void 0===n?{}:n,a=e.onClose,o=void 0===a?{}:a,i=Lr(Tr([]),2),c=i[0],l=i[1],u=Lr(Tr(!1),2),s=u[0],f=u[1],m=Lr(Tr(!1),2),h=m[0],p=m[1];Cr((function(){t&&d(t)}),[t]);var d=function(){var e=Sr(_r().mark((function e(t){var n,r;return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.postId,f(!0),e.next=4,(0,E.PV)("".concat(_,"/make_excerpts"),{method:"POST",nonce:P,json:{postId:n}});case 4:(r=e.sent).success&&l(r.data),f(!1);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),y=function(){var e=Sr(_r().mark((function e(t){return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f(!0),e.prev=1,e.next=4,r(t);case 4:g(),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),p(e.t0.message);case 10:f(!1);case 11:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(t){return e.apply(this,arguments)}}(),g=function(){var e=Sr(_r().mark((function e(){return _r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o(),l([]),p(),f(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),b=Nr((function(){return s?React.createElement(kn.S,{type:"circle",size:"10%"}):h?React.createElement(React.Fragment,null,"Error: ",h):(null==c?void 0:c.length)>0?React.createElement(React.Fragment,null,"Pick a new excerpt by clicking on it.",React.createElement(On,null,c.map((function(e){return React.createElement(Sn,{key:e,onClick:function(){y(e)}},e)})))):React.createElement(React.Fragment,null,"Nothing to display.")}),[s,c,h]);return React.createElement(v.o,null,React.createElement(Ee.L,{isOpen:t,onRequestClose:g,title:'New excerpt for "'.concat(null==t?void 0:t.postTitle,'"'),content:b,ok:"Close",onOkClick:g}))};function Ar(e){return Ar="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},Ar(e)}function Fr(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 Gr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fr(Object(n),!0).forEach((function(t){zr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function zr(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==Ar(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!==Ar(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===Ar(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Mr=wp.element,Br=(Mr.useState,Mr.useEffect,Mr.useMemo),Dr=React.createElement("g",null,React.createElement("g",null,React.createElement("path",{d:"m391 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#39326c"}),React.createElement("path",{d:"m331 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#39326c"}),React.createElement("path",{d:"m271 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#39326c"}),React.createElement("path",{d:"m211 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#5f55af"}),React.createElement("path",{d:"m151 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#5f55af"}),React.createElement("path",{d:"m91 81h30v-66c0-8.284-6.716-15-15-15-8.284 0-15 6.716-15 15z",fill:"#5f55af"}),React.createElement("path",{d:"m406 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z",fill:"#39326c"}),React.createElement("path",{d:"m346 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z",fill:"#39326c"}),React.createElement("path",{d:"m286 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z",fill:"#39326c"}),React.createElement("g",{fill:"#5f55af"},React.createElement("path",{d:"m226 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m166 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m106 512c8.284 0 15-6.716 15-15v-66h-30v66c0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 121h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 181h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 241h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 301h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 361h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"}),React.createElement("path",{d:"m15 421h66v-30h-66c-8.284 0-15 6.716-15 15 0 8.284 6.716 15 15 15z"})),React.createElement("path",{d:"m431 91v30h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15z",fill:"#39326c"}),React.createElement("path",{d:"m431 181h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66z",fill:"#39326c"}),React.createElement("path",{d:"m431 241h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66z",fill:"#39326c"}),React.createElement("path",{d:"m431 301h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66z",fill:"#39326c"}),React.createElement("path",{d:"m431 361h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66z",fill:"#39326c"}),React.createElement("path",{d:"m431 421h66c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15h-66z",fill:"#39326c"})),React.createElement("g",null,React.createElement("path",{d:"m446 51h-380c-8.284 0-15 6.716-15 15v380c0 8.284 6.716 15 15 15h380c8.284 0 15-6.716 15-15v-380c0-8.284-6.716-15-15-15z",fill:"#aed0ff"}),React.createElement("g",null,React.createElement("path",{d:"m461 446v-380c0-8.284-6.716-15-15-15h-190v410h190c8.284 0 15-6.716 15-15z",fill:"#7c84e8"})),React.createElement("path",{d:"m386 111h-260c-8.284 0-15 6.716-15 15v260c0 8.284 6.716 15 15 15h260c8.284 0 15-6.716 15-15v-260c0-8.284-6.716-15-15-15z",fill:"#5f55af"}),React.createElement("g",null,React.createElement("path",{d:"m401 386v-260c0-8.284-6.716-15-15-15h-130v290h130c8.284 0 15-6.716 15-15z",fill:"#39326c"}))),React.createElement("g",null,React.createElement("path",{d:"m247.626 192.389c-.052-.138-.106-.274-.162-.411-2.744-6.671-9.175-10.978-16.387-10.978-.006 0-.012 0-.018 0-7.219.007-13.65 4.329-16.383 11.01-.046.113-.091.227-.134.341l-45.06 118.31c-2.949 7.742.937 16.408 8.679 19.356 7.742 2.95 16.408-.937 19.356-8.679l7.543-19.804h51.691l7.458 19.762c2.267 6.007 7.974 9.708 14.036 9.708 1.76 0 3.55-.312 5.294-.97 7.75-2.925 11.663-11.579 8.737-19.33zm-31.14 79.146 14.538-38.171 14.406 38.171z",fill:"#f9f9f9"}),React.createElement("g",{fill:"#e2dff4"},React.createElement("path",{d:"m264.209 321.296c2.267 6.007 7.974 9.708 14.036 9.708 1.76 0 3.55-.312 5.294-.97 7.75-2.925 11.663-11.579 8.737-19.33l-36.276-96.126v86.956h.751z"}),React.createElement("path",{d:"m328.5 181c-8.284 0-15 6.716-15 15v120c0 8.284 6.716 15 15 15s15-6.716 15-15v-120c0-8.284-6.716-15-15-15z"})))),Yr=React.createElement("g",null,React.createElement("path",{d:"m213.46 341.461-139.26 156.08c-16.17 18.48-44.53 19.33-61.8 2.06-17.32-17.32-16.37-45.67 2.06-61.8l156.08-139.26s13.46-2.54 29.46 13.46 13.46 29.46 13.46 29.46z",fill:"#0052be"}),React.createElement("path",{d:"m213.46 341.461-139.26 156.08c-16.17 18.48-44.53 19.33-61.8 2.06l187.6-187.6c16 16 13.46 29.46 13.46 29.46z",fill:"#00429b"}),React.createElement("path",{d:"m304 240.001-90.54 101.46c-14.997-14.997-27.922-27.922-42.92-42.92l101.46-90.54z",fill:"#00429b"}),React.createElement("path",{d:"m304 240.001-90.54 101.46-21.46-21.46 96-96z",fill:"#00337a"}),React.createElement("path",{d:"m400 279.001h-64.4l-42.47 57.87c-7.88 10.735-24.824 6.606-26.91-6.52l-11.56-73.01-73.01-11.56c-13.139-2.087-17.244-19.042-6.52-26.91l57.87-42.47v-64.4c0-12.176 13.797-19.289 23.72-12.21l50.15 35.83 70.92-19.9c11.25-3.168 21.656 7.245 18.49 18.49l-19.9 70.92 35.83 50.15c7.071 9.913-.02 23.72-12.21 23.72z",fill:"#ffdd54"}),React.createElement("path",{d:"m412.21 255.281c7.071 9.913-.02 23.72-12.21 23.72h-64.4l-42.47 57.87c-7.875 10.728-24.823 6.616-26.91-6.52l-11.56-73.01 137.79-137.79c3.83 3.84 5.3 9.44 3.83 14.66l-19.9 70.92z",fill:"#ffb454"}),React.createElement("path",{d:"m512 39.001c0 8.28-6.72 15-15 15h-9v9c0 8.28-6.72 15-15 15s-15-6.72-15-15v-9h-9c-8.28 0-15-6.72-15-15s6.72-15 15-15h9v-9c0-8.28 6.72-15 15-15s15 6.72 15 15v9h9c8.28 0 15 6.719 15 15z",fill:"#bee75e"}),React.createElement("path",{d:"m512 39.001c0 8.28-6.72 15-15 15h-9v9c0 8.28-6.72 15-15 15s-15-6.72-15-15v-9l30-30h9c8.28 0 15 6.719 15 15z",fill:"#00cb75"}),React.createElement("path",{d:"m336 41.001h-9v-9c0-8.284-6.716-15-15-15s-15 6.716-15 15v9h-9c-8.284 0-15 6.716-15 15s6.716 15 15 15h9v9c0 8.284 6.716 15 15 15s15-6.716 15-15v-9h9c8.284 0 15-6.716 15-15s-6.716-15-15-15z",fill:"#f6f9f9"}),React.createElement("path",{d:"m441 224.001c0 8.284 6.716 15 15 15s15-6.716 15-15v-9h9c8.284 0 15-6.716 15-15s-6.716-15-15-15h-9v-9c0-8.284-6.716-15-15-15s-15 6.716-15 15v9h-9c-8.284 0-15 6.716-15 15s6.716 15 15 15h9z",fill:"#e2dff4"}),React.createElement("path",{d:"m497 329.001h-9v-9c0-8.284-6.716-15-15-15s-15 6.716-15 15v9h-9c-8.284 0-15 6.716-15 15s6.716 15 15 15h9v9c0 8.284 6.716 15 15 15s15-6.716 15-15v-9h9c8.284 0 15-6.716 15-15s-6.716-15-15-15z",fill:"#ff4a4a"}),React.createElement("path",{d:"m192 24.001h-9v-9c0-8.284-6.716-15-15-15s-15 6.716-15 15v9h-9c-8.284 0-15 6.716-15 15s6.716 15 15 15h9v9c0 8.284 6.716 15 15 15s15-6.716 15-15v-9h9c8.284 0 15-6.716 15-15s-6.716-15-15-15z",fill:"#ff8659"}),React.createElement("path",{d:"m159.442 122.977-56-32c-7.191-4.109-16.355-1.611-20.466 5.581-4.11 7.193-1.611 16.355 5.581 20.466l56 32c7.16 4.093 16.337 1.644 20.466-5.581 4.111-7.193 1.612-16.355-5.581-20.466z",fill:"#f6f9f9"}),React.createElement("path",{d:"m118.14 169.117-64 8c-8.221 1.027-14.052 8.524-13.023 16.744 1.027 8.218 8.523 14.054 16.744 13.023l64-8c8.221-1.027 14.052-8.524 13.023-16.744-1.028-8.22-8.527-14.062-16.744-13.023z",fill:"#acceff"}),React.createElement("path",{d:"m389.023 352.558c-4.111-7.193-13.274-9.693-20.466-5.581-7.192 4.11-9.691 13.272-5.581 20.466l32 56c2.769 4.845 7.83 7.561 13.037 7.561 11.319 0 18.784-12.341 13.01-22.445z",fill:"#e2dff4"}),React.createElement("path",{d:"m329.86 377.117c-8.222-1.031-15.717 4.804-16.744 13.023l-8 64c-1.117 8.925 5.834 16.862 14.902 16.862 7.455 0 13.917-5.553 14.865-13.142l8-64c1.029-8.219-4.802-15.716-13.023-16.743z",fill:"#6ba7ff"}));const qr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.icon,n=void 0===t?"ai":t,r=e.style,a=void 0===r?{}:r,o=Br((function(){switch(n){case"ai":default:return Dr;case"wand":return Yr}}),[n]);return React.createElement("svg",{style:Gr({width:20,height:20,marginRight:5},a),"enable-background":"new 0 0 512 512",height:"512",viewBox:"0 0 512 512",width:"512",xmlns:"http://www.w3.org/2000/svg"},o)};function Wr(e){return Wr="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},Wr(e)}function Zr(){Zr=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,a){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),c=new _(a||[]);return r(i,"_invoke",{value:E(e,n,c)}),i}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f={};function m(){}function h(){}function p(){}var d={};l(d,o,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==t&&n.call(v,o)&&(d=v);var g=p.prototype=m.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function a(r,o,i,c){var l=s(e[r],e,o);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==Wr(f)&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){a("next",e,i,c)}),(function(e){a("throw",e,i,c)})):t.resolve(f).then((function(e){u.value=e,i(u)}),(function(e){return a("throw",e,i,c)}))}c(l.arg)}var o;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){a(e,n,t,r)}))}return o=o?o.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(a,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===a)throw o;return{value:void 0,done:!0}}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var c=R(i,n);if(c){if(c===f)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=s(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}function R(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,R(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var a=s(r,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,f;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function O(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:S}}function S(){return{value:void 0,done:!0}}return h.prototype=p,r(g,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:h,configurable:!0}),h.displayName=l(p,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,l(e,c,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(w.prototype),l(w.prototype,i,(function(){return this})),e.AsyncIterator=w,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new w(u(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(g),l(g,c,"Generator"),l(g,o,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.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}},e.values=O,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return i.type="throw",i.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):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),f},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),k(n),f}},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 a=r.arg;k(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function Hr(e,t,n,r,a,o,i){try{var c=e[o](i),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,a)}function Ur(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){Hr(o,r,a,i,c,"next",e)}function c(e){Hr(o,r,a,i,c,"throw",e)}i(void 0)}))}}function Vr(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,a,o,i,c=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Jr(e,t);var n=Object.prototype.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)?Jr(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 Jr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var $r=wp.element,Kr=$r.useState,Qr=($r.useEffect,$r.useMemo,wp.i18n.__),Xr=wp.plugins.registerPlugin,ea=wp.components.Button,ta=wp.editPost,na=ta.PluginDocumentSettingPanel,ra=ta.PluginBlockSettingsMenuItem,aa=function(){alert("Coming soon! Let me know your feedback and ideas, I will make this awesome for you.")};Xr("ai-engine-menu-paragraph-generate",{render:function(){return React.createElement(React.Fragment,null,React.createElement(ra,{allowedBlocks:["core/paragraph"],icon:React.createElement(qr,{icon:"wand",style:{marginRight:0}}),label:React.createElement(React.Fragment,null," ",Qr("Enhance text")),onClick:aa}),React.createElement(ra,{allowedBlocks:["core/paragraph"],icon:React.createElement(qr,{icon:"wand",style:{marginRight:0}}),label:React.createElement(React.Fragment,null," ",Qr("Translate text")),onClick:aa}))}});var oa=function(){var e=Vr(Kr(),2),t=e[0],n=e[1],r=Vr(Kr(),2),a=r[0],o=r[1],i=function(){var e=Ur(Zr().mark((function e(t){return Zr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:wp.data.dispatch("core/editor").editPost({title:t});case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),c=function(){var e=Ur(Zr().mark((function e(t){return Zr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:wp.data.dispatch("core/editor").editPost({excerpt:t});case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return React.createElement(na,{name:"mwai-document-settings",title:React.createElement(React.Fragment,null,React.createElement(qr,null)," AI Engine"),className:"mwai-document-settings"},React.createElement("p",null,"Generate:"),React.createElement("div",{style:{display:"flex"}},React.createElement(ea,{variant:"primary",onClick:function(){var e=(0,wp.data.select("core/editor").getCurrentPost)(),t=e.id,r=e.title;e.excerpt,n({postId:t,postTitle:r})},style:{flex:1,marginRight:10}},React.createElement(qr,{icon:"wand",style:{marginRight:8}})," Titles"),React.createElement(ea,{variant:"primary",onClick:function(){var e=(0,wp.data.select("core/editor").getCurrentPost)(),t=e.id,n=e.title;e.excerpt,o({postId:t,postTitle:n})},style:{flex:1}},React.createElement(qr,{icon:"wand",style:{marginRight:8}})," Excerpts")),React.createElement(v.o,null,React.createElement(zn,{post:t,onTitleClick:i,onClose:n}),React.createElement(Ir,{post:a,onExcerptClick:c,onClose:o})))};var ia=React.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("rect",{width:"20",height:"20",fill:"white"}),React.createElement("path",{d:"M16.6667 3.33334V13.3333H6.66667V3.33334H16.6667ZM16.6667 1.66667H6.66667L5 3.33334V13.3333L6.66667 15H16.6667L18.3333 13.3333V3.33334L16.6667 1.66667Z",fill:"#2D4B6D"}),React.createElement("path",{d:"M10 10L10.8333 11.6667L13.3333 9.16667L15.8333 12.5H7.5L10 10Z",fill:"#1ABC9C"}),React.createElement("path",{d:"M1.66667 5V16.6667L3.33333 18.3333H15V16.6667H3.33333V5H1.66667Z",fill:"#2D4B6D"})),ca=wp.i18n.__,la=wp.blocks,ua=la.registerBlockType,sa=(la.createBlock,wp.element),fa=sa.useMemo,ma=(sa.useEffect,sa.useState,wp.components),ha=(ma.Button,ma.DropZone,ma.PanelBody),pa=(ma.RangeControl,ma.CheckboxControl,ma.TextControl,ma.SelectControl,ma.Toolbar,ma.withNotices,wp.blockEditor),da=(pa.BlockControls,pa.InspectorControls),ya=function(e){var t=e.attributes;return t.id,t.fieldName,t.labelText,console.log(e),React.createElement(React.Fragment,null,"[mwai_chatbot]")},va=function(e){var t=e.attributes,n=(t.id,t.fieldName,t.labelText,e.setAttributes,fa((function(){return ya(e)}),[e]));return React.createElement(React.Fragment,null,n,React.createElement(da,null,React.createElement(ha,{title:ca("Chatbot")}),React.createElement(ha,{title:ca("Settings")})))};var ga=wp.i18n.__,ba=wp.blocks,wa=ba.registerBlockType,Ea=(ba.createBlock,wp.element),Ra=Ea.useMemo,xa=(Ea.useEffect,Ea.useState,wp.components),ka=(xa.Button,xa.DropZone,xa.PanelBody),_a=(xa.RangeControl,xa.CheckboxControl,xa.TextControl),Oa=xa.SelectControl,Sa=(xa.Toolbar,xa.withNotices,wp.blockEditor),La=(Sa.BlockControls,Sa.InspectorControls),Pa=function(e){var t=e.attributes,n=t.id,r=t.fieldName,a=t.labelText;return console.log(e),React.createElement("div",{className:"mwai-field-container"},React.createElement("label",{className:"mwai-label",htmlFor:n},a),React.createElement("input",{className:"mwai-field mwai-input",type:"text",id:n,name:r}))},ja=function(e){var t=e.attributes,n=t.id,r=t.fieldName,a=t.labelText,o=e.setAttributes,i=Ra((function(){return Pa(e)}),[e]);return React.createElement(React.Fragment,null,i,React.createElement(La,null,React.createElement(ka,{title:ga("Field")},React.createElement(_a,{label:"Label Text",value:a,onChange:function(e){return o({labelText:e})}}),React.createElement(_a,{label:"Field Name",value:r,onChange:function(e){return o({fieldName:e})}}),React.createElement(Oa,{label:"Field Type",value:"text",options:[{label:"TextField",value:"text"},{label:"Select",value:"select"},{label:"Checkbox",value:"checkbox"},{label:"Radio",value:"radio"},{label:"TextArea",value:"textarea"}]})),React.createElement(ka,{title:ga("Settings")},React.createElement(_a,{label:"ID",value:n,onChange:function(e){return o({id:e})}}))))};var Ta=wp.element.render,Ca=new l.S({defaultOptions:{queries:{refetchOnWindowFocus:!1}}});wa("ai-engine/form-field",{title:"AI Form Field",description:React.createElement(React.Fragment,null,"This feature is ",React.createElement("b",null,"being built"),". I will allow to create AI forms. Coming soon!"),icon:ia,category:"layout",keywords:[ga("ai"),ga("openai"),ga("form")],attributes:{id:{type:"string",default:""},fieldName:{type:"string",default:""},labelText:{type:"string",default:"Label: "}},edit:ja,save:Pa}),ua("ai-engine/chatbot",{title:"AI Chatbot",description:React.createElement(React.Fragment,null,"This feature is ",React.createElement("b",null,"being built"),". I will allow to create a chatbot. Coming soon!"),icon:ia,category:"layout",keywords:[ca("ai"),ca("openai"),ca("chatbot")],attributes:{id:{type:"string",default:""}},edit:va,save:ya}),document.addEventListener("DOMContentLoaded",(function(){Xr("ai-engine-document-settings",{render:oa});var e=document.getElementById("mwai-admin-settings");e&&Ta(React.createElement(u.aH,{client:Ca},React.createElement(on,null)),e);var t=document.getElementById("mwai-content-generator");t&&Ta(React.createElement(ir,null),t);var n=document.getElementById("mwai-image-generator");n&&Ta(React.createElement(xr,null),n);var r=document.getElementById("mwai-playground");r&&Ta(React.createElement(En,null),r);var a=document.getElementById("mwai-admin-postsList");a&&Ta(React.createElement(Hn,null),a);var o=document.getElementById("meow-common-dashboard");o&&Ta(React.createElement(ye,null),o)}))},7363:e=>{e.exports=React},1533:e=>{e.exports=ReactDOM}},n={};function r(e){var a=n[e];if(void 0!==a)return a.exports;var o=n[e]={exports:{}};return t[e].call(o.exports,o,o.exports,r),o.exports}r.m=t,r.amdO={},e=[],r.O=(t,n,a,o)=>{if(!n){var i=1/0;for(s=0;s<e.length;s++){n=e[s][0],a=e[s][1],o=e[s][2];for(var c=!0,l=0;l<n.length;l++)(!1&o||i>=o)&&Object.keys(r.O).every((e=>r.O[e](n[l])))?n.splice(l--,1):(c=!1,o<i&&(i=o));if(c){e.splice(s--,1);var u=a();void 0!==u&&(t=u)}}return t}o=o||0;for(var s=e.length;s>0&&e[s-1][2]>o;s--)e[s]=e[s-1];e[s]=[n,a,o]},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={826:0};r.O.j=t=>0===e[t];var t=(t,n)=>{var a,o,i=n[0],c=n[1],l=n[2],u=0;if(i.some((t=>0!==e[t]))){for(a in c)r.o(c,a)&&(r.m[a]=c[a]);if(l)var s=l(r)}for(t&&t(n);u<i.length;u++)o=i[u],r.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return r.O(s)},n=self.wpJsonMwai=self.wpJsonMwai||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),r.nc=void 0;var a=r.O(void 0,[736],(()=>r(6806)));a=r.O(a)})();
8 //# sourceMappingURL=index.js.map