File Editor
Directories:
.. (Back)
externals
languages
Files:
academy.js
addon-installation.js
admin-global.js
admin-modules.js
analysis-worker.js
api-client.js
block-editor.js
bulk-editor.js
classic-editor.js
crawl-settings.js
dashboard-widget.js
dynamic-blocks.js
edit-page.js
editor-modules.js
elementor.js
externals-components.js
externals-contexts.js
externals-redux.js
faq-block.js
filter-explanation.js
first-time-configuration.js
frontend-inspector-resources.js
general-page.js
help-scout-beacon.js
how-to-block.js
import.js
indexation.js
installation-success.js
integrations-page.js
introductions.js
network-admin.js
new-settings.js
post-edit.js
quick-edit-handler.js
react-select.js
redirect-old-features-tab.js
reindex-links.js
settings.js
support.js
term-edit.js
used-keywords-assessment.js
wincher-dashboard-widget.js
workouts.js
Create New File
Create
Edit File: editor-modules.js
(()=>{"use strict";var e={6746:(e,t,s)=>{var a="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},r=i(s(9196)),n=i(s(9156)),o=i(s(6743));function i(e){return e&&e.__esModule?e:{default:e}}var l=void 0;function c(e,t){var s,o,i,u,d,p,m,h,g=[],y={};for(p=0;p<e.length;p++)if("string"!==(d=e[p]).type){if(!t.hasOwnProperty(d.value)||void 0===t[d.value])throw new Error("Invalid interpolation, missing component node: `"+d.value+"`");if("object"!==a(t[d.value]))throw new Error("Invalid interpolation, component node must be a ReactElement or null: `"+d.value+"`","\n> "+l);if("componentClose"===d.type)throw new Error("Missing opening component token: `"+d.value+"`");if("componentOpen"===d.type){s=t[d.value],i=p;break}g.push(t[d.value])}else g.push(d.value);return s&&(u=function(e,t){var s,a,r=t[e],n=0;for(a=e+1;a<t.length;a++)if((s=t[a]).value===r.value){if("componentOpen"===s.type){n++;continue}if("componentClose"===s.type){if(0===n)return a;n--}}throw new Error("Missing closing component token `"+r.value+"`")}(i,e),m=c(e.slice(i+1,u),t),o=r.default.cloneElement(s,{},m),g.push(o),u<e.length-1&&(h=c(e.slice(u+1),t),g=g.concat(h))),1===g.length?g[0]:(g.forEach((function(e,t){e&&(y["interpolation-child-"+t]=e)})),(0,n.default)(y))}t.Z=function(e){var t=e.mixedString,s=e.components,r=e.throwErrors;if(l=t,!s)return t;if("object"!==(void 0===s?"undefined":a(s))){if(r)throw new Error("Interpolation Error: unable to process `"+t+"` because components is not an object");return t}var n=(0,o.default)(t);try{return c(n,s)}catch(e){if(r)throw new Error("Interpolation Error: unable to process `"+t+"` because of error `"+e.message+"`");return t}}},6743:e=>{function t(e){return e.match(/^\{\{\//)?{type:"componentClose",value:e.replace(/\W/g,"")}:e.match(/\/\}\}$/)?{type:"componentSelfClosing",value:e.replace(/\W/g,"")}:e.match(/^\{\{/)?{type:"componentOpen",value:e.replace(/\W/g,"")}:{type:"string",value:e}}e.exports=function(e){return e.split(/(\{\{\/?\s*\w+\s*\/?\}\})/g).map(t)}},9156:(e,t,s)=>{var a=s(9196),r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,n=s(7942),o=s(9179),i=s(397),l=".",c=":",u="function"==typeof Symbol&&Symbol.iterator,d="@@iterator";function p(e,t){return e&&"object"==typeof e&&null!=e.key?(s=e.key,a={"=":"=0",":":"=2"},"$"+(""+s).replace(/[=:]/g,(function(e){return a[e]}))):t.toString(36);var s,a}function m(e,t,s,a){var n,i=typeof e;if("undefined"!==i&&"boolean"!==i||(e=null),null===e||"string"===i||"number"===i||"object"===i&&e.$$typeof===r)return s(a,e,""===t?l+p(e,0):t),1;var h=0,g=""===t?l:t+c;if(Array.isArray(e))for(var y=0;y<e.length;y++)h+=m(n=e[y],g+p(n,y),s,a);else{var f=function(e){var t=e&&(u&&e[u]||e[d]);if("function"==typeof t)return t}(e);if(f)for(var b,w=f.call(e),v=0;!(b=w.next()).done;)h+=m(n=b.value,g+p(n,v++),s,a);else if("object"===i){var k=""+e;o(!1,"Objects are not valid as a React child (found: %s).%s","[object Object]"===k?"object with keys {"+Object.keys(e).join(", ")+"}":k,"")}}return h}var h=/\/+/g;function g(e){return(""+e).replace(h,"$&/")}var y,f,b=w,w=function(e){var t=this;if(t.instancePool.length){var s=t.instancePool.pop();return t.call(s,e),s}return new t(e)};function v(e,t,s,a){this.result=e,this.keyPrefix=t,this.func=s,this.context=a,this.count=0}function k(e,t,s){var r,o,i=e.result,l=e.keyPrefix,c=e.func,u=e.context,d=c.call(u,t,e.count++);Array.isArray(d)?E(d,i,s,n.thatReturnsArgument):null!=d&&(a.isValidElement(d)&&(r=d,o=l+(!d.key||t&&t.key===d.key?"":g(d.key)+"/")+s,d=a.cloneElement(r,{key:o},void 0!==r.props?r.props.children:void 0)),i.push(d))}function E(e,t,s,a,r){var n="";null!=s&&(n=g(s)+"/");var o=v.getPooled(t,n,a,r);!function(e,t,s){null==e||m(e,"",t,s)}(e,k,o),v.release(o)}v.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},y=function(e,t,s,a){var r=this;if(r.instancePool.length){var n=r.instancePool.pop();return r.call(n,e,t,s,a),n}return new r(e,t,s,a)},(f=v).instancePool=[],f.getPooled=y||b,f.poolSize||(f.poolSize=10),f.release=function(e){var t=this;o(e instanceof t,"Trying to release an instance into a pool of a different type."),e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},e.exports=function(e){if("object"!=typeof e||!e||Array.isArray(e))return i(!1,"React.addons.createFragment only accepts a single object. Got: %s",e),e;if(a.isValidElement(e))return i(!1,"React.addons.createFragment does not accept a ReactElement without a wrapper object."),e;o(1!==e.nodeType,"React.addons.createFragment(...): Encountered an invalid child; DOM elements are not valid children of React components.");var t=[];for(var s in e)E(e[s],t,s,n.thatReturnsArgument);return t}},7942:e=>{function t(e){return function(){return e}}var s=function(){};s.thatReturns=t,s.thatReturnsFalse=t(!1),s.thatReturnsTrue=t(!0),s.thatReturnsNull=t(null),s.thatReturnsThis=function(){return this},s.thatReturnsArgument=function(e){return e},e.exports=s},9179:e=>{e.exports=function(e,t,s,a,r,n,o,i){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[s,a,r,n,o,i],u=0;(l=new Error(t.replace(/%s/g,(function(){return c[u++]})))).name="Invariant Violation"}throw l.framesToPop=1,l}}},397:(e,t,s)=>{var a=s(7942);e.exports=a},9196:e=>{e.exports=window.React}},t={};function s(a){var r=t[a];if(void 0!==r)return r.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,s),n.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var a in t)s.o(t,a)&&!s.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={};s.r(e),s.d(e,{refreshDelay:()=>l});var t={};s.r(t),s.d(t,{default:()=>b,initializationDone:()=>w,sortResultsByIdentifier:()=>f});var a={};s.r(a),s.d(a,{default:()=>U,getIconForScore:()=>z});var r={};s.r(r),s.d(r,{doAjaxRequest:()=>Ws});var n={};s.r(n),s.d(n,{setTextdomainL10n:()=>Xs});var o={};s.r(o),s.d(o,{applyReplaceUsingPlugin:()=>fa,createLabelFromName:()=>ca,excerptFromContent:()=>ya,fillReplacementVariables:()=>ia,handlePrefixes:()=>la,mapCustomFields:()=>ga,mapCustomTaxonomies:()=>ha,nonReplaceVars:()=>oa,prepareCustomFieldForDispatch:()=>pa,prepareCustomTaxonomyForDispatch:()=>ma,pushNewReplaceVar:()=>ua,replaceSpaces:()=>da});const i=window.yoast.externals.contexts,l=500,c=window.lodash;function u(){return(0,c.get)(window,"wpseoScriptData.metabox",{intl:{},isRtl:!1})}const d=window.wp.i18n,p=window.yoast.analysis,m=window.wp.hooks,h=window.yoast.externals.redux;function g(){}let y=!1;function f(e){return e.sort(((e,t)=>e._identifier.localeCompare(t._identifier)))}function b(e,t,s,a,r){if(!y)return;const n=p.Paper.parse(t());e.analyze(n).then((o=>{const{result:{seo:i,readability:l,inclusiveLanguage:c}}=o;if(i){const e=i[""];e.results.forEach((e=>{e.getMarker=()=>()=>s(n,e.marks)})),e.results=f(e.results),a.dispatch(h.actions.setSeoResultsForKeyword(n.getKeyword(),e.results)),a.dispatch(h.actions.setOverallSeoScore(e.score,n.getKeyword())),a.dispatch(h.actions.refreshSnippetEditor()),r.saveScores(e.score,n.getKeyword())}l&&(l.results.forEach((e=>{e.getMarker=()=>()=>s(n,e.marks)})),l.results=f(l.results),a.dispatch(h.actions.setReadabilityResults(l.results)),a.dispatch(h.actions.setOverallReadabilityScore(l.score)),a.dispatch(h.actions.refreshSnippetEditor()),r.saveContentScore(l.score)),c&&(c.results.forEach((e=>{e.getMarker=()=>()=>s(n,e.marks)})),c.results=f(c.results),a.dispatch(h.actions.setInclusiveLanguageResults(c.results)),a.dispatch(h.actions.setOverallInclusiveLanguageScore(c.score)),a.dispatch(h.actions.refreshSnippetEditor()),r.saveInclusiveLanguageScore(c.score)),(0,m.doAction)("yoast.analysis.refresh",o,{paper:n,worker:e,collectData:t,applyMarks:s,store:a,dataCollector:r})})).catch(g)}function w(){y=!0}var v=s(9196);const k=window.wp.element,E=window.yoast.styledComponents;var R=s.n(E);const _=window.yoast.propTypes;var x=s.n(_);const T=window.yoast.componentsNew,S=window.yoast.helpers,C=window.yoast.styleGuide,I=C.colors.$color_bad,L=C.colors.$palette_error_background,A=C.colors.$color_grey_text_light,q=C.colors.$palette_error_text,P=R().div` display: flex; flex-direction: column; `,N=R().label` font-size: var(--yoast-font-size-default); font-weight: var(--yoast-font-weight-bold); ${(0,S.getDirectionalStyle)("margin-right: 4px","margin-left: 4px")}; `,B=R().span` margin-bottom: 0.5em; `,M=R()(T.InputField)` flex: 1 !important; box-sizing: border-box; max-width: 100%; margin: 0; // Reset margins inherited from WordPress. // Hide native X in Edge and IE11. &::-ms-clear { display: none; } &.has-error { border-color: ${I} !important; background-color: ${L} !important; &:focus { box-shadow: 0 0 2px ${I} !important; } } `,O=R().ul` color: ${q}; list-style-type: disc; list-style-position: outside; margin: 0; margin-left: 1.2em; `,F=R().li` color: ${q}; margin: 0 0 0.5em 0; `,K=(0,T.addFocusStyle)(R().button` border: 1px solid transparent; box-shadow: none; background: none; flex: 0 0 32px; height: 32px; max-width: 32px; padding: 0; cursor: pointer; `);K.propTypes={type:x().string,focusColor:x().string,focusBackgroundColor:x().string,focusBorderColor:x().string},K.defaultProps={type:"button",focusColor:C.colors.$color_button_text_hover,focusBackgroundColor:"transparent",focusBorderColor:C.colors.$color_blue};const D=R()(T.SvgIcon)` margin-top: 4px; `,$=R().div` display: flex; flex-direction: row; align-items: center; &.has-remove-keyword-button { ${M} { ${(0,S.getDirectionalStyle)("padding-right: 40px","padding-left: 40px")}; } ${K} { ${(0,S.getDirectionalStyle)("margin-left: -32px","margin-right: -32px")}; } } `;class H extends k.Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this)}handleChange(e){this.props.onChange(e.target.value)}renderLabel(){const{id:e,label:t,helpLink:s}=this.props;return(0,v.createElement)(B,null,(0,v.createElement)(N,{htmlFor:e},t),s)}renderErrorMessages(){const e=[...this.props.errorMessages];return!(0,c.isEmpty)(e)&&(0,v.createElement)(O,null,e.map(((e,t)=>(0,v.createElement)(F,{key:t},(0,v.createElement)("span",{role:"alert"},e)))))}render(){const{id:e,showLabel:t,keyword:s,onRemoveKeyword:a,onBlurKeyword:r,onFocusKeyword:n,hasError:o}=this.props,i=!t,l=a!==c.noop;return(0,v.createElement)(P,null,t&&this.renderLabel(),o&&this.renderErrorMessages(),(0,v.createElement)($,{className:l?"has-remove-keyword-button":null},(0,v.createElement)(M,{"aria-label":i?this.props.label:null,type:"text",id:e,className:o?"has-error":null,onChange:this.handleChange,onFocus:n,onBlur:r,value:s,autoComplete:"off"}),l&&(0,v.createElement)(K,{onClick:a,focusBoxShadowColor:"#084A67"},(0,v.createElement)(D,{size:"18px",icon:"times-circle",color:A}))))}}H.propTypes={id:x().string.isRequired,showLabel:x().bool,keyword:x().string,onChange:x().func.isRequired,onRemoveKeyword:x().func,onBlurKeyword:x().func,onFocusKeyword:x().func,label:x().string.isRequired,helpLink:x().node,hasError:x().bool,errorMessages:x().arrayOf(x().string)},H.defaultProps={showLabel:!0,keyword:"",onRemoveKeyword:c.noop,onBlurKeyword:c.noop,onFocusKeyword:c.noop,helpLink:null,hasError:!1,errorMessages:[]};const W=H;function j(e,t=""){const s=e.getIdentifier(),a={score:e.score,rating:p.interpreters.scoreToRating(e.score),hasMarks:e.hasMarks(),marker:e.getMarker(),id:s,text:e.text,markerId:t.length>0?`${t}:${s}`:s,hasBetaBadge:e.hasBetaBadge(),hasJumps:e.hasJumps(),hasAIFixes:e.hasAIFixes(),editFieldName:e.editFieldName};return"ok"===a.rating&&(a.rating="OK"),a}function Y(e,t){switch(e.rating){case"error":t.errorsResults.push(e);break;case"feedback":t.considerationsResults.push(e);break;case"bad":t.problemsResults.push(e);break;case"OK":t.improvementsResults.push(e);break;case"good":t.goodResults.push(e)}return t}function z(e){switch(e){case"loading":return{icon:"loading-spinner",color:C.colors.$color_green_medium_light};case"not-set":return{icon:"seo-score-none",color:C.colors.$color_score_icon};case"noindex":return{icon:"seo-score-none",color:C.colors.$color_noindex};case"good":return{icon:"seo-score-good",color:C.colors.$color_green_medium};case"ok":return{icon:"seo-score-ok",color:C.colors.$color_ok};default:return{icon:"seo-score-bad",color:C.colors.$color_red}}}function U(e,t=""){let s={errorsResults:[],problemsResults:[],improvementsResults:[],goodResults:[],considerationsResults:[]};if(!e)return s;for(let a=0;a<e.length;a++){const r=e[a];r.text&&(s=Y(j(r,t),s))}return s}const V=(0,S.makeOutboundLink)(R().a` display: inline-block; position: relative; outline: none; text-decoration: none; border-radius: 100%; width: 24px; height: 24px; margin: -4px 0; vertical-align: middle; color: ${C.colors.$color_help_text}; &:hover, &:focus { color: ${C.colors.$color_snippet_focus}; } // Overwrite the default blue active color for links. &:active { color: ${C.colors.$color_help_text}; } &::before { position: absolute; top: 0; left: 0; padding: 2px; content: "\f223"; } `),G=R()(T.Collapsible)` h2 > button { padding-left: 24px; padding-top: 16px; &:hover { background-color: #f0f0f0; } } div[class^="collapsible_content"] { padding: 24px 0; margin: 0 24px; border-top: 1px solid rgba(0,0,0,0.2); } `,Z=window.wp.components,J="yoast yoast-gutenberg-modal",Q=e=>{const{title:t,className:s,showYoastIcon:a,additionalClassName:r,...n}=e,o=a?(0,v.createElement)("span",{className:"yoast-icon"}):null;return(0,v.createElement)(Z.Modal,{title:t,className:`${s} ${r}`,icon:o,...n},e.children)};Q.propTypes={title:x().string,className:x().string,showYoastIcon:x().bool,children:x().oneOfType([x().node,x().arrayOf(x().node)]),additionalClassName:x().string},Q.defaultProps={title:"Yoast SEO",className:J,showYoastIcon:!0,children:null,additionalClassName:""};const X=Q,ee=(window.yoast.socialMetadataForms,e=>({type:e.subtype,width:e.width,height:e.height,url:e.url,id:e.id,sizes:e.sizes,alt:e.alt||e.title||e.name}));const te=({hiddenField:e,hiddenFieldImageId:t,hiddenFieldFallbackImageId:s,hasImageValidation:a,...r})=>{const[n,o]=(0,k.useState)(null!==document.getElementById(s)),i=(0,k.useMemo)((()=>document.getElementById(e))),l=(0,k.useMemo)((()=>document.getElementById(t)));let c=null;c=s&&document.getElementById(s)?(0,k.useMemo)((()=>document.getElementById(s))):l;const[u,d]=(0,k.useState)({url:i?i.value:"",id:c?parseInt(c.value,10):"",alt:""}),[p,m]=(0,k.useState)([]),h=(0,k.useCallback)((e=>{i&&(i.value=e.url),c&&(c.value=e.id)})),g=(0,k.useCallback)((()=>{(function(e){const t=window.wp.media();return t.on("select",(()=>{const s=t.state().get("selection").first();e(ee(s.attributes))})),t})((e=>{c=l,d(e),h(e),a&&m((0,S.validateFacebookImage)(e)),o(!1)})).open()}),[a,h]),y=(0,k.useCallback)((()=>{c=l;const e={url:"",id:"",alt:""};d(e),h(e),m([]),o(!0)}),[h]);return(0,k.useEffect)((()=>{u.id&&!u.alt&&function(e){return new Promise(((t,s)=>{window.wp.media.attachment||s(),window.wp.media.attachment(e).fetch().then((e=>{t(ee(e))})).catch((()=>s()))}))}(u.id).then((e=>d(e)))}),[u]),(0,v.createElement)(T.ImageSelect,{...r,usingFallback:n,imageUrl:u.url,imageId:u.id,imageAltText:u.alt,onClick:g,onRemoveImageClick:y,warnings:p})};te.propTypes={hiddenField:x().string.isRequired,hiddenFieldImageId:x().string,hiddenFieldFallbackImageId:x().string,hasImageValidation:x().bool},te.defaultProps={hiddenFieldImageId:"",hiddenFieldFallbackImageId:"",hasImageValidation:!1};const se=te;function ae({target:e,children:t}){let s=e;return"string"==typeof e&&(s=document.getElementById(e)),s?(0,k.createPortal)(t,s):null}function re({target:e,label:t,hasPreview:s,hiddenField:a,hiddenFieldImageId:r,hiddenFieldFallbackImageId:n,selectImageButtonId:o,replaceImageButtonId:i,removeImageButtonId:l,hasNewBadge:c,isDisabled:u,hasPremiumBadge:d,hasImageValidation:p}){return(0,v.createElement)(ae,{target:e},(0,v.createElement)(se,{label:t,hasPreview:s,hiddenField:a,hiddenFieldImageId:r,hiddenFieldFallbackImageId:n,selectImageButtonId:o,replaceImageButtonId:i,removeImageButtonId:l,hasNewBadge:c,isDisabled:u,hasPremiumBadge:d,hasImageValidation:p}))}ae.propTypes={target:x().oneOfType([x().string,x().object]).isRequired,children:x().node.isRequired},re.propTypes={target:x().string.isRequired,label:x().string.isRequired,hasPreview:x().bool.isRequired,hiddenField:x().string.isRequired,hiddenFieldImageId:x().string,hiddenFieldFallbackImageId:x().string,selectImageButtonId:x().string,replaceImageButtonId:x().string,removeImageButtonId:x().string,hasNewBadge:x().bool,isDisabled:x().bool,hasPremiumBadge:x().bool,hasImageValidation:x().bool},re.defaultProps={hiddenFieldImageId:"",hiddenFieldFallbackImageId:"",selectImageButtonId:"",replaceImageButtonId:"",removeImageButtonId:"",hasNewBadge:!1,isDisabled:!1,hasPremiumBadge:!1,hasImageValidation:!1};const ne=({target:e,scoreIndicator:t})=>(0,v.createElement)(ae,{target:e},(0,v.createElement)(T.SvgIcon,{...z(t)}));ne.propTypes={target:x().string.isRequired,scoreIndicator:x().string.isRequired};const oe=ne,ie=e=>{const[t,s]=(0,k.useState)(!1),{prefixIcon:a}=e;return(0,v.createElement)("div",{className:"yoast components-panel__body "+(t?"is-opened":"")},(0,v.createElement)("h2",{className:"components-panel__body-title"},(0,v.createElement)("button",{onClick:function(){s(!t)},className:"components-button components-panel__body-toggle",type:"button",id:e.buttonId},(0,v.createElement)("span",{className:"yoast-icon-span",style:{fill:`${a&&a.color||""}`}},a&&(0,v.createElement)(T.SvgIcon,{icon:a.icon,color:a.color,size:a.size})),(0,v.createElement)("span",{className:"yoast-title-container"},(0,v.createElement)("div",{className:"yoast-title"},e.title),(0,v.createElement)("div",{className:"yoast-subtitle"},e.subTitle)),e.hasBetaBadgeLabel&&(0,v.createElement)(T.BetaBadge,null),(0,v.createElement)("span",{className:"yoast-chevron","aria-hidden":"true"}))),t&&e.children)},le=ie;ie.propTypes={title:x().string.isRequired,children:x().oneOfType([x().node,x().arrayOf(x().node)]).isRequired,prefixIcon:x().object,subTitle:x().string,hasBetaBadgeLabel:x().bool,buttonId:x().string},ie.defaultProps={prefixIcon:null,subTitle:"",hasBetaBadgeLabel:!1,buttonId:null};const ce=({children:e})=>(0,v.createElement)("div",null,e);ce.propTypes={renderPriority:x().number.isRequired,children:x().node.isRequired};const ue=ce,de=({theme:e,location:t,children:s})=>(0,v.createElement)(i.LocationProvider,{value:t},(0,v.createElement)(E.ThemeProvider,{theme:e},s));de.propTypes={theme:x().object.isRequired,location:x().oneOf(["sidebar","metabox","modal"]).isRequired,children:x().element.isRequired};const pe=de,me=window.wp.compose,he=window.wp.data,ge=e=>(0,v.createElement)("div",{className:"yoast components-panel__body"},(0,v.createElement)("h2",{className:"components-panel__body-title"},(0,v.createElement)("button",{id:e.id,onClick:e.onClick,className:"components-button components-panel__body-toggle",type:"button"},e.prefixIcon&&(0,v.createElement)("span",{className:"yoast-icon-span",style:{fill:`${e.prefixIcon&&e.prefixIcon.color||""}`}},(0,v.createElement)(T.SvgIcon,{size:e.prefixIcon.size,icon:e.prefixIcon.icon})),(0,v.createElement)("span",{className:"yoast-title-container"},(0,v.createElement)("div",{className:"yoast-title"},e.title),(0,v.createElement)("div",{className:"yoast-subtitle"},e.subTitle)),e.children,e.suffixIcon&&(0,v.createElement)(T.SvgIcon,{size:e.suffixIcon.size,icon:e.suffixIcon.icon}),e.SuffixHeroIcon))),ye=ge;ge.propTypes={onClick:x().func.isRequired,title:x().string.isRequired,id:x().string,subTitle:x().string,suffixIcon:x().object,SuffixHeroIcon:x().object,prefixIcon:x().object,children:x().node},ge.defaultProps={id:"",suffixIcon:null,SuffixHeroIcon:null,prefixIcon:null,subTitle:"",children:null};const fe=({id:e,postTypeName:t,children:s,title:a,isOpen:r,close:n,open:o,shouldCloseOnClickOutside:l,showChangesWarning:c,SuffixHeroIcon:u})=>(0,v.createElement)(k.Fragment,null,r&&(0,v.createElement)(i.LocationProvider,{value:"modal"},(0,v.createElement)(X,{title:a,onRequestClose:n,additionalClassName:"yoast-collapsible-modal yoast-post-settings-modal",id:"id",shouldCloseOnClickOutside:l},(0,v.createElement)("div",{className:"yoast-content-container"},(0,v.createElement)("div",{className:"yoast-modal-content"},s)),(0,v.createElement)("div",{className:"yoast-notice-container"},(0,v.createElement)("hr",null),(0,v.createElement)("div",{className:"yoast-button-container"},c&&(0,v.createElement)("p",null,/* Translators: %s translates to the Post Label in singular form */ (0,d.sprintf)((0,d.__)("Make sure to save your %s for changes to take effect","wordpress-seo"),t)),(0,v.createElement)("button",{className:"yoast-button yoast-button--primary yoast-button--post-settings-modal",type:"button",onClick:n},/* Translators: %s translates to the Post Label in singular form */ (0,d.sprintf)((0,d.__)("Return to your %s","wordpress-seo"),t)))))),(0,v.createElement)(ye,{id:e+"-open-button",title:a,SuffixHeroIcon:u,suffixIcon:u?null:{size:"20px",icon:"pencil-square"},onClick:o}));fe.propTypes={id:x().string.isRequired,postTypeName:x().string.isRequired,children:x().oneOfType([x().node,x().arrayOf(x().node)]).isRequired,title:x().string.isRequired,isOpen:x().bool.isRequired,open:x().func.isRequired,close:x().func.isRequired,shouldCloseOnClickOutside:x().bool,showChangesWarning:x().bool,SuffixHeroIcon:x().object},fe.defaultProps={shouldCloseOnClickOutside:!0,showChangesWarning:!0};const be=fe,we=(0,me.compose)([(0,he.withSelect)(((e,t)=>{const{getPostOrPageString:s,getIsModalOpen:a}=e("yoast-seo/editor");return{postTypeName:s(),isOpen:a(t.id)}})),(0,he.withDispatch)(((e,t)=>{const{openEditorModal:s,closeEditorModal:a}=e("yoast-seo/editor");return{open:()=>s(t.id),close:a}}))])(be),ve=(0,me.compose)([(0,he.withSelect)(((e,t)=>{const{isAlertDismissed:s}=e(t.store||"yoast-seo/editor");return{isAlertDismissed:s(t.alertKey)}})),(0,he.withDispatch)(((e,t)=>{const{dismissAlert:s}=e(t.store||"yoast-seo/editor");return{onDismissed:()=>s(t.alertKey)}}))])(T.Alert),ke=window.yoast.analysisReport,Ee=window.yoast.uiLibrary,Re=v.forwardRef((function(e,t){return v.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),v.createElement("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"}))})),_e=(R().div` min-width: 600px; @media screen and ( max-width: 680px ) { min-width: 0; width: 86vw; } `,R().div` @media screen and ( min-width: 600px ) { max-width: 420px; } `),xe=(R()(T.Icon)` float: ${(0,S.getDirectionalStyle)("right","left")}; margin: ${(0,S.getDirectionalStyle)("0 0 16px 16px","0 16px 16px 0")}; && { width: 150px; height: 150px; @media screen and ( max-width: 680px ) { width: 80px; height: 80px; } } `,window.wp.url),Te=R().div` padding: 25px 32px 32px; color: #303030; `,Se=R().ul` margin: 0; padding: 0; li { list-style-image: var(--yoast-svg-icon-check); margin: 0.5rem 0 0 1.5rem; line-height: 1.4em; &::marker { font-size: 1.5rem; } } `,Ce=R().span` display: block; margin-top: 4px; `,Ie=R().h2` margin-top: 0; margin-bottom: 0.25rem; color: #303030; font-size: 0.8125rem; font-weight: 600; `,Le=R().p` display: block; margin: 0.25rem 0 1rem 0 !important; max-width: 420px; `,Ae=R().hr` margin-top: 1.5rem; margin-bottom: 1rem; border-top: 0; border-bottom: 1px solid #E2E8F0; `,qe=R().div` text-align: center; `,Pe=R().a` width: 100%; `,Ne=(0,S.makeOutboundLink)(Pe);class Be extends k.Component{constructor(e){super(e),this.state={defaultPrice:"99"}}createBenefitsList(e){return e.length>0&&(0,v.createElement)(Se,{role:"list"},e.map(((e,t)=>(0,v.createElement)("li",{key:`upsell-benefit-${t}`},(0,k.createInterpolateElement)(e,{strong:(0,v.createElement)("strong",null)})))))}render(){const e=(0,he.select)("yoast-seo/editor").isPromotionActive("black-friday-2024-promotion"),{defaultPrice:t}=this.state,s=e?"69.30":null,a=s||t;return(0,v.createElement)(k.Fragment,null,e&&(0,v.createElement)("div",{className:"yst-flex yst-items-center yst-text-lg yst-content-between yst-bg-black yst-text-amber-300 yst-h-9 yst-border-amber-300 yst-border-y yst-border-x-0 yst-border-solid yst-px-6"},(0,v.createElement)("div",{className:"yst-mx-auto"},(0,d.__)("30% OFF - BLACK FRIDAY","wordpress-seo"))),(0,v.createElement)(Te,null,(0,v.createElement)(Ie,null,this.props.title),(0,v.createElement)(Le,null,this.props.description),(0,v.createElement)(qe,null,(0,v.createElement)(Ne,{...this.props.upsellButton},this.props.upsellButtonText,this.props.upsellButtonHasCaret&&(0,v.createElement)("span",{"aria-hidden":"true",className:"yoast-button-upsell__caret"})),(0,v.createElement)("div",{className:"yst-text-slate-600 yst-my-4"},s&&(0,v.createElement)(k.Fragment,null,(0,v.createElement)("span",{className:"yst-text-slate-500 yst-line-through"},t)," "),(0,v.createElement)("span",{className:"yst-text-slate-900 yst-text-2xl yst-font-bold"},a)," ",(0,d.__)("$ USD / € EUR / £ GBP per year (ex. VAT)","wordpress-seo")),(0,v.createElement)(Ce,{id:this.props.upsellButton["aria-describedby"]},this.props.upsellButtonLabel)),(0,v.createElement)(Ae,null),(0,v.createElement)(Ie,null,this.props.benefitsTitle),this.createBenefitsList(this.props.benefits)))}}Be.propTypes={title:x().node,benefits:x().array,benefitsTitle:x().node,description:x().node,upsellButton:x().object,upsellButtonText:x().string.isRequired,upsellButtonLabel:x().string,upsellButtonHasCaret:x().bool},Be.defaultProps={title:null,description:null,benefits:[],benefitsTitle:null,upsellButton:{href:"",className:"button button-primary"},upsellButtonLabel:"",upsellButtonHasCaret:!0};const Me=Be,Oe=(0,d.__)("Check your text on even more SEO criteria and get an enhanced keyphrase analysis, making it easier to optimize your content.","wordpress-seo"),Fe=e=>{const{locationContext:t}=(0,i.useRootContext)(),s=(0,xe.addQueryArgs)(wpseoAdminL10n[e.buyLink],{context:t});return(0,v.createElement)(Me,{title:(0,d.__)("Get more help with writing content that ranks","wordpress-seo"),description:e.description,benefitsTitle:/* translators: %s expands to 'Yoast SEO Premium'. */ (0,d.sprintf)("%s also gives you:","Yoast SEO Premium"),benefits:[(0,d.sprintf)(/* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */ (0,d.__)("%1$sAI%2$s: Better SEO titles and meta descriptions, faster.","wordpress-seo"),"<strong>","</strong>"),(0,d.sprintf)(/* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */ (0,d.__)("%1$sMultiple keywords%2$s: Rank higher for more searches.","wordpress-seo"),"<strong>","</strong>"),(0,d.sprintf)(/* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */ (0,d.__)("%1$sSuper fast%2$s internal linking suggestions.","wordpress-seo"),"<strong>","</strong>"),(0,d.sprintf)(/* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */ (0,d.__)("%1$sNo more broken links%2$s: Automatic redirect manager.","wordpress-seo"),"<strong>","</strong>"),(0,d.sprintf)(/* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */ (0,d.__)("%1$sAppealing social previews%2$s people actually want to click on.","wordpress-seo"),"<strong>","</strong>"),(0,d.sprintf)(/* translators: %1$s expands to a strong opening tag, %2$s expands to a strong closing tag. */ (0,d.__)("%1$s24/7 support%2$s: Also on evenings and weekends.","wordpress-seo"),"<strong>","</strong>")],upsellButtonText:(0,d.sprintf)(/* translators: %s expands to 'Yoast SEO Premium'. */ (0,d.__)("Unlock with %s","wordpress-seo"),"Yoast SEO Premium"),upsellButton:{href:s,className:"yoast-button-upsell",rel:null,"data-ctb-id":"f6a84663-465f-4cb5-8ba5-f7a6d72224b2","data-action":"load-nfd-ctb"},upsellButtonLabel:(0,d.__)("1 year of premium support and updates included!","wordpress-seo")})};Fe.propTypes={buyLink:x().string.isRequired,description:x().string},Fe.defaultProps={description:Oe};const Ke=Fe;class De extends k.Component{constructor(e){super(e);const t=this.props.results;this.state={mappedResults:{}},null!==t&&(this.state={mappedResults:U(t,this.props.keywordKey)}),this.handleMarkButtonClick=this.handleMarkButtonClick.bind(this),this.handleEditButtonClick=this.handleEditButtonClick.bind(this),this.handleResultsChange=this.handleResultsChange.bind(this),this.renderHighlightingUpsell=this.renderHighlightingUpsell.bind(this),this.createMarkButton=this.createMarkButton.bind(this)}componentDidUpdate(e){null!==this.props.results&&this.props.results!==e.results&&this.setState({mappedResults:U(this.props.results,this.props.keywordKey)})}createMarkButton({ariaLabel:e,id:t,className:s,status:a,onClick:r,isPressed:n}){return(0,v.createElement)(k.Fragment,null,(0,v.createElement)(T.IconButtonToggle,{marksButtonStatus:a,className:s,onClick:r,id:t,icon:"eye",pressed:n,ariaLabel:e}),this.props.shouldUpsellHighlighting&&(0,v.createElement)("div",{className:"yst-root"},(0,v.createElement)(Ee.Badge,{className:"yst-absolute yst-px-[3px] yst-py-[3px] yst--right-[6.5px] yst--top-[6.5px]",size:"small",variant:"upsell"},(0,v.createElement)(Re,{className:"yst-w-2.5 yst-h-2.5 yst-shrink-0",role:"img","aria-hidden":!0,focusable:!1}))))}deactivateMarker(){this.props.setActiveMarker(null),this.props.setMarkerPauseStatus(!1),this.removeMarkers()}activateMarker(e,t){this.props.setActiveMarker(e),t()}handleMarkButtonClick(e,t){const s=this.props.keywordKey.length>0?`${this.props.keywordKey}:${e}`:e;this.props.activeAIFixesButton&&this.props.setActiveAIFixesButton(null),s===this.props.activeMarker?this.deactivateMarker():this.activateMarker(s,t)}handleResultsChange(e,t,s){const a=this.props.keywordKey.length>0?`${this.props.keywordKey}:${e}`:e;a===this.props.activeMarker&&(s?(0,c.isUndefined)(t)||this.activateMarker(a,t):this.deactivateMarker())}focusOnKeyphraseField(e){const t=this.props.keywordKey,s=""===t?"focus-keyword-input-"+e:"yoast-keyword-input-"+t+"-"+e,a=document.getElementById(s);a.focus(),a.scrollIntoView({behavior:"auto",block:"center",inline:"center"})}focusOnGooglePreviewField(e,t){let s;s="metaDescriptionKeyword"===e||"metaDescriptionLength"===e?"description":"titleWidth"===e||"keyphraseInSEOTitle"===e?"title":"slug";const a=document.getElementById("yoast-google-preview-"+s+"-"+t);a.focus(),a.scrollIntoView({behavior:"auto",block:"center",inline:"center"})}handleEditButtonClick(e){const t=this.props.location;"functionWordsInKeyphrase"!==e&&"keyphraseLength"!==e?(["metaDescriptionKeyword","metaDescriptionLength","titleWidth","keyphraseInSEOTitle","slugKeyword"].includes(e)&&this.handleGooglePreviewFocus(t,e),(0,m.doAction)("yoast.focus.input",e)):this.focusOnKeyphraseField(t)}handleGooglePreviewFocus(e,t){if("sidebar"===e)document.getElementById("yoast-search-appearance-modal-open-button").click(),setTimeout((()=>this.focusOnGooglePreviewField(t,"modal")),500);else{const s=document.getElementById("yoast-snippet-editor-metabox");s&&"false"===s.getAttribute("aria-expanded")?(s.click(),setTimeout((()=>this.focusOnGooglePreviewField(t,e)),100)):this.focusOnGooglePreviewField(t,e)}}removeMarkers(){window.YoastSEO.analysis.applyMarks(new p.Paper("",{}),[])}renderHighlightingUpsell(e,t){const s=(0,d.__)("Highlight areas of improvement in your text, no more searching for a needle in a haystack, straight to optimizing! Now also in Elementor!","wordpress-seo");return e&&(0,v.createElement)(X,{title:(0,d.__)("Unlock Premium SEO analysis","wordpress-seo"),onRequestClose:t,additionalClassName:"",className:`${J} yoast-gutenberg-modal__box yoast-gutenberg-modal__no-padding`,id:"yoast-premium-seo-analysis-highlighting-modal",shouldCloseOnClickOutside:!0},(0,v.createElement)(_e,null,(0,v.createElement)(Ke,{buyLink:this.props.highlightingUpsellLink,description:s})))}render(){const{mappedResults:e}=this.state,{errorsResults:t,improvementsResults:s,goodResults:a,considerationsResults:r,problemsResults:n}=e,{upsellResults:o,resultCategoryLabels:i}=this.props,l={errors:(0,d.__)("Errors","wordpress-seo"),problems:(0,d.__)("Problems","wordpress-seo"),improvements:(0,d.__)("Improvements","wordpress-seo"),considerations:(0,d.__)("Considerations","wordpress-seo"),goodResults:(0,d.__)("Good results","wordpress-seo")},c=Object.assign(l,i);let u=this.props.marksButtonStatus;return"enabled"===u&&this.props.shortcodesForParsing.length>0&&(u="disabled"),(0,v.createElement)(k.Fragment,null,(0,v.createElement)(ke.ContentAnalysis,{errorsResults:t,problemsResults:n,upsellResults:o,improvementsResults:s,considerationsResults:r,goodResults:a,activeMarker:this.props.activeMarker,onMarkButtonClick:this.handleMarkButtonClick,onEditButtonClick:this.handleEditButtonClick,marksButtonClassName:this.props.marksButtonClassName,editButtonClassName:this.props.editButtonClassName,marksButtonStatus:u,headingLevel:3,keywordKey:this.props.keywordKey,isPremium:this.props.isPremium,resultCategoryLabels:c,onResultChange:this.handleResultsChange,shouldUpsellHighlighting:this.props.shouldUpsellHighlighting,renderAIFixesButton:this.props.renderAIFixesButton,renderHighlightingUpsell:this.renderHighlightingUpsell,markButtonFactory:this.createMarkButton}))}}De.propTypes={results:x().array,upsellResults:x().array,marksButtonClassName:x().string,editButtonClassName:x().string,marksButtonStatus:x().oneOf(["enabled","disabled","hidden"]),setActiveMarker:x().func.isRequired,setMarkerPauseStatus:x().func.isRequired,setActiveAIFixesButton:x().func.isRequired,activeMarker:x().string,activeAIFixesButton:x().string,keywordKey:x().string,location:x().string,isPremium:x().bool,resultCategoryLabels:x().shape({errors:x().string,problems:x().string,improvements:x().string,considerations:x().string,goodResults:x().string}),shortcodesForParsing:x().array,shouldUpsellHighlighting:x().bool,highlightingUpsellLink:x().string,renderAIFixesButton:x().func},De.defaultProps={results:null,upsellResults:[],marksButtonStatus:"enabled",marksButtonClassName:"",editButtonClassName:"",activeMarker:null,activeAIFixesButton:null,keywordKey:"",location:"",isPremium:!1,resultCategoryLabels:{},shortcodesForParsing:[],shouldUpsellHighlighting:!1,highlightingUpsellLink:"",renderAIFixesButton:()=>{}};const $e=De,He=(0,me.compose)([(0,he.withSelect)((e=>{const{getActiveMarker:t,getIsPremium:s,getShortcodesForParsing:a,getActiveAIFixesButton:r}=e("yoast-seo/editor");return{activeMarker:t(),isPremium:s(),shortcodesForParsing:a(),activeAIFixesButton:r()}})),(0,he.withDispatch)((e=>{const{setActiveMarker:t,setMarkerPauseStatus:s,setActiveAIFixesButton:a}=e("yoast-seo/editor");return{setActiveMarker:t,setMarkerPauseStatus:s,setActiveAIFixesButton:a}}))])($e),We=()=>(0,v.createElement)("p",{className:"yoast-related-keyphrases-modal__loading-message"},(0,d.sprintf)(/* translators: %1$s expands to "Yoast SEO", %2$s expands to "Semrush". */ (0,d.__)("Please wait while %1$s connects to %2$s to get related keyphrases...","wordpress-seo"),"Yoast SEO","Semrush")," ",(0,v.createElement)(T.SvgIcon,{icon:"loading-spinner"})),je=(0,S.makeOutboundLink)(),Ye=()=>(0,v.createElement)(k.Fragment,null,(0,v.createElement)("p",null,(0,d.sprintf)(/* translators: %s : Expands to "Semrush". */ (0,d.__)("You've reached your request limit for today. Check back tomorrow or upgrade your plan over at %s.","wordpress-seo"),"Semrush")),(0,v.createElement)(je,{href:window.wpseoAdminL10n["shortlinks.semrush.prices"],className:"yoast-button-upsell"},(0,d.sprintf)(/* translators: %s : Expands to "Semrush". */ (0,d.__)("Upgrade your %s plan","wordpress-seo"),"Semrush"),(0,v.createElement)("span",{"aria-hidden":"true",className:"yoast-button-upsell__caret"}))),ze=window.wp.apiFetch;var Ue=s.n(ze);const Ve="yoast-semrush-country-selector",Ge=[{value:"us",name:"United States - US"},{value:"uk",name:"United Kingdom - UK"},{value:"ca",name:"Canada - CA"},{value:"ru",name:"Russia - RU"},{value:"de",name:"Germany - DE"},{value:"fr",name:"France - FR"},{value:"es",name:"Spain - ES"},{value:"it",name:"Italy - IT"},{value:"br",name:"Brazil - BR"},{value:"au",name:"Australia - AU"},{value:"ar",name:"Argentina - AR"},{value:"be",name:"Belgium - BE"},{value:"ch",name:"Switzerland - CH"},{value:"dk",name:"Denmark - DK"},{value:"fi",name:"Finland - FI"},{value:"hk",name:"Hong Kong - HK"},{value:"ie",name:"Ireland - IE"},{value:"il",name:"Israel - IL"},{value:"mx",name:"Mexico - MX"},{value:"nl",name:"Netherlands - NL"},{value:"no",name:"Norway - NO"},{value:"pl",name:"Poland - PL"},{value:"se",name:"Sweden - SE"},{value:"sg",name:"Singapore - SG"},{value:"tr",name:"Turkey - TR"},{value:"jp",name:"Japan - JP"},{value:"in",name:"India - IN"},{value:"hu",name:"Hungary - HU"},{value:"af",name:"Afghanistan - AF"},{value:"al",name:"Albania - AL"},{value:"dz",name:"Algeria - DZ"},{value:"ao",name:"Angola - AO"},{value:"am",name:"Armenia - AM"},{value:"at",name:"Austria - AT"},{value:"az",name:"Azerbaijan - AZ"},{value:"bh",name:"Bahrain - BH"},{value:"bd",name:"Bangladesh - BD"},{value:"by",name:"Belarus - BY"},{value:"bz",name:"Belize - BZ"},{value:"bo",name:"Bolivia - BO"},{value:"ba",name:"Bosnia and Herzegovina - BA"},{value:"bw",name:"Botswana - BW"},{value:"bn",name:"Brunei - BN"},{value:"bg",name:"Bulgaria - BG"},{value:"cv",name:"Cabo Verde - CV"},{value:"kh",name:"Cambodia - KH"},{value:"cm",name:"Cameroon - CM"},{value:"cl",name:"Chile - CL"},{value:"co",name:"Colombia - CO"},{value:"cr",name:"Costa Rica - CR"},{value:"hr",name:"Croatia - HR"},{value:"cy",name:"Cyprus - CY"},{value:"cz",name:"Czech Republic - CZ"},{value:"cd",name:"Congo - CD"},{value:"do",name:"Dominican Republic - DO"},{value:"ec",name:"Ecuador - EC"},{value:"eg",name:"Egypt - EG"},{value:"sv",name:"El Salvador - SV"},{value:"ee",name:"Estonia - EE"},{value:"et",name:"Ethiopia - ET"},{value:"ge",name:"Georgia - GE"},{value:"gh",name:"Ghana - GH"},{value:"gr",name:"Greece - GR"},{value:"gt",name:"Guatemala - GT"},{value:"gy",name:"Guyana - GY"},{value:"ht",name:"Haiti - HT"},{value:"hn",name:"Honduras - HN"},{value:"is",name:"Iceland - IS"},{value:"id",name:"Indonesia - ID"},{value:"jm",name:"Jamaica - JM"},{value:"jo",name:"Jordan - JO"},{value:"kz",name:"Kazakhstan - KZ"},{value:"kw",name:"Kuwait - KW"},{value:"lv",name:"Latvia - LV"},{value:"lb",name:"Lebanon - LB"},{value:"lt",name:"Lithuania - LT"},{value:"lu",name:"Luxembourg - LU"},{value:"mg",name:"Madagascar - MG"},{value:"my",name:"Malaysia - MY"},{value:"mt",name:"Malta - MT"},{value:"mu",name:"Mauritius - MU"},{value:"md",name:"Moldova - MD"},{value:"mn",name:"Mongolia - MN"},{value:"me",name:"Montenegro - ME"},{value:"ma",name:"Morocco - MA"},{value:"mz",name:"Mozambique - MZ"},{value:"na",name:"Namibia - NA"},{value:"np",name:"Nepal - NP"},{value:"nz",name:"New Zealand - NZ"},{value:"ni",name:"Nicaragua - NI"},{value:"ng",name:"Nigeria - NG"},{value:"om",name:"Oman - OM"},{value:"py",name:"Paraguay - PY"},{value:"pe",name:"Peru - PE"},{value:"ph",name:"Philippines - PH"},{value:"pt",name:"Portugal - PT"},{value:"ro",name:"Romania - RO"},{value:"sa",name:"Saudi Arabia - SA"},{value:"sn",name:"Senegal - SN"},{value:"rs",name:"Serbia - RS"},{value:"sk",name:"Slovakia - SK"},{value:"si",name:"Slovenia - SI"},{value:"za",name:"South Africa - ZA"},{value:"kr",name:"South Korea - KR"},{value:"lk",name:"Sri Lanka - LK"},{value:"th",name:"Thailand - TH"},{value:"bs",name:"Bahamas - BS"},{value:"tt",name:"Trinidad and Tobago - TT"},{value:"tn",name:"Tunisia - TN"},{value:"ua",name:"Ukraine - UA"},{value:"ae",name:"United Arab Emirates - AE"},{value:"uy",name:"Uruguay - UY"},{value:"ve",name:"Venezuela - VE"},{value:"vn",name:"Vietnam - VN"},{value:"zm",name:"Zambia - ZM"},{value:"zw",name:"Zimbabwe - ZW"},{value:"ly",name:"Libya - LY"}];class Ze extends k.Component{constructor(e){super(e),this.relatedKeyphrasesRequest=this.relatedKeyphrasesRequest.bind(this),this.onChangeHandler=this.onChangeHandler.bind(this)}componentDidMount(){this.props.response&&this.props.keyphrase===this.props.lastRequestKeyphrase||this.relatedKeyphrasesRequest()}storeCountryCode(e){Ue()({path:"yoast/v1/semrush/country_code",method:"POST",data:{country_code:e}})}async relatedKeyphrasesRequest(){const{keyphrase:e,countryCode:t,newRequest:s}=this.props;s(t,e),this.storeCountryCode(t);const a=await this.doRequest(e,t);200!==a.status?this.handleFailedResponse(a):this.handleSuccessResponse(a)}handleSuccessResponse(e){const{setNoResultsFound:t,setRequestSucceeded:s}=this.props;0!==e.results.rows.length?s(e):t()}handleFailedResponse(e){const{setRequestLimitReached:t,setRequestFailed:s}=this.props;"error"in e&&(e.error.includes("TOTAL LIMIT EXCEEDED")?t():s(e))}async doRequest(e,t){return await Ue()({path:(0,xe.addQueryArgs)("/yoast/v1/semrush/related_keyphrases",{keyphrase:e,country_code:t})})}onChangeHandler(e){this.props.setCountry(e)}render(){return(0,v.createElement)("div",{id:Ve},(0,v.createElement)(T.SingleSelect,{id:Ve+"-select",label:(0,d.__)("Show results for:","wordpress-seo"),name:"semrush-country-code",options:Ge,selected:this.props.countryCode,onChange:this.onChangeHandler,wrapperClassName:"yoast-field-group yoast-field-group--inline"}),(0,v.createElement)(T.NewButton,{id:Ve+"-button",variant:"secondary",onClick:this.relatedKeyphrasesRequest},(0,d.__)("Select country","wordpress-seo")))}}Ze.propTypes={keyphrase:x().string,countryCode:x().string,response:x().object,lastRequestKeyphrase:x().string,setCountry:x().func.isRequired,newRequest:x().func.isRequired,setNoResultsFound:x().func.isRequired,setRequestSucceeded:x().func.isRequired,setRequestLimitReached:x().func.isRequired,setRequestFailed:x().func.isRequired},Ze.defaultProps={keyphrase:"",countryCode:"us",response:{},lastRequestKeyphrase:""};const Je=Ze,Qe=({data:e,mapChartDataToTableData:t,dataTableCaption:s,dataTableHeaderLabels:a,isDataTableVisuallyHidden:r})=>e.length!==a.length?(0,v.createElement)("p",null,(0,d.__)("The number of headers and header labels don't match.","wordpress-seo")):(0,v.createElement)("div",{className:r?"screen-reader-text":null},(0,v.createElement)("table",null,(0,v.createElement)("caption",null,s),(0,v.createElement)("thead",null,(0,v.createElement)("tr",null,a.map(((e,t)=>(0,v.createElement)("th",{key:t},e))))),(0,v.createElement)("tbody",null,(0,v.createElement)("tr",null,e.map(((e,s)=>(0,v.createElement)("td",{key:s},t(e.y))))))));Qe.propTypes={data:x().arrayOf(x().shape({x:x().number,y:x().number})).isRequired,mapChartDataToTableData:x().func,dataTableCaption:x().string.isRequired,dataTableHeaderLabels:x().array.isRequired,isDataTableVisuallyHidden:x().bool},Qe.defaultProps={mapChartDataToTableData:null,isDataTableVisuallyHidden:!0};const Xe=Qe,et=({data:e,width:t,height:s,fillColor:a,strokeColor:r,strokeWidth:n,className:o,mapChartDataToTableData:i,dataTableCaption:l,dataTableHeaderLabels:c,isDataTableVisuallyHidden:u})=>{const d=Math.max(1,Math.max(...e.map((e=>e.x)))),p=Math.max(1,Math.max(...e.map((e=>e.y)))),m=s-n,h=e.map((e=>`${e.x/d*t},${m-e.y/p*m+n}`)).join(" "),g=`0,${m+n} `+h+` ${t},${m+n}`;return(0,v.createElement)(k.Fragment,null,(0,v.createElement)("svg",{width:t,height:s,viewBox:`0 0 ${t} ${s}`,className:o,role:"img","aria-hidden":"true",focusable:"false"},(0,v.createElement)("polygon",{fill:a,points:g}),(0,v.createElement)("polyline",{fill:"none",stroke:r,strokeWidth:n,strokeLinejoin:"round",strokeLinecap:"round",points:h})),i&&(0,v.createElement)(Xe,{data:e,mapChartDataToTableData:i,dataTableCaption:l,dataTableHeaderLabels:c,isDataTableVisuallyHidden:u}))};et.propTypes={data:x().arrayOf(x().shape({x:x().number,y:x().number})).isRequired,width:x().number.isRequired,height:x().number.isRequired,fillColor:x().string,strokeColor:x().string,strokeWidth:x().number,className:x().string,mapChartDataToTableData:x().func,dataTableCaption:x().string.isRequired,dataTableHeaderLabels:x().array.isRequired,isDataTableVisuallyHidden:x().bool},et.defaultProps={fillColor:null,strokeColor:"#000000",strokeWidth:1,className:"",mapChartDataToTableData:null,isDataTableVisuallyHidden:!0};const tt=et,st=(0,S.makeOutboundLink)();class at extends k.Component{constructor(e){super(e),this.transformTrendDataToChartPoints=this.transformTrendDataToChartPoints.bind(this),this.getAreaChartDataTableHeaderLabels=this.getAreaChartDataTableHeaderLabels.bind(this),this.mapAreaChartDataToTableData=this.mapAreaChartDataToTableData.bind(this)}transformTrendDataToChartPoints(e){return e.split(",").map(((e,t)=>({x:t,y:parseFloat(e)})))}getAreaChartDataTableHeaderLabels(){return[(0,d.__)("Twelve months ago","wordpress-seo"),(0,d.__)("Eleven months ago","wordpress-seo"),(0,d.__)("Ten months ago","wordpress-seo"),(0,d.__)("Nine months ago","wordpress-seo"),(0,d.__)("Eight months ago","wordpress-seo"),(0,d.__)("Seven months ago","wordpress-seo"),(0,d.__)("Six months ago","wordpress-seo"),(0,d.__)("Five months ago","wordpress-seo"),(0,d.__)("Four months ago","wordpress-seo"),(0,d.__)("Three months ago","wordpress-seo"),(0,d.__)("Two months ago","wordpress-seo"),(0,d.__)("Last month","wordpress-seo")]}mapAreaChartDataToTableData(e){return Math.round(100*e)}render(){const{keyphrase:e,relatedKeyphrases:t,countryCode:s,data:a,renderAction:r}=this.props,n="https://www.semrush.com/analytics/keywordoverview/?q="+encodeURIComponent(e)+"&db="+encodeURIComponent(s);return a&&!(0,c.isEmpty)(a.results)&&(0,v.createElement)(k.Fragment,null,(0,v.createElement)("table",{className:"yoast yoast-table"},(0,v.createElement)("thead",null,(0,v.createElement)("tr",null,(0,v.createElement)("th",{scope:"col",className:"yoast-table--primary"},(0,d.__)("Related keyphrase","wordpress-seo")),(0,v.createElement)("th",{scope:"col",abbr:(0,d.__)("Volume","wordpress-seo")},(0,d.__)("Volume","wordpress-seo"),(0,v.createElement)(V,{href:window.wpseoAdminL10n["shortlinks.semrush.volume_help"],className:"dashicons"},(0,v.createElement)("span",{className:"screen-reader-text"},/* translators: Hidden accessibility text. */ (0,d.__)("Learn more about the related keyphrases volume","wordpress-seo")))),(0,v.createElement)("th",{scope:"col",abbr:(0,d.__)("Trend","wordpress-seo")},(0,d.__)("Trend","wordpress-seo"),(0,v.createElement)(V,{href:window.wpseoAdminL10n["shortlinks.semrush.trend_help"],className:"dashicons"},(0,v.createElement)("span",{className:"screen-reader-text"},/* translators: Hidden accessibility text. */ (0,d.__)("Learn more about the related keyphrases trend","wordpress-seo")))),r&&(0,v.createElement)("td",{className:"yoast-table--nobreak"}))),(0,v.createElement)("tbody",null,a.results.rows.map(((e,s)=>{const a=e[0],n=this.transformTrendDataToChartPoints(e[2]),o=this.getAreaChartDataTableHeaderLabels();return(0,v.createElement)("tr",{key:s},(0,v.createElement)("td",null,a),(0,v.createElement)("td",null,e[1]),(0,v.createElement)("td",{className:"yoast-table--nopadding"},(0,v.createElement)(tt,{width:66,height:24,data:n,strokeWidth:1.8,strokeColor:"#498afc",fillColor:"#ade3fc",className:"yoast-related-keyphrases-modal__chart",mapChartDataToTableData:this.mapAreaChartDataToTableData,dataTableCaption:(0,d.__)("Keyphrase volume in the last 12 months on a scale from 0 to 100.","wordpress-seo"),dataTableHeaderLabels:o})),r&&(0,v.createElement)("td",{className:"yoast-table--nobreak"},r(a,t)))})))),(0,v.createElement)("p",{style:{marginBottom:0}},(0,v.createElement)(st,{href:n},(0,d.sprintf)(/* translators: %s expands to Semrush */ (0,d.__)("Get more insights at %s","wordpress-seo"),"Semrush"))))}}at.propTypes={data:x().object,keyphrase:x().string,relatedKeyphrases:x().array,countryCode:x().string,renderAction:x().func},at.defaultProps={data:{},keyphrase:"",relatedKeyphrases:[],countryCode:"us",renderAction:null};const rt=at,nt=(0,S.makeOutboundLink)(),ot=()=>(0,v.createElement)(T.Alert,{type:"info"},(0,d.sprintf)(/* translators: %s: Expands to "Yoast SEO". */ (0,d.__)("You’ll reach more people with multiple keyphrases! Want to quickly add these related keyphrases to the %s analyses for even better content optimization?","wordpress-seo"),"Yoast SEO")+" ",(0,v.createElement)(nt,{href:window.wpseoAdminL10n["shortlinks.semrush.premium_landing_page"]},(0,d.sprintf)(/* translators: %s: Expands to "Yoast SEO Premium". */ (0,d.__)("Explore %s!","wordpress-seo"),"Yoast SEO Premium"))),it=()=>(0,v.createElement)(T.Alert,{type:"error"},(0,d.__)("We've encountered a problem trying to get related keyphrases. Please try again later.","wordpress-seo")),lt=()=>(0,v.createElement)(T.Alert,{type:"warning"},(0,d.sprintf)(/* translators: %s: Expands to "Yoast SEO". */ (0,d.__)("You've reached the maximum amount of 4 related keyphrases. You can change or remove related keyphrases in the %s metabox or sidebar.","wordpress-seo"),"Yoast SEO"));function ct(e){const{response:t,lastRequestKeyphrase:s,keyphrase:a,newRequest:r,setCountry:n,renderAction:o,countryCode:i,requestLimitReached:l,setRequestFailed:p,setNoResultsFound:m,relatedKeyphrases:h,setRequestSucceeded:g,setRequestLimitReached:y}=e,f=u().isPremium;return(0,v.createElement)(k.Fragment,null,!l&&(0,v.createElement)(k.Fragment,null,!f&&(0,v.createElement)(ot,null),f&&function(e){return e&&e.length>=4}(h)&&(0,v.createElement)(lt,null),(0,v.createElement)(Je,{countryCode:i,setCountry:n,newRequest:r,keyphrase:a,setRequestFailed:p,setNoResultsFound:m,setRequestSucceeded:g,setRequestLimitReached:y,response:t,lastRequestKeyphrase:s})),function(e){const{isPending:t,requestLimitReached:s,isSuccess:a,response:r,requestHasData:n}=e;return t?(0,v.createElement)(We,null):s?(0,v.createElement)(Ye,null):!a&&function(e){return!(0,c.isEmpty)(e)&&"error"in e}(r)?(0,v.createElement)(it,null):n?void 0:(0,v.createElement)("p",null,(0,d.__)("Sorry, there's no data available for that keyphrase/country combination.","wordpress-seo"))}(e),(0,v.createElement)(rt,{keyphrase:a,relatedKeyphrases:h,countryCode:i,renderAction:o,data:t}))}ct.propTypes={keyphrase:x().string,relatedKeyphrases:x().array,renderAction:x().func,requestLimitReached:x().bool,countryCode:x().string.isRequired,setCountry:x().func.isRequired,newRequest:x().func.isRequired,setRequestSucceeded:x().func.isRequired,setRequestLimitReached:x().func.isRequired,setRequestFailed:x().func.isRequired,setNoResultsFound:x().func.isRequired,response:x().object,lastRequestKeyphrase:x().string},ct.defaultProps={keyphrase:"",relatedKeyphrases:[],renderAction:null,requestLimitReached:!1,response:{},lastRequestKeyphrase:""};const ut=(0,me.compose)([(0,he.withSelect)((e=>{const{getFocusKeyphrase:t,getSEMrushSelectedCountry:s,getSEMrushRequestLimitReached:a,getSEMrushRequestResponse:r,getSEMrushRequestIsSuccess:n,getSEMrushIsRequestPending:o,getSEMrushRequestHasData:i,getSEMrushRequestKeyphrase:l}=e("yoast-seo/editor");return{keyphrase:t(),countryCode:s(),requestLimitReached:a(),response:r(),isSuccess:n(),isPending:o(),requestHasData:i(),lastRequestKeyphrase:l()}})),(0,he.withDispatch)((e=>{const{setSEMrushChangeCountry:t,setSEMrushNewRequest:s,setSEMrushRequestSucceeded:a,setSEMrushRequestFailed:r,setSEMrushSetRequestLimitReached:n,setSEMrushNoResultsFound:o}=e("yoast-seo/editor");return{setCountry:e=>{t(e)},newRequest:(e,t)=>{s(e,t)},setRequestSucceeded:e=>{a(e)},setRequestFailed:e=>{r(e)},setRequestLimitReached:()=>{n()},setNoResultsFound:()=>{o()}}}))])(ct),dt=window.moment;var pt=s.n(dt),mt=s(6746);const ht=(0,S.makeOutboundLink)(),gt=e=>{const t=(0,d.sprintf)(/* translators: %d expands to the amount of allowed keyphrases on a free account, %s expands to a link to Wincher plans. */ (0,d.__)("You've reached the maximum amount of %d keyphrases you can add to your Wincher account. If you wish to add more keyphrases, please %s.","wordpress-seo"),e.limit,"{{updateWincherPlanLink/}}");return(0,v.createElement)(T.Alert,{type:"error"},(0,mt.Z)({mixedString:t,components:{updateWincherPlanLink:(0,v.createElement)(ht,{href:wpseoAdminGlobalL10n["links.wincher.pricing"]},(0,d.sprintf)(/* translators: %s : Expands to "Wincher". */ (0,d.__)("upgrade your %s plan","wordpress-seo"),"Wincher"))}}))};gt.propTypes={limit:x().number},gt.defaultProps={limit:10};const yt=gt,ft=()=>(0,v.createElement)(T.Alert,{type:"error"},(0,d.__)("Something went wrong while tracking the ranking position(s) of your page. Please try again later.","wordpress-seo"));async function bt(e,t,s,a=200){try{const r=await e();return!!r&&(r.status===a?t(r):s(r))}catch(e){console.error(e.message)}}async function wt(e){try{return await Ue()(e)}catch(e){return e.error&&e.status?e:e instanceof Response&&await e.json()}}async function vt(e){return(0,c.isArray)(e)||(e=[e]),await wt({path:"yoast/v1/wincher/keyphrases/track",method:"POST",data:{keyphrases:e}})}const kt=R().p` color: ${C.colors.$color_pink_dark}; font-size: 14px; font-weight: 700; margin: 13px 0 10px; `,Et=R()(T.SvgIcon)` margin-right: 5px; vertical-align: middle; `,Rt=R().button` position: absolute; top: 9px; right: 9px; border: none; background: none; cursor: pointer; `,_t=R().p` font-size: 13px; font-weight: 500; margin: 10px 0 13px; `,xt=R().div` position: relative; background: ${e=>e.isTitleShortened?"#F5F7F7":"transparent"}; border: 1px solid #C7C7C7; border-left: 4px solid${C.colors.$color_pink_dark}; padding: 0 16px; margin-bottom: 1.5em; `,Tt=e=>{const[t,s]=(0,k.useState)(null);return(0,k.useEffect)((()=>{e&&!t&&async function(){return await wt({path:"yoast/v1/wincher/account/limit",method:"GET"})}().then((e=>s(e)))}),[t]),t};Tt.propTypes={limit:x().bool.isRequired};const St=({limit:e,usage:t,isTitleShortened:s,isFreeAccount:a})=>{const r=(0,d.sprintf)( /* Translators: %1$s expands to the number of used keywords. * %2$s expands to the account keywords limit. */ (0,d.__)("Your are tracking %1$s out of %2$s keyphrases included in your free account.","wordpress-seo"),t,e),n=(0,d.sprintf)( /* Translators: %1$s expands to the number of used keywords. * %2$s expands to the account keywords limit. */ (0,d.__)("Your are tracking %1$s out of %2$s keyphrases included in your account.","wordpress-seo"),t,e),o=a?r:n,i=(0,d.sprintf)( /* Translators: %1$s expands to the number of used keywords. * %2$s expands to the account keywords limit. */ (0,d.__)("Keyphrases tracked: %1$s/%2$s","wordpress-seo"),t,e),l=s?i:o;return(0,v.createElement)(kt,null,s&&(0,v.createElement)(Et,{icon:"exclamation-triangle",color:C.colors.$color_pink_dark,size:"14px"}),l)};St.propTypes={limit:x().number.isRequired,usage:x().number.isRequired,isTitleShortened:x().bool,isFreeAccount:x().bool};const Ct=(0,S.makeOutboundLink)(),It=({discount:e,months:t})=>{const s=(0,v.createElement)(Ct,{href:wpseoAdminGlobalL10n["links.wincher.upgrade"],style:{fontWeight:600}},(0,d.sprintf)(/* Translators: %s : Expands to "Wincher". */ (0,d.__)("Click here to upgrade your %s plan","wordpress-seo"),"Wincher"));if(!e||!t)return(0,v.createElement)(_t,null,s);const a=100*e,r=(0,d.sprintf)( /* Translators: %1$s expands to upgrade account link. * %2$s expands to the upgrade discount value. * %3$s expands to the upgrade discount duration e.g. 2 months. */ (0,d.__)("%1$s and get an exclusive %2$s discount for %3$s month(s).","wordpress-seo"),"{{wincherAccountUpgradeLink/}}",a+"%",t);return(0,v.createElement)(_t,null,(0,mt.Z)({mixedString:r,components:{wincherAccountUpgradeLink:s}}))};It.propTypes={discount:x().number,months:x().number};const Lt=({onClose:e,isTitleShortened:t,trackingInfo:s})=>{const a=(()=>{const[e,t]=(0,k.useState)(null);return(0,k.useEffect)((()=>{e||async function(){return await wt({path:"yoast/v1/wincher/account/upgrade-campaign",method:"GET"})}().then((e=>t(e)))}),[e]),e})();if(null===s)return null;const{limit:r,usage:n}=s;if(!(r&&n/r>=.8))return null;const o=Boolean(null==a?void 0:a.discount);return(0,v.createElement)(xt,{isTitleShortened:t},e&&(0,v.createElement)(Rt,{type:"button","aria-label":(0,d.__)("Close the upgrade callout","wordpress-seo"),onClick:e},(0,v.createElement)(T.SvgIcon,{icon:"times-circle",color:C.colors.$color_pink_dark,size:"14px"})),(0,v.createElement)(St,{...s,isTitleShortened:t,isFreeAccount:o}),(0,v.createElement)(It,{discount:null==a?void 0:a.discount,months:null==a?void 0:a.months}))};Lt.propTypes={onClose:x().func,isTitleShortened:x().bool,trackingInfo:x().object};const At=Lt,qt=()=>(0,v.createElement)(T.Alert,{type:"success"},(0,d.sprintf)(/* translators: %s: Expands to "Wincher". */ (0,d.__)("You have successfully connected to %s! You can now track the SEO performance for the keyphrase(s) of this page.","wordpress-seo"),"Wincher")),Pt=()=>(0,v.createElement)(T.Alert,{type:"info"},(0,d.sprintf)(/* translators: %s: Expands to "Wincher". */ (0,d.__)("%s is currently tracking the ranking position(s) of your page. This may take a few minutes. Please wait or check back later.","wordpress-seo"),"Wincher")),Nt=()=>(0,v.createElement)("p",{className:"yoast-wincher-seo-performance-modal__loading-message"},(0,d.__)("Tracking the ranking position...","wordpress-seo")," ",(0,v.createElement)(T.SvgIcon,{icon:"loading-spinner"})),Bt=R()(T.SvgIcon)` margin-left: 2px; flex-shrink: 0; rotate: ${e=>e.isImproving?"-90deg":"90deg"}; `,Mt=R().span` color: ${e=>e.isImproving?"#69AB56":"#DC3332"}; font-size: 13px; font-weight: 600; line-height: 20px; margin-right: 2px; margin-left: 12px; `,Ot=R().td` padding-right: 0 !important; & > div { margin: 0px; } `,Ft=R().td` padding-left: 2px !important; `,Kt=R().td.attrs({className:"yoast-table--nopadding"})` & > div { justify-content: center; } `,Dt=R().div` display: flex; align-items: center; & > a { box-sizing: border-box; } `,$t=R().button` background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit; display: flex; align-items: center; `,Ht=R().tr` background-color: ${e=>e.isEnabled?"#FFFFFF":"#F9F9F9"} !important; `;function Wt(e){return Math.round(100*e)}function jt({chartData:e}){if((0,c.isEmpty)(e)||(0,c.isEmpty)(e.position))return"?";const t=function(e){return Array.from({length:e.position.history.length},((e,t)=>t+1)).map((e=>(0,d.sprintf)((0,d._n)("%d day","%d days",e,"wordpress-seo"),e)))}(e),s=e.position.history.map(((e,t)=>({x:t,y:101-e.value})));return(0,v.createElement)(tt,{width:66,height:24,data:s,strokeWidth:1.8,strokeColor:"#498afc",fillColor:"#ade3fc",mapChartDataToTableData:Wt,dataTableCaption:(0,d.__)("Keyphrase position in the last 90 days on a scale from 0 to 100.","wordpress-seo"),dataTableHeaderLabels:t})}jt.propTypes={chartData:x().object},jt.defaultProps={chartData:{}};const Yt=({rowData:e})=>{var t;if(null==e||null===(t=e.position)||void 0===t||!t.change)return(0,v.createElement)(jt,{chartData:e});const s=e.position.change<0;return(0,v.createElement)(k.Fragment,null,(0,v.createElement)(jt,{chartData:e}),(0,v.createElement)(Mt,{isImproving:s},Math.abs(e.position.change)),(0,v.createElement)(Bt,{icon:"caret-right",color:s?"#69AB56":"#DC3332",size:"14px",isImproving:s}))};function zt(e){var t;const{keyphrase:s,rowData:a,onTrackKeyphrase:r,onUntrackKeyphrase:n,isFocusKeyphrase:o,isDisabled:i,isLoading:l,isSelected:u,onSelectKeyphrases:p}=e,m=!(0,c.isEmpty)(a),h=!(0,c.isEmpty)(null==a||null===(t=a.position)||void 0===t?void 0:t.history),g=(0,k.useCallback)((()=>{i||(m?n(s,a.id):r(s))}),[s,r,n,m,a,i]),y=(0,k.useCallback)((()=>{p((e=>u?e.filter((e=>e!==s)):e.concat(s)))}),[p,u,s]);return(0,v.createElement)(Ht,{isEnabled:m},(0,v.createElement)(Ot,null,h&&(0,v.createElement)(T.Checkbox,{id:"select-"+s,onChange:y,checked:u,label:""})),(0,v.createElement)(Ft,null,s,o&&(0,v.createElement)("span",null,"*")),function(e){const{rowData:t,websiteId:s,keyphrase:a,onSelectKeyphrases:r}=e,n=(0,k.useCallback)((()=>{r([a])}),[r,a]),o=!(0,c.isEmpty)(t),i=t&&t.updated_at&&pt()(t.updated_at)>=pt()().subtract(7,"days"),l=t?(0,d.sprintf)("https://app.wincher.com/websites/%s/keywords?serp=%s&utm_medium=plugin&utm_source=yoast&referer=yoast&partner=yoast",s,t.id):null;return o?i?(0,v.createElement)(k.Fragment,null,(0,v.createElement)("td",null,(0,v.createElement)(Dt,null,function(e){return!e||!e.position||e.position.value>100?"> 100":e.position.value}(t),(0,v.createElement)(T.ButtonStyledLink,{variant:"secondary",href:l,style:{height:28,marginLeft:12},rel:"noopener",target:"_blank"},(0,d.__)("View","wordpress-seo")))),(0,v.createElement)("td",{className:"yoast-table--nopadding"},(0,v.createElement)($t,{type:"button",onClick:n},(0,v.createElement)(Yt,{rowData:t}))),(0,v.createElement)("td",null,(u=t.updated_at,pt()(u).fromNow()))):(0,v.createElement)("td",{className:"yoast-table--nopadding",colSpan:"3"},(0,v.createElement)(Nt,null)):(0,v.createElement)("td",{className:"yoast-table--nopadding",colSpan:"3"},(0,v.createElement)("i",null,(0,d.__)("Activate tracking to show the ranking position","wordpress-seo")));var u}(e),(0,v.createElement)(Kt,null,function({keyphrase:e,isEnabled:t,toggleAction:s,isLoading:a}){return a?(0,v.createElement)(T.SvgIcon,{icon:"loading-spinner"}):(0,v.createElement)(T.Toggle,{id:`toggle-keyphrase-tracking-${e}`,className:"wincher-toggle",isEnabled:t,onSetToggleState:s,showToggleStateLabel:!1})}({keyphrase:s,isEnabled:m,toggleAction:g,isLoading:l})))}Yt.propTypes={rowData:x().object},zt.propTypes={rowData:x().object,keyphrase:x().string.isRequired,onTrackKeyphrase:x().func,onUntrackKeyphrase:x().func,isFocusKeyphrase:x().bool,isDisabled:x().bool,isLoading:x().bool,websiteId:x().string,isSelected:x().bool.isRequired,onSelectKeyphrases:x().func.isRequired},zt.defaultProps={rowData:{},onTrackKeyphrase:()=>{},onUntrackKeyphrase:()=>{},isFocusKeyphrase:!1,isDisabled:!1,isLoading:!1,websiteId:""};const Ut=(0,S.makeOutboundLink)(),Vt=R().span` display: block; font-style: italic; @media (min-width: 782px) { display: inline; position: absolute; ${(0,S.getDirectionalStyle)("right","left")}: 8px; } `,Gt=R().div` width: 100%; overflow-y: auto; `,Zt=R().th` pointer-events: ${e=>e.isDisabled?"none":"initial"}; padding-right: 0 !important; & > div { margin: 0px; } `,Jt=R().th` padding-left: 2px !important; `,Qt=e=>{const t=(0,k.useRef)();return(0,k.useEffect)((()=>{t.current=e})),t.current},Xt=(0,c.debounce)((async function(e=null,t=null,s=null,a){return await wt({path:"yoast/v1/wincher/keyphrases",method:"POST",data:{keyphrases:e,permalink:s,startAt:t},signal:a})}),500,{leading:!0}),es=e=>{const{addTrackedKeyphrase:t,isLoggedIn:s,keyphrases:a,permalink:r,removeTrackedKeyphrase:n,setKeyphraseLimitReached:o,setRequestFailed:i,setRequestSucceeded:l,setTrackedKeyphrases:u,setHasTrackedAll:p,trackAll:m,trackedKeyphrases:h,isNewlyAuthenticated:g,websiteId:y,focusKeyphrase:f,newRequest:b,startAt:w,selectedKeyphrases:E,onSelectKeyphrases:R}=e,_=(0,k.useRef)(),x=(0,k.useRef)(),S=(0,k.useRef)(!1),[C,I]=(0,k.useState)([]),L=(0,k.useCallback)((e=>{const t=e.toLowerCase();return h&&!(0,c.isEmpty)(h)&&h.hasOwnProperty(t)?h[t]:null}),[h]),A=(0,k.useMemo)((()=>async()=>{await bt((()=>(x.current&&x.current.abort(),x.current="undefined"==typeof AbortController?null:new AbortController,Xt(a,w,r,x.current.signal))),(e=>{l(e),u(e.results)}),(e=>{i(e)}))}),[l,i,u,a,r,w]),q=(0,k.useCallback)((async e=>{const s=(Array.isArray(e)?e:[e]).map((e=>e.toLowerCase()));I((e=>[...e,...s])),await bt((()=>vt(s)),(e=>{l(e),t(e.results),A()}),(e=>{400===e.status&&e.limit&&o(e.limit),i(e)}),201),I((e=>(0,c.without)(e,...s)))}),[l,i,o,t,A]),P=(0,k.useCallback)((async(e,t)=>{e=e.toLowerCase(),I((t=>[...t,e])),await bt((()=>async function(e){return await wt({path:"yoast/v1/wincher/keyphrases/untrack",method:"DELETE",data:{keyphraseID:e}})}(t)),(t=>{l(t),n(e)}),(e=>{i(e)})),I((t=>(0,c.without)(t,e)))}),[l,n,i]),N=(0,k.useCallback)((async e=>{b(),await q(e)}),[b,q]),B=Qt(r),M=Qt(a),O=Qt(w),F=r&&w;(0,k.useEffect)((()=>{s&&F&&(r!==B||(0,c.difference)(a,M).length||w!==O)&&A()}),[s,r,B,a,M,A,F,w,O]),(0,k.useEffect)((()=>{if(s&&m&&null!==h){const e=a.filter((e=>!L(e)));e.length&&q(e),p()}}),[s,m,h,q,p,L,a]),(0,k.useEffect)((()=>{g&&!S.current&&(A(),S.current=!0)}),[g,A]),(0,k.useEffect)((()=>{if(s&&!(0,c.isEmpty)(h))return(0,c.filter)(h,(e=>(0,c.isEmpty)(e.updated_at))).length>0&&(_.current=setInterval((()=>{A()}),1e4)),()=>{clearInterval(_.current)}}),[s,h,A]);const K=s&&null===h,D=(0,k.useMemo)((()=>(0,c.isEmpty)(h)?[]:Object.values(h).filter((e=>{var t;return!(0,c.isEmpty)(null==e||null===(t=e.position)||void 0===t?void 0:t.history)})).map((e=>e.keyword))),[h]),$=(0,k.useMemo)((()=>E.length>0&&D.length>0&&D.every((e=>E.includes(e)))),[E,D]),H=(0,k.useCallback)((()=>{R($?[]:D)}),[R,$,D]),W=(0,k.useMemo)((()=>(0,c.orderBy)(a,[e=>Object.values(h||{}).map((e=>e.keyword)).includes(e)],["desc"])),[a,h]);return a&&!(0,c.isEmpty)(a)&&(0,v.createElement)(k.Fragment,null,(0,v.createElement)(Gt,null,(0,v.createElement)("table",{className:"yoast yoast-table"},(0,v.createElement)("thead",null,(0,v.createElement)("tr",null,(0,v.createElement)(Zt,{isDisabled:0===D.length},(0,v.createElement)(T.Checkbox,{id:"select-all",onChange:H,checked:$,label:""})),(0,v.createElement)(Jt,{scope:"col",abbr:(0,d.__)("Keyphrase","wordpress-seo")},(0,d.__)("Keyphrase","wordpress-seo")),(0,v.createElement)("th",{scope:"col",abbr:(0,d.__)("Position","wordpress-seo")},(0,d.__)("Position","wordpress-seo")),(0,v.createElement)("th",{scope:"col",abbr:(0,d.__)("Position over time","wordpress-seo")},(0,d.__)("Position over time","wordpress-seo")),(0,v.createElement)("th",{scope:"col",abbr:(0,d.__)("Last updated","wordpress-seo")},(0,d.__)("Last updated","wordpress-seo")),(0,v.createElement)("th",{scope:"col",abbr:(0,d.__)("Tracking","wordpress-seo")},(0,d.__)("Tracking","wordpress-seo")))),(0,v.createElement)("tbody",null,W.map(((e,t)=>(0,v.createElement)(zt,{key:`trackable-keyphrase-${t}`,keyphrase:e,onTrackKeyphrase:N,onUntrackKeyphrase:P,rowData:L(e),isFocusKeyphrase:e===f.trim().toLowerCase(),websiteId:y,isDisabled:!s,isLoading:K||C.indexOf(e.toLowerCase())>=0,isSelected:E.includes(e),onSelectKeyphrases:R})))))),(0,v.createElement)("p",{style:{marginBottom:0,position:"relative"}},(0,v.createElement)(Ut,{href:wpseoAdminGlobalL10n["links.wincher.login"]},(0,d.sprintf)(/* translators: %s expands to Wincher */ (0,d.__)("Get more insights over at %s","wordpress-seo"),"Wincher")),(0,v.createElement)(Vt,null,(0,d.__)("* focus keyphrase","wordpress-seo"))))};es.propTypes={addTrackedKeyphrase:x().func.isRequired,isLoggedIn:x().bool,isNewlyAuthenticated:x().bool,keyphrases:x().array,newRequest:x().func.isRequired,removeTrackedKeyphrase:x().func.isRequired,setRequestFailed:x().func.isRequired,setKeyphraseLimitReached:x().func.isRequired,setRequestSucceeded:x().func.isRequired,setTrackedKeyphrases:x().func.isRequired,setHasTrackedAll:x().func.isRequired,trackAll:x().bool,trackedKeyphrases:x().object,websiteId:x().string,permalink:x().string.isRequired,focusKeyphrase:x().string,startAt:x().string,selectedKeyphrases:x().arrayOf(x().string).isRequired,onSelectKeyphrases:x().func.isRequired},es.defaultProps={isLoggedIn:!1,isNewlyAuthenticated:!1,keyphrases:[],trackAll:!1,websiteId:"",focusKeyphrase:""};const ts=es,ss=(0,me.compose)([(0,he.withSelect)((e=>{const{getWincherWebsiteId:t,getWincherTrackableKeyphrases:s,getWincherLoginStatus:a,getWincherPermalink:r,getFocusKeyphrase:n,isWincherNewlyAuthenticated:o,shouldWincherTrackAll:i}=e("yoast-seo/editor");return{focusKeyphrase:n(),keyphrases:s(),isLoggedIn:a(),trackAll:i(),websiteId:t(),isNewlyAuthenticated:o(),permalink:r()}})),(0,he.withDispatch)((e=>{const{setWincherNewRequest:t,setWincherRequestSucceeded:s,setWincherRequestFailed:a,setWincherSetKeyphraseLimitReached:r,setWincherTrackedKeyphrases:n,setWincherTrackingForKeyphrase:o,setWincherTrackAllKeyphrases:i,unsetWincherTrackingForKeyphrase:l}=e("yoast-seo/editor");return{newRequest:()=>{t()},setRequestSucceeded:e=>{s(e)},setRequestFailed:e=>{a(e)},setKeyphraseLimitReached:e=>{r(e)},addTrackedKeyphrase:e=>{o(e)},removeTrackedKeyphrase:e=>{l(e)},setTrackedKeyphrases:e=>{n(e)},setHasTrackedAll:()=>{i(!1)}}}))])(ts),as=(0,S.makeOutboundLink)(),rs=(0,S.makeOutboundLink)(),ns=()=>{const e=(0,d.sprintf)((0,d.__)(/* translators: %1$s expands to a link to Wincher, %2$s expands to a link to the keyphrase tracking article on Yoast.com */ "With %1$s you can track the ranking position of your page in the search results based on your keyphrase(s). %2$s","wordpress-seo"),"{{wincherLink/}}","{{wincherReadMoreLink/}}");return(0,v.createElement)("p",null,(0,mt.Z)({mixedString:e,components:{wincherLink:(0,v.createElement)(as,{href:wpseoAdminGlobalL10n["links.wincher.website"]},"Wincher"),wincherReadMoreLink:(0,v.createElement)(rs,{href:wpseoAdminL10n["shortlinks.wincher.seo_performance"]},(0,d.__)("Read more about keyphrase tracking with Wincher","wordpress-seo"))}}))},os=()=>(0,v.createElement)(T.Alert,{type:"error"},(0,d.__)("No keyphrase has been set. Please set a keyphrase first.","wordpress-seo")),is=()=>(0,v.createElement)(T.Alert,{type:"info"},(0,d.sprintf)(/* translators: %s: Expands to "Wincher". */ (0,d.__)("Automatic tracking of keyphrases is enabled. Your keyphrase(s) will automatically be tracked by %s when you publish your post.","wordpress-seo"),"Wincher"));class ls{constructor(e,t={},s={}){this.url=e,this.origin=new URL(e).origin,this.eventHandlers=Object.assign({success:{type:"",callback:()=>{}},error:{type:"",callback:()=>{}}},t),this.options=Object.assign({height:570,width:340,title:""},s),this.popup=null,this.createPopup=this.createPopup.bind(this),this.messageHandler=this.messageHandler.bind(this),this.getPopup=this.getPopup.bind(this)}createPopup(){const{height:e,width:t,title:s}=this.options,a=["top="+(window.top.outerHeight/2+window.top.screenY-e/2),"left="+(window.top.outerWidth/2+window.top.screenX-t/2),"width="+t,"height="+e,"resizable=1","scrollbars=1","status=0"];this.popup&&!this.popup.closed||(this.popup=window.open(this.url,s,a.join(","))),this.popup&&this.popup.focus(),window.addEventListener("message",this.messageHandler,!1)}async messageHandler(e){const{data:t,source:s,origin:a}=e;a===this.origin&&this.popup===s&&(t.type===this.eventHandlers.success.type&&(this.popup.close(),window.removeEventListener("message",this.messageHandler,!1),await this.eventHandlers.success.callback(t)),t.type===this.eventHandlers.error.type&&(this.popup.close(),window.removeEventListener("message",this.messageHandler,!1),await this.eventHandlers.error.callback(t)))}getPopup(){return this.popup}isClosed(){return!this.popup||this.popup.closed}focus(){this.isClosed()||this.popup.focus()}}const cs=e=>{const t=(0,d.sprintf)(/* translators: %s expands to a link to open the Wincher login popup. */ (0,d.__)("It seems like something went wrong when retrieving your website's data. Please %s and try again.","wordpress-seo"),"{{reconnectToWincher/}}","Wincher");return(0,v.createElement)(T.Alert,{type:"error",className:e.className},(0,mt.Z)({mixedString:t,components:{reconnectToWincher:(0,v.createElement)("a",{href:"#",onClick:t=>{t.preventDefault(),e.onReconnect()}},(0,d.sprintf)(/* translators: %s : Expands to "Wincher". */ (0,d.__)("reconnect to %s","wordpress-seo"),"Wincher"))}}))};cs.propTypes={onReconnect:x().func.isRequired,className:x().string},cs.defaultProps={className:""};const us=cs,ds=()=>(0,v.createElement)(T.Alert,{type:"error"},(0,d.__)("Before you can track your SEO performance make sure to set either the post’s title and save it as a draft or manually set the post’s slug.","wordpress-seo")),ps=window.yoast["chart.js"],ms="label";function hs(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function gs(e,t){e.labels=t}function ys(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ms;const a=[];e.datasets=t.map((t=>{const r=e.datasets.find((e=>e[s]===t[s]));return r&&t.data&&!a.includes(r)?(a.push(r),Object.assign(r,t),r):{...t}}))}function fs(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ms;const s={labels:[],datasets:[]};return gs(s,e.labels),ys(s,e.datasets,t),s}function bs(e,t){const{height:s=150,width:a=300,redraw:r=!1,datasetIdKey:n,type:o,data:i,options:l,plugins:c=[],fallbackContent:u,updateMode:d,...p}=e,m=(0,v.useRef)(null),h=(0,v.useRef)(),g=()=>{m.current&&(h.current=new ps.Chart(m.current,{type:o,data:fs(i,n),options:l&&{...l},plugins:c}),hs(t,h.current))},y=()=>{hs(t,null),h.current&&(h.current.destroy(),h.current=null)};return(0,v.useEffect)((()=>{!r&&h.current&&l&&function(e,t){const s=e.options;s&&t&&Object.assign(s,t)}(h.current,l)}),[r,l]),(0,v.useEffect)((()=>{!r&&h.current&&gs(h.current.config.data,i.labels)}),[r,i.labels]),(0,v.useEffect)((()=>{!r&&h.current&&i.datasets&&ys(h.current.config.data,i.datasets,n)}),[r,i.datasets]),(0,v.useEffect)((()=>{h.current&&(r?(y(),setTimeout(g)):h.current.update(d))}),[r,l,i.labels,i.datasets,d]),(0,v.useEffect)((()=>{h.current&&(y(),setTimeout(g))}),[o]),(0,v.useEffect)((()=>(g(),()=>y())),[]),v.createElement("canvas",Object.assign({ref:m,role:"img",height:s,width:a},p),u)}const ws=(0,v.forwardRef)(bs);function vs(e,t){return ps.Chart.register(t),(0,v.forwardRef)(((t,s)=>v.createElement(ws,Object.assign({},t,{ref:s,type:e}))))}const ks=vs("line",ps.LineController),Es={datetime:"MMM D, YYYY, h:mm:ss a",millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm a",hour:"hA",day:"MMM D",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"};ps._adapters._date.override("function"==typeof pt()?{_id:"moment",formats:function(){return Es},parse:function(e,t){return"string"==typeof e&&"string"==typeof t?e=pt()(e,t):e instanceof pt()||(e=pt()(e)),e.isValid()?e.valueOf():null},format:function(e,t){return pt()(e).format(t)},add:function(e,t,s){return pt()(e).add(t,s).valueOf()},diff:function(e,t,s){return pt()(e).diff(pt()(t),s)},startOf:function(e,t,s){return e=pt()(e),"isoWeek"===t?(s=Math.trunc(Math.min(Math.max(0,s),6)),e.isoWeekday(s).startOf("day").valueOf()):e.startOf(t).valueOf()},endOf:function(e,t){return pt()(e).endOf(t).valueOf()}}:{}),Math.PI,Number.POSITIVE_INFINITY,Math.log10,Math.sign,"undefined"==typeof window||window.requestAnimationFrame,new Map,Object.create(null),Object.create(null),Number.EPSILON;const Rs=["top","right","bottom","left"];function _s(e,t,s){const a={};s=s?"-"+s:"";for(let r=0;r<4;r++){const n=Rs[r];a[n]=parseFloat(e[t+"-"+n+s])||0}return a.width=a.left+a.right,a.height=a.top+a.bottom,a}!function(){let e=!1;try{const t={get passive(){return e=!0,!1}};window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}}(),ps.Chart.register(ps.CategoryScale,ps.LineController,ps.LineElement,ps.PointElement,ps.LinearScale,ps.TimeScale,ps.Legend,ps.Tooltip);const xs=["#ff983b","#ffa3f7","#3798ff","#ff3b3b","#acce81","#b51751","#3949ab","#26c6da","#ccb800","#de66ff","#4db6ac","#ffab91","#45f5f1","#77f210","#90a4ae","#ffd54f","#006b5e","#8ec7d2","#b1887c","#cc9300"];function Ts({datasets:e,isChartShown:t,keyphrases:s}){if(!t)return null;const a=(0,k.useMemo)((()=>Object.fromEntries([...s].sort().map(((e,t)=>[e,xs[t%xs.length]])))),[s]),r=e.map((e=>{const t=a[e.label];return{...e,data:e.data.map((({datetime:e,value:t})=>({x:e,y:t}))),lineTension:0,pointRadius:1,pointHoverRadius:4,borderWidth:2,pointHitRadius:6,backgroundColor:t,borderColor:t}})).filter((e=>!1!==e.selected));return(0,v.createElement)(ks,{height:100,data:{datasets:r},options:{plugins:{legend:{display:!0,position:"bottom",labels:{color:"black",usePointStyle:!0,boxHeight:7,boxWidth:7},onClick:c.noop},tooltip:{enabled:!0,callbacks:{title:e=>pt()(e[0].raw.x).utc().format("YYYY-MM-DD")},titleAlign:"center",mode:"xPoint",position:"nearest",usePointStyle:!0,boxHeight:7,boxWidth:7,boxPadding:2}},scales:{x:{bounds:"ticks",type:"time",time:{unit:"day",minUnit:"day"},grid:{display:!1},ticks:{autoSkipPadding:50,maxRotation:0,color:"black"}},y:{bounds:"ticks",offset:!0,reverse:!0,ticks:{precision:0,color:"black"},max:101}}}})}ps.Interaction.modes.xPoint=(e,t,s,a)=>{const r=function(e,t){if("native"in e)return e;const{canvas:s,currentDevicePixelRatio:a}=t,r=(m=s).ownerDocument.defaultView.getComputedStyle(m,null),n="border-box"===r.boxSizing,o=_s(r,"padding"),i=_s(r,"border","width"),{x:l,y:c,box:u}=function(e,t){const s=e.touches,a=s&&s.length?s[0]:e,{offsetX:r,offsetY:n}=a;let o,i,l=!1;if(((e,t,s)=>(e>0||t>0)&&(!s||!s.shadowRoot))(r,n,e.target))o=r,i=n;else{const e=t.getBoundingClientRect();o=a.clientX-e.left,i=a.clientY-e.top,l=!0}return{x:o,y:i,box:l}}(e,s),d=o.left+(u&&i.left),p=o.top+(u&&i.top);var m;let{width:h,height:g}=t;return n&&(h-=o.width+i.width,g-=o.height+i.height),{x:Math.round((l-d)/h*s.width/a),y:Math.round((c-p)/g*s.height/a)}}(t,e);let n=[];if(ps.Interaction.evaluateInteractionItems(e,"x",r,((e,t,s)=>{e.inXRange(r.x,a)&&n.push({element:e,datasetIndex:t,index:s})})),0===n.length)return n;const o=n.reduce(((e,t)=>Math.abs(r.x-e.element.x)<Math.abs(r.x-t.element.x)?e:t)).element.x;return n=n.filter((e=>e.element.x===o)),n.some((e=>Math.abs(e.element.y-r.y)<10))?n:[]},Ts.propTypes={datasets:x().arrayOf(x().shape({label:x().string.isRequired,data:x().arrayOf(x().shape({datetime:x().string.isRequired,value:x().number.isRequired})).isRequired,selected:x().bool})).isRequired,isChartShown:x().bool.isRequired,keyphrases:x().array.isRequired};const Ss=({response:e,onLogin:t})=>[401,403,404].includes(e.status)?(0,v.createElement)(us,{onReconnect:t}):(0,v.createElement)(ft,null);Ss.propTypes={response:x().object.isRequired,onLogin:x().func.isRequired};const Cs=({isSuccess:e,response:t,allKeyphrasesMissRanking:s,onLogin:a,keyphraseLimitReached:r,limit:n})=>r?(0,v.createElement)(yt,{limit:n}):(0,c.isEmpty)(t)||e?s?(0,v.createElement)(Pt,null):null:(0,v.createElement)(Ss,{response:t,onLogin:a});Cs.propTypes={isSuccess:x().bool.isRequired,allKeyphrasesMissRanking:x().bool.isRequired,response:x().object,onLogin:x().func.isRequired,keyphraseLimitReached:x().bool.isRequired,limit:x().number.isRequired},Cs.defaultProps={response:{}};let Is=null;const Ls=async e=>{if(Is&&!Is.isClosed())return void Is.focus();const{url:t}=await async function(){return await wt({path:"yoast/v1/wincher/authorization-url",method:"GET"})}();Is=new ls(t,{success:{type:"wincher:oauth:success",callback:t=>(async(e,t)=>{const{onAuthentication:s,setRequestSucceeded:a,setRequestFailed:r,keyphrases:n,addTrackedKeyphrase:o,setKeyphraseLimitReached:i}=e;await bt((()=>async function(e){const{code:t,websiteId:s}=e;return await wt({path:"yoast/v1/wincher/authenticate",method:"POST",data:{code:t,websiteId:s}})}(t)),(async e=>{s(!0,!0,t.websiteId.toString()),a(e);const l=(Array.isArray(n)?n:[n]).map((e=>e.toLowerCase()));await bt((()=>vt(l)),(e=>{a(e),o(e.results)}),(e=>{400===e.status&&e.limit&&i(e.limit),r(e)}),201);const c=Is.getPopup();c&&c.close()}),(async e=>r(e)))})(e,t)},error:{type:"wincher:oauth:error",callback:()=>e.onAuthentication(!1,!1)}},{title:"Wincher_login",width:500,height:700}),Is.createPopup()},As=e=>e.isLoggedIn?null:(0,v.createElement)("p",null,(0,v.createElement)(T.NewButton,{onClick:e.onLogin,variant:"primary"},(0,d.sprintf)(/* translators: %s expands to Wincher */ (0,d.__)("Connect with %s","wordpress-seo"),"Wincher")));As.propTypes={isLoggedIn:x().bool.isRequired,onLogin:x().func.isRequired};const qs=R().div` p { margin: 1em 0; } `,Ps=R().div` ${e=>e.isDisabled&&"\n\t\topacity: .5;\n\t\tpointer-events: none;\n\t"}; `,Ns=R().div` font-weight: var(--yoast-font-weight-bold); color: var(--yoast-color-label); font-size: var(--yoast-font-size-default); `,Bs=R().div.attrs({className:"yoast-field-group"})` display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; `,Ms=R().div` margin: 8px 0; `,Os=pt().utc().startOf("day"),Fs=[{name:(0,d.__)("Last day","wordpress-seo"),value:pt()(Os).subtract(1,"days").format(),defaultIndex:1},{name:(0,d.__)("Last week","wordpress-seo"),value:pt()(Os).subtract(1,"week").format(),defaultIndex:2},{name:(0,d.__)("Last month","wordpress-seo"),value:pt()(Os).subtract(1,"month").format(),defaultIndex:3},{name:(0,d.__)("Last year","wordpress-seo"),value:pt()(Os).subtract(1,"year").format(),defaultIndex:0}],Ks=e=>{const{onSelect:t,selected:s,options:a,isLoggedIn:r}=e;return r?a.length<1?null:(0,v.createElement)("select",{className:"components-select-control__input",id:"wincher-period-picker",value:(null==s?void 0:s.value)||a[0].value,onChange:t},a.map((e=>(0,v.createElement)("option",{key:e.name,value:e.value},e.name)))):null};Ks.propTypes={onSelect:x().func.isRequired,selected:x().object,options:x().array.isRequired,isLoggedIn:x().bool.isRequired};const Ds=e=>{const{trackedKeyphrases:t,isLoggedIn:s,keyphrases:a,shouldTrackAll:r,permalink:n,historyDaysLimit:o}=e;if(!n&&s)return(0,v.createElement)(ds,null);if(0===a.length)return(0,v.createElement)(os,null);const i=pt()(Os).subtract(o,"days"),l=Fs.filter((e=>pt()(e.value).isSameOrAfter(i))),u=(0,c.orderBy)(l,(e=>e.defaultIndex),"desc")[0],[p,m]=(0,k.useState)(u),[h,g]=(0,k.useState)([]),y=h.length>0,f=(0,me.usePrevious)(t);(0,k.useEffect)((()=>{if(!(0,c.isEmpty)(t)&&(0,c.difference)(Object.keys(t),Object.keys(f||[])).length){const e=Object.values(t).map((e=>e.keyword));g(e)}}),[t,f]),(0,k.useEffect)((()=>{m(u)}),[null==u?void 0:u.name]);const b=(0,k.useCallback)((e=>{const t=Fs.find((t=>t.value===e.target.value));t&&m(t)}),[m]),w=(0,k.useMemo)((()=>(0,c.isEmpty)(h)||(0,c.isEmpty)(t)?[]:Object.values(t).filter((e=>{var t;return!(null==e||null===(t=e.position)||void 0===t||!t.history)})).map((e=>{var t;return{label:e.keyword,data:e.position.history,selected:h.includes(e.keyword)&&!(0,c.isEmpty)(null===(t=e.position)||void 0===t?void 0:t.history)}}))),[h,t]);return(0,v.createElement)(Ps,{isDisabled:!s},(0,v.createElement)("p",null,(0,d.__)("You can enable / disable tracking the SEO performance for each keyphrase below.","wordpress-seo")),s&&r&&(0,v.createElement)(is,null),(0,v.createElement)(Bs,null,(0,v.createElement)(Ks,{selected:p,onSelect:b,options:l,isLoggedIn:s})),(0,v.createElement)(Ms,null,(0,v.createElement)(Ts,{isChartShown:y,datasets:w,keyphrases:a})),(0,v.createElement)(ss,{startAt:null==p?void 0:p.value,selectedKeyphrases:h,onSelectKeyphrases:g,trackedKeyphrases:t}))};function $s(e){const{isNewlyAuthenticated:t,isLoggedIn:s}=e,a=(0,k.useCallback)((()=>{Ls(e)}),[Ls,e]),r=Tt(s);return(0,v.createElement)(qs,null,t&&(0,v.createElement)(qt,null),s&&(0,v.createElement)(At,{trackingInfo:r}),(0,v.createElement)(Ns,null,(0,d.__)("SEO performance","wordpress-seo"),(0,v.createElement)(T.HelpIcon,{linkTo:wpseoAdminL10n["shortlinks.wincher.seo_performance"] /* translators: Hidden accessibility text. */,linkText:(0,d.__)("Learn more about the SEO performance feature.","wordpress-seo")})),(0,v.createElement)(ns,null),(0,v.createElement)(As,{isLoggedIn:s,onLogin:a}),(0,v.createElement)(Cs,{...e,onLogin:a}),(0,v.createElement)(Ds,{...e,historyDaysLimit:(null==r?void 0:r.historyDays)||31}))}Ds.propTypes={trackedKeyphrases:x().object,keyphrases:x().array.isRequired,isLoggedIn:x().bool.isRequired,shouldTrackAll:x().bool.isRequired,permalink:x().string.isRequired,historyDaysLimit:x().number},$s.propTypes={trackedKeyphrases:x().object,addTrackedKeyphrase:x().func.isRequired,isLoggedIn:x().bool,isNewlyAuthenticated:x().bool,keyphrases:x().array,response:x().object,shouldTrackAll:x().bool,permalink:x().string,historyDaysLimit:x().number},$s.defaultProps={trackedKeyphrases:null,isLoggedIn:!1,isNewlyAuthenticated:!1,keyphrases:[],response:{},shouldTrackAll:!1,permalink:"",historyDaysLimit:0};const Hs=(0,me.compose)([(0,he.withSelect)((e=>{const{isWincherNewlyAuthenticated:t,getWincherKeyphraseLimitReached:s,getWincherLimit:a,getWincherHistoryDaysLimit:r,getWincherLoginStatus:n,getWincherRequestIsSuccess:o,getWincherRequestResponse:i,getWincherTrackableKeyphrases:l,getWincherTrackedKeyphrases:c,getWincherAllKeyphrasesMissRanking:u,getWincherPermalink:d,shouldWincherAutomaticallyTrackAll:p}=e("yoast-seo/editor");return{keyphrases:l(),trackedKeyphrases:c(),allKeyphrasesMissRanking:u(),isLoggedIn:n(),isNewlyAuthenticated:t(),isSuccess:o(),keyphraseLimitReached:s(),limit:a(),response:i(),shouldTrackAll:p(),permalink:d(),historyDaysLimit:r()}})),(0,he.withDispatch)((e=>{const{setWincherWebsiteId:t,setWincherRequestSucceeded:s,setWincherRequestFailed:a,setWincherTrackingForKeyphrase:r,setWincherSetKeyphraseLimitReached:n,setWincherLoginStatus:o}=e("yoast-seo/editor");return{setRequestSucceeded:e=>{s(e)},setRequestFailed:e=>{a(e)},addTrackedKeyphrase:e=>{r(e)},setKeyphraseLimitReached:e=>{n(e)},onAuthentication:(e,s,a)=>{t(a),o(e,s)}}}))])($s);function Ws(e,t,s,a){return new Promise(((r,n)=>{jQuery.ajax({type:e,url:t,beforeSend:s?e=>{e.setRequestHeader("X-WP-Nonce",s)}:null,data:a,dataType:"json",success:r,error:n})}))}let js,Ys,zs,Us;const Vs=/<(\/)?(\w+)\s*(\/)?>/g;function Gs(e,t,s,a,r){return{element:e,tokenStart:t,tokenLength:s,prevOffset:a,leadingTextStart:r,children:[]}}function Zs(){const e=js.length-Ys;0!==e&&zs.push(js.substring(Ys,Ys+e))}function Js(e){const{element:t,tokenStart:s,tokenLength:a,prevOffset:r,children:n}=e,o=Us[Us.length-1],i=js.substring(o.prevOffset,s);i&&o.children.push(i),o.children.push((0,k.cloneElement)(t,null,...n)),o.prevOffset=r||s+a}function Qs(e){const t=function(){const e=Vs.exec(js);if(null===e)return["no-more-tokens"];const t=e.index,[s,a,r,n]=e,o=s.length;return n?["self-closed",r,t,o]:a?["closer",r,t,o]:["opener",r,t,o]}(),[s,a,r,n]=t,o=Us.length,i=r>Ys?Ys:null;if(!e[a])return Zs(),!1;switch(s){case"no-more-tokens":if(0!==o){const{leadingTextStart:e,tokenStart:t}=Us.pop();zs.push(js.substring(e,e+t))}return Zs(),!1;case"self-closed":return 0===o?(null!==i&&zs.push(js.substring(i,r)),zs.push(e[a]),Ys=r+n,!0):(Js(Gs(e[a],r,n)),Ys=r+n,!0);case"opener":return Us.push(Gs(e[a],r,n,r+n,i)),Ys=r+n,!0;case"closer":if(1===o)return function(e){const{element:t,leadingTextStart:s,prevOffset:a,tokenStart:r,children:n}=Us.pop(),o=e?js.substring(a,e):js.substring(a);o&&n.push(o),null!==s&&zs.push(js.substring(s,r)),zs.push((0,k.cloneElement)(t,null,...n))}(r),Ys=r+n,!0;const t=Us.pop(),s=js.substring(t.prevOffset,r);t.children.push(s),t.prevOffset=r+n;const l=Gs(t.element,t.tokenStart,t.tokenLength,r+n);return l.children=t.children,Js(l),Ys=r+n,!0;default:return Zs(),!1}}function Xs(e,t="wpseoYoastJSL10n"){const s=(0,c.get)(window,[t,e,"locale_data",e],!1);"yoast-components"===e&&(e="wordpress-seo"),!1===s?(0,d.setLocaleData)({"":{}},e):(0,d.setLocaleData)(s,e)}const ea=window.wp.sanitize,ta="SNIPPET_EDITOR_UPDATE_REPLACEMENT_VARIABLE",sa="SNIPPET_EDITOR_UPDATE_REPLACEMENT_VARIABLES_BATCH";function aa(e,t,s="",a=!1){const r="string"==typeof t?(0,S.decodeHTML)(t):t;return{type:ta,name:e,value:r,label:s,hidden:a}}function ra(e){return e.charAt(0).toUpperCase()+e.slice(1)}const{stripHTMLTags:na}=S.strings,oa=["slug","content","contentImage","snippetPreviewImageURL"];function ia(e,t){(0,c.forEach)(e,((e,s)=>{oa.includes(s)||t.dispatch(aa(s,e))}))}function la(e){if(!["ct_","cf_","pt_"].includes(e.substring(0,3)))return e.replace(/_/g," ");const t=e.slice(0,3);switch(-1!==(e=e.slice(3)).indexOf("desc_")&&(e=e.slice(5)+" description"),t){case"ct_":e+=" (custom taxonomy)";break;case"cf_":e+=" (custom field)";break;case"pt_":e="Post type ("+(e=e.replace("single","singular"))+")"}return e}function ca(e){return ra(e=la(e))}function ua(e,t){return e.push({name:t.name,label:t.label||ca(t.name),value:t.value}),e}function da(e,t="_"){return e.replace(/\s/g,t)}function pa(e){return{name:"cf_"+da(e),label:ra(e+" (custom field)")}}function ma(e){const t=da(e);return{name:"ct_"+t,label:ra(e+" (custom taxonomy)"),descriptionName:"ct_desc_"+t,descriptionLabel:ra(e+" description (custom taxonomy)")}}function ha(e,t){if(!e.custom_taxonomies)return e;const s={};return(0,c.forEach)(e.custom_taxonomies,((e,t)=>{const{name:a,label:r,descriptionName:n,descriptionLabel:o}=ma(t),i="string"==typeof e.name?(0,S.decodeHTML)(e.name):e.name,l="string"==typeof e.description?(0,S.decodeHTML)(e.description):e.description;s[a]={value:i,label:r},s[n]={value:l,label:o}})),t.dispatch(function(e){return{type:sa,updatedVariables:e}}(s)),(0,c.omit)({...e},"custom_taxonomies")}function ga(e,t){return e.custom_fields?((0,c.forEach)(e.custom_fields,((e,s)=>{const{name:a,label:r}=pa(s);t.dispatch(aa(a,e,r))})),(0,c.omit)({...e},"custom_fields")):e}function ya(e,t=156){return(e=(e=(0,ea.stripTags)(e)).trim()).length<=t||(e=e.substring(0,t),/\s/.test(e)&&(e=e.substring(0,e.lastIndexOf(" ")))),e}const fa=function(e){const t=(0,c.get)(window,["YoastSEO","app","pluggable"],!1);if(!t||!(0,c.get)(window,["YoastSEO","app","pluggable","loaded"],!1))return function(e){const t=(0,c.get)(window,["YoastSEO","wp","replaceVarsPlugin","replaceVariables"],c.identity);return{url:e.url,title:na(t(e.title)),description:na(t(e.description)),filteredSEOTitle:e.filteredSEOTitle?na(t(e.filteredSEOTitle)):""}}(e);const s=t._applyModifications.bind(t);return{url:e.url,title:na(s("data_page_title",e.title)),description:na(s("data_meta_desc",e.description)),filteredSEOTitle:e.filteredSEOTitle?na(s("data_page_title",e.filteredSEOTitle)):""}};var ba="score-text",wa="image yoast-logo svg",va=jQuery;function ka(e,t,s=null){var a,r,n,o,i;if(null!==s)return(0,c.get)(s,t,"");const l=(0,he.select)("yoast-seo/editor").getIsPremium(),u={na:(0,d.__)("Not available","wordpress-seo"),bad:(0,d.__)("Needs improvement","wordpress-seo"),ok:(0,d.__)("OK","wordpress-seo"),good:(0,d.__)("Good","wordpress-seo")},p={keyword:{label:l?(0,d.__)("Premium SEO analysis:","wordpress-seo"):(0,d.__)("SEO analysis:","wordpress-seo"),anchor:"yoast-seo-analysis-collapsible-metabox",status:u},content:{label:(0,d.__)("Readability analysis:","wordpress-seo"),anchor:"yoast-readability-analysis-collapsible-metabox",status:u},"inclusive-language":{label:(0,d.__)("Inclusive language:","wordpress-seo"),anchor:"yoast-inclusive-language-analysis-collapsible-metabox",status:{...u,ok:(0,d.__)("Potentially non-inclusive","wordpress-seo")}}};return null!=p&&null!==(a=p[e])&&void 0!==a&&null!==(r=a.status)&&void 0!==r&&r[t]?`<a href="#${null===(n=p[e])||void 0===n?void 0:n.anchor}">${null===(o=p[e])||void 0===o?void 0:o.label}</a> <strong>${null===(i=p[e])||void 0===i?void 0:i.status[t]}</strong>`:""}window.yoast=window.yoast||{},window.yoast.editorModules={analysis:{getL10nObject:u,getContentLocale:function(){const e=u();return(0,c.get)(e,"contentLocale","en_US")},getIndicatorForScore:function(e){return(0,c.isNil)(e)||(e/=10),function(e){switch(e){case"feedback":return{className:"na",screenReaderText:(0,d.__)("Not available","wordpress-seo"),screenReaderReadabilityText:(0,d.__)("Not available","wordpress-seo"),screenReaderInclusiveLanguageText:(0,d.__)("Not available","wordpress-seo")};case"bad":return{className:"bad",screenReaderText:(0,d.__)("Needs improvement","wordpress-seo"),screenReaderReadabilityText:(0,d.__)("Needs improvement","wordpress-seo"),screenReaderInclusiveLanguageText:(0,d.__)("Needs improvement","wordpress-seo")};case"ok":return{className:"ok",screenReaderText:(0,d.__)("OK SEO score","wordpress-seo"),screenReaderReadabilityText:(0,d.__)("OK","wordpress-seo"),screenReaderInclusiveLanguageText:(0,d.__)("Potentially non-inclusive","wordpress-seo")};case"good":return{className:"good",screenReaderText:(0,d.__)("Good SEO score","wordpress-seo"),screenReaderReadabilityText:(0,d.__)("Good","wordpress-seo"),screenReaderInclusiveLanguageText:(0,d.__)("Good","wordpress-seo")};default:return{className:"loading",screenReaderText:"",screenReaderReadabilityText:"",screenReaderInclusiveLanguageText:""}}}(p.interpreters.scoreToRating(e))},constants:e,refreshAnalysis:t},components:{HelpLink:V,TopLevelProviders:pe,higherorder:{withYoastSidebarPriority:e=>{const t=t=>{const{renderPriority:s,...a}=t;return(0,v.createElement)(e,{...a})};return t.propTypes={renderPriority:x().number},t}},contentAnalysis:{KeywordInput:W,mapResults:a},contexts:{location:{LocationContext:i.LocationContext,LocationProvider:i.LocationProvider,LocationConsumer:i.LocationConsumer}},SidebarItem:ue,SidebarCollapsible:le,MetaboxCollapsible:e=>(0,v.createElement)(G,{hasPadding:!0,hasSeparator:!0,...e}),Modal:X,portals:{Portal:ae,ImageSelectPortal:re,ScoreIconPortal:oe}},containers:{EditorModal:we,PersistentDismissableAlert:ve,Results:He,SEMrushRelatedKeyphrases:ut,WincherSEOPerformance:Hs},helpers:{ajaxHelper:r,createInterpolateElement:(e,t)=>{if(js=e,Ys=0,zs=[],Us=[],Vs.lastIndex=0,!(e=>{const t="object"==typeof e,s=t&&Object.values(e);return t&&s.length&&s.every((e=>(0,k.isValidElement)(e)))})(t))throw new TypeError("The conversionMap provided is not valid. It must be an object with values that are WPElements");do{}while(Qs(t));return(0,k.createElement)(k.Fragment,null,...zs)},createWatcher:(e,t)=>{let s=e();return()=>{const a=e();(0,c.isEqual)(a,s)||(s=a,t((0,c.clone)(a)))}},isBlockEditor:function(){return window.wpseoScriptData&&"1"===window.wpseoScriptData.isBlockEditor},i18n:n,replacementVariableHelpers:o,publishBox:{updateScore:function(e,t,s=null){var a=va("#"+e+"-score"),r=wa+" "+t;a.children(".image").attr("class",r);var n=ka(e,t,s);a.children("."+ba).html(n)},createScoresInPublishBox:function(e,t,s=null){const a=va("<div />",{class:"misc-pub-section yoast yoast-seo-score "+e+"-score",id:e+"-score"}),r=va("<span />",{class:ba,html:ka(e,t,s)}),n=va("<span>").attr("class",wa+" na");a.append(n).append(r),va("#yoast-seo-publishbox-section").append(a)},scrollToCollapsible:function(e){const t=va("#wpadminbar"),s=va(e);if(!t||!s)return;const a="fixed"===t.css("position")?t.height():0;va([document.documentElement,document.body]).animate({scrollTop:s.offset().top-a},1e3),s.trigger("focus"),0===s.parent().siblings().length&&s.trigger("click")}},updateAdminBar:function(e){jQuery("#wp-admin-bar-wpseo-menu .wpseo-score-icon").attr("title",e.screenReaderText).attr("class","wpseo-score-icon "+e.className).find(".wpseo-score-text").text(e.screenReaderText)},updateTrafficLight:function(e){var t=jQuery(".yst-traffic-light"),s=t.closest(".wpseo-meta-section-link"),a=jQuery("#wpseo-traffic-light-desc"),r=e.className||"na";t.attr("class","yst-traffic-light "+r),s.attr("aria-describedby","wpseo-traffic-light-desc"),a.length>0?a.text(e.screenReaderText):s.closest("li").append("<span id='wpseo-traffic-light-desc' class='screen-reader-text'>"+e.screenReaderText+"</span>")}}}})()})();
Save Changes
Rename File
Rename