Файловый менеджер - Редактировать - /home/harasnat/www/horse/wp-content/plugins/essential-blocks/assets/admin/write-with-ai/index.js
Назад
(()=>{"use strict";var e,t={2031:(e,t,a)=>{window.React;const n=window.wp.element,r=window.wp.data;var o=a(3453);const s=window.wp.i18n,l=window.wp.components,i=window.wp.blocks,c=function(){return React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32",fill:"none"},React.createElement("g",{clipPath:"url(#clip0_2453_20882)"},React.createElement("path",{d:"M15.8322 30.1765L8.97508 30.7708L9.56936 23.9136L23.8322 9.74219C24.0451 9.52448 24.2993 9.3515 24.58 9.23341C24.8606 9.11531 25.162 9.05447 25.4665 9.05447C25.771 9.05447 26.0724 9.11531 26.3531 9.23341C26.6337 9.3515 26.8879 9.52448 27.1008 9.74219L30.0037 12.6679C30.2176 12.8805 30.3874 13.1334 30.5033 13.4119C30.6192 13.6904 30.6788 13.9891 30.6788 14.2908C30.6788 14.5924 30.6192 14.8911 30.5033 15.1696C30.3874 15.4481 30.2176 15.701 30.0037 15.9136L15.8322 30.1765ZM1.92593 9.07933C1.12365 8.9399 1.12365 7.7879 1.92593 7.64848C3.34647 7.40124 4.6612 6.73658 5.70251 5.73923C6.74382 4.74188 7.46455 3.45703 7.77279 2.04848L7.82079 1.82676C7.99451 1.03591 9.12365 1.02905 9.30651 1.82219L9.36365 2.07819C9.68319 3.48048 10.4099 4.75709 11.4526 5.74772C12.4953 6.73834 13.8074 7.39881 15.2242 7.64619C16.0311 7.78333 16.0311 8.94219 15.2242 9.0839C13.8073 9.33071 12.4949 9.99066 11.4518 10.9809C10.4087 11.9711 9.68146 13.2474 9.36136 14.6496L9.30193 14.9079C9.12136 15.6988 7.99222 15.6942 7.81851 14.901L7.77279 14.6793C7.46424 13.2702 6.74284 11.9849 5.70064 10.9874C4.65845 9.99003 3.34273 9.32574 1.92136 9.07933H1.92593Z",stroke:"#ffffff",strokeWidth:"2.28571",strokeLinecap:"round",strokeLinejoin:"round"})),React.createElement("defs",null,React.createElement("clipPath",{id:"clip0_2453_20882"},React.createElement("rect",{width:"32",height:"32",fill:"white"}))))},u=function(){var e,t,a,u,d,m,p=(0,n.useState)(!1),h=(0,o.A)(p,2),g=h[0],b=h[1],v=(0,n.useState)(!1),f=(0,o.A)(v,2),w=f[0],k=f[1],_=(0,n.useState)(!1),E=(0,o.A)(_,2),C=E[0],R=E[1],y=(0,n.useState)(""),L=(0,o.A)(y,2),A=L[0],x=L[1],B=(0,n.useState)(""),N=(0,o.A)(B,2),O=N[0],P=N[1],I=(0,n.useState)(""),S=(0,o.A)(I,2),T=S[0],j=S[1],W=(0,n.useState)("medium"),z=(0,o.A)(W,2),M=z[0],K=z[1],D=(0,n.useState)("informative"),F=(0,o.A)(D,2),G=F[0],$=F[1],q=(0,n.useState)(!1),H=(0,o.A)(q,2),Z=H[0],J=H[1],X=(0,n.useState)(!1),Q=(0,o.A)(X,2),U=Q[0],V=Q[1],Y=function(){b(!g)},ee=function(e,t,a,n){if(!e||!e.trim())return"";var r=function(e){switch(e){case"casual":return"conversational and friendly, using a casual tone";case"formal":return"professional and formal, using proper language";case"persuasive":return"persuasive and compelling, designed to convince the reader";default:return"informative and educational, focusing on providing valuable information"}}(a),o=function(e){switch(e){case"short":return"Keep the content concise and to the point, around 150-250 words.";case"long":return"Create comprehensive content with detailed explanations, around 500-800 words.";default:return"Write a moderate-length content of approximately 300-500 words."}}(n),s="Generate content using proper HTML structure for '".concat(e,"'. ");return t&&t.trim()?s+="Include relevant details based on ".concat(t," throughout the content. "):s+="Include relevant details throughout the content. ",(s+="Ensure all text is enclosed with <p> tags, use appropriate heading tags (<h1>, <h2>, etc.) for structure, and apply a <span> tag with the class 'highlight' to important terms for emphasis. ")+"The content should be ".concat(r,". ").concat(o," ")},te=0===(0,r.select)("core/block-editor").getBlocks().length;return null!==(e=EssentialBlocksLocalize)&&void 0!==e&&e.hasOpenAiApiKey?"1"!==(null===(t=EssentialBlocksLocalize)||void 0===t?void 0:t.enableWriteAIPageContent)?"":React.createElement(React.Fragment,null,React.createElement(l.Button,{onClick:function(){return Y()},className:"eb-write-ai-button"},React.createElement("img",{src:"".concat(null===(a=EssentialBlocksLocalize)||void 0===a?void 0:a.eb_plugins_url,"assets/images/eb-logo.svg"),alt:"Essential Blocks Icon"})," ",(0,s.__)("Write With AI","essential-blocks")),g&&React.createElement(l.Popover,{className:"eb-write-ai-popover"},React.createElement("div",{className:"eb-write-ai-popover-content"},React.createElement("div",{className:"ai-content-generator"},React.createElement("div",{className:"eb-write-ai-header"},React.createElement("h2",{className:"eb-write-ai-heading"},React.createElement(c,null),(0,s.__)("Write Content with Essential Blocks AI","essential-blocks")),React.createElement("p",{className:"eb-write-ai-description"},(0,s.__)("Generate high-quality posts, pages, custom post types and product descriptions effortlessly with Essential Blocks AI. Simply input your title, keywords, prompt, and let the system automatically generate engaging and structured content tailored to your needs.","essential-blocks"))),React.createElement("div",{className:"eb-write-ai-form"},!(null!==(u=EssentialBlocksLocalize)&&void 0!==u&&u.hasOpenAiApiKey)&&React.createElement("div",{className:"eb-write-ai-api-key-warning"},React.createElement("p",null,(0,s.__)("Please Insert your OpenAI API Key to use this Write with AI feature.","essential-blocks")),React.createElement("a",{href:"".concat(null===(d=EssentialBlocksLocalize)||void 0===d?void 0:d.eb_admin_url,"admin.php?page=essential-blocks&tab=ai-suite"),target:"_blank",rel:"noopener noreferrer"},(0,s.__)("OpenAI API Key will redirect to our Write with AI Dashboard","essential-blocks"))),React.createElement(l.TextControl,{label:(0,s.__)("Content Title:","essential-blocks"),value:A,onChange:function(e){if(x(e),e.trim()){var t=ee(e,T,G,M);P(t),V(!0)}else P(""),V(!1)},placeholder:(0,s.__)("Enter a descriptive title for your post, page or custom post type.","essential-blocks"),className:"eb-write-ai-topic"}),React.createElement(l.TextControl,{label:(0,s.__)("Keywords:","essential-blocks"),value:T,onChange:function(e){if(j(e),A.trim()){var t=ee(A,e,G,M);P(t),V(!0)}},placeholder:(0,s.__)("Add keywords to generate precise & relevant content (comma-separated).","essential-blocks"),className:"eb-write-ai-keywords"}),React.createElement(l.TextareaControl,{label:(0,s.__)("Prompt:","essential-blocks"),value:O,onChange:function(e){P(e),U&&V(!1)},placeholder:(0,s.__)("Generate content using proper HTML structure for '{Content Title}'. Include relevant details based on {Content Keywords} throughout the content. Ensure all text is enclosed with <p> tags, use appropriate heading tags (<h1>, <h2>, etc.) for structure, and apply a <span> tag with the class 'highlight' to important terms for emphasis.","essential-blocks"),rows:6,className:"eb-write-ai-prompt",help:(0,s.__)("Ensure you include a clear and detailed prompt to receive the best possible output. Follow the provided guidelines for optimal results.","essential-blocks")}),React.createElement(l.SelectControl,{label:(0,s.__)("Content Tone:","essential-blocks"),value:G,options:[{label:(0,s.__)("Informative","essential-blocks"),value:"informative"},{label:(0,s.__)("Casual","essential-blocks"),value:"casual"},{label:(0,s.__)("Formal","essential-blocks"),value:"formal"},{label:(0,s.__)("Persuasive","essential-blocks"),value:"persuasive"}],onChange:function(e){if($(e),A.trim()){var t=ee(A,T,e,M);P(t),V(!0)}},className:"eb-write-ai-tone"}),React.createElement(l.SelectControl,{label:(0,s.__)("Desired Content Length:","essential-blocks"),value:M,options:[{label:(0,s.__)("Short (around 150-250 words)","essential-blocks"),value:"short"},{label:(0,s.__)("Medium (around 300-500 words)","essential-blocks"),value:"medium"},{label:(0,s.__)("Long (around 500-800 words)","essential-blocks"),value:"long"}],onChange:function(e){if(K(e),A.trim()){var t=ee(A,T,G,e);P(t),V(!0)}},className:"eb-write-ai-length"}),!te&&React.createElement(l.ToggleControl,{label:(0,s.__)("Overwrite existing content","essential-blocks"),checked:Z,onChange:function(e){return J(e)},help:(0,s.__)("If enabled, all existing content will be removed before inserting the generated content.","essential-blocks"),className:"eb-write-ai-overwrite"}),React.createElement("div",{className:"eb-write-ai-generate-button-wrapper"},React.createElement(l.Button,{className:"eb-write-ai-generate-button ".concat(C?"eb-button-error":""),onClick:function(){return function(){var e;if(O){k(!0),R(!1);var t=O+"\n\nIMPORTANT: Do not include any <html> or <head> or <body> tag in your response. Provide content only for body. Do not add \\n for line breaks. Our system will handle the formatting.",a=new FormData;a.append("action","write_with_ai"),a.append("admin_nonce",EssentialBlocksLocalize.admin_nonce),a.append("prompt",t),a.append("overwrite",Z),a.append("content_for","writePageContent"),fetch(null===(e=EssentialBlocksLocalize)||void 0===e?void 0:e.ajax_url,{method:"POST",body:a}).then(function(e){return e.json()}).then(function(e){if(k(!1),e.success){var t=e.data.content,a=(0,r.dispatch)("core/block-editor");if(Z){var n=(0,(0,r.select)("core/block-editor").getBlocks)();n.length>0&&a.removeBlocks(n.map(function(e){return e.clientId}))}var o=function(e){for(var t=e.split(/\r?\n/),a=[],n="",r=function(e){return e.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>")},o=function(e){if(e.trim()){var t=r(e.trim());a.push((0,i.createBlock)("essential-blocks/text",{tagName:"p",text:t,source:"custom"}))}},s=0;s<t.length;s++){var l=t[s].trim();if(l){var c=l.match(/<h([1-6])>(.*?)<\/h\1>/i);if(c)n&&(o(n),n=""),a.push((0,i.createBlock)("essential-blocks/advanced-heading",{tagName:"h"+c[1],titleText:r(c[2].trim()),source:"custom"}));else{var u=l.match(/^(#{1,6})\s+(.+)$/);if(u)n&&(o(n),n=""),a.push((0,i.createBlock)("essential-blocks/advanced-heading",{tagName:"h"+u[1].length,titleText:r(u[2]),source:"custom"}));else{var d=l.match(/^\*\*(.*)\*\*$/);if(d)n&&(o(n),n=""),a.push((0,i.createBlock)("essential-blocks/advanced-heading",{tagName:"h3",titleText:d[1],source:"custom"}));else if(!l.match(/^(\d+)\.?\s+(.+)$/)||0!==s&&t[s-1].trim()&&!t[s-1].match(/^(\d+)\.?\s+/))if(l.match(/^[*-]\s+/)||l.match(/^\d+\.\s+/)){n&&(o(n),n="");var m=l.replace(/^[*-]\s+|^\d+\.\s+/,"").trim();o("".concat(m))}else l.match(/[.!?]$/)&&(s===t.length-1||!t[s+1].trim()||t[s+1].match(/^[A-Z]/)||t[s+1].match(/^[*#\-]/)||t[s+1].match(/^\d+\./))?(o(n+=(n?" ":"")+l),n=""):n+=(n?" ":"")+l;else n&&(o(n),n=""),o(l)}}}else n&&(o(n),n="")}return n&&a.push((0,i.createBlock)("essential-blocks/text",{tagName:"p",text:n,source:"custom"})),0===a.length&&e.trim()&&a.push((0,i.createBlock)("essential-blocks/text",{tagName:"p",text:e.trim(),source:"custom"})),a}(t);a.insertBlocks(o),b(!1)}else R(!0),console.error("Error generating content:",e.data.message),alert((0,s.__)("Error generating content. Please try again.","essential-blocks"))}).catch(function(e){k(!1),R(!0),console.error("AJAX Error:",e),alert((0,s.__)("Error connecting to the server. Please try again.","essential-blocks"))})}else alert((0,s.__)("Please enter a prompt","essential-blocks"))}()},isPrimary:!0,disabled:w||!O||!(null!==(m=EssentialBlocksLocalize)&&void 0!==m&&m.hasOpenAiApiKey)},React.createElement(c,null),!C&&!w&&(0,s.__)("Generate Content","essential-blocks"),!C&&w&&React.createElement(React.Fragment,null,(0,s.__)("Generating...","essential-blocks"),React.createElement("img",{className:"eb-install-loader",src:"".concat(EssentialBlocksLocalize.eb_plugins_url,"/assets/images/loading.svg"),alt:(0,s.__)("Loading","essential-blocks")})),C&&(0,s.__)("Something went wrong!","essential-blocks")))))),React.createElement("a",{className:"eb-write-ai-close-btn",href:"#",onClick:function(){return Y()}},React.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("g",{"clip-path":"url(#clip0_435_1560)"},React.createElement("path",{d:"M15 4.75L5 14.75",stroke:"#667085",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),React.createElement("path",{d:"M5 4.75L15 14.75",stroke:"#667085",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})),React.createElement("defs",null,React.createElement("clipPath",{id:"clip0_435_1560"},React.createElement("rect",{width:"20",height:"20",fill:"white"}))))))):""};document.addEventListener("DOMContentLoaded",function(){var e=document.createElement("div");e.classList.add("eb-write-ai-button-wrapper"),(0,n.createRoot)(e).render(React.createElement(u,null)),(0,r.subscribe)(function(){var t=document.querySelector(".editor-header__settings");t&&(t.querySelector(".eb-write-ai-button-wrapper")||t.prepend(e))})})}},a={};function n(e){var r=a[e];if(void 0!==r)return r.exports;var o=a[e]={exports:{}};return t[e](o,o.exports,n),o.exports}n.m=t,e=[],n.O=(t,a,r,o)=>{if(!a){var s=1/0;for(u=0;u<e.length;u++){for(var[a,r,o]=e[u],l=!0,i=0;i<a.length;i++)(!1&o||s>=o)&&Object.keys(n.O).every(e=>n.O[e](a[i]))?a.splice(i--,1):(l=!1,o<s&&(s=o));if(l){e.splice(u--,1);var c=r();void 0!==c&&(t=c)}}return t}o=o||0;for(var u=e.length;u>0&&e[u-1][2]>o;u--)e[u]=e[u-1];e[u]=[a,r,o]},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.j=9101,(()=>{var e={9101:0};n.O.j=t=>0===e[t];var t=(t,a)=>{var r,o,[s,l,i]=a,c=0;if(s.some(t=>0!==e[t])){for(r in l)n.o(l,r)&&(n.m[r]=l[r]);if(i)var u=i(n)}for(t&&t(a);c<s.length;c++)o=s[c],n.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return n.O(u)},a=globalThis.webpackChunkessential_blocks=globalThis.webpackChunkessential_blocks||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})();var r=n.O(void 0,[3935],()=>n(2031));r=n.O(r)})();
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0.04 |
proxy
|
phpinfo
|
Настройка