diff --git a/Build/resources/javascript/Components/ReadingTime.js b/Build/resources/javascript/Components/ReadingTime.js new file mode 100644 index 0000000..24105ce --- /dev/null +++ b/Build/resources/javascript/Components/ReadingTime.js @@ -0,0 +1,27 @@ +import React from 'react'; +import {connect} from 'react-redux'; +import LoadingIndicator from './LoadingIndicator'; +import { __, _n } from "@wordpress/i18n"; +import { InsightsCard } from "@yoast/components"; + +const ReadingTime = ({readingTime}) => { + if (readingTime) { + const estimatedReadingTime = readingTime.result; + return + } + return +} + +const mapStateToProps = (state) => { + return { + ...state.readingTime + } +} + +export default connect(mapStateToProps)(ReadingTime); diff --git a/Build/resources/javascript/Components/WordCount.js b/Build/resources/javascript/Components/WordCount.js new file mode 100644 index 0000000..711efbc --- /dev/null +++ b/Build/resources/javascript/Components/WordCount.js @@ -0,0 +1,35 @@ +import React from 'react'; +import {connect} from 'react-redux'; +import LoadingIndicator from './LoadingIndicator'; +import { __, _n } from "@wordpress/i18n"; +import { InsightsCard } from "@yoast/components"; + +const WordCount = ({wordCount}) => { + if (wordCount) { + let unitString = _n( "word", "words", wordCount.result.count, "wordpress-seo" ); + let titleString = __( "Word count", "wordpress-seo" ); + let linkText = __( "Learn more about word count", "wordpress-seo" ); + if ( wordCount.result.unit === "character" ) { + unitString = _n( "character", "characters", wordCount.result.count, "wordpress-seo" ); + titleString = __( "Character count", "wordpress-seo" ); + linkText = __( "Learn more about character count", "wordpress-seo" ); + } + + return + } + return +} + +const mapStateToProps = (state) => { + return { + ...state.wordCount + } +} + +export default connect(mapStateToProps)(WordCount); diff --git a/Build/resources/javascript/analysis/refreshAnalysis.js b/Build/resources/javascript/analysis/refreshAnalysis.js index 6214413..ed5a1e9 100644 --- a/Build/resources/javascript/analysis/refreshAnalysis.js +++ b/Build/resources/javascript/analysis/refreshAnalysis.js @@ -4,6 +4,8 @@ import {analyzeData} from '../redux/actions/analysis'; import {getRelevantWords} from '../redux/actions/relevantWords'; import {getInsights} from "../redux/actions/insights"; import {getFleschReadingScore} from "../redux/actions/flesch"; +import {getReadingTime} from "../redux/actions/readingTime"; +import {getWordCount} from "../redux/actions/wordCount"; export default function refreshAnalysis(worker, store) { const state = store.getState(); @@ -23,5 +25,7 @@ export default function refreshAnalysis(worker, store) { store.dispatch(getRelevantWords(worker, paper)), store.dispatch(getInsights(worker, paper)), store.dispatch(getFleschReadingScore(worker, paper)), + store.dispatch(getReadingTime(worker, paper)), + store.dispatch(getWordCount(worker, paper)), ]); } diff --git a/Build/resources/javascript/plugin.js b/Build/resources/javascript/plugin.js index 21b6ebc..bfe220c 100644 --- a/Build/resources/javascript/plugin.js +++ b/Build/resources/javascript/plugin.js @@ -22,6 +22,8 @@ import {setFocusKeywordSynonyms} from "./redux/actions/focusKeywordSynonyms"; import {setLocaleData} from "@wordpress/i18n"; import {Paper} from "yoastseo"; import {getLinkingSuggestions} from "./redux/actions/linkingSuggestions"; +import ReadingTime from "./Components/ReadingTime"; +import WordCount from "./Components/WordCount"; let YoastTypo3 = { _yoastWorker: null, @@ -228,6 +230,16 @@ let YoastPlugin = { const fleschRoot = createRoot(container); fleschRoot.render(); }); + + document.querySelectorAll('[data-yoast-readingtime]').forEach(container => { + const readingTimeRoot = createRoot(container); + readingTimeRoot.render(); + }); + + document.querySelectorAll('[data-yoast-wordcount]').forEach(container => { + const wordCountRoot = createRoot(container); + wordCountRoot.render(); + }); }, initCornerstone: () => { diff --git a/Build/resources/javascript/redux/actions/index.js b/Build/resources/javascript/redux/actions/index.js index 012c47e..87e6d23 100644 --- a/Build/resources/javascript/redux/actions/index.js +++ b/Build/resources/javascript/redux/actions/index.js @@ -6,6 +6,8 @@ import {getRelevantWords} from "./relevantWords"; import {getInsights} from "./insights"; import {getFleschReadingScore} from "./flesch"; import {getLinkingSuggestions} from "./linkingSuggestions"; +import {getReadingTime} from "./readingTime"; +import {getWordCount} from "./wordCount"; export default { getContent, @@ -15,5 +17,7 @@ export default { getRelevantWords, getInsights, getFleschReadingScore, + getReadingTime, + getWordCount, getLinkingSuggestions }; diff --git a/Build/resources/javascript/redux/actions/readingTime.js b/Build/resources/javascript/redux/actions/readingTime.js new file mode 100644 index 0000000..efabeb0 --- /dev/null +++ b/Build/resources/javascript/redux/actions/readingTime.js @@ -0,0 +1,17 @@ +export const GET_READINGTIME_REQUEST = 'GET_READINGTIME_REQUEST'; +export const GET_READINGTIME_SUCCESS = 'GET_READINGTIME_SUCCESS'; + +export function getReadingTime(worker, paper) { + return dispatch => { + dispatch({type: GET_READINGTIME_REQUEST}); + + return worker + .runResearch('readingTime', paper) + .then((results) => { + dispatch({type: GET_READINGTIME_SUCCESS, payload: results}); + }).catch((error) => { + console.error('An error occured while analyzing the text:'); + console.error(error); + }); + }; +} diff --git a/Build/resources/javascript/redux/actions/wordCount.js b/Build/resources/javascript/redux/actions/wordCount.js new file mode 100644 index 0000000..195fc83 --- /dev/null +++ b/Build/resources/javascript/redux/actions/wordCount.js @@ -0,0 +1,17 @@ +export const GET_WORDCOUNT_REQUEST = 'GET_WORDCOUNT_REQUEST'; +export const GET_WORDCOUNT_SUCCESS = 'GET_WORDCOUNT_SUCCESS'; + +export function getWordCount(worker, paper) { + return dispatch => { + dispatch({type: GET_WORDCOUNT_REQUEST}); + + return worker + .runResearch('wordCountInText', paper) + .then((results) => { + dispatch({type: GET_WORDCOUNT_SUCCESS, payload: results}); + }).catch((error) => { + console.error('An error occured while analyzing the text:'); + console.error(error); + }); + }; +} diff --git a/Build/resources/javascript/redux/reducers/flesch.js b/Build/resources/javascript/redux/reducers/flesch.js index 1f3bff9..f52750c 100644 --- a/Build/resources/javascript/redux/reducers/flesch.js +++ b/Build/resources/javascript/redux/reducers/flesch.js @@ -1,8 +1,7 @@ import {GET_FLESCH_REQUEST, GET_FLESCH_SUCCESS} from '../actions/flesch'; const initialState = { - isCheckingFlesch: false, - words: [] + isCheckingFlesch: false }; function fleschReducer (state = initialState, action) { diff --git a/Build/resources/javascript/redux/reducers/index.js b/Build/resources/javascript/redux/reducers/index.js index 51c4b59..aeaca70 100644 --- a/Build/resources/javascript/redux/reducers/index.js +++ b/Build/resources/javascript/redux/reducers/index.js @@ -5,6 +5,8 @@ import analysis from './analysis'; import relevantWords from './relevantWords'; import insights from "./insights"; import flesch from "./flesch"; +import readingTime from "./readingTime"; +import wordCount from "./wordCount"; import linkingSuggestions from "./linkingSuggestions"; export default { content, @@ -14,5 +16,7 @@ export default { relevantWords, insights, flesch, + readingTime, + wordCount, linkingSuggestions } diff --git a/Build/resources/javascript/redux/reducers/insights.js b/Build/resources/javascript/redux/reducers/insights.js index 5c8d794..77314ff 100644 --- a/Build/resources/javascript/redux/reducers/insights.js +++ b/Build/resources/javascript/redux/reducers/insights.js @@ -1,8 +1,7 @@ import {GET_INSIGHTS_REQUEST, GET_INSIGHTS_SUCCESS} from '../actions/insights'; const initialState = { - isCheckingInsights: false, - words: [] + isCheckingInsights: false }; function insightsReducer (state = initialState, action) { diff --git a/Build/resources/javascript/redux/reducers/readingTime.js b/Build/resources/javascript/redux/reducers/readingTime.js new file mode 100644 index 0000000..2a5e771 --- /dev/null +++ b/Build/resources/javascript/redux/reducers/readingTime.js @@ -0,0 +1,18 @@ +import {GET_READINGTIME_REQUEST, GET_READINGTIME_SUCCESS} from '../actions/readingTime'; + +const initialState = { + isCheckingReadingTime: false +}; + +function readingTimeReducer (state = initialState, action) { + switch(action.type) { + case GET_READINGTIME_REQUEST: + return {...state, isCheckingReadingTime: true}; + case GET_READINGTIME_SUCCESS: + return {...state, isCheckingReadingTime: false, readingTime: action.payload}; + default: + return state; + } +} + +export default readingTimeReducer; diff --git a/Build/resources/javascript/redux/reducers/wordCount.js b/Build/resources/javascript/redux/reducers/wordCount.js new file mode 100644 index 0000000..b32237f --- /dev/null +++ b/Build/resources/javascript/redux/reducers/wordCount.js @@ -0,0 +1,18 @@ +import {GET_WORDCOUNT_REQUEST, GET_WORDCOUNT_SUCCESS} from '../actions/wordCount'; + +const initialState = { + isCheckingWordCount: false +}; + +function wordCountReducer (state = initialState, action) { + switch(action.type) { + case GET_WORDCOUNT_REQUEST: + return {...state, isCheckingWordCount: true}; + case GET_WORDCOUNT_SUCCESS: + return {...state, isCheckingWordCount: false, wordCount: action.payload}; + default: + return state; + } +} + +export default wordCountReducer; diff --git a/Build/resources/sass/yoast.scss b/Build/resources/sass/yoast.scss index 0958da2..1bd1a5e 100644 --- a/Build/resources/sass/yoast.scss +++ b/Build/resources/sass/yoast.scss @@ -225,6 +225,12 @@ div.yoast-analysis { z-index: -1; } + .yoast-insights-row { + display: flex; + gap: 40px; + padding-top: 15px; + } + .yoast-insights-card { &__content { padding-top: 5px; diff --git a/CHANGELOG.md b/CHANGELOG.md index 100a60b..656dce9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ We will follow [Semantic Versioning](http://semver.org/). ### Breaking - Replaced the `urlToCheck` with a new `ModifyPreviewUrl` event +### Added +- Added "Flesh reading score" to the Insights +- Added "Reading time" to the Insights +- Added "Word count" to the Insights + ### Changed - Updated all the underlying Yoast libraries to the latest version - Added custom combine-reducers package to replace the existing one with CSP issues diff --git a/Resources/Private/Templates/TCA/Insights.html b/Resources/Private/Templates/TCA/Insights.html index d651b1c..b4a1686 100644 --- a/Resources/Private/Templates/TCA/Insights.html +++ b/Resources/Private/Templates/TCA/Insights.html @@ -1,8 +1,12 @@
-
-
-
+
+
+
+
+
+
+
diff --git a/Resources/Public/CSS/yoast.min.css b/Resources/Public/CSS/yoast.min.css index db48678..016920c 100644 --- a/Resources/Public/CSS/yoast.min.css +++ b/Resources/Public/CSS/yoast.min.css @@ -1 +1 @@ -.yoast-seo{background-color:var(--module-bg,#fff);padding:15px}#yoast-snippet-preview-container{background-color:var(--module-bg,#fff)!important}#yoast-snippet-preview-container div:first-child>div:first-child,#yoast-snippet-preview-container div:nth-child(2)>div{color:var(--module-color,#000)!important}.yoast-seo-snippet-header{background-color:var(--module-docheader-bg,#eee);border-radius:5px;color:var(--module-color,#000);padding:5px}.yoast-seo-snippet-header-premium{float:right}.yoast-seo-snippet-header-premium a{margin-left:5px;text-decoration:underline}.yoast-seo-snippet-header-premium a i{color:#a4286a;margin-right:5px}.yoast-seo-score-bar{margin-bottom:15px}.yoast-seo-score-bar--analysis{margin-right:20px}.yoast-seo-score-bar--analysis.yoast-seo-page{cursor:pointer}.yoast-seo-score-bar--analysis svg{vertical-align:middle}.yoast-seo-snippet-error{color:#dc3232;padding:10px;text-align:center}.yoast-seo-snippet-error a{color:#dc3232;text-decoration:underline}.spinner{margin:50px auto;text-align:center;width:70px}.spinner>div{animation:sk-bouncedelay 1.4s ease-in-out infinite both;background-color:#ccc;border-radius:100%;display:inline-block;height:18px;width:18px}.spinner .bounce1{animation-delay:-.32s}.spinner .bounce2{animation-delay:-.16s}@keyframes sk-bouncedelay{0%,80%,to{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.yoast-seo-snippet-preview{border:1px solid #ccc;padding:15px}.yoast-seo-snippet-preview-styling{min-height:235px}.yoast-seo-snippet-preview-styling fieldset legend{border-bottom:0!important;font-size:12px!important}.yoast-seo-snippet-preview-styling fieldset label{font-size:12px!important;font-weight:400}div.yoast-analysis button{background-color:inherit!important;font-size:12px!important}div.yoast-analysis button:disabled{display:none}div.yoast-analysis div:not(.bounce){background-color:inherit!important}div.yoast-analysis a{text-decoration:underline}.yoastSeo-insights a{font-weight:700}.yoastSeo-insights a:hover{text-decoration:underline}.yoastSeo-insights .yoast-field-group__title{font-weight:600}.yoastSeo-insights .yoast-help{margin-left:5px}.yoastSeo-insights .yoast-help__icon svg{fill:#707070;height:12px;transition:all .15s ease-out;width:12px}.yoastSeo-insights .yoast-help:focus svg,.yoastSeo-insights .yoast-help:hover svg{fill:#000}.yoastSeo-insights .screen-reader-text{height:1px;left:-10000px;overflow:hidden;position:absolute;top:auto;width:1px}.yoastSeo-insights .yoast-data-model{list-style:none;padding:3px 0 0;width:300px}.yoastSeo-insights .yoast-data-model li{font-weight:600;line-height:1.8;padding:0 8px;position:relative;z-index:2}.yoastSeo-insights .yoast-data-model span{float:right;font-weight:400}.yoastSeo-insights .yoast-data-model li+li{margin-top:9px}.yoastSeo-insights .yoast-data-model li:after{background:var(--typo3-surface-container-info,#d5eef6);content:"";height:20px;left:0;position:absolute;width:var(--yoast-width);z-index:-1}.yoastSeo-insights .yoast-insights-card__content{display:flex;padding-top:5px}.yoastSeo-insights .yoast-insights-card__score{flex-shrink:0;margin-right:2em}.yoastSeo-insights .yoast-insights-card__amount{display:block;font-size:3.5em;line-height:1}.yoastSeo-insights .yoast-insights-card__description{max-width:600px} +.yoast-seo{background-color:var(--module-bg,#fff);padding:15px}#yoast-snippet-preview-container{background-color:var(--module-bg,#fff)!important}#yoast-snippet-preview-container div:first-child>div:first-child,#yoast-snippet-preview-container div:nth-child(2)>div{color:var(--module-color,#000)!important}.yoast-seo-snippet-header{background-color:var(--module-docheader-bg,#eee);border-radius:5px;color:var(--module-color,#000);padding:5px}.yoast-seo-snippet-header-premium{float:right}.yoast-seo-snippet-header-premium a{margin-left:5px;text-decoration:underline}.yoast-seo-snippet-header-premium a i{color:#a4286a;margin-right:5px}.yoast-seo-score-bar{margin-bottom:15px}.yoast-seo-score-bar--analysis{margin-right:20px}.yoast-seo-score-bar--analysis.yoast-seo-page{cursor:pointer}.yoast-seo-score-bar--analysis svg{vertical-align:middle}.yoast-seo-snippet-error{color:#dc3232;padding:10px;text-align:center}.yoast-seo-snippet-error a{color:#dc3232;text-decoration:underline}.spinner{margin:50px auto;text-align:center;width:70px}.spinner>div{animation:sk-bouncedelay 1.4s ease-in-out infinite both;background-color:#ccc;border-radius:100%;display:inline-block;height:18px;width:18px}.spinner .bounce1{animation-delay:-.32s}.spinner .bounce2{animation-delay:-.16s}@keyframes sk-bouncedelay{0%,80%,to{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.yoast-seo-snippet-preview{border:1px solid #ccc;padding:15px}.yoast-seo-snippet-preview-styling{min-height:235px}.yoast-seo-snippet-preview-styling fieldset legend{border-bottom:0!important;font-size:12px!important}.yoast-seo-snippet-preview-styling fieldset label{font-size:12px!important;font-weight:400}div.yoast-analysis button{background-color:inherit!important;font-size:12px!important}div.yoast-analysis button:disabled{display:none}div.yoast-analysis div:not(.bounce){background-color:inherit!important}div.yoast-analysis a{text-decoration:underline}.yoastSeo-insights a{font-weight:700}.yoastSeo-insights a:hover{text-decoration:underline}.yoastSeo-insights .yoast-field-group__title{font-weight:600}.yoastSeo-insights .yoast-help{margin-left:5px}.yoastSeo-insights .yoast-help__icon svg{fill:#707070;height:12px;transition:all .15s ease-out;width:12px}.yoastSeo-insights .yoast-help:focus svg,.yoastSeo-insights .yoast-help:hover svg{fill:#000}.yoastSeo-insights .screen-reader-text{height:1px;left:-10000px;overflow:hidden;position:absolute;top:auto;width:1px}.yoastSeo-insights .yoast-data-model{list-style:none;padding:3px 0 0;width:300px}.yoastSeo-insights .yoast-data-model li{font-weight:600;line-height:1.8;padding:0 8px;position:relative;z-index:2}.yoastSeo-insights .yoast-data-model span{float:right;font-weight:400}.yoastSeo-insights .yoast-data-model li+li{margin-top:9px}.yoastSeo-insights .yoast-data-model li:after{background:var(--typo3-surface-container-info,#d5eef6);content:"";height:20px;left:0;position:absolute;width:var(--yoast-width);z-index:-1}.yoastSeo-insights .yoast-insights-row{display:flex;gap:40px;padding-top:10px}.yoastSeo-insights .yoast-insights-card__content{display:flex;padding-top:5px}.yoastSeo-insights .yoast-insights-card__score{flex-shrink:0;margin-right:2em}.yoastSeo-insights .yoast-insights-card__amount{display:block;font-size:3.5em;line-height:1}.yoastSeo-insights .yoast-insights-card__description{max-width:600px} diff --git a/Resources/Public/JavaScript/dist/plugin.js b/Resources/Public/JavaScript/dist/plugin.js index e9de456..58d6441 100644 --- a/Resources/Public/JavaScript/dist/plugin.js +++ b/Resources/Public/JavaScript/dist/plugin.js @@ -3378,4 +3378,4 @@ i=(0,ee.__)("Your site language is set to %s. If this is not correct, contact yo padding: 8px 0; color: ${fn.$color_blue} } -`;class pc extends e.Component{renderCollapsible(t,n,r){return(0,e.createElement)(uc,{initialIsOpen:!0,title:`${t} (${r.length})`,prefixIcon:{icon:"angle-up",color:fn.$color_grey_dark,size:"18px"},prefixIconCollapsed:{icon:"angle-down",color:fn.$color_grey_dark,size:"18px"},suffixIcon:null,suffixIconCollapsed:null,headingProps:{level:n,fontSize:"13px",fontWeight:"bold"}},(0,e.createElement)(cc,{results:r,marksButtonActivatedResult:this.props.activeMarker,marksButtonStatus:this.props.marksButtonStatus,marksButtonClassName:this.props.marksButtonClassName,onMarksButtonClick:this.props.onMarkButtonClick}))}render(){const{problemsResults:t,improvementsResults:n,goodResults:r,considerationsResults:o,errorsResults:i,headingLevel:a}=this.props,s=i.length,c=t.length,l=n.length,u=o.length,p=r.length;return(0,e.createElement)(lc,null,s>0&&this.renderCollapsible((0,ee.__)("Errors","yoast-components"),a,i),c>0&&this.renderCollapsible((0,ee.__)("Problems","yoast-components"),a,t),l>0&&this.renderCollapsible((0,ee.__)("Improvements","yoast-components"),a,n),u>0&&this.renderCollapsible((0,ee.__)("Considerations","yoast-components"),a,o),p>0&&this.renderCollapsible((0,ee.__)("Good results","yoast-components"),a,r))}}pc.propTypes={onMarkButtonClick:a().func,problemsResults:a().array,improvementsResults:a().array,goodResults:a().array,considerationsResults:a().array,errorsResults:a().array,headingLevel:a().number,marksButtonStatus:a().string,marksButtonClassName:a().string,activeMarker:a().string},pc.defaultProps={onMarkButtonClick:()=>{},problemsResults:[],improvementsResults:[],goodResults:[],considerationsResults:[],errorsResults:[],headingLevel:4,marksButtonStatus:"enabled",marksButtonClassName:"",activeMarker:""};const dc=pc;var fc=o(37091);const bc=JSON.parse('{"s6":"#dc3232","vb":"#ee7c1b","Yy":"#7ad03a","ct":"#008a00","Wh":"#dc3232","nk":"#64a60a","t_":"#a0a5aa"}'),{scoreToRating:hc}=fc.interpreters;function Mc(e,t=""){const n=e.getIdentifier(),r={score:e.score,rating:hc(e.score),hasMarks:e.hasMarks(),marker:e.getMarker(),id:n,text:e.text,markerId:t.length>0?`${t}:${n}`:n};return"ok"===r.rating&&(r.rating="OK"),r}function mc(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 gc(e){let t="";switch(e){case"readability":t=(0,ee.__)("Readability analysis:","wordpress-seo");break;case"seo":t=(0,ee.__)("SEO analysis:","wordpress-seo")}return t}const zc=(e,t,n)=>void 0!==n?e.result[t][n]:e.result[t],Oc=I((e=>({content:e.content,analysis:e.analysis,keyword:e.focusKeyword})))((({content:t,analysis:n,keyword:r,resultType:o,resultSubtype:i})=>{const[a,s]=(0,e.useState)({currentAnalysis:!1,mappedResults:{}});if((0,e.useEffect)((()=>{if(null!==n.result[o]){let e=function(e,t=""){let n={errorsResults:[],problemsResults:[],improvementsResults:[],goodResults:[],considerationsResults:[]};if(!e)return n;for(let r=0;r({content:e.content,analysis:e.analysis})))((({content:t,analysis:n,resultType:r,resultSubtype:o,text:i})=>{const{scoreToRating:a}=fc.interpreters;if(!1===t.isFetching&&!1===n.isAnalyzing&&zc(n,r,o)){let t=zc(n,r,o).score/10,s=function(e){let t={icon:"seo-score-none",color:bc.t_};switch(e){case"loading":t={icon:"loading-spinner",color:bc.nk};break;case"good":t={icon:"seo-score-good",color:bc.ct};break;case"ok":t={icon:"seo-score-ok",color:bc.vb};break;case"bad":t={icon:"seo-score-bad",color:bc.Wh}}return t}(a(t));return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Ac.SvgIcon,{icon:s.icon,color:s.color})," ","true"===i?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:`score-label-${r}`},gc(r))," ",(0,e.createElement)("span",null,function(e){let t="-";switch(e){case"good":t=(0,ee.__)("Good","wordpress-seo");break;case"ok":t=(0,ee.__)("OK","wordpress-seo");break;case"bad":t=(0,ee.__)("Needs improvement","wordpress-seo")}return t}(a(t)))):"")}return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Ac.SvgIcon,{icon:"circle",color:"#bebebe"})," ","true"===i?(0,e.createElement)("span",{className:`score-label-${r}`},gc(r)):"")}));function yc(e){return e>=7?bc.Yy:e>=5?bc.vb:bc.s6}const _c="yoast-measurement-element";function qc(e){let t=document.getElementById(_c);return t||(t=function(){const e=document.createElement("div");return e.id=_c,e.style.position="absolute",e.style.left="-9999em",e.style.top=0,e.style.height=0,e.style.overflow="hidden",e.style.fontFamily="Arial",e.style.fontSize="18px",e.style.fontWeight="400",document.body.appendChild(e),e}()),t.innerText=e,t.offsetWidth}const Ec=e=>{const t=qc(e),n=new fc.assessments.seo.PageTitleWidthAssessment,r=n.calculateScore(t);return{max:n.getMaximumLength(),actual:t,score:r}},wc=I((e=>({...e.content})))((({title:t=""})=>{const[n,r]=(0,e.useState)({progress:null,title:""});return(0,e.useEffect)((()=>{r((e=>({...e,progress:Ec(t),title:t})))}),[t]),null!==n.progress?(0,e.createElement)(Ac.ProgressBar,{min:0,max:n.progress.max,value:n.progress.actual,progressColor:yc(n.progress.score)}):(0,e.createElement)(e.Fragment,null)})),Tc=(e,t)=>{let n=e.length;""!==t&&n>0&&(n+=t.length+3);const r=new fc.assessments.seo.MetaDescriptionLengthAssessment,o=r.calculateScore(n);return{max:r.getMaximumLength(),actual:n,score:o}},Sc=I((e=>({...e.content})))((({description:t="",date:n=""})=>{const[r,o]=(0,e.useState)({progress:null,description:""});return(0,e.useEffect)((()=>{o((e=>({...e,progress:Tc(t,n),description:t})))}),[t]),null!==r.progress?(0,e.createElement)(Ac.ProgressBar,{min:0,max:r.progress.max,value:r.progress.actual,progressColor:yc(r.progress.score)}):(0,e.createElement)(e.Fragment,null)})),Lc=I((e=>({...e.linkingSuggestions})))((({suggestions:t,isCheckingLinkingSuggestions:n})=>n?(0,e.createElement)(Q,null):t.links&&t.links.length>0?(0,e.createElement)("table",{className:"table",style:{width:"auto"}},(0,e.createElement)("thead",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",null,"Label"),(0,e.createElement)("th",null,"Record"),(0,e.createElement)("th",null,"Linked")),t.links.map((t=>(0,e.createElement)("tr",{key:t.recordType+t.id},(0,e.createElement)("td",null,t.label," ",1===parseInt(t.cornerstone)&&"*"),(0,e.createElement)("td",null,t.recordType," [uid=",t.id,"]"),(0,e.createElement)("td",{className:"text-center"},t.active?(0,e.createElement)("button",{className:"btn btn-success btn-sm"}," ✓ "):(0,e.createElement)("button",{className:"btn btn-danger btn-sm"}," ✗ "))))))):(0,e.createElement)("div",{className:"alert alert-info"},"No results found, make sure you have more than 100 words to analyze.",(0,e.createElement)("br",null),"If there's enough content to analyze, it may be that no other content relates to the current content."))),kc=I((e=>({...e.insights})))((({insights:t})=>{if(t){let n=t.result.slice(0,20);return(0,e.createElement)(Ac.WordOccurrenceInsights,{words:n,researchArticleLink:"https://yoa.st/keyword-research-metabox"})}return(0,e.createElement)(Q,null)}));function Rc(t,n,r){const o=function(e){switch(e){case fc.DIFFICULTY.FAIRLY_DIFFICULT:case fc.DIFFICULTY.DIFFICULT:case fc.DIFFICULTY.VERY_DIFFICULT:return(0,ee.__)("Try to make shorter sentences, using less difficult words to improve readability","wordpress-seo");case fc.DIFFICULTY.NO_DATA:return(0,ee.__)("Continue writing to get insight into the readability of your text!","wordpress-seo");default:return(0,ee.__)("Good job!","wordpress-seo")}}(n);return(0,e.createElement)("span",null,function(e,t){return-1===e?sprintf((0,ee.__)("Your text should be slightly longer to calculate your Flesch reading ease score.","wordpress-seo")):sprintf((0,ee.__)("The copy scores %1$s in the test, which is considered %2$s to read.","wordpress-seo"),e,function(e){switch(e){case fc.DIFFICULTY.NO_DATA:return(0,ee.__)("no data","wordpress-seo");case fc.DIFFICULTY.VERY_EASY:return(0,ee.__)("very easy","wordpress-seo");case fc.DIFFICULTY.EASY:return(0,ee.__)("easy","wordpress-seo");case fc.DIFFICULTY.FAIRLY_EASY:return(0,ee.__)("fairly easy","wordpress-seo");case fc.DIFFICULTY.OKAY:return(0,ee.__)("okay","wordpress-seo");case fc.DIFFICULTY.FAIRLY_DIFFICULT:return(0,ee.__)("fairly difficult","wordpress-seo");case fc.DIFFICULTY.DIFFICULT:return(0,ee.__)("difficult","wordpress-seo");case fc.DIFFICULTY.VERY_DIFFICULT:return(0,ee.__)("very difficult","wordpress-seo")}}(t))}(t,n)," ",n>=fc.DIFFICULTY.FAIRLY_DIFFICULT?(0,e.createElement)("a",{href:r,target:"_blank",rel:"noopener noreferrer"},o+"."):o)}const xc=I((e=>({...e.flesch})))((({flesch:t})=>{if(t){let n=t.result.score;const r=(0,e.useMemo)((()=>Rc(n,t.result.difficulty,"https://yoa.st/34s")));return-1===n&&(n="?"),(0,e.createElement)(Ac.InsightsCard,{amount:n,unit:(0,ee.__)("out of 100","wordpress-seo"),title:(0,ee.__)("Flesch reading ease","wordpress-seo"),linkTo:"https://yoa.st/34r",linkText:(0,ee.__)("Learn more about Flesch reading ease","wordpress-seo"),description:r})}return(0,e.createElement)(Q,null)}));function Wc(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,r,e):t(o)}}}}var Cc=Wc();Cc.withExtraArgument=Wc;const Nc=Cc;var Dc=o(78964);const Ic="GET_CONTENT_REQUEST",Pc="GET_CONTENT_SUCCESS",Bc="GET_CONTENT_ERROR",jc="UPDATE_CONTENT";function Fc(e){return void 0!==e.title&&(e.title=Dc.strings.stripHTMLTags(e.title)),void 0!==e.description&&(e.description=Dc.strings.stripHTMLTags(e.description)),{type:jc,payload:e}}const Hc={isFetching:!1};let Yc=[];const Uc="SET_FOCUS_KEYWORD";function Xc(e){return{type:Uc,keyword:e}}const $c="SET_FOCUS_KEYWORD_SYNONYMS";function Gc(e){return{type:$c,synonyms:e}}const Vc="ANALYZE_DATA_REQUEST",Kc="ANALYZE_DATA_SUCCESS",Qc=e=>{const{scoreToRating:t}=fc.interpreters;void 0!==YoastConfig.data&&void 0!==YoastConfig.urls.saveScores&&fetch(YoastConfig.urls.saveScores,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({table:YoastConfig.data.table,uid:YoastConfig.data.uid,languageId:YoastConfig.data.languageId,readabilityScore:t(e.result.readability.score/10),seoScore:t(e.result.seo[""].score/10)})})},Jc=e=>{console.error("An error occured while analyzing the text:"),console.error(e)};function Zc(e,t,n=void 0){return r=>{if(r({type:Vc}),void 0!==n&&"object"==typeof n&&Object.keys(n).length>0)return e.analyze(t).then((o=>{Qc(o),e.analyzeRelatedKeywords(t,n).then((e=>{o.result.seo={...o.result.seo,...e.result.seo},r({type:Kc,payload:o})})).catch((e=>Jc(e)))})).catch((e=>Jc(e)));let o;return o=void 0===n?e.analyze(t):e.analyzeRelatedKeywords(t,n),o.then((e=>{Qc(e),r({type:Kc,payload:e})})).catch((e=>Jc(e)))}}const el={isAnalyzing:!1,result:{readability:{results:[]},seo:{results:[]}}},tl="GET_RELEVANTWORDS_REQUEST",nl="GET_RELEVANTWORDS_SUCCESS";function rl(e,t){return n=>(n({type:tl}),e.runResearch("getProminentWordsForInternalLinking",t).then((e=>{n({type:nl,payload:e})})).catch((e=>{console.error("An error occured while analyzing the text:"),console.error(e)})))}const ol={isCheckingRelevantWords:!1,words:[]},il="GET_INSIGHTS_REQUEST",al="GET_INSIGHTS_SUCCESS";function sl(e,t){return n=>(n({type:il}),e.runResearch("getProminentWordsForInsights",t).then((e=>{n({type:al,payload:e})})).catch((e=>{console.error("An error occured while analyzing the text:"),console.error(e)})))}const cl={isCheckingInsights:!1,words:[]},ll="GET_FLESCH_REQUEST",ul="GET_FLESCH_SUCCESS";function pl(e,t){return n=>(n({type:ll}),e.runResearch("getFleschReadingScore",t).then((e=>{n({type:ul,payload:e})})).catch((e=>{console.error("An error occured while analyzing the text:"),console.error(e)})))}const dl={isCheckingFlesch:!1,words:[]},fl="GET_LINKINGSUGGESTIONS_SUCCESS",bl={isCheckingLinkingSuggestions:!0,suggestions:[]},hl={content:function e(t=Hc,n){switch(n.type){case Ic:return{...t,isFetching:!0};case Pc:YoastConfig.pageTitlePrepend=n.payload.pageTitlePrepend,YoastConfig.pageTitleAppend=n.payload.pageTitleAppend;let r={...t,isFetching:!1,...n.payload};return Yc.forEach((t=>{r=e(r,t)})),Yc=[],r;case Bc:return{...t,isFetching:!1,error:n.error};case jc:return t.isFetching?(Yc.push(n),t):{...t,isFetching:!1,...n.payload};default:return t}},focusKeyword:(e="",t)=>t.type===Uc?t.keyword:e,focusKeywordSynonyms:(e="",t)=>t.type===$c?t.synonyms:e,analysis:function(e=el,t){switch(t.type){case Vc:return{...e,isAnalyzing:!0};case Kc:return{...e,isAnalyzing:!1,...t.payload};default:return e}},relevantWords:function(e=ol,t){switch(t.type){case tl:return{...e,isCheckingRelevantWords:!0};case nl:return{...e,isCheckingRelevantWords:!1,relevantWords:t.payload};default:return e}},insights:function(e=cl,t){switch(t.type){case il:return{...e,isCheckingInsights:!0};case al:return{...e,isCheckingInsights:!1,insights:t.payload};default:return e}},flesch:function(e=dl,t){switch(t.type){case ll:return{...e,isCheckingFlesch:!0};case ul:return{...e,isCheckingFlesch:!1,flesch:t.payload};default:return e}},linkingSuggestions:function(e=bl,t){return t.type===fl?{...e,isCheckingLinkingSuggestions:!1,suggestions:t.payload}:e}},Ml=(0,T.y$)((0,T.HY)(hl),(0,T.Tw)(Nc)),ml=document.createElement("div");document.body.appendChild(ml);const gl=Ml;let zl={_yoastWorker:null,_progressBarInitialized:!1,init:function(){"undefined"!=typeof YoastConfig&&(void 0!==YoastConfig.data&&void 0!==YoastConfig.data.uid&&Ol.init(),void 0!==YoastConfig.urls.linkingSuggestions&&Al.init(YoastConfig.urls.linkingSuggestions),void 0!==YoastConfig.urls.indexPages&&vl.init())},setWorker:function(e,t="en_US"){null!==zl._yoastWorker&&zl._yoastWorker._worker.terminate(),zl._yoastWorker=function(e,t){const n=new fc.AnalysisWorkerWrapper((0,fc.createWorker)(YoastConfig.urls.workerUrl));return n.initialize({locale:t,contentAnalysisActive:!0,keywordAnalysisActive:!0,useKeywordDistribution:!0,useCornerstone:e,logLevel:"ERROR",translations:YoastConfig.translations,defaultQueryParams:null}),n}(e,t)},setLocales:function(){if((0,ee.setLocaleData)({"":{"yoast-components":{}}},"yoast-components"),YoastConfig.translations)for(let e of YoastConfig.translations)(0,ee.setLocaleData)(e.locale_data["wordpress-seo"],e.domain);else(0,ee.setLocaleData)({"":{"wordpress-seo":{}}},"wordpress-seo")},postRequest:(e,t)=>fetch(e,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},Ol={init:()=>{zl.setWorker(YoastConfig.isCornerstoneContent),zl.setLocales(),gl.dispatch(Xc(YoastConfig.focusKeyphrase.keyword)),gl.dispatch(Gc(YoastConfig.focusKeyphrase.synonyms)),Ol.initContentAnalysis(),Ol.initStatusIcon(),Ol.initScoreBars(),Ol.initTCA(),Ol.initSnippetPreviewAndInsights(),Ol.initCornerstone(),Ol.initProgressBars(),Ol.initFocusKeyword(),Ol.initRelatedFocusKeywords(),Ol.initSeoTitle()},initContentAnalysis:()=>{gl.dispatch((e=>(e({type:Ic}),fetch(YoastConfig.urls.previewUrl).then((e=>e.json())).then((t=>{e({type:Pc,payload:t})})).catch((t=>{e({type:Bc,payload:t,error:!0})}))))).then((e=>(zl.setWorker(YoastConfig.isCornerstoneContent,gl.getState().content.locale),Ol.refreshAnalysis()))).then((n=>{document.querySelectorAll("[data-yoast-analysis]").forEach((n=>{const r={};r.resultType=n.getAttribute("data-yoast-analysis"),"seo"===r.resultType&&(r.resultSubtype=n.getAttribute("data-yoast-subtype")),(0,t.H)(n).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(Oc,{...r})))})),gl.dispatch(function(e,t,n,r,o,i){return a=>{let s=e.relevantWords.result.prominentWords.slice(0,25),c={};s.forEach((function(e){c[e.getStem()]=e.getOccurrences()})),i&&fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({words:c,uid:t,pid:n,languageId:r,table:o})}),a({type:"SAVE_RELEVANTWORDS_SUCCESS"})}}(gl.getState().relevantWords,YoastConfig.data.uid,YoastConfig.data.pid,YoastConfig.data.languageId,YoastConfig.data.table,YoastConfig.urls.prominentWords))}))},initStatusIcon:()=>{document.querySelectorAll("[data-yoast-analysis]").forEach((n=>{const r={};r.resultType=n.getAttribute("data-yoast-analysis");let o=n.closest(".form-section");if(null===o)return;let i=o.querySelector("h4"),a=document.createElement("span");if(null!=i)a.classList.add("yoast-seo-status-icon"),i.prepend(a);else{let e=n.closest(".panel");null!==e&&(i=e.querySelector(".t3js-icon"),a.style.cssText="top: 3px; position: relative;",i.replaceWith(a))}"seo"===r.resultType&&(r.resultSubtype=n.getAttribute("data-yoast-subtype")),(0,t.H)(a).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(vc,{...r,text:"false"})))}))},initScoreBars:()=>{document.querySelectorAll(".yoast-seo-score-bar--analysis").forEach((n=>{let r=n.getAttribute("data-yoast-analysis-type");const o={},i={};o.resultType="readability",i.resultType="seo",i.resultSubtype="";const a=(0,t.H)(n);"readability"===r&&a.render((0,e.createElement)(l,{store:gl},(0,e.createElement)(vc,{...o,text:"true"}))),"seo"===r&&a.render((0,e.createElement)(l,{store:gl},(0,e.createElement)(vc,{...i,text:"true"})))}))},initTCA:()=>{void 0!==YoastConfig.TCA&&1===YoastConfig.TCA&&document.querySelectorAll("h1").forEach((n=>{const r={},o={};r.resultType="readability",o.resultType="seo",o.resultSubtype="";let i=document.createElement("div");i.classList.add("yoast-seo-score-bar");let a=document.createElement("span");a.classList.add("yoast-seo-score-bar--analysis"),a.classList.add("yoast-seo-tca"),i.append(a);let s=document.createElement("span");s.classList.add("yoast-seo-score-bar--analysis"),s.classList.add("yoast-seo-tca"),i.append(s),n.parentNode.insertBefore(i,n.nextSibling),(0,t.H)(a).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(vc,{...r,text:"true"}))),(0,t.H)(s).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(vc,{...o,text:"true"})))}))},initSnippetPreviewAndInsights:()=>{document.querySelectorAll("[data-yoast-snippetpreview]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(ce,null)))})),document.querySelectorAll("[data-yoast-insights]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(kc,null)))})),document.querySelectorAll("[data-yoast-flesch]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(xc,null)))}))},initCornerstone:()=>{let e=Ol.getFormEngineElement("cornerstone");null!==e&&e.addEventListener("change",(function(){zl.setWorker(this.checked),Ol.refreshAnalysis()}))},initProgressBars:()=>{let n=Ol.getFormEngineElement("title"),r=Ol.getFormEngineElement("description");null!==n&&null!==r&&(Ol._progressBarInitialized=!0,[{input:n,component:(0,e.createElement)(wc,null),storeKey:"title"},{input:r,component:(0,e.createElement)(Sc,null),storeKey:"description"}].forEach((n=>{if(n.input){let r=document.createElement("div");Ol.addProgressContainer(n.input,r),n.input.addEventListener("input",(0,K.debounce)((e=>{let t=n.input.value,r=Ol.getFormEngineElement("pageTitle").value;""===t&&(t=r),"title"===n.storeKey&&(t=Ol.getTitleValue(t)),gl.dispatch(Fc({[n.storeKey]:t}))}),100)),n.input.addEventListener("change",(e=>{Ol.refreshAnalysis()})),(0,t.H)(r).render((0,e.createElement)(l,{store:gl},n.component))}})))},addProgressContainer:(e,t)=>{let n=e.closest(".form-wizards-wrap");if("grid"===window.getComputedStyle(n).getPropertyValue("display")){t.style.gridArea="bottom";let n=e.closest(".form-control-wrap");n.style.maxWidth&&(t.style.maxWidth=n.style.maxWidth),e.closest(".form-control-wrap").after(t)}else e.after(t)},initFocusKeyword:()=>{Ol.getFormEngineElements("focusKeyword").forEach((e=>{e.addEventListener("input",(0,K.debounce)((t=>{gl.dispatch(Xc(e.value)),Ol.refreshAnalysis()}),500))})),Ol.getFormEngineElements("focusKeywordSynonyms").forEach((e=>{e.addEventListener("input",(0,K.debounce)((t=>{gl.dispatch(Gc(e.value)),Ol.refreshAnalysis()}),500))}))},initRelatedFocusKeywords:()=>{if("undefined"==typeof YoastConfig||void 0===YoastConfig.fieldSelectors||void 0===YoastConfig.fieldSelectors.relatedKeyword)return;let n=document.querySelector(`#${YoastConfig.fieldSelectors.relatedKeyword}`);null!==n&&n.querySelectorAll(".panel-heading").forEach((n=>{n.addEventListener("click",(0,K.debounce)((n=>{document.querySelectorAll("[data-yoast-analysis]").forEach((n=>{const r={};r.resultType=n.getAttribute("data-yoast-analysis"),"seo"===r.resultType&&(r.resultSubtype=n.getAttribute("data-yoast-subtype")),(0,t.H)(n).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(Oc,{...r})))}))}),2e3))}))},initSeoTitle:()=>{let e=Ol.getFieldSelector("title"),t=Ol.getFieldSelector("pageTitle");if(!1===e||!1===t)return;let n=Ol.getFormEngineElement("pageTitle");n&&n.addEventListener("change",(function(e){Ol.setSeoTitlePlaceholder()})),window.addEventListener("load",(function(e){Ol.setSeoTitlePlaceholder()})),document.querySelectorAll("li.t3js-tabmenu-item").forEach((e=>{e.innerHTML.includes("SEO")&&e.addEventListener("click",(0,K.debounce)((e=>{!1===Ol._progressBarInitialized&&Ol.initProgressBars();let t=Ol.getFormEngineElement("title"),n=t.value,r=Ol.getFormEngineElement("pageTitle").value;t.setAttribute("placeholder",r),""===n&&(n=r),n=Ol.getTitleValue(n),gl.dispatch(Fc({title:n+" "}))}),100))}))},getTitleValue:e=>(void 0!==YoastConfig.pageTitlePrepend&&null!==YoastConfig.pageTitlePrepend&&""!==YoastConfig.pageTitlePrepend&&(e=YoastConfig.pageTitlePrepend+e),void 0!==YoastConfig.pageTitleAppend&&null!==YoastConfig.pageTitleAppend&&""!==YoastConfig.pageTitleAppend&&(e+=YoastConfig.pageTitleAppend),e),setSeoTitlePlaceholder:()=>{let e=Ol.getFormEngineElement("title"),t=Ol.getFormEngineElement("pageTitle");if(e&&t){let n=t.value;e.setAttribute("placeholder",n)}},getFieldSelector:e=>void 0!==YoastConfig.fieldSelectors&&void 0!==YoastConfig.fieldSelectors[e]&&YoastConfig.fieldSelectors[e],getFormEngineElement:e=>{let t=Ol.getFieldSelector(e);return!1===t?null:document.querySelector(`[data-formengine-input-name="${t}"]`)},getFormEngineElements:e=>{let t=Ol.getFieldSelector(e);return!1===t?[]:document.querySelectorAll(`[data-formengine-input-name="${t}"]`)},refreshAnalysis:()=>function(e,t){const n=t.getState(),r=n.content,o=new fc.Paper(r.body,{keyword:n.focusKeyword,title:r.title,synonyms:n.focusKeywordSynonyms,description:r.description,locale:r.locale,titleWidth:qc(r.title)});return Promise.all([t.dispatch(Zc(e,o,YoastConfig.relatedKeyphrases)),t.dispatch(rl(e,o)),t.dispatch(sl(e,o)),t.dispatch(pl(e,o))])}(zl._yoastWorker,gl)},Al={_url:null,_updateInterval:null,init:n=>{Al._url=n,zl.setWorker(!1,YoastConfig.linkingSuggestions.locale),document.querySelectorAll("[data-yoast-linking-suggestions]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:gl},(0,e.createElement)(Lc,null)))})),Al._updateInterval=setInterval((()=>{Al.checkLinkingSuggestions()}),1e3)},checkLinkingSuggestions:()=>{let e=Al.getCKEditorContent();null!==e&&(gl.dispatch(function(e,t,n){return r=>{const o=new fc.Paper(t,{locale:YoastConfig.linkingSuggestions.locale});return e.runResearch("getProminentWordsForInternalLinking",o).then((e=>{let o=e.result.prominentWords.slice(0,5);fetch(n,{method:"post",headers:new Headers,body:JSON.stringify({words:o,excludedPage:YoastConfig.linkingSuggestions.excludedPage,languageId:YoastConfig.data.languageId,content:t})}).then((e=>e.json())).then((e=>{r({type:fl,payload:e})})).catch((e=>{console.error("An error occured while analyzing the linking suggestions:"),console.error(e)}))}))}}(zl._yoastWorker,e,Al._url)),clearInterval(Al._updateInterval),Al._updateInterval=setInterval((()=>{Al.checkLinkingSuggestions()}),1e4))},getCKEditorContent:()=>{if(document.getElementsByTagName("typo3-rte-ckeditor-ckeditor5").length>0){const e=document.querySelectorAll(".ck-editor__editable");let t="",n=!1;for(let r in e)void 0!==e[r].ckeditorInstance&&(n=!0,t+=e[r].ckeditorInstance.getData());return!1===n?null:t}{if("undefined"==typeof CKEDITOR)return null;let e="";for(let t in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(t)&&(e+=CKEDITOR.instances[t].getData());return e}}},vl={_progressCache:[],init:()=>{document.querySelectorAll(".js-crawler-index").forEach((e=>{e.addEventListener("click",(t=>{vl.startIndex(e.dataset.site,e.dataset.language)}))}))},startIndex:(e,t)=>{vl.setButtonsDisableStatus(!0),document.querySelector("#saved-progress-"+e+"-"+t).remove();let n=document.querySelector("#progress-"+e+"-"+t);n.classList.remove("hide");let r=n.querySelector(".js-crawler-pages-progress"),o=n.querySelector(".js-crawler-pages-success");zl.postRequest(YoastConfig.urls.determinePages,{site:e,language:t}).then((e=>e.json())).then((n=>{void 0!==n.error?(r.innerHTML=n.error,r.classList.remove("alert-info"),r.classList.add("alert-danger")):(r.classList.add("hide"),o.classList.remove("hide"),o.innerHTML=o.innerHTML.replace("%d",n.amount),vl.runIndex(e,t))}))},setButtonsDisableStatus:e=>{document.querySelectorAll(".js-crawler-button").forEach((t=>{t.disabled=e}))},runIndex:(e,t)=>{let n=document.querySelector("#progress-"+e+"-"+t).querySelector(".js-crawler-progress-bar");zl.postRequest(YoastConfig.urls.indexPages,{site:e,language:t,offset:void 0!==vl._progressCache[e+"-"+t]?parseInt(vl._progressCache[e+"-"+t]):0}).then((e=>e.json())).then((async r=>{void 0!==r.status?(vl.setButtonsDisableStatus(!1),n.classList.remove("progress-bar-info"),n.classList.add("progress-bar-success"),n.style.width="100%",n.innerHTML=r.total+" pages have been indexed."):(vl._progressCache[e+"-"+t]=parseInt(r.nextOffset),await vl.process(e,t,r,n),vl.runIndex(e,t,r))}))},process:async(e,t,n,r)=>{let o=n.current,i=n.total,a=Math.round(o/i*100);vl.updateProgressBar(r,o,i,a);for(let e in n.pages)if(n.pages.hasOwnProperty(e)){let s=n.pages[e],c=await zl.postRequest(YoastConfig.urls.preview,{pageId:s,languageId:t,additionalGetVars:""});if(c.ok){let e=await c.json();await vl.processRelevantWords(s,t,e),o++,a=Math.round(o/i*100),vl.updateProgressBar(r,o,i,a)}}},processRelevantWords:(e,t,n)=>{zl.setWorker(!1,n.locale);let r=new fc.Paper(n.body,{title:n.title,description:n.description,locale:n.locale});return zl._yoastWorker.runResearch("getProminentWordsForInternalLinking",r).then((async n=>{await vl.saveRelevantWords(e,t,n)}))},saveRelevantWords:(e,t,n)=>{let r=n.result.prominentWords.slice(0,25),o={};r.forEach((e=>{o[e.getStem()]=e.getOccurrences()})),zl.postRequest(YoastConfig.urls.prominentWords,{words:o,uid:e,languageId:t,table:"pages"})},updateProgressBar:(e,t,n,r)=>{e.innerText=t+"/"+n,e.style.width=r+"%"}};zl.init()})()})(); \ No newline at end of file +`;class pc extends e.Component{renderCollapsible(t,n,r){return(0,e.createElement)(uc,{initialIsOpen:!0,title:`${t} (${r.length})`,prefixIcon:{icon:"angle-up",color:fn.$color_grey_dark,size:"18px"},prefixIconCollapsed:{icon:"angle-down",color:fn.$color_grey_dark,size:"18px"},suffixIcon:null,suffixIconCollapsed:null,headingProps:{level:n,fontSize:"13px",fontWeight:"bold"}},(0,e.createElement)(cc,{results:r,marksButtonActivatedResult:this.props.activeMarker,marksButtonStatus:this.props.marksButtonStatus,marksButtonClassName:this.props.marksButtonClassName,onMarksButtonClick:this.props.onMarkButtonClick}))}render(){const{problemsResults:t,improvementsResults:n,goodResults:r,considerationsResults:o,errorsResults:i,headingLevel:a}=this.props,s=i.length,c=t.length,l=n.length,u=o.length,p=r.length;return(0,e.createElement)(lc,null,s>0&&this.renderCollapsible((0,ee.__)("Errors","yoast-components"),a,i),c>0&&this.renderCollapsible((0,ee.__)("Problems","yoast-components"),a,t),l>0&&this.renderCollapsible((0,ee.__)("Improvements","yoast-components"),a,n),u>0&&this.renderCollapsible((0,ee.__)("Considerations","yoast-components"),a,o),p>0&&this.renderCollapsible((0,ee.__)("Good results","yoast-components"),a,r))}}pc.propTypes={onMarkButtonClick:a().func,problemsResults:a().array,improvementsResults:a().array,goodResults:a().array,considerationsResults:a().array,errorsResults:a().array,headingLevel:a().number,marksButtonStatus:a().string,marksButtonClassName:a().string,activeMarker:a().string},pc.defaultProps={onMarkButtonClick:()=>{},problemsResults:[],improvementsResults:[],goodResults:[],considerationsResults:[],errorsResults:[],headingLevel:4,marksButtonStatus:"enabled",marksButtonClassName:"",activeMarker:""};const dc=pc;var fc=o(37091);const bc=JSON.parse('{"s6":"#dc3232","vb":"#ee7c1b","Yy":"#7ad03a","ct":"#008a00","Wh":"#dc3232","nk":"#64a60a","t_":"#a0a5aa"}'),{scoreToRating:hc}=fc.interpreters;function Mc(e,t=""){const n=e.getIdentifier(),r={score:e.score,rating:hc(e.score),hasMarks:e.hasMarks(),marker:e.getMarker(),id:n,text:e.text,markerId:t.length>0?`${t}:${n}`:n};return"ok"===r.rating&&(r.rating="OK"),r}function mc(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 gc(e){let t="";switch(e){case"readability":t=(0,ee.__)("Readability analysis:","wordpress-seo");break;case"seo":t=(0,ee.__)("SEO analysis:","wordpress-seo")}return t}const zc=(e,t,n)=>void 0!==n?e.result[t][n]:e.result[t],Oc=I((e=>({content:e.content,analysis:e.analysis,keyword:e.focusKeyword})))((({content:t,analysis:n,keyword:r,resultType:o,resultSubtype:i})=>{const[a,s]=(0,e.useState)({currentAnalysis:!1,mappedResults:{}});if((0,e.useEffect)((()=>{if(null!==n.result[o]){let e=function(e,t=""){let n={errorsResults:[],problemsResults:[],improvementsResults:[],goodResults:[],considerationsResults:[]};if(!e)return n;for(let r=0;r({content:e.content,analysis:e.analysis})))((({content:t,analysis:n,resultType:r,resultSubtype:o,text:i})=>{const{scoreToRating:a}=fc.interpreters;if(!1===t.isFetching&&!1===n.isAnalyzing&&zc(n,r,o)){let t=zc(n,r,o).score/10,s=function(e){let t={icon:"seo-score-none",color:bc.t_};switch(e){case"loading":t={icon:"loading-spinner",color:bc.nk};break;case"good":t={icon:"seo-score-good",color:bc.ct};break;case"ok":t={icon:"seo-score-ok",color:bc.vb};break;case"bad":t={icon:"seo-score-bad",color:bc.Wh}}return t}(a(t));return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Ac.SvgIcon,{icon:s.icon,color:s.color})," ","true"===i?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:`score-label-${r}`},gc(r))," ",(0,e.createElement)("span",null,function(e){let t="-";switch(e){case"good":t=(0,ee.__)("Good","wordpress-seo");break;case"ok":t=(0,ee.__)("OK","wordpress-seo");break;case"bad":t=(0,ee.__)("Needs improvement","wordpress-seo")}return t}(a(t)))):"")}return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Ac.SvgIcon,{icon:"circle",color:"#bebebe"})," ","true"===i?(0,e.createElement)("span",{className:`score-label-${r}`},gc(r)):"")}));function yc(e){return e>=7?bc.Yy:e>=5?bc.vb:bc.s6}const _c="yoast-measurement-element";function qc(e){let t=document.getElementById(_c);return t||(t=function(){const e=document.createElement("div");return e.id=_c,e.style.position="absolute",e.style.left="-9999em",e.style.top=0,e.style.height=0,e.style.overflow="hidden",e.style.fontFamily="Arial",e.style.fontSize="18px",e.style.fontWeight="400",document.body.appendChild(e),e}()),t.innerText=e,t.offsetWidth}const Ec=e=>{const t=qc(e),n=new fc.assessments.seo.PageTitleWidthAssessment,r=n.calculateScore(t);return{max:n.getMaximumLength(),actual:t,score:r}},wc=I((e=>({...e.content})))((({title:t=""})=>{const[n,r]=(0,e.useState)({progress:null,title:""});return(0,e.useEffect)((()=>{r((e=>({...e,progress:Ec(t),title:t})))}),[t]),null!==n.progress?(0,e.createElement)(Ac.ProgressBar,{min:0,max:n.progress.max,value:n.progress.actual,progressColor:yc(n.progress.score)}):(0,e.createElement)(e.Fragment,null)})),Tc=(e,t)=>{let n=e.length;""!==t&&n>0&&(n+=t.length+3);const r=new fc.assessments.seo.MetaDescriptionLengthAssessment,o=r.calculateScore(n);return{max:r.getMaximumLength(),actual:n,score:o}},Sc=I((e=>({...e.content})))((({description:t="",date:n=""})=>{const[r,o]=(0,e.useState)({progress:null,description:""});return(0,e.useEffect)((()=>{o((e=>({...e,progress:Tc(t,n),description:t})))}),[t]),null!==r.progress?(0,e.createElement)(Ac.ProgressBar,{min:0,max:r.progress.max,value:r.progress.actual,progressColor:yc(r.progress.score)}):(0,e.createElement)(e.Fragment,null)})),Lc=I((e=>({...e.linkingSuggestions})))((({suggestions:t,isCheckingLinkingSuggestions:n})=>n?(0,e.createElement)(Q,null):t.links&&t.links.length>0?(0,e.createElement)("table",{className:"table",style:{width:"auto"}},(0,e.createElement)("thead",null,(0,e.createElement)("tr",null,(0,e.createElement)("th",null,"Label"),(0,e.createElement)("th",null,"Record"),(0,e.createElement)("th",null,"Linked")),t.links.map((t=>(0,e.createElement)("tr",{key:t.recordType+t.id},(0,e.createElement)("td",null,t.label," ",1===parseInt(t.cornerstone)&&"*"),(0,e.createElement)("td",null,t.recordType," [uid=",t.id,"]"),(0,e.createElement)("td",{className:"text-center"},t.active?(0,e.createElement)("button",{className:"btn btn-success btn-sm"}," ✓ "):(0,e.createElement)("button",{className:"btn btn-danger btn-sm"}," ✗ "))))))):(0,e.createElement)("div",{className:"alert alert-info"},"No results found, make sure you have more than 100 words to analyze.",(0,e.createElement)("br",null),"If there's enough content to analyze, it may be that no other content relates to the current content."))),kc=I((e=>({...e.insights})))((({insights:t})=>{if(t){let n=t.result.slice(0,20);return(0,e.createElement)(Ac.WordOccurrenceInsights,{words:n,researchArticleLink:"https://yoa.st/keyword-research-metabox"})}return(0,e.createElement)(Q,null)}));function Rc(t,n,r){const o=function(e){switch(e){case fc.DIFFICULTY.FAIRLY_DIFFICULT:case fc.DIFFICULTY.DIFFICULT:case fc.DIFFICULTY.VERY_DIFFICULT:return(0,ee.__)("Try to make shorter sentences, using less difficult words to improve readability","wordpress-seo");case fc.DIFFICULTY.NO_DATA:return(0,ee.__)("Continue writing to get insight into the readability of your text!","wordpress-seo");default:return(0,ee.__)("Good job!","wordpress-seo")}}(n);return(0,e.createElement)("span",null,function(e,t){return-1===e?sprintf((0,ee.__)("Your text should be slightly longer to calculate your Flesch reading ease score.","wordpress-seo")):sprintf((0,ee.__)("The copy scores %1$s in the test, which is considered %2$s to read.","wordpress-seo"),e,function(e){switch(e){case fc.DIFFICULTY.NO_DATA:return(0,ee.__)("no data","wordpress-seo");case fc.DIFFICULTY.VERY_EASY:return(0,ee.__)("very easy","wordpress-seo");case fc.DIFFICULTY.EASY:return(0,ee.__)("easy","wordpress-seo");case fc.DIFFICULTY.FAIRLY_EASY:return(0,ee.__)("fairly easy","wordpress-seo");case fc.DIFFICULTY.OKAY:return(0,ee.__)("okay","wordpress-seo");case fc.DIFFICULTY.FAIRLY_DIFFICULT:return(0,ee.__)("fairly difficult","wordpress-seo");case fc.DIFFICULTY.DIFFICULT:return(0,ee.__)("difficult","wordpress-seo");case fc.DIFFICULTY.VERY_DIFFICULT:return(0,ee.__)("very difficult","wordpress-seo")}}(t))}(t,n)," ",n>=fc.DIFFICULTY.FAIRLY_DIFFICULT?(0,e.createElement)("a",{href:r,target:"_blank",rel:"noopener noreferrer"},o+"."):o)}const xc=I((e=>({...e.flesch})))((({flesch:t})=>{if(t){let n=t.result.score;const r=(0,e.useMemo)((()=>Rc(n,t.result.difficulty,"https://yoa.st/34s")));return-1===n&&(n="?"),(0,e.createElement)(Ac.InsightsCard,{amount:n,unit:(0,ee.__)("out of 100","wordpress-seo"),title:(0,ee.__)("Flesch reading ease","wordpress-seo"),linkTo:"https://yoa.st/34r",linkText:(0,ee.__)("Learn more about Flesch reading ease","wordpress-seo"),description:r})}return(0,e.createElement)(Q,null)}));function Wc(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,r,e):t(o)}}}}var Cc=Wc();Cc.withExtraArgument=Wc;const Nc=Cc;var Dc=o(78964);const Ic="GET_CONTENT_REQUEST",Pc="GET_CONTENT_SUCCESS",Bc="GET_CONTENT_ERROR",jc="UPDATE_CONTENT";function Fc(e){return void 0!==e.title&&(e.title=Dc.strings.stripHTMLTags(e.title)),void 0!==e.description&&(e.description=Dc.strings.stripHTMLTags(e.description)),{type:jc,payload:e}}const Hc={isFetching:!1};let Yc=[];const Uc="SET_FOCUS_KEYWORD";function Xc(e){return{type:Uc,keyword:e}}const $c="SET_FOCUS_KEYWORD_SYNONYMS";function Gc(e){return{type:$c,synonyms:e}}const Vc="ANALYZE_DATA_REQUEST",Kc="ANALYZE_DATA_SUCCESS",Qc=e=>{const{scoreToRating:t}=fc.interpreters;void 0!==YoastConfig.data&&void 0!==YoastConfig.urls.saveScores&&fetch(YoastConfig.urls.saveScores,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({table:YoastConfig.data.table,uid:YoastConfig.data.uid,languageId:YoastConfig.data.languageId,readabilityScore:t(e.result.readability.score/10),seoScore:t(e.result.seo[""].score/10)})})},Jc=e=>{console.error("An error occured while analyzing the text:"),console.error(e)};function Zc(e,t,n=void 0){return r=>{if(r({type:Vc}),void 0!==n&&"object"==typeof n&&Object.keys(n).length>0)return e.analyze(t).then((o=>{Qc(o),e.analyzeRelatedKeywords(t,n).then((e=>{o.result.seo={...o.result.seo,...e.result.seo},r({type:Kc,payload:o})})).catch((e=>Jc(e)))})).catch((e=>Jc(e)));let o;return o=void 0===n?e.analyze(t):e.analyzeRelatedKeywords(t,n),o.then((e=>{Qc(e),r({type:Kc,payload:e})})).catch((e=>Jc(e)))}}const el={isAnalyzing:!1,result:{readability:{results:[]},seo:{results:[]}}},tl="GET_RELEVANTWORDS_REQUEST",nl="GET_RELEVANTWORDS_SUCCESS";function rl(e,t){return n=>(n({type:tl}),e.runResearch("getProminentWordsForInternalLinking",t).then((e=>{n({type:nl,payload:e})})).catch((e=>{console.error("An error occured while analyzing the text:"),console.error(e)})))}const ol={isCheckingRelevantWords:!1,words:[]},il="GET_INSIGHTS_REQUEST",al="GET_INSIGHTS_SUCCESS";function sl(e,t){return n=>(n({type:il}),e.runResearch("getProminentWordsForInsights",t).then((e=>{n({type:al,payload:e})})).catch((e=>{console.error("An error occured while analyzing the text:"),console.error(e)})))}const cl={isCheckingInsights:!1},ll="GET_FLESCH_REQUEST",ul="GET_FLESCH_SUCCESS";function pl(e,t){return n=>(n({type:ll}),e.runResearch("getFleschReadingScore",t).then((e=>{n({type:ul,payload:e})})).catch((e=>{console.error("An error occured while analyzing the text:"),console.error(e)})))}const dl={isCheckingFlesch:!1},fl="GET_READINGTIME_REQUEST",bl="GET_READINGTIME_SUCCESS";function hl(e,t){return n=>(n({type:fl}),e.runResearch("readingTime",t).then((e=>{n({type:bl,payload:e})})).catch((e=>{console.error("An error occured while analyzing the text:"),console.error(e)})))}const Ml={isCheckingReadingTime:!1},ml="GET_WORDCOUNT_REQUEST",gl="GET_WORDCOUNT_SUCCESS";function zl(e,t){return n=>(n({type:ml}),e.runResearch("wordCountInText",t).then((e=>{n({type:gl,payload:e})})).catch((e=>{console.error("An error occured while analyzing the text:"),console.error(e)})))}const Ol={isCheckingWordCount:!1},Al="GET_LINKINGSUGGESTIONS_SUCCESS",vl={isCheckingLinkingSuggestions:!0,suggestions:[]},yl={content:function e(t=Hc,n){switch(n.type){case Ic:return{...t,isFetching:!0};case Pc:YoastConfig.pageTitlePrepend=n.payload.pageTitlePrepend,YoastConfig.pageTitleAppend=n.payload.pageTitleAppend;let r={...t,isFetching:!1,...n.payload};return Yc.forEach((t=>{r=e(r,t)})),Yc=[],r;case Bc:return{...t,isFetching:!1,error:n.error};case jc:return t.isFetching?(Yc.push(n),t):{...t,isFetching:!1,...n.payload};default:return t}},focusKeyword:(e="",t)=>t.type===Uc?t.keyword:e,focusKeywordSynonyms:(e="",t)=>t.type===$c?t.synonyms:e,analysis:function(e=el,t){switch(t.type){case Vc:return{...e,isAnalyzing:!0};case Kc:return{...e,isAnalyzing:!1,...t.payload};default:return e}},relevantWords:function(e=ol,t){switch(t.type){case tl:return{...e,isCheckingRelevantWords:!0};case nl:return{...e,isCheckingRelevantWords:!1,relevantWords:t.payload};default:return e}},insights:function(e=cl,t){switch(t.type){case il:return{...e,isCheckingInsights:!0};case al:return{...e,isCheckingInsights:!1,insights:t.payload};default:return e}},flesch:function(e=dl,t){switch(t.type){case ll:return{...e,isCheckingFlesch:!0};case ul:return{...e,isCheckingFlesch:!1,flesch:t.payload};default:return e}},readingTime:function(e=Ml,t){switch(t.type){case fl:return{...e,isCheckingReadingTime:!0};case bl:return{...e,isCheckingReadingTime:!1,readingTime:t.payload};default:return e}},wordCount:function(e=Ol,t){switch(t.type){case ml:return{...e,isCheckingWordCount:!0};case gl:return{...e,isCheckingWordCount:!1,wordCount:t.payload};default:return e}},linkingSuggestions:function(e=vl,t){return t.type===Al?{...e,isCheckingLinkingSuggestions:!1,suggestions:t.payload}:e}},_l=(0,T.y$)((0,T.HY)(yl),(0,T.Tw)(Nc)),ql=document.createElement("div");document.body.appendChild(ql);const El=_l,wl=I((e=>({...e.readingTime})))((({readingTime:t})=>{if(t){const n=t.result;return(0,e.createElement)(Ac.InsightsCard,{amount:n,unit:(0,ee._n)("minute","minutes",n,"wordpress-seo"),title:(0,ee.__)("Reading time","wordpress-seo"),linkTo:"https://yoa.st/4fd",linkText:(0,ee.__)("Learn more about reading time","wordpress-seo")})}return(0,e.createElement)(Q,null)})),Tl=I((e=>({...e.wordCount})))((({wordCount:t})=>{if(t){let n=(0,ee._n)("word","words",t.result.count,"wordpress-seo"),r=(0,ee.__)("Word count","wordpress-seo"),o=(0,ee.__)("Learn more about word count","wordpress-seo");return"character"===t.result.unit&&(n=(0,ee._n)("character","characters",t.result.count,"wordpress-seo"),r=(0,ee.__)("Character count","wordpress-seo"),o=(0,ee.__)("Learn more about character count","wordpress-seo")),(0,e.createElement)(Ac.InsightsCard,{amount:t.result.count,unit:n,title:r,linkText:o})}return(0,e.createElement)(Q,null)}));let Sl={_yoastWorker:null,_progressBarInitialized:!1,init:function(){"undefined"!=typeof YoastConfig&&(void 0!==YoastConfig.data&&void 0!==YoastConfig.data.uid&&Ll.init(),void 0!==YoastConfig.urls.linkingSuggestions&&kl.init(YoastConfig.urls.linkingSuggestions),void 0!==YoastConfig.urls.indexPages&&Rl.init())},setWorker:function(e,t="en_US"){null!==Sl._yoastWorker&&Sl._yoastWorker._worker.terminate(),Sl._yoastWorker=function(e,t){const n=new fc.AnalysisWorkerWrapper((0,fc.createWorker)(YoastConfig.urls.workerUrl));return n.initialize({locale:t,contentAnalysisActive:!0,keywordAnalysisActive:!0,useKeywordDistribution:!0,useCornerstone:e,logLevel:"ERROR",translations:YoastConfig.translations,defaultQueryParams:null}),n}(e,t)},setLocales:function(){if((0,ee.setLocaleData)({"":{"yoast-components":{}}},"yoast-components"),YoastConfig.translations)for(let e of YoastConfig.translations)(0,ee.setLocaleData)(e.locale_data["wordpress-seo"],e.domain);else(0,ee.setLocaleData)({"":{"wordpress-seo":{}}},"wordpress-seo")},postRequest:(e,t)=>fetch(e,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},Ll={init:()=>{Sl.setWorker(YoastConfig.isCornerstoneContent),Sl.setLocales(),El.dispatch(Xc(YoastConfig.focusKeyphrase.keyword)),El.dispatch(Gc(YoastConfig.focusKeyphrase.synonyms)),Ll.initContentAnalysis(),Ll.initStatusIcon(),Ll.initScoreBars(),Ll.initTCA(),Ll.initSnippetPreviewAndInsights(),Ll.initCornerstone(),Ll.initProgressBars(),Ll.initFocusKeyword(),Ll.initRelatedFocusKeywords(),Ll.initSeoTitle()},initContentAnalysis:()=>{El.dispatch((e=>(e({type:Ic}),fetch(YoastConfig.urls.previewUrl).then((e=>e.json())).then((t=>{e({type:Pc,payload:t})})).catch((t=>{e({type:Bc,payload:t,error:!0})}))))).then((e=>(Sl.setWorker(YoastConfig.isCornerstoneContent,El.getState().content.locale),Ll.refreshAnalysis()))).then((n=>{document.querySelectorAll("[data-yoast-analysis]").forEach((n=>{const r={};r.resultType=n.getAttribute("data-yoast-analysis"),"seo"===r.resultType&&(r.resultSubtype=n.getAttribute("data-yoast-subtype")),(0,t.H)(n).render((0,e.createElement)(l,{store:El},(0,e.createElement)(Oc,{...r})))})),El.dispatch(function(e,t,n,r,o,i){return a=>{let s=e.relevantWords.result.prominentWords.slice(0,25),c={};s.forEach((function(e){c[e.getStem()]=e.getOccurrences()})),i&&fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({words:c,uid:t,pid:n,languageId:r,table:o})}),a({type:"SAVE_RELEVANTWORDS_SUCCESS"})}}(El.getState().relevantWords,YoastConfig.data.uid,YoastConfig.data.pid,YoastConfig.data.languageId,YoastConfig.data.table,YoastConfig.urls.prominentWords))}))},initStatusIcon:()=>{document.querySelectorAll("[data-yoast-analysis]").forEach((n=>{const r={};r.resultType=n.getAttribute("data-yoast-analysis");let o=n.closest(".form-section");if(null===o)return;let i=o.querySelector("h4"),a=document.createElement("span");if(null!=i)a.classList.add("yoast-seo-status-icon"),i.prepend(a);else{let e=n.closest(".panel");null!==e&&(i=e.querySelector(".t3js-icon"),a.style.cssText="top: 3px; position: relative;",i.replaceWith(a))}"seo"===r.resultType&&(r.resultSubtype=n.getAttribute("data-yoast-subtype")),(0,t.H)(a).render((0,e.createElement)(l,{store:El},(0,e.createElement)(vc,{...r,text:"false"})))}))},initScoreBars:()=>{document.querySelectorAll(".yoast-seo-score-bar--analysis").forEach((n=>{let r=n.getAttribute("data-yoast-analysis-type");const o={},i={};o.resultType="readability",i.resultType="seo",i.resultSubtype="";const a=(0,t.H)(n);"readability"===r&&a.render((0,e.createElement)(l,{store:El},(0,e.createElement)(vc,{...o,text:"true"}))),"seo"===r&&a.render((0,e.createElement)(l,{store:El},(0,e.createElement)(vc,{...i,text:"true"})))}))},initTCA:()=>{void 0!==YoastConfig.TCA&&1===YoastConfig.TCA&&document.querySelectorAll("h1").forEach((n=>{const r={},o={};r.resultType="readability",o.resultType="seo",o.resultSubtype="";let i=document.createElement("div");i.classList.add("yoast-seo-score-bar");let a=document.createElement("span");a.classList.add("yoast-seo-score-bar--analysis"),a.classList.add("yoast-seo-tca"),i.append(a);let s=document.createElement("span");s.classList.add("yoast-seo-score-bar--analysis"),s.classList.add("yoast-seo-tca"),i.append(s),n.parentNode.insertBefore(i,n.nextSibling),(0,t.H)(a).render((0,e.createElement)(l,{store:El},(0,e.createElement)(vc,{...r,text:"true"}))),(0,t.H)(s).render((0,e.createElement)(l,{store:El},(0,e.createElement)(vc,{...o,text:"true"})))}))},initSnippetPreviewAndInsights:()=>{document.querySelectorAll("[data-yoast-snippetpreview]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:El},(0,e.createElement)(ce,null)))})),document.querySelectorAll("[data-yoast-insights]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:El},(0,e.createElement)(kc,null)))})),document.querySelectorAll("[data-yoast-flesch]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:El},(0,e.createElement)(xc,null)))})),document.querySelectorAll("[data-yoast-readingtime]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:El},(0,e.createElement)(wl,null)))})),document.querySelectorAll("[data-yoast-wordcount]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:El},(0,e.createElement)(Tl,null)))}))},initCornerstone:()=>{let e=Ll.getFormEngineElement("cornerstone");null!==e&&e.addEventListener("change",(function(){Sl.setWorker(this.checked),Ll.refreshAnalysis()}))},initProgressBars:()=>{let n=Ll.getFormEngineElement("title"),r=Ll.getFormEngineElement("description");null!==n&&null!==r&&(Ll._progressBarInitialized=!0,[{input:n,component:(0,e.createElement)(wc,null),storeKey:"title"},{input:r,component:(0,e.createElement)(Sc,null),storeKey:"description"}].forEach((n=>{if(n.input){let r=document.createElement("div");Ll.addProgressContainer(n.input,r),n.input.addEventListener("input",(0,K.debounce)((e=>{let t=n.input.value,r=Ll.getFormEngineElement("pageTitle").value;""===t&&(t=r),"title"===n.storeKey&&(t=Ll.getTitleValue(t)),El.dispatch(Fc({[n.storeKey]:t}))}),100)),n.input.addEventListener("change",(e=>{Ll.refreshAnalysis()})),(0,t.H)(r).render((0,e.createElement)(l,{store:El},n.component))}})))},addProgressContainer:(e,t)=>{let n=e.closest(".form-wizards-wrap");if("grid"===window.getComputedStyle(n).getPropertyValue("display")){t.style.gridArea="bottom";let n=e.closest(".form-control-wrap");n.style.maxWidth&&(t.style.maxWidth=n.style.maxWidth),e.closest(".form-control-wrap").after(t)}else e.after(t)},initFocusKeyword:()=>{Ll.getFormEngineElements("focusKeyword").forEach((e=>{e.addEventListener("input",(0,K.debounce)((t=>{El.dispatch(Xc(e.value)),Ll.refreshAnalysis()}),500))})),Ll.getFormEngineElements("focusKeywordSynonyms").forEach((e=>{e.addEventListener("input",(0,K.debounce)((t=>{El.dispatch(Gc(e.value)),Ll.refreshAnalysis()}),500))}))},initRelatedFocusKeywords:()=>{if("undefined"==typeof YoastConfig||void 0===YoastConfig.fieldSelectors||void 0===YoastConfig.fieldSelectors.relatedKeyword)return;let n=document.querySelector(`#${YoastConfig.fieldSelectors.relatedKeyword}`);null!==n&&n.querySelectorAll(".panel-heading").forEach((n=>{n.addEventListener("click",(0,K.debounce)((n=>{document.querySelectorAll("[data-yoast-analysis]").forEach((n=>{const r={};r.resultType=n.getAttribute("data-yoast-analysis"),"seo"===r.resultType&&(r.resultSubtype=n.getAttribute("data-yoast-subtype")),(0,t.H)(n).render((0,e.createElement)(l,{store:El},(0,e.createElement)(Oc,{...r})))}))}),2e3))}))},initSeoTitle:()=>{let e=Ll.getFieldSelector("title"),t=Ll.getFieldSelector("pageTitle");if(!1===e||!1===t)return;let n=Ll.getFormEngineElement("pageTitle");n&&n.addEventListener("change",(function(e){Ll.setSeoTitlePlaceholder()})),window.addEventListener("load",(function(e){Ll.setSeoTitlePlaceholder()})),document.querySelectorAll("li.t3js-tabmenu-item").forEach((e=>{e.innerHTML.includes("SEO")&&e.addEventListener("click",(0,K.debounce)((e=>{!1===Ll._progressBarInitialized&&Ll.initProgressBars();let t=Ll.getFormEngineElement("title"),n=t.value,r=Ll.getFormEngineElement("pageTitle").value;t.setAttribute("placeholder",r),""===n&&(n=r),n=Ll.getTitleValue(n),El.dispatch(Fc({title:n+" "}))}),100))}))},getTitleValue:e=>(void 0!==YoastConfig.pageTitlePrepend&&null!==YoastConfig.pageTitlePrepend&&""!==YoastConfig.pageTitlePrepend&&(e=YoastConfig.pageTitlePrepend+e),void 0!==YoastConfig.pageTitleAppend&&null!==YoastConfig.pageTitleAppend&&""!==YoastConfig.pageTitleAppend&&(e+=YoastConfig.pageTitleAppend),e),setSeoTitlePlaceholder:()=>{let e=Ll.getFormEngineElement("title"),t=Ll.getFormEngineElement("pageTitle");if(e&&t){let n=t.value;e.setAttribute("placeholder",n)}},getFieldSelector:e=>void 0!==YoastConfig.fieldSelectors&&void 0!==YoastConfig.fieldSelectors[e]&&YoastConfig.fieldSelectors[e],getFormEngineElement:e=>{let t=Ll.getFieldSelector(e);return!1===t?null:document.querySelector(`[data-formengine-input-name="${t}"]`)},getFormEngineElements:e=>{let t=Ll.getFieldSelector(e);return!1===t?[]:document.querySelectorAll(`[data-formengine-input-name="${t}"]`)},refreshAnalysis:()=>function(e,t){const n=t.getState(),r=n.content,o=new fc.Paper(r.body,{keyword:n.focusKeyword,title:r.title,synonyms:n.focusKeywordSynonyms,description:r.description,locale:r.locale,titleWidth:qc(r.title)});return Promise.all([t.dispatch(Zc(e,o,YoastConfig.relatedKeyphrases)),t.dispatch(rl(e,o)),t.dispatch(sl(e,o)),t.dispatch(pl(e,o)),t.dispatch(hl(e,o)),t.dispatch(zl(e,o))])}(Sl._yoastWorker,El)},kl={_url:null,_updateInterval:null,init:n=>{kl._url=n,Sl.setWorker(!1,YoastConfig.linkingSuggestions.locale),document.querySelectorAll("[data-yoast-linking-suggestions]").forEach((n=>{(0,t.H)(n).render((0,e.createElement)(l,{store:El},(0,e.createElement)(Lc,null)))})),kl._updateInterval=setInterval((()=>{kl.checkLinkingSuggestions()}),1e3)},checkLinkingSuggestions:()=>{let e=kl.getCKEditorContent();null!==e&&(El.dispatch(function(e,t,n){return r=>{const o=new fc.Paper(t,{locale:YoastConfig.linkingSuggestions.locale});return e.runResearch("getProminentWordsForInternalLinking",o).then((e=>{let o=e.result.prominentWords.slice(0,5);fetch(n,{method:"post",headers:new Headers,body:JSON.stringify({words:o,excludedPage:YoastConfig.linkingSuggestions.excludedPage,languageId:YoastConfig.data.languageId,content:t})}).then((e=>e.json())).then((e=>{r({type:Al,payload:e})})).catch((e=>{console.error("An error occured while analyzing the linking suggestions:"),console.error(e)}))}))}}(Sl._yoastWorker,e,kl._url)),clearInterval(kl._updateInterval),kl._updateInterval=setInterval((()=>{kl.checkLinkingSuggestions()}),1e4))},getCKEditorContent:()=>{if(document.getElementsByTagName("typo3-rte-ckeditor-ckeditor5").length>0){const e=document.querySelectorAll(".ck-editor__editable");let t="",n=!1;for(let r in e)void 0!==e[r].ckeditorInstance&&(n=!0,t+=e[r].ckeditorInstance.getData());return!1===n?null:t}{if("undefined"==typeof CKEDITOR)return null;let e="";for(let t in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(t)&&(e+=CKEDITOR.instances[t].getData());return e}}},Rl={_progressCache:[],init:()=>{document.querySelectorAll(".js-crawler-index").forEach((e=>{e.addEventListener("click",(t=>{Rl.startIndex(e.dataset.site,e.dataset.language)}))}))},startIndex:(e,t)=>{Rl.setButtonsDisableStatus(!0),document.querySelector("#saved-progress-"+e+"-"+t).remove();let n=document.querySelector("#progress-"+e+"-"+t);n.classList.remove("hide");let r=n.querySelector(".js-crawler-pages-progress"),o=n.querySelector(".js-crawler-pages-success");Sl.postRequest(YoastConfig.urls.determinePages,{site:e,language:t}).then((e=>e.json())).then((n=>{void 0!==n.error?(r.innerHTML=n.error,r.classList.remove("alert-info"),r.classList.add("alert-danger")):(r.classList.add("hide"),o.classList.remove("hide"),o.innerHTML=o.innerHTML.replace("%d",n.amount),Rl.runIndex(e,t))}))},setButtonsDisableStatus:e=>{document.querySelectorAll(".js-crawler-button").forEach((t=>{t.disabled=e}))},runIndex:(e,t)=>{let n=document.querySelector("#progress-"+e+"-"+t).querySelector(".js-crawler-progress-bar");Sl.postRequest(YoastConfig.urls.indexPages,{site:e,language:t,offset:void 0!==Rl._progressCache[e+"-"+t]?parseInt(Rl._progressCache[e+"-"+t]):0}).then((e=>e.json())).then((async r=>{void 0!==r.status?(Rl.setButtonsDisableStatus(!1),n.classList.remove("progress-bar-info"),n.classList.add("progress-bar-success"),n.style.width="100%",n.innerHTML=r.total+" pages have been indexed."):(Rl._progressCache[e+"-"+t]=parseInt(r.nextOffset),await Rl.process(e,t,r,n),Rl.runIndex(e,t,r))}))},process:async(e,t,n,r)=>{let o=n.current,i=n.total,a=Math.round(o/i*100);Rl.updateProgressBar(r,o,i,a);for(let e in n.pages)if(n.pages.hasOwnProperty(e)){let s=n.pages[e],c=await Sl.postRequest(YoastConfig.urls.preview,{pageId:s,languageId:t,additionalGetVars:""});if(c.ok){let e=await c.json();await Rl.processRelevantWords(s,t,e),o++,a=Math.round(o/i*100),Rl.updateProgressBar(r,o,i,a)}}},processRelevantWords:(e,t,n)=>{Sl.setWorker(!1,n.locale);let r=new fc.Paper(n.body,{title:n.title,description:n.description,locale:n.locale});return Sl._yoastWorker.runResearch("getProminentWordsForInternalLinking",r).then((async n=>{await Rl.saveRelevantWords(e,t,n)}))},saveRelevantWords:(e,t,n)=>{let r=n.result.prominentWords.slice(0,25),o={};r.forEach((e=>{o[e.getStem()]=e.getOccurrences()})),Sl.postRequest(YoastConfig.urls.prominentWords,{words:o,uid:e,languageId:t,table:"pages"})},updateProgressBar:(e,t,n,r)=>{e.innerText=t+"/"+n,e.style.width=r+"%"}};Sl.init()})()})(); \ No newline at end of file