30 lines
73 KiB
JavaScript
30 lines
73 KiB
JavaScript
|
|
"use strict";(globalThis.__googlesitekit_webpackJsonp=globalThis.__googlesitekit_webpackJsonp||[]).push([[474],{2362:(e,t,i)=>{i.d(t,{A:()=>d});var r=i(4452),n=i.n(r),s=i(62688),o=i.n(s),a=i(63696),l=i(62540);const c=(0,a.forwardRef)(({label:e,className:t,hasLeftSpacing:i=!1,...r},s)=>(0,l.jsx)("span",{ref:s,...r,className:n()("googlesitekit-badge",t,{"googlesitekit-badge--has-left-spacing":i}),children:e}));c.displayName="Badge",c.propTypes={label:o().string.isRequired,hasLeftSpacing:o().bool};const d=c},2522:(e,t,i)=>{i.d(t,{D:()=>s});var r=i(32091),n=i.n(r);function s(e,{dateRangeLength:t}){n()(Array.isArray(e),"report must be an array to partition."),n()(Number.isInteger(t)&&t>0,"dateRangeLength must be a positive integer.");const i=-1*t;return{currentRange:e.slice(i),compareRange:e.slice(2*i,i)}}},3687:(e,t,i)=>{i.d(t,{U:()=>m});var r=i(32091),n=i.n(r),s=i(17243),o=i(21125),a=i(71769),l=i(12850),c=i(50539);function d(e){return e}function g(){return{}}function p(){}const{clearError:u,receiveError:h}=o.o1;function m({baseName:e,controlCallback:t,reducerCallback:i=d,argsToParams:r=g,validateParams:o=p}){let m;n()(e,"baseName is required."),n()("function"==typeof t,"controlCallback is required and must be a function."),n()("function"==typeof i,"reducerCallback must be a function."),n()("function"==typeof r,"argsToParams must be a function."),n()("function"==typeof o,"validateParams must be a function.");try{o(r()),m=!1}catch(e){m=!0}const f=(0,a.m2)(e),_=(0,a.sP)(e),b=`FETCH_${_}`,v=`START_${b}`,y=`FINISH_${b}`,k=`CATCH_${b}`,A=`RECEIVE_${_}`,x=`fetch${f}`,w=`receive${f}`,R=`isFetching${f}`,N={[R]:{}};const S={[x](...t){const i=r(...t);return o(i),function*(t,i){let r,n;yield{payload:{params:t},type:v},yield u(e,i);try{r=yield{payload:{params:t},type:b},yield S[w](r,t),yield{payload:{params:t},type:y}}catch(r){n=r,yield h(n,e,i),yield{payload:{params:t},type:k}}return{response:r,error:n}}(i,t)},[w]:(e,t)=>(n()(void 0!==e,"response is required."),m?(n()((0,s.isPlainObject)(t),"params is required."),o(t)):t={},{payload:{response:e,params:t},type:A})},j={[b]:({payload:e})=>t(e.params)},E=(0,c.createReducer)((e,{type:t,payload:r})=>{switch(t){case v:{const{params:t}=r;return e[R]=e[R]||{},e[R][(0,l.Zm)(t)]=!0,e}case A:{const{response:t,params:n}=r;return i(e,t,n)}case y:{const{params:t}=r;return e[R]=e[R]||{},e[R][(0,l.Zm)(t)]=!1,e}case k:{const{params:t}=r;return e[R]=e[R]||{},e[R][(0,l.Zm)(t)]=!1,e}default:return e}});return{initialState:N,actions:S,controls:j,reducer:E,resolvers:{},selectors:{[R]:(e,...t)=>{if(void 0===e[R])return!1;let i;try{i=r(...t),o(i)}catch(e){return!1}return!!e[R][(0,l.Zm)(i)]}}}}},3714:(e,t,i)=>{i.d(t,{Kk:()=>s,SZ:()=>r,Yw:()=>o,oJ:()=>a,tT:()=>n});const r="body",n=[r,"display","headline","label","title"],s="small",o="medium",a=[s,o,"large"]},7070:(e,t,i)=>{i.d(t,{A:()=>o});var r=i(63696),n=i(77766),s=i(12850);function o(e,t,{viewAction:i="view_notification",confirmAction:o="confirm_notification",dismissAction:a="dismiss_notification",clickLearnMoreAction:l="click_learn_more_link"}={}){const c=(0,n.A)(),d=null!=t?t:`${c}_${e}`;return{view:(0,r.useCallback)((...e)=>(0,s.sx)(d,i,...e),[d,i]),confirm:(0,r.useCallback)((...e)=>(0,s.sx)(d,o,...e),[d,o]),dismiss:(0,r.useCallback)((...e)=>(0,s.sx)(d,a,...e),[d,a]),clickLearnMore:(0,r.useCallback)((...e)=>(0,s.sx)(d,l,...e),[d,l])}}},7081:(e,t,i)=>{i.d(t,{F:()=>n,n:()=>r});const r="core/ui",n="activeContextID"},8143:(e,t,i)=>{i.d(t,{VZ:()=>s,dc:()=>o,pH:()=>n,r0:()=>a});var r=i(84024);function n(e){try{return new URL(e).pathname}catch{}return null}function s(e,t){try{return new URL(t,e).href}catch{}return("string"==typeof e?e:"")+("string"==typeof t?t:"")}function o(e){return"string"!=typeof e?e:e.replace(/^https?:\/\/(www\.)?/i,"").replace(/\/$/,"")}function a(e,t){if(!(0,r.m)(e))return e;if(e.length<=t)return e;const i=new URL(e),n=e.replace(i.origin,"");if(n.length<t)return n;const s=n.length-Math.floor(t)+1;return"…"+n.substr(s)}},10953:(e,t,i)=>{i.d(t,{A:()=>InfoTooltip});var r,n=i(4452),s=i.n(n),o=i(62688),a=i.n(o),l=i(49383),c=i(63696);function
|
||
|
|
(0,v._n)("Last %s day","Last %s days",e,"google-site-kit"),e)}return{"last-7-days":{slug:"last-7-days",label:e(7),days:7},"last-14-days":{slug:"last-14-days",label:e(14),days:14},"last-28-days":{slug:"last-28-days",label:e(28),days:28},"last-90-days":{slug:"last-90-days",label:e(90),days:90}}}function j(e=""){if(!(0,r.isString)(e))return!1;if(3!==e.split("-").length)return!1;const t=new Date(e);return(0,r.isDate)(t)&&!isNaN(t)}function E(e){b()((0,r.isDate)(e)&&!isNaN(e),y);const t=`${e.getMonth()+1}`,i=`${e.getDate()}`;return[e.getFullYear(),t.length<2?`0${t}`:t,i.length<2?`0${i}`:i].join("-")}function T(e){b()(j(e),k);const[t,i,r]=e.split("-");return new Date(t,i-1,r)}function O(e,t){return E(I(e,t*R))}function D(e){const t=e.split("-");return 3===t.length&&"last"===t[0]&&!Number.isNaN(t[1])&&!Number.isNaN(parseFloat(t[1]))&&"days"===t[2]}function I(e,t){b()(j(e)||(0,r.isDate)(e)&&!isNaN(e),k);const i=j(e)?Date.parse(e):e.getTime();return new Date(i-1e3*t)}var C=i(69743),L=i(94552),M=i(62540);function P(e,t={}){if(Number.isNaN(Number(e)))return"";const{invertColor:i=!1}=t;return(0,C.Ay)((0,M.jsx)(L.A,{direction:e>0?"up":"down",invertColor:i}))}function H(e,t){return e>0&&t>0?e/t-1:e>0?1:t>0?-1:0}var B=i(8143);function F(e){const t=parseFloat(e)||0;return!!Number.isInteger(t)&&t>0}function $(e){if("number"==typeof e)return!0;const t=(e||"").toString();return!!t&&!isNaN(t)}function U(e){return Array.isArray(e)?[...e].sort():e}var q=i(2522);function z(e,t){function i(e){return"0"===e||0===e}if(i(e)&&i(t))return 0;if(i(e)||Number.isNaN(e))return null;const r=(t-e)/e;return Number.isNaN(r)||!Number.isFinite(r)?null:r}function W(e){try{return JSON.parse(e)&&!!e}catch(e){return!1}}function V(e){if(!e)return"";const t=e.replace(/&#(\d+);/g,(e,t)=>String.fromCharCode(t)).replace(/(\\)/g,"");return(0,r.unescape)(t)}},13620:e=>{e.exports=googlesitekit.modules},15167:(e,t,i)=>{i.d(t,{A:()=>Typography});var r=i(62688),n=i.n(r),s=i(4452),o=i.n(s),a=i(3714),l=i(62540);function Typography({className:e,type:t,size:i,as:r="span",children:n,...s}){return(0,l.jsx)(r,{className:o()("googlesitekit-typography",e,{[`googlesitekit-typography--${t}`]:t&&a.tT.includes(t),[`googlesitekit-typography--${i}`]:i&&a.oJ.includes(i)}),...s,children:n})}Typography.propTypes={className:n().string,type:n().oneOf(a.tT),size:n().oneOf(a.oJ),as:n().oneOfType([n().string,n().elementType])}},15210:(e,t,i)=>{i.d(t,{O:()=>n});var r=i(31234);const n=i.n(r)()(i.g)},15577:(e,t,i)=>{i.d(t,{SO:()=>c});var r=i(55620),n=i(99123);const s={},o=void 0===i.g?null:i.g;function a(){return[i.g.innerWidth,i.g.innerHeight]}function l(e=s){const{fps:t,leading:i,initialWidth:l=0,initialHeight:c=0}=e,[d,g]=(0,r._)("undefined"==typeof document?[l,c]:a,t,i);function p(){return g(a)}return(0,n.A)(o,"resize",p),(0,n.A)(o,"orientationchange",p),d}function c(e){return l(e)[0]}},16196:(e,t,i)=>{i.d(t,{A:()=>a});var r=i(50539),n=i(37226),s=i(71769),o=i(62540);function a({moduleName:e,FallbackComponent:t,IncompleteComponent:i}){return a=>{function WhenActiveComponent(s){const l=(0,r.useSelect)(t=>t(n.i).getModule(e),[e]);if(!l)return null;const c=t||s.WidgetNull||null;if(!1===l.active)return c&&(0,o.jsx)(c,{...s});if(!1===l.connected){const e=i||c;return e&&(0,o.jsx)(e,{...s})}return(0,o.jsx)(a,{...s})}return WhenActiveComponent.displayName=`When${(0,s.Uf)(e)}Active`,(a.displayName||a.name)&&(WhenActiveComponent.displayName+=`(${a.displayName||a.name})`),WhenActiveComponent}}},19793:(e,t,i)=>{i.d(t,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var r,n=i(63696);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},s.apply(null,arguments)}const __WEBPACK_DEFAULT_EXPORT__=e=>n.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},e),r||(r=n.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 1C5.925 1 1 5.925 1 12s4.925 11 11 11 11-4.925 11-11S18.075 1 12 1m4.806 8.592.592-.806-1.612-1.184-.592.806-3.89 5.296c-.166
|
||
|
|
(0,g.__)('To view insights, <a href="%s">visit the dashboard</a>',"google-site-kit"),`${e}#speed`);return(0,x.jsx)("p",{dangerouslySetInnerHTML:(0,h.p9)(t,{ALLOWED_TAGS:["a"],ALLOWED_ATTR:["href"]})})}var w=i(4452),R=i.n(w),N=i(63560),S=i(63696),j=i(49383),E=i(89318),T=i(93896),O=i(7081),D=i(77766),I=i(62688),C=i.n(I),L=i(23224);function PreviewBlocks({width:e,height:t,shape:i,count:r,smallWidth:n,smallHeight:s,tabletWidth:o,tabletHeight:a,desktopWidth:l,desktopHeight:c}){const d=[];let g=0;for(;g++<r;)d.push((0,x.jsx)(L.A,{width:e,height:t,shape:i,smallWidth:n,smallHeight:s,tabletWidth:o,tabletHeight:a,desktopWidth:l,desktopHeight:c},g));return d}PreviewBlocks.propTypes={width:C().string,height:C().string,shape:C().string,count:C().number,smallWidth:C().string,smallHeight:C().string,tabletWidth:C().string,tabletHeight:C().string,desktopWidth:C().string,desktopHeight:C().string},PreviewBlocks.defaultProps={width:"100px",height:"100px",shape:"square",count:1};const M=PreviewBlocks;function Loading(){return(0,x.jsxs)("div",{className:"googlesitekit-pagespeed-widget__content",children:[(0,x.jsxs)("header",{className:"googlesitekit-pagespeed-widget__header",children:[(0,x.jsx)("div",{className:"googlesitekit-pagespeed-widget__data-src-tabs",children:(0,x.jsx)(M,{count:3,smallWidth:"70px",smallHeight:"48px",width:"120px",height:"48px"})}),(0,x.jsx)("div",{className:"googlesitekit-pagespeed-widget__device-size-tab-bar-wrapper",children:(0,x.jsx)(M,{count:2,width:"56px",height:"32px"})})]}),(0,x.jsx)("section",{className:"googlesitekit-pagespeed-widget__values",children:(0,x.jsx)(M,{count:5,smallWidth:"100%",smallHeight:"90px",width:"100%",height:"78px"})}),(0,x.jsx)("div",{className:"googlesitekit-pagespeed-report__row",children:(0,x.jsx)(L.A,{width:"130px",height:"40px"})}),(0,x.jsx)("div",{className:"googlesitekit-pagespeed-report__footer",children:(0,x.jsx)(L.A,{width:"224px",height:"40px"})})]})}var P,H;function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},B.apply(null,arguments)}const F=e=>S.createElement("svg",B({xmlns:"http://www.w3.org/2000/svg",viewBox:"5 1 14 22"},e),P||(P=S.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),H||(H=S.createElement("path",{fill:"currentColor",d:"M17 1.01 7 1c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-1.99-2-1.99M17 19H7V5h10z"})));var $,U;function q(){return q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},q.apply(null,arguments)}const z=e=>S.createElement("svg",q({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 4 24 16"},e),$||($=S.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),U||(U=S.createElement("path",{fill:"currentColor",d:"M20 18c1.1 0 1.99-.9 1.99-2L22 6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2H0v2h24v-2zM4 6h16v10H4z"})));function DeviceSizeTabBar({activeTab:e,disabled:t=!1,handleDeviceSizeUpdate:i,deviceSizes:r=[{slug:"mobile",label:(0,g.__)("Mobile","google-site-kit"),icon:(0,x.jsx)(F,{width:"15",height:"22"})},{slug:"desktop",label:(0,g.__)("Desktop","google-site-kit"),icon:(0,x.jsx)(z,{width:"23",height:"17"})}]}){const n=(0,S.useCallback)(e=>{const t=r[e];i(t,e)},[r,i]);if(!r?.length)return null;const s=r.findIndex(({slug:t})=>t===e);return(0,x.jsx)(j.TabBar,{className:"googlesitekit-device-size-tab-bar",activeIndex:s,handleActiveIndexUpdate:n,children:r.map(({icon:e,label:i},r)=>(0,x.jsx)(j.Tab,{"aria-label":i,disabled:t,focusOnActivate:!1,children:e},`google-sitekit-device-size-tab-key-${r}`))})}DeviceSizeTabBar.propTypes={activeTab:C().string,disabled:C().bool,deviceSizes:C().arrayOf(C().shape({label:C().string,slug:C().string,icon:C().node})),handleDeviceSizeUpdate:C().func},DeviceSizeTabBar.defaultProps={handleDeviceSizeUpdate:()=>{}};const W=DeviceSizeTabBar,V=(0,S.forwardRef)(({isFetching:e,updateActiveTab:t,recommendations:i=[]},n)=>{const s=(0,r.useSelect)(e=>e(O.n).g
|
||
|
|
(0,g.__)("View details at %s","google-site-kit"),`<a>${(0,g._x)("PageSpeed Insights","Service name","google-site-kit")}</a>`),{a:(0,x.jsx)(G.A,{href:t,external:!0})})})}const Q="pagespeed-insights";var J=i(27240);function Footer({isFetching:e}){const t=(0,r.useSelect)(e=>e(T.O4).getCurrentReferenceURL()),i=(0,r.useSelect)(e=>e(O.n).getValue(A))||b,{invalidateResolution:n}=(0,r.useDispatch)(m),s=(0,S.useCallback)(async e=>{e.preventDefault(),await(0,Y.invalidateCache)("modules",Q,"pagespeed"),n("getReport",[t,_]),n("getReport",[t,f])},[n,t]);return(0,x.jsxs)("div",{className:R()("googlesitekit-pagespeed-report__footer",{"googlesitekit-pagespeed-report__footer--with-action":i===b}),children:[i===b&&(0,x.jsxs)("div",{children:[(0,x.jsx)(G.A,{onClick:s,disabled:e,children:(0,g.__)("Run test again","google-site-kit")}),(0,x.jsx)(J.A,{isSaving:e})]}),(0,x.jsx)(ReportDetailsLink,{})]})}const X="fast",ee="average",te="slow";var ie=i(2362),re=i(10953);function ReportMetric({title:e,description:t,displayValue:i,category:r,experimental:n,isLast:s,isHidden:o,isUnavailable:a,hintText:l}){return r=r?.toLowerCase(),(0,x.jsxs)("tr",{className:R()("googlesitekit-pagespeed-report__row","googlesitekit-pagespeed-report-metric",{"googlesitekit-pagespeed-report__row--last":s,"googlesitekit-pagespeed-report__row--hidden":o,"googlesitekit-pagespeed-report__row--unavailable":a}),children:[(0,x.jsxs)("td",{children:[(0,x.jsxs)("div",{className:"googlesitekit-pagespeed-report-metric__title",children:[e,!!n&&(0,x.jsx)(ie.A,{label:(0,g.__)("Experimental","google-site-kit"),className:"googlesitekit-pagespeed-report-metric__badge"}),a&&(0,x.jsx)(re.A,{title:(0,g.__)("Field data is still being gathered for this metric and will become available once your site gets sufficient traffic","google-site-kit")})]}),(0,x.jsx)("div",{className:"googlesitekit-pagespeed-report-metric__description",children:t}),l&&(0,x.jsx)("div",{className:"googlesitekit-pagespeed-report-metric__hint-text",children:l})]}),(0,x.jsx)("td",{className:R()("googlesitekit-pagespeed-report-metric-value",{[`googlesitekit-pagespeed-report-metric--${r}`]:!!r}),children:(0,x.jsxs)("div",{className:"googlesitekit-pagespeed-report-metric-value-container",children:[(0,x.jsx)("div",{className:"googlesitekit-pagespeed-report-metric-value__display-value",children:a?"—":i}),(0,x.jsxs)("div",{className:"googlesitekit-pagespeed-report-metric-value__rating",children:[a&&(0,x.jsx)("span",{children:(0,g.__)("gathering data","google-site-kit")}),!a&&r===X&&(0,x.jsx)("span",{children:(0,g._x)("Good","Performance rating","google-site-kit")}),!a&&r===ee&&(0,x.jsx)("span",{children:(0,g._x)("Needs improvement","Performance rating","google-site-kit")}),!a&&r===te&&(0,x.jsx)("span",{children:(0,g._x)("Poor","Performance rating","google-site-kit")})]})]})})]})}function MetricsLearnMoreLink(){return(0,x.jsx)(G.A,{href:"https://web.dev/user-centric-performance-metrics/#how-metrics-are-measured","aria-label":(0,g.__)("Learn more how metrics are measured.","google-site-kit"),external:!0,children:(0,g.__)("Learn more","google-site-kit")})}function ne(e){return.9<=e?X:.5<=e?ee:te}ReportMetric.propTypes={title:C().string.isRequired,description:C().string.isRequired,displayValue:C().string.isRequired,category:C().string,experimental:C().bool,isLast:C().bool,isHidden:C().bool,hintText:C().node};var se=i(67150),oe=i(35902),ae=i(77967);function LabReportMetrics({data:e,error:t}){const i=e?.lighthouseResult?.audits?.["largest-contentful-paint"],r=e?.lighthouseResult?.audits?.["cumulative-layout-shift"],n=e?.lighthouseResult?.audits?.["total-blocking-time"];if(t){const e=(0,se.e4)(t);return(0,x.jsx)("div",{className:"googlesitekit-pagespeed-insights-web-vitals-metrics",children:(0,x.jsxs)("div",{className:"googlesitekit-pagespeed-report__row googlesitekit-pagespeed-report__row--error",children:[(0,x.jsx)(ae.A,{error:t,message:e,hasButton:!0}),(0,x.jsx)(oe.A,{moduleSlug:"pagespeed-insights",error:t})]})})}return(0,x.jsxs)("div",{className:"googlesitekit-pagespeed-insights-web-vitals-metrics",children:[(0,x.jsx)("div",{clas
|
||
|
|
(0,g._x)("%s s","duration","google-site-kit"),s),category:i?.category,isUnavailable:!i}),(0,x.jsx)(ReportMetric,{title:(0,g._x)("Cumulative Layout Shift","core web vitals name","google-site-kit"),description:(0,g.__)("How stable the elements on the page are","google-site-kit"),displayValue:o,category:r?.category,isUnavailable:!r}),(0,x.jsx)(ReportMetric,{title:(0,g._x)("Interaction to Next Paint","core web vitals name","google-site-kit"),description:(0,g.__)("How quickly your page responds when people interact with it","google-site-kit"),displayValue:(0,g.sprintf)(/* translators: %s: number of milliseconds */ /* translators: %s: number of milliseconds */
|
||
|
|
(0,g._x)("%s ms","duration","google-site-kit"),n?.percentile),category:n?.category||ee,isUnavailable:!n,hintText:(0,K.A)((0,g.__)("INP is a new Core Web Vital that replaced FID in March 2024. <LearnMoreLink />","google-site-kit"),{LearnMoreLink:(0,x.jsx)(INPLearnMoreLink,{})}),isLast:!0})]})]})]})}FieldReportMetrics.propTypes={data:C().object,error:C().object};var ce=i(19266),de=i(80097),ge=i(84385);function Accordion({title:e,children:t,initialOpen:i,onOpen:r,onClose:n,disabled:s}){const[o,a]=(0,S.useState)(!!i);(0,S.useEffect)(()=>{o&&r&&"function"==typeof r?r():!o&&n&&"function"==typeof n&&n()},[o,n,r]),(0,S.useEffect)(()=>{s&&o&&a(!1)},[s,o]);const l=(0,S.useCallback)(e=>{("keydown"!==e.type||[ce.Fm,ce.t6].includes(e.keyCode))&&(e.preventDefault(),a(!o))},[o]);return(0,x.jsxs)("div",{className:R()("googlesitekit-accordion",{"googlesitekit-accordion--disabled":s}),children:[(0,x.jsxs)("div",{className:R()("googlesitekit-accordion__header",{"is-active":o}),onClick:l,onKeyDown:l,tabIndex:s?-1:0,role:"button",children:[e,(0,x.jsx)(ge.A,{children:(0,x.jsx)(de.A,{width:12,height:12})})]}),(0,x.jsx)("div",{className:R()("googlesitekit-accordion__content",{"is-active":o}),children:t})]})}function Recommendation(e){const{auditID:t,title:i,referenceURL:n,strategy:s}=e,o=(0,D.A)(),a=(0,S.useCallback)(()=>{(0,h.sx)(`${o}_pagespeed-widget`,"stack_pack_expand",t)},[t,o]),l=(0,r.useSelect)(e=>e(m).getStackPackDescription(n,s,t,"wordpress"));if(!l)return null;const c=(0,h.S_)(l.description);return(0,x.jsx)(Accordion,{id:t,title:i,onOpen:a,children:(0,x.jsx)("div",{dangerouslySetInnerHTML:(0,h.p9)(c,{ALLOWED_TAGS:["a","p"],ALLOWED_ATTR:["href","rel","target"]})})})}function Recommendations({className:e,recommendations:t,referenceURL:i,strategy:r}){return(0,x.jsxs)("div",{className:R()("googlesitekit-pagespeed--recommendations",e),children:[(0,x.jsx)("div",{className:"googlesitekit-pagespeed-recommendations__title",children:(0,g.__)("Recommendations on how to improve your site","google-site-kit")}),t.map(({id:e,title:t})=>(0,x.jsx)(Recommendation,{auditID:e,title:t,referenceURL:i,strategy:r},e))]})}function Content({isFetching:e,recommendations:t,reportData:i,reportError:n}){const s=(0,r.useSelect)(e=>e(T.O4).getCurrentReferenceURL()),o=(0,r.useSelect)(e=>e(O.n).getValue(k))||f,a=(0,r.useSelect)(e=>e(O.n).getValue(A))||b;return(0,x.jsxs)("section",{className:R()({"googlesitekit-pagespeed-widget__refreshing":e}),children:[a===b&&(0,x.jsx)(LabReportMetrics,{data:i,error:n}),a===v&&(0,x.jsx)(FieldReportMetrics,{data:i,error:n}),a===y&&t.length>0&&(0,x.jsx)(Recommendations,{className:R()({"googlesitekit-pagespeed-widget__refreshing":e}),recommendations:t,referenceURL:s,strategy:o})]})}Accordion.propTypes={title:C().node.isRequired,children:C().node.isRequired,initialOpen:C().bool,onOpen:C().func,onClose:C().func,disabled:C().bool},Recommendation.propTypes={auditID:C().string.isRequired,title:C().string.isRequired,referenceURL:C().string.isRequired,strategy:C().oneOf([f,_]).isRequired},Recommendations.propTypes={className:C().string,recommendations:C().arrayOf(C().object),referenceURL:C().string.isRequired,strategy:C().oneOf([f,_]).isRequired},Recommendations.defaultProps={className:""};function DashboardPageSpeed(){const e=(0,S.useRef)(),[t,i]=(0,S.useState)(!1),n=(0,D.A)(),s=(0,r.useSelect)(e=>e(T.O4).getCurrentReferenceURL()),o=(0,r.useSelect)(e=>e(O.n).getValue(k))||f,a=(0,r.useSelect)(e=>e(O.n).getValue(A))||b,{isFetchingMobile:l,isFetchingDesktop:c,errorMobile:d,errorDesktop:p}=(0,r.useSelect)(e=>{const t=e(m);return{isFetchingMobile:!t.hasFinishedResolution("getReport",[s,f]),errorMobile:t.getErrorForSelector("getReport",[s,f]),isFetchingDesktop:!t.hasFinishedResolution("getReport",[s,_]),errorDesktop:t.getErrorForSelector("getReport",[s,_])}}),u=(0,r.useInViewSelect)(e=>e(m).getReport(s,f),[s]),h=(0,r.useInViewSelect)(e=>e(m).getReport(s,_),[s]),{setValues:w}=(0,r.useDispatch)(O.n),I=(0,N.A)(e,{threshold:.25}),C=!!I?.intersectionRatio,L=o===f?l:c;(0,S.useEffect)(()=>{C&&!t&&((0,E.sx)(`${n}_pagespeed-widget`,"widget_view"),(0,E.sx)
|
||
|
|
(0,o.__)("%s (Please try again.)","google-site-kit"),y)),u||(y=(0,o.sprintf)(/* translators: $%s: Error message */ /* translators: $%s: Error message */
|
||
|
|
(0,o.__)("Error: %s","google-site-kit"),y));const k=t?.data?.reconnectURL;k&&(0,a.m)(k)&&(y=(0,o.sprintf)(/* translators: 1: Original error message 2: Reconnect URL */ /* translators: 1: Original error message 2: Reconnect URL */
|
||
|
|
(0,o.__)('%1$s To fix this, <a href="%2$s">redo the plugin setup</a>.',"google-site-kit"),y,k));return(0,p.jsx)(d.A,{className:e,type:d.A.TYPES.ERROR,description:(0,p.jsx)("span",{dangerouslySetInnerHTML:(0,g.p9)(y,{ALLOWED_TAGS:["a"],ALLOWED_ATTR:["href"]})}),ctaButton:v?{label:(0,o.__)("Retry","google-site-kit"),onClick:b}:void 0,hideIcon:m})}ErrorNotice.propTypes={className:n().string,error:n().shape({message:n().string}),hasButton:n().bool,storeName:n().string,message:n().string,noPrefix:n().bool,skipRetryMessage:n().bool,hideIcon:n().bool}},79829:(e,t,i)=>{i.d(t,{Eo:()=>g,JK:()=>m,K5:()=>h,jq:()=>u,mK:()=>d});var r=i(17243),n=i(50532),s=i.n(n),o=i(82871);function a(e,t={}){const{formatUnit:i,formatDecimal:r}=function(e,t={}){const{hours:i,minutes:r,seconds:n}=l(e);return{hours:i,minutes:r,seconds:n,formatUnit(){const{unitDisplay:s="short",...a}=t,l={unitDisplay:s,...a,style:"unit"};return 0===e?u(n,{...l,unit:"second"}):(0,o.sprintf)(/* translators: 1: formatted seconds, 2: formatted minutes, 3: formatted hours */ /* translators: 1: formatted seconds, 2: formatted minutes, 3: formatted hours */
|
||
|
|
(0,o._x)("%3$s %2$s %1$s","duration of time: hh mm ss","google-site-kit"),n?u(n,{...l,unit:"second"}):"",r?u(r,{...l,unit:"minute"}):"",i?u(i,{...l,unit:"hour"}):"").trim()},formatDecimal(){const t=(0,o.sprintf)(
|
||
|
|
// translators: %s: number of seconds with "s" as the abbreviated unit.
|
||
|
|
// translators: %s: number of seconds with "s" as the abbreviated unit.
|
||
|
|
(0,o.__)("%ds","google-site-kit"),n);if(0===e)return t;const s=(0,o.sprintf)(
|
||
|
|
// translators: %s: number of minutes with "m" as the abbreviated unit.
|
||
|
|
// translators: %s: number of minutes with "m" as the abbreviated unit.
|
||
|
|
(0,o.__)("%dm","google-site-kit"),r),a=(0,o.sprintf)(
|
||
|
|
// translators: %s: number of hours with "h" as the abbreviated unit.
|
||
|
|
// translators: %s: number of hours with "h" as the abbreviated unit.
|
||
|
|
(0,o.__)("%dh","google-site-kit"),i);return(0,o.sprintf)(/* translators: 1: formatted seconds, 2: formatted minutes, 3: formatted hours */ /* translators: 1: formatted seconds, 2: formatted minutes, 3: formatted hours */
|
||
|
|
(0,o._x)("%3$s %2$s %1$s","duration of time: hh mm ss","google-site-kit"),n?t:"",r?s:"",i?a:"").trim()}}}(e,t);try{return i()}catch{return r()}}function l(e){e=parseInt(e,10),Number.isNaN(e)&&(e=0);return{hours:Math.floor(e/60/60),minutes:Math.floor(e/60%60),seconds:Math.floor(e%60)}}function c(e){return 1e6<=e?Math.round(e/1e5)/10:1e4<=e?Math.round(e/1e3):1e3<=e?Math.round(e/100)/10:e}function d(e){let t={};return"%"===e?t={style:"percent",maximumFractionDigits:2}:"s"===e?t={style:"duration",unitDisplay:"narrow"}:e&&"string"==typeof e?t={style:"currency",currency:e}:(0,r.isPlainObject)(e)&&(t={...e}),t}function g(e,t={}){e=(0,r.isFinite)(e)?e:Number(e),(0,r.isFinite)(e)||(console.warn("Invalid number",e,typeof e),e=0);const i=d(t),{style:n="metric"}=i;return"metric"===n?function(e){const t={minimumFractionDigits:1,maximumFractionDigits:1};return 1e6<=e?(0,o.sprintf)(
|
||
|
|
// translators: %s: an abbreviated number in millions.
|
||
|
|
// translators: %s: an abbreviated number in millions.
|
||
|
|
(0,o.__)("%sM","google-site-kit"),u(c(e),e%10==0?{}:t)):1e4<=e?(0,o.sprintf)(
|
||
|
|
// translators: %s: an abbreviated number in thousands.
|
||
|
|
// translators: %s: an abbreviated number in thousands.
|
||
|
|
(0,o.__)("%sK","google-site-kit"),u(c(e))):1e3<=e?(0,o.sprintf)(
|
||
|
|
// translators: %s: an abbreviated number in thousands.
|
||
|
|
// translators: %s: an abbreviated number in thousands.
|
||
|
|
(0,o.__)("%sK","google-site-kit"),u(c(e),e%10==0?{}:t)):u(e,{signDisplay:"never",maximumFractionDigits:1})}(e):"duration"===n?a(e,i):"durationISO"===n?function(e){let{hours:t,minutes:i,seconds:r}=l(e);return r=("0"+r).slice(-2),i=("0"+i).slice(-2),t=("0"+t).slice(-2),"00"===t?`${i}:${r}`:`${t}:${i}:${r}`}(e):u(e,i)}const p=s()(console.warn);function u(e,t={}){const{locale:i=m(),...r}=t;try{return new Intl.NumberFormat(i,r).format(e)}catch(t){p(`Site Kit numberFormat error: Intl.NumberFormat( ${JSON.stringify(i)}, ${JSON.stringify(r)} ).format( ${typeof e} )`,t.message)}const n={currencyDisplay:"narrow",currencySign:"accounting",style:"unit"},s=["signDisplay","compactDisplay"],o={};for(const[e,t]of Object.entries(r))n[e]&&t===n[e]||s.includes(e)||(o[e]=t);try{return new Intl.NumberFormat(i,o).format(e)}catch{return new Intl.NumberFormat(i).format(e)}}function h(e,t={}){const{locale:i=m(),style:r="long",type:n="conjunction"}=t;if(Intl.ListFormat){return new Intl.ListFormat(i,{style:r,type:n}).format(e)}
|
||
|
|
/* translators: used between list items, there is a space after the comma. */const s=(0,o.__)(", ","google-site-kit");return e.join(s)}function m(e=i.g){const t=(0,r.get)(e,["_googlesitekitLegacyData","locale"]);if(t){const e=t.match(/^(\w{2})?(_)?(\w{2})/);if(e&&e[0])return e[0].replace(/_/g,"-")}return e.navigator.language}},80035:(e,t,i)=>{i.d(t,{A:()=>v});var r,n=i(62688),s=i.n(n),o=i(4452),a=i.n(o),l=i(63696),c=i(19793);function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},d.apply(null,arguments)}const warning_notice=e=>l.createElement("svg",d({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},e),r||(r=l.createElement("path",{fill:"currentColor",d:"M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12 5.925 1 12 1m0 14a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3m-1-2h2V6h-2z"})));var g=i(42343),p=i(49655),u=i(62540);const h={[p.Q.NEW]:g.A,[p.Q.SUCCESS]:c.A,[p.Q.INFO]:warning_notice,[p.Q.WARNING]:warning_notice,[p.Q.ERROR]:warning_notice};function Icon({type:e}){const t=h[e]||warning_notice;return(0,u.jsx)(t,{width:24,height:24})}function Title({className:e,children:t}){return(0,u.jsx)("p",{className:a()("googlesitekit-notice__title",e),children:t})}function Description({className:e,children:t}){return(0,u.jsx)("p",{className:a()("googlesitekit-notice__description",e),children:t})}Icon.propTypes={type:s().oneOf(Object.values(p.Q))},Title.propTypes={className:s().string,children:s().node},Description.propTypes={className:s().string,children:s().node};var m=i(49383),f=i(83366);function CTAButton({label:e,disabled:t,inProgress:i,onClick:r,href:n,external:s=!1,hideExternalIndicator:o=!1}){let a;return s&&!o&&(a=(0,u.jsx)(f.A,{width:14,height:14})),(0,u.jsx)(m.SpinnerButton,{className:"googlesitekit-notice__cta",disabled:t,isSaving:i,onClick:r,href:n,target:s?"_blank":void 0,trailingIcon:a,children:e})}CTAButton.propTypes={label:s().string.isRequired,disabled:s().bool,inProgress:s().bool,onClick:s().func,href:s().string,external:s().bool,hideExternalIndicator:s().bool};var _=i(82871);function DismissButton({label:e=(0,_.__)("Got it","google-site-kit"),onClick:t,disabled:i}){return(0,u.jsx)(m.Button,{onClick:t,disabled:i,tertiary:!0,children:e})}DismissButton.propTypes={label:s().string,onClick:s().func.isRequired,disabled:s().bool};const b=(0,l.forwardRef)(({className:e,title:t,description:i,dismissButton:r,ctaButton:n,type:s=p.Q.INFO,children:o,hideIcon:l},c)=>(0,u.jsxs)("div",{ref:c,className:a()("googlesitekit-notice",`googlesitekit-notice--${s}`,e),children:[!l&&(0,u.jsx)("div",{className:"googlesitekit-notice__icon",children:(0,u.jsx)(Icon,{type:s})}),(0,u.jsxs)("div",{className:"googlesitekit-notice__content",children:[t&&(0,u.jsx)(Title,{children:t}),i&&(0,u.jsx)(Description,{children:i})]}),(r?.label||r?.onClick||n?.label&&(n?.onClick||n?.href)||o)&&(0,u.jsxs)("div",{className:"googlesitekit-notice__action",children:[o,(r?.label||r?.onClick)&&(0,u.jsx)(DismissButton,{label:r.label,onClick:r.onClick,disabled:r.disabled}),n?.label&&(n?.onClick||n?.href)&&(0,u.jsx)(CTAButton,{label:n.label,onClick:n.onClick,inProgress:n.inProgress,disabled:n.disabled,href:n.href,external:n.external,hideExternalIndicator:n.hideExternalIndicator})]})]}));b.TYPES=p.Q,b.propTypes={className:s().string,title:s().oneOfType([s().string,s().object]),description:s().node,type:s().oneOf(Object.values(p.Q)),dismissButton:s().shape(DismissButton.propTypes),ctaButton:s().shape({...CTAButton.propTypes,label:s().string}),children:s().node,hideIcon:s().bool};const v=b},80097:(e,t,i)=>{i.d(t,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var r,n=i(63696);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},s.apply(null,arguments)}const __WEBPACK_DEFAULT_EXPORT__=e=>n.createElement("svg",s({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 8"},e),r||(r=n.createElement("path
|