Edit file File name : sidebar-plugin-compiled.js Content :!function(){"use strict";var e=window.wp.element;const{__:__}=wp.i18n,t=t=>{let{score:a,tti:o,device:r}=t,s="two-score-mobile";return"Desktop"==r&&(s="two-score-desktop"),(0,e.createElement)("div",{className:s},(0,e.createElement)("div",{className:"two-score-circle two_circle_with_bg","data-id":r,"data-thickness":"2","data-size":"40","data-score":a,"data-loading-time":o},(0,e.createElement)("span",{className:"two-score-circle-animated"})),(0,e.createElement)("div",{className:"two-score-text"},(0,e.createElement)("span",{className:"two-score-text-name"},__(r+" score","tenweb-speed-optimizer")),(0,e.createElement)("span",{className:"two-load-text-time"},__("Load time:","tenweb-speed-optimizer")," ",(0,e.createElement)("span",{className:"two-load-time"}),"s")))};var a=window.React;const{__:o}=wp.i18n,{__:r}=wp.i18n,s=t=>{let a,{title:o}=t;return a="Reload in 2 minutes to see<br> the new score",(0,e.createElement)("span",{className:"two-page-speed two-optimizing two-loading-bg"},r(o,"tenweb-speed-optimizer"),(0,e.createElement)("p",{className:"two-description",dangerouslySetInnerHTML:{__html:"Reload in 2 minutes to see<br> the new score"}}))},{__:n}=wp.i18n,i=r=>{let{metas:i,post_id:c}=r,l=(e=>{let t,{post_id:a,metas:o}=e;return t="front_page"==a?two_speed.two_front_page_speed:o.two_page_speed,t})({post_id:c,metas:i}),p=(t=>{let{post_id:r,score_data:s}=t,n=!1,i=!1,c=!1;s&&(s.current_score&&s.current_score.status&&"inprogress"==s.current_score.status&&(n=!0,i=!0),s.previous_score&&s.previous_score.status&&"inprogress"==s.previous_score.status&&(n=!0,c=!0));let l="",p="",m="new",d="",_="",w="";s&&s.previous_score&&!c||(l="two-no-scores",m="old"),s&&s.current_score&&!i||(p="two-no-scores"),""!=l&&""!=p&&(m="both");const[u,g]=(0,a.useState)(n),[b,E]=(0,a.useState)(!1),[z,h]=(0,a.useState)(p),f=(e,t)=>{if(!u){g(!0),"button"==t&&(E(!0),h("two-no-scores"));const o=two_speed.ajax_url;var a=new FormData;a.append("action","two_recount_score"),a.append("post_id",e),a.append("nonce",two_speed.nonce),a.append("initiator","gutenberg"),a.append("reanalyze_score_for",m),fetch(o,{method:"POST",body:a}).then((e=>e.json())).then((e=>{console.log(e)})).catch((e=>console.log(e)))}};if(u)w=(0,e.createElement)("div",{className:"two-gutenberg-reanalyze_container two_reanalyze_loading"},(0,e.createElement)("a",{href:"#",className:"two_reanalyze_button"},o("Reanalyzing...","tenweb-speed-optimizer")),(0,e.createElement)("p",{className:"two-description"},o("Reload in 2 minutes to see the new score","tenweb-speed-optimizer"))),b?(_=(0,e.createElement)("span",{className:"two-page-speed two-optimizing"}),"both"==m&&(d=(0,e.createElement)("span",{className:"two-page-speed two-optimizing"}))):"both"==m?(d=(0,e.createElement)("span",{className:"two-page-speed two-optimizing"}),_=(0,e.createElement)("span",{className:"two-page-speed two-optimizing"})):"old"==m?d=(0,e.createElement)("span",{className:"two-page-speed two-optimizing"}):"new"==m&&(_=(0,e.createElement)("span",{className:"two-page-speed two-optimizing"}));else{w=(0,e.createElement)("div",{className:"two-gutenberg-reanalyze_container"},(0,e.createElement)("a",{onClick:()=>f(r,"button"),className:"two_reanalyze_button"},o("Reanalyze","tenweb-speed-optimizer")));let t=(0,e.createElement)("a",{onClick:()=>f(r,""),"data-post_id":r,target:"_blank",className:"two_reanalyze_link"});""!=l&&""!=p?(d=t,_=t):""!=l?(d=t,_=""):""!=p&&(d="",_=t)}return{score_check_button:w,score_check_link_before:d,score_check_link_after:_,no_new_scores:z,no_old_scores:l,reanalyzingStatus:u}})({post_id:c,score_data:l});(0,a.useEffect)((()=>{const e=document.getElementsByClassName("two-score-circle");for(let t=0;t<e.length;t++)two_draw_score_circle(e[t])}),[l]);const[m,d]=(0,a.useState)(!1);let _=0;l&&l.current_score&&(c in two_speed.critical_pages&&two_speed.critical_pages[c].critical_date?_=two_speed.critical_pages[c].critical_date:l.current_score.date&&(_=Date.parse(l.current_score.date)));let w="",u=!1;w=Date.parse(wp.data.select("core/editor").getEditedPostAttribute("modified")+"Z")/1e3,w>_&&0!=_&&(u=!0);let g=(0,e.createElement)("div",{className:"two-score-container-reoptimize"},(0,e.createElement)("a",{onClick:()=>(e=>{d(!0),fetch(two_speed.ajax_url+"?action=two_optimize_page&post_id="+e+"&nonce="+two_speed.nonce+"&initiator=gutenberg").then((e=>{}))})(c),"data-initiator":"gutenberg",className:"two-button-green "},n("Re-optimize","tenweb-speed-optimizer")));p.reanalyzingStatus&&(g=(0,e.createElement)("div",{className:"two-score-container-reoptimize"},(0,e.createElement)("a",{href:"#",className:"two-button-green two-deactivated-button"},n("Re-optimize","tenweb-speed-optimizer"))));const b=wp.data.select("core/editor").getEditedPostAttribute("title");if(m){let t="Re-optimizing...";return(0,e.createElement)(s,{title:t})}return(0,e.createElement)("div",{className:"two-score-section two-score-section-gutenberg"},(0,e.createElement)("p",{className:"two-gutenberg-container-title"},(0,e.createElement)("span",null,(0,e.createElement)("b",null,b)),n(" page is successfully optimized","tenweb-speed-optimizer")),(0,e.createElement)("div",{className:"two-score-container-both"},(0,e.createElement)("div",{className:"two-score-container-old"},(0,e.createElement)("div",{className:"two-score-header"},n("Before optimization","tenweb-speed-optimizer")),(0,e.createElement)("div",{className:"two-old-scores "+p.no_old_scores},(0,e.createElement)(t,{score:l&&l.previous_score&&l.previous_score.mobile_score,tti:l&&l.previous_score&&l.previous_score.mobile_tti,device:"Mobile"}),(0,e.createElement)(t,{score:l&&l.previous_score&&l.previous_score.desktop_score,tti:l&&l.previous_score&&l.previous_score.desktop_tti,device:"Desktop"}),p.score_check_link_before)),(0,e.createElement)("div",{className:"two-score-container-new"},(0,e.createElement)("div",{className:"two-score-header"},n("After optimization","tenweb-speed-optimizer")),(0,e.createElement)("div",{className:"two-new-scores "+p.no_new_scores},(0,e.createElement)(t,{score:l&&l.current_score&&l.current_score.mobile_score,tti:l&&l.current_score&&l.current_score.mobile_tti,device:"Mobile"}),(0,e.createElement)(t,{score:l&&l.current_score&&l.current_score.desktop_score,tti:l&&l.current_score&&l.current_score.desktop_tti,device:"Desktop"}),p.score_check_link_after))),p.score_check_button,u&&g)},{__:c}=wp.i18n,l=t=>{let{post_id:o}=t;const[r,n]=(0,a.useState)(!1);if(r){let t="Optimizing...";return(0,e.createElement)(s,{title:t})}{let t="",a="",r="";return 0!=two_speed.optimize_entire_website?(t="You’ve reached the Free Plan limit",a="Upgrade to 10Web Booster Pro to<br> optimize all pages and enable<br> Cloudflare Enterprise CDN.",r="Upgrade"):(t="Optimize with 10Web Booster",a="Get a 90+ PageSpeed score",r="Optimize now"),(0,e.createElement)("span",{className:"two-editor-page-speed two-notoptimized "},(0,e.createElement)("b",null,c(t,"tenweb-speed-optimizer")),(0,e.createElement)("p",{dangerouslySetInnerHTML:{__html:a}}),(0,e.createElement)("a",{onClick:()=>(e=>{0!=two_speed.optimize_entire_website?window.open(two_speed.optimize_entire_website+"?two_comes_from=gutenbergAfterLimit","_blank"):(n(!0),fetch(two_speed.ajax_url+"?action=two_optimize_page&post_id="+e+"&nonce="+two_speed.nonce+"&initiator=gutenberg").then((e=>{})))})(o),"data-initiator":"gutenberg",className:"two-button-green"},c(r,"tenweb-speed-optimizer")))}},{registerPlugin:p}=wp.plugins,{__:m}=wp.i18n,{PluginDocumentSettingPanel:d,PluginSidebarMoreMenuItem:_,PluginSidebar:w}=wp.editPost,{PanelRow:u}=wp.components,{Fragment:g}=wp.element,b=()=>{var t=wp.data.select("core/editor").getCurrentPostId();two_speed.front_page_id==t&&(t="front_page");const a=wp.data.select("core/editor").getCurrentPostAttribute("meta");let o="optimized";if(two_speed.optimizing_in_progress?o="optimizing":t in two_speed.critical_pages||(o="notOptimized"),"optimized"==o)return(0,e.createElement)(g,null,(0,e.createElement)(u,null,(0,e.createElement)(i,{metas:a,post_id:t})));if("notOptimized"==o)return(0,e.createElement)(u,null,(0,e.createElement)(l,{post_id:t}));{let t="Optimizing...";return(0,e.createElement)(u,null,(0,e.createElement)(s,{title:t}))}};p("booster-sidebar-panel",{render:()=>{const t=wp.data.select("core/editor").getCurrentPostType();return["post","page"].includes(t)&&"publish"==wp.data.select("core/editor").getCurrentPost().status?(0,e.createElement)(g,null,(0,e.createElement)(_,{target:"awp-custom-sidebar"},m("10Web Booster","tenweb-speed-optimizer")),(0,e.createElement)(w,{title:m("10Web Booster","tenweb-speed-optimizer")},(0,e.createElement)(b,null))):""},icon:(0,e.createElement)("svg",{className:"two-speed-icon",xmlns:"http://www.w3.org/2000/svg",width:"26",height:"26",viewBox:"0 0 26 26"},(0,e.createElement)("g",{id:"Group_103139","data-name":"Group 103139",transform:"translate(0 -0.391)"},(0,e.createElement)("path",{id:"Path_171039","data-name":"Path 171039",d:"M.441,38.127h0a1.445,1.445,0,0,0,2.065-.037l7.924-6.038a.131.131,0,0,0,.033-.18.126.126,0,0,0-.158-.045l-9.409,4a1.426,1.426,0,0,0-.52,2.23Z",transform:"translate(-0.028 -23.443)",fill:"#fff"}),(0,e.createElement)("path",{id:"Path_171040","data-name":"Path 171040",d:"M5.434,48.088a1.443,1.443,0,0,1-2.063.039l0,0L.462,45.274l-.034-.029-.06-.063a1.427,1.427,0,0,1,.12-1.992,1.393,1.393,0,0,1,.4-.252L4.295,41.49,3.723,42a1.571,1.571,0,0,0-.163,2.191q.045.054.095.1l1.74,1.7a1.5,1.5,0,0,1,.039,2.1",transform:"translate(-0.014 -30.56)",fill:"#9ea3a8"}),(0,e.createElement)("path",{id:"Path_171041","data-name":"Path 171041",d:"M69.869,43.142h0a1.445,1.445,0,0,0-2.065.037l-7.911,6.038a.131.131,0,0,0-.033.18.126.126,0,0,0,.158.045l9.4-4a1.426,1.426,0,0,0,.52-2.23Z",transform:"translate(-44.277 -31.469)",fill:"#fff"}),(0,e.createElement)("path",{id:"Path_171042","data-name":"Path 171042",d:"M78,32.276a1.443,1.443,0,0,1,2.063-.039l0,0,2.907,2.851L83,35.12l.06.063a1.427,1.427,0,0,1-.12,1.992,1.393,1.393,0,0,1-.4.252l-3.407,1.448.572-.507a1.571,1.571,0,0,0,.163-2.191q-.045-.054-.095-.1l-1.742-1.7a1.5,1.5,0,0,1-.036-2.1",transform:"translate(-57.411 -23.446)",fill:"#9ea3a8"}),(0,e.createElement)("path",{id:"Path_171043","data-name":"Path 171043",d:"M31.607,23.5l5.172-7.19a.126.126,0,0,0,0-.176.121.121,0,0,0-.173,0l-13.2,10.025a.131.131,0,0,0-.03.18.127.127,0,0,0,.106.055h4.143a.136.136,0,0,1,.134.139.138.138,0,0,1-.025.078L22.56,33.8a.126.126,0,0,0,0,.176.121.121,0,0,0,.173,0l13.2-10.025a.131.131,0,0,0,.03-.18.127.127,0,0,0-.106-.055H31.717a.136.136,0,0,1-.134-.139.138.138,0,0,1,.025-.078",transform:"translate(-16.668 -11.879)",fill:"#9ea3a8"})))}),p("booster-settings-panel",{render:()=>{const t=wp.data.select("core/editor").getCurrentPostType();return["post","page"].includes(t)&&"publish"==wp.data.select("core/editor").getCurrentPost().status?(0,e.createElement)(g,null,(0,e.createElement)(d,{name:"awp-custom-sidebar",title:m("10Web Booster","tenweb-speed-optimizer")},(0,e.createElement)(b,null))):""},icon:""})}(); Save