kollapsminoriteten/wp-content/plugins/google-site-kit/dist/assets/js/googlesitekit-activation-2a...

24 lines
70 KiB
JavaScript
Raw Permalink Normal View History

2026-03-31 11:30:59 +02:00
"use strict";(globalThis.__googlesitekit_webpackJsonp=globalThis.__googlesitekit_webpackJsonp||[]).push([[722],{6730:(e,t,i)=>{i.d(t,{A:()=>GenericErrorHandlerActions});var n=i(62688),o=i.n(n),r=i(82871),s=i(38432),a=i(38021),l=i.n(a),c=i(63696),g=i(12417),d=i(1027),u=i(65123),p=i(49383),m=i(62540);function ReportErrorButton({message:e,componentStack:t}){const[i,n]=(0,c.useState)(!1);return(0,m.jsx)(p.Button,{"aria-label":i?(0,r.__)("Error message copied to clipboard. Click to copy the error message again.","google-site-kit"):void 0,onClick:function(){l()(`\`\`\`\n${e}\n${t}\n\`\`\``),n(!0)},trailingIcon:(0,m.jsx)(g.A,{className:"mdc-button__icon",icon:i?d.A:u.A}),children:i?(0,r.__)("Copied to clipboard","google-site-kit"):(0,r.__)("Copy error contents","google-site-kit")})}ReportErrorButton.propTypes={message:o().string,componentStack:o().string};const I=ReportErrorButton;function GenericErrorHandlerActions({message:e,componentStack:t}){return(0,m.jsxs)("div",{className:"googlesitekit-generic-error-handler-actions",children:[(0,m.jsx)(I,{message:e,componentStack:t}),(0,m.jsx)(s.A,{href:"https://wordpress.org/support/plugin/google-site-kit/",external:!0,children:(0,r.__)("Report this problem","google-site-kit")})]})}GenericErrorHandlerActions.propTypes={message:o().string,componentStack:o().string}},7972:(e,t,i)=>{i.d(t,{F:()=>o,n:()=>n});const n="core/ui",o="activeContextID"},8513:(e,t,i)=>{i.d(t,{Kk:()=>r,SZ:()=>n,Yw:()=>s,oJ:()=>a,tT:()=>o});const n="body",o=[n,"display","headline","label","title"],r="small",s="medium",a=[r,s,"large"]},8732:(e,t,i)=>{i.d(t,{$:()=>r,D:()=>o});var n=i(20697);const o="core/notifications",r=[n.uR,n.jU,n.f7,n.Ax,n.Is]},10740:(e,t,i)=>{i.d(t,{$z:()=>o.$,CR:()=>a.C,Cf:()=>l.DialogContent,Es:()=>l.DialogFooter,Nv:()=>n.N,P3:()=>s.P,Si:()=>r.S,fI:()=>g.fI,fh:()=>g.fh,lG:()=>c.a,xA:()=>g.xA});var n=i(91046),o=i(3412),r=i(30454),s=i(26569),a=i(56655),l=i(12786),c=i.n(l),g=i(84984)},11193:(e,t,i)=>{i.d(t,{D:()=>r});var n=i(32091),o=i.n(n);function r(e,{dateRangeLength:t}){o()(Array.isArray(e),"report must be an array to partition."),o()(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)}}},11999:(e,t,i)=>{i.d(t,{s:()=>n});const n="core/forms"},13047:(e,t,i)=>{i.d(t,{tt:()=>y.tt,Jg:()=>y.Jg,Gp:()=>y.Gp,GH:()=>y.GH,r0:()=>y.r0,Du:()=>y.Du,Zf:()=>A,Cn:()=>k,G7:()=>h,vH:()=>I,N_:()=>y.N_,zh:()=>w,mK:()=>g.mK,Ql:()=>y.Ql,vY:()=>j,sq:()=>y.sq,VZ:()=>b.VZ,JK:()=>g.JK,IS:()=>y.IS,pH:()=>b.pH,kf:()=>T,O5:()=>y.O5,Qr:()=>y.Qr,x6:()=>x,K5:()=>g.K5,S_:()=>m,dc:()=>b.dc,Eo:()=>g.Eo,jq:()=>g.jq,DK:()=>D.D,N9:()=>v,p9:()=>r.p,XH:()=>y.XH,Zm:()=>l,sx:()=>o.sx,BI:()=>o.BI,CZ:()=>r.C,BG:()=>S});var n=i(17243),o=i(65054),r=i(50477),s=i(10523),a=i.n(s);function l(e){return a()(JSON.stringify(c(e)))}function c(e){const t={};return Object.keys(e).sort().forEach(i=>{let n=e[i];n&&"object"==typeof n&&!Array.isArray(n)&&(n=c(n)),t[i]=n}),t}var g=i(49746);function d(e){return e.replace(new RegExp("\\[([^\\]]+)\\]\\((https?://[^/]+\\.\\w+/?.*?)\\)","gi"),'<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>')}function u(e){return`<p>${e.replace(/\n{2,}/g,"</p><p>")}</p>`}function p(e){return e.replace(/\n/gi,"<br>")}function m(e){const t=[d,u,p];let i=e;for(const e of t)i=e(i);return i}function I(e){return e=parseFloat(e),isNaN(e)||0===e?[0,0,0,0]:[Math.floor(e/60/60),Math.floor(e/60%60),Math.floor(e%60),Math.floor(1e3*e)-1e3*Math.floor(e)]}function h(e){const t=e&&!Number.isInteger(e)?new Date(e).getTime():e;return isNaN(t)||!t?0:t}var y=i(51193),M=i(78159),f=i(38017),N=i(62540);function j(e,t={}){if(Number.isNaN(Number(e)))return"";const{invertColor:i=!1}=t;return(0,M.Ay)((0,N.jsx)(f.A,{direction:e>0?"up":"down",invertColor:i}))}function k(e,t){return e>0&&t>0?e/t-1:e>0?1:t>0?-1:0}var b=i(48276);function x(e){const t=parseFloat(e)||0;return!!Number.isInteger(t)&&t>0}function T(e){if("number"==typeof e)return!0;const t=(e||"").toString();return!!t&&!isNaN(t)}function v(e){return Array.isArray(e)?[...e].sort():e}var D=i(
(0,s._x)("%3$s %2$s %1$s","duration of time: hh mm ss","google-site-kit"),o?p(o,{...l,unit:"second"}):"",n?p(n,{...l,unit:"minute"}):"",i?p(i,{...l,unit:"hour"}):"").trim()},formatDecimal(){const t=(0,s.sprintf)(
// translators: %s: number of seconds with "s" as the abbreviated unit.
// translators: %s: number of seconds with "s" as the abbreviated unit.
(0,s.__)("%ds","google-site-kit"),o);if(0===e)return t;const r=(0,s.sprintf)(
// translators: %s: number of minutes with "m" as the abbreviated unit.
// translators: %s: number of minutes with "m" as the abbreviated unit.
(0,s.__)("%dm","google-site-kit"),n),a=(0,s.sprintf)(
// translators: %s: number of hours with "h" as the abbreviated unit.
// translators: %s: number of hours with "h" as the abbreviated unit.
(0,s.__)("%dh","google-site-kit"),i);return(0,s.sprintf)(/* translators: 1: formatted seconds, 2: formatted minutes, 3: formatted hours */ /* translators: 1: formatted seconds, 2: formatted minutes, 3: formatted hours */
(0,s._x)("%3$s %2$s %1$s","duration of time: hh mm ss","google-site-kit"),o?t:"",n?r:"",i?a:"").trim()}}}(e,t);try{return i()}catch{return n()}}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 g(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,n.isPlainObject)(e)&&(t={...e}),t}function d(e,t={}){e=(0,n.isFinite)(e)?e:Number(e),(0,n.isFinite)(e)||(console.warn("Invalid number",e,typeof e),e=0);const i=g(t),{style:o="metric"}=i;return"metric"===o?function(e){const t={minimumFractionDigits:1,maximumFractionDigits:1};return 1e6<=e?(0,s.sprintf)(
// translators: %s: an abbreviated number in millions.
// translators: %s: an abbreviated number in millions.
(0,s.__)("%sM","google-site-kit"),p(c(e),e%10==0?{}:t)):1e4<=e?(0,s.sprintf)(
// translators: %s: an abbreviated number in thousands.
// translators: %s: an abbreviated number in thousands.
(0,s.__)("%sK","google-site-kit"),p(c(e))):1e3<=e?(0,s.sprintf)(
// translators: %s: an abbreviated number in thousands.
// translators: %s: an abbreviated number in thousands.
(0,s.__)("%sK","google-site-kit"),p(c(e),e%10==0?{}:t)):p(e,{signDisplay:"never",maximumFractionDigits:1})}(e):"duration"===o?a(e,i):"durationISO"===o?function(e){let{hours:t,minutes:i,seconds:n}=l(e);return n=("0"+n).slice(-2),i=("0"+i).slice(-2),t=("0"+t).slice(-2),"00"===t?`${i}:${n}`:`${t}:${i}:${n}`}(e):p(e,i)}const u=r()(console.warn);function p(e,t={}){const{locale:i=I(),...n}=t;try{return new Intl.NumberFormat(i,n).format(e)}catch(t){u(`Site Kit numberFormat error: Intl.NumberFormat( ${JSON.stringify(i)}, ${JSON.stringify(n)} ).format( ${typeof e} )`,t.message)}const o={currencyDisplay:"narrow",currencySign:"accounting",style:"unit"},r=["signDisplay","compactDisplay"],s={};for(const[e,t]of Object.entries(n))o[e]&&t===o[e]||r.includes(e)||(s[e]=t);try{return new Intl.NumberFormat(i,s).format(e)}catch{return new Intl.NumberFormat(i).format(e)}}function m(e,t={}){const{locale:i=I(),style:n="long",type:o="conjunction"}=t;if(Intl.ListFormat){return new Intl.ListFormat(i,{style:n,type:o}).format(e)}
/* translators: used between list items, there is a space after the comma. */const r=(0,s.__)(", ","google-site-kit");return e.join(r)}function I(e=i.g){const t=(0,n.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}},49993:(e,t,i)=>{i.d(t,{Gq:()=>d,IL:()=>I,LD:()=>p,SO:()=>u,a2:()=>o,xD:()=>m});var n=i(13047);const o="googlesitekit_",r=`${o}1.175.0_${i.g._googlesitekitBaseData.storagePrefix}_`,s=["sessionStorage","localStorage"];let a,l=[...s];async function c(e){const t=i.g[e];if(!t)return!1;try{const e="__storage_test__";return t.setItem(e,e),t.removeItem(e),!0}catch(e){return e instanceof DOMException&&(22===e.code||1014===e.code||"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&0!==t.length}}async function g(){if(void 0!==a)return a;for(const e of l)a||await c(e)&&(a=i.g[e]);return void 0===a&&(a=null),a}async function d(e){const t=await g();if(t){const i=t.getItem(`${r}${e}`);if(i){const e=JSON.parse(i),{timestamp:t,ttl:n,value:o,isError:r}=e;if(t&&(!n||Math.round(Date.now()/1e3)-t<n))return{cacheHit:!0,value:o,isError:r}}}return{cacheHit:!1,value:void 0}}async function u(e,t,{ttl:o=n.Jg,timestamp:s=Math.round(Date.now()/1e3),isError:a=!1}={}){const l=await g();if(l)try{return l.setItem(`${r}${e}`,JSON.stringify({timestamp:s,ttl:o,value:t,isError:a})),!0}catch(e){return i.g.console.warn("Encountered an unexpected storage error:",e),!1}return!1}async function p(e){const t=await g();if(t)try{const i=e.startsWith(o)?e:`${r}${e}`;return t.removeItem(i),!0}catch(e){return i.g.console.warn("Encountered an unexpected storage error:",e),!1}return!1}async function m(){const e=await g();if(e)try{const t=[];for(let i=0;i<e.length;i++){const n=e.key(i);0===n.indexOf(o)&&t.push(n)}return t}catch(e){return i.g.console.warn("Encountered an unexpected storage error:",e),[]}return[]}async function I(){if(await g()){const e=await m();for(const t of e)await p(t);return!0}return!1}},50304:(e,t,i)=>{i.d(t,{A:()=>IconWrapper});var n=i(62688),o=i.n(n),r=i(62540);function IconWrapper({children:e,marginLeft:t,marginRight:i}){return(0,r.jsx)("span",{className:"googlesitekit-icon-wrapper",style:{marginLeft:t,marginRight:i},children:e})}IconWrapper.propTypes={children:o().node.isRequired,marginLeft:o().number,marginRight:o().number}},50477:(e,t,i)=>{i.d(t,{C:()=>r,p:()=>o});var n=i(55465);function o(e,t={}){return{__html:n.O.sanitize(e,t)}}function r(e){const t="object"==typeof e?e.toString():e;return t?.replace?.(/\/+$/,"")}},50539:e=>{e.exports=googlesitekit.data},51193:(e,t,i)=>{i.d(t,{Du:()=>p,GH:()=>l,Gp:()=>c,IS:()=>M,Jg:()=>d,N_:()=>N,O5:()=>f,Ql:()=>m,Qr:()=>I,XH:()=>y,r0:()=>g,sq:()=>h,tt:()=>u});var n=i(32091),o=i.n(n),r=i(17243),s=i(82871);const a="Date param must construct to a valid date instance or be a valid date instance itself.",l="Invalid dateString parameter, it must be a string.",c='Invalid date range, it must be a string with the format "last-x-days".',g=60,d=60*g,u=24*d,p=7*u;function m(){function e(e){return(0,s.sprintf)(/* translators: %s: number of days */ /* translators: %s: number of days */
(0,s._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 I(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 h(e){o()((0,r.isDate)(e)&&!isNaN(e),a);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 y(e){o()(I(e),l);const[t,i,n]=e.split("-");return new Date(t,i-1,n)}function M(e,t){return h(N(e,t*u))}function f(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 N(e,t){o()(I(e)||(0,r.isDate)(e)&&!isNaN(e),l);const i=I(e)?Date.parse(e):e.getTime();return new Date(i-1e3*t)}},52735:(e,t,i)=>{i.d(t,{A:()=>n});const n=(0,i(63696).createContext)(!1)},55465:(e,t,i)=>{i.d(t,{O:()=>o});var n=i(31234);const o=i.n(n)()(i.g)},55989:(e,t,i)=>{i.d(t,{A:()=>l});var n=i(62688),o=i.n(n),r=i(4452),s=i.n(r),a=i(62540);function VisuallyHidden({className:e,children:t,...i}){return t?(0,a.jsx)("span",{...i,className:s()("screen-reader-text",e),children:t}):null}VisuallyHidden.propTypes={className:o().string,children:o().node},VisuallyHidden.defaultProps={className:""};const l=VisuallyHidden},59865:(e,t,i)=>{i.d(t,{A:()=>p});var n=i(62688),o=i.n(n),r=i(4452),s=i.n(r),a=i(52684),l=i(13606),c=i(82871),g=i(49383),d=i(85149),u=i(62540);function ModalDialog({className:e="",dialogActive:t=!1,handleCancel:i=null,onOpen:n=null,onClose:o=null,title:r=null,provides:p,handleConfirm:m,subtitle:I,confirmButton:h=null,notes:y=[],danger:M=!1,inProgress:f=!1,small:N=!1,medium:j=!1,buttonLink:k=null}){const b=`googlesitekit-dialog-description-${(0,a.A)(ModalDialog)}`,x=!(!p||!p.length);return(0,u.jsxs)(g.Dialog,{open:t,onOpen:n,onClose:o,"aria-describedby":x?b:void 0,tabIndex:"-1",className:s()(e,{"googlesitekit-dialog-sm":N,"googlesitekit-dialog-md":j}),children:[(0,u.jsxs)(g.DialogTitle,{children:[M&&(0,u.jsx)(d.A,{width:28,height:28}),r]}),I?(0,u.jsx)("p",{className:"mdc-dialog__lead",children:I}):[],(0,u.jsxs)(g.DialogContent,{children:[x&&(0,u.jsx)("section",{id:b,className:"mdc-dialog__provides",children:(0,u.jsx)("ul",{className:"mdc-list mdc-list--underlined mdc-list--non-interactive",children:p.map(e=>(0,u.jsx)("li",{className:"mdc-list-item",children:(0,u.jsx)("span",{className:"mdc-list-item__text",children:e})},e))})}),y.length>0&&(0,u.jsx)("section",{className:"mdc-dialog__notes",children:y.map((e,t)=>(0,u.jsxs)("p",{className:"mdc-dialog__note",children:["string"==typeof e&&(0,l.A)((0,c.sprintf)(/* translators: %s is replaced with some sub-note text. */ /* translators: %s is replaced with some sub-note text. */
(0,c.__)("<strong>Note:</strong> %s","google-site-kit"),e),{strong:(0,u.jsx)("strong",{})}),"function"==typeof e&&(0,u.jsx)(e,{})]},`note-${t}`))})]}),(0,u.jsxs)(g.DialogFooter,{children:[(0,u.jsx)(g.Button,{className:"mdc-dialog__cancel-button",onClick:i,disabled:f,tertiary:!0,children:(0,c.__)("Cancel","google-site-kit")}),k?(0,u.jsx)(g.Button,{href:k,onClick:m,target:"_blank",danger:M,children:h}):(0,u.jsx)(g.SpinnerButton,{onClick:m,danger:M,disabled:f,isSaving:f,children:h||(0,c.__)("Disconnect","google-site-kit")})]})]})}ModalDialog.displayName="Dialog",ModalDialog.propTypes={className:o().string,dialogActive:o().bool,handleDialog:o().func,handleConfirm:o().func.isRequired,onOpen:o().func,onClose:o().func,title:o().string,provides:o().arrayOf(o().string),confirmButton:o().string,notes:o().arrayOf(o().oneOfType([o().string,o().elementType])),danger:o().bool,small:o().bool,medium:o().bool,buttonLink:o().string};const p=ModalDialog},61983:(e,t,i)=>{i.d(t,{A:()=>DismissButton});var n=i(62688),o=i.n(n),r=i(82871),s=i(49383),a=i(62540);function DismissButton({className:e,label:t=(0,r.__)("Maybe later","google-site-kit"),onClick:i,disabled:n,tertiary:o=!0}){return i?(0,a.jsx)(s.Button,{className:e,onClick:i,disabled:n,tertiary:o,children:t}):null}DismissButton.propTypes={className:o().string,label:o().string,onClick:o().func,disabled:o().bool,tertiary:o().bool,dismissOptions:o().shape({expiresInSeconds:o().number,skipHidingFromQueue:o().bool})}},62659:(e,t,i)=>{i.d(t,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var n=i(63696),o=i(19826);const __WEBPACK_DEFAULT_EXPORT__=function(){return(0,n.useContext)(o.Ay)}},63081:(e,t,i)=>{i.d(t,{A:()=>Root});var n=i(62688),o=i.n(n),r=i(44010),s=i(77105),a=i(63696),l=i(50539),c=i.n(l),g=i(82871),d=i(6730),u=i(19826),p=i(67510),m=i(13047),I=i(62540);class ErrorHandler extends a.Component{constructor(e){super(e),this.state={error:null,info:null,copied:!1}}componentDidCatch(e,t){i.g.console.error("Caught an error:",e,t),this.setState({error:e,info:t}),(0,m.sx)("react_error",`handle_${this.context||"unknown"}_error`,`${e?.message}\n${t?.componentStack}`.slice(0,500))}render(){const{children:e}=this.props,{error:t,info:i}=this.state;return t?(0,I.jsx)(p.A,{notificationID:"googlesitekit-error",className:"googlesitekit-error-handler",type:"error",title:(0,g.__)("Site Kit encountered an error","google-site-kit"),description:(0,I.jsxs)(a.Fragment,{children:[(0,I.jsx)(d.A,{message:t.message,componentStack:i.componentStack}),(0,I.jsxs)("pre",{className:"googlesitekit-overflow-auto",children:[t.message,i.componentStack]})]})}):e}}ErrorHandler.contextType=u.Ay,ErrorHandler.propTypes={children:o().node.isRequired};const h=ErrorHandler;var y=i(79961);const{Consumer:M,Provider:f}=y.A,N=f;var j=i(84895),k=i(82246),b=i(11999),x=i(70301),T=i(97345),v=i(78990),D=i(94656);const A=function AuthenticatedPermissionsModal(){const e=(0,l.useRegistry)(),t=(0,l.useSelect)(e=>e(T.oR).getPermissionScopeError()),n=(0,l.useSelect)(e=>e(T.oR).getUnsatisfiedScopes()),o=(0,l.useSelect)(e=>e(T.oR).getConnectURL({additionalScopes:t?.data?.scopes,redirectURL:t?.data?.redirectURL||i.g.location.href,errorRedirectURL:t?.data?.errorRedirectURL})),{clearPermissionScopeError:r}=(0,l.useDispatch)(T.oR),{navigateTo:s}=(0,l.useDispatch)(x.M),{setValues:c}=(0,l.useDispatch)(b.s),d=(0,a.useCallback)(()=>{r()},[r]),u=(0,a.useCallback)(async()=>{c(T.$8,{permissionsError:t}),await(0,v.mR)(e),s(o)},[e,o,s,t,c]);return(0,a.useEffect)(()=>{!async function(){t?.data?.skipModal&&t?.data?.scopes?.length&&await u()}()},[u,t]),t?t?.data?.scopes?.length?t?.data?.skipModal||n&&t?.data?.scopes.every(e=>n.includes(e))?null:(0,I.jsx)(D.A,{children:(0,I.jsx)(k.A,{title:(0,g.__)("Additional Permissions Required","google-site-kit"),subtitle:t.message,confirmButton:(0,g.__)("Proceed","google-site-kit"),handleConfirm:u,handleCancel:d,onClose:d,dialogActive:!0,medium:!0})}):(i.g.console.warn("permissionsError lacks scopes array to use for redirect, so not showing the PermissionsModal. permissionsError was:",t),null):null};const S=function PermissionsModal(){retur