Changeset 2992578
- Timestamp:
- 11/08/2023 08:56:58 PM (2 years ago)
- Location:
- diagnoseo
- Files:
-
- 5 edited
- 34 copied
-
tags/1.2.20 (copied) (copied from diagnoseo/trunk)
-
tags/1.2.20/css/diagnoseo-admin.css (copied) (copied from diagnoseo/trunk/css/diagnoseo-admin.css)
-
tags/1.2.20/css/diagnoseo-editor.css (copied) (copied from diagnoseo/trunk/css/diagnoseo-editor.css)
-
tags/1.2.20/diagnoseo.php (copied) (copied from diagnoseo/trunk/diagnoseo.php) (1 diff)
-
tags/1.2.20/includes/admin-bar-menu.php (copied) (copied from diagnoseo/trunk/includes/admin-bar-menu.php)
-
tags/1.2.20/includes/api-endpoints.php (copied) (copied from diagnoseo/trunk/includes/api-endpoints.php)
-
tags/1.2.20/includes/assets.php (copied) (copied from diagnoseo/trunk/includes/assets.php)
-
tags/1.2.20/includes/blocks.php (copied) (copied from diagnoseo/trunk/includes/blocks.php)
-
tags/1.2.20/includes/blocks/breadcrumbs/breadcrumbs.php (copied) (copied from diagnoseo/trunk/includes/blocks/breadcrumbs/breadcrumbs.php)
-
tags/1.2.20/includes/class-diagnoseo-breadcrumbs.php (copied) (copied from diagnoseo/trunk/includes/class-diagnoseo-breadcrumbs.php)
-
tags/1.2.20/includes/class-diagnoseo-generalsettings.php (copied) (copied from diagnoseo/trunk/includes/class-diagnoseo-generalsettings.php)
-
tags/1.2.20/includes/class-diagnoseo-metatags.php (copied) (copied from diagnoseo/trunk/includes/class-diagnoseo-metatags.php)
-
tags/1.2.20/includes/class-diagnoseo-metatagsettings.php (copied) (copied from diagnoseo/trunk/includes/class-diagnoseo-metatagsettings.php)
-
tags/1.2.20/includes/class-diagnoseo-schemasettings.php (copied) (copied from diagnoseo/trunk/includes/class-diagnoseo-schemasettings.php)
-
tags/1.2.20/includes/class-diagnoseo-settings.php (copied) (copied from diagnoseo/trunk/includes/class-diagnoseo-settings.php)
-
tags/1.2.20/includes/class-diagnoseo-settingshelper.php (copied) (copied from diagnoseo/trunk/includes/class-diagnoseo-settingshelper.php)
-
tags/1.2.20/includes/content-watcher-meta.php (copied) (copied from diagnoseo/trunk/includes/content-watcher-meta.php)
-
tags/1.2.20/includes/content-watcher-scripts.php (copied) (copied from diagnoseo/trunk/includes/content-watcher-scripts.php)
-
tags/1.2.20/includes/customize/breadcrumbs.php (copied) (copied from diagnoseo/trunk/includes/customize/breadcrumbs.php)
-
tags/1.2.20/includes/customize/customize-utils.php (copied) (copied from diagnoseo/trunk/includes/customize/customize-utils.php)
-
tags/1.2.20/includes/customize/defaults.php (copied) (copied from diagnoseo/trunk/includes/customize/defaults.php)
-
tags/1.2.20/includes/metabox-seo-settings.php (copied) (copied from diagnoseo/trunk/includes/metabox-seo-settings.php)
-
tags/1.2.20/includes/option-defaults.php (copied) (copied from diagnoseo/trunk/includes/option-defaults.php)
-
tags/1.2.20/includes/sitemap.php (copied) (copied from diagnoseo/trunk/includes/sitemap.php)
-
tags/1.2.20/includes/structured-data.php (copied) (copied from diagnoseo/trunk/includes/structured-data.php)
-
tags/1.2.20/includes/utils.php (copied) (copied from diagnoseo/trunk/includes/utils.php)
-
tags/1.2.20/js/blocks/breadcrumbs.min.js (copied) (copied from diagnoseo/trunk/js/blocks/breadcrumbs.min.js)
-
tags/1.2.20/js/build/index.js (copied) (copied from diagnoseo/trunk/js/build/index.js)
-
tags/1.2.20/js/diagnoseo-checks.min.js (copied) (copied from diagnoseo/trunk/js/diagnoseo-checks.min.js)
-
tags/1.2.20/js/diagnoseo-editor-metabox.min.js (copied) (copied from diagnoseo/trunk/js/diagnoseo-editor-metabox.min.js) (1 diff)
-
tags/1.2.20/js/diagnoseo-editor.min.js (copied) (copied from diagnoseo/trunk/js/diagnoseo-editor.min.js) (1 diff)
-
tags/1.2.20/js/diagnoseo.min.js (copied) (copied from diagnoseo/trunk/js/diagnoseo.min.js) (1 diff)
-
tags/1.2.20/languages (copied) (copied from diagnoseo/trunk/languages)
-
tags/1.2.20/readme.txt (copied) (copied from diagnoseo/trunk/readme.txt) (1 diff)
-
trunk/diagnoseo.php (modified) (1 diff)
-
trunk/js/diagnoseo-editor-metabox.min.js (modified) (1 diff)
-
trunk/js/diagnoseo-editor.min.js (modified) (1 diff)
-
trunk/js/diagnoseo.min.js (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
diagnoseo/tags/1.2.20/diagnoseo.php
r2992575 r2992578 4 4 * Plugin URI: https://diagnoseo.com/wordpress-seo-plugin/ 5 5 * Description: Powerful SEO plugin for WordPress. The most lightweight and complete SEO solution on the market! It includes best-in-class content analyzer and keyword placement checkpoints. 6 * Version: 1.2. 196 * Version: 1.2.20 7 7 * Author: DiagnoSEO 8 8 * Author URI: https://diagnoseo.com/ -
diagnoseo/tags/1.2.20/js/diagnoseo-editor-metabox.min.js
r2990586 r2992578 1 const seoHelper={slugify:function(e){e=(e=e.replace(/^\s+|\s+$/g,"")).toLowerCase();for(var t="àáãäâąèéëêęìíïîóòóöôùúüûñńśçćźżł·/_,:;",a=0,l=t.length;a<l;a++)e=e.replace(new RegExp(t.charAt(a),"g"),"aaaaaaeeeeeiiiiooooouuuunnscczzl------".charAt(a));return e=e.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},countOccurences:function(e,t){if(!t||!e)return 0;t=t.toLowerCase().replaceAll(/[:;,.!?-]/g,""),e=e.toLowerCase();e=new RegExp(e,"g");return(t.match(e)||[]).length},countSyllables:function(e){if(""===e)return 0;if(e.length<=3)return 1;e=(e=(e=(e=e.toLowerCase()).replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,"")).replace(/^y/,"")).match(/[aeiouy]{1,2}/g);return e?e.length:0},countWords:function(e){e=(e=(e=e.replace(/(\r\n|\n|\r)/gm," ")).replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g," ")).split(" ");return(e=(e=e.map(e=>e.trim())).filter(e=>e&&""!==e&&"\n"!==e)).length||0},countElements:function(e,t){if(!e||!t)return 0;const a=document.createElement("div");return a.innerHTML=e,a.querySelectorAll(t).length},replaceVariables:function(e){if(e){var{site:t,siteTagline:a,separator:l,excerpt:i,postTitle:n}=document.querySelector(".diagnoseo-preview").dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",document.body.classList.contains("block-editor-page")?window.wp.data.select("core/editor").getEditedPostAttribute("title"):n)).replaceAll("%sitename%",t)).replaceAll("%tagline%",a)).replaceAll("%sep%",l)).replaceAll("%page%"," ")).replaceAll("%excerpt%",i)).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))}},isKeywordInText:function(e,t){if(!e||!t)return!1;e=e.toLowerCase();let a=(t=t.toLowerCase()).toLowerCase().replaceAll(/[:;,.!?-]/g,"");return t.includes(e)||a.includes(e)},isKeywordInAnyElement:function(t,e,a){if(!t||!e||!a)return!1;var l=!1;const i=seoHelper.createMarkupEl(e);return elements=i.querySelectorAll(a),elements.forEach(e=>{seoHelper.isKeywordInText(t,e.textContent)&&(l=!0)}),l},isKeywordInAnyAlt:function(t,e,a=null){if(!t)return!1;if(a&&seoHelper.isKeywordInText(t,a.alt_text))return!0;var l=0;const i=seoHelper.createMarkupEl(e),n=i.querySelectorAll("img");return n.forEach(e=>{e=e.getAttribute("alt").toLowerCase();l+=seoHelper.countOccurences(t,e)}),l},createMarkupEl:function(e){const t=document.createElement("div");return t.innerHTML=e,t},stripTags:function(e){return e.replace(/(<([^>]+)>)/gi,"")}};class diagnoseoFormHelper{input(e,t,a,l="text",i=!1,n="1",r={}){const o=document.createElement("input");for(var u in this.setAttributes(o,{type:l,name:e,id:e,class:a||"components-textarea-control__input widefat",value:t,step:"number"===l?n:""}),i&&o.setAttribute("required","required"),r)o.addEventListener(u,r[u]);return o.addEventListener("input",this.saveSchemaData),o}textarea(e,t,a,l=!1,i={}){const n=document.createElement("textarea");for(var r in this.setAttributes(n,{name:e,id:e,class:a||"components-textarea-control__input widefat"}),n.value=t,l&&n.setAttribute("required","required"),i)n.addEventListener(r,i[r]);return n.addEventListener("input",this.saveSchemaData),n}select(e,a,t,l,i=!1,n={}){const r=document.createElement("select");for(var o in r.value=a,this.setAttributes(r,{name:e,id:e,class:l||"widefat"}),i&&r.setAttribute("required","required"),t.forEach(e=>{const t=document.createElement("option");t.setAttribute("value",e.value),t.textContent=e.label,e.value===a&&t.setAttribute("selected","selected"),r.appendChild(t)}),n)r.addEventListener(o,n[o]);return r.addEventListener("change",this.saveSchemaData),r}button(e,t,a,l,i="",n={}){const r=document.createElement("button");for(var o in r.textContent=a,this.setAttributes(r,{name:e,id:e,class:l,value:t,type:i||""}),n)r.addEventListener(o,n[o]);return r}sectionTitle(e){if(e){const t=document.createElement("h3");return t.classList.add("components-base-control__heading"),t.textContent=e,t}}wrapField(e,t,a="",l="components-base-control__field"){const i=document.createElement("div");l&&i.classList.add(l);const n=document.createElement("label");if(n.classList.add("components-base-control__label"),n.setAttribute("for",e.getAttribute("id")),n.textContent=t,e.getAttribute("required")){const r=document.createElement("span");r.classList.add("req"),r.textContent="*",n.appendChild(r)}if(i.appendChild(n),i.appendChild(e),a){const o=document.createElement("p");o.classList.add("hint"),o.textContent=a,i.appendChild(o)}return i}setAttributes(e,t){for(var a in t)e.setAttribute(a,t[a])}prepareField(e){var t,{fieldType:a,label:l,name:i,value:n,type:r,className:o,options:u,listeners:s,required:p,hint:e,text:c,step:d}=e;switch(a){case"input":t=this.input(i,n,o,r,p,d,s);break;case"textarea":t=this.textarea(i,n,o,p,s);break;case"select":t=this.select(i,n,u,o,p,s);break;case"button":t=this.button(i,n,l,o,r,s);break;case"sectionTitle":t=this.sectionTitle(c)}return"button"===a||"sectionTitle"===a?t:this.wrapField(t,l,e)}saveSchemaData(e){const i=e.target.closest(".diagnoseo-schema-form");if(i){const n={};i.formConfig.forEach(t=>{if("sectionTitle"!==t.fieldType){let e=t.name;var l=e.replaceAll("-","_");let a=i.querySelector(`#${e}`).value||"";t.splitLines&&(a=a.split(t.splitLines),a.forEach((e,t)=>{a[t]=e.trim()})),n[l]=a}});const t=document.querySelector("#schema-data");t.value=JSON.stringify(n);let e=document.querySelector(".diagnoseo-schema-generator");e.setAttribute("data-schema-data",t.value)}}buildSchemaForm(e){const t=document.createElement("div");return t.classList.add("diagnoseo-schema-form"),e.forEach(e=>{e=this.prepareField(e);t.appendChild(e)}),t.formConfig=e,t}}function permalinkWatcher(){"use strict";if(window.wp.data){var e,t=document.body.classList.contains("block-editor-page");const a=document.querySelector("#seo-slug"),l=document.querySelector(".editor-post-link input");a.addEventListener("input",e=>{const t=document.querySelector(".editor-post-link input");e=e.target.value;t&&t.value!==e&&(t.value=e,e=new Event("blur"),t.dispatchEvent(e))}),l&&(l.addEventListener("input",e=>{a.value!==e.target.value&&(a.value=e.target.value)}),a.value&&l&&l.value!==a.value&&(l.value=a.value,e=new Event("blur"),l.dispatchEvent(e))),t&&window.wp.data.subscribe(function(){var e=window.wp.data.select("core/editor").isSavingPost(),t=window.wp.data.select("core/editor").isAutosavingPost();e&&!t&&setTimeout(()=>{const e=document.querySelector("#seo-slug"),t=document.querySelector(".editor-post-link input");var a;e.value&&t?(a=seoHelper.slugify(e.value),e.value=a,t.value=a,a=new Event("blur"),t.dispatchEvent(a)):!e.value&&t&&(a=seoHelper.slugify(t.value),e.value=a)},500)})}}document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".diagnoseo-image-select");e.forEach(i=>{const e=i.querySelector(".diagnoseo-img-upload"),l=i.querySelector(".diagnoseo-img-remove");e&&e.addEventListener("click",e=>{e.preventDefault();const l=wp.media({title:"Custom Image",button:{text:"Select Image"},multiple:!1}).on("select",()=>{var e=l.state().get("selection").first().toJSON();const t=i.querySelector(".diagnoseo-img"),a=i.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",e.url),a&&(a.value=e.url)}).open()}),l&&l.addEventListener("click",e=>{e.preventDefault();const t=i.querySelector(".diagnoseo-img"),a=i.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",l.dataset.fallbackImage||""),a&&(a.value="")})})}),window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(permalinkWatcher,500)});const schemaGeneratorInit=function(){var e,o="",t="";const a=function(e,t=!1){var a=null,l={},i=document.querySelector(".diagnoseo-schema-generator");i&&(l=(l=i.dataset.schemaData)&&JSON.parse(l));const n=["Article","NewsArticle","BlogPosting"];if(!t&&n.includes(e)&&n.includes(o))return o=e,!1;switch(o=e){case"Article":case"NewsArticle":case"BlogPosting":a=articleSchemaForm(l);break;case"Review":a=reviewSchemaForm(l);break;case"Service":a=serviceSchemaForm(l);break;case"Product":a=productSchemaForm(l);break;case"Course":a=courseSchemaForm(l);break;case"Recipe":a=recipeSchemaForm(l);break;case"Person":a=personSchemaForm(l);break;case"JobPosting":a=jobPostingSchemaForm(l);break;case"SoftwareApplication":a=appSchemaForm(l);break;case"Book":a=bookSchemaForm(l);break;case"Event":a=eventSchemaForm(l);break;case"VideoObject":a=videoSchemaForm(l);break;case"ImageObject":a=imageSchemaForm(l);break;case"WebPage":a=webPageSchemaForm(l);break;case"AboutPage":a=aboutPageSchemaForm(l);break;case"FAQPage":a=faqPageSchemaForm(l);break;case"ContactPage":a=contactPageSchemaForm(l);break;default:a=null}const r=document.querySelector(".diagnoseo-schema-fields");return a?(r&&(r.innerHTML="",r.appendChild(a)),!0):(r&&(r.innerHTML=""),!1)},l=function(){const t=document.querySelector(".diagnoseo-schema-generator");if(t){var{schemaData:a}=t.dataset;if(a)for(prop in a=JSON.parse(a)){var l=prop.replaceAll("_","-");let e=t.querySelector(`#${l}`);e&&!e.value&&(e.value=a[prop])}}},i=document.querySelector("#schema-type");i&&(i.addEventListener("change",e=>{a(e.target.value)&&l()}),(e=document.querySelector(".diagnoseo-schema-generator"))&&(t=e.dataset.defaultSchemaType),o=i.value||""),a(o||t,!0),l()};window.addEventListener("load",schemaGeneratorInit);const aboutPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},appSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"operating-system",type:"text",value:e.operating_system||"",label:"Operating system"},{fieldType:"input",name:"app-category",type:"text",value:e.app_category||"",label:"Application category",hint:"Example: Multimedia, Game"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Currency"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"input",name:"rating-count",type:"number",value:e.rating_count,label:"Rating count"}];return t.buildSchemaForm(e)},articleSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"headline",type:"text",value:e.headline||"",label:"Headline"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"keywords",type:"text",value:e.keywords||"",label:"Keywords"}];return t.buildSchemaForm(e)},bookSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"input",name:"url",type:"url",value:e.url||"",label:"URL"},{fieldType:"input",name:"author-name",type:"text",value:e.author_name||"",label:"Author name"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"}];return t.buildSchemaForm(e)},contactPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},courseSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Course name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Course description"},{fieldType:"sectionTitle",text:"Provider"},{fieldType:"select",name:"provider-type",value:e.provider_type,label:"Provider type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"provider-name",type:"text",value:e.provider_name||"",label:"Provider name"},{fieldType:"input",name:"provider-url",type:"text",value:e.provider_url||"",label:"Provider URL"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},eventSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"type",value:e.type,options:[{value:"Event",label:"Event"},{value:"BusinessEvent",label:"Business Event"},{value:"ChildrensEvent",label:"Childrens Event"},{value:"ComedyEvent",label:"Comedy Event"},{value:"DanceEvent",label:"Dance Event"},{value:"DeliveryEvent",label:"Delivery Event"},{value:"EducationEvent",label:"Education Event"},{value:"ExhibitionEvent",label:"Exhibition Event"},{value:"Festival",label:"Festival"},{value:"FoodEvent",label:"Food Event"},{value:"LiteraryEvent",label:"Literary Event"},{value:"MusicEvent",label:"Music Event"},{value:"PublicationEvent",label:"Publication Event"},{value:"SaleEvent",label:"Sale Event"},{value:"ScreeningEvent",label:"Screening Event"},{value:"SocialEvent",label:"Social Event"},{value:"SportsEvent",label:"Sports Event"},{value:"TheaterEvent",label:"Theater Event"},{value:"VisualArtsEvent",label:"Visual Arts Event"}],label:"Event type"},{fieldType:"select",name:"status",value:e.status,options:[{value:"",label:"None"},{value:"EventScheduled",label:"Scheduled"},{value:"EventCancelled",label:"Cancelled"},{value:"EventPostponed",label:"Postponed"},{value:"EventRescheduled",label:"Rescheduled"},{value:"EventMovedOnline",label:"Moved Online"}],label:"Event status"},{fieldType:"select",name:"mode",value:e.mode,options:[{value:"OfflineEventAttendanceMode",label:"Offline"},{value:"OnlineEventAttendanceMode",label:"Online"},{value:"MixedEventAttendanceMode",label:"Mixed (Offline + Online)"}],label:"Attendance mode"},{fieldType:"input",name:"date-start",type:"date",value:e.date_start,label:"Start date"},{fieldType:"input",name:"date-end",type:"date",value:e.date_end,label:"End date"},{fieldType:"sectionTitle",text:"Venue"},{fieldType:"input",name:"venue-name",type:"text",value:e.venue_name||"",label:"Venue name"},{fieldType:"input",name:"venue-url",type:"url",value:e.venue_url||"",label:"Venue URL"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"},{fieldType:"sectionTitle",text:"Performer"},{fieldType:"select",name:"performer-type",value:e.performer_type,options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}],label:"Performer"},{fieldType:"input",name:"performer-name",type:"text",value:e.performer_name||"",label:"Performer name"},{fieldType:"input",name:"performer-url",type:"url",value:e.performer_url||"",label:"Performer website or social link"},{fieldType:"sectionTitle",text:"Organizer"},{fieldType:"select",name:"organizer-type",value:e.organizer_type,options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}],label:"Organizer"},{fieldType:"input",name:"organizer-name",type:"text",value:e.organizer_name||"",label:"Organizer name"},{fieldType:"input",name:"organizer-url",type:"url",value:e.organizer_url||"",label:"Organizer website or social link"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-url",type:"url",value:e.offer_url||"",label:"Offer URL"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Offer price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Offer currency"},{fieldType:"select",name:"offer-availability",value:e.offer_availability,options:[{value:"InStock",label:"In Stock"},{value:"SoldOut",label:"Sold Out"},{value:"Preorder",label:"Preorder"}],label:"Availability"},{fieldType:"input",name:"price-valid-from",type:"date",value:e.price_valid_from,label:"Price valid from"},{fieldType:"input",name:"inv-level",type:"text",value:e.inv_level||"",label:"Inventory level"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"}];return t.buildSchemaForm(e)},faqPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"main-question",type:"text",value:e.main_question||"",label:"Main entity - question"},{fieldType:"textarea",name:"main-answer",type:"text",value:e.main_answer||"",label:"Main entity - answer"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},imageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"location",type:"text",value:e.location||"",label:"Location",hint:"Name of the place where the picture was taken, for example: Manhattan, New York"}];return t.buildSchemaForm(e)},jobPostingSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"salary-currency",type:"text",value:e.salary_currency||"",label:"Salary currency",hint:"ISO 4217 Currency code. Example: EUR"},{fieldType:"input",name:"salary-amount",type:"text",value:e.salary_amount||"",label:"Salary amount",hint:"Insert amount, e.g. 100.00, or a salary range, e.g. 120.00-160.00"},{fieldType:"select",name:"salary-payroll",value:e.salary_payroll,label:"Payroll",options:[{value:"None",label:""},{value:"Yearly",label:"YEAR"},{value:"Monthly",label:"MONTH"},{value:"Weekly",label:"WEEK"},{value:"Daily",label:"DAY"},{value:"Hourly",label:"HOUR"}]},{fieldType:"input",name:"date-posted",type:"date",value:e.date_posted,label:"Date posted",hint:"Choose date, post publication date will be used if this field is empty"},{fieldType:"input",name:"date-expires",type:"date",value:e.date_expires,label:"Expiry date",hint:"Leave empty if the job posting does not expire"},{fieldType:"select",name:"employment-type",value:e.employment_type,label:"Employment type",options:[{value:"FULL_TIME",label:"Full Time"},{value:"PART_TIME",label:"Part Time"},{value:"CONTRACTOR",label:"Contractor"},{value:"TEMPORARY",label:"Temporary"},{value:"INTERN",label:"Intern"},{value:"VOLUNTEER",label:"Volunteer"},{value:"PER_DIEM",label:"Per Diem"},{value:"OTHER",label:"Other"}]},{fieldType:"input",name:"posting-id",type:"text",value:e.posting_id||"",label:"Posting ID"},{fieldType:"sectionTitle",text:"Hiring organization"},{fieldType:"input",name:"company",type:"text",value:e.company||"",label:"Hiring organization"},{fieldType:"input",name:"org-url",type:"url",value:e.org_url||"",label:"Organization URL"},{fieldType:"input",name:"org-logo",type:"url",value:e.org_logo||"",label:"Organization logo URL"},{fieldType:"sectionTitle",text:"Job location"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"}];return t.buildSchemaForm(e)},personSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"email",type:"email",value:e.email||"",label:"E-mail"},{fieldType:"input",name:"gender",type:"text",value:e.gender||"",label:"Gender"},{fieldType:"input",name:"job-title",type:"text",value:e.job_title||"",label:"Job title"},{fieldType:"input",name:"url",type:"url",value:e.url||"",label:"URL"},{fieldType:"input",name:"image",type:"url",value:e.url||"",label:"Image URL"},{fieldType:"sectionTitle",text:"Address"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"}];return t.buildSchemaForm(e)},productSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Product name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Product description"},{fieldType:"input",name:"sku",type:"text",value:e.sku||"",label:"Product SKU"},{fieldType:"input",name:"identifier_name",type:"text",value:e.identifier_name||"",label:"Global identifier",hint:"GTIN, MPN, ISBN or other"},{fieldType:"input",name:"identifier_value",type:"text",value:e.identifier_value||"",label:"Global identifier value"},{fieldType:"input",name:"brand",type:"text",value:e.brand||"",label:"Brand name"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"price",type:"number",value:e.price,label:"Price",step:"0.01"},{fieldType:"input",name:"currency",type:"text",value:e.currency||"",label:"Currency"},{fieldType:"input",name:"deadline",type:"date",value:e.deadline,label:"Price valid until"},{fieldType:"select",name:"availability",value:e.availability,options:[{label:"In Stock",value:"InStock"},{label:"Sold Out",value:"SoldOut"},{label:"Preorder",value:"Preorder"}],label:"Availability"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"sectionTitle",text:"Review publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},recipeSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Recipe title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Recipe description"},{fieldType:"input",name:"prep-time",type:"text",value:e.prep_time||"",label:"Preparation time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"cook-time",type:"text",value:e.cook_time||"",label:"Cooking time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"total-time",type:"text",value:e.total_time||"",label:"Total time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"type",type:"text",value:e.type||"",label:"Type of dish",hint:"Example: appetizer or dessert"},{fieldType:"input",name:"cuisine",type:"text",value:e.cuisine||"",label:"Cuisine"},{fieldType:"input",name:"keywords",type:"text",value:e.keywords||"",label:"Keywords"},{fieldType:"input",name:"yield",type:"text",value:e.yield||"",label:"Recipe yield",hint:"Quantity of portions produced by the recipe, for example: 4"},{fieldType:"input",name:"calories",type:"number",value:e.calories,label:"Calories"},{fieldType:"textarea",name:"ingredients",value:e.ingredients?e.ingredients.join("; "):"",label:"Ingredients",hint:"Separate ingredients with semicolons (;)",splitLines:";"},{fieldType:"textarea",name:"instructions",value:e.instructions?e.instructions.join("; "):"",label:"Recipe instructions",hint:"Separate instructions with semicolons (;)",splitLines:";"},{fieldType:"sectionTitle",text:"Aggregate Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-count",type:"number",value:e.rating_count,label:"Rating count"},{fieldType:"sectionTitle",text:"Video"},{fieldType:"input",name:"video-title",type:"text",value:e.video_title||"",label:"Video title"},{fieldType:"textarea",name:"video-description",value:e.video_description||"",label:"Video description"},{fieldType:"input",name:"video-url",type:"url",value:e.video_url||"",label:"Video URL"},{fieldType:"input",name:"video-content-url",type:"url",value:e.video_content_url||"",label:"Video content URL",hint:"A URL pointing to the actual video media file"},{fieldType:"input",name:"video-thumbnail",type:"url",value:e.video_thumbnail||"",label:"Video thumbnail URL"},{fieldType:"input",name:"video-duration",type:"text",value:e.video_duration||"",label:"Video duration",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"video-uploaded",type:"date",value:e.video_uploaded,label:"Video upload date"}];return t.buildSchemaForm(e)},reviewSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Review title"},{fieldType:"sectionTitle",text:"Reviewed item"},{fieldType:"select",name:"reviewed-item",value:e.reviewed_item,label:"Reviewed item",options:[{value:"Book",label:"Book"},{value:"Course",label:"Course"},{value:"Event",label:"Event"},{value:"How-to",label:"How-to"},{value:"LocalBusiness",label:"Local Business"},{value:"Movie",label:"Movie"},{value:"Product",label:"Product"},{value:"Recipe",label:"Recipe"},{value:"SoftwareApp",label:"Software App"}]},{fieldType:"input",name:"reviewed-item-image",type:"url",value:e.reviewed_item_image||"",label:"Reviewed item image URL"},{fieldType:"input",name:"reviewed-item-name",type:"text",value:e.reviewed_item_name||"",label:"Reviewed item name"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",step:"0.01",value:e.rating,label:"Rating value"},{fieldType:"textarea",name:"review-body",value:e.review_body||"",label:"Review text"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},serviceSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"service-type",type:"text",value:e.service_type||"",label:"Service type"},{fieldType:"input",name:"service-name",type:"text",value:e.service_name||"",label:"Name"},{fieldType:"textarea",name:"service-description",value:e.service_description||"",label:"Service description"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Currency"}];return t.buildSchemaForm(e)},videoSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"embed-url",type:"url",value:e.embed_url||"",label:"Embed URL",hint:"A URL pointing to the embeddable player for the video. Example: https://www.youtube.com/embed/VIDEOID"},{fieldType:"input",name:"content-url",type:"url",value:e.content_url||"",label:"Content URL",hint:"A URL pointing to the actual video media file like MP4, MOV, etc. Please leave it empty if you don't know the URL"},{fieldType:"input",name:"duration",type:"text",value:e.duration||"",label:"Duration",hint:"ISO 8601 duration format. Example: PT1H30M"}];return t.buildSchemaForm(e)},webPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)};function initSerpSimulator(){"use strict";const r=document.body.classList.contains("block-editor-page"),o=document.querySelector(".diagnoseo-preview");if(!o)return;const l=o.querySelector(".search-result .search-result-title"),a=o.querySelector(".search-result.mobile .search-result-title"),i=o.querySelector(".search-result .search-result-descr"),n=o.querySelector(".search-result.mobile .search-result-descr"),e=document.querySelector(".diagnoseo-meta-form")||document.querySelector(".diagnoseo-settings-form"),u=e.querySelector("#seo-title")||e.querySelector("#diagnoseo_home_title"),s=e.querySelector(".info-title-chars"),p=e.querySelector(".info-title-width"),c=e.querySelector(".seo-title-progress .diagnoseo-progress-fill"),d=e.querySelector("#seo-description")||e.querySelector("#diagnoseo_home_description"),m=e.querySelector(".info-descr-chars"),v=e.querySelector(".info-descr-width"),y=e.querySelector(".seo-descr-progress .diagnoseo-progress-fill"),b=e.querySelector("#seo-slug"),f=e.querySelector(".info-slug-chars"),g=e.querySelector(".seo-slug-progress .diagnoseo-progress-fill"),h=o.querySelector(".title-sample"),T=o.querySelector(".description-sample"),t=function(){for(var e=!1;function(){var e=l.offsetWidth-20;l.style.maxWidth="none",l.style.position="absolute";var t=l.offsetWidth;return l.removeAttribute("style"),e<t}();){var t=S(l.textContent);if(!t)break;t=(t=(t=t.replace(/\/$/," ...")).split(" ").slice(0,-1).join(" ")).replace(/,\s*$/,""),e=!0,l.textContent=t,a.textContent=t}e&&(l.textContent=l.textContent+" ...",a.textContent=a.textContent+" ...")},x=function(e,t,a=0){const l=e.split(" "),i=T;if(!i)return e;e=function(e,t){for(var a,l="",i=e.split(" "),n=0;n<i.length;n++)if(a=l,(l+=" "+i[n]).length>t){l=a+" ...";break}return l=l.replace(/,\s*$/,"")}(e,a),i.textContent=e;for(var n=!1;i.clientWidth>t;){l.pop();var n=!0,r=l.join(" ");i.textContent=r}return n?l.join(" ")+" ...":e},w=function(e){var t=S(e),e=x(t,960,158);i.textContent=e;e=x(t,680,158);n.textContent=e,T.textContent=t},S=function(e){if(!e)return"";var{site:t,siteTagline:a,separator:l,excerpt:i,postTitle:n}=o.dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",r?window.wp.data.select("core/editor").getEditedPostAttribute("title"):n)).replaceAll("%sitename%",t)).replaceAll("%tagline%",a)).replaceAll("%sep%",l)).replaceAll(" %page%","")).replaceAll("%excerpt%",i||_())).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))},E=function(e){e=S(e),h.textContent=e||l.dataset.fallback,l.textContent=e||l.dataset.fallback,a.textContent=e||l.dataset.fallback,t()},_=function(){if(!window.wp||!window.wp.data)return"";let a=r?window.wp.data.select("core/editor").getEditedPostAttribute("excerpt"):o.dataset.excerpt;if(!a){let e=r?window.wp.data.select("core/editor").getEditedPostContent():"";e=seoHelper.stripTags(e).trim();let t=e.split(" ");var l=Math.min(t.length,55);t=t.splice(0,l),a=t.join(" ")}return a},P=function(){var e,t,a,l;c&&(e=h.clientWidth,l=h.textContent,100<(a=e/600*100)&&(a=100),(t=(l=S(l)).length)||(a=0),a+="%",l="",30<=t&&e<=600&&(30<=t&&t<35||60<t&&e<=600?l="medium":35<=t&&t<=60&&(l="full")),s.textContent=t,p.textContent=e,c.style.width=a,l?c.classList.contains(l)||(c.classList.remove("medium","full"),c.classList.add(l)):c.classList.remove("medium","full"))},A=function(){var e,t,a,l;y&&(l=T.textContent,e=T.clientWidth,t=l.length,100<(a=e/990*100)&&(a=100),d.value.length||d.getAttribute("placeholder")||(a=0),a+="%",l="",70<=t&&e<=990&&(70<=t&&t<130||158<t&&e<=990?l="medium":130<=t&&t<=158&&(l="full")),m.textContent=t,v.textContent=e,y.style.width=a,l?y.classList.contains(l)||(y.classList.remove("medium","full"),y.classList.add(l)):y.classList.remove("medium","full"))},L=function(){var e,t,a;g&&(t="",(a=(e=(e=b.value).replaceAll(" ","-")).split("-")).length<=5&&e.length?e.length<=50?t="full":50<e.length&&e.length<=60&&(t="medium"):5<a.length&&e.length<60&&(t="medium"),100<(a=Math.round(e.length/60*100))&&(a=100),g.style.width=a+"%",f.textContent=e.length,t?g.classList.contains(t)||(g.classList.remove("medium","full"),g.classList.add(t)):g.classList.remove("medium","full"))};u&&(u.addEventListener("input",function(e){E(e.target.value),h.textContent=S(e.target.value),r&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_title:e.target.value}}),P()}),E(u.value||u.getAttribute("placeholder")),P());const k=l.dataset.fallback;r?window.wp.data.subscribe(()=>{var e=window.wp.data.select("core/editor").getEditedPostAttribute("title")||o.dataset.postTitle;l.dataset.fallback=e||k;var t=u.value||u.getAttribute("placeholder");E(t),P();const a=document.querySelector("#postlist-title");!(window.wp.data.select("core/editor").getEditedPostAttribute("meta")?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:e)&&a&&a.setAttribute("placeholder",e)}):u&&u.addEventListener("input",e=>{var t=r?window.wp.data.select("core/editor").getEditedPostAttribute("title"):o.dataset.postTitle;l.dataset.fallback=t||k;e=e.target.value||e.target.value.getAttribute("placeholder");E(e),P();const a=document.querySelector("#postlist-title");!(r?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:t)&&a&&a.setAttribute("placeholder",t)}),d&&(d.addEventListener("input",function(e){w(e.target.value||e.target.getAttribute("placeholder")),r&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_description:e.target.value}}),A()}),w(d.value||d.getAttribute("placeholder")),A()),b&&b.addEventListener("input",e=>{r&&window.wp.data.dispatch("core/editor").editPost({slug:seoHelper.slugify(e.target.value)}),L()});const C=document.querySelectorAll(".diagnoseo-var-input");C&&C.forEach(e=>{const l=e.querySelector(".var-input"),i=e.querySelector(".var-select"),t=e.querySelector(".var-button");t.addEventListener("click",e=>{e.preventDefault();var t,a=i.value;a&&(l.selectionStart||"0"==l.selectionStart?(t=l.selectionStart,e=l.selectionEnd,l.value=l.value.substring(0,t)+" "+a+l.value.substring(e,l.value.length)):l.value+=a,l.dispatchEvent(new Event("input")))})}),setTimeout(function(){t(),P(),A(),L()},500)}window._wpLoadBlockEditor?window._wpLoadBlockEditor.then(function(){setTimeout(initSerpSimulator,500)}):window.addEventListener("load",initSerpSimulator);const startSocialPreview=function(){ const{select:m,dispatch:l,subscribe:e}=window.wp.data,t=document.querySelectorAll(".diagnoseo-social-meta"),a=document.body.classList.contains("block-editor-page");if(t){const v=document.querySelector("#facebook-title"),y=document.querySelector("#twitter-title"),b=document.querySelector("#facebook-description"),f=document.querySelector("#twitter-description"),g=document.querySelector("#seo-title"),h=document.querySelector("#seo-description");if(g.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");v.setAttribute("placeholder",e),y.setAttribute("placeholder",e)}),h.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");b.setAttribute("placeholder",e),f.setAttribute("placeholder",e)}),t.forEach(e=>{e.addEventListener("input",e=>{a&&function(e,t){const a={};a[e]=t,l("core/editor").editPost({meta:a})}(e.target.dataset.customField,e.target.value)})}),a)e(()=>{const e=m("core/editor");var t=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_title||v.value||g.value||v.getAttribute("placeholder"),a=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_description||b.value||h.value||h.getAttribute("placeholder"),l=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_title||y.value||g.value||y.getAttribute("placeholder"),i=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_description||f.value||h.value||h.getAttribute("placeholder"),n=e.getEditedPostAttribute("featured_media");const r=document.querySelectorAll(".diagnoseo-social-preview"),o=document.querySelector(".preview-facebook"),u=document.querySelector(".preview-twitter"),s=o.querySelector(".facebook-post-title");s&&(s.textContent=seoHelper.replaceVariables(t));const p=o.querySelector(".facebook-post-description");p&&(p.textContent=seoHelper.replaceVariables(a));const c=u.querySelector(".twitter-post-title");c&&(c.textContent=seoHelper.replaceVariables(l));const d=u.querySelector(".twitter-post-description");d&&(d.textContent=seoHelper.replaceVariables(i)),r.forEach(e=>{var t=n?m("core").getMedia(n):null,t=t?t.guid.raw:e.dataset.placeholderImage;const a=e.querySelector(".preview-image img");a.setAttribute("src",t)})});else{const i=document.querySelector(".preview-facebook"),n=document.querySelector(".preview-twitter"),r=i.querySelector(".facebook-post-title"),o=i.querySelector(".facebook-post-description"),u=n.querySelector(".twitter-post-title"),s=n.querySelector(".twitter-post-description");r.textContent=seoHelper.replaceVariables(i.dataset.facebookTitle),o.textContent=seoHelper.replaceVariables(i.dataset.facebookDescription),u.textContent=seoHelper.replaceVariables(n.dataset.twitterTitle),s.textContent=seoHelper.replaceVariables(n.dataset.twitterDescription),v.addEventListener("input",e=>{e=e.target.value;r&&(r.textContent=seoHelper.replaceVariables(e))}),b.addEventListener("input",e=>{e=e.target.value;o&&(o.textContent=seoHelper.replaceVariables(e))}),y.addEventListener("input",e=>{e=e.target.value;u&&(u.textContent=seoHelper.replaceVariables(e))}),f.addEventListener("input",e=>{e=e.target.value;s&&(s.textContent=seoHelper.replaceVariables(e))})}}};window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(startSocialPreview,500)}),document.body.classList.contains("block-editor-page")||window.addEventListener("load",startSocialPreview),jQuery(document).on("ready",function(){jQuery(".toggle").each(function(){const t=jQuery(this).find(".toggle-trigger"),a=jQuery(this).find(".toggle-content");t.on("click",function(e){e.preventDefault(),a.slideToggle(),t.toggleClass("open")})})});1 const seoHelper={slugify:function(e){e=(e=e.replace(/^\s+|\s+$/g,"")).toLowerCase();for(var t="àáãäâąèéëêęìíïîóòóöôùúüûñńśçćźżł·/_,:;",a=0,l=t.length;a<l;a++)e=e.replace(new RegExp(t.charAt(a),"g"),"aaaaaaeeeeeiiiiooooouuuunnscczzl------".charAt(a));return e=e.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},countOccurences:function(e,t){if(!t||!e)return 0;t=t.toLowerCase().replaceAll(/[:;,.!?-]/g,""),e=e.toLowerCase();e=new RegExp(e,"g");return(t.match(e)||[]).length},countSyllables:function(e){if(""===e)return 0;if(e.length<=3)return 1;e=(e=(e=(e=e.toLowerCase()).replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,"")).replace(/^y/,"")).match(/[aeiouy]{1,2}/g);return e?e.length:0},countWords:function(e){e=(e=(e=e.replace(/(\r\n|\n|\r)/gm," ")).replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g," ")).split(" ");return(e=(e=e.map(e=>e.trim())).filter(e=>e&&""!==e&&"\n"!==e)).length||0},countElements:function(e,t){if(!e||!t)return 0;const a=document.createElement("div");return a.innerHTML=e,a.querySelectorAll(t).length},replaceVariables:function(e){if(e){var{site:t,siteTagline:a,separator:l,excerpt:i,postTitle:n}=document.querySelector(".diagnoseo-preview").dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",document.body.classList.contains("block-editor-page")?window.wp.data.select("core/editor").getEditedPostAttribute("title"):n)).replaceAll("%sitename%",t)).replaceAll("%tagline%",a)).replaceAll("%sep%",l)).replaceAll("%page%"," ")).replaceAll("%excerpt%",i)).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))}},isKeywordInText:function(e,t){if(!e||!t)return!1;e=e.toLowerCase();let a=(t=t.toLowerCase()).toLowerCase().replaceAll(/[:;,.!?-]/g,"");return t.includes(e)||a.includes(e)},isKeywordInAnyElement:function(t,e,a){if(!t||!e||!a)return!1;var l=!1;const i=seoHelper.createMarkupEl(e);return elements=i.querySelectorAll(a),elements.forEach(e=>{seoHelper.isKeywordInText(t,e.textContent)&&(l=!0)}),l},isKeywordInAnyAlt:function(t,e,a=null){if(!t)return!1;if(a&&seoHelper.isKeywordInText(t,a.alt_text))return!0;var l=0;const i=seoHelper.createMarkupEl(e),n=i.querySelectorAll("img");return n.forEach(e=>{e=e.getAttribute("alt").toLowerCase();l+=seoHelper.countOccurences(t,e)}),l},createMarkupEl:function(e){const t=document.createElement("div");return t.innerHTML=e,t},stripTags:function(e){return e.replace(/(<([^>]+)>)/gi,"")}};class diagnoseoFormHelper{input(e,t,a,l="text",i=!1,n="1",r={}){const o=document.createElement("input");for(var u in this.setAttributes(o,{type:l,name:e,id:e,class:a||"components-textarea-control__input widefat",value:t,step:"number"===l?n:""}),i&&o.setAttribute("required","required"),r)o.addEventListener(u,r[u]);return o.addEventListener("input",this.saveSchemaData),o}textarea(e,t,a,l=!1,i={}){const n=document.createElement("textarea");for(var r in this.setAttributes(n,{name:e,id:e,class:a||"components-textarea-control__input widefat"}),n.value=t,l&&n.setAttribute("required","required"),i)n.addEventListener(r,i[r]);return n.addEventListener("input",this.saveSchemaData),n}select(e,a,t,l,i=!1,n={}){const r=document.createElement("select");for(var o in r.value=a,this.setAttributes(r,{name:e,id:e,class:l||"widefat"}),i&&r.setAttribute("required","required"),t.forEach(e=>{const t=document.createElement("option");t.setAttribute("value",e.value),t.textContent=e.label,e.value===a&&t.setAttribute("selected","selected"),r.appendChild(t)}),n)r.addEventListener(o,n[o]);return r.addEventListener("change",this.saveSchemaData),r}button(e,t,a,l,i="",n={}){const r=document.createElement("button");for(var o in r.textContent=a,this.setAttributes(r,{name:e,id:e,class:l,value:t,type:i||""}),n)r.addEventListener(o,n[o]);return r}sectionTitle(e){if(e){const t=document.createElement("h3");return t.classList.add("components-base-control__heading"),t.textContent=e,t}}wrapField(e,t,a="",l="components-base-control__field"){const i=document.createElement("div");l&&i.classList.add(l);const n=document.createElement("label");if(n.classList.add("components-base-control__label"),n.setAttribute("for",e.getAttribute("id")),n.textContent=t,e.getAttribute("required")){const r=document.createElement("span");r.classList.add("req"),r.textContent="*",n.appendChild(r)}if(i.appendChild(n),i.appendChild(e),a){const o=document.createElement("p");o.classList.add("hint"),o.textContent=a,i.appendChild(o)}return i}setAttributes(e,t){for(var a in t)e.setAttribute(a,t[a])}prepareField(e){var t,{fieldType:a,label:l,name:i,value:n,type:r,className:o,options:u,listeners:s,required:p,hint:e,text:c,step:d}=e;switch(a){case"input":t=this.input(i,n,o,r,p,d,s);break;case"textarea":t=this.textarea(i,n,o,p,s);break;case"select":t=this.select(i,n,u,o,p,s);break;case"button":t=this.button(i,n,l,o,r,s);break;case"sectionTitle":t=this.sectionTitle(c)}return"button"===a||"sectionTitle"===a?t:this.wrapField(t,l,e)}saveSchemaData(e){const i=e.target.closest(".diagnoseo-schema-form");if(i){const n={};i.formConfig.forEach(t=>{if("sectionTitle"!==t.fieldType){let e=t.name;var l=e.replaceAll("-","_");let a=i.querySelector(`#${e}`).value||"";t.splitLines&&(a=a.split(t.splitLines),a.forEach((e,t)=>{a[t]=e.trim()})),n[l]=a}});const t=document.querySelector("#schema-data");t.value=JSON.stringify(n);let e=document.querySelector(".diagnoseo-schema-generator");e.setAttribute("data-schema-data",t.value)}}buildSchemaForm(e){const t=document.createElement("div");return t.classList.add("diagnoseo-schema-form"),e.forEach(e=>{e=this.prepareField(e);t.appendChild(e)}),t.formConfig=e,t}}function permalinkWatcher(){"use strict";if(window.wp.data){var e,t=document.body.classList.contains("block-editor-page");const a=document.querySelector("#seo-slug"),l=document.querySelector(".editor-post-link input");a.addEventListener("input",e=>{const t=document.querySelector(".editor-post-link input");e=e.target.value;t&&t.value!==e&&(t.value=e,e=new Event("blur"),t.dispatchEvent(e))}),l&&(l.addEventListener("input",e=>{a.value!==e.target.value&&(a.value=e.target.value)}),a.value&&l&&l.value!==a.value&&(l.value=a.value,e=new Event("blur"),l.dispatchEvent(e))),t&&window.wp.data.subscribe(function(){var e=window.wp.data.select("core/editor").isSavingPost(),t=window.wp.data.select("core/editor").isAutosavingPost();e&&!t&&setTimeout(()=>{const e=document.querySelector("#seo-slug"),t=document.querySelector(".editor-post-link input");var a;e.value&&t?(a=seoHelper.slugify(e.value),e.value=a,t.value=a,a=new Event("blur"),t.dispatchEvent(a)):!e.value&&t&&(a=seoHelper.slugify(t.value),e.value=a)},500)})}}document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".diagnoseo-image-select");e.forEach(i=>{const e=i.querySelector(".diagnoseo-img-upload"),l=i.querySelector(".diagnoseo-img-remove");e&&e.addEventListener("click",e=>{e.preventDefault();const l=wp.media({title:"Custom Image",button:{text:"Select Image"},multiple:!1}).on("select",()=>{var e=l.state().get("selection").first().toJSON();const t=i.querySelector(".diagnoseo-img"),a=i.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",e.url),a&&(a.value=e.url)}).open()}),l&&l.addEventListener("click",e=>{e.preventDefault();const t=i.querySelector(".diagnoseo-img"),a=i.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",l.dataset.fallbackImage||""),a&&(a.value="")})})}),window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(permalinkWatcher,500)});const schemaGeneratorInit=function(){var e,o="",t="";const a=function(e,t=!1){var a=null,l={},i=document.querySelector(".diagnoseo-schema-generator");i&&(l=(l=i.dataset.schemaData)&&JSON.parse(l));const n=["Article","NewsArticle","BlogPosting"];if(!t&&n.includes(e)&&n.includes(o))return o=e,!1;switch(o=e){case"Article":case"NewsArticle":case"BlogPosting":a=articleSchemaForm(l);break;case"Review":a=reviewSchemaForm(l);break;case"Service":a=serviceSchemaForm(l);break;case"Product":a=productSchemaForm(l);break;case"Course":a=courseSchemaForm(l);break;case"Recipe":a=recipeSchemaForm(l);break;case"Person":a=personSchemaForm(l);break;case"JobPosting":a=jobPostingSchemaForm(l);break;case"SoftwareApplication":a=appSchemaForm(l);break;case"Book":a=bookSchemaForm(l);break;case"Event":a=eventSchemaForm(l);break;case"VideoObject":a=videoSchemaForm(l);break;case"ImageObject":a=imageSchemaForm(l);break;case"WebPage":a=webPageSchemaForm(l);break;case"AboutPage":a=aboutPageSchemaForm(l);break;case"FAQPage":a=faqPageSchemaForm(l);break;case"ContactPage":a=contactPageSchemaForm(l);break;default:a=null}const r=document.querySelector(".diagnoseo-schema-fields");return a?(r&&(r.innerHTML="",r.appendChild(a)),!0):(r&&(r.innerHTML=""),!1)},l=function(){const t=document.querySelector(".diagnoseo-schema-generator");if(t){var{schemaData:a}=t.dataset;if(a)for(prop in a=JSON.parse(a)){var l=prop.replaceAll("_","-");let e=t.querySelector(`#${l}`);e&&!e.value&&(e.value=a[prop])}}},i=document.querySelector("#schema-type");i&&(i.addEventListener("change",e=>{a(e.target.value)&&l()}),(e=document.querySelector(".diagnoseo-schema-generator"))&&(t=e.dataset.defaultSchemaType),o=i.value||""),a(o||t,!0),l()};window.addEventListener("load",schemaGeneratorInit);const aboutPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},appSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"operating-system",type:"text",value:e.operating_system||"",label:"Operating system"},{fieldType:"input",name:"app-category",type:"text",value:e.app_category||"",label:"Application category",hint:"Example: Multimedia, Game"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Currency"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"input",name:"rating-count",type:"number",value:e.rating_count,label:"Rating count"}];return t.buildSchemaForm(e)},articleSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"headline",type:"text",value:e.headline||"",label:"Headline"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"keywords",type:"text",value:e.keywords||"",label:"Keywords"}];return t.buildSchemaForm(e)},bookSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"input",name:"url",type:"url",value:e.url||"",label:"URL"},{fieldType:"input",name:"author-name",type:"text",value:e.author_name||"",label:"Author name"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"}];return t.buildSchemaForm(e)},contactPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},courseSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Course name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Course description"},{fieldType:"sectionTitle",text:"Provider"},{fieldType:"select",name:"provider-type",value:e.provider_type,label:"Provider type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"provider-name",type:"text",value:e.provider_name||"",label:"Provider name"},{fieldType:"input",name:"provider-url",type:"text",value:e.provider_url||"",label:"Provider URL"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},eventSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"type",value:e.type,options:[{value:"Event",label:"Event"},{value:"BusinessEvent",label:"Business Event"},{value:"ChildrensEvent",label:"Childrens Event"},{value:"ComedyEvent",label:"Comedy Event"},{value:"DanceEvent",label:"Dance Event"},{value:"DeliveryEvent",label:"Delivery Event"},{value:"EducationEvent",label:"Education Event"},{value:"ExhibitionEvent",label:"Exhibition Event"},{value:"Festival",label:"Festival"},{value:"FoodEvent",label:"Food Event"},{value:"LiteraryEvent",label:"Literary Event"},{value:"MusicEvent",label:"Music Event"},{value:"PublicationEvent",label:"Publication Event"},{value:"SaleEvent",label:"Sale Event"},{value:"ScreeningEvent",label:"Screening Event"},{value:"SocialEvent",label:"Social Event"},{value:"SportsEvent",label:"Sports Event"},{value:"TheaterEvent",label:"Theater Event"},{value:"VisualArtsEvent",label:"Visual Arts Event"}],label:"Event type"},{fieldType:"select",name:"status",value:e.status,options:[{value:"",label:"None"},{value:"EventScheduled",label:"Scheduled"},{value:"EventCancelled",label:"Cancelled"},{value:"EventPostponed",label:"Postponed"},{value:"EventRescheduled",label:"Rescheduled"},{value:"EventMovedOnline",label:"Moved Online"}],label:"Event status"},{fieldType:"select",name:"mode",value:e.mode,options:[{value:"OfflineEventAttendanceMode",label:"Offline"},{value:"OnlineEventAttendanceMode",label:"Online"},{value:"MixedEventAttendanceMode",label:"Mixed (Offline + Online)"}],label:"Attendance mode"},{fieldType:"input",name:"date-start",type:"date",value:e.date_start,label:"Start date"},{fieldType:"input",name:"date-end",type:"date",value:e.date_end,label:"End date"},{fieldType:"sectionTitle",text:"Venue"},{fieldType:"input",name:"venue-name",type:"text",value:e.venue_name||"",label:"Venue name"},{fieldType:"input",name:"venue-url",type:"url",value:e.venue_url||"",label:"Venue URL"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"},{fieldType:"sectionTitle",text:"Performer"},{fieldType:"select",name:"performer-type",value:e.performer_type,options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}],label:"Performer"},{fieldType:"input",name:"performer-name",type:"text",value:e.performer_name||"",label:"Performer name"},{fieldType:"input",name:"performer-url",type:"url",value:e.performer_url||"",label:"Performer website or social link"},{fieldType:"sectionTitle",text:"Organizer"},{fieldType:"select",name:"organizer-type",value:e.organizer_type,options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}],label:"Organizer"},{fieldType:"input",name:"organizer-name",type:"text",value:e.organizer_name||"",label:"Organizer name"},{fieldType:"input",name:"organizer-url",type:"url",value:e.organizer_url||"",label:"Organizer website or social link"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-url",type:"url",value:e.offer_url||"",label:"Offer URL"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Offer price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Offer currency"},{fieldType:"select",name:"offer-availability",value:e.offer_availability,options:[{value:"InStock",label:"In Stock"},{value:"SoldOut",label:"Sold Out"},{value:"Preorder",label:"Preorder"}],label:"Availability"},{fieldType:"input",name:"price-valid-from",type:"date",value:e.price_valid_from,label:"Price valid from"},{fieldType:"input",name:"inv-level",type:"text",value:e.inv_level||"",label:"Inventory level"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"}];return t.buildSchemaForm(e)},faqPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"main-question",type:"text",value:e.main_question||"",label:"Main entity - question"},{fieldType:"textarea",name:"main-answer",type:"text",value:e.main_answer||"",label:"Main entity - answer"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},imageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"location",type:"text",value:e.location||"",label:"Location",hint:"Name of the place where the picture was taken, for example: Manhattan, New York"}];return t.buildSchemaForm(e)},jobPostingSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"salary-currency",type:"text",value:e.salary_currency||"",label:"Salary currency",hint:"ISO 4217 Currency code. Example: EUR"},{fieldType:"input",name:"salary-amount",type:"text",value:e.salary_amount||"",label:"Salary amount",hint:"Insert amount, e.g. 100.00, or a salary range, e.g. 120.00-160.00"},{fieldType:"select",name:"salary-payroll",value:e.salary_payroll,label:"Payroll",options:[{value:"None",label:""},{value:"Yearly",label:"YEAR"},{value:"Monthly",label:"MONTH"},{value:"Weekly",label:"WEEK"},{value:"Daily",label:"DAY"},{value:"Hourly",label:"HOUR"}]},{fieldType:"input",name:"date-posted",type:"date",value:e.date_posted,label:"Date posted",hint:"Choose date, post publication date will be used if this field is empty"},{fieldType:"input",name:"date-expires",type:"date",value:e.date_expires,label:"Expiry date",hint:"Leave empty if the job posting does not expire"},{fieldType:"select",name:"employment-type",value:e.employment_type,label:"Employment type",options:[{value:"FULL_TIME",label:"Full Time"},{value:"PART_TIME",label:"Part Time"},{value:"CONTRACTOR",label:"Contractor"},{value:"TEMPORARY",label:"Temporary"},{value:"INTERN",label:"Intern"},{value:"VOLUNTEER",label:"Volunteer"},{value:"PER_DIEM",label:"Per Diem"},{value:"OTHER",label:"Other"}]},{fieldType:"input",name:"posting-id",type:"text",value:e.posting_id||"",label:"Posting ID"},{fieldType:"sectionTitle",text:"Hiring organization"},{fieldType:"input",name:"company",type:"text",value:e.company||"",label:"Hiring organization"},{fieldType:"input",name:"org-url",type:"url",value:e.org_url||"",label:"Organization URL"},{fieldType:"input",name:"org-logo",type:"url",value:e.org_logo||"",label:"Organization logo URL"},{fieldType:"sectionTitle",text:"Job location"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"}];return t.buildSchemaForm(e)},personSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"email",type:"email",value:e.email||"",label:"E-mail"},{fieldType:"input",name:"gender",type:"text",value:e.gender||"",label:"Gender"},{fieldType:"input",name:"job-title",type:"text",value:e.job_title||"",label:"Job title"},{fieldType:"input",name:"url",type:"url",value:e.url||"",label:"URL"},{fieldType:"input",name:"image",type:"url",value:e.url||"",label:"Image URL"},{fieldType:"sectionTitle",text:"Address"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"}];return t.buildSchemaForm(e)},productSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Product name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Product description"},{fieldType:"input",name:"sku",type:"text",value:e.sku||"",label:"Product SKU"},{fieldType:"input",name:"identifier_name",type:"text",value:e.identifier_name||"",label:"Global identifier",hint:"GTIN, MPN, ISBN or other"},{fieldType:"input",name:"identifier_value",type:"text",value:e.identifier_value||"",label:"Global identifier value"},{fieldType:"input",name:"brand",type:"text",value:e.brand||"",label:"Brand name"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"price",type:"number",value:e.price,label:"Price",step:"0.01"},{fieldType:"input",name:"currency",type:"text",value:e.currency||"",label:"Currency"},{fieldType:"input",name:"deadline",type:"date",value:e.deadline,label:"Price valid until"},{fieldType:"select",name:"availability",value:e.availability,options:[{label:"In Stock",value:"InStock"},{label:"Sold Out",value:"SoldOut"},{label:"Preorder",value:"Preorder"}],label:"Availability"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"sectionTitle",text:"Review publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},recipeSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Recipe title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Recipe description"},{fieldType:"input",name:"prep-time",type:"text",value:e.prep_time||"",label:"Preparation time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"cook-time",type:"text",value:e.cook_time||"",label:"Cooking time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"total-time",type:"text",value:e.total_time||"",label:"Total time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"type",type:"text",value:e.type||"",label:"Type of dish",hint:"Example: appetizer or dessert"},{fieldType:"input",name:"cuisine",type:"text",value:e.cuisine||"",label:"Cuisine"},{fieldType:"input",name:"keywords",type:"text",value:e.keywords||"",label:"Keywords"},{fieldType:"input",name:"yield",type:"text",value:e.yield||"",label:"Recipe yield",hint:"Quantity of portions produced by the recipe, for example: 4"},{fieldType:"input",name:"calories",type:"number",value:e.calories,label:"Calories"},{fieldType:"textarea",name:"ingredients",value:e.ingredients?e.ingredients.join("; "):"",label:"Ingredients",hint:"Separate ingredients with semicolons (;)",splitLines:";"},{fieldType:"textarea",name:"instructions",value:e.instructions?e.instructions.join("; "):"",label:"Recipe instructions",hint:"Separate instructions with semicolons (;)",splitLines:";"},{fieldType:"sectionTitle",text:"Aggregate Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-count",type:"number",value:e.rating_count,label:"Rating count"},{fieldType:"sectionTitle",text:"Video"},{fieldType:"input",name:"video-title",type:"text",value:e.video_title||"",label:"Video title"},{fieldType:"textarea",name:"video-description",value:e.video_description||"",label:"Video description"},{fieldType:"input",name:"video-url",type:"url",value:e.video_url||"",label:"Video URL"},{fieldType:"input",name:"video-content-url",type:"url",value:e.video_content_url||"",label:"Video content URL",hint:"A URL pointing to the actual video media file"},{fieldType:"input",name:"video-thumbnail",type:"url",value:e.video_thumbnail||"",label:"Video thumbnail URL"},{fieldType:"input",name:"video-duration",type:"text",value:e.video_duration||"",label:"Video duration",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"video-uploaded",type:"date",value:e.video_uploaded,label:"Video upload date"}];return t.buildSchemaForm(e)},reviewSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Review title"},{fieldType:"sectionTitle",text:"Reviewed item"},{fieldType:"select",name:"reviewed-item",value:e.reviewed_item,label:"Reviewed item",options:[{value:"Book",label:"Book"},{value:"Course",label:"Course"},{value:"Event",label:"Event"},{value:"How-to",label:"How-to"},{value:"LocalBusiness",label:"Local Business"},{value:"Movie",label:"Movie"},{value:"Product",label:"Product"},{value:"Recipe",label:"Recipe"},{value:"SoftwareApp",label:"Software App"}]},{fieldType:"input",name:"reviewed-item-image",type:"url",value:e.reviewed_item_image||"",label:"Reviewed item image URL"},{fieldType:"input",name:"reviewed-item-name",type:"text",value:e.reviewed_item_name||"",label:"Reviewed item name"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",step:"0.01",value:e.rating,label:"Rating value"},{fieldType:"textarea",name:"review-body",value:e.review_body||"",label:"Review text"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},serviceSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"service-type",type:"text",value:e.service_type||"",label:"Service type"},{fieldType:"input",name:"service-name",type:"text",value:e.service_name||"",label:"Name"},{fieldType:"textarea",name:"service-description",value:e.service_description||"",label:"Service description"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Currency"}];return t.buildSchemaForm(e)},videoSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"embed-url",type:"url",value:e.embed_url||"",label:"Embed URL",hint:"A URL pointing to the embeddable player for the video. Example: https://www.youtube.com/embed/VIDEOID"},{fieldType:"input",name:"content-url",type:"url",value:e.content_url||"",label:"Content URL",hint:"A URL pointing to the actual video media file like MP4, MOV, etc. Please leave it empty if you don't know the URL"},{fieldType:"input",name:"duration",type:"text",value:e.duration||"",label:"Duration",hint:"ISO 8601 duration format. Example: PT1H30M"}];return t.buildSchemaForm(e)},webPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)};function initSerpSimulator(){"use strict";const r=document.body.classList.contains("block-editor-page"),o=document.querySelector(".diagnoseo-preview");if(!o)return;const l=o.querySelector(".search-result .search-result-title"),a=o.querySelector(".search-result.mobile .search-result-title"),i=o.querySelector(".search-result .search-result-descr"),n=o.querySelector(".search-result.mobile .search-result-descr"),e=document.querySelector(".diagnoseo-meta-form")||document.querySelector(".diagnoseo-settings-form"),u=e.querySelector("#seo-title")||e.querySelector("#diagnoseo_home_title"),s=e.querySelector(".info-title-chars"),p=e.querySelector(".info-title-width"),c=e.querySelector(".seo-title-progress .diagnoseo-progress-fill"),d=e.querySelector("#seo-description")||e.querySelector("#diagnoseo_home_description"),m=e.querySelector(".info-descr-chars"),v=e.querySelector(".info-descr-width"),y=e.querySelector(".seo-descr-progress .diagnoseo-progress-fill"),b=e.querySelector("#seo-slug"),f=e.querySelector(".info-slug-chars"),g=e.querySelector(".seo-slug-progress .diagnoseo-progress-fill"),h=o.querySelector(".title-sample"),T=o.querySelector(".description-sample"),t=function(){for(var e=!1;function(){var e=l.offsetWidth-20;l.style.maxWidth="none",l.style.position="absolute";var t=l.offsetWidth;return l.removeAttribute("style"),e<t}();){var t=S(l.textContent);if(!t)break;t=(t=(t=t.replace(/\/$/," ...")).split(" ").slice(0,-1).join(" ")).replace(/,\s*$/,""),e=!0,l.textContent=t,a.textContent=t}e&&(l.textContent=l.textContent+" ...",a.textContent=a.textContent+" ...")},x=function(e,t,a=0){const l=e.split(" "),i=T;if(!i)return e;e=function(e,t){for(var a,l="",i=e.split(" "),n=0;n<i.length;n++)if(a=l,(l+=" "+i[n]).length>t){l=a+" ...";break}return l=l.replace(/,\s*$/,"")}(e,a),i.textContent=e;for(var n=!1;i.clientWidth>t;){l.pop();var n=!0,r=l.join(" ");i.textContent=r}return n?l.join(" ")+" ...":e},w=function(e){var t=S(e),e=x(t,960,158);i.textContent=e;e=x(t,680,158);n.textContent=e,T.textContent=t},S=function(e){if(!e)return"";var{site:t,siteTagline:a,separator:l,excerpt:i,postTitle:n}=o.dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",r?window.wp.data.select("core/editor").getEditedPostAttribute("title"):n)).replaceAll("%sitename%",t)).replaceAll("%tagline%",a)).replaceAll("%sep%",l)).replaceAll(" %page%","")).replaceAll("%excerpt%",i||_())).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))},E=function(e){e=S(e),h.textContent=e||l.dataset.fallback,l.textContent=e||l.dataset.fallback,a.textContent=e||l.dataset.fallback,t()},_=function(){if(!window.wp||!window.wp.data)return"";let a=r?window.wp.data.select("core/editor").getEditedPostAttribute("excerpt"):o.dataset.excerpt;if(!a){let e=r?window.wp.data.select("core/editor").getEditedPostContent():"";e=seoHelper.stripTags(e).trim();let t=e.split(" ");var l=Math.min(t.length,55);t=t.splice(0,l),a=t.join(" ")}return a},P=function(){var e,t,a,l;c&&(e=h.clientWidth,l=h.textContent,100<(a=e/600*100)&&(a=100),(t=(l=S(l)).length)||(a=0),a+="%",l="",30<=t&&e<=600&&(30<=t&&t<35||60<t&&e<=600?l="medium":35<=t&&t<=60&&(l="full")),s.textContent=t,p.textContent=e,c.style.width=a,l?c.classList.contains(l)||(c.classList.remove("medium","full"),c.classList.add(l)):c.classList.remove("medium","full"))},A=function(){var e,t,a,l;y&&(l=T.textContent,e=T.clientWidth,t=l.length,100<(a=e/990*100)&&(a=100),d.value.length||d.getAttribute("placeholder")||(a=0),a+="%",l="",70<=t&&e<=990&&(70<=t&&t<130||158<t&&e<=990?l="medium":130<=t&&t<=158&&(l="full")),m.textContent=t,v.textContent=e,y.style.width=a,l?y.classList.contains(l)||(y.classList.remove("medium","full"),y.classList.add(l)):y.classList.remove("medium","full"))},L=function(){var e,t,a;g&&(t="",(a=(e=(e=b.value).replaceAll(" ","-")).split("-")).length<=5&&e.length?e.length<=50?t="full":50<e.length&&e.length<=60&&(t="medium"):5<a.length&&e.length<60&&(t="medium"),100<(a=Math.round(e.length/60*100))&&(a=100),g.style.width=a+"%",f.textContent=e.length,t?g.classList.contains(t)||(g.classList.remove("medium","full"),g.classList.add(t)):g.classList.remove("medium","full"))};u&&(u.addEventListener("input",function(e){E(e.target.value),h.textContent=S(e.target.value),r&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_title:e.target.value}}),P()}),E(u.value||u.getAttribute("placeholder")),P());const k=l.dataset.fallback;r?window.wp.data.subscribe(()=>{var e=window.wp.data.select("core/editor").getEditedPostAttribute("title")||o.dataset.postTitle;l.dataset.fallback=e||k;var t=u.value||u.getAttribute("placeholder");E(t),P();const a=document.querySelector("#postlist-title");!(window.wp.data.select("core/editor").getEditedPostAttribute("meta")?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:e)&&a&&a.setAttribute("placeholder",e)}):u&&u.addEventListener("input",e=>{var t=r?window.wp.data.select("core/editor").getEditedPostAttribute("title"):o.dataset.postTitle;l.dataset.fallback=t||k;e=e.target.value||e.target.value.getAttribute("placeholder");E(e),P();const a=document.querySelector("#postlist-title");!(r?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:t)&&a&&a.setAttribute("placeholder",t)}),d&&(d.addEventListener("input",function(e){w(e.target.value||e.target.getAttribute("placeholder")),r&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_description:e.target.value}}),A()}),w(d.value||d.getAttribute("placeholder")),A()),b&&b.addEventListener("input",e=>{r&&window.wp.data.dispatch("core/editor").editPost({slug:seoHelper.slugify(e.target.value)}),L()});const C=document.querySelectorAll(".diagnoseo-var-input");C&&C.forEach(e=>{const l=e.querySelector(".var-input"),i=e.querySelector(".var-select"),t=e.querySelector(".var-button");t.addEventListener("click",e=>{e.preventDefault();var t,a=i.value;a&&(l.selectionStart||"0"==l.selectionStart?(t=l.selectionStart,e=l.selectionEnd,l.value=l.value.substring(0,t)+" "+a+l.value.substring(e,l.value.length)):l.value+=a,l.dispatchEvent(new Event("input")))})}),setTimeout(function(){t(),P(),A(),L()},500)}window._wpLoadBlockEditor?window._wpLoadBlockEditor.then(function(){setTimeout(initSerpSimulator,500)}):window.addEventListener("load",initSerpSimulator);const startSocialPreview=function(){if(window.wp.data){const{select,dispatch,subscribe}=window.wp.data}const e=document.querySelectorAll(".diagnoseo-social-meta"),t=document.body.classList.contains("block-editor-page");if(e){const m=document.querySelector("#facebook-title"),v=document.querySelector("#twitter-title"),y=document.querySelector("#facebook-description"),b=document.querySelector("#twitter-description"),f=document.querySelector("#seo-title"),g=document.querySelector("#seo-description");if(f&&f.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");m.setAttribute("placeholder",e),v.setAttribute("placeholder",e)}),g&&g.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");y.setAttribute("placeholder",e),b.setAttribute("placeholder",e)}),e.forEach(e=>{e.addEventListener("input",e=>{t&&function(e,t){const a={};a[e]=t,dispatch("core/editor").editPost({meta:a})}(e.target.dataset.customField,e.target.value)})}),t)subscribe(()=>{const e=select("core/editor");var t=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_title||m.value||f.value||m.getAttribute("placeholder"),a=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_description||y.value||g.value||g.getAttribute("placeholder"),l=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_title||v.value||f.value||v.getAttribute("placeholder"),i=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_description||b.value||g.value||g.getAttribute("placeholder"),n=e.getEditedPostAttribute("featured_media");const r=document.querySelectorAll(".diagnoseo-social-preview"),o=document.querySelector(".preview-facebook"),u=document.querySelector(".preview-twitter");if(r){const s=o?o.querySelector(".facebook-post-title"):null;s&&(s.textContent=seoHelper.replaceVariables(t));const p=o?o.querySelector(".facebook-post-description"):null;p&&(p.textContent=seoHelper.replaceVariables(a));const c=u?u.querySelector(".twitter-post-title"):null;c&&(c.textContent=seoHelper.replaceVariables(l));const d=u?u.querySelector(".twitter-post-description"):null;d&&(d.textContent=seoHelper.replaceVariables(i)),r.forEach(e=>{var t=n?select("core").getMedia(n):null,t=t?t.guid.raw:e.dataset.placeholderImage;const a=e.querySelector(".preview-image img");a.setAttribute("src",t)})}});else{const a=document.querySelector(".preview-facebook"),l=document.querySelector(".preview-twitter");if(a&&l){const i=a.querySelector(".facebook-post-title"),n=a.querySelector(".facebook-post-description"),r=l.querySelector(".twitter-post-title"),o=l.querySelector(".twitter-post-description");i.textContent=seoHelper.replaceVariables(a.dataset.facebookTitle),n.textContent=seoHelper.replaceVariables(a.dataset.facebookDescription),r.textContent=seoHelper.replaceVariables(l.dataset.twitterTitle),o.textContent=seoHelper.replaceVariables(l.dataset.twitterDescription),m.addEventListener("input",e=>{e=e.target.value;i&&(i.textContent=seoHelper.replaceVariables(e))}),y.addEventListener("input",e=>{e=e.target.value;n&&(n.textContent=seoHelper.replaceVariables(e))}),v.addEventListener("input",e=>{e=e.target.value;r&&(r.textContent=seoHelper.replaceVariables(e))}),b.addEventListener("input",e=>{e=e.target.value;o&&(o.textContent=seoHelper.replaceVariables(e))})}}}};window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(startSocialPreview,500)}),document.body.classList.contains("block-editor-page")||window.addEventListener("load",startSocialPreview),jQuery(document).on("ready",function(){jQuery(".toggle").each(function(){const t=jQuery(this).find(".toggle-trigger"),a=jQuery(this).find(".toggle-content");t.on("click",function(e){e.preventDefault(),a.slideToggle(),t.toggleClass("open")})})}); -
diagnoseo/tags/1.2.20/js/diagnoseo-editor.min.js
r2990586 r2992578 1 const{__}=window.wp.i18n;window.diagnoseo={additionalKeywordLimit:10,additionalKeywordCount:0,RelatedKeywordsInPost:0,checks:[{id:"title-not-too-long",type:"check",label:__("Title not too long"),section:"content",test:e=>{var{metaTitle:t,postTitle:e}=e;if(!t&&!e)return"nok";t=t||e;const a=document.querySelector(".title-sample");a.textContent=t;e=a.clientWidth,t=t.length;return e<=600?60<t?"nok medium-nok":t<=60?"ok":"nok":"nok"}},{id:"title-not-too-short",type:"check",label:__("Title not too short"),section:"content",test:e=>{var{metaTitle:t,postTitle:e}=e;if(!t&&!e)return"nok";e=(t||e).length;return 30<=e?30<=e&&e<35?"nok medium-nok":35<=e?"ok":"nok":"nok"}},{id:"description-not-too-long",type:"check",label:__("Description not too long"),section:"content",test:e=>{var{metaDescription:t}=e;if(!t)return"nok";e=document.querySelector(".description-sample"),t=t.length;if(e.clientWidth<=990){if(155<t)return"nok medium-nok";if(t<=155)return"ok"}return"nok"}},{id:"description-not-too-short",type:"check",label:__("Description not too short"),section:"content",test:e=>{var{metaDescription:e}=e;if(!e)return"nok";e=e.length;if(70<=e){if(e<130)return"nok medium-nok";if(130<=e)return"ok"}return"nok"}},{id:"too-long-sentences",type:"check",label:__("No sentences with more than 20 words"),section:"content",test:e=>{var{postContent:e}=e;e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("</p>",".</p>")).replaceAll("</h1>",".</h1>")).replaceAll("</h2>",".</h2>")).replaceAll("</h3>",".</h3>")).replaceAll("</h4>",".</h4>")).replaceAll("</h5>",".</h5>")).replaceAll("</h6>",".</h6>")).replaceAll("</li>",".</li>");const t=(e=seoHelper.stripTags(e)).split(/\.|\?|!/);var a=!1;return t.length&&t.forEach(e=>{a=a||20<seoHelper.countWords(e)}),a?"nok":"ok"}},{id:"too-many-words",type:"check",label:__("No paragraphs with more than 100 words"),section:"content",test:e=>{const t=seoHelper.createMarkupEl(e.postContent),a=t.querySelectorAll("p");var l=!1;return a.length&&a.forEach(e=>{100<seoHelper.countWords(e.textContent)&&(l=!0)}),l?"nok":"ok"}},{id:"too-many-sentences",type:"check",label:__("No paragraphs with more than 5 sentences"),section:"content",test:e=>{const t=seoHelper.createMarkupEl(e.postContent),a=t.querySelectorAll("p");var l=!1;return a.length&&a.forEach(e=>{5<e.textContent.split(/\.|\?|!/).filter(e=>!!e.trim()).length&&(l=!0)}),l?"nok":"ok"}},{id:"internal-links-present",type:"check",label:__("Contains internal links"),section:"content",test:e=>{const t=seoHelper.createMarkupEl(e.postContent),a=t.querySelectorAll("a");var l=!1;return a.forEach(e=>{e=e.getAttribute("href")||"";e&&(e.includes("http://"+window.location.hostname)||e.includes("https://"+window.location.hostname)||"/"===e.substr(0,1)||"./"===e.substr(0,2))&&(l=!0)}),l?"ok":"nok"}},{id:"strong-present",type:"check",label:__("Contains bold text (strong tag)"),section:"content",test:e=>seoHelper.countElements(e.postContent,"strong")?"ok":"nok"},{id:"readability",type:"stats",label:__("Readability score"),order:"label value comment",section:"content",test:e=>{var{postContent:t}=e,a=(t=seoHelper.stripTags(t)).split(/\.|\?|!/);a=(a=a.map(e=>e.trim())).filter(e=>e&&" "!==e&&"\n"!==e);e=(t=t.replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g," ")).split(" ");e=(e=e.map(e=>e.trim())).filter(e=>e&&""!==e&&"\n"!==e);var t=seoHelper.countSyllables(t),l=206.835-e.length/a.length*1.015-t/e.length*84.6;(l=l.toFixed(2))<0?l=0:100<l&&(l=100);var n="",i="";switch(!0){case isNaN(l):l=__("N/A"),n="",i="nok";break;case 90<l:n=__("Very easy to read","diagnoseo"),i="ok";break;case 80<l&&l<=90:n=__("Easy to read","diagnoseo"),i="ok";break;case 70<l&&l<=80:n=__("Fairly easy to read","diagnoseo"),i="ok";break;case 60<l&&l<=70:n=__("Average reading ease","diagnoseo"),i="nok medium-nok";break;case 50<l&&l<=60:n=__("Fairly difficult to read","diagnoseo"),i="nok";break;case 30<l&&l<=50:n=__("Difficult to read","diagnoseo"),i="nok";break;case 10<l&&l<=30:n=__("Very difficult to read","diagnoseo"),i="nok";break;case l<=10:n=__("Extremely difficult to read","diagnoseo"),i="nok"}return{value:l,comment:n=n&&` (${n})`,status:i}}},{id:"est-reading-time",type:"stats",label:__("Estimated reading time"),section:"content",order:"label value",test:e=>{var{postContent:t}=e,e=seoHelper.countWords(t),t=Math.floor(e/225),e=Math.floor(e%225/3.75);return{value:`${t} ${__("min")} ${e} ${__("s")}`}}},{id:"minimal-word-count",type:"check",label:__("Minimal word count"),section:"content",postTypes:["post","page"],inPro:!0},{id:"words",type:"stats",label:__("words"),section:"content",test:e=>{var{postContent:e}=e;return{value:seoHelper.countWords(e)}}},{id:"chars",type:"stats",label:__("characters"),section:"content",test:e=>({value:e.postContent.length||0})},{id:"sentences",type:"stats",label:__("sentences"),section:"content",test:e=>{var{postContent:e}=e,e=(e=e.replace(/(\r\n|\n|\r)/gm," ")).split(/\.|\?|!/);return{value:(e=(e=e.map(e=>e.trim())).filter(e=>e&&" "!==e&&"\n"!==e)).length||0}}},{id:"paragraphs",type:"stats",label:__("paragraphs"),section:"content",test:e=>({value:seoHelper.countElements(e.postContent,"p")})},{id:"headings",type:"stats",label:__("Headings"),inPro:!0,section:"content"},{id:"optimal-heading-number",type:"check",label:__("Optimal number of headings"),inPro:!0,section:"content"},{id:"images",type:"stats",label:__("Images"),inPro:!0,section:"content"},{id:"optimal-image-number",type:"check",label:__("Optimal number of images"),inPro:!0,section:"content"},{id:"too-long-headings",type:"check",label:__("No too long headings"),inPro:!0,section:"content"},{id:"toc-block",type:"check",label:__("Use Table of Contents block"),inPro:!0,section:"content"},{id:"keyword-exists",type:"check",label:__("Keyword is provided"),section:"keyword",test:e=>e.keyword?"ok":"nok"},{id:"keyword-unique",type:"check",label:__("Focus Keyword not used before"),section:"keyword",test:async a=>{var l=document.querySelector(".keyword-unique");if(a.keyword){let e=new URLSearchParams(window.location.search);var n=Object.fromEntries(e.entries()),n=`${diagnoseoRestUrl}diagnoseo/v1/check-posts-keyword/${a.keyword}/${n.post||0}`;let t=0===await(await fetch(n)).json()?"ok":"nok";l?l&&(l.classList.remove("ok","nok"),l.classList.add(t)):setTimeout(()=>{(l=document.querySelector(".keyword-unique"))&&(l.classList.remove("ok","nok"),l.classList.add(t))},200)}else l&&l.classList.add("ok")}},{id:"keyword-in-title",type:"check",label:__("Keyword present in title tag"),section:"keyword",test:e=>{var{keyword:t,postTitle:a,metaTitle:e}=e,a=e||a;return seoHelper.isKeywordInText(t,a)?"ok":"nok"}},{id:"keyword-in-title-beginning",type:"check",label:__("Keyword in the beginning of the title tag"),section:"keyword",test:e=>{var{keyword:t,postTitle:a,metaTitle:e}=e;if(!t)return"nok";a=(a=e||a).toLowerCase(),t=t.toLowerCase();const l=new RegExp("^"+t);return l.test(a)?"ok":"nok"}},{id:"keyword-in-descr",type:"check",label:__("Keyword present in meta description tag"),section:"keyword",test:e=>{var{keyword:t,metaDescription:e}=e;return seoHelper.isKeywordInText(t,e)?"ok":"nok"}},{id:"keyword-in-slug",type:"check",label:__("Keyword present in URL slug"),section:"keyword",test:e=>{var{keyword:t,slug:a,postTitle:e}=e;return t&&(a=a||seoHelper.slugify(e)).includes(seoHelper.slugify(t))?"ok":"nok"}},{id:"slug-length-ok",type:"check",label:__("URL slug length"),section:"keyword",test:e=>{var{slug:t,postTitle:e}=e;if(!t&&!e)return"nok";if((t=t||seoHelper.slugify(e)).length<=60&&t.split("-").length<=5)return"ok";return"nok"}},{id:"keyword-in-h1",type:"check",label:__("Keyword present in H1 element"),section:"keyword",test:e=>{var{keyword:t,postContent:a,postTitle:e}=e;return seoHelper.isKeywordInText(t,e)||seoHelper.isKeywordInAnyElement(t,a,"h1")?"ok":"nok"}},{id:"keyword-in-image-alt",type:"check",label:__("Keyword present in any image alt attribute"),section:"keyword",test:e=>{var{keyword:t,postContent:a,featuredImage:e}=e;return seoHelper.isKeywordInAnyAlt(t,a,e)?"ok":"nok"}},{id:"keyword-in-image-filename",type:"check",label:__("Keyword in image file name"),section:"keyword",inPro:!0,hidden:!0},{id:"keyword-not-in-ext-link",type:"check",label:__("Keyword NOT present in external link text"),section:"keyword",test:e=>{const{keyword:a,postContent:t}=e;if(!a)return"ok";const l=seoHelper.createMarkupEl(t);var n=!1;const i=l.querySelectorAll("a");return i.forEach(e=>{const t=e.getAttribute("href")||"";t.includes("http://"+window.location.hostname)||t.includes("https://"+window.location.hostname)||"/"===t.substr(0,1)||"./"===t.substr(0,2)||!seoHelper.isKeywordInText(a,e.textContent)||(n=!0)}),n?"nok":"ok"}},{id:"keyword-in-first-words",type:"check",label:__("Keyword present within first 100 words"),section:"keyword",test:e=>{var{keyword:t,postContent:e}=e;if(!t)return"nok";var t=t.trim(),a=(e=seoHelper.stripTags(e)).toLowerCase().split(/\s|\n/),l=100<=(a=a.filter(e=>e)).length?100:a.length;if(a=a.splice(0,l),!seoHelper.isKeywordInText(t,a.join(" ")))return"nok";if(1<t.split(" ").length)return"ok";if(a.length)for(let e=0;e<l;e++)a[e]=a[e].replace(".",""),a[e]=a[e].replace(",",""),a[e]=a[e].replace("?",""),a[e]=a[e].replace("!",""),a[e]=a[e].replace(":",""),a[e]=a[e].replace(";","");return a.includes(t)?"ok":"nok"}},{id:"more",type:"check",label:__("Many more powerful SEO checkpoints"),inPro:!0,section:"content"},{id:"more",type:"check",label:__("Many more powerful SEO checkpoints"),inPro:!0,section:"keyword"}],checkResults:{}},function(){"use strict";function l(){return(0,c.createElement)("svg",{"enable-background":"new 0 0 20 20",height:"20",width:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",className:"diagnoseo-icon"},(0,c.createElement)("clipPath",{id:"a"},(0,c.createElement)("path",{d:"m0 0h20v20h-20z"})),(0,c.createElement)("path",{className:"diagnoseo-icon-part-tick",d:"m12.377 5.866 1.835 1.612-4.839 5.508-4.11-3.576 1.672-1.902 2.256 1.982z"}),(0,c.createElement)("path",{className:"diagnoseo-icon-part-magnifier","clip-path":"url(#a)",d:"m16.298 15.209c1.745-1.983 2.548-4.603 2.208-7.228-.315-2.426-1.555-4.584-3.493-6.077s-4.341-2.139-6.768-1.828c-2.426.315-4.584 1.555-6.077 3.493s-2.142 4.341-1.827 6.767c.649 5.007 5.251 8.554 10.259 7.905 1.441-.188 2.824-.717 4.014-1.536l3.749 3.295 1.476-1.68zm-1.471-1.887c-1.111 1.443-2.72 2.368-4.527 2.602-1.808.235-3.598-.247-5.041-1.361-1.444-1.111-2.368-2.719-2.602-4.527-.483-3.73 2.158-7.158 5.889-7.642.296-.038.59-.057.881-.057 3.375 0 6.316 2.511 6.761 5.946.235 1.806-.249 3.596-1.361 5.039"}))}var c=window.wp.element,e=window.wp.plugins,i=window.wp.data;class t extends React.Component{constructor(e){super(e),this.state={score:0,timeout:null},this.handleCheckChanged=this.handleCheckChanged.bind(this),this.calculateScore=this.calculateScore.bind(this),this.runAllChecks=this.runAllChecks.bind(this)}calculateScore(){const e=window.diagnoseo.checks.filter(e=>"check"===e.type);var t=e.length+1,a=e.filter(e=>e.checked),a=window.diagnoseo.additionalKeywordCount===window.diagnoseo.RelatedKeywordsInPost?a.length+1:a.length,t=Math.round(100*a/t);this.setState({score:t})}runAllChecks(){const e=window.diagnoseo.checks.filter(e=>"check"===e.type),n={postTitle:(0,i.select)("core/editor").getEditedPostAttribute("title"),postContent:(0,i.select)("core/editor").getEditedPostContent(),keyword:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_keyword,featuredImageId:(0,i.select)("core/editor").getEditedPostAttribute("featured_media"),featuredImage:(0,i.select)("core").getMedia((0,i.select)("core/editor").getEditedPostAttribute("featured_media")),metaTitle:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_title,metaDescription:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_description,slug:(0,i.select)("core/editor").getEditedPostAttribute("slug"),blocks:(0,i.select)("core/block-editor").getBlocks(),optimalKeywordDensity:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_keyword_density,optimalWordNumber:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_word_number,optimalHeadingNumber:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_heading_number,optimalImageNumber:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_image_number};var t;!n.featuredImageId||n.featuredImage?(n.metaTitle=seoHelper.replaceVariables(n.metaTitle)||(document.querySelector("#seo-title")?seoHelper.replaceVariables(document.querySelector("#seo-title").getAttribute("placeholder")):""),n.metaDescription=seoHelper.replaceVariables(n.metaDescription)||(document.querySelector("#seo-description")?seoHelper.replaceVariables(document.querySelector("#seo-description").value):""),e.forEach((t,e)=>{var a,l;t.test&&(a="ok"===t.test(n),l=window.diagnoseo.checks.findIndex(e=>e.id===t.id),window.diagnoseo.checks[l].checked=a)}),this.calculateScore()):t=setInterval(()=>{(0,i.select)("core").getMedia(n.featuredImageId)&&(clearInterval(t),this.runAllChecks())},500)}handleCheckChanged(){clearTimeout(this.state.timeout),this.setState({timeout:setTimeout(this.calculateScore,300)})}async componentDidMount(){window.addEventListener("check-changed",this.handleCheckChanged),setTimeout(this.runAllChecks,1e3)}componentWillUnmount(){window.removeEventListener("check-changed",this.handleCheckChanged)}render(){let e,t=this.state.score;switch(!0){case t<60:e="score-low";break;case 60<=t&&t<80:e="score-medium";break;case 80<=t:e="score-high"}var a=`diagnoseo-button-content ${e}`;return(0,c.createElement)("span",{className:a},(0,c.createElement)(l,null),(0,c.createElement)("b",{className:"diagnoseo-score"},this.state.score,"/100"))}whenEditorIsReady(){return new Promise(e=>{const t=(0,i.subscribe)(()=>{((0,i.select)("core/editor").isCleanNewPost()||0<(0,i.select)("core/block-editor").getBlockCount())&&(t(),e())})})}}var a=t,n=window.wp.editPost,u=window.wp.components,p=window.wp.i18n,o=window.wp.compose,r=(0,o.compose)((0,i.withDispatch)((a,l)=>({setMetaValue:e=>{var t={};t[l.fieldName]=e,a("core/editor").editPost({meta:t}),l.changeCallback&&l.changeCallback(e)}})),(0,i.withSelect)((e,t)=>({metaValue:e("core/editor").getEditedPostAttribute("meta")[t.fieldName]})))(t=>(0,c.createElement)(u.TextControl,{label:t.label,value:t.metaValue,onChange:e=>t.setMetaValue(e)})),s=(0,o.compose)((0,i.withSelect)(e=>({content:e("core/editor").getEditedPostContent(),keyword:e("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_keyword,optimalKeywordDensity:e("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_keyword_density})))(e=>{var t,a,l=0;e.keyword&&(a=(a=(t=(t=(t=e.content.replace(/<\!--.*?-->/g,"")).replace(/(\r\n|\n|\r)/gm," ")).toLowerCase()).split(" ")).filter(e=>""!==e),(t=seoHelper.countOccurences(e.keyword,t))&&(l=(l=t/a.length*100).toFixed(2)));let n;return n=window.diagnoseoPro?(a="diagnoseo-check optimal-keyword-density",parseFloat(e.optimalKeywordDensity),parseFloat(e.optimalKeywordDensity),(0,c.createElement)("p",{className:a+=1<=l&&l<=3?" ok":" nok"},(0,p.__)("Optimal keyword density","diagnoseo")," ",(0,c.createElement)("b",{className:"value"},"1% - 3%"))):(0,c.createElement)("p",{className:"diagnoseo-check optimal-keyword-density"},(0,c.createElement)("i",{className:"dashicons dashicons-lock"})," ",(0,p.__)("Optimal keyword density","diagnoseo")),(0,c.createElement)(c.Fragment,null,(0,c.createElement)("p",{className:"diagnoseo-stats keyword-density"},(0,p.__)("Keyword density","diagnoseo")," ",(0,c.createElement)("b",{className:"value"},l,"%")),n)}),d=t=>{let e=["diagnoseo-check",t.id];var a;if(t.test&&("string"==typeof(a=t.test(t.postData))&&e.push(a),l="ok"===a,a=t.checkConfig.findIndex(e=>e.id===t.id),t.checkConfig[a].checked!==l&&window.dispatchEvent(new Event("check-changed")),t.checkConfig[a].checked=l),t.inPro)return(0,c.createElement)("p",{className:e.join(" ")},(0,c.createElement)("i",{className:"dashicons dashicons-lock"})," ",t.label," ",(0,c.createElement)("b",null,(0,c.createElement)("a",{href:"https://diagnoseo.com/wordpress-seo-plugin/?utm_source=wp&utm_medium=link&utm_campaign=available_in_pro",target:"_blank",rel:"noreferrer noopener"},(0,p.__)("Available in Pro","diagnoseo"))));var l=t.valueFieldName&&t.postData[t.valueFieldName]?(0,c.createElement)("b",null,t.postData[t.valueFieldName]):"";return(0,c.createElement)("p",{className:e.join(" ")},t.label," ",l)},m=e=>{let t=["diagnoseo-stats",e.id];if(e.inPro)return(0,c.createElement)("p",{className:t.join(" ")},(0,c.createElement)("i",{className:"dashicons dashicons-lock"})," ",e.label," ",(0,c.createElement)("b",null,(0,c.createElement)("a",{href:"https://diagnoseo.com/wordpress-seo-plugin/?utm_source=wp&utm_medium=link&utm_campaign=available_in_pro",target:"_blank",rel:"noreferrer noopener"},(0,p.__)("Available in Pro","diagnoseo"))));let a,l=(0,c.createElement)("b",{className:"value"}),n="";var i;return e.test&&(i=e.test(e.postData),l=(0,c.createElement)("b",{className:"value"},i.value),n=i.comment?(0,c.createElement)("span",{className:"comment"},i.comment):"",i.status&&t.push(i.status)),a=e.order&&"value label"!==e.order?(0,c.createElement)(c.Fragment,null,e.label," ",l," ",n):(0,c.createElement)(c.Fragment,null,l," ",e.label),(0,c.createElement)("p",{className:t.join(" ")},a)},y=(0,o.compose)((0,i.withSelect)(e=>({postTitle:e("core/editor").getEditedPostAttribute("title"),postContent:e("core/editor").getEditedPostContent(),featuredImage:e("core").getMedia(e("core/editor").getEditedPostAttribute("featured_media")),keyword:e("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_keyword,metaTitle:e("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_title,metaDescription:e("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_description,urlSlug:e("core/editor").getEditedPostAttribute("slug"),blocks:e("core/block-editor").getBlocks(),optimalKeywordDensity:2,optimalWordNumber:300,optimalHeadingNumber:1,optimalImageNumber:e("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_image_number,postType:e("core/editor").getCurrentPostType()})))(a=>{const l=window.diagnoseo.checks,e=l.filter(e=>e.section===a.sectionName),n={postTitle:a.postTitle,postContent:a.postContent,keyword:a.keyword,metaTitle:seoHelper.replaceVariables(a.metaTitle)||(document.querySelector("#seo-title")?seoHelper.replaceVariables(document.querySelector("#seo-title").getAttribute("placeholder")):""),metaDescription:seoHelper.replaceVariables(a.metaDescription)||(document.querySelector("#seo-description")?seoHelper.replaceVariables(document.querySelector("#seo-description").value):""),slug:a.urlSlug,blocks:a.blocks,featuredImage:a.featuredImage,optimalKeywordDensity:a.optimalKeywordDensity,optimalWordNumber:a.optimalWordNumber,optimalHeadingNumber:a.optimalHeadingNumber,optimalImageNumber:a.optimalImageNumber},t=e.map(e=>{let t=!0;if(e.postTypes&&(t=e.postTypes.includes(a.postType)),!e.hidden&&t)switch(e.type){case"check":return e.inPro?(0,c.createElement)(d,{id:e.id,label:e.label,inPro:e.inPro}):(0,c.createElement)(d,{id:e.id,label:e.label,test:e.test,postData:n,checkConfig:l,valueFieldName:e.valueFieldName});case"stats":return e.inPro?(0,c.createElement)(m,{id:e.id,label:e.label,inPro:e.inPro}):(0,c.createElement)(m,{id:e.id,label:e.label,test:e.test,order:e.order,postData:n})}});return(0,c.createElement)(c.Fragment,null,t.map((e,t)=>(0,c.createElement)(React.Fragment,{key:t},e)))});class g extends React.Component{constructor(e){super(e),this.state={keyword:"",keywordList:[],keywordLimit:(window.diagnoseoPro||window.diagnoseo).additionalKeywordLimit,apiKey:"",language:diagnoseo_settings?diagnoseo_settings.locale.substr(0,2):"",loading:!1},this.handleChange=this.handleChange.bind(this),this.handleLangChange=this.handleLangChange.bind(this),this.handleLoadButtonClick=this.handleLoadButtonClick.bind(this),this.relatedKeywordsApiUrl="diagnoseo/v1/related-keywords"}stripKeywordData(e){return(e=-1===e.indexOf("|")?e:e.substr(0,e.indexOf(" |"))).trim()}async loadRelatedKeywords(){var t=(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_keyword,a=(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_language;if(t)if(this.state.language){this.setState({loading:!0});let e=await this.getRelatedKeywords(t,a);if(e=e.split(","),e.length){let a=this.state.keywordList;e.forEach(t=>{t={name:t.trim()};var e=a.findIndex(e=>e.name===t);-1===e?a.push(t):(a[e].repeat_min=t.repeat_min,a[e].repeat_max=t.repeat_max)}),this.saveKeywords(a)}this.setState({loading:!1})}else alert((0,p.__)("Please select language.","diagnoseo"));else alert((0,p.__)('Please enter the "focus keyword" first',"diagnoseo"))}saveKeywords(e){const t=[...new Set(e)];t.splice(this.state.keywordLimit),this.setState({keywordList:t}),(window.onbeforeunload=null,i.dispatch)("core/editor").editPost({meta:{diagnoseo_meta_additional_keywords:JSON.stringify(t)}})}saveLanguage(e){(0,i.dispatch)("core/editor").editPost({meta:{diagnoseo_meta_language:e}})}componentDidMount(){let e=(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_additional_keywords,t=(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_language;try{e=JSON.parse(e)}catch{e=""}this.setState({language:t,keyword:this.props.focusKeyword,keywordList:e||[]})}async handleLoadButtonClick(){window.diagnoseoPro?this.loadRelatedKeywords():alert((0,p.__)("Related keywords and Pro data require DiagnoSEO Pro.","diagnoseo"))}handleChange(e){const l=this.state.keywordList,{stripKeywordData:n}=this;e=e.map(e=>{let t=n(e.value||e),a=l.findIndex(e=>t===e.name);return{name:t,repeat_min:-1!==a?l[a].repeat_min:0,repeat_max:-1!==a?l[a].repeat_max:0}});this.saveKeywords(e)}handleLangChange(e){this.setState({language:e}),this.saveLanguage(e)}render(){let{postTitle:i,postContent:o,featuredMedia:r}=this.props;const{countOccurences:s}=seoHelper;let d=0,e=this.state.keywordList.map(e=>{let t=e.name||"",a="error",l=function(e){o=seoHelper.stripTags(o);var t=0;return t+=s(e,i),t+=s(e,o),t+=seoHelper.isKeywordInAnyAlt(e,o),t+=r?s(e,r.alt_text):0}(t);l&&(a=!e.repeat_min||!e.repeat_max||l>=e.repeat_min&&l<=e.repeat_max?"success":"validating",d++);let n=` | ${l}`;return e.repeat_min&&e.repeat_max&&(n+=` (${e.repeat_min} - ${e.repeat_max})`),{value:t+n,status:a}}),t=!1;window.diagnoseo.RelatedKeywordsInPost!==d&&(window.diagnoseo.RelatedKeywordsInPost=d,t=!0),window.diagnoseo.additionalKeywordCount!==e.length&&(window.diagnoseo.additionalKeywordCount=e.length,t=!0),t&&window.dispatchEvent(new Event("check-changed"));var a=this.state.loading?(0,p.__)("Please wait... Loading related keywords. It can take up to a few minutes.","diagnoseo"):(0,c.createElement)("button",{className:"button get-related-keywords",onClick:this.handleLoadButtonClick},(0,p.__)("Get related keywords and Pro data","diagnoseo"));return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"components-base-control__field add-keyword diagnoseo-related-keywords"},(0,c.createElement)(u.FormTokenField,{label:(0,c.createElement)("b",null,(0,p.__)("Related keywords","diagnoseo")),onChange:this.handleChange,value:e,maxLength:this.state.keywordLimit+10}),(0,c.createElement)("p",{className:"components-form-token-field__help"},(0,p.__)("Limits: 10 keywords in free, 100 keywords in Pro","diagnoseo")),(0,c.createElement)(u.SelectControl,{options:[{value:"chinese",label:"Taiwan"},{value:"arabic",label:"Bahrain"},{value:"bulgarian",label:"Bulgaria"},{value:"croatian",label:"Croatia"},{value:"czech",label:"Czechia"},{value:"danish",label:"Denmark"},{value:"dutch",label:"Netherlands"},{value:"english",label:"United States"},{value:"finnish",label:"Finland"},{value:"french",label:"France"},{value:"austrian",label:"Austria"},{value:"greek",label:"Cyprus"},{value:"israeli",label:"Israel"},{value:"indian",label:"India"},{value:"hungarian",label:"Hungary"},{value:"indonesian",label:"Indonesia"},{value:"italian",label:"Italy"},{value:"japanese",label:"Japan"},{value:"korean",label:"South Korea"},{value:"latvian",label:"Latvia"},{value:"lithuanian",label:"Lithuania"},{value:"norwegian",label:"Norway"},{value:"polish",label:"Poland"},{value:"portugese",label:"Portugal"},{value:"romanian",label:"Romania"},{value:"russian",label:"Russia"},{value:"serbian",label:"Serbia"},{value:"slovak",label:"Slovakia"},{value:"slovenian",label:"Slovenia"},{value:"spanish",label:"Argentina"},{value:"swedish",label:"Sweden"},{value:"thai",label:"Thailand"},{value:"turkish",label:"Turkey"},{value:"ukrainian",label:"Ukraine"},{value:"vietnamese",label:"Vietnam"}],value:this.state.language,onChange:this.handleLangChange,label:(0,p.__)("Language","diagnoseo")}),(0,c.createElement)("p",null,a)))}getRelatedKeywords(a,l){return new Promise(t=>{const e=new FormData;e.append("keyword",a),e.append("language",l),e.append("count",30),fetch("/wp-json/diagnoseo/v1/related-keywords",{method:"POST",body:e}).then(e=>e.json()).then(e=>{"ok"===e.status?t(e.keywords):t("")}).catch(e=>{console.error(e),t("")})})}}var b=(0,o.compose)((0,i.withSelect)(e=>{var t=e("core/editor").getEditedPostAttribute("featured_media");return{postTitle:e("core/editor").getEditedPostAttribute("title"),postContent:e("core/editor").getEditedPostContent(),featuredMedia:e("core").getMedia(t,{context:"embed"})||{}}}))(e=>(0,c.createElement)(g,{postTitle:e.postTitle,postContent:e.postContent,featuredMedia:e.featuredMedia,seoDataCollector:e.seoDataCollector})),v=(0,o.compose)((0,i.withSelect)(e=>{if(!window.diagnoseoPro)return{};e={categories:e("core/editor").getEditedPostAttribute("categories"),status:"publish",per_page:10,exclude:[e("core/editor").getEditedPostAttribute("id")]};return{suggestedPosts:wp.data.select("core").getEntityRecords("postType","post",e)||[]}}))(e=>{if(window.diagnoseoPro){var t="";return t=e.suggestedPosts.length?(t=e.suggestedPosts.map(e=>(0,c.createElement)("li",null,(0,c.createElement)("a",{href:e.link},e.title.raw))),(0,c.createElement)("ol",null,t)):(0,c.createElement)("p",null,(0,p.__)("Could not prepare suggestions as there are no posts related to this one"))}return(0,c.createElement)("p",null,(0,c.createElement)("b",null,(0,c.createElement)("a",{href:"https://diagnoseo.com/wordpress-seo-plugin/?utm_source=wp&utm_medium=link&utm_campaign=available_in_pro",target:"_blank",rel:"noreferrer noopener"},(0,p.__)("Available in Pro","diagnoseo"))))}),o=(0,o.compose)((0,i.withDispatch)(t=>({setMetaValues:e=>{t("core/editor").editPost({meta:{diagnoseo_optimal_word_number:e.number_of_words.toString(),diagnoseo_optimal_keyword_density:e.focus_keyword_density.toString(),diagnoseo_optimal_heading_number:e.number_of_headings.toString(),diagnoseo_optimal_image_number:e.number_of_images.toString()}})}})))(e=>{var t=window.diagnoseoPro?"DiagnoSEO Pro":"DiagnoSEO";return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(n.PluginSidebarMoreMenuItem,{target:"diagnoseo-content-analyzer"},(0,p.__)("DiagnoSEO Content Watcher","diagnoseo")),(0,c.createElement)(n.PluginSidebar,{title:t,name:"diagnoseo-content-analyzer"},(0,c.createElement)(u.PanelBody,{title:(0,p.__)("Content analyzer","diagnoseo"),initialOpen:"true"},(0,c.createElement)(y,{sectionName:"content"})),(0,c.createElement)(u.PanelBody,{title:(0,p.__)("Keyword placement","diagnoseo"),initialOpen:"true"},(0,c.createElement)(r,{fieldName:"diagnoseo_meta_keyword",label:(0,c.createElement)("b",null,(0,p.__)("Focus keyword","diagnoseo"))}),(0,c.createElement)(s,null),(0,c.createElement)(b,{seoDataCollector:e.setMetaValues}),(0,c.createElement)(y,{sectionName:"keyword"})),(0,c.createElement)(u.PanelBody,{title:(0,p.__)("Internal linking suggestions","diagnoseo"),initialOpen:"true"},(0,c.createElement)(v,null))))});(0,e.registerPlugin)("diagnoseo-sidebar",{icon:(0,c.createElement)(a,null),render:o})}();class diagnoseoFormHelper{input(e,t,a,l="text",n=!1,i="1",o={}){const r=document.createElement("input");for(var s in this.setAttributes(r,{type:l,name:e,id:e,class:a||"components-textarea-control__input widefat",value:t,step:"number"===l?i:""}),n&&r.setAttribute("required","required"),o)r.addEventListener(s,o[s]);return r.addEventListener("input",this.saveSchemaData),r}textarea(e,t,a,l=!1,n={}){const i=document.createElement("textarea");for(var o in this.setAttributes(i,{name:e,id:e,class:a||"components-textarea-control__input widefat"}),i.value=t,l&&i.setAttribute("required","required"),n)i.addEventListener(o,n[o]);return i.addEventListener("input",this.saveSchemaData),i}select(e,a,t,l,n=!1,i={}){const o=document.createElement("select");for(var r in o.value=a,this.setAttributes(o,{name:e,id:e,class:l||"widefat"}),n&&o.setAttribute("required","required"),t.forEach(e=>{const t=document.createElement("option");t.setAttribute("value",e.value),t.textContent=e.label,e.value===a&&t.setAttribute("selected","selected"),o.appendChild(t)}),i)o.addEventListener(r,i[r]);return o.addEventListener("change",this.saveSchemaData),o}button(e,t,a,l,n="",i={}){const o=document.createElement("button");for(var r in o.textContent=a,this.setAttributes(o,{name:e,id:e,class:l,value:t,type:n||""}),i)o.addEventListener(r,i[r]);return o}sectionTitle(e){if(e){const t=document.createElement("h3");return t.classList.add("components-base-control__heading"),t.textContent=e,t}}wrapField(e,t,a="",l="components-base-control__field"){const n=document.createElement("div");l&&n.classList.add(l);const i=document.createElement("label");if(i.classList.add("components-base-control__label"),i.setAttribute("for",e.getAttribute("id")),i.textContent=t,e.getAttribute("required")){const o=document.createElement("span");o.classList.add("req"),o.textContent="*",i.appendChild(o)}if(n.appendChild(i),n.appendChild(e),a){const r=document.createElement("p");r.classList.add("hint"),r.textContent=a,n.appendChild(r)}return n}setAttributes(e,t){for(var a in t)e.setAttribute(a,t[a])}prepareField(e){var t,{fieldType:a,label:l,name:n,value:i,type:o,className:r,options:s,listeners:d,required:c,hint:e,text:u,step:p}=e;switch(a){case"input":t=this.input(n,i,r,o,c,p,d);break;case"textarea":t=this.textarea(n,i,r,c,d);break;case"select":t=this.select(n,i,s,r,c,d);break;case"button":t=this.button(n,i,l,r,o,d);break;case"sectionTitle":t=this.sectionTitle(u)}return"button"===a||"sectionTitle"===a?t:this.wrapField(t,l,e)}saveSchemaData(e){const n=e.target.closest(".diagnoseo-schema-form");if(n){const i={};n.formConfig.forEach(t=>{if("sectionTitle"!==t.fieldType){let e=t.name;var l=e.replaceAll("-","_");let a=n.querySelector(`#${e}`).value||"";t.splitLines&&(a=a.split(t.splitLines),a.forEach((e,t)=>{a[t]=e.trim()})),i[l]=a}});const t=document.querySelector("#schema-data");t.value=JSON.stringify(i);let e=document.querySelector(".diagnoseo-schema-generator");e.setAttribute("data-schema-data",t.value)}}buildSchemaForm(e){const t=document.createElement("div");return t.classList.add("diagnoseo-schema-form"),e.forEach(e=>{e=this.prepareField(e);t.appendChild(e)}),t.formConfig=e,t}}function permalinkWatcher(){"use strict";if(window.wp.data){var e,t=document.body.classList.contains("block-editor-page");const a=document.querySelector("#seo-slug"),l=document.querySelector(".editor-post-link input");a.addEventListener("input",e=>{const t=document.querySelector(".editor-post-link input");e=e.target.value;t&&t.value!==e&&(t.value=e,e=new Event("blur"),t.dispatchEvent(e))}),l&&(l.addEventListener("input",e=>{a.value!==e.target.value&&(a.value=e.target.value)}),a.value&&l&&l.value!==a.value&&(l.value=a.value,e=new Event("blur"),l.dispatchEvent(e))),t&&window.wp.data.subscribe(function(){var e=window.wp.data.select("core/editor").isSavingPost(),t=window.wp.data.select("core/editor").isAutosavingPost();e&&!t&&setTimeout(()=>{const e=document.querySelector("#seo-slug"),t=document.querySelector(".editor-post-link input");var a;e.value&&t?(a=seoHelper.slugify(e.value),e.value=a,t.value=a,a=new Event("blur"),t.dispatchEvent(a)):!e.value&&t&&(a=seoHelper.slugify(t.value),e.value=a)},500)})}}document.addEventListener("DOMContentLoaded",function(){"use strict";const e=document.querySelectorAll(".meta-template");e.forEach(e=>{const n=e.querySelector(".choose-variable"),t=e.querySelector(".add-variable"),i=e.querySelector("input, textarea");t&&t.addEventListener("click",e=>{e.preventDefault();var t,a,l=n.value;i.selectionStart||"0"==i.selectionStart?(t=i.selectionStart,a=i.selectionEnd,e=parseInt(t)?" ":"",i.value=i.value.substring(0,t)+e+l+i.value.substring(a,i.value.length)):i.value+=l,i.dispatchEvent(new Event("input"))})})}),document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".diagnoseo-image-select");e.forEach(n=>{const e=n.querySelector(".diagnoseo-img-upload"),l=n.querySelector(".diagnoseo-img-remove");e&&e.addEventListener("click",e=>{e.preventDefault();const l=wp.media({title:"Custom Image",button:{text:"Select Image"},multiple:!1}).on("select",()=>{var e=l.state().get("selection").first().toJSON();const t=n.querySelector(".diagnoseo-img"),a=n.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",e.url),a&&(a.value=e.url)}).open()}),l&&l.addEventListener("click",e=>{e.preventDefault();const t=n.querySelector(".diagnoseo-img"),a=n.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",l.dataset.fallbackImage||""),a&&(a.value="")})})}),window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(permalinkWatcher,500)});const schemaGeneratorInit=function(){var e,r="",t="";const a=function(e,t=!1){var a=null,l={},n=document.querySelector(".diagnoseo-schema-generator");n&&(l=(l=n.dataset.schemaData)&&JSON.parse(l));const i=["Article","NewsArticle","BlogPosting"];if(!t&&i.includes(e)&&i.includes(r))return r=e,!1;switch(r=e){case"Article":case"NewsArticle":case"BlogPosting":a=articleSchemaForm(l);break;case"Review":a=reviewSchemaForm(l);break;case"Service":a=serviceSchemaForm(l);break;case"Product":a=productSchemaForm(l);break;case"Course":a=courseSchemaForm(l);break;case"Recipe":a=recipeSchemaForm(l);break;case"Person":a=personSchemaForm(l);break;case"JobPosting":a=jobPostingSchemaForm(l);break;case"SoftwareApplication":a=appSchemaForm(l);break;case"Book":a=bookSchemaForm(l);break;case"Event":a=eventSchemaForm(l);break;case"VideoObject":a=videoSchemaForm(l);break;case"ImageObject":a=imageSchemaForm(l);break;case"WebPage":a=webPageSchemaForm(l);break;case"AboutPage":a=aboutPageSchemaForm(l);break;case"FAQPage":a=faqPageSchemaForm(l);break;case"ContactPage":a=contactPageSchemaForm(l);break;default:a=null}const o=document.querySelector(".diagnoseo-schema-fields");return a?(o&&(o.innerHTML="",o.appendChild(a)),!0):(o&&(o.innerHTML=""),!1)},l=function(){const t=document.querySelector(".diagnoseo-schema-generator");if(t){var{schemaData:a}=t.dataset;if(a)for(prop in a=JSON.parse(a)){var l=prop.replaceAll("_","-");let e=t.querySelector(`#${l}`);e&&!e.value&&(e.value=a[prop])}}},n=document.querySelector("#schema-type");n&&(n.addEventListener("change",e=>{a(e.target.value)&&l()}),(e=document.querySelector(".diagnoseo-schema-generator"))&&(t=e.dataset.defaultSchemaType),r=n.value||""),a(r||t,!0),l()};window.addEventListener("load",schemaGeneratorInit);const aboutPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},appSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"operating-system",type:"text",value:e.operating_system||"",label:"Operating system"},{fieldType:"input",name:"app-category",type:"text",value:e.app_category||"",label:"Application category",hint:"Example: Multimedia, Game"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Currency"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"input",name:"rating-count",type:"number",value:e.rating_count,label:"Rating count"}];return t.buildSchemaForm(e)},articleSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"headline",type:"text",value:e.headline||"",label:"Headline"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"keywords",type:"text",value:e.keywords||"",label:"Keywords"}];return t.buildSchemaForm(e)},bookSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"input",name:"url",type:"url",value:e.url||"",label:"URL"},{fieldType:"input",name:"author-name",type:"text",value:e.author_name||"",label:"Author name"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"}];return t.buildSchemaForm(e)},contactPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},courseSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Course name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Course description"},{fieldType:"sectionTitle",text:"Provider"},{fieldType:"select",name:"provider-type",value:e.provider_type,label:"Provider type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"provider-name",type:"text",value:e.provider_name||"",label:"Provider name"},{fieldType:"input",name:"provider-url",type:"text",value:e.provider_url||"",label:"Provider URL"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},eventSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"type",value:e.type,options:[{value:"Event",label:"Event"},{value:"BusinessEvent",label:"Business Event"},{value:"ChildrensEvent",label:"Childrens Event"},{value:"ComedyEvent",label:"Comedy Event"},{value:"DanceEvent",label:"Dance Event"},{value:"DeliveryEvent",label:"Delivery Event"},{value:"EducationEvent",label:"Education Event"},{value:"ExhibitionEvent",label:"Exhibition Event"},{value:"Festival",label:"Festival"},{value:"FoodEvent",label:"Food Event"},{value:"LiteraryEvent",label:"Literary Event"},{value:"MusicEvent",label:"Music Event"},{value:"PublicationEvent",label:"Publication Event"},{value:"SaleEvent",label:"Sale Event"},{value:"ScreeningEvent",label:"Screening Event"},{value:"SocialEvent",label:"Social Event"},{value:"SportsEvent",label:"Sports Event"},{value:"TheaterEvent",label:"Theater Event"},{value:"VisualArtsEvent",label:"Visual Arts Event"}],label:"Event type"},{fieldType:"select",name:"status",value:e.status,options:[{value:"",label:"None"},{value:"EventScheduled",label:"Scheduled"},{value:"EventCancelled",label:"Cancelled"},{value:"EventPostponed",label:"Postponed"},{value:"EventRescheduled",label:"Rescheduled"},{value:"EventMovedOnline",label:"Moved Online"}],label:"Event status"},{fieldType:"select",name:"mode",value:e.mode,options:[{value:"OfflineEventAttendanceMode",label:"Offline"},{value:"OnlineEventAttendanceMode",label:"Online"},{value:"MixedEventAttendanceMode",label:"Mixed (Offline + Online)"}],label:"Attendance mode"},{fieldType:"input",name:"date-start",type:"date",value:e.date_start,label:"Start date"},{fieldType:"input",name:"date-end",type:"date",value:e.date_end,label:"End date"},{fieldType:"sectionTitle",text:"Venue"},{fieldType:"input",name:"venue-name",type:"text",value:e.venue_name||"",label:"Venue name"},{fieldType:"input",name:"venue-url",type:"url",value:e.venue_url||"",label:"Venue URL"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"},{fieldType:"sectionTitle",text:"Performer"},{fieldType:"select",name:"performer-type",value:e.performer_type,options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}],label:"Performer"},{fieldType:"input",name:"performer-name",type:"text",value:e.performer_name||"",label:"Performer name"},{fieldType:"input",name:"performer-url",type:"url",value:e.performer_url||"",label:"Performer website or social link"},{fieldType:"sectionTitle",text:"Organizer"},{fieldType:"select",name:"organizer-type",value:e.organizer_type,options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}],label:"Organizer"},{fieldType:"input",name:"organizer-name",type:"text",value:e.organizer_name||"",label:"Organizer name"},{fieldType:"input",name:"organizer-url",type:"url",value:e.organizer_url||"",label:"Organizer website or social link"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-url",type:"url",value:e.offer_url||"",label:"Offer URL"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Offer price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Offer currency"},{fieldType:"select",name:"offer-availability",value:e.offer_availability,options:[{value:"InStock",label:"In Stock"},{value:"SoldOut",label:"Sold Out"},{value:"Preorder",label:"Preorder"}],label:"Availability"},{fieldType:"input",name:"price-valid-from",type:"date",value:e.price_valid_from,label:"Price valid from"},{fieldType:"input",name:"inv-level",type:"text",value:e.inv_level||"",label:"Inventory level"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"}];return t.buildSchemaForm(e)},faqPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"main-question",type:"text",value:e.main_question||"",label:"Main entity - question"},{fieldType:"textarea",name:"main-answer",type:"text",value:e.main_answer||"",label:"Main entity - answer"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},imageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"location",type:"text",value:e.location||"",label:"Location",hint:"Name of the place where the picture was taken, for example: Manhattan, New York"}];return t.buildSchemaForm(e)},jobPostingSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"salary-currency",type:"text",value:e.salary_currency||"",label:"Salary currency",hint:"ISO 4217 Currency code. Example: EUR"},{fieldType:"input",name:"salary-amount",type:"text",value:e.salary_amount||"",label:"Salary amount",hint:"Insert amount, e.g. 100.00, or a salary range, e.g. 120.00-160.00"},{fieldType:"select",name:"salary-payroll",value:e.salary_payroll,label:"Payroll",options:[{value:"None",label:""},{value:"Yearly",label:"YEAR"},{value:"Monthly",label:"MONTH"},{value:"Weekly",label:"WEEK"},{value:"Daily",label:"DAY"},{value:"Hourly",label:"HOUR"}]},{fieldType:"input",name:"date-posted",type:"date",value:e.date_posted,label:"Date posted",hint:"Choose date, post publication date will be used if this field is empty"},{fieldType:"input",name:"date-expires",type:"date",value:e.date_expires,label:"Expiry date",hint:"Leave empty if the job posting does not expire"},{fieldType:"select",name:"employment-type",value:e.employment_type,label:"Employment type",options:[{value:"FULL_TIME",label:"Full Time"},{value:"PART_TIME",label:"Part Time"},{value:"CONTRACTOR",label:"Contractor"},{value:"TEMPORARY",label:"Temporary"},{value:"INTERN",label:"Intern"},{value:"VOLUNTEER",label:"Volunteer"},{value:"PER_DIEM",label:"Per Diem"},{value:"OTHER",label:"Other"}]},{fieldType:"input",name:"posting-id",type:"text",value:e.posting_id||"",label:"Posting ID"},{fieldType:"sectionTitle",text:"Hiring organization"},{fieldType:"input",name:"company",type:"text",value:e.company||"",label:"Hiring organization"},{fieldType:"input",name:"org-url",type:"url",value:e.org_url||"",label:"Organization URL"},{fieldType:"input",name:"org-logo",type:"url",value:e.org_logo||"",label:"Organization logo URL"},{fieldType:"sectionTitle",text:"Job location"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"}];return t.buildSchemaForm(e)},personSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"email",type:"email",value:e.email||"",label:"E-mail"},{fieldType:"input",name:"gender",type:"text",value:e.gender||"",label:"Gender"},{fieldType:"input",name:"job-title",type:"text",value:e.job_title||"",label:"Job title"},{fieldType:"input",name:"url",type:"url",value:e.url||"",label:"URL"},{fieldType:"input",name:"image",type:"url",value:e.url||"",label:"Image URL"},{fieldType:"sectionTitle",text:"Address"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"}];return t.buildSchemaForm(e)},productSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Product name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Product description"},{fieldType:"input",name:"sku",type:"text",value:e.sku||"",label:"Product SKU"},{fieldType:"input",name:"identifier_name",type:"text",value:e.identifier_name||"",label:"Global identifier",hint:"GTIN, MPN, ISBN or other"},{fieldType:"input",name:"identifier_value",type:"text",value:e.identifier_value||"",label:"Global identifier value"},{fieldType:"input",name:"brand",type:"text",value:e.brand||"",label:"Brand name"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"price",type:"number",value:e.price,label:"Price",step:"0.01"},{fieldType:"input",name:"currency",type:"text",value:e.currency||"",label:"Currency"},{fieldType:"input",name:"deadline",type:"date",value:e.deadline,label:"Price valid until"},{fieldType:"select",name:"availability",value:e.availability,options:[{label:"In Stock",value:"InStock"},{label:"Sold Out",value:"SoldOut"},{label:"Preorder",value:"Preorder"}],label:"Availability"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"sectionTitle",text:"Review publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},recipeSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Recipe title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Recipe description"},{fieldType:"input",name:"prep-time",type:"text",value:e.prep_time||"",label:"Preparation time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"cook-time",type:"text",value:e.cook_time||"",label:"Cooking time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"total-time",type:"text",value:e.total_time||"",label:"Total time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"type",type:"text",value:e.type||"",label:"Type of dish",hint:"Example: appetizer or dessert"},{fieldType:"input",name:"cuisine",type:"text",value:e.cuisine||"",label:"Cuisine"},{fieldType:"input",name:"keywords",type:"text",value:e.keywords||"",label:"Keywords"},{fieldType:"input",name:"yield",type:"text",value:e.yield||"",label:"Recipe yield",hint:"Quantity of portions produced by the recipe, for example: 4"},{fieldType:"input",name:"calories",type:"number",value:e.calories,label:"Calories"},{fieldType:"textarea",name:"ingredients",value:e.ingredients?e.ingredients.join("; "):"",label:"Ingredients",hint:"Separate ingredients with semicolons (;)",splitLines:";"},{fieldType:"textarea",name:"instructions",value:e.instructions?e.instructions.join("; "):"",label:"Recipe instructions",hint:"Separate instructions with semicolons (;)",splitLines:";"},{fieldType:"sectionTitle",text:"Aggregate Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-count",type:"number",value:e.rating_count,label:"Rating count"},{fieldType:"sectionTitle",text:"Video"},{fieldType:"input",name:"video-title",type:"text",value:e.video_title||"",label:"Video title"},{fieldType:"textarea",name:"video-description",value:e.video_description||"",label:"Video description"},{fieldType:"input",name:"video-url",type:"url",value:e.video_url||"",label:"Video URL"},{fieldType:"input",name:"video-content-url",type:"url",value:e.video_content_url||"",label:"Video content URL",hint:"A URL pointing to the actual video media file"},{fieldType:"input",name:"video-thumbnail",type:"url",value:e.video_thumbnail||"",label:"Video thumbnail URL"},{fieldType:"input",name:"video-duration",type:"text",value:e.video_duration||"",label:"Video duration",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"video-uploaded",type:"date",value:e.video_uploaded,label:"Video upload date"}];return t.buildSchemaForm(e)},reviewSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Review title"},{fieldType:"sectionTitle",text:"Reviewed item"},{fieldType:"select",name:"reviewed-item",value:e.reviewed_item,label:"Reviewed item",options:[{value:"Book",label:"Book"},{value:"Course",label:"Course"},{value:"Event",label:"Event"},{value:"How-to",label:"How-to"},{value:"LocalBusiness",label:"Local Business"},{value:"Movie",label:"Movie"},{value:"Product",label:"Product"},{value:"Recipe",label:"Recipe"},{value:"SoftwareApp",label:"Software App"}]},{fieldType:"input",name:"reviewed-item-image",type:"url",value:e.reviewed_item_image||"",label:"Reviewed item image URL"},{fieldType:"input",name:"reviewed-item-name",type:"text",value:e.reviewed_item_name||"",label:"Reviewed item name"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",step:"0.01",value:e.rating,label:"Rating value"},{fieldType:"textarea",name:"review-body",value:e.review_body||"",label:"Review text"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},serviceSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"service-type",type:"text",value:e.service_type||"",label:"Service type"},{fieldType:"input",name:"service-name",type:"text",value:e.service_name||"",label:"Name"},{fieldType:"textarea",name:"service-description",value:e.service_description||"",label:"Service description"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Currency"}];return t.buildSchemaForm(e)},videoSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"embed-url",type:"url",value:e.embed_url||"",label:"Embed URL",hint:"A URL pointing to the embeddable player for the video. Example: https://www.youtube.com/embed/VIDEOID"},{fieldType:"input",name:"content-url",type:"url",value:e.content_url||"",label:"Content URL",hint:"A URL pointing to the actual video media file like MP4, MOV, etc. Please leave it empty if you don't know the URL"},{fieldType:"input",name:"duration",type:"text",value:e.duration||"",label:"Duration",hint:"ISO 8601 duration format. Example: PT1H30M"}];return t.buildSchemaForm(e)},webPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},seoHelper={slugify:function(e){e=(e=e.replace(/^\s+|\s+$/g,"")).toLowerCase();for(var t="àáãäâąèéëêęìíïîóòóöôùúüûñńśçćźżł·/_,:;",a=0,l=t.length;a<l;a++)e=e.replace(new RegExp(t.charAt(a),"g"),"aaaaaaeeeeeiiiiooooouuuunnscczzl------".charAt(a));return e=e.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},countOccurences:function(e,t){if(!t||!e)return 0;t=t.toLowerCase().replaceAll(/[:;,.!?-]/g,""),e=e.toLowerCase();e=new RegExp(e,"g");return(t.match(e)||[]).length},countSyllables:function(e){if(""===e)return 0;if(e.length<=3)return 1;e=(e=(e=(e=e.toLowerCase()).replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,"")).replace(/^y/,"")).match(/[aeiouy]{1,2}/g);return e?e.length:0},countWords:function(e){e=(e=(e=e.replace(/(\r\n|\n|\r)/gm," ")).replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g," ")).split(" ");return(e=(e=e.map(e=>e.trim())).filter(e=>e&&""!==e&&"\n"!==e)).length||0},countElements:function(e,t){if(!e||!t)return 0;const a=document.createElement("div");return a.innerHTML=e,a.querySelectorAll(t).length},replaceVariables:function(e){if(e){var{site:t,siteTagline:a,separator:l,excerpt:n,postTitle:i}=document.querySelector(".diagnoseo-preview").dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",document.body.classList.contains("block-editor-page")?window.wp.data.select("core/editor").getEditedPostAttribute("title"):i)).replaceAll("%sitename%",t)).replaceAll("%tagline%",a)).replaceAll("%sep%",l)).replaceAll("%page%"," ")).replaceAll("%excerpt%",n)).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))}},isKeywordInText:function(e,t){if(!e||!t)return!1;e=e.toLowerCase();let a=(t=t.toLowerCase()).toLowerCase().replaceAll(/[:;,.!?-]/g,"");return t.includes(e)||a.includes(e)},isKeywordInAnyElement:function(t,e,a){if(!t||!e||!a)return!1;var l=!1;const n=seoHelper.createMarkupEl(e);return elements=n.querySelectorAll(a),elements.forEach(e=>{seoHelper.isKeywordInText(t,e.textContent)&&(l=!0)}),l},isKeywordInAnyAlt:function(t,e,a=null){if(!t)return!1;if(a&&seoHelper.isKeywordInText(t,a.alt_text))return!0;var l=0;const n=seoHelper.createMarkupEl(e),i=n.querySelectorAll("img");return i.forEach(e=>{e=e.getAttribute("alt").toLowerCase();l+=seoHelper.countOccurences(t,e)}),l},createMarkupEl:function(e){const t=document.createElement("div");return t.innerHTML=e,t},stripTags:function(e){return e.replace(/(<([^>]+)>)/gi,"")}};function initSerpSimulator(){"use strict";const o=document.body.classList.contains("block-editor-page"),r=document.querySelector(".diagnoseo-preview");if(!r)return;const l=r.querySelector(".search-result .search-result-title"),a=r.querySelector(".search-result.mobile .search-result-title"),n=r.querySelector(".search-result .search-result-descr"),i=r.querySelector(".search-result.mobile .search-result-descr"),e=document.querySelector(".diagnoseo-meta-form")||document.querySelector(".diagnoseo-settings-form"),s=e.querySelector("#seo-title")||e.querySelector("#diagnoseo_home_title"),d=e.querySelector(".info-title-chars"),c=e.querySelector(".info-title-width"),u=e.querySelector(".seo-title-progress .diagnoseo-progress-fill"),p=e.querySelector("#seo-description")||e.querySelector("#diagnoseo_home_description"),m=e.querySelector(".info-descr-chars"),y=e.querySelector(".info-descr-width"),g=e.querySelector(".seo-descr-progress .diagnoseo-progress-fill"),b=e.querySelector("#seo-slug"),v=e.querySelector(".info-slug-chars"),h=e.querySelector(".seo-slug-progress .diagnoseo-progress-fill"),f=r.querySelector(".title-sample"),w=r.querySelector(".description-sample"),t=function(){for(var e=!1;function(){var e=l.offsetWidth-20;l.style.maxWidth="none",l.style.position="absolute";var t=l.offsetWidth;return l.removeAttribute("style"),e<t}();){var t=T(l.textContent);if(!t)break;t=(t=(t=t.replace(/\/$/," ...")).split(" ").slice(0,-1).join(" ")).replace(/,\s*$/,""),e=!0,l.textContent=t,a.textContent=t}e&&(l.textContent=l.textContent+" ...",a.textContent=a.textContent+" ...")},_=function(e,t,a=0){const l=e.split(" "),n=w;if(!n)return e;e=function(e,t){for(var a,l="",n=e.split(" "),i=0;i<n.length;i++)if(a=l,(l+=" "+n[i]).length>t){l=a+" ...";break}return l=l.replace(/,\s*$/,"")}(e,a),n.textContent=e;for(var i=!1;n.clientWidth>t;){l.pop();var i=!0,o=l.join(" ");n.textContent=o}return i?l.join(" ")+" ...":e},k=function(e){var t=T(e),e=_(t,960,158);n.textContent=e;e=_(t,680,158);i.textContent=e,w.textContent=t},T=function(e){if(!e)return"";var{site:t,siteTagline:a,separator:l,excerpt:n,postTitle:i}=r.dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",o?window.wp.data.select("core/editor").getEditedPostAttribute("title"):i)).replaceAll("%sitename%",t)).replaceAll("%tagline%",a)).replaceAll("%sep%",l)).replaceAll(" %page%","")).replaceAll("%excerpt%",n||x())).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))},E=function(e){e=T(e),f.textContent=e||l.dataset.fallback,l.textContent=e||l.dataset.fallback,a.textContent=e||l.dataset.fallback,t()},x=function(){if(!window.wp||!window.wp.data)return"";let a=o?window.wp.data.select("core/editor").getEditedPostAttribute("excerpt"):r.dataset.excerpt;if(!a){let e=o?window.wp.data.select("core/editor").getEditedPostContent():"";e=seoHelper.stripTags(e).trim();let t=e.split(" ");var l=Math.min(t.length,55);t=t.splice(0,l),a=t.join(" ")}return a},S=function(){var e,t,a,l;u&&(e=f.clientWidth,l=f.textContent,100<(a=e/600*100)&&(a=100),(t=(l=T(l)).length)||(a=0),a+="%",l="",30<=t&&e<=600&&(30<=t&&t<35||60<t&&e<=600?l="medium":35<=t&&t<=60&&(l="full")),d.textContent=t,c.textContent=e,u.style.width=a,l?u.classList.contains(l)||(u.classList.remove("medium","full"),u.classList.add(l)):u.classList.remove("medium","full"))},P=function(){var e,t,a,l;g&&(l=w.textContent,e=w.clientWidth,t=l.length,100<(a=e/990*100)&&(a=100),p.value.length||p.getAttribute("placeholder")||(a=0),a+="%",l="",70<=t&&e<=990&&(70<=t&&t<130||158<t&&e<=990?l="medium":130<=t&&t<=158&&(l="full")),m.textContent=t,y.textContent=e,g.style.width=a,l?g.classList.contains(l)||(g.classList.remove("medium","full"),g.classList.add(l)):g.classList.remove("medium","full"))},C=function(){var e,t,a;h&&(t="",(a=(e=(e=b.value).replaceAll(" ","-")).split("-")).length<=5&&e.length?e.length<=50?t="full":50<e.length&&e.length<=60&&(t="medium"):5<a.length&&e.length<60&&(t="medium"),100<(a=Math.round(e.length/60*100))&&(a=100),h.style.width=a+"%",v.textContent=e.length,t?h.classList.contains(t)||(h.classList.remove("medium","full"),h.classList.add(t)):h.classList.remove("medium","full"))};s&&(s.addEventListener("input",function(e){E(e.target.value),f.textContent=T(e.target.value),o&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_title:e.target.value}}),S()}),E(s.value||s.getAttribute("placeholder")),S());const A=l.dataset.fallback;o?window.wp.data.subscribe(()=>{var e=window.wp.data.select("core/editor").getEditedPostAttribute("title")||r.dataset.postTitle;l.dataset.fallback=e||A;var t=s.value||s.getAttribute("placeholder");E(t),S();const a=document.querySelector("#postlist-title");!(window.wp.data.select("core/editor").getEditedPostAttribute("meta")?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:e)&&a&&a.setAttribute("placeholder",e)}):s&&s.addEventListener("input",e=>{var t=o?window.wp.data.select("core/editor").getEditedPostAttribute("title"):r.dataset.postTitle;l.dataset.fallback=t||A;e=e.target.value||e.target.value.getAttribute("placeholder");E(e),S();const a=document.querySelector("#postlist-title");!(o?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:t)&&a&&a.setAttribute("placeholder",t)}),p&&(p.addEventListener("input",function(e){k(e.target.value||e.target.getAttribute("placeholder")),o&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_description:e.target.value}}),P()}),k(p.value||p.getAttribute("placeholder")),P()),b&&b.addEventListener("input",e=>{o&&window.wp.data.dispatch("core/editor").editPost({slug:seoHelper.slugify(e.target.value)}),C()});const L=document.querySelectorAll(".diagnoseo-var-input");L&&L.forEach(e=>{const l=e.querySelector(".var-input"),n=e.querySelector(".var-select"),t=e.querySelector(".var-button");t.addEventListener("click",e=>{e.preventDefault();var t,a=n.value;a&&(l.selectionStart||"0"==l.selectionStart?(t=l.selectionStart,e=l.selectionEnd,l.value=l.value.substring(0,t)+" "+a+l.value.substring(e,l.value.length)):l.value+=a,l.dispatchEvent(new Event("input")))})}),setTimeout(function(){t(),S(),P(),C()},500)}window._wpLoadBlockEditor?window._wpLoadBlockEditor.then(function(){setTimeout(initSerpSimulator,500)}):window.addEventListener("load",initSerpSimulator);const startSocialPreview=function(){ const{select:m,dispatch:l,subscribe:e}=window.wp.data,t=document.querySelectorAll(".diagnoseo-social-meta"),a=document.body.classList.contains("block-editor-page");if(t){const y=document.querySelector("#facebook-title"),g=document.querySelector("#twitter-title"),b=document.querySelector("#facebook-description"),v=document.querySelector("#twitter-description"),h=document.querySelector("#seo-title"),f=document.querySelector("#seo-description");if(h.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");y.setAttribute("placeholder",e),g.setAttribute("placeholder",e)}),f.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");b.setAttribute("placeholder",e),v.setAttribute("placeholder",e)}),t.forEach(e=>{e.addEventListener("input",e=>{a&&function(e,t){const a={};a[e]=t,l("core/editor").editPost({meta:a})}(e.target.dataset.customField,e.target.value)})}),a)e(()=>{const e=m("core/editor");var t=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_title||y.value||h.value||y.getAttribute("placeholder"),a=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_description||b.value||f.value||f.getAttribute("placeholder"),l=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_title||g.value||h.value||g.getAttribute("placeholder"),n=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_description||v.value||f.value||f.getAttribute("placeholder"),i=e.getEditedPostAttribute("featured_media");const o=document.querySelectorAll(".diagnoseo-social-preview"),r=document.querySelector(".preview-facebook"),s=document.querySelector(".preview-twitter"),d=r.querySelector(".facebook-post-title");d&&(d.textContent=seoHelper.replaceVariables(t));const c=r.querySelector(".facebook-post-description");c&&(c.textContent=seoHelper.replaceVariables(a));const u=s.querySelector(".twitter-post-title");u&&(u.textContent=seoHelper.replaceVariables(l));const p=s.querySelector(".twitter-post-description");p&&(p.textContent=seoHelper.replaceVariables(n)),o.forEach(e=>{var t=i?m("core").getMedia(i):null,t=t?t.guid.raw:e.dataset.placeholderImage;const a=e.querySelector(".preview-image img");a.setAttribute("src",t)})});else{const n=document.querySelector(".preview-facebook"),i=document.querySelector(".preview-twitter"),o=n.querySelector(".facebook-post-title"),r=n.querySelector(".facebook-post-description"),s=i.querySelector(".twitter-post-title"),d=i.querySelector(".twitter-post-description");o.textContent=seoHelper.replaceVariables(n.dataset.facebookTitle),r.textContent=seoHelper.replaceVariables(n.dataset.facebookDescription),s.textContent=seoHelper.replaceVariables(i.dataset.twitterTitle),d.textContent=seoHelper.replaceVariables(i.dataset.twitterDescription),y.addEventListener("input",e=>{e=e.target.value;o&&(o.textContent=seoHelper.replaceVariables(e))}),b.addEventListener("input",e=>{e=e.target.value;r&&(r.textContent=seoHelper.replaceVariables(e))}),g.addEventListener("input",e=>{e=e.target.value;s&&(s.textContent=seoHelper.replaceVariables(e))}),v.addEventListener("input",e=>{e=e.target.value;d&&(d.textContent=seoHelper.replaceVariables(e))})}}};window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(startSocialPreview,500)}),document.body.classList.contains("block-editor-page")||window.addEventListener("load",startSocialPreview),jQuery(document).on("ready",function(){jQuery(".toggle").each(function(){const t=jQuery(this).find(".toggle-trigger"),a=jQuery(this).find(".toggle-content");t.on("click",function(e){e.preventDefault(),a.slideToggle(),t.toggleClass("open")})})});1 const{__}=window.wp.i18n;window.diagnoseo={additionalKeywordLimit:10,additionalKeywordCount:0,RelatedKeywordsInPost:0,checks:[{id:"title-not-too-long",type:"check",label:__("Title not too long"),section:"content",test:e=>{var{metaTitle:t,postTitle:e}=e;if(!t&&!e)return"nok";t=t||e;const a=document.querySelector(".title-sample");a.textContent=t;e=a.clientWidth,t=t.length;return e<=600?60<t?"nok medium-nok":t<=60?"ok":"nok":"nok"}},{id:"title-not-too-short",type:"check",label:__("Title not too short"),section:"content",test:e=>{var{metaTitle:t,postTitle:e}=e;if(!t&&!e)return"nok";e=(t||e).length;return 30<=e?30<=e&&e<35?"nok medium-nok":35<=e?"ok":"nok":"nok"}},{id:"description-not-too-long",type:"check",label:__("Description not too long"),section:"content",test:e=>{var{metaDescription:t}=e;if(!t)return"nok";e=document.querySelector(".description-sample"),t=t.length;if(e.clientWidth<=990){if(155<t)return"nok medium-nok";if(t<=155)return"ok"}return"nok"}},{id:"description-not-too-short",type:"check",label:__("Description not too short"),section:"content",test:e=>{var{metaDescription:e}=e;if(!e)return"nok";e=e.length;if(70<=e){if(e<130)return"nok medium-nok";if(130<=e)return"ok"}return"nok"}},{id:"too-long-sentences",type:"check",label:__("No sentences with more than 20 words"),section:"content",test:e=>{var{postContent:e}=e;e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("</p>",".</p>")).replaceAll("</h1>",".</h1>")).replaceAll("</h2>",".</h2>")).replaceAll("</h3>",".</h3>")).replaceAll("</h4>",".</h4>")).replaceAll("</h5>",".</h5>")).replaceAll("</h6>",".</h6>")).replaceAll("</li>",".</li>");const t=(e=seoHelper.stripTags(e)).split(/\.|\?|!/);var a=!1;return t.length&&t.forEach(e=>{a=a||20<seoHelper.countWords(e)}),a?"nok":"ok"}},{id:"too-many-words",type:"check",label:__("No paragraphs with more than 100 words"),section:"content",test:e=>{const t=seoHelper.createMarkupEl(e.postContent),a=t.querySelectorAll("p");var l=!1;return a.length&&a.forEach(e=>{100<seoHelper.countWords(e.textContent)&&(l=!0)}),l?"nok":"ok"}},{id:"too-many-sentences",type:"check",label:__("No paragraphs with more than 5 sentences"),section:"content",test:e=>{const t=seoHelper.createMarkupEl(e.postContent),a=t.querySelectorAll("p");var l=!1;return a.length&&a.forEach(e=>{5<e.textContent.split(/\.|\?|!/).filter(e=>!!e.trim()).length&&(l=!0)}),l?"nok":"ok"}},{id:"internal-links-present",type:"check",label:__("Contains internal links"),section:"content",test:e=>{const t=seoHelper.createMarkupEl(e.postContent),a=t.querySelectorAll("a");var l=!1;return a.forEach(e=>{e=e.getAttribute("href")||"";e&&(e.includes("http://"+window.location.hostname)||e.includes("https://"+window.location.hostname)||"/"===e.substr(0,1)||"./"===e.substr(0,2))&&(l=!0)}),l?"ok":"nok"}},{id:"strong-present",type:"check",label:__("Contains bold text (strong tag)"),section:"content",test:e=>seoHelper.countElements(e.postContent,"strong")?"ok":"nok"},{id:"readability",type:"stats",label:__("Readability score"),order:"label value comment",section:"content",test:e=>{var{postContent:t}=e,a=(t=seoHelper.stripTags(t)).split(/\.|\?|!/);a=(a=a.map(e=>e.trim())).filter(e=>e&&" "!==e&&"\n"!==e);e=(t=t.replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g," ")).split(" ");e=(e=e.map(e=>e.trim())).filter(e=>e&&""!==e&&"\n"!==e);var t=seoHelper.countSyllables(t),l=206.835-e.length/a.length*1.015-t/e.length*84.6;(l=l.toFixed(2))<0?l=0:100<l&&(l=100);var n="",i="";switch(!0){case isNaN(l):l=__("N/A"),n="",i="nok";break;case 90<l:n=__("Very easy to read","diagnoseo"),i="ok";break;case 80<l&&l<=90:n=__("Easy to read","diagnoseo"),i="ok";break;case 70<l&&l<=80:n=__("Fairly easy to read","diagnoseo"),i="ok";break;case 60<l&&l<=70:n=__("Average reading ease","diagnoseo"),i="nok medium-nok";break;case 50<l&&l<=60:n=__("Fairly difficult to read","diagnoseo"),i="nok";break;case 30<l&&l<=50:n=__("Difficult to read","diagnoseo"),i="nok";break;case 10<l&&l<=30:n=__("Very difficult to read","diagnoseo"),i="nok";break;case l<=10:n=__("Extremely difficult to read","diagnoseo"),i="nok"}return{value:l,comment:n=n&&` (${n})`,status:i}}},{id:"est-reading-time",type:"stats",label:__("Estimated reading time"),section:"content",order:"label value",test:e=>{var{postContent:t}=e,e=seoHelper.countWords(t),t=Math.floor(e/225),e=Math.floor(e%225/3.75);return{value:`${t} ${__("min")} ${e} ${__("s")}`}}},{id:"minimal-word-count",type:"check",label:__("Minimal word count"),section:"content",postTypes:["post","page"],inPro:!0},{id:"words",type:"stats",label:__("words"),section:"content",test:e=>{var{postContent:e}=e;return{value:seoHelper.countWords(e)}}},{id:"chars",type:"stats",label:__("characters"),section:"content",test:e=>({value:e.postContent.length||0})},{id:"sentences",type:"stats",label:__("sentences"),section:"content",test:e=>{var{postContent:e}=e,e=(e=e.replace(/(\r\n|\n|\r)/gm," ")).split(/\.|\?|!/);return{value:(e=(e=e.map(e=>e.trim())).filter(e=>e&&" "!==e&&"\n"!==e)).length||0}}},{id:"paragraphs",type:"stats",label:__("paragraphs"),section:"content",test:e=>({value:seoHelper.countElements(e.postContent,"p")})},{id:"headings",type:"stats",label:__("Headings"),inPro:!0,section:"content"},{id:"optimal-heading-number",type:"check",label:__("Optimal number of headings"),inPro:!0,section:"content"},{id:"images",type:"stats",label:__("Images"),inPro:!0,section:"content"},{id:"optimal-image-number",type:"check",label:__("Optimal number of images"),inPro:!0,section:"content"},{id:"too-long-headings",type:"check",label:__("No too long headings"),inPro:!0,section:"content"},{id:"toc-block",type:"check",label:__("Use Table of Contents block"),inPro:!0,section:"content"},{id:"keyword-exists",type:"check",label:__("Keyword is provided"),section:"keyword",test:e=>e.keyword?"ok":"nok"},{id:"keyword-unique",type:"check",label:__("Focus Keyword not used before"),section:"keyword",test:async a=>{var l=document.querySelector(".keyword-unique");if(a.keyword){let e=new URLSearchParams(window.location.search);var n=Object.fromEntries(e.entries()),n=`${diagnoseoRestUrl}diagnoseo/v1/check-posts-keyword/${a.keyword}/${n.post||0}`;let t=0===await(await fetch(n)).json()?"ok":"nok";l?l&&(l.classList.remove("ok","nok"),l.classList.add(t)):setTimeout(()=>{(l=document.querySelector(".keyword-unique"))&&(l.classList.remove("ok","nok"),l.classList.add(t))},200)}else l&&l.classList.add("ok")}},{id:"keyword-in-title",type:"check",label:__("Keyword present in title tag"),section:"keyword",test:e=>{var{keyword:t,postTitle:a,metaTitle:e}=e,a=e||a;return seoHelper.isKeywordInText(t,a)?"ok":"nok"}},{id:"keyword-in-title-beginning",type:"check",label:__("Keyword in the beginning of the title tag"),section:"keyword",test:e=>{var{keyword:t,postTitle:a,metaTitle:e}=e;if(!t)return"nok";a=(a=e||a).toLowerCase(),t=t.toLowerCase();const l=new RegExp("^"+t);return l.test(a)?"ok":"nok"}},{id:"keyword-in-descr",type:"check",label:__("Keyword present in meta description tag"),section:"keyword",test:e=>{var{keyword:t,metaDescription:e}=e;return seoHelper.isKeywordInText(t,e)?"ok":"nok"}},{id:"keyword-in-slug",type:"check",label:__("Keyword present in URL slug"),section:"keyword",test:e=>{var{keyword:t,slug:a,postTitle:e}=e;return t&&(a=a||seoHelper.slugify(e)).includes(seoHelper.slugify(t))?"ok":"nok"}},{id:"slug-length-ok",type:"check",label:__("URL slug length"),section:"keyword",test:e=>{var{slug:t,postTitle:e}=e;if(!t&&!e)return"nok";if((t=t||seoHelper.slugify(e)).length<=60&&t.split("-").length<=5)return"ok";return"nok"}},{id:"keyword-in-h1",type:"check",label:__("Keyword present in H1 element"),section:"keyword",test:e=>{var{keyword:t,postContent:a,postTitle:e}=e;return seoHelper.isKeywordInText(t,e)||seoHelper.isKeywordInAnyElement(t,a,"h1")?"ok":"nok"}},{id:"keyword-in-image-alt",type:"check",label:__("Keyword present in any image alt attribute"),section:"keyword",test:e=>{var{keyword:t,postContent:a,featuredImage:e}=e;return seoHelper.isKeywordInAnyAlt(t,a,e)?"ok":"nok"}},{id:"keyword-in-image-filename",type:"check",label:__("Keyword in image file name"),section:"keyword",inPro:!0,hidden:!0},{id:"keyword-not-in-ext-link",type:"check",label:__("Keyword NOT present in external link text"),section:"keyword",test:e=>{const{keyword:a,postContent:t}=e;if(!a)return"ok";const l=seoHelper.createMarkupEl(t);var n=!1;const i=l.querySelectorAll("a");return i.forEach(e=>{const t=e.getAttribute("href")||"";t.includes("http://"+window.location.hostname)||t.includes("https://"+window.location.hostname)||"/"===t.substr(0,1)||"./"===t.substr(0,2)||!seoHelper.isKeywordInText(a,e.textContent)||(n=!0)}),n?"nok":"ok"}},{id:"keyword-in-first-words",type:"check",label:__("Keyword present within first 100 words"),section:"keyword",test:e=>{var{keyword:t,postContent:e}=e;if(!t)return"nok";var t=t.trim(),a=(e=seoHelper.stripTags(e)).toLowerCase().split(/\s|\n/),l=100<=(a=a.filter(e=>e)).length?100:a.length;if(a=a.splice(0,l),!seoHelper.isKeywordInText(t,a.join(" ")))return"nok";if(1<t.split(" ").length)return"ok";if(a.length)for(let e=0;e<l;e++)a[e]=a[e].replace(".",""),a[e]=a[e].replace(",",""),a[e]=a[e].replace("?",""),a[e]=a[e].replace("!",""),a[e]=a[e].replace(":",""),a[e]=a[e].replace(";","");return a.includes(t)?"ok":"nok"}},{id:"more",type:"check",label:__("Many more powerful SEO checkpoints"),inPro:!0,section:"content"},{id:"more",type:"check",label:__("Many more powerful SEO checkpoints"),inPro:!0,section:"keyword"}],checkResults:{}},function(){"use strict";function l(){return(0,c.createElement)("svg",{"enable-background":"new 0 0 20 20",height:"20",width:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",className:"diagnoseo-icon"},(0,c.createElement)("clipPath",{id:"a"},(0,c.createElement)("path",{d:"m0 0h20v20h-20z"})),(0,c.createElement)("path",{className:"diagnoseo-icon-part-tick",d:"m12.377 5.866 1.835 1.612-4.839 5.508-4.11-3.576 1.672-1.902 2.256 1.982z"}),(0,c.createElement)("path",{className:"diagnoseo-icon-part-magnifier","clip-path":"url(#a)",d:"m16.298 15.209c1.745-1.983 2.548-4.603 2.208-7.228-.315-2.426-1.555-4.584-3.493-6.077s-4.341-2.139-6.768-1.828c-2.426.315-4.584 1.555-6.077 3.493s-2.142 4.341-1.827 6.767c.649 5.007 5.251 8.554 10.259 7.905 1.441-.188 2.824-.717 4.014-1.536l3.749 3.295 1.476-1.68zm-1.471-1.887c-1.111 1.443-2.72 2.368-4.527 2.602-1.808.235-3.598-.247-5.041-1.361-1.444-1.111-2.368-2.719-2.602-4.527-.483-3.73 2.158-7.158 5.889-7.642.296-.038.59-.057.881-.057 3.375 0 6.316 2.511 6.761 5.946.235 1.806-.249 3.596-1.361 5.039"}))}var c=window.wp.element,e=window.wp.plugins,i=window.wp.data;class t extends React.Component{constructor(e){super(e),this.state={score:0,timeout:null},this.handleCheckChanged=this.handleCheckChanged.bind(this),this.calculateScore=this.calculateScore.bind(this),this.runAllChecks=this.runAllChecks.bind(this)}calculateScore(){const e=window.diagnoseo.checks.filter(e=>"check"===e.type);var t=e.length+1,a=e.filter(e=>e.checked),a=window.diagnoseo.additionalKeywordCount===window.diagnoseo.RelatedKeywordsInPost?a.length+1:a.length,t=Math.round(100*a/t);this.setState({score:t})}runAllChecks(){const e=window.diagnoseo.checks.filter(e=>"check"===e.type),n={postTitle:(0,i.select)("core/editor").getEditedPostAttribute("title"),postContent:(0,i.select)("core/editor").getEditedPostContent(),keyword:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_keyword,featuredImageId:(0,i.select)("core/editor").getEditedPostAttribute("featured_media"),featuredImage:(0,i.select)("core").getMedia((0,i.select)("core/editor").getEditedPostAttribute("featured_media")),metaTitle:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_title,metaDescription:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_description,slug:(0,i.select)("core/editor").getEditedPostAttribute("slug"),blocks:(0,i.select)("core/block-editor").getBlocks(),optimalKeywordDensity:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_keyword_density,optimalWordNumber:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_word_number,optimalHeadingNumber:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_heading_number,optimalImageNumber:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_image_number};var t;!n.featuredImageId||n.featuredImage?(n.metaTitle=seoHelper.replaceVariables(n.metaTitle)||(document.querySelector("#seo-title")?seoHelper.replaceVariables(document.querySelector("#seo-title").getAttribute("placeholder")):""),n.metaDescription=seoHelper.replaceVariables(n.metaDescription)||(document.querySelector("#seo-description")?seoHelper.replaceVariables(document.querySelector("#seo-description").value):""),e.forEach((t,e)=>{var a,l;t.test&&(a="ok"===t.test(n),l=window.diagnoseo.checks.findIndex(e=>e.id===t.id),window.diagnoseo.checks[l].checked=a)}),this.calculateScore()):t=setInterval(()=>{(0,i.select)("core").getMedia(n.featuredImageId)&&(clearInterval(t),this.runAllChecks())},500)}handleCheckChanged(){clearTimeout(this.state.timeout),this.setState({timeout:setTimeout(this.calculateScore,300)})}async componentDidMount(){window.addEventListener("check-changed",this.handleCheckChanged),setTimeout(this.runAllChecks,1e3)}componentWillUnmount(){window.removeEventListener("check-changed",this.handleCheckChanged)}render(){let e,t=this.state.score;switch(!0){case t<60:e="score-low";break;case 60<=t&&t<80:e="score-medium";break;case 80<=t:e="score-high"}var a=`diagnoseo-button-content ${e}`;return(0,c.createElement)("span",{className:a},(0,c.createElement)(l,null),(0,c.createElement)("b",{className:"diagnoseo-score"},this.state.score,"/100"))}whenEditorIsReady(){return new Promise(e=>{const t=(0,i.subscribe)(()=>{((0,i.select)("core/editor").isCleanNewPost()||0<(0,i.select)("core/block-editor").getBlockCount())&&(t(),e())})})}}var a=t,n=window.wp.editPost,u=window.wp.components,p=window.wp.i18n,o=window.wp.compose,r=(0,o.compose)((0,i.withDispatch)((a,l)=>({setMetaValue:e=>{var t={};t[l.fieldName]=e,a("core/editor").editPost({meta:t}),l.changeCallback&&l.changeCallback(e)}})),(0,i.withSelect)((e,t)=>({metaValue:e("core/editor").getEditedPostAttribute("meta")[t.fieldName]})))(t=>(0,c.createElement)(u.TextControl,{label:t.label,value:t.metaValue,onChange:e=>t.setMetaValue(e)})),s=(0,o.compose)((0,i.withSelect)(e=>({content:e("core/editor").getEditedPostContent(),keyword:e("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_keyword,optimalKeywordDensity:e("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_keyword_density})))(e=>{var t,a,l=0;e.keyword&&(a=(a=(t=(t=(t=e.content.replace(/<\!--.*?-->/g,"")).replace(/(\r\n|\n|\r)/gm," ")).toLowerCase()).split(" ")).filter(e=>""!==e),(t=seoHelper.countOccurences(e.keyword,t))&&(l=(l=t/a.length*100).toFixed(2)));let n;return n=window.diagnoseoPro?(a="diagnoseo-check optimal-keyword-density",parseFloat(e.optimalKeywordDensity),parseFloat(e.optimalKeywordDensity),(0,c.createElement)("p",{className:a+=1<=l&&l<=3?" ok":" nok"},(0,p.__)("Optimal keyword density","diagnoseo")," ",(0,c.createElement)("b",{className:"value"},"1% - 3%"))):(0,c.createElement)("p",{className:"diagnoseo-check optimal-keyword-density"},(0,c.createElement)("i",{className:"dashicons dashicons-lock"})," ",(0,p.__)("Optimal keyword density","diagnoseo")),(0,c.createElement)(c.Fragment,null,(0,c.createElement)("p",{className:"diagnoseo-stats keyword-density"},(0,p.__)("Keyword density","diagnoseo")," ",(0,c.createElement)("b",{className:"value"},l,"%")),n)}),d=t=>{let e=["diagnoseo-check",t.id];var a;if(t.test&&("string"==typeof(a=t.test(t.postData))&&e.push(a),l="ok"===a,a=t.checkConfig.findIndex(e=>e.id===t.id),t.checkConfig[a].checked!==l&&window.dispatchEvent(new Event("check-changed")),t.checkConfig[a].checked=l),t.inPro)return(0,c.createElement)("p",{className:e.join(" ")},(0,c.createElement)("i",{className:"dashicons dashicons-lock"})," ",t.label," ",(0,c.createElement)("b",null,(0,c.createElement)("a",{href:"https://diagnoseo.com/wordpress-seo-plugin/?utm_source=wp&utm_medium=link&utm_campaign=available_in_pro",target:"_blank",rel:"noreferrer noopener"},(0,p.__)("Available in Pro","diagnoseo"))));var l=t.valueFieldName&&t.postData[t.valueFieldName]?(0,c.createElement)("b",null,t.postData[t.valueFieldName]):"";return(0,c.createElement)("p",{className:e.join(" ")},t.label," ",l)},m=e=>{let t=["diagnoseo-stats",e.id];if(e.inPro)return(0,c.createElement)("p",{className:t.join(" ")},(0,c.createElement)("i",{className:"dashicons dashicons-lock"})," ",e.label," ",(0,c.createElement)("b",null,(0,c.createElement)("a",{href:"https://diagnoseo.com/wordpress-seo-plugin/?utm_source=wp&utm_medium=link&utm_campaign=available_in_pro",target:"_blank",rel:"noreferrer noopener"},(0,p.__)("Available in Pro","diagnoseo"))));let a,l=(0,c.createElement)("b",{className:"value"}),n="";var i;return e.test&&(i=e.test(e.postData),l=(0,c.createElement)("b",{className:"value"},i.value),n=i.comment?(0,c.createElement)("span",{className:"comment"},i.comment):"",i.status&&t.push(i.status)),a=e.order&&"value label"!==e.order?(0,c.createElement)(c.Fragment,null,e.label," ",l," ",n):(0,c.createElement)(c.Fragment,null,l," ",e.label),(0,c.createElement)("p",{className:t.join(" ")},a)},y=(0,o.compose)((0,i.withSelect)(e=>({postTitle:e("core/editor").getEditedPostAttribute("title"),postContent:e("core/editor").getEditedPostContent(),featuredImage:e("core").getMedia(e("core/editor").getEditedPostAttribute("featured_media")),keyword:e("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_keyword,metaTitle:e("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_title,metaDescription:e("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_description,urlSlug:e("core/editor").getEditedPostAttribute("slug"),blocks:e("core/block-editor").getBlocks(),optimalKeywordDensity:2,optimalWordNumber:300,optimalHeadingNumber:1,optimalImageNumber:e("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_image_number,postType:e("core/editor").getCurrentPostType()})))(a=>{const l=window.diagnoseo.checks,e=l.filter(e=>e.section===a.sectionName),n={postTitle:a.postTitle,postContent:a.postContent,keyword:a.keyword,metaTitle:seoHelper.replaceVariables(a.metaTitle)||(document.querySelector("#seo-title")?seoHelper.replaceVariables(document.querySelector("#seo-title").getAttribute("placeholder")):""),metaDescription:seoHelper.replaceVariables(a.metaDescription)||(document.querySelector("#seo-description")?seoHelper.replaceVariables(document.querySelector("#seo-description").value):""),slug:a.urlSlug,blocks:a.blocks,featuredImage:a.featuredImage,optimalKeywordDensity:a.optimalKeywordDensity,optimalWordNumber:a.optimalWordNumber,optimalHeadingNumber:a.optimalHeadingNumber,optimalImageNumber:a.optimalImageNumber},t=e.map(e=>{let t=!0;if(e.postTypes&&(t=e.postTypes.includes(a.postType)),!e.hidden&&t)switch(e.type){case"check":return e.inPro?(0,c.createElement)(d,{id:e.id,label:e.label,inPro:e.inPro}):(0,c.createElement)(d,{id:e.id,label:e.label,test:e.test,postData:n,checkConfig:l,valueFieldName:e.valueFieldName});case"stats":return e.inPro?(0,c.createElement)(m,{id:e.id,label:e.label,inPro:e.inPro}):(0,c.createElement)(m,{id:e.id,label:e.label,test:e.test,order:e.order,postData:n})}});return(0,c.createElement)(c.Fragment,null,t.map((e,t)=>(0,c.createElement)(React.Fragment,{key:t},e)))});class g extends React.Component{constructor(e){super(e),this.state={keyword:"",keywordList:[],keywordLimit:(window.diagnoseoPro||window.diagnoseo).additionalKeywordLimit,apiKey:"",language:diagnoseo_settings?diagnoseo_settings.locale.substr(0,2):"",loading:!1},this.handleChange=this.handleChange.bind(this),this.handleLangChange=this.handleLangChange.bind(this),this.handleLoadButtonClick=this.handleLoadButtonClick.bind(this),this.relatedKeywordsApiUrl="diagnoseo/v1/related-keywords"}stripKeywordData(e){return(e=-1===e.indexOf("|")?e:e.substr(0,e.indexOf(" |"))).trim()}async loadRelatedKeywords(){var t=(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_keyword,a=(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_language;if(t)if(this.state.language){this.setState({loading:!0});let e=await this.getRelatedKeywords(t,a);if(e=e.split(","),e.length){let a=this.state.keywordList;e.forEach(t=>{t={name:t.trim()};var e=a.findIndex(e=>e.name===t);-1===e?a.push(t):(a[e].repeat_min=t.repeat_min,a[e].repeat_max=t.repeat_max)}),this.saveKeywords(a)}this.setState({loading:!1})}else alert((0,p.__)("Please select language.","diagnoseo"));else alert((0,p.__)('Please enter the "focus keyword" first',"diagnoseo"))}saveKeywords(e){const t=[...new Set(e)];t.splice(this.state.keywordLimit),this.setState({keywordList:t}),(window.onbeforeunload=null,i.dispatch)("core/editor").editPost({meta:{diagnoseo_meta_additional_keywords:JSON.stringify(t)}})}saveLanguage(e){(0,i.dispatch)("core/editor").editPost({meta:{diagnoseo_meta_language:e}})}componentDidMount(){let e=(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_additional_keywords,t=(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_language;try{e=JSON.parse(e)}catch{e=""}this.setState({language:t,keyword:this.props.focusKeyword,keywordList:e||[]})}async handleLoadButtonClick(){window.diagnoseoPro?this.loadRelatedKeywords():alert((0,p.__)("Related keywords and Pro data require DiagnoSEO Pro.","diagnoseo"))}handleChange(e){const l=this.state.keywordList,{stripKeywordData:n}=this;e=e.map(e=>{let t=n(e.value||e),a=l.findIndex(e=>t===e.name);return{name:t,repeat_min:-1!==a?l[a].repeat_min:0,repeat_max:-1!==a?l[a].repeat_max:0}});this.saveKeywords(e)}handleLangChange(e){this.setState({language:e}),this.saveLanguage(e)}render(){let{postTitle:i,postContent:o,featuredMedia:r}=this.props;const{countOccurences:s}=seoHelper;let d=0,e=this.state.keywordList.map(e=>{let t=e.name||"",a="error",l=function(e){o=seoHelper.stripTags(o);var t=0;return t+=s(e,i),t+=s(e,o),t+=seoHelper.isKeywordInAnyAlt(e,o),t+=r?s(e,r.alt_text):0}(t);l&&(a=!e.repeat_min||!e.repeat_max||l>=e.repeat_min&&l<=e.repeat_max?"success":"validating",d++);let n=` | ${l}`;return e.repeat_min&&e.repeat_max&&(n+=` (${e.repeat_min} - ${e.repeat_max})`),{value:t+n,status:a}}),t=!1;window.diagnoseo.RelatedKeywordsInPost!==d&&(window.diagnoseo.RelatedKeywordsInPost=d,t=!0),window.diagnoseo.additionalKeywordCount!==e.length&&(window.diagnoseo.additionalKeywordCount=e.length,t=!0),t&&window.dispatchEvent(new Event("check-changed"));var a=this.state.loading?(0,p.__)("Please wait... Loading related keywords. It can take up to a few minutes.","diagnoseo"):(0,c.createElement)("button",{className:"button get-related-keywords",onClick:this.handleLoadButtonClick},(0,p.__)("Get related keywords and Pro data","diagnoseo"));return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"components-base-control__field add-keyword diagnoseo-related-keywords"},(0,c.createElement)(u.FormTokenField,{label:(0,c.createElement)("b",null,(0,p.__)("Related keywords","diagnoseo")),onChange:this.handleChange,value:e,maxLength:this.state.keywordLimit+10}),(0,c.createElement)("p",{className:"components-form-token-field__help"},(0,p.__)("Limits: 10 keywords in free, 100 keywords in Pro","diagnoseo")),(0,c.createElement)(u.SelectControl,{options:[{value:"chinese",label:"Taiwan"},{value:"arabic",label:"Bahrain"},{value:"bulgarian",label:"Bulgaria"},{value:"croatian",label:"Croatia"},{value:"czech",label:"Czechia"},{value:"danish",label:"Denmark"},{value:"dutch",label:"Netherlands"},{value:"english",label:"United States"},{value:"finnish",label:"Finland"},{value:"french",label:"France"},{value:"austrian",label:"Austria"},{value:"greek",label:"Cyprus"},{value:"israeli",label:"Israel"},{value:"indian",label:"India"},{value:"hungarian",label:"Hungary"},{value:"indonesian",label:"Indonesia"},{value:"italian",label:"Italy"},{value:"japanese",label:"Japan"},{value:"korean",label:"South Korea"},{value:"latvian",label:"Latvia"},{value:"lithuanian",label:"Lithuania"},{value:"norwegian",label:"Norway"},{value:"polish",label:"Poland"},{value:"portugese",label:"Portugal"},{value:"romanian",label:"Romania"},{value:"russian",label:"Russia"},{value:"serbian",label:"Serbia"},{value:"slovak",label:"Slovakia"},{value:"slovenian",label:"Slovenia"},{value:"spanish",label:"Argentina"},{value:"swedish",label:"Sweden"},{value:"thai",label:"Thailand"},{value:"turkish",label:"Turkey"},{value:"ukrainian",label:"Ukraine"},{value:"vietnamese",label:"Vietnam"}],value:this.state.language,onChange:this.handleLangChange,label:(0,p.__)("Language","diagnoseo")}),(0,c.createElement)("p",null,a)))}getRelatedKeywords(a,l){return new Promise(t=>{const e=new FormData;e.append("keyword",a),e.append("language",l),e.append("count",30),fetch("/wp-json/diagnoseo/v1/related-keywords",{method:"POST",body:e}).then(e=>e.json()).then(e=>{"ok"===e.status?t(e.keywords):t("")}).catch(e=>{console.error(e),t("")})})}}var b=(0,o.compose)((0,i.withSelect)(e=>{var t=e("core/editor").getEditedPostAttribute("featured_media");return{postTitle:e("core/editor").getEditedPostAttribute("title"),postContent:e("core/editor").getEditedPostContent(),featuredMedia:e("core").getMedia(t,{context:"embed"})||{}}}))(e=>(0,c.createElement)(g,{postTitle:e.postTitle,postContent:e.postContent,featuredMedia:e.featuredMedia,seoDataCollector:e.seoDataCollector})),v=(0,o.compose)((0,i.withSelect)(e=>{if(!window.diagnoseoPro)return{};e={categories:e("core/editor").getEditedPostAttribute("categories"),status:"publish",per_page:10,exclude:[e("core/editor").getEditedPostAttribute("id")]};return{suggestedPosts:wp.data.select("core").getEntityRecords("postType","post",e)||[]}}))(e=>{if(window.diagnoseoPro){var t="";return t=e.suggestedPosts.length?(t=e.suggestedPosts.map(e=>(0,c.createElement)("li",null,(0,c.createElement)("a",{href:e.link},e.title.raw))),(0,c.createElement)("ol",null,t)):(0,c.createElement)("p",null,(0,p.__)("Could not prepare suggestions as there are no posts related to this one"))}return(0,c.createElement)("p",null,(0,c.createElement)("b",null,(0,c.createElement)("a",{href:"https://diagnoseo.com/wordpress-seo-plugin/?utm_source=wp&utm_medium=link&utm_campaign=available_in_pro",target:"_blank",rel:"noreferrer noopener"},(0,p.__)("Available in Pro","diagnoseo"))))}),o=(0,o.compose)((0,i.withDispatch)(t=>({setMetaValues:e=>{t("core/editor").editPost({meta:{diagnoseo_optimal_word_number:e.number_of_words.toString(),diagnoseo_optimal_keyword_density:e.focus_keyword_density.toString(),diagnoseo_optimal_heading_number:e.number_of_headings.toString(),diagnoseo_optimal_image_number:e.number_of_images.toString()}})}})))(e=>{var t=window.diagnoseoPro?"DiagnoSEO Pro":"DiagnoSEO";return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(n.PluginSidebarMoreMenuItem,{target:"diagnoseo-content-analyzer"},(0,p.__)("DiagnoSEO Content Watcher","diagnoseo")),(0,c.createElement)(n.PluginSidebar,{title:t,name:"diagnoseo-content-analyzer"},(0,c.createElement)(u.PanelBody,{title:(0,p.__)("Content analyzer","diagnoseo"),initialOpen:"true"},(0,c.createElement)(y,{sectionName:"content"})),(0,c.createElement)(u.PanelBody,{title:(0,p.__)("Keyword placement","diagnoseo"),initialOpen:"true"},(0,c.createElement)(r,{fieldName:"diagnoseo_meta_keyword",label:(0,c.createElement)("b",null,(0,p.__)("Focus keyword","diagnoseo"))}),(0,c.createElement)(s,null),(0,c.createElement)(b,{seoDataCollector:e.setMetaValues}),(0,c.createElement)(y,{sectionName:"keyword"})),(0,c.createElement)(u.PanelBody,{title:(0,p.__)("Internal linking suggestions","diagnoseo"),initialOpen:"true"},(0,c.createElement)(v,null))))});(0,e.registerPlugin)("diagnoseo-sidebar",{icon:(0,c.createElement)(a,null),render:o})}();class diagnoseoFormHelper{input(e,t,a,l="text",n=!1,i="1",o={}){const r=document.createElement("input");for(var s in this.setAttributes(r,{type:l,name:e,id:e,class:a||"components-textarea-control__input widefat",value:t,step:"number"===l?i:""}),n&&r.setAttribute("required","required"),o)r.addEventListener(s,o[s]);return r.addEventListener("input",this.saveSchemaData),r}textarea(e,t,a,l=!1,n={}){const i=document.createElement("textarea");for(var o in this.setAttributes(i,{name:e,id:e,class:a||"components-textarea-control__input widefat"}),i.value=t,l&&i.setAttribute("required","required"),n)i.addEventListener(o,n[o]);return i.addEventListener("input",this.saveSchemaData),i}select(e,a,t,l,n=!1,i={}){const o=document.createElement("select");for(var r in o.value=a,this.setAttributes(o,{name:e,id:e,class:l||"widefat"}),n&&o.setAttribute("required","required"),t.forEach(e=>{const t=document.createElement("option");t.setAttribute("value",e.value),t.textContent=e.label,e.value===a&&t.setAttribute("selected","selected"),o.appendChild(t)}),i)o.addEventListener(r,i[r]);return o.addEventListener("change",this.saveSchemaData),o}button(e,t,a,l,n="",i={}){const o=document.createElement("button");for(var r in o.textContent=a,this.setAttributes(o,{name:e,id:e,class:l,value:t,type:n||""}),i)o.addEventListener(r,i[r]);return o}sectionTitle(e){if(e){const t=document.createElement("h3");return t.classList.add("components-base-control__heading"),t.textContent=e,t}}wrapField(e,t,a="",l="components-base-control__field"){const n=document.createElement("div");l&&n.classList.add(l);const i=document.createElement("label");if(i.classList.add("components-base-control__label"),i.setAttribute("for",e.getAttribute("id")),i.textContent=t,e.getAttribute("required")){const o=document.createElement("span");o.classList.add("req"),o.textContent="*",i.appendChild(o)}if(n.appendChild(i),n.appendChild(e),a){const r=document.createElement("p");r.classList.add("hint"),r.textContent=a,n.appendChild(r)}return n}setAttributes(e,t){for(var a in t)e.setAttribute(a,t[a])}prepareField(e){var t,{fieldType:a,label:l,name:n,value:i,type:o,className:r,options:s,listeners:d,required:c,hint:e,text:u,step:p}=e;switch(a){case"input":t=this.input(n,i,r,o,c,p,d);break;case"textarea":t=this.textarea(n,i,r,c,d);break;case"select":t=this.select(n,i,s,r,c,d);break;case"button":t=this.button(n,i,l,r,o,d);break;case"sectionTitle":t=this.sectionTitle(u)}return"button"===a||"sectionTitle"===a?t:this.wrapField(t,l,e)}saveSchemaData(e){const n=e.target.closest(".diagnoseo-schema-form");if(n){const i={};n.formConfig.forEach(t=>{if("sectionTitle"!==t.fieldType){let e=t.name;var l=e.replaceAll("-","_");let a=n.querySelector(`#${e}`).value||"";t.splitLines&&(a=a.split(t.splitLines),a.forEach((e,t)=>{a[t]=e.trim()})),i[l]=a}});const t=document.querySelector("#schema-data");t.value=JSON.stringify(i);let e=document.querySelector(".diagnoseo-schema-generator");e.setAttribute("data-schema-data",t.value)}}buildSchemaForm(e){const t=document.createElement("div");return t.classList.add("diagnoseo-schema-form"),e.forEach(e=>{e=this.prepareField(e);t.appendChild(e)}),t.formConfig=e,t}}function permalinkWatcher(){"use strict";if(window.wp.data){var e,t=document.body.classList.contains("block-editor-page");const a=document.querySelector("#seo-slug"),l=document.querySelector(".editor-post-link input");a.addEventListener("input",e=>{const t=document.querySelector(".editor-post-link input");e=e.target.value;t&&t.value!==e&&(t.value=e,e=new Event("blur"),t.dispatchEvent(e))}),l&&(l.addEventListener("input",e=>{a.value!==e.target.value&&(a.value=e.target.value)}),a.value&&l&&l.value!==a.value&&(l.value=a.value,e=new Event("blur"),l.dispatchEvent(e))),t&&window.wp.data.subscribe(function(){var e=window.wp.data.select("core/editor").isSavingPost(),t=window.wp.data.select("core/editor").isAutosavingPost();e&&!t&&setTimeout(()=>{const e=document.querySelector("#seo-slug"),t=document.querySelector(".editor-post-link input");var a;e.value&&t?(a=seoHelper.slugify(e.value),e.value=a,t.value=a,a=new Event("blur"),t.dispatchEvent(a)):!e.value&&t&&(a=seoHelper.slugify(t.value),e.value=a)},500)})}}document.addEventListener("DOMContentLoaded",function(){"use strict";const e=document.querySelectorAll(".meta-template");e.forEach(e=>{const n=e.querySelector(".choose-variable"),t=e.querySelector(".add-variable"),i=e.querySelector("input, textarea");t&&t.addEventListener("click",e=>{e.preventDefault();var t,a,l=n.value;i.selectionStart||"0"==i.selectionStart?(t=i.selectionStart,a=i.selectionEnd,e=parseInt(t)?" ":"",i.value=i.value.substring(0,t)+e+l+i.value.substring(a,i.value.length)):i.value+=l,i.dispatchEvent(new Event("input"))})})}),document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".diagnoseo-image-select");e.forEach(n=>{const e=n.querySelector(".diagnoseo-img-upload"),l=n.querySelector(".diagnoseo-img-remove");e&&e.addEventListener("click",e=>{e.preventDefault();const l=wp.media({title:"Custom Image",button:{text:"Select Image"},multiple:!1}).on("select",()=>{var e=l.state().get("selection").first().toJSON();const t=n.querySelector(".diagnoseo-img"),a=n.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",e.url),a&&(a.value=e.url)}).open()}),l&&l.addEventListener("click",e=>{e.preventDefault();const t=n.querySelector(".diagnoseo-img"),a=n.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",l.dataset.fallbackImage||""),a&&(a.value="")})})}),window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(permalinkWatcher,500)});const schemaGeneratorInit=function(){var e,r="",t="";const a=function(e,t=!1){var a=null,l={},n=document.querySelector(".diagnoseo-schema-generator");n&&(l=(l=n.dataset.schemaData)&&JSON.parse(l));const i=["Article","NewsArticle","BlogPosting"];if(!t&&i.includes(e)&&i.includes(r))return r=e,!1;switch(r=e){case"Article":case"NewsArticle":case"BlogPosting":a=articleSchemaForm(l);break;case"Review":a=reviewSchemaForm(l);break;case"Service":a=serviceSchemaForm(l);break;case"Product":a=productSchemaForm(l);break;case"Course":a=courseSchemaForm(l);break;case"Recipe":a=recipeSchemaForm(l);break;case"Person":a=personSchemaForm(l);break;case"JobPosting":a=jobPostingSchemaForm(l);break;case"SoftwareApplication":a=appSchemaForm(l);break;case"Book":a=bookSchemaForm(l);break;case"Event":a=eventSchemaForm(l);break;case"VideoObject":a=videoSchemaForm(l);break;case"ImageObject":a=imageSchemaForm(l);break;case"WebPage":a=webPageSchemaForm(l);break;case"AboutPage":a=aboutPageSchemaForm(l);break;case"FAQPage":a=faqPageSchemaForm(l);break;case"ContactPage":a=contactPageSchemaForm(l);break;default:a=null}const o=document.querySelector(".diagnoseo-schema-fields");return a?(o&&(o.innerHTML="",o.appendChild(a)),!0):(o&&(o.innerHTML=""),!1)},l=function(){const t=document.querySelector(".diagnoseo-schema-generator");if(t){var{schemaData:a}=t.dataset;if(a)for(prop in a=JSON.parse(a)){var l=prop.replaceAll("_","-");let e=t.querySelector(`#${l}`);e&&!e.value&&(e.value=a[prop])}}},n=document.querySelector("#schema-type");n&&(n.addEventListener("change",e=>{a(e.target.value)&&l()}),(e=document.querySelector(".diagnoseo-schema-generator"))&&(t=e.dataset.defaultSchemaType),r=n.value||""),a(r||t,!0),l()};window.addEventListener("load",schemaGeneratorInit);const aboutPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},appSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"operating-system",type:"text",value:e.operating_system||"",label:"Operating system"},{fieldType:"input",name:"app-category",type:"text",value:e.app_category||"",label:"Application category",hint:"Example: Multimedia, Game"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Currency"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"input",name:"rating-count",type:"number",value:e.rating_count,label:"Rating count"}];return t.buildSchemaForm(e)},articleSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"headline",type:"text",value:e.headline||"",label:"Headline"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"keywords",type:"text",value:e.keywords||"",label:"Keywords"}];return t.buildSchemaForm(e)},bookSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"input",name:"url",type:"url",value:e.url||"",label:"URL"},{fieldType:"input",name:"author-name",type:"text",value:e.author_name||"",label:"Author name"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"}];return t.buildSchemaForm(e)},contactPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},courseSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Course name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Course description"},{fieldType:"sectionTitle",text:"Provider"},{fieldType:"select",name:"provider-type",value:e.provider_type,label:"Provider type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"provider-name",type:"text",value:e.provider_name||"",label:"Provider name"},{fieldType:"input",name:"provider-url",type:"text",value:e.provider_url||"",label:"Provider URL"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},eventSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"type",value:e.type,options:[{value:"Event",label:"Event"},{value:"BusinessEvent",label:"Business Event"},{value:"ChildrensEvent",label:"Childrens Event"},{value:"ComedyEvent",label:"Comedy Event"},{value:"DanceEvent",label:"Dance Event"},{value:"DeliveryEvent",label:"Delivery Event"},{value:"EducationEvent",label:"Education Event"},{value:"ExhibitionEvent",label:"Exhibition Event"},{value:"Festival",label:"Festival"},{value:"FoodEvent",label:"Food Event"},{value:"LiteraryEvent",label:"Literary Event"},{value:"MusicEvent",label:"Music Event"},{value:"PublicationEvent",label:"Publication Event"},{value:"SaleEvent",label:"Sale Event"},{value:"ScreeningEvent",label:"Screening Event"},{value:"SocialEvent",label:"Social Event"},{value:"SportsEvent",label:"Sports Event"},{value:"TheaterEvent",label:"Theater Event"},{value:"VisualArtsEvent",label:"Visual Arts Event"}],label:"Event type"},{fieldType:"select",name:"status",value:e.status,options:[{value:"",label:"None"},{value:"EventScheduled",label:"Scheduled"},{value:"EventCancelled",label:"Cancelled"},{value:"EventPostponed",label:"Postponed"},{value:"EventRescheduled",label:"Rescheduled"},{value:"EventMovedOnline",label:"Moved Online"}],label:"Event status"},{fieldType:"select",name:"mode",value:e.mode,options:[{value:"OfflineEventAttendanceMode",label:"Offline"},{value:"OnlineEventAttendanceMode",label:"Online"},{value:"MixedEventAttendanceMode",label:"Mixed (Offline + Online)"}],label:"Attendance mode"},{fieldType:"input",name:"date-start",type:"date",value:e.date_start,label:"Start date"},{fieldType:"input",name:"date-end",type:"date",value:e.date_end,label:"End date"},{fieldType:"sectionTitle",text:"Venue"},{fieldType:"input",name:"venue-name",type:"text",value:e.venue_name||"",label:"Venue name"},{fieldType:"input",name:"venue-url",type:"url",value:e.venue_url||"",label:"Venue URL"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"},{fieldType:"sectionTitle",text:"Performer"},{fieldType:"select",name:"performer-type",value:e.performer_type,options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}],label:"Performer"},{fieldType:"input",name:"performer-name",type:"text",value:e.performer_name||"",label:"Performer name"},{fieldType:"input",name:"performer-url",type:"url",value:e.performer_url||"",label:"Performer website or social link"},{fieldType:"sectionTitle",text:"Organizer"},{fieldType:"select",name:"organizer-type",value:e.organizer_type,options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}],label:"Organizer"},{fieldType:"input",name:"organizer-name",type:"text",value:e.organizer_name||"",label:"Organizer name"},{fieldType:"input",name:"organizer-url",type:"url",value:e.organizer_url||"",label:"Organizer website or social link"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-url",type:"url",value:e.offer_url||"",label:"Offer URL"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Offer price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Offer currency"},{fieldType:"select",name:"offer-availability",value:e.offer_availability,options:[{value:"InStock",label:"In Stock"},{value:"SoldOut",label:"Sold Out"},{value:"Preorder",label:"Preorder"}],label:"Availability"},{fieldType:"input",name:"price-valid-from",type:"date",value:e.price_valid_from,label:"Price valid from"},{fieldType:"input",name:"inv-level",type:"text",value:e.inv_level||"",label:"Inventory level"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"}];return t.buildSchemaForm(e)},faqPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"main-question",type:"text",value:e.main_question||"",label:"Main entity - question"},{fieldType:"textarea",name:"main-answer",type:"text",value:e.main_answer||"",label:"Main entity - answer"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},imageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"location",type:"text",value:e.location||"",label:"Location",hint:"Name of the place where the picture was taken, for example: Manhattan, New York"}];return t.buildSchemaForm(e)},jobPostingSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"salary-currency",type:"text",value:e.salary_currency||"",label:"Salary currency",hint:"ISO 4217 Currency code. Example: EUR"},{fieldType:"input",name:"salary-amount",type:"text",value:e.salary_amount||"",label:"Salary amount",hint:"Insert amount, e.g. 100.00, or a salary range, e.g. 120.00-160.00"},{fieldType:"select",name:"salary-payroll",value:e.salary_payroll,label:"Payroll",options:[{value:"None",label:""},{value:"Yearly",label:"YEAR"},{value:"Monthly",label:"MONTH"},{value:"Weekly",label:"WEEK"},{value:"Daily",label:"DAY"},{value:"Hourly",label:"HOUR"}]},{fieldType:"input",name:"date-posted",type:"date",value:e.date_posted,label:"Date posted",hint:"Choose date, post publication date will be used if this field is empty"},{fieldType:"input",name:"date-expires",type:"date",value:e.date_expires,label:"Expiry date",hint:"Leave empty if the job posting does not expire"},{fieldType:"select",name:"employment-type",value:e.employment_type,label:"Employment type",options:[{value:"FULL_TIME",label:"Full Time"},{value:"PART_TIME",label:"Part Time"},{value:"CONTRACTOR",label:"Contractor"},{value:"TEMPORARY",label:"Temporary"},{value:"INTERN",label:"Intern"},{value:"VOLUNTEER",label:"Volunteer"},{value:"PER_DIEM",label:"Per Diem"},{value:"OTHER",label:"Other"}]},{fieldType:"input",name:"posting-id",type:"text",value:e.posting_id||"",label:"Posting ID"},{fieldType:"sectionTitle",text:"Hiring organization"},{fieldType:"input",name:"company",type:"text",value:e.company||"",label:"Hiring organization"},{fieldType:"input",name:"org-url",type:"url",value:e.org_url||"",label:"Organization URL"},{fieldType:"input",name:"org-logo",type:"url",value:e.org_logo||"",label:"Organization logo URL"},{fieldType:"sectionTitle",text:"Job location"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"}];return t.buildSchemaForm(e)},personSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"email",type:"email",value:e.email||"",label:"E-mail"},{fieldType:"input",name:"gender",type:"text",value:e.gender||"",label:"Gender"},{fieldType:"input",name:"job-title",type:"text",value:e.job_title||"",label:"Job title"},{fieldType:"input",name:"url",type:"url",value:e.url||"",label:"URL"},{fieldType:"input",name:"image",type:"url",value:e.url||"",label:"Image URL"},{fieldType:"sectionTitle",text:"Address"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"}];return t.buildSchemaForm(e)},productSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Product name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Product description"},{fieldType:"input",name:"sku",type:"text",value:e.sku||"",label:"Product SKU"},{fieldType:"input",name:"identifier_name",type:"text",value:e.identifier_name||"",label:"Global identifier",hint:"GTIN, MPN, ISBN or other"},{fieldType:"input",name:"identifier_value",type:"text",value:e.identifier_value||"",label:"Global identifier value"},{fieldType:"input",name:"brand",type:"text",value:e.brand||"",label:"Brand name"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"price",type:"number",value:e.price,label:"Price",step:"0.01"},{fieldType:"input",name:"currency",type:"text",value:e.currency||"",label:"Currency"},{fieldType:"input",name:"deadline",type:"date",value:e.deadline,label:"Price valid until"},{fieldType:"select",name:"availability",value:e.availability,options:[{label:"In Stock",value:"InStock"},{label:"Sold Out",value:"SoldOut"},{label:"Preorder",value:"Preorder"}],label:"Availability"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"sectionTitle",text:"Review publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},recipeSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Recipe title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Recipe description"},{fieldType:"input",name:"prep-time",type:"text",value:e.prep_time||"",label:"Preparation time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"cook-time",type:"text",value:e.cook_time||"",label:"Cooking time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"total-time",type:"text",value:e.total_time||"",label:"Total time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"type",type:"text",value:e.type||"",label:"Type of dish",hint:"Example: appetizer or dessert"},{fieldType:"input",name:"cuisine",type:"text",value:e.cuisine||"",label:"Cuisine"},{fieldType:"input",name:"keywords",type:"text",value:e.keywords||"",label:"Keywords"},{fieldType:"input",name:"yield",type:"text",value:e.yield||"",label:"Recipe yield",hint:"Quantity of portions produced by the recipe, for example: 4"},{fieldType:"input",name:"calories",type:"number",value:e.calories,label:"Calories"},{fieldType:"textarea",name:"ingredients",value:e.ingredients?e.ingredients.join("; "):"",label:"Ingredients",hint:"Separate ingredients with semicolons (;)",splitLines:";"},{fieldType:"textarea",name:"instructions",value:e.instructions?e.instructions.join("; "):"",label:"Recipe instructions",hint:"Separate instructions with semicolons (;)",splitLines:";"},{fieldType:"sectionTitle",text:"Aggregate Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-count",type:"number",value:e.rating_count,label:"Rating count"},{fieldType:"sectionTitle",text:"Video"},{fieldType:"input",name:"video-title",type:"text",value:e.video_title||"",label:"Video title"},{fieldType:"textarea",name:"video-description",value:e.video_description||"",label:"Video description"},{fieldType:"input",name:"video-url",type:"url",value:e.video_url||"",label:"Video URL"},{fieldType:"input",name:"video-content-url",type:"url",value:e.video_content_url||"",label:"Video content URL",hint:"A URL pointing to the actual video media file"},{fieldType:"input",name:"video-thumbnail",type:"url",value:e.video_thumbnail||"",label:"Video thumbnail URL"},{fieldType:"input",name:"video-duration",type:"text",value:e.video_duration||"",label:"Video duration",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"video-uploaded",type:"date",value:e.video_uploaded,label:"Video upload date"}];return t.buildSchemaForm(e)},reviewSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Review title"},{fieldType:"sectionTitle",text:"Reviewed item"},{fieldType:"select",name:"reviewed-item",value:e.reviewed_item,label:"Reviewed item",options:[{value:"Book",label:"Book"},{value:"Course",label:"Course"},{value:"Event",label:"Event"},{value:"How-to",label:"How-to"},{value:"LocalBusiness",label:"Local Business"},{value:"Movie",label:"Movie"},{value:"Product",label:"Product"},{value:"Recipe",label:"Recipe"},{value:"SoftwareApp",label:"Software App"}]},{fieldType:"input",name:"reviewed-item-image",type:"url",value:e.reviewed_item_image||"",label:"Reviewed item image URL"},{fieldType:"input",name:"reviewed-item-name",type:"text",value:e.reviewed_item_name||"",label:"Reviewed item name"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",step:"0.01",value:e.rating,label:"Rating value"},{fieldType:"textarea",name:"review-body",value:e.review_body||"",label:"Review text"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},serviceSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"service-type",type:"text",value:e.service_type||"",label:"Service type"},{fieldType:"input",name:"service-name",type:"text",value:e.service_name||"",label:"Name"},{fieldType:"textarea",name:"service-description",value:e.service_description||"",label:"Service description"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Currency"}];return t.buildSchemaForm(e)},videoSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"embed-url",type:"url",value:e.embed_url||"",label:"Embed URL",hint:"A URL pointing to the embeddable player for the video. Example: https://www.youtube.com/embed/VIDEOID"},{fieldType:"input",name:"content-url",type:"url",value:e.content_url||"",label:"Content URL",hint:"A URL pointing to the actual video media file like MP4, MOV, etc. Please leave it empty if you don't know the URL"},{fieldType:"input",name:"duration",type:"text",value:e.duration||"",label:"Duration",hint:"ISO 8601 duration format. Example: PT1H30M"}];return t.buildSchemaForm(e)},webPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},seoHelper={slugify:function(e){e=(e=e.replace(/^\s+|\s+$/g,"")).toLowerCase();for(var t="àáãäâąèéëêęìíïîóòóöôùúüûñńśçćźżł·/_,:;",a=0,l=t.length;a<l;a++)e=e.replace(new RegExp(t.charAt(a),"g"),"aaaaaaeeeeeiiiiooooouuuunnscczzl------".charAt(a));return e=e.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},countOccurences:function(e,t){if(!t||!e)return 0;t=t.toLowerCase().replaceAll(/[:;,.!?-]/g,""),e=e.toLowerCase();e=new RegExp(e,"g");return(t.match(e)||[]).length},countSyllables:function(e){if(""===e)return 0;if(e.length<=3)return 1;e=(e=(e=(e=e.toLowerCase()).replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,"")).replace(/^y/,"")).match(/[aeiouy]{1,2}/g);return e?e.length:0},countWords:function(e){e=(e=(e=e.replace(/(\r\n|\n|\r)/gm," ")).replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g," ")).split(" ");return(e=(e=e.map(e=>e.trim())).filter(e=>e&&""!==e&&"\n"!==e)).length||0},countElements:function(e,t){if(!e||!t)return 0;const a=document.createElement("div");return a.innerHTML=e,a.querySelectorAll(t).length},replaceVariables:function(e){if(e){var{site:t,siteTagline:a,separator:l,excerpt:n,postTitle:i}=document.querySelector(".diagnoseo-preview").dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",document.body.classList.contains("block-editor-page")?window.wp.data.select("core/editor").getEditedPostAttribute("title"):i)).replaceAll("%sitename%",t)).replaceAll("%tagline%",a)).replaceAll("%sep%",l)).replaceAll("%page%"," ")).replaceAll("%excerpt%",n)).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))}},isKeywordInText:function(e,t){if(!e||!t)return!1;e=e.toLowerCase();let a=(t=t.toLowerCase()).toLowerCase().replaceAll(/[:;,.!?-]/g,"");return t.includes(e)||a.includes(e)},isKeywordInAnyElement:function(t,e,a){if(!t||!e||!a)return!1;var l=!1;const n=seoHelper.createMarkupEl(e);return elements=n.querySelectorAll(a),elements.forEach(e=>{seoHelper.isKeywordInText(t,e.textContent)&&(l=!0)}),l},isKeywordInAnyAlt:function(t,e,a=null){if(!t)return!1;if(a&&seoHelper.isKeywordInText(t,a.alt_text))return!0;var l=0;const n=seoHelper.createMarkupEl(e),i=n.querySelectorAll("img");return i.forEach(e=>{e=e.getAttribute("alt").toLowerCase();l+=seoHelper.countOccurences(t,e)}),l},createMarkupEl:function(e){const t=document.createElement("div");return t.innerHTML=e,t},stripTags:function(e){return e.replace(/(<([^>]+)>)/gi,"")}};function initSerpSimulator(){"use strict";const o=document.body.classList.contains("block-editor-page"),r=document.querySelector(".diagnoseo-preview");if(!r)return;const l=r.querySelector(".search-result .search-result-title"),a=r.querySelector(".search-result.mobile .search-result-title"),n=r.querySelector(".search-result .search-result-descr"),i=r.querySelector(".search-result.mobile .search-result-descr"),e=document.querySelector(".diagnoseo-meta-form")||document.querySelector(".diagnoseo-settings-form"),s=e.querySelector("#seo-title")||e.querySelector("#diagnoseo_home_title"),d=e.querySelector(".info-title-chars"),c=e.querySelector(".info-title-width"),u=e.querySelector(".seo-title-progress .diagnoseo-progress-fill"),p=e.querySelector("#seo-description")||e.querySelector("#diagnoseo_home_description"),m=e.querySelector(".info-descr-chars"),y=e.querySelector(".info-descr-width"),g=e.querySelector(".seo-descr-progress .diagnoseo-progress-fill"),b=e.querySelector("#seo-slug"),v=e.querySelector(".info-slug-chars"),h=e.querySelector(".seo-slug-progress .diagnoseo-progress-fill"),f=r.querySelector(".title-sample"),w=r.querySelector(".description-sample"),t=function(){for(var e=!1;function(){var e=l.offsetWidth-20;l.style.maxWidth="none",l.style.position="absolute";var t=l.offsetWidth;return l.removeAttribute("style"),e<t}();){var t=T(l.textContent);if(!t)break;t=(t=(t=t.replace(/\/$/," ...")).split(" ").slice(0,-1).join(" ")).replace(/,\s*$/,""),e=!0,l.textContent=t,a.textContent=t}e&&(l.textContent=l.textContent+" ...",a.textContent=a.textContent+" ...")},_=function(e,t,a=0){const l=e.split(" "),n=w;if(!n)return e;e=function(e,t){for(var a,l="",n=e.split(" "),i=0;i<n.length;i++)if(a=l,(l+=" "+n[i]).length>t){l=a+" ...";break}return l=l.replace(/,\s*$/,"")}(e,a),n.textContent=e;for(var i=!1;n.clientWidth>t;){l.pop();var i=!0,o=l.join(" ");n.textContent=o}return i?l.join(" ")+" ...":e},k=function(e){var t=T(e),e=_(t,960,158);n.textContent=e;e=_(t,680,158);i.textContent=e,w.textContent=t},T=function(e){if(!e)return"";var{site:t,siteTagline:a,separator:l,excerpt:n,postTitle:i}=r.dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",o?window.wp.data.select("core/editor").getEditedPostAttribute("title"):i)).replaceAll("%sitename%",t)).replaceAll("%tagline%",a)).replaceAll("%sep%",l)).replaceAll(" %page%","")).replaceAll("%excerpt%",n||x())).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))},E=function(e){e=T(e),f.textContent=e||l.dataset.fallback,l.textContent=e||l.dataset.fallback,a.textContent=e||l.dataset.fallback,t()},x=function(){if(!window.wp||!window.wp.data)return"";let a=o?window.wp.data.select("core/editor").getEditedPostAttribute("excerpt"):r.dataset.excerpt;if(!a){let e=o?window.wp.data.select("core/editor").getEditedPostContent():"";e=seoHelper.stripTags(e).trim();let t=e.split(" ");var l=Math.min(t.length,55);t=t.splice(0,l),a=t.join(" ")}return a},S=function(){var e,t,a,l;u&&(e=f.clientWidth,l=f.textContent,100<(a=e/600*100)&&(a=100),(t=(l=T(l)).length)||(a=0),a+="%",l="",30<=t&&e<=600&&(30<=t&&t<35||60<t&&e<=600?l="medium":35<=t&&t<=60&&(l="full")),d.textContent=t,c.textContent=e,u.style.width=a,l?u.classList.contains(l)||(u.classList.remove("medium","full"),u.classList.add(l)):u.classList.remove("medium","full"))},P=function(){var e,t,a,l;g&&(l=w.textContent,e=w.clientWidth,t=l.length,100<(a=e/990*100)&&(a=100),p.value.length||p.getAttribute("placeholder")||(a=0),a+="%",l="",70<=t&&e<=990&&(70<=t&&t<130||158<t&&e<=990?l="medium":130<=t&&t<=158&&(l="full")),m.textContent=t,y.textContent=e,g.style.width=a,l?g.classList.contains(l)||(g.classList.remove("medium","full"),g.classList.add(l)):g.classList.remove("medium","full"))},C=function(){var e,t,a;h&&(t="",(a=(e=(e=b.value).replaceAll(" ","-")).split("-")).length<=5&&e.length?e.length<=50?t="full":50<e.length&&e.length<=60&&(t="medium"):5<a.length&&e.length<60&&(t="medium"),100<(a=Math.round(e.length/60*100))&&(a=100),h.style.width=a+"%",v.textContent=e.length,t?h.classList.contains(t)||(h.classList.remove("medium","full"),h.classList.add(t)):h.classList.remove("medium","full"))};s&&(s.addEventListener("input",function(e){E(e.target.value),f.textContent=T(e.target.value),o&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_title:e.target.value}}),S()}),E(s.value||s.getAttribute("placeholder")),S());const A=l.dataset.fallback;o?window.wp.data.subscribe(()=>{var e=window.wp.data.select("core/editor").getEditedPostAttribute("title")||r.dataset.postTitle;l.dataset.fallback=e||A;var t=s.value||s.getAttribute("placeholder");E(t),S();const a=document.querySelector("#postlist-title");!(window.wp.data.select("core/editor").getEditedPostAttribute("meta")?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:e)&&a&&a.setAttribute("placeholder",e)}):s&&s.addEventListener("input",e=>{var t=o?window.wp.data.select("core/editor").getEditedPostAttribute("title"):r.dataset.postTitle;l.dataset.fallback=t||A;e=e.target.value||e.target.value.getAttribute("placeholder");E(e),S();const a=document.querySelector("#postlist-title");!(o?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:t)&&a&&a.setAttribute("placeholder",t)}),p&&(p.addEventListener("input",function(e){k(e.target.value||e.target.getAttribute("placeholder")),o&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_description:e.target.value}}),P()}),k(p.value||p.getAttribute("placeholder")),P()),b&&b.addEventListener("input",e=>{o&&window.wp.data.dispatch("core/editor").editPost({slug:seoHelper.slugify(e.target.value)}),C()});const L=document.querySelectorAll(".diagnoseo-var-input");L&&L.forEach(e=>{const l=e.querySelector(".var-input"),n=e.querySelector(".var-select"),t=e.querySelector(".var-button");t.addEventListener("click",e=>{e.preventDefault();var t,a=n.value;a&&(l.selectionStart||"0"==l.selectionStart?(t=l.selectionStart,e=l.selectionEnd,l.value=l.value.substring(0,t)+" "+a+l.value.substring(e,l.value.length)):l.value+=a,l.dispatchEvent(new Event("input")))})}),setTimeout(function(){t(),S(),P(),C()},500)}window._wpLoadBlockEditor?window._wpLoadBlockEditor.then(function(){setTimeout(initSerpSimulator,500)}):window.addEventListener("load",initSerpSimulator);const startSocialPreview=function(){if(window.wp.data){const{select,dispatch,subscribe}=window.wp.data}const e=document.querySelectorAll(".diagnoseo-social-meta"),t=document.body.classList.contains("block-editor-page");if(e){const m=document.querySelector("#facebook-title"),y=document.querySelector("#twitter-title"),g=document.querySelector("#facebook-description"),b=document.querySelector("#twitter-description"),v=document.querySelector("#seo-title"),h=document.querySelector("#seo-description");if(v&&v.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");m.setAttribute("placeholder",e),y.setAttribute("placeholder",e)}),h&&h.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");g.setAttribute("placeholder",e),b.setAttribute("placeholder",e)}),e.forEach(e=>{e.addEventListener("input",e=>{t&&function(e,t){const a={};a[e]=t,dispatch("core/editor").editPost({meta:a})}(e.target.dataset.customField,e.target.value)})}),t)subscribe(()=>{const e=select("core/editor");var t=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_title||m.value||v.value||m.getAttribute("placeholder"),a=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_description||g.value||h.value||h.getAttribute("placeholder"),l=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_title||y.value||v.value||y.getAttribute("placeholder"),n=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_description||b.value||h.value||h.getAttribute("placeholder"),i=e.getEditedPostAttribute("featured_media");const o=document.querySelectorAll(".diagnoseo-social-preview"),r=document.querySelector(".preview-facebook"),s=document.querySelector(".preview-twitter");if(o){const d=r?r.querySelector(".facebook-post-title"):null;d&&(d.textContent=seoHelper.replaceVariables(t));const c=r?r.querySelector(".facebook-post-description"):null;c&&(c.textContent=seoHelper.replaceVariables(a));const u=s?s.querySelector(".twitter-post-title"):null;u&&(u.textContent=seoHelper.replaceVariables(l));const p=s?s.querySelector(".twitter-post-description"):null;p&&(p.textContent=seoHelper.replaceVariables(n)),o.forEach(e=>{var t=i?select("core").getMedia(i):null,t=t?t.guid.raw:e.dataset.placeholderImage;const a=e.querySelector(".preview-image img");a.setAttribute("src",t)})}});else{const a=document.querySelector(".preview-facebook"),l=document.querySelector(".preview-twitter");if(a&&l){const n=a.querySelector(".facebook-post-title"),i=a.querySelector(".facebook-post-description"),o=l.querySelector(".twitter-post-title"),r=l.querySelector(".twitter-post-description");n.textContent=seoHelper.replaceVariables(a.dataset.facebookTitle),i.textContent=seoHelper.replaceVariables(a.dataset.facebookDescription),o.textContent=seoHelper.replaceVariables(l.dataset.twitterTitle),r.textContent=seoHelper.replaceVariables(l.dataset.twitterDescription),m.addEventListener("input",e=>{e=e.target.value;n&&(n.textContent=seoHelper.replaceVariables(e))}),g.addEventListener("input",e=>{e=e.target.value;i&&(i.textContent=seoHelper.replaceVariables(e))}),y.addEventListener("input",e=>{e=e.target.value;o&&(o.textContent=seoHelper.replaceVariables(e))}),b.addEventListener("input",e=>{e=e.target.value;r&&(r.textContent=seoHelper.replaceVariables(e))})}}}};window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(startSocialPreview,500)}),document.body.classList.contains("block-editor-page")||window.addEventListener("load",startSocialPreview),jQuery(document).on("ready",function(){jQuery(".toggle").each(function(){const t=jQuery(this).find(".toggle-trigger"),a=jQuery(this).find(".toggle-content");t.on("click",function(e){e.preventDefault(),a.slideToggle(),t.toggleClass("open")})})}); -
diagnoseo/tags/1.2.20/js/diagnoseo.min.js
r2990168 r2992578 1 const seoHelper={slugify:function(e){e=(e=e.replace(/^\s+|\s+$/g,"")).toLowerCase();for(var t="àáãäâąèéëêęìíïîóòóöôùúüûñńśçćźżł·/_,:;",r=0,o=t.length;r<o;r++)e=e.replace(new RegExp(t.charAt(r),"g"),"aaaaaaeeeeeiiiiooooouuuunnscczzl------".charAt(r));return e=e.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},countOccurences:function(e,t){if(!t||!e)return 0;t=t.toLowerCase().replaceAll(/[:;,.!?-]/g,""),e=e.toLowerCase();e=new RegExp(e,"g");return(t.match(e)||[]).length},countSyllables:function(e){if(""===e)return 0;if(e.length<=3)return 1;e=(e=(e=(e=e.toLowerCase()).replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,"")).replace(/^y/,"")).match(/[aeiouy]{1,2}/g);return e?e.length:0},countWords:function(e){e=(e=(e=e.replace(/(\r\n|\n|\r)/gm," ")).replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g," ")).split(" ");return(e=(e=e.map(e=>e.trim())).filter(e=>e&&""!==e&&"\n"!==e)).length||0},countElements:function(e,t){if(!e||!t)return 0;const r=document.createElement("div");return r.innerHTML=e,r.querySelectorAll(t).length},replaceVariables:function(e){if(e){var{site:t,siteTagline:r,separator:o,excerpt:a,postTitle:n}=document.querySelector(".diagnoseo-preview").dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",document.body.classList.contains("block-editor-page")?window.wp.data.select("core/editor").getEditedPostAttribute("title"):n)).replaceAll("%sitename%",t)).replaceAll("%tagline%",r)).replaceAll("%sep%",o)).replaceAll("%page%"," ")).replaceAll("%excerpt%",a)).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))}},isKeywordInText:function(e,t){if(!e||!t)return!1;e=e.toLowerCase();let r=(t=t.toLowerCase()).toLowerCase().replaceAll(/[:;,.!?-]/g,"");return t.includes(e)||r.includes(e)},isKeywordInAnyElement:function(t,e,r){if(!t||!e||!r)return!1;var o=!1;const a=seoHelper.createMarkupEl(e);return elements=a.querySelectorAll(r),elements.forEach(e=>{seoHelper.isKeywordInText(t,e.textContent)&&(o=!0)}),o},isKeywordInAnyAlt:function(t,e,r=null){if(!t)return!1;if(r&&seoHelper.isKeywordInText(t,r.alt_text))return!0;var o=0;const a=seoHelper.createMarkupEl(e),n=a.querySelectorAll("img");return n.forEach(e=>{e=e.getAttribute("alt").toLowerCase();o+=seoHelper.countOccurences(t,e)}),o},createMarkupEl:function(e){const t=document.createElement("div");return t.innerHTML=e,t},stripTags:function(e){return e.replace(/(<([^>]+)>)/gi,"")}};class diagnoseoFormHelper{input(e,t,r,o="text",a=!1,n="1", i={}){const l=document.createElement("input");for(var s in this.setAttributes(l,{type:o,name:e,id:e,class:r||"components-textarea-control__input widefat",value:t,step:"number"===o?n:""}),a&&l.setAttribute("required","required"),i)l.addEventListener(s,i[s]);return l.addEventListener("input",this.saveSchemaData),l}textarea(e,t,r,o=!1,a={}){const n=document.createElement("textarea");for(var i in this.setAttributes(n,{name:e,id:e,class:r||"components-textarea-control__input widefat"}),n.value=t,o&&n.setAttribute("required","required"),a)n.addEventListener(i,a[i]);return n.addEventListener("input",this.saveSchemaData),n}select(e,r,t,o,a=!1,n={}){const i=document.createElement("select");for(var l in i.value=r,this.setAttributes(i,{name:e,id:e,class:o||"widefat"}),a&&i.setAttribute("required","required"),t.forEach(e=>{const t=document.createElement("option");t.setAttribute("value",e.value),t.textContent=e.label,e.value===r&&t.setAttribute("selected","selected"),i.appendChild(t)}),n)i.addEventListener(l,n[l]);return i.addEventListener("change",this.saveSchemaData),i}button(e,t,r,o,a="",n={}){const i=document.createElement("button");for(var l in i.textContent=r,this.setAttributes(i,{name:e,id:e,class:o,value:t,type:a||""}),n)i.addEventListener(l,n[l]);return i}sectionTitle(e){if(e){const t=document.createElement("h3");return t.classList.add("components-base-control__heading"),t.textContent=e,t}}wrapField(e,t,r="",o="components-base-control__field"){const a=document.createElement("div");o&&a.classList.add(o);const n=document.createElement("label");if(n.classList.add("components-base-control__label"),n.setAttribute("for",e.getAttribute("id")),n.textContent=t,e.getAttribute("required")){const i=document.createElement("span");i.classList.add("req"),i.textContent="*",n.appendChild(i)}if(a.appendChild(n),a.appendChild(e),r){const l=document.createElement("p");l.classList.add("hint"),l.textContent=r,a.appendChild(l)}return a}setAttributes(e,t){for(var r in t)e.setAttribute(r,t[r])}prepareField(e){var t,{fieldType:r,label:o,name:a,value:n,type:i,className:l,options:s,listeners:c,required:u,hint:e,text:d,step:p}=e;switch(r){case"input":t=this.input(a,n,l,i,u,p,c);break;case"textarea":t=this.textarea(a,n,l,u,c);break;case"select":t=this.select(a,n,s,l,u,c);break;case"button":t=this.button(a,n,o,l,i,c);break;case"sectionTitle":t=this.sectionTitle(d)}return"button"===r||"sectionTitle"===r?t:this.wrapField(t,o,e)}saveSchemaData(e){const a=e.target.closest(".diagnoseo-schema-form");if(a){const n={};a.formConfig.forEach(t=>{if("sectionTitle"!==t.fieldType){let e=t.name;var o=e.replaceAll("-","_");let r=a.querySelector(`#${e}`).value||"";t.splitLines&&(r=r.split(t.splitLines),r.forEach((e,t)=>{r[t]=e.trim()})),n[o]=r}});const t=document.querySelector("#schema-data");t.value=JSON.stringify(n);let e=document.querySelector(".diagnoseo-schema-generator");e.setAttribute("data-schema-data",t.value)}}buildSchemaForm(e){const t=document.createElement("div");return t.classList.add("diagnoseo-schema-form"),e.forEach(e=>{e=this.prepareField(e);t.appendChild(e)}),t.formConfig=e,t}}function initSerpSimulator(){"use strict";const i=document.body.classList.contains("block-editor-page"),l=document.querySelector(".diagnoseo-preview");if(!l)return;const o=l.querySelector(".search-result .search-result-title"),r=l.querySelector(".search-result.mobile .search-result-title"),a=l.querySelector(".search-result .search-result-descr"),n=l.querySelector(".search-result.mobile .search-result-descr"),e=document.querySelector(".diagnoseo-meta-form")||document.querySelector(".diagnoseo-settings-form"),s=e.querySelector("#seo-title")||e.querySelector("#diagnoseo_home_title"),c=e.querySelector(".info-title-chars"),u=e.querySelector(".info-title-width"),d=e.querySelector(".seo-title-progress .diagnoseo-progress-fill"),p=e.querySelector("#seo-description")||e.querySelector("#diagnoseo_home_description"),m=e.querySelector(".info-descr-chars"),g=e.querySelector(".info-descr-width"),f=e.querySelector(".seo-descr-progress .diagnoseo-progress-fill"),v=e.querySelector("#seo-slug"),h=e.querySelector(".info-slug-chars"),b=e.querySelector(".seo-slug-progress .diagnoseo-progress-fill"),w=l.querySelector(".title-sample"),y=l.querySelector(".description-sample"),t=function(){for(var e=!1;function(){var e=o.offsetWidth-20;o.style.maxWidth="none",o.style.position="absolute";var t=o.offsetWidth;return o.removeAttribute("style"),e<t}();){var t=E(o.textContent);if(!t)break;t=(t=(t=t.replace(/\/$/," ...")).split(" ").slice(0,-1).join(" ")).replace(/,\s*$/,""),e=!0,o.textContent=t,r.textContent=t}e&&(o.textContent=o.textContent+" ...",r.textContent=r.textContent+" ...")},S=function(e,t,r=0){const o=e.split(" "),a=y;if(!a)return e;e=function(e,t){for(var r,o="",a=e.split(" "),n=0;n<a.length;n++)if(r=o,(o+=" "+a[n]).length>t){o=r+" ...";break}return o=o.replace(/,\s*$/,"")}(e,r),a.textContent=e;for(var n=!1;a.clientWidth>t;){o.pop();var n=!0,i=o.join(" ");a.textContent=i}return n?o.join(" ")+" ...":e},A=function(e){var t=E(e),e=S(t,960,158);a.textContent=e;e=S(t,680,158);n.textContent=e,y.textContent=t},E=function(e){if(!e)return"";var{site:t,siteTagline:r,separator:o,excerpt:a,postTitle:n}=l.dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",i?window.wp.data.select("core/editor").getEditedPostAttribute("title"):n)).replaceAll("%sitename%",t)).replaceAll("%tagline%",r)).replaceAll("%sep%",o)).replaceAll(" %page%","")).replaceAll("%excerpt%",a||L())).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))},q=function(e){e=E(e),w.textContent=e||o.dataset.fallback,o.textContent=e||o.dataset.fallback,r.textContent=e||o.dataset.fallback,t()},L=function(){if(!window.wp||!window.wp.data)return"";let r=i?window.wp.data.select("core/editor").getEditedPostAttribute("excerpt"):l.dataset.excerpt;if(!r){let e=i?window.wp.data.select("core/editor").getEditedPostContent():"";e=seoHelper.stripTags(e).trim();let t=e.split(" ");var o=Math.min(t.length,55);t=t.splice(0,o),r=t.join(" ")}return r},x=function(){var e,t,r,o;d&&(e=w.clientWidth,o=w.textContent,100<(r=e/600*100)&&(r=100),(t=(o=E(o)).length)||(r=0),r+="%",o="",30<=t&&e<=600&&(30<=t&&t<35||60<t&&e<=600?o="medium":35<=t&&t<=60&&(o="full")),c.textContent=t,u.textContent=e,d.style.width=r,o?d.classList.contains(o)||(d.classList.remove("medium","full"),d.classList.add(o)):d.classList.remove("medium","full"))},C=function(){var e,t,r,o;f&&(o=y.textContent,e=y.clientWidth,t=o.length,100<(r=e/990*100)&&(r=100),p.value.length||p.getAttribute("placeholder")||(r=0),r+="%",o="",70<=t&&e<=990&&(70<=t&&t<130||158<t&&e<=990?o="medium":130<=t&&t<=158&&(o="full")),m.textContent=t,g.textContent=e,f.style.width=r,o?f.classList.contains(o)||(f.classList.remove("medium","full"),f.classList.add(o)):f.classList.remove("medium","full"))},_=function(){var e,t,r;b&&(t="",(r=(e=(e=v.value).replaceAll(" ","-")).split("-")).length<=5&&e.length?e.length<=50?t="full":50<e.length&&e.length<=60&&(t="medium"):5<r.length&&e.length<60&&(t="medium"),100<(r=Math.round(e.length/60*100))&&(r=100),b.style.width=r+"%",h.textContent=e.length,t?b.classList.contains(t)||(b.classList.remove("medium","full"),b.classList.add(t)):b.classList.remove("medium","full"))};s&&(s.addEventListener("input",function(e){q(e.target.value),w.textContent=E(e.target.value),i&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_title:e.target.value}}),x()}),q(s.value||s.getAttribute("placeholder")),x());const k=o.dataset.fallback;i?window.wp.data.subscribe(()=>{var e=window.wp.data.select("core/editor").getEditedPostAttribute("title")||l.dataset.postTitle;o.dataset.fallback=e||k;var t=s.value||s.getAttribute("placeholder");q(t),x();const r=document.querySelector("#postlist-title");!(window.wp.data.select("core/editor").getEditedPostAttribute("meta")?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:e)&&r&&r.setAttribute("placeholder",e)}):s&&s.addEventListener("input",e=>{var t=i?window.wp.data.select("core/editor").getEditedPostAttribute("title"):l.dataset.postTitle;o.dataset.fallback=t||k;e=e.target.value||e.target.value.getAttribute("placeholder");q(e),x();const r=document.querySelector("#postlist-title");!(i?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:t)&&r&&r.setAttribute("placeholder",t)}),p&&(p.addEventListener("input",function(e){A(e.target.value||e.target.getAttribute("placeholder")),i&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_description:e.target.value}}),C()}),A(p.value||p.getAttribute("placeholder")),C()),v&&v.addEventListener("input",e=>{i&&window.wp.data.dispatch("core/editor").editPost({slug:seoHelper.slugify(e.target.value)}),_()});const T=document.querySelectorAll(".diagnoseo-var-input");T&&T.forEach(e=>{const o=e.querySelector(".var-input"),a=e.querySelector(".var-select"),t=e.querySelector(".var-button");t.addEventListener("click",e=>{e.preventDefault();var t,r=a.value;r&&(o.selectionStart||"0"==o.selectionStart?(t=o.selectionStart,e=o.selectionEnd,o.value=o.value.substring(0,t)+" "+r+o.value.substring(e,o.value.length)):o.value+=r,o.dispatchEvent(new Event("input")))})}),setTimeout(function(){t(),x(),C(),_()},500)}document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".diagnoseo-image-select");e.forEach(a=>{const e=a.querySelector(".diagnoseo-img-upload"),o=a.querySelector(".diagnoseo-img-remove");e&&e.addEventListener("click",e=>{e.preventDefault();const o=wp.media({title:"Custom Image",button:{text:"Select Image"},multiple:!1}).on("select",()=>{var e=o.state().get("selection").first().toJSON();const t=a.querySelector(".diagnoseo-img"),r=a.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",e.url),r&&(r.value=e.url)}).open()}),o&&o.addEventListener("click",e=>{e.preventDefault();const t=a.querySelector(".diagnoseo-img"),r=a.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",o.dataset.fallbackImage||""),r&&(r.value="")})})}),window._wpLoadBlockEditor?window._wpLoadBlockEditor.then(function(){setTimeout(initSerpSimulator,500)}):window.addEventListener("load",initSerpSimulator);const startSocialPreview=function(){const{select:m,dispatch:o,subscribe:e}=window.wp.data,t=document.querySelectorAll(".diagnoseo-social-meta"),r=document.body.classList.contains("block-editor-page");if(t){const g=document.querySelector("#facebook-title"),f=document.querySelector("#twitter-title"),v=document.querySelector("#facebook-description"),h=document.querySelector("#twitter-description"),b=document.querySelector("#seo-title"),w=document.querySelector("#seo-description");if(b.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");g.setAttribute("placeholder",e),f.setAttribute("placeholder",e)}),w.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");v.setAttribute("placeholder",e),h.setAttribute("placeholder",e)}),t.forEach(e=>{e.addEventListener("input",e=>{r&&function(e,t){const r={};r[e]=t,o("core/editor").editPost({meta:r})}(e.target.dataset.customField,e.target.value)})}),r)e(()=>{const e=m("core/editor");var t=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_title||g.value||b.value||g.getAttribute("placeholder"),r=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_description||v.value||w.value||w.getAttribute("placeholder"),o=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_title||f.value||b.value||f.getAttribute("placeholder"),a=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_description||h.value||w.value||w.getAttribute("placeholder"),n=e.getEditedPostAttribute("featured_media");const i=document.querySelectorAll(".diagnoseo-social-preview"),l=document.querySelector(".preview-facebook"),s=document.querySelector(".preview-twitter"),c=l.querySelector(".facebook-post-title");c&&(c.textContent=seoHelper.replaceVariables(t));const u=l.querySelector(".facebook-post-description");u&&(u.textContent=seoHelper.replaceVariables(r));const d=s.querySelector(".twitter-post-title");d&&(d.textContent=seoHelper.replaceVariables(o));const p=s.querySelector(".twitter-post-description");p&&(p.textContent=seoHelper.replaceVariables(a)),i.forEach(e=>{var t=n?m("core").getMedia(n):null,t=t?t.guid.raw:e.dataset.placeholderImage;const r=e.querySelector(".preview-image img");r.setAttribute("src",t)})});else{const a=document.querySelector(".preview-facebook"),n=document.querySelector(".preview-twitter"),i=a.querySelector(".facebook-post-title"),l=a.querySelector(".facebook-post-description"),s=n.querySelector(".twitter-post-title"),c=n.querySelector(".twitter-post-description");i.textContent=seoHelper.replaceVariables(a.dataset.facebookTitle),l.textContent=seoHelper.replaceVariables(a.dataset.facebookDescription),s.textContent=seoHelper.replaceVariables(n.dataset.twitterTitle),c.textContent=seoHelper.replaceVariables(n.dataset.twitterDescription),g.addEventListener("input",e=>{e=e.target.value;i&&(i.textContent=seoHelper.replaceVariables(e))}),v.addEventListener("input",e=>{e=e.target.value;l&&(l.textContent=seoHelper.replaceVariables(e))}),f.addEventListener("input",e=>{e=e.target.value;s&&(s.textContent=seoHelper.replaceVariables(e))}),h.addEventListener("input",e=>{e=e.target.value;c&&(c.textContent=seoHelper.replaceVariables(e))})}}};window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(startSocialPreview,500)}),document.body.classList.contains("block-editor-page")||window.addEventListener("load",startSocialPreview);1 const seoHelper={slugify:function(e){e=(e=e.replace(/^\s+|\s+$/g,"")).toLowerCase();for(var t="àáãäâąèéëêęìíïîóòóöôùúüûñńśçćźżł·/_,:;",r=0,o=t.length;r<o;r++)e=e.replace(new RegExp(t.charAt(r),"g"),"aaaaaaeeeeeiiiiooooouuuunnscczzl------".charAt(r));return e=e.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},countOccurences:function(e,t){if(!t||!e)return 0;t=t.toLowerCase().replaceAll(/[:;,.!?-]/g,""),e=e.toLowerCase();e=new RegExp(e,"g");return(t.match(e)||[]).length},countSyllables:function(e){if(""===e)return 0;if(e.length<=3)return 1;e=(e=(e=(e=e.toLowerCase()).replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,"")).replace(/^y/,"")).match(/[aeiouy]{1,2}/g);return e?e.length:0},countWords:function(e){e=(e=(e=e.replace(/(\r\n|\n|\r)/gm," ")).replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g," ")).split(" ");return(e=(e=e.map(e=>e.trim())).filter(e=>e&&""!==e&&"\n"!==e)).length||0},countElements:function(e,t){if(!e||!t)return 0;const r=document.createElement("div");return r.innerHTML=e,r.querySelectorAll(t).length},replaceVariables:function(e){if(e){var{site:t,siteTagline:r,separator:o,excerpt:a,postTitle:n}=document.querySelector(".diagnoseo-preview").dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",document.body.classList.contains("block-editor-page")?window.wp.data.select("core/editor").getEditedPostAttribute("title"):n)).replaceAll("%sitename%",t)).replaceAll("%tagline%",r)).replaceAll("%sep%",o)).replaceAll("%page%"," ")).replaceAll("%excerpt%",a)).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))}},isKeywordInText:function(e,t){if(!e||!t)return!1;e=e.toLowerCase();let r=(t=t.toLowerCase()).toLowerCase().replaceAll(/[:;,.!?-]/g,"");return t.includes(e)||r.includes(e)},isKeywordInAnyElement:function(t,e,r){if(!t||!e||!r)return!1;var o=!1;const a=seoHelper.createMarkupEl(e);return elements=a.querySelectorAll(r),elements.forEach(e=>{seoHelper.isKeywordInText(t,e.textContent)&&(o=!0)}),o},isKeywordInAnyAlt:function(t,e,r=null){if(!t)return!1;if(r&&seoHelper.isKeywordInText(t,r.alt_text))return!0;var o=0;const a=seoHelper.createMarkupEl(e),n=a.querySelectorAll("img");return n.forEach(e=>{e=e.getAttribute("alt").toLowerCase();o+=seoHelper.countOccurences(t,e)}),o},createMarkupEl:function(e){const t=document.createElement("div");return t.innerHTML=e,t},stripTags:function(e){return e.replace(/(<([^>]+)>)/gi,"")}};class diagnoseoFormHelper{input(e,t,r,o="text",a=!1,n="1",l={}){const i=document.createElement("input");for(var s in this.setAttributes(i,{type:o,name:e,id:e,class:r||"components-textarea-control__input widefat",value:t,step:"number"===o?n:""}),a&&i.setAttribute("required","required"),l)i.addEventListener(s,l[s]);return i.addEventListener("input",this.saveSchemaData),i}textarea(e,t,r,o=!1,a={}){const n=document.createElement("textarea");for(var l in this.setAttributes(n,{name:e,id:e,class:r||"components-textarea-control__input widefat"}),n.value=t,o&&n.setAttribute("required","required"),a)n.addEventListener(l,a[l]);return n.addEventListener("input",this.saveSchemaData),n}select(e,r,t,o,a=!1,n={}){const l=document.createElement("select");for(var i in l.value=r,this.setAttributes(l,{name:e,id:e,class:o||"widefat"}),a&&l.setAttribute("required","required"),t.forEach(e=>{const t=document.createElement("option");t.setAttribute("value",e.value),t.textContent=e.label,e.value===r&&t.setAttribute("selected","selected"),l.appendChild(t)}),n)l.addEventListener(i,n[i]);return l.addEventListener("change",this.saveSchemaData),l}button(e,t,r,o,a="",n={}){const l=document.createElement("button");for(var i in l.textContent=r,this.setAttributes(l,{name:e,id:e,class:o,value:t,type:a||""}),n)l.addEventListener(i,n[i]);return l}sectionTitle(e){if(e){const t=document.createElement("h3");return t.classList.add("components-base-control__heading"),t.textContent=e,t}}wrapField(e,t,r="",o="components-base-control__field"){const a=document.createElement("div");o&&a.classList.add(o);const n=document.createElement("label");if(n.classList.add("components-base-control__label"),n.setAttribute("for",e.getAttribute("id")),n.textContent=t,e.getAttribute("required")){const l=document.createElement("span");l.classList.add("req"),l.textContent="*",n.appendChild(l)}if(a.appendChild(n),a.appendChild(e),r){const i=document.createElement("p");i.classList.add("hint"),i.textContent=r,a.appendChild(i)}return a}setAttributes(e,t){for(var r in t)e.setAttribute(r,t[r])}prepareField(e){var t,{fieldType:r,label:o,name:a,value:n,type:l,className:i,options:s,listeners:c,required:u,hint:e,text:d,step:p}=e;switch(r){case"input":t=this.input(a,n,i,l,u,p,c);break;case"textarea":t=this.textarea(a,n,i,u,c);break;case"select":t=this.select(a,n,s,i,u,c);break;case"button":t=this.button(a,n,o,i,l,c);break;case"sectionTitle":t=this.sectionTitle(d)}return"button"===r||"sectionTitle"===r?t:this.wrapField(t,o,e)}saveSchemaData(e){const a=e.target.closest(".diagnoseo-schema-form");if(a){const n={};a.formConfig.forEach(t=>{if("sectionTitle"!==t.fieldType){let e=t.name;var o=e.replaceAll("-","_");let r=a.querySelector(`#${e}`).value||"";t.splitLines&&(r=r.split(t.splitLines),r.forEach((e,t)=>{r[t]=e.trim()})),n[o]=r}});const t=document.querySelector("#schema-data");t.value=JSON.stringify(n);let e=document.querySelector(".diagnoseo-schema-generator");e.setAttribute("data-schema-data",t.value)}}buildSchemaForm(e){const t=document.createElement("div");return t.classList.add("diagnoseo-schema-form"),e.forEach(e=>{e=this.prepareField(e);t.appendChild(e)}),t.formConfig=e,t}}function initSerpSimulator(){"use strict";const l=document.body.classList.contains("block-editor-page"),i=document.querySelector(".diagnoseo-preview");if(!i)return;const o=i.querySelector(".search-result .search-result-title"),r=i.querySelector(".search-result.mobile .search-result-title"),a=i.querySelector(".search-result .search-result-descr"),n=i.querySelector(".search-result.mobile .search-result-descr"),e=document.querySelector(".diagnoseo-meta-form")||document.querySelector(".diagnoseo-settings-form"),s=e.querySelector("#seo-title")||e.querySelector("#diagnoseo_home_title"),c=e.querySelector(".info-title-chars"),u=e.querySelector(".info-title-width"),d=e.querySelector(".seo-title-progress .diagnoseo-progress-fill"),p=e.querySelector("#seo-description")||e.querySelector("#diagnoseo_home_description"),m=e.querySelector(".info-descr-chars"),g=e.querySelector(".info-descr-width"),f=e.querySelector(".seo-descr-progress .diagnoseo-progress-fill"),v=e.querySelector("#seo-slug"),h=e.querySelector(".info-slug-chars"),b=e.querySelector(".seo-slug-progress .diagnoseo-progress-fill"),w=i.querySelector(".title-sample"),y=i.querySelector(".description-sample"),t=function(){for(var e=!1;function(){var e=o.offsetWidth-20;o.style.maxWidth="none",o.style.position="absolute";var t=o.offsetWidth;return o.removeAttribute("style"),e<t}();){var t=E(o.textContent);if(!t)break;t=(t=(t=t.replace(/\/$/," ...")).split(" ").slice(0,-1).join(" ")).replace(/,\s*$/,""),e=!0,o.textContent=t,r.textContent=t}e&&(o.textContent=o.textContent+" ...",r.textContent=r.textContent+" ...")},S=function(e,t,r=0){const o=e.split(" "),a=y;if(!a)return e;e=function(e,t){for(var r,o="",a=e.split(" "),n=0;n<a.length;n++)if(r=o,(o+=" "+a[n]).length>t){o=r+" ...";break}return o=o.replace(/,\s*$/,"")}(e,r),a.textContent=e;for(var n=!1;a.clientWidth>t;){o.pop();var n=!0,l=o.join(" ");a.textContent=l}return n?o.join(" ")+" ...":e},A=function(e){var t=E(e),e=S(t,960,158);a.textContent=e;e=S(t,680,158);n.textContent=e,y.textContent=t},E=function(e){if(!e)return"";var{site:t,siteTagline:r,separator:o,excerpt:a,postTitle:n}=i.dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",l?window.wp.data.select("core/editor").getEditedPostAttribute("title"):n)).replaceAll("%sitename%",t)).replaceAll("%tagline%",r)).replaceAll("%sep%",o)).replaceAll(" %page%","")).replaceAll("%excerpt%",a||L())).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))},q=function(e){e=E(e),w.textContent=e||o.dataset.fallback,o.textContent=e||o.dataset.fallback,r.textContent=e||o.dataset.fallback,t()},L=function(){if(!window.wp||!window.wp.data)return"";let r=l?window.wp.data.select("core/editor").getEditedPostAttribute("excerpt"):i.dataset.excerpt;if(!r){let e=l?window.wp.data.select("core/editor").getEditedPostContent():"";e=seoHelper.stripTags(e).trim();let t=e.split(" ");var o=Math.min(t.length,55);t=t.splice(0,o),r=t.join(" ")}return r},x=function(){var e,t,r,o;d&&(e=w.clientWidth,o=w.textContent,100<(r=e/600*100)&&(r=100),(t=(o=E(o)).length)||(r=0),r+="%",o="",30<=t&&e<=600&&(30<=t&&t<35||60<t&&e<=600?o="medium":35<=t&&t<=60&&(o="full")),c.textContent=t,u.textContent=e,d.style.width=r,o?d.classList.contains(o)||(d.classList.remove("medium","full"),d.classList.add(o)):d.classList.remove("medium","full"))},C=function(){var e,t,r,o;f&&(o=y.textContent,e=y.clientWidth,t=o.length,100<(r=e/990*100)&&(r=100),p.value.length||p.getAttribute("placeholder")||(r=0),r+="%",o="",70<=t&&e<=990&&(70<=t&&t<130||158<t&&e<=990?o="medium":130<=t&&t<=158&&(o="full")),m.textContent=t,g.textContent=e,f.style.width=r,o?f.classList.contains(o)||(f.classList.remove("medium","full"),f.classList.add(o)):f.classList.remove("medium","full"))},_=function(){var e,t,r;b&&(t="",(r=(e=(e=v.value).replaceAll(" ","-")).split("-")).length<=5&&e.length?e.length<=50?t="full":50<e.length&&e.length<=60&&(t="medium"):5<r.length&&e.length<60&&(t="medium"),100<(r=Math.round(e.length/60*100))&&(r=100),b.style.width=r+"%",h.textContent=e.length,t?b.classList.contains(t)||(b.classList.remove("medium","full"),b.classList.add(t)):b.classList.remove("medium","full"))};s&&(s.addEventListener("input",function(e){q(e.target.value),w.textContent=E(e.target.value),l&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_title:e.target.value}}),x()}),q(s.value||s.getAttribute("placeholder")),x());const k=o.dataset.fallback;l?window.wp.data.subscribe(()=>{var e=window.wp.data.select("core/editor").getEditedPostAttribute("title")||i.dataset.postTitle;o.dataset.fallback=e||k;var t=s.value||s.getAttribute("placeholder");q(t),x();const r=document.querySelector("#postlist-title");!(window.wp.data.select("core/editor").getEditedPostAttribute("meta")?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:e)&&r&&r.setAttribute("placeholder",e)}):s&&s.addEventListener("input",e=>{var t=l?window.wp.data.select("core/editor").getEditedPostAttribute("title"):i.dataset.postTitle;o.dataset.fallback=t||k;e=e.target.value||e.target.value.getAttribute("placeholder");q(e),x();const r=document.querySelector("#postlist-title");!(l?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:t)&&r&&r.setAttribute("placeholder",t)}),p&&(p.addEventListener("input",function(e){A(e.target.value||e.target.getAttribute("placeholder")),l&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_description:e.target.value}}),C()}),A(p.value||p.getAttribute("placeholder")),C()),v&&v.addEventListener("input",e=>{l&&window.wp.data.dispatch("core/editor").editPost({slug:seoHelper.slugify(e.target.value)}),_()});const T=document.querySelectorAll(".diagnoseo-var-input");T&&T.forEach(e=>{const o=e.querySelector(".var-input"),a=e.querySelector(".var-select"),t=e.querySelector(".var-button");t.addEventListener("click",e=>{e.preventDefault();var t,r=a.value;r&&(o.selectionStart||"0"==o.selectionStart?(t=o.selectionStart,e=o.selectionEnd,o.value=o.value.substring(0,t)+" "+r+o.value.substring(e,o.value.length)):o.value+=r,o.dispatchEvent(new Event("input")))})}),setTimeout(function(){t(),x(),C(),_()},500)}document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".diagnoseo-image-select");e.forEach(a=>{const e=a.querySelector(".diagnoseo-img-upload"),o=a.querySelector(".diagnoseo-img-remove");e&&e.addEventListener("click",e=>{e.preventDefault();const o=wp.media({title:"Custom Image",button:{text:"Select Image"},multiple:!1}).on("select",()=>{var e=o.state().get("selection").first().toJSON();const t=a.querySelector(".diagnoseo-img"),r=a.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",e.url),r&&(r.value=e.url)}).open()}),o&&o.addEventListener("click",e=>{e.preventDefault();const t=a.querySelector(".diagnoseo-img"),r=a.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",o.dataset.fallbackImage||""),r&&(r.value="")})})}),window._wpLoadBlockEditor?window._wpLoadBlockEditor.then(function(){setTimeout(initSerpSimulator,500)}):window.addEventListener("load",initSerpSimulator);const startSocialPreview=function(){if(window.wp.data){const{select,dispatch,subscribe}=window.wp.data}const e=document.querySelectorAll(".diagnoseo-social-meta"),t=document.body.classList.contains("block-editor-page");if(e){const m=document.querySelector("#facebook-title"),g=document.querySelector("#twitter-title"),f=document.querySelector("#facebook-description"),v=document.querySelector("#twitter-description"),h=document.querySelector("#seo-title"),b=document.querySelector("#seo-description");if(h&&h.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");m.setAttribute("placeholder",e),g.setAttribute("placeholder",e)}),b&&b.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");f.setAttribute("placeholder",e),v.setAttribute("placeholder",e)}),e.forEach(e=>{e.addEventListener("input",e=>{t&&function(e,t){const r={};r[e]=t,dispatch("core/editor").editPost({meta:r})}(e.target.dataset.customField,e.target.value)})}),t)subscribe(()=>{const e=select("core/editor");var t=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_title||m.value||h.value||m.getAttribute("placeholder"),r=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_description||f.value||b.value||b.getAttribute("placeholder"),o=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_title||g.value||h.value||g.getAttribute("placeholder"),a=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_description||v.value||b.value||b.getAttribute("placeholder"),n=e.getEditedPostAttribute("featured_media");const l=document.querySelectorAll(".diagnoseo-social-preview"),i=document.querySelector(".preview-facebook"),s=document.querySelector(".preview-twitter");if(l){const c=i?i.querySelector(".facebook-post-title"):null;c&&(c.textContent=seoHelper.replaceVariables(t));const u=i?i.querySelector(".facebook-post-description"):null;u&&(u.textContent=seoHelper.replaceVariables(r));const d=s?s.querySelector(".twitter-post-title"):null;d&&(d.textContent=seoHelper.replaceVariables(o));const p=s?s.querySelector(".twitter-post-description"):null;p&&(p.textContent=seoHelper.replaceVariables(a)),l.forEach(e=>{var t=n?select("core").getMedia(n):null,t=t?t.guid.raw:e.dataset.placeholderImage;const r=e.querySelector(".preview-image img");r.setAttribute("src",t)})}});else{const r=document.querySelector(".preview-facebook"),o=document.querySelector(".preview-twitter");if(r&&o){const a=r.querySelector(".facebook-post-title"),n=r.querySelector(".facebook-post-description"),l=o.querySelector(".twitter-post-title"),i=o.querySelector(".twitter-post-description");a.textContent=seoHelper.replaceVariables(r.dataset.facebookTitle),n.textContent=seoHelper.replaceVariables(r.dataset.facebookDescription),l.textContent=seoHelper.replaceVariables(o.dataset.twitterTitle),i.textContent=seoHelper.replaceVariables(o.dataset.twitterDescription),m.addEventListener("input",e=>{e=e.target.value;a&&(a.textContent=seoHelper.replaceVariables(e))}),f.addEventListener("input",e=>{e=e.target.value;n&&(n.textContent=seoHelper.replaceVariables(e))}),g.addEventListener("input",e=>{e=e.target.value;l&&(l.textContent=seoHelper.replaceVariables(e))}),v.addEventListener("input",e=>{e=e.target.value;i&&(i.textContent=seoHelper.replaceVariables(e))})}}}};window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(startSocialPreview,500)}),document.body.classList.contains("block-editor-page")||window.addEventListener("load",startSocialPreview); -
diagnoseo/tags/1.2.20/readme.txt
r2992575 r2992578 4 4 Requires at least: 4.7 5 5 Tested up to: 6.3.2 6 Stable tag: 1.2. 196 Stable tag: 1.2.20 7 7 Requires PHP: 5.0 8 8 License: GPLv2 or later -
diagnoseo/trunk/diagnoseo.php
r2992575 r2992578 4 4 * Plugin URI: https://diagnoseo.com/wordpress-seo-plugin/ 5 5 * Description: Powerful SEO plugin for WordPress. The most lightweight and complete SEO solution on the market! It includes best-in-class content analyzer and keyword placement checkpoints. 6 * Version: 1.2. 196 * Version: 1.2.20 7 7 * Author: DiagnoSEO 8 8 * Author URI: https://diagnoseo.com/ -
diagnoseo/trunk/js/diagnoseo-editor-metabox.min.js
r2990586 r2992578 1 const seoHelper={slugify:function(e){e=(e=e.replace(/^\s+|\s+$/g,"")).toLowerCase();for(var t="àáãäâąèéëêęìíïîóòóöôùúüûñńśçćźżł·/_,:;",a=0,l=t.length;a<l;a++)e=e.replace(new RegExp(t.charAt(a),"g"),"aaaaaaeeeeeiiiiooooouuuunnscczzl------".charAt(a));return e=e.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},countOccurences:function(e,t){if(!t||!e)return 0;t=t.toLowerCase().replaceAll(/[:;,.!?-]/g,""),e=e.toLowerCase();e=new RegExp(e,"g");return(t.match(e)||[]).length},countSyllables:function(e){if(""===e)return 0;if(e.length<=3)return 1;e=(e=(e=(e=e.toLowerCase()).replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,"")).replace(/^y/,"")).match(/[aeiouy]{1,2}/g);return e?e.length:0},countWords:function(e){e=(e=(e=e.replace(/(\r\n|\n|\r)/gm," ")).replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g," ")).split(" ");return(e=(e=e.map(e=>e.trim())).filter(e=>e&&""!==e&&"\n"!==e)).length||0},countElements:function(e,t){if(!e||!t)return 0;const a=document.createElement("div");return a.innerHTML=e,a.querySelectorAll(t).length},replaceVariables:function(e){if(e){var{site:t,siteTagline:a,separator:l,excerpt:i,postTitle:n}=document.querySelector(".diagnoseo-preview").dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",document.body.classList.contains("block-editor-page")?window.wp.data.select("core/editor").getEditedPostAttribute("title"):n)).replaceAll("%sitename%",t)).replaceAll("%tagline%",a)).replaceAll("%sep%",l)).replaceAll("%page%"," ")).replaceAll("%excerpt%",i)).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))}},isKeywordInText:function(e,t){if(!e||!t)return!1;e=e.toLowerCase();let a=(t=t.toLowerCase()).toLowerCase().replaceAll(/[:;,.!?-]/g,"");return t.includes(e)||a.includes(e)},isKeywordInAnyElement:function(t,e,a){if(!t||!e||!a)return!1;var l=!1;const i=seoHelper.createMarkupEl(e);return elements=i.querySelectorAll(a),elements.forEach(e=>{seoHelper.isKeywordInText(t,e.textContent)&&(l=!0)}),l},isKeywordInAnyAlt:function(t,e,a=null){if(!t)return!1;if(a&&seoHelper.isKeywordInText(t,a.alt_text))return!0;var l=0;const i=seoHelper.createMarkupEl(e),n=i.querySelectorAll("img");return n.forEach(e=>{e=e.getAttribute("alt").toLowerCase();l+=seoHelper.countOccurences(t,e)}),l},createMarkupEl:function(e){const t=document.createElement("div");return t.innerHTML=e,t},stripTags:function(e){return e.replace(/(<([^>]+)>)/gi,"")}};class diagnoseoFormHelper{input(e,t,a,l="text",i=!1,n="1",r={}){const o=document.createElement("input");for(var u in this.setAttributes(o,{type:l,name:e,id:e,class:a||"components-textarea-control__input widefat",value:t,step:"number"===l?n:""}),i&&o.setAttribute("required","required"),r)o.addEventListener(u,r[u]);return o.addEventListener("input",this.saveSchemaData),o}textarea(e,t,a,l=!1,i={}){const n=document.createElement("textarea");for(var r in this.setAttributes(n,{name:e,id:e,class:a||"components-textarea-control__input widefat"}),n.value=t,l&&n.setAttribute("required","required"),i)n.addEventListener(r,i[r]);return n.addEventListener("input",this.saveSchemaData),n}select(e,a,t,l,i=!1,n={}){const r=document.createElement("select");for(var o in r.value=a,this.setAttributes(r,{name:e,id:e,class:l||"widefat"}),i&&r.setAttribute("required","required"),t.forEach(e=>{const t=document.createElement("option");t.setAttribute("value",e.value),t.textContent=e.label,e.value===a&&t.setAttribute("selected","selected"),r.appendChild(t)}),n)r.addEventListener(o,n[o]);return r.addEventListener("change",this.saveSchemaData),r}button(e,t,a,l,i="",n={}){const r=document.createElement("button");for(var o in r.textContent=a,this.setAttributes(r,{name:e,id:e,class:l,value:t,type:i||""}),n)r.addEventListener(o,n[o]);return r}sectionTitle(e){if(e){const t=document.createElement("h3");return t.classList.add("components-base-control__heading"),t.textContent=e,t}}wrapField(e,t,a="",l="components-base-control__field"){const i=document.createElement("div");l&&i.classList.add(l);const n=document.createElement("label");if(n.classList.add("components-base-control__label"),n.setAttribute("for",e.getAttribute("id")),n.textContent=t,e.getAttribute("required")){const r=document.createElement("span");r.classList.add("req"),r.textContent="*",n.appendChild(r)}if(i.appendChild(n),i.appendChild(e),a){const o=document.createElement("p");o.classList.add("hint"),o.textContent=a,i.appendChild(o)}return i}setAttributes(e,t){for(var a in t)e.setAttribute(a,t[a])}prepareField(e){var t,{fieldType:a,label:l,name:i,value:n,type:r,className:o,options:u,listeners:s,required:p,hint:e,text:c,step:d}=e;switch(a){case"input":t=this.input(i,n,o,r,p,d,s);break;case"textarea":t=this.textarea(i,n,o,p,s);break;case"select":t=this.select(i,n,u,o,p,s);break;case"button":t=this.button(i,n,l,o,r,s);break;case"sectionTitle":t=this.sectionTitle(c)}return"button"===a||"sectionTitle"===a?t:this.wrapField(t,l,e)}saveSchemaData(e){const i=e.target.closest(".diagnoseo-schema-form");if(i){const n={};i.formConfig.forEach(t=>{if("sectionTitle"!==t.fieldType){let e=t.name;var l=e.replaceAll("-","_");let a=i.querySelector(`#${e}`).value||"";t.splitLines&&(a=a.split(t.splitLines),a.forEach((e,t)=>{a[t]=e.trim()})),n[l]=a}});const t=document.querySelector("#schema-data");t.value=JSON.stringify(n);let e=document.querySelector(".diagnoseo-schema-generator");e.setAttribute("data-schema-data",t.value)}}buildSchemaForm(e){const t=document.createElement("div");return t.classList.add("diagnoseo-schema-form"),e.forEach(e=>{e=this.prepareField(e);t.appendChild(e)}),t.formConfig=e,t}}function permalinkWatcher(){"use strict";if(window.wp.data){var e,t=document.body.classList.contains("block-editor-page");const a=document.querySelector("#seo-slug"),l=document.querySelector(".editor-post-link input");a.addEventListener("input",e=>{const t=document.querySelector(".editor-post-link input");e=e.target.value;t&&t.value!==e&&(t.value=e,e=new Event("blur"),t.dispatchEvent(e))}),l&&(l.addEventListener("input",e=>{a.value!==e.target.value&&(a.value=e.target.value)}),a.value&&l&&l.value!==a.value&&(l.value=a.value,e=new Event("blur"),l.dispatchEvent(e))),t&&window.wp.data.subscribe(function(){var e=window.wp.data.select("core/editor").isSavingPost(),t=window.wp.data.select("core/editor").isAutosavingPost();e&&!t&&setTimeout(()=>{const e=document.querySelector("#seo-slug"),t=document.querySelector(".editor-post-link input");var a;e.value&&t?(a=seoHelper.slugify(e.value),e.value=a,t.value=a,a=new Event("blur"),t.dispatchEvent(a)):!e.value&&t&&(a=seoHelper.slugify(t.value),e.value=a)},500)})}}document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".diagnoseo-image-select");e.forEach(i=>{const e=i.querySelector(".diagnoseo-img-upload"),l=i.querySelector(".diagnoseo-img-remove");e&&e.addEventListener("click",e=>{e.preventDefault();const l=wp.media({title:"Custom Image",button:{text:"Select Image"},multiple:!1}).on("select",()=>{var e=l.state().get("selection").first().toJSON();const t=i.querySelector(".diagnoseo-img"),a=i.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",e.url),a&&(a.value=e.url)}).open()}),l&&l.addEventListener("click",e=>{e.preventDefault();const t=i.querySelector(".diagnoseo-img"),a=i.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",l.dataset.fallbackImage||""),a&&(a.value="")})})}),window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(permalinkWatcher,500)});const schemaGeneratorInit=function(){var e,o="",t="";const a=function(e,t=!1){var a=null,l={},i=document.querySelector(".diagnoseo-schema-generator");i&&(l=(l=i.dataset.schemaData)&&JSON.parse(l));const n=["Article","NewsArticle","BlogPosting"];if(!t&&n.includes(e)&&n.includes(o))return o=e,!1;switch(o=e){case"Article":case"NewsArticle":case"BlogPosting":a=articleSchemaForm(l);break;case"Review":a=reviewSchemaForm(l);break;case"Service":a=serviceSchemaForm(l);break;case"Product":a=productSchemaForm(l);break;case"Course":a=courseSchemaForm(l);break;case"Recipe":a=recipeSchemaForm(l);break;case"Person":a=personSchemaForm(l);break;case"JobPosting":a=jobPostingSchemaForm(l);break;case"SoftwareApplication":a=appSchemaForm(l);break;case"Book":a=bookSchemaForm(l);break;case"Event":a=eventSchemaForm(l);break;case"VideoObject":a=videoSchemaForm(l);break;case"ImageObject":a=imageSchemaForm(l);break;case"WebPage":a=webPageSchemaForm(l);break;case"AboutPage":a=aboutPageSchemaForm(l);break;case"FAQPage":a=faqPageSchemaForm(l);break;case"ContactPage":a=contactPageSchemaForm(l);break;default:a=null}const r=document.querySelector(".diagnoseo-schema-fields");return a?(r&&(r.innerHTML="",r.appendChild(a)),!0):(r&&(r.innerHTML=""),!1)},l=function(){const t=document.querySelector(".diagnoseo-schema-generator");if(t){var{schemaData:a}=t.dataset;if(a)for(prop in a=JSON.parse(a)){var l=prop.replaceAll("_","-");let e=t.querySelector(`#${l}`);e&&!e.value&&(e.value=a[prop])}}},i=document.querySelector("#schema-type");i&&(i.addEventListener("change",e=>{a(e.target.value)&&l()}),(e=document.querySelector(".diagnoseo-schema-generator"))&&(t=e.dataset.defaultSchemaType),o=i.value||""),a(o||t,!0),l()};window.addEventListener("load",schemaGeneratorInit);const aboutPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},appSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"operating-system",type:"text",value:e.operating_system||"",label:"Operating system"},{fieldType:"input",name:"app-category",type:"text",value:e.app_category||"",label:"Application category",hint:"Example: Multimedia, Game"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Currency"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"input",name:"rating-count",type:"number",value:e.rating_count,label:"Rating count"}];return t.buildSchemaForm(e)},articleSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"headline",type:"text",value:e.headline||"",label:"Headline"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"keywords",type:"text",value:e.keywords||"",label:"Keywords"}];return t.buildSchemaForm(e)},bookSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"input",name:"url",type:"url",value:e.url||"",label:"URL"},{fieldType:"input",name:"author-name",type:"text",value:e.author_name||"",label:"Author name"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"}];return t.buildSchemaForm(e)},contactPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},courseSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Course name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Course description"},{fieldType:"sectionTitle",text:"Provider"},{fieldType:"select",name:"provider-type",value:e.provider_type,label:"Provider type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"provider-name",type:"text",value:e.provider_name||"",label:"Provider name"},{fieldType:"input",name:"provider-url",type:"text",value:e.provider_url||"",label:"Provider URL"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},eventSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"type",value:e.type,options:[{value:"Event",label:"Event"},{value:"BusinessEvent",label:"Business Event"},{value:"ChildrensEvent",label:"Childrens Event"},{value:"ComedyEvent",label:"Comedy Event"},{value:"DanceEvent",label:"Dance Event"},{value:"DeliveryEvent",label:"Delivery Event"},{value:"EducationEvent",label:"Education Event"},{value:"ExhibitionEvent",label:"Exhibition Event"},{value:"Festival",label:"Festival"},{value:"FoodEvent",label:"Food Event"},{value:"LiteraryEvent",label:"Literary Event"},{value:"MusicEvent",label:"Music Event"},{value:"PublicationEvent",label:"Publication Event"},{value:"SaleEvent",label:"Sale Event"},{value:"ScreeningEvent",label:"Screening Event"},{value:"SocialEvent",label:"Social Event"},{value:"SportsEvent",label:"Sports Event"},{value:"TheaterEvent",label:"Theater Event"},{value:"VisualArtsEvent",label:"Visual Arts Event"}],label:"Event type"},{fieldType:"select",name:"status",value:e.status,options:[{value:"",label:"None"},{value:"EventScheduled",label:"Scheduled"},{value:"EventCancelled",label:"Cancelled"},{value:"EventPostponed",label:"Postponed"},{value:"EventRescheduled",label:"Rescheduled"},{value:"EventMovedOnline",label:"Moved Online"}],label:"Event status"},{fieldType:"select",name:"mode",value:e.mode,options:[{value:"OfflineEventAttendanceMode",label:"Offline"},{value:"OnlineEventAttendanceMode",label:"Online"},{value:"MixedEventAttendanceMode",label:"Mixed (Offline + Online)"}],label:"Attendance mode"},{fieldType:"input",name:"date-start",type:"date",value:e.date_start,label:"Start date"},{fieldType:"input",name:"date-end",type:"date",value:e.date_end,label:"End date"},{fieldType:"sectionTitle",text:"Venue"},{fieldType:"input",name:"venue-name",type:"text",value:e.venue_name||"",label:"Venue name"},{fieldType:"input",name:"venue-url",type:"url",value:e.venue_url||"",label:"Venue URL"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"},{fieldType:"sectionTitle",text:"Performer"},{fieldType:"select",name:"performer-type",value:e.performer_type,options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}],label:"Performer"},{fieldType:"input",name:"performer-name",type:"text",value:e.performer_name||"",label:"Performer name"},{fieldType:"input",name:"performer-url",type:"url",value:e.performer_url||"",label:"Performer website or social link"},{fieldType:"sectionTitle",text:"Organizer"},{fieldType:"select",name:"organizer-type",value:e.organizer_type,options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}],label:"Organizer"},{fieldType:"input",name:"organizer-name",type:"text",value:e.organizer_name||"",label:"Organizer name"},{fieldType:"input",name:"organizer-url",type:"url",value:e.organizer_url||"",label:"Organizer website or social link"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-url",type:"url",value:e.offer_url||"",label:"Offer URL"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Offer price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Offer currency"},{fieldType:"select",name:"offer-availability",value:e.offer_availability,options:[{value:"InStock",label:"In Stock"},{value:"SoldOut",label:"Sold Out"},{value:"Preorder",label:"Preorder"}],label:"Availability"},{fieldType:"input",name:"price-valid-from",type:"date",value:e.price_valid_from,label:"Price valid from"},{fieldType:"input",name:"inv-level",type:"text",value:e.inv_level||"",label:"Inventory level"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"}];return t.buildSchemaForm(e)},faqPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"main-question",type:"text",value:e.main_question||"",label:"Main entity - question"},{fieldType:"textarea",name:"main-answer",type:"text",value:e.main_answer||"",label:"Main entity - answer"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},imageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"location",type:"text",value:e.location||"",label:"Location",hint:"Name of the place where the picture was taken, for example: Manhattan, New York"}];return t.buildSchemaForm(e)},jobPostingSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"salary-currency",type:"text",value:e.salary_currency||"",label:"Salary currency",hint:"ISO 4217 Currency code. Example: EUR"},{fieldType:"input",name:"salary-amount",type:"text",value:e.salary_amount||"",label:"Salary amount",hint:"Insert amount, e.g. 100.00, or a salary range, e.g. 120.00-160.00"},{fieldType:"select",name:"salary-payroll",value:e.salary_payroll,label:"Payroll",options:[{value:"None",label:""},{value:"Yearly",label:"YEAR"},{value:"Monthly",label:"MONTH"},{value:"Weekly",label:"WEEK"},{value:"Daily",label:"DAY"},{value:"Hourly",label:"HOUR"}]},{fieldType:"input",name:"date-posted",type:"date",value:e.date_posted,label:"Date posted",hint:"Choose date, post publication date will be used if this field is empty"},{fieldType:"input",name:"date-expires",type:"date",value:e.date_expires,label:"Expiry date",hint:"Leave empty if the job posting does not expire"},{fieldType:"select",name:"employment-type",value:e.employment_type,label:"Employment type",options:[{value:"FULL_TIME",label:"Full Time"},{value:"PART_TIME",label:"Part Time"},{value:"CONTRACTOR",label:"Contractor"},{value:"TEMPORARY",label:"Temporary"},{value:"INTERN",label:"Intern"},{value:"VOLUNTEER",label:"Volunteer"},{value:"PER_DIEM",label:"Per Diem"},{value:"OTHER",label:"Other"}]},{fieldType:"input",name:"posting-id",type:"text",value:e.posting_id||"",label:"Posting ID"},{fieldType:"sectionTitle",text:"Hiring organization"},{fieldType:"input",name:"company",type:"text",value:e.company||"",label:"Hiring organization"},{fieldType:"input",name:"org-url",type:"url",value:e.org_url||"",label:"Organization URL"},{fieldType:"input",name:"org-logo",type:"url",value:e.org_logo||"",label:"Organization logo URL"},{fieldType:"sectionTitle",text:"Job location"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"}];return t.buildSchemaForm(e)},personSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"email",type:"email",value:e.email||"",label:"E-mail"},{fieldType:"input",name:"gender",type:"text",value:e.gender||"",label:"Gender"},{fieldType:"input",name:"job-title",type:"text",value:e.job_title||"",label:"Job title"},{fieldType:"input",name:"url",type:"url",value:e.url||"",label:"URL"},{fieldType:"input",name:"image",type:"url",value:e.url||"",label:"Image URL"},{fieldType:"sectionTitle",text:"Address"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"}];return t.buildSchemaForm(e)},productSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Product name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Product description"},{fieldType:"input",name:"sku",type:"text",value:e.sku||"",label:"Product SKU"},{fieldType:"input",name:"identifier_name",type:"text",value:e.identifier_name||"",label:"Global identifier",hint:"GTIN, MPN, ISBN or other"},{fieldType:"input",name:"identifier_value",type:"text",value:e.identifier_value||"",label:"Global identifier value"},{fieldType:"input",name:"brand",type:"text",value:e.brand||"",label:"Brand name"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"price",type:"number",value:e.price,label:"Price",step:"0.01"},{fieldType:"input",name:"currency",type:"text",value:e.currency||"",label:"Currency"},{fieldType:"input",name:"deadline",type:"date",value:e.deadline,label:"Price valid until"},{fieldType:"select",name:"availability",value:e.availability,options:[{label:"In Stock",value:"InStock"},{label:"Sold Out",value:"SoldOut"},{label:"Preorder",value:"Preorder"}],label:"Availability"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"sectionTitle",text:"Review publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},recipeSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Recipe title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Recipe description"},{fieldType:"input",name:"prep-time",type:"text",value:e.prep_time||"",label:"Preparation time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"cook-time",type:"text",value:e.cook_time||"",label:"Cooking time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"total-time",type:"text",value:e.total_time||"",label:"Total time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"type",type:"text",value:e.type||"",label:"Type of dish",hint:"Example: appetizer or dessert"},{fieldType:"input",name:"cuisine",type:"text",value:e.cuisine||"",label:"Cuisine"},{fieldType:"input",name:"keywords",type:"text",value:e.keywords||"",label:"Keywords"},{fieldType:"input",name:"yield",type:"text",value:e.yield||"",label:"Recipe yield",hint:"Quantity of portions produced by the recipe, for example: 4"},{fieldType:"input",name:"calories",type:"number",value:e.calories,label:"Calories"},{fieldType:"textarea",name:"ingredients",value:e.ingredients?e.ingredients.join("; "):"",label:"Ingredients",hint:"Separate ingredients with semicolons (;)",splitLines:";"},{fieldType:"textarea",name:"instructions",value:e.instructions?e.instructions.join("; "):"",label:"Recipe instructions",hint:"Separate instructions with semicolons (;)",splitLines:";"},{fieldType:"sectionTitle",text:"Aggregate Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-count",type:"number",value:e.rating_count,label:"Rating count"},{fieldType:"sectionTitle",text:"Video"},{fieldType:"input",name:"video-title",type:"text",value:e.video_title||"",label:"Video title"},{fieldType:"textarea",name:"video-description",value:e.video_description||"",label:"Video description"},{fieldType:"input",name:"video-url",type:"url",value:e.video_url||"",label:"Video URL"},{fieldType:"input",name:"video-content-url",type:"url",value:e.video_content_url||"",label:"Video content URL",hint:"A URL pointing to the actual video media file"},{fieldType:"input",name:"video-thumbnail",type:"url",value:e.video_thumbnail||"",label:"Video thumbnail URL"},{fieldType:"input",name:"video-duration",type:"text",value:e.video_duration||"",label:"Video duration",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"video-uploaded",type:"date",value:e.video_uploaded,label:"Video upload date"}];return t.buildSchemaForm(e)},reviewSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Review title"},{fieldType:"sectionTitle",text:"Reviewed item"},{fieldType:"select",name:"reviewed-item",value:e.reviewed_item,label:"Reviewed item",options:[{value:"Book",label:"Book"},{value:"Course",label:"Course"},{value:"Event",label:"Event"},{value:"How-to",label:"How-to"},{value:"LocalBusiness",label:"Local Business"},{value:"Movie",label:"Movie"},{value:"Product",label:"Product"},{value:"Recipe",label:"Recipe"},{value:"SoftwareApp",label:"Software App"}]},{fieldType:"input",name:"reviewed-item-image",type:"url",value:e.reviewed_item_image||"",label:"Reviewed item image URL"},{fieldType:"input",name:"reviewed-item-name",type:"text",value:e.reviewed_item_name||"",label:"Reviewed item name"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",step:"0.01",value:e.rating,label:"Rating value"},{fieldType:"textarea",name:"review-body",value:e.review_body||"",label:"Review text"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},serviceSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"service-type",type:"text",value:e.service_type||"",label:"Service type"},{fieldType:"input",name:"service-name",type:"text",value:e.service_name||"",label:"Name"},{fieldType:"textarea",name:"service-description",value:e.service_description||"",label:"Service description"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Currency"}];return t.buildSchemaForm(e)},videoSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"embed-url",type:"url",value:e.embed_url||"",label:"Embed URL",hint:"A URL pointing to the embeddable player for the video. Example: https://www.youtube.com/embed/VIDEOID"},{fieldType:"input",name:"content-url",type:"url",value:e.content_url||"",label:"Content URL",hint:"A URL pointing to the actual video media file like MP4, MOV, etc. Please leave it empty if you don't know the URL"},{fieldType:"input",name:"duration",type:"text",value:e.duration||"",label:"Duration",hint:"ISO 8601 duration format. Example: PT1H30M"}];return t.buildSchemaForm(e)},webPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)};function initSerpSimulator(){"use strict";const r=document.body.classList.contains("block-editor-page"),o=document.querySelector(".diagnoseo-preview");if(!o)return;const l=o.querySelector(".search-result .search-result-title"),a=o.querySelector(".search-result.mobile .search-result-title"),i=o.querySelector(".search-result .search-result-descr"),n=o.querySelector(".search-result.mobile .search-result-descr"),e=document.querySelector(".diagnoseo-meta-form")||document.querySelector(".diagnoseo-settings-form"),u=e.querySelector("#seo-title")||e.querySelector("#diagnoseo_home_title"),s=e.querySelector(".info-title-chars"),p=e.querySelector(".info-title-width"),c=e.querySelector(".seo-title-progress .diagnoseo-progress-fill"),d=e.querySelector("#seo-description")||e.querySelector("#diagnoseo_home_description"),m=e.querySelector(".info-descr-chars"),v=e.querySelector(".info-descr-width"),y=e.querySelector(".seo-descr-progress .diagnoseo-progress-fill"),b=e.querySelector("#seo-slug"),f=e.querySelector(".info-slug-chars"),g=e.querySelector(".seo-slug-progress .diagnoseo-progress-fill"),h=o.querySelector(".title-sample"),T=o.querySelector(".description-sample"),t=function(){for(var e=!1;function(){var e=l.offsetWidth-20;l.style.maxWidth="none",l.style.position="absolute";var t=l.offsetWidth;return l.removeAttribute("style"),e<t}();){var t=S(l.textContent);if(!t)break;t=(t=(t=t.replace(/\/$/," ...")).split(" ").slice(0,-1).join(" ")).replace(/,\s*$/,""),e=!0,l.textContent=t,a.textContent=t}e&&(l.textContent=l.textContent+" ...",a.textContent=a.textContent+" ...")},x=function(e,t,a=0){const l=e.split(" "),i=T;if(!i)return e;e=function(e,t){for(var a,l="",i=e.split(" "),n=0;n<i.length;n++)if(a=l,(l+=" "+i[n]).length>t){l=a+" ...";break}return l=l.replace(/,\s*$/,"")}(e,a),i.textContent=e;for(var n=!1;i.clientWidth>t;){l.pop();var n=!0,r=l.join(" ");i.textContent=r}return n?l.join(" ")+" ...":e},w=function(e){var t=S(e),e=x(t,960,158);i.textContent=e;e=x(t,680,158);n.textContent=e,T.textContent=t},S=function(e){if(!e)return"";var{site:t,siteTagline:a,separator:l,excerpt:i,postTitle:n}=o.dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",r?window.wp.data.select("core/editor").getEditedPostAttribute("title"):n)).replaceAll("%sitename%",t)).replaceAll("%tagline%",a)).replaceAll("%sep%",l)).replaceAll(" %page%","")).replaceAll("%excerpt%",i||_())).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))},E=function(e){e=S(e),h.textContent=e||l.dataset.fallback,l.textContent=e||l.dataset.fallback,a.textContent=e||l.dataset.fallback,t()},_=function(){if(!window.wp||!window.wp.data)return"";let a=r?window.wp.data.select("core/editor").getEditedPostAttribute("excerpt"):o.dataset.excerpt;if(!a){let e=r?window.wp.data.select("core/editor").getEditedPostContent():"";e=seoHelper.stripTags(e).trim();let t=e.split(" ");var l=Math.min(t.length,55);t=t.splice(0,l),a=t.join(" ")}return a},P=function(){var e,t,a,l;c&&(e=h.clientWidth,l=h.textContent,100<(a=e/600*100)&&(a=100),(t=(l=S(l)).length)||(a=0),a+="%",l="",30<=t&&e<=600&&(30<=t&&t<35||60<t&&e<=600?l="medium":35<=t&&t<=60&&(l="full")),s.textContent=t,p.textContent=e,c.style.width=a,l?c.classList.contains(l)||(c.classList.remove("medium","full"),c.classList.add(l)):c.classList.remove("medium","full"))},A=function(){var e,t,a,l;y&&(l=T.textContent,e=T.clientWidth,t=l.length,100<(a=e/990*100)&&(a=100),d.value.length||d.getAttribute("placeholder")||(a=0),a+="%",l="",70<=t&&e<=990&&(70<=t&&t<130||158<t&&e<=990?l="medium":130<=t&&t<=158&&(l="full")),m.textContent=t,v.textContent=e,y.style.width=a,l?y.classList.contains(l)||(y.classList.remove("medium","full"),y.classList.add(l)):y.classList.remove("medium","full"))},L=function(){var e,t,a;g&&(t="",(a=(e=(e=b.value).replaceAll(" ","-")).split("-")).length<=5&&e.length?e.length<=50?t="full":50<e.length&&e.length<=60&&(t="medium"):5<a.length&&e.length<60&&(t="medium"),100<(a=Math.round(e.length/60*100))&&(a=100),g.style.width=a+"%",f.textContent=e.length,t?g.classList.contains(t)||(g.classList.remove("medium","full"),g.classList.add(t)):g.classList.remove("medium","full"))};u&&(u.addEventListener("input",function(e){E(e.target.value),h.textContent=S(e.target.value),r&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_title:e.target.value}}),P()}),E(u.value||u.getAttribute("placeholder")),P());const k=l.dataset.fallback;r?window.wp.data.subscribe(()=>{var e=window.wp.data.select("core/editor").getEditedPostAttribute("title")||o.dataset.postTitle;l.dataset.fallback=e||k;var t=u.value||u.getAttribute("placeholder");E(t),P();const a=document.querySelector("#postlist-title");!(window.wp.data.select("core/editor").getEditedPostAttribute("meta")?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:e)&&a&&a.setAttribute("placeholder",e)}):u&&u.addEventListener("input",e=>{var t=r?window.wp.data.select("core/editor").getEditedPostAttribute("title"):o.dataset.postTitle;l.dataset.fallback=t||k;e=e.target.value||e.target.value.getAttribute("placeholder");E(e),P();const a=document.querySelector("#postlist-title");!(r?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:t)&&a&&a.setAttribute("placeholder",t)}),d&&(d.addEventListener("input",function(e){w(e.target.value||e.target.getAttribute("placeholder")),r&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_description:e.target.value}}),A()}),w(d.value||d.getAttribute("placeholder")),A()),b&&b.addEventListener("input",e=>{r&&window.wp.data.dispatch("core/editor").editPost({slug:seoHelper.slugify(e.target.value)}),L()});const C=document.querySelectorAll(".diagnoseo-var-input");C&&C.forEach(e=>{const l=e.querySelector(".var-input"),i=e.querySelector(".var-select"),t=e.querySelector(".var-button");t.addEventListener("click",e=>{e.preventDefault();var t,a=i.value;a&&(l.selectionStart||"0"==l.selectionStart?(t=l.selectionStart,e=l.selectionEnd,l.value=l.value.substring(0,t)+" "+a+l.value.substring(e,l.value.length)):l.value+=a,l.dispatchEvent(new Event("input")))})}),setTimeout(function(){t(),P(),A(),L()},500)}window._wpLoadBlockEditor?window._wpLoadBlockEditor.then(function(){setTimeout(initSerpSimulator,500)}):window.addEventListener("load",initSerpSimulator);const startSocialPreview=function(){ const{select:m,dispatch:l,subscribe:e}=window.wp.data,t=document.querySelectorAll(".diagnoseo-social-meta"),a=document.body.classList.contains("block-editor-page");if(t){const v=document.querySelector("#facebook-title"),y=document.querySelector("#twitter-title"),b=document.querySelector("#facebook-description"),f=document.querySelector("#twitter-description"),g=document.querySelector("#seo-title"),h=document.querySelector("#seo-description");if(g.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");v.setAttribute("placeholder",e),y.setAttribute("placeholder",e)}),h.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");b.setAttribute("placeholder",e),f.setAttribute("placeholder",e)}),t.forEach(e=>{e.addEventListener("input",e=>{a&&function(e,t){const a={};a[e]=t,l("core/editor").editPost({meta:a})}(e.target.dataset.customField,e.target.value)})}),a)e(()=>{const e=m("core/editor");var t=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_title||v.value||g.value||v.getAttribute("placeholder"),a=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_description||b.value||h.value||h.getAttribute("placeholder"),l=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_title||y.value||g.value||y.getAttribute("placeholder"),i=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_description||f.value||h.value||h.getAttribute("placeholder"),n=e.getEditedPostAttribute("featured_media");const r=document.querySelectorAll(".diagnoseo-social-preview"),o=document.querySelector(".preview-facebook"),u=document.querySelector(".preview-twitter"),s=o.querySelector(".facebook-post-title");s&&(s.textContent=seoHelper.replaceVariables(t));const p=o.querySelector(".facebook-post-description");p&&(p.textContent=seoHelper.replaceVariables(a));const c=u.querySelector(".twitter-post-title");c&&(c.textContent=seoHelper.replaceVariables(l));const d=u.querySelector(".twitter-post-description");d&&(d.textContent=seoHelper.replaceVariables(i)),r.forEach(e=>{var t=n?m("core").getMedia(n):null,t=t?t.guid.raw:e.dataset.placeholderImage;const a=e.querySelector(".preview-image img");a.setAttribute("src",t)})});else{const i=document.querySelector(".preview-facebook"),n=document.querySelector(".preview-twitter"),r=i.querySelector(".facebook-post-title"),o=i.querySelector(".facebook-post-description"),u=n.querySelector(".twitter-post-title"),s=n.querySelector(".twitter-post-description");r.textContent=seoHelper.replaceVariables(i.dataset.facebookTitle),o.textContent=seoHelper.replaceVariables(i.dataset.facebookDescription),u.textContent=seoHelper.replaceVariables(n.dataset.twitterTitle),s.textContent=seoHelper.replaceVariables(n.dataset.twitterDescription),v.addEventListener("input",e=>{e=e.target.value;r&&(r.textContent=seoHelper.replaceVariables(e))}),b.addEventListener("input",e=>{e=e.target.value;o&&(o.textContent=seoHelper.replaceVariables(e))}),y.addEventListener("input",e=>{e=e.target.value;u&&(u.textContent=seoHelper.replaceVariables(e))}),f.addEventListener("input",e=>{e=e.target.value;s&&(s.textContent=seoHelper.replaceVariables(e))})}}};window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(startSocialPreview,500)}),document.body.classList.contains("block-editor-page")||window.addEventListener("load",startSocialPreview),jQuery(document).on("ready",function(){jQuery(".toggle").each(function(){const t=jQuery(this).find(".toggle-trigger"),a=jQuery(this).find(".toggle-content");t.on("click",function(e){e.preventDefault(),a.slideToggle(),t.toggleClass("open")})})});1 const seoHelper={slugify:function(e){e=(e=e.replace(/^\s+|\s+$/g,"")).toLowerCase();for(var t="àáãäâąèéëêęìíïîóòóöôùúüûñńśçćźżł·/_,:;",a=0,l=t.length;a<l;a++)e=e.replace(new RegExp(t.charAt(a),"g"),"aaaaaaeeeeeiiiiooooouuuunnscczzl------".charAt(a));return e=e.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},countOccurences:function(e,t){if(!t||!e)return 0;t=t.toLowerCase().replaceAll(/[:;,.!?-]/g,""),e=e.toLowerCase();e=new RegExp(e,"g");return(t.match(e)||[]).length},countSyllables:function(e){if(""===e)return 0;if(e.length<=3)return 1;e=(e=(e=(e=e.toLowerCase()).replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,"")).replace(/^y/,"")).match(/[aeiouy]{1,2}/g);return e?e.length:0},countWords:function(e){e=(e=(e=e.replace(/(\r\n|\n|\r)/gm," ")).replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g," ")).split(" ");return(e=(e=e.map(e=>e.trim())).filter(e=>e&&""!==e&&"\n"!==e)).length||0},countElements:function(e,t){if(!e||!t)return 0;const a=document.createElement("div");return a.innerHTML=e,a.querySelectorAll(t).length},replaceVariables:function(e){if(e){var{site:t,siteTagline:a,separator:l,excerpt:i,postTitle:n}=document.querySelector(".diagnoseo-preview").dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",document.body.classList.contains("block-editor-page")?window.wp.data.select("core/editor").getEditedPostAttribute("title"):n)).replaceAll("%sitename%",t)).replaceAll("%tagline%",a)).replaceAll("%sep%",l)).replaceAll("%page%"," ")).replaceAll("%excerpt%",i)).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))}},isKeywordInText:function(e,t){if(!e||!t)return!1;e=e.toLowerCase();let a=(t=t.toLowerCase()).toLowerCase().replaceAll(/[:;,.!?-]/g,"");return t.includes(e)||a.includes(e)},isKeywordInAnyElement:function(t,e,a){if(!t||!e||!a)return!1;var l=!1;const i=seoHelper.createMarkupEl(e);return elements=i.querySelectorAll(a),elements.forEach(e=>{seoHelper.isKeywordInText(t,e.textContent)&&(l=!0)}),l},isKeywordInAnyAlt:function(t,e,a=null){if(!t)return!1;if(a&&seoHelper.isKeywordInText(t,a.alt_text))return!0;var l=0;const i=seoHelper.createMarkupEl(e),n=i.querySelectorAll("img");return n.forEach(e=>{e=e.getAttribute("alt").toLowerCase();l+=seoHelper.countOccurences(t,e)}),l},createMarkupEl:function(e){const t=document.createElement("div");return t.innerHTML=e,t},stripTags:function(e){return e.replace(/(<([^>]+)>)/gi,"")}};class diagnoseoFormHelper{input(e,t,a,l="text",i=!1,n="1",r={}){const o=document.createElement("input");for(var u in this.setAttributes(o,{type:l,name:e,id:e,class:a||"components-textarea-control__input widefat",value:t,step:"number"===l?n:""}),i&&o.setAttribute("required","required"),r)o.addEventListener(u,r[u]);return o.addEventListener("input",this.saveSchemaData),o}textarea(e,t,a,l=!1,i={}){const n=document.createElement("textarea");for(var r in this.setAttributes(n,{name:e,id:e,class:a||"components-textarea-control__input widefat"}),n.value=t,l&&n.setAttribute("required","required"),i)n.addEventListener(r,i[r]);return n.addEventListener("input",this.saveSchemaData),n}select(e,a,t,l,i=!1,n={}){const r=document.createElement("select");for(var o in r.value=a,this.setAttributes(r,{name:e,id:e,class:l||"widefat"}),i&&r.setAttribute("required","required"),t.forEach(e=>{const t=document.createElement("option");t.setAttribute("value",e.value),t.textContent=e.label,e.value===a&&t.setAttribute("selected","selected"),r.appendChild(t)}),n)r.addEventListener(o,n[o]);return r.addEventListener("change",this.saveSchemaData),r}button(e,t,a,l,i="",n={}){const r=document.createElement("button");for(var o in r.textContent=a,this.setAttributes(r,{name:e,id:e,class:l,value:t,type:i||""}),n)r.addEventListener(o,n[o]);return r}sectionTitle(e){if(e){const t=document.createElement("h3");return t.classList.add("components-base-control__heading"),t.textContent=e,t}}wrapField(e,t,a="",l="components-base-control__field"){const i=document.createElement("div");l&&i.classList.add(l);const n=document.createElement("label");if(n.classList.add("components-base-control__label"),n.setAttribute("for",e.getAttribute("id")),n.textContent=t,e.getAttribute("required")){const r=document.createElement("span");r.classList.add("req"),r.textContent="*",n.appendChild(r)}if(i.appendChild(n),i.appendChild(e),a){const o=document.createElement("p");o.classList.add("hint"),o.textContent=a,i.appendChild(o)}return i}setAttributes(e,t){for(var a in t)e.setAttribute(a,t[a])}prepareField(e){var t,{fieldType:a,label:l,name:i,value:n,type:r,className:o,options:u,listeners:s,required:p,hint:e,text:c,step:d}=e;switch(a){case"input":t=this.input(i,n,o,r,p,d,s);break;case"textarea":t=this.textarea(i,n,o,p,s);break;case"select":t=this.select(i,n,u,o,p,s);break;case"button":t=this.button(i,n,l,o,r,s);break;case"sectionTitle":t=this.sectionTitle(c)}return"button"===a||"sectionTitle"===a?t:this.wrapField(t,l,e)}saveSchemaData(e){const i=e.target.closest(".diagnoseo-schema-form");if(i){const n={};i.formConfig.forEach(t=>{if("sectionTitle"!==t.fieldType){let e=t.name;var l=e.replaceAll("-","_");let a=i.querySelector(`#${e}`).value||"";t.splitLines&&(a=a.split(t.splitLines),a.forEach((e,t)=>{a[t]=e.trim()})),n[l]=a}});const t=document.querySelector("#schema-data");t.value=JSON.stringify(n);let e=document.querySelector(".diagnoseo-schema-generator");e.setAttribute("data-schema-data",t.value)}}buildSchemaForm(e){const t=document.createElement("div");return t.classList.add("diagnoseo-schema-form"),e.forEach(e=>{e=this.prepareField(e);t.appendChild(e)}),t.formConfig=e,t}}function permalinkWatcher(){"use strict";if(window.wp.data){var e,t=document.body.classList.contains("block-editor-page");const a=document.querySelector("#seo-slug"),l=document.querySelector(".editor-post-link input");a.addEventListener("input",e=>{const t=document.querySelector(".editor-post-link input");e=e.target.value;t&&t.value!==e&&(t.value=e,e=new Event("blur"),t.dispatchEvent(e))}),l&&(l.addEventListener("input",e=>{a.value!==e.target.value&&(a.value=e.target.value)}),a.value&&l&&l.value!==a.value&&(l.value=a.value,e=new Event("blur"),l.dispatchEvent(e))),t&&window.wp.data.subscribe(function(){var e=window.wp.data.select("core/editor").isSavingPost(),t=window.wp.data.select("core/editor").isAutosavingPost();e&&!t&&setTimeout(()=>{const e=document.querySelector("#seo-slug"),t=document.querySelector(".editor-post-link input");var a;e.value&&t?(a=seoHelper.slugify(e.value),e.value=a,t.value=a,a=new Event("blur"),t.dispatchEvent(a)):!e.value&&t&&(a=seoHelper.slugify(t.value),e.value=a)},500)})}}document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".diagnoseo-image-select");e.forEach(i=>{const e=i.querySelector(".diagnoseo-img-upload"),l=i.querySelector(".diagnoseo-img-remove");e&&e.addEventListener("click",e=>{e.preventDefault();const l=wp.media({title:"Custom Image",button:{text:"Select Image"},multiple:!1}).on("select",()=>{var e=l.state().get("selection").first().toJSON();const t=i.querySelector(".diagnoseo-img"),a=i.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",e.url),a&&(a.value=e.url)}).open()}),l&&l.addEventListener("click",e=>{e.preventDefault();const t=i.querySelector(".diagnoseo-img"),a=i.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",l.dataset.fallbackImage||""),a&&(a.value="")})})}),window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(permalinkWatcher,500)});const schemaGeneratorInit=function(){var e,o="",t="";const a=function(e,t=!1){var a=null,l={},i=document.querySelector(".diagnoseo-schema-generator");i&&(l=(l=i.dataset.schemaData)&&JSON.parse(l));const n=["Article","NewsArticle","BlogPosting"];if(!t&&n.includes(e)&&n.includes(o))return o=e,!1;switch(o=e){case"Article":case"NewsArticle":case"BlogPosting":a=articleSchemaForm(l);break;case"Review":a=reviewSchemaForm(l);break;case"Service":a=serviceSchemaForm(l);break;case"Product":a=productSchemaForm(l);break;case"Course":a=courseSchemaForm(l);break;case"Recipe":a=recipeSchemaForm(l);break;case"Person":a=personSchemaForm(l);break;case"JobPosting":a=jobPostingSchemaForm(l);break;case"SoftwareApplication":a=appSchemaForm(l);break;case"Book":a=bookSchemaForm(l);break;case"Event":a=eventSchemaForm(l);break;case"VideoObject":a=videoSchemaForm(l);break;case"ImageObject":a=imageSchemaForm(l);break;case"WebPage":a=webPageSchemaForm(l);break;case"AboutPage":a=aboutPageSchemaForm(l);break;case"FAQPage":a=faqPageSchemaForm(l);break;case"ContactPage":a=contactPageSchemaForm(l);break;default:a=null}const r=document.querySelector(".diagnoseo-schema-fields");return a?(r&&(r.innerHTML="",r.appendChild(a)),!0):(r&&(r.innerHTML=""),!1)},l=function(){const t=document.querySelector(".diagnoseo-schema-generator");if(t){var{schemaData:a}=t.dataset;if(a)for(prop in a=JSON.parse(a)){var l=prop.replaceAll("_","-");let e=t.querySelector(`#${l}`);e&&!e.value&&(e.value=a[prop])}}},i=document.querySelector("#schema-type");i&&(i.addEventListener("change",e=>{a(e.target.value)&&l()}),(e=document.querySelector(".diagnoseo-schema-generator"))&&(t=e.dataset.defaultSchemaType),o=i.value||""),a(o||t,!0),l()};window.addEventListener("load",schemaGeneratorInit);const aboutPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},appSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"operating-system",type:"text",value:e.operating_system||"",label:"Operating system"},{fieldType:"input",name:"app-category",type:"text",value:e.app_category||"",label:"Application category",hint:"Example: Multimedia, Game"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Currency"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"input",name:"rating-count",type:"number",value:e.rating_count,label:"Rating count"}];return t.buildSchemaForm(e)},articleSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"headline",type:"text",value:e.headline||"",label:"Headline"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"keywords",type:"text",value:e.keywords||"",label:"Keywords"}];return t.buildSchemaForm(e)},bookSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"input",name:"url",type:"url",value:e.url||"",label:"URL"},{fieldType:"input",name:"author-name",type:"text",value:e.author_name||"",label:"Author name"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"}];return t.buildSchemaForm(e)},contactPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},courseSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Course name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Course description"},{fieldType:"sectionTitle",text:"Provider"},{fieldType:"select",name:"provider-type",value:e.provider_type,label:"Provider type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"provider-name",type:"text",value:e.provider_name||"",label:"Provider name"},{fieldType:"input",name:"provider-url",type:"text",value:e.provider_url||"",label:"Provider URL"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},eventSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"type",value:e.type,options:[{value:"Event",label:"Event"},{value:"BusinessEvent",label:"Business Event"},{value:"ChildrensEvent",label:"Childrens Event"},{value:"ComedyEvent",label:"Comedy Event"},{value:"DanceEvent",label:"Dance Event"},{value:"DeliveryEvent",label:"Delivery Event"},{value:"EducationEvent",label:"Education Event"},{value:"ExhibitionEvent",label:"Exhibition Event"},{value:"Festival",label:"Festival"},{value:"FoodEvent",label:"Food Event"},{value:"LiteraryEvent",label:"Literary Event"},{value:"MusicEvent",label:"Music Event"},{value:"PublicationEvent",label:"Publication Event"},{value:"SaleEvent",label:"Sale Event"},{value:"ScreeningEvent",label:"Screening Event"},{value:"SocialEvent",label:"Social Event"},{value:"SportsEvent",label:"Sports Event"},{value:"TheaterEvent",label:"Theater Event"},{value:"VisualArtsEvent",label:"Visual Arts Event"}],label:"Event type"},{fieldType:"select",name:"status",value:e.status,options:[{value:"",label:"None"},{value:"EventScheduled",label:"Scheduled"},{value:"EventCancelled",label:"Cancelled"},{value:"EventPostponed",label:"Postponed"},{value:"EventRescheduled",label:"Rescheduled"},{value:"EventMovedOnline",label:"Moved Online"}],label:"Event status"},{fieldType:"select",name:"mode",value:e.mode,options:[{value:"OfflineEventAttendanceMode",label:"Offline"},{value:"OnlineEventAttendanceMode",label:"Online"},{value:"MixedEventAttendanceMode",label:"Mixed (Offline + Online)"}],label:"Attendance mode"},{fieldType:"input",name:"date-start",type:"date",value:e.date_start,label:"Start date"},{fieldType:"input",name:"date-end",type:"date",value:e.date_end,label:"End date"},{fieldType:"sectionTitle",text:"Venue"},{fieldType:"input",name:"venue-name",type:"text",value:e.venue_name||"",label:"Venue name"},{fieldType:"input",name:"venue-url",type:"url",value:e.venue_url||"",label:"Venue URL"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"},{fieldType:"sectionTitle",text:"Performer"},{fieldType:"select",name:"performer-type",value:e.performer_type,options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}],label:"Performer"},{fieldType:"input",name:"performer-name",type:"text",value:e.performer_name||"",label:"Performer name"},{fieldType:"input",name:"performer-url",type:"url",value:e.performer_url||"",label:"Performer website or social link"},{fieldType:"sectionTitle",text:"Organizer"},{fieldType:"select",name:"organizer-type",value:e.organizer_type,options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}],label:"Organizer"},{fieldType:"input",name:"organizer-name",type:"text",value:e.organizer_name||"",label:"Organizer name"},{fieldType:"input",name:"organizer-url",type:"url",value:e.organizer_url||"",label:"Organizer website or social link"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-url",type:"url",value:e.offer_url||"",label:"Offer URL"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Offer price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Offer currency"},{fieldType:"select",name:"offer-availability",value:e.offer_availability,options:[{value:"InStock",label:"In Stock"},{value:"SoldOut",label:"Sold Out"},{value:"Preorder",label:"Preorder"}],label:"Availability"},{fieldType:"input",name:"price-valid-from",type:"date",value:e.price_valid_from,label:"Price valid from"},{fieldType:"input",name:"inv-level",type:"text",value:e.inv_level||"",label:"Inventory level"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"}];return t.buildSchemaForm(e)},faqPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"main-question",type:"text",value:e.main_question||"",label:"Main entity - question"},{fieldType:"textarea",name:"main-answer",type:"text",value:e.main_answer||"",label:"Main entity - answer"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},imageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"location",type:"text",value:e.location||"",label:"Location",hint:"Name of the place where the picture was taken, for example: Manhattan, New York"}];return t.buildSchemaForm(e)},jobPostingSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"salary-currency",type:"text",value:e.salary_currency||"",label:"Salary currency",hint:"ISO 4217 Currency code. Example: EUR"},{fieldType:"input",name:"salary-amount",type:"text",value:e.salary_amount||"",label:"Salary amount",hint:"Insert amount, e.g. 100.00, or a salary range, e.g. 120.00-160.00"},{fieldType:"select",name:"salary-payroll",value:e.salary_payroll,label:"Payroll",options:[{value:"None",label:""},{value:"Yearly",label:"YEAR"},{value:"Monthly",label:"MONTH"},{value:"Weekly",label:"WEEK"},{value:"Daily",label:"DAY"},{value:"Hourly",label:"HOUR"}]},{fieldType:"input",name:"date-posted",type:"date",value:e.date_posted,label:"Date posted",hint:"Choose date, post publication date will be used if this field is empty"},{fieldType:"input",name:"date-expires",type:"date",value:e.date_expires,label:"Expiry date",hint:"Leave empty if the job posting does not expire"},{fieldType:"select",name:"employment-type",value:e.employment_type,label:"Employment type",options:[{value:"FULL_TIME",label:"Full Time"},{value:"PART_TIME",label:"Part Time"},{value:"CONTRACTOR",label:"Contractor"},{value:"TEMPORARY",label:"Temporary"},{value:"INTERN",label:"Intern"},{value:"VOLUNTEER",label:"Volunteer"},{value:"PER_DIEM",label:"Per Diem"},{value:"OTHER",label:"Other"}]},{fieldType:"input",name:"posting-id",type:"text",value:e.posting_id||"",label:"Posting ID"},{fieldType:"sectionTitle",text:"Hiring organization"},{fieldType:"input",name:"company",type:"text",value:e.company||"",label:"Hiring organization"},{fieldType:"input",name:"org-url",type:"url",value:e.org_url||"",label:"Organization URL"},{fieldType:"input",name:"org-logo",type:"url",value:e.org_logo||"",label:"Organization logo URL"},{fieldType:"sectionTitle",text:"Job location"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"}];return t.buildSchemaForm(e)},personSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"email",type:"email",value:e.email||"",label:"E-mail"},{fieldType:"input",name:"gender",type:"text",value:e.gender||"",label:"Gender"},{fieldType:"input",name:"job-title",type:"text",value:e.job_title||"",label:"Job title"},{fieldType:"input",name:"url",type:"url",value:e.url||"",label:"URL"},{fieldType:"input",name:"image",type:"url",value:e.url||"",label:"Image URL"},{fieldType:"sectionTitle",text:"Address"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"}];return t.buildSchemaForm(e)},productSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Product name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Product description"},{fieldType:"input",name:"sku",type:"text",value:e.sku||"",label:"Product SKU"},{fieldType:"input",name:"identifier_name",type:"text",value:e.identifier_name||"",label:"Global identifier",hint:"GTIN, MPN, ISBN or other"},{fieldType:"input",name:"identifier_value",type:"text",value:e.identifier_value||"",label:"Global identifier value"},{fieldType:"input",name:"brand",type:"text",value:e.brand||"",label:"Brand name"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"price",type:"number",value:e.price,label:"Price",step:"0.01"},{fieldType:"input",name:"currency",type:"text",value:e.currency||"",label:"Currency"},{fieldType:"input",name:"deadline",type:"date",value:e.deadline,label:"Price valid until"},{fieldType:"select",name:"availability",value:e.availability,options:[{label:"In Stock",value:"InStock"},{label:"Sold Out",value:"SoldOut"},{label:"Preorder",value:"Preorder"}],label:"Availability"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"sectionTitle",text:"Review publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},recipeSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Recipe title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Recipe description"},{fieldType:"input",name:"prep-time",type:"text",value:e.prep_time||"",label:"Preparation time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"cook-time",type:"text",value:e.cook_time||"",label:"Cooking time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"total-time",type:"text",value:e.total_time||"",label:"Total time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"type",type:"text",value:e.type||"",label:"Type of dish",hint:"Example: appetizer or dessert"},{fieldType:"input",name:"cuisine",type:"text",value:e.cuisine||"",label:"Cuisine"},{fieldType:"input",name:"keywords",type:"text",value:e.keywords||"",label:"Keywords"},{fieldType:"input",name:"yield",type:"text",value:e.yield||"",label:"Recipe yield",hint:"Quantity of portions produced by the recipe, for example: 4"},{fieldType:"input",name:"calories",type:"number",value:e.calories,label:"Calories"},{fieldType:"textarea",name:"ingredients",value:e.ingredients?e.ingredients.join("; "):"",label:"Ingredients",hint:"Separate ingredients with semicolons (;)",splitLines:";"},{fieldType:"textarea",name:"instructions",value:e.instructions?e.instructions.join("; "):"",label:"Recipe instructions",hint:"Separate instructions with semicolons (;)",splitLines:";"},{fieldType:"sectionTitle",text:"Aggregate Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-count",type:"number",value:e.rating_count,label:"Rating count"},{fieldType:"sectionTitle",text:"Video"},{fieldType:"input",name:"video-title",type:"text",value:e.video_title||"",label:"Video title"},{fieldType:"textarea",name:"video-description",value:e.video_description||"",label:"Video description"},{fieldType:"input",name:"video-url",type:"url",value:e.video_url||"",label:"Video URL"},{fieldType:"input",name:"video-content-url",type:"url",value:e.video_content_url||"",label:"Video content URL",hint:"A URL pointing to the actual video media file"},{fieldType:"input",name:"video-thumbnail",type:"url",value:e.video_thumbnail||"",label:"Video thumbnail URL"},{fieldType:"input",name:"video-duration",type:"text",value:e.video_duration||"",label:"Video duration",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"video-uploaded",type:"date",value:e.video_uploaded,label:"Video upload date"}];return t.buildSchemaForm(e)},reviewSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Review title"},{fieldType:"sectionTitle",text:"Reviewed item"},{fieldType:"select",name:"reviewed-item",value:e.reviewed_item,label:"Reviewed item",options:[{value:"Book",label:"Book"},{value:"Course",label:"Course"},{value:"Event",label:"Event"},{value:"How-to",label:"How-to"},{value:"LocalBusiness",label:"Local Business"},{value:"Movie",label:"Movie"},{value:"Product",label:"Product"},{value:"Recipe",label:"Recipe"},{value:"SoftwareApp",label:"Software App"}]},{fieldType:"input",name:"reviewed-item-image",type:"url",value:e.reviewed_item_image||"",label:"Reviewed item image URL"},{fieldType:"input",name:"reviewed-item-name",type:"text",value:e.reviewed_item_name||"",label:"Reviewed item name"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",step:"0.01",value:e.rating,label:"Rating value"},{fieldType:"textarea",name:"review-body",value:e.review_body||"",label:"Review text"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},serviceSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"service-type",type:"text",value:e.service_type||"",label:"Service type"},{fieldType:"input",name:"service-name",type:"text",value:e.service_name||"",label:"Name"},{fieldType:"textarea",name:"service-description",value:e.service_description||"",label:"Service description"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Currency"}];return t.buildSchemaForm(e)},videoSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"embed-url",type:"url",value:e.embed_url||"",label:"Embed URL",hint:"A URL pointing to the embeddable player for the video. Example: https://www.youtube.com/embed/VIDEOID"},{fieldType:"input",name:"content-url",type:"url",value:e.content_url||"",label:"Content URL",hint:"A URL pointing to the actual video media file like MP4, MOV, etc. Please leave it empty if you don't know the URL"},{fieldType:"input",name:"duration",type:"text",value:e.duration||"",label:"Duration",hint:"ISO 8601 duration format. Example: PT1H30M"}];return t.buildSchemaForm(e)},webPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)};function initSerpSimulator(){"use strict";const r=document.body.classList.contains("block-editor-page"),o=document.querySelector(".diagnoseo-preview");if(!o)return;const l=o.querySelector(".search-result .search-result-title"),a=o.querySelector(".search-result.mobile .search-result-title"),i=o.querySelector(".search-result .search-result-descr"),n=o.querySelector(".search-result.mobile .search-result-descr"),e=document.querySelector(".diagnoseo-meta-form")||document.querySelector(".diagnoseo-settings-form"),u=e.querySelector("#seo-title")||e.querySelector("#diagnoseo_home_title"),s=e.querySelector(".info-title-chars"),p=e.querySelector(".info-title-width"),c=e.querySelector(".seo-title-progress .diagnoseo-progress-fill"),d=e.querySelector("#seo-description")||e.querySelector("#diagnoseo_home_description"),m=e.querySelector(".info-descr-chars"),v=e.querySelector(".info-descr-width"),y=e.querySelector(".seo-descr-progress .diagnoseo-progress-fill"),b=e.querySelector("#seo-slug"),f=e.querySelector(".info-slug-chars"),g=e.querySelector(".seo-slug-progress .diagnoseo-progress-fill"),h=o.querySelector(".title-sample"),T=o.querySelector(".description-sample"),t=function(){for(var e=!1;function(){var e=l.offsetWidth-20;l.style.maxWidth="none",l.style.position="absolute";var t=l.offsetWidth;return l.removeAttribute("style"),e<t}();){var t=S(l.textContent);if(!t)break;t=(t=(t=t.replace(/\/$/," ...")).split(" ").slice(0,-1).join(" ")).replace(/,\s*$/,""),e=!0,l.textContent=t,a.textContent=t}e&&(l.textContent=l.textContent+" ...",a.textContent=a.textContent+" ...")},x=function(e,t,a=0){const l=e.split(" "),i=T;if(!i)return e;e=function(e,t){for(var a,l="",i=e.split(" "),n=0;n<i.length;n++)if(a=l,(l+=" "+i[n]).length>t){l=a+" ...";break}return l=l.replace(/,\s*$/,"")}(e,a),i.textContent=e;for(var n=!1;i.clientWidth>t;){l.pop();var n=!0,r=l.join(" ");i.textContent=r}return n?l.join(" ")+" ...":e},w=function(e){var t=S(e),e=x(t,960,158);i.textContent=e;e=x(t,680,158);n.textContent=e,T.textContent=t},S=function(e){if(!e)return"";var{site:t,siteTagline:a,separator:l,excerpt:i,postTitle:n}=o.dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",r?window.wp.data.select("core/editor").getEditedPostAttribute("title"):n)).replaceAll("%sitename%",t)).replaceAll("%tagline%",a)).replaceAll("%sep%",l)).replaceAll(" %page%","")).replaceAll("%excerpt%",i||_())).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))},E=function(e){e=S(e),h.textContent=e||l.dataset.fallback,l.textContent=e||l.dataset.fallback,a.textContent=e||l.dataset.fallback,t()},_=function(){if(!window.wp||!window.wp.data)return"";let a=r?window.wp.data.select("core/editor").getEditedPostAttribute("excerpt"):o.dataset.excerpt;if(!a){let e=r?window.wp.data.select("core/editor").getEditedPostContent():"";e=seoHelper.stripTags(e).trim();let t=e.split(" ");var l=Math.min(t.length,55);t=t.splice(0,l),a=t.join(" ")}return a},P=function(){var e,t,a,l;c&&(e=h.clientWidth,l=h.textContent,100<(a=e/600*100)&&(a=100),(t=(l=S(l)).length)||(a=0),a+="%",l="",30<=t&&e<=600&&(30<=t&&t<35||60<t&&e<=600?l="medium":35<=t&&t<=60&&(l="full")),s.textContent=t,p.textContent=e,c.style.width=a,l?c.classList.contains(l)||(c.classList.remove("medium","full"),c.classList.add(l)):c.classList.remove("medium","full"))},A=function(){var e,t,a,l;y&&(l=T.textContent,e=T.clientWidth,t=l.length,100<(a=e/990*100)&&(a=100),d.value.length||d.getAttribute("placeholder")||(a=0),a+="%",l="",70<=t&&e<=990&&(70<=t&&t<130||158<t&&e<=990?l="medium":130<=t&&t<=158&&(l="full")),m.textContent=t,v.textContent=e,y.style.width=a,l?y.classList.contains(l)||(y.classList.remove("medium","full"),y.classList.add(l)):y.classList.remove("medium","full"))},L=function(){var e,t,a;g&&(t="",(a=(e=(e=b.value).replaceAll(" ","-")).split("-")).length<=5&&e.length?e.length<=50?t="full":50<e.length&&e.length<=60&&(t="medium"):5<a.length&&e.length<60&&(t="medium"),100<(a=Math.round(e.length/60*100))&&(a=100),g.style.width=a+"%",f.textContent=e.length,t?g.classList.contains(t)||(g.classList.remove("medium","full"),g.classList.add(t)):g.classList.remove("medium","full"))};u&&(u.addEventListener("input",function(e){E(e.target.value),h.textContent=S(e.target.value),r&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_title:e.target.value}}),P()}),E(u.value||u.getAttribute("placeholder")),P());const k=l.dataset.fallback;r?window.wp.data.subscribe(()=>{var e=window.wp.data.select("core/editor").getEditedPostAttribute("title")||o.dataset.postTitle;l.dataset.fallback=e||k;var t=u.value||u.getAttribute("placeholder");E(t),P();const a=document.querySelector("#postlist-title");!(window.wp.data.select("core/editor").getEditedPostAttribute("meta")?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:e)&&a&&a.setAttribute("placeholder",e)}):u&&u.addEventListener("input",e=>{var t=r?window.wp.data.select("core/editor").getEditedPostAttribute("title"):o.dataset.postTitle;l.dataset.fallback=t||k;e=e.target.value||e.target.value.getAttribute("placeholder");E(e),P();const a=document.querySelector("#postlist-title");!(r?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:t)&&a&&a.setAttribute("placeholder",t)}),d&&(d.addEventListener("input",function(e){w(e.target.value||e.target.getAttribute("placeholder")),r&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_description:e.target.value}}),A()}),w(d.value||d.getAttribute("placeholder")),A()),b&&b.addEventListener("input",e=>{r&&window.wp.data.dispatch("core/editor").editPost({slug:seoHelper.slugify(e.target.value)}),L()});const C=document.querySelectorAll(".diagnoseo-var-input");C&&C.forEach(e=>{const l=e.querySelector(".var-input"),i=e.querySelector(".var-select"),t=e.querySelector(".var-button");t.addEventListener("click",e=>{e.preventDefault();var t,a=i.value;a&&(l.selectionStart||"0"==l.selectionStart?(t=l.selectionStart,e=l.selectionEnd,l.value=l.value.substring(0,t)+" "+a+l.value.substring(e,l.value.length)):l.value+=a,l.dispatchEvent(new Event("input")))})}),setTimeout(function(){t(),P(),A(),L()},500)}window._wpLoadBlockEditor?window._wpLoadBlockEditor.then(function(){setTimeout(initSerpSimulator,500)}):window.addEventListener("load",initSerpSimulator);const startSocialPreview=function(){if(window.wp.data){const{select,dispatch,subscribe}=window.wp.data}const e=document.querySelectorAll(".diagnoseo-social-meta"),t=document.body.classList.contains("block-editor-page");if(e){const m=document.querySelector("#facebook-title"),v=document.querySelector("#twitter-title"),y=document.querySelector("#facebook-description"),b=document.querySelector("#twitter-description"),f=document.querySelector("#seo-title"),g=document.querySelector("#seo-description");if(f&&f.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");m.setAttribute("placeholder",e),v.setAttribute("placeholder",e)}),g&&g.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");y.setAttribute("placeholder",e),b.setAttribute("placeholder",e)}),e.forEach(e=>{e.addEventListener("input",e=>{t&&function(e,t){const a={};a[e]=t,dispatch("core/editor").editPost({meta:a})}(e.target.dataset.customField,e.target.value)})}),t)subscribe(()=>{const e=select("core/editor");var t=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_title||m.value||f.value||m.getAttribute("placeholder"),a=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_description||y.value||g.value||g.getAttribute("placeholder"),l=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_title||v.value||f.value||v.getAttribute("placeholder"),i=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_description||b.value||g.value||g.getAttribute("placeholder"),n=e.getEditedPostAttribute("featured_media");const r=document.querySelectorAll(".diagnoseo-social-preview"),o=document.querySelector(".preview-facebook"),u=document.querySelector(".preview-twitter");if(r){const s=o?o.querySelector(".facebook-post-title"):null;s&&(s.textContent=seoHelper.replaceVariables(t));const p=o?o.querySelector(".facebook-post-description"):null;p&&(p.textContent=seoHelper.replaceVariables(a));const c=u?u.querySelector(".twitter-post-title"):null;c&&(c.textContent=seoHelper.replaceVariables(l));const d=u?u.querySelector(".twitter-post-description"):null;d&&(d.textContent=seoHelper.replaceVariables(i)),r.forEach(e=>{var t=n?select("core").getMedia(n):null,t=t?t.guid.raw:e.dataset.placeholderImage;const a=e.querySelector(".preview-image img");a.setAttribute("src",t)})}});else{const a=document.querySelector(".preview-facebook"),l=document.querySelector(".preview-twitter");if(a&&l){const i=a.querySelector(".facebook-post-title"),n=a.querySelector(".facebook-post-description"),r=l.querySelector(".twitter-post-title"),o=l.querySelector(".twitter-post-description");i.textContent=seoHelper.replaceVariables(a.dataset.facebookTitle),n.textContent=seoHelper.replaceVariables(a.dataset.facebookDescription),r.textContent=seoHelper.replaceVariables(l.dataset.twitterTitle),o.textContent=seoHelper.replaceVariables(l.dataset.twitterDescription),m.addEventListener("input",e=>{e=e.target.value;i&&(i.textContent=seoHelper.replaceVariables(e))}),y.addEventListener("input",e=>{e=e.target.value;n&&(n.textContent=seoHelper.replaceVariables(e))}),v.addEventListener("input",e=>{e=e.target.value;r&&(r.textContent=seoHelper.replaceVariables(e))}),b.addEventListener("input",e=>{e=e.target.value;o&&(o.textContent=seoHelper.replaceVariables(e))})}}}};window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(startSocialPreview,500)}),document.body.classList.contains("block-editor-page")||window.addEventListener("load",startSocialPreview),jQuery(document).on("ready",function(){jQuery(".toggle").each(function(){const t=jQuery(this).find(".toggle-trigger"),a=jQuery(this).find(".toggle-content");t.on("click",function(e){e.preventDefault(),a.slideToggle(),t.toggleClass("open")})})}); -
diagnoseo/trunk/js/diagnoseo-editor.min.js
r2990586 r2992578 1 const{__}=window.wp.i18n;window.diagnoseo={additionalKeywordLimit:10,additionalKeywordCount:0,RelatedKeywordsInPost:0,checks:[{id:"title-not-too-long",type:"check",label:__("Title not too long"),section:"content",test:e=>{var{metaTitle:t,postTitle:e}=e;if(!t&&!e)return"nok";t=t||e;const a=document.querySelector(".title-sample");a.textContent=t;e=a.clientWidth,t=t.length;return e<=600?60<t?"nok medium-nok":t<=60?"ok":"nok":"nok"}},{id:"title-not-too-short",type:"check",label:__("Title not too short"),section:"content",test:e=>{var{metaTitle:t,postTitle:e}=e;if(!t&&!e)return"nok";e=(t||e).length;return 30<=e?30<=e&&e<35?"nok medium-nok":35<=e?"ok":"nok":"nok"}},{id:"description-not-too-long",type:"check",label:__("Description not too long"),section:"content",test:e=>{var{metaDescription:t}=e;if(!t)return"nok";e=document.querySelector(".description-sample"),t=t.length;if(e.clientWidth<=990){if(155<t)return"nok medium-nok";if(t<=155)return"ok"}return"nok"}},{id:"description-not-too-short",type:"check",label:__("Description not too short"),section:"content",test:e=>{var{metaDescription:e}=e;if(!e)return"nok";e=e.length;if(70<=e){if(e<130)return"nok medium-nok";if(130<=e)return"ok"}return"nok"}},{id:"too-long-sentences",type:"check",label:__("No sentences with more than 20 words"),section:"content",test:e=>{var{postContent:e}=e;e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("</p>",".</p>")).replaceAll("</h1>",".</h1>")).replaceAll("</h2>",".</h2>")).replaceAll("</h3>",".</h3>")).replaceAll("</h4>",".</h4>")).replaceAll("</h5>",".</h5>")).replaceAll("</h6>",".</h6>")).replaceAll("</li>",".</li>");const t=(e=seoHelper.stripTags(e)).split(/\.|\?|!/);var a=!1;return t.length&&t.forEach(e=>{a=a||20<seoHelper.countWords(e)}),a?"nok":"ok"}},{id:"too-many-words",type:"check",label:__("No paragraphs with more than 100 words"),section:"content",test:e=>{const t=seoHelper.createMarkupEl(e.postContent),a=t.querySelectorAll("p");var l=!1;return a.length&&a.forEach(e=>{100<seoHelper.countWords(e.textContent)&&(l=!0)}),l?"nok":"ok"}},{id:"too-many-sentences",type:"check",label:__("No paragraphs with more than 5 sentences"),section:"content",test:e=>{const t=seoHelper.createMarkupEl(e.postContent),a=t.querySelectorAll("p");var l=!1;return a.length&&a.forEach(e=>{5<e.textContent.split(/\.|\?|!/).filter(e=>!!e.trim()).length&&(l=!0)}),l?"nok":"ok"}},{id:"internal-links-present",type:"check",label:__("Contains internal links"),section:"content",test:e=>{const t=seoHelper.createMarkupEl(e.postContent),a=t.querySelectorAll("a");var l=!1;return a.forEach(e=>{e=e.getAttribute("href")||"";e&&(e.includes("http://"+window.location.hostname)||e.includes("https://"+window.location.hostname)||"/"===e.substr(0,1)||"./"===e.substr(0,2))&&(l=!0)}),l?"ok":"nok"}},{id:"strong-present",type:"check",label:__("Contains bold text (strong tag)"),section:"content",test:e=>seoHelper.countElements(e.postContent,"strong")?"ok":"nok"},{id:"readability",type:"stats",label:__("Readability score"),order:"label value comment",section:"content",test:e=>{var{postContent:t}=e,a=(t=seoHelper.stripTags(t)).split(/\.|\?|!/);a=(a=a.map(e=>e.trim())).filter(e=>e&&" "!==e&&"\n"!==e);e=(t=t.replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g," ")).split(" ");e=(e=e.map(e=>e.trim())).filter(e=>e&&""!==e&&"\n"!==e);var t=seoHelper.countSyllables(t),l=206.835-e.length/a.length*1.015-t/e.length*84.6;(l=l.toFixed(2))<0?l=0:100<l&&(l=100);var n="",i="";switch(!0){case isNaN(l):l=__("N/A"),n="",i="nok";break;case 90<l:n=__("Very easy to read","diagnoseo"),i="ok";break;case 80<l&&l<=90:n=__("Easy to read","diagnoseo"),i="ok";break;case 70<l&&l<=80:n=__("Fairly easy to read","diagnoseo"),i="ok";break;case 60<l&&l<=70:n=__("Average reading ease","diagnoseo"),i="nok medium-nok";break;case 50<l&&l<=60:n=__("Fairly difficult to read","diagnoseo"),i="nok";break;case 30<l&&l<=50:n=__("Difficult to read","diagnoseo"),i="nok";break;case 10<l&&l<=30:n=__("Very difficult to read","diagnoseo"),i="nok";break;case l<=10:n=__("Extremely difficult to read","diagnoseo"),i="nok"}return{value:l,comment:n=n&&` (${n})`,status:i}}},{id:"est-reading-time",type:"stats",label:__("Estimated reading time"),section:"content",order:"label value",test:e=>{var{postContent:t}=e,e=seoHelper.countWords(t),t=Math.floor(e/225),e=Math.floor(e%225/3.75);return{value:`${t} ${__("min")} ${e} ${__("s")}`}}},{id:"minimal-word-count",type:"check",label:__("Minimal word count"),section:"content",postTypes:["post","page"],inPro:!0},{id:"words",type:"stats",label:__("words"),section:"content",test:e=>{var{postContent:e}=e;return{value:seoHelper.countWords(e)}}},{id:"chars",type:"stats",label:__("characters"),section:"content",test:e=>({value:e.postContent.length||0})},{id:"sentences",type:"stats",label:__("sentences"),section:"content",test:e=>{var{postContent:e}=e,e=(e=e.replace(/(\r\n|\n|\r)/gm," ")).split(/\.|\?|!/);return{value:(e=(e=e.map(e=>e.trim())).filter(e=>e&&" "!==e&&"\n"!==e)).length||0}}},{id:"paragraphs",type:"stats",label:__("paragraphs"),section:"content",test:e=>({value:seoHelper.countElements(e.postContent,"p")})},{id:"headings",type:"stats",label:__("Headings"),inPro:!0,section:"content"},{id:"optimal-heading-number",type:"check",label:__("Optimal number of headings"),inPro:!0,section:"content"},{id:"images",type:"stats",label:__("Images"),inPro:!0,section:"content"},{id:"optimal-image-number",type:"check",label:__("Optimal number of images"),inPro:!0,section:"content"},{id:"too-long-headings",type:"check",label:__("No too long headings"),inPro:!0,section:"content"},{id:"toc-block",type:"check",label:__("Use Table of Contents block"),inPro:!0,section:"content"},{id:"keyword-exists",type:"check",label:__("Keyword is provided"),section:"keyword",test:e=>e.keyword?"ok":"nok"},{id:"keyword-unique",type:"check",label:__("Focus Keyword not used before"),section:"keyword",test:async a=>{var l=document.querySelector(".keyword-unique");if(a.keyword){let e=new URLSearchParams(window.location.search);var n=Object.fromEntries(e.entries()),n=`${diagnoseoRestUrl}diagnoseo/v1/check-posts-keyword/${a.keyword}/${n.post||0}`;let t=0===await(await fetch(n)).json()?"ok":"nok";l?l&&(l.classList.remove("ok","nok"),l.classList.add(t)):setTimeout(()=>{(l=document.querySelector(".keyword-unique"))&&(l.classList.remove("ok","nok"),l.classList.add(t))},200)}else l&&l.classList.add("ok")}},{id:"keyword-in-title",type:"check",label:__("Keyword present in title tag"),section:"keyword",test:e=>{var{keyword:t,postTitle:a,metaTitle:e}=e,a=e||a;return seoHelper.isKeywordInText(t,a)?"ok":"nok"}},{id:"keyword-in-title-beginning",type:"check",label:__("Keyword in the beginning of the title tag"),section:"keyword",test:e=>{var{keyword:t,postTitle:a,metaTitle:e}=e;if(!t)return"nok";a=(a=e||a).toLowerCase(),t=t.toLowerCase();const l=new RegExp("^"+t);return l.test(a)?"ok":"nok"}},{id:"keyword-in-descr",type:"check",label:__("Keyword present in meta description tag"),section:"keyword",test:e=>{var{keyword:t,metaDescription:e}=e;return seoHelper.isKeywordInText(t,e)?"ok":"nok"}},{id:"keyword-in-slug",type:"check",label:__("Keyword present in URL slug"),section:"keyword",test:e=>{var{keyword:t,slug:a,postTitle:e}=e;return t&&(a=a||seoHelper.slugify(e)).includes(seoHelper.slugify(t))?"ok":"nok"}},{id:"slug-length-ok",type:"check",label:__("URL slug length"),section:"keyword",test:e=>{var{slug:t,postTitle:e}=e;if(!t&&!e)return"nok";if((t=t||seoHelper.slugify(e)).length<=60&&t.split("-").length<=5)return"ok";return"nok"}},{id:"keyword-in-h1",type:"check",label:__("Keyword present in H1 element"),section:"keyword",test:e=>{var{keyword:t,postContent:a,postTitle:e}=e;return seoHelper.isKeywordInText(t,e)||seoHelper.isKeywordInAnyElement(t,a,"h1")?"ok":"nok"}},{id:"keyword-in-image-alt",type:"check",label:__("Keyword present in any image alt attribute"),section:"keyword",test:e=>{var{keyword:t,postContent:a,featuredImage:e}=e;return seoHelper.isKeywordInAnyAlt(t,a,e)?"ok":"nok"}},{id:"keyword-in-image-filename",type:"check",label:__("Keyword in image file name"),section:"keyword",inPro:!0,hidden:!0},{id:"keyword-not-in-ext-link",type:"check",label:__("Keyword NOT present in external link text"),section:"keyword",test:e=>{const{keyword:a,postContent:t}=e;if(!a)return"ok";const l=seoHelper.createMarkupEl(t);var n=!1;const i=l.querySelectorAll("a");return i.forEach(e=>{const t=e.getAttribute("href")||"";t.includes("http://"+window.location.hostname)||t.includes("https://"+window.location.hostname)||"/"===t.substr(0,1)||"./"===t.substr(0,2)||!seoHelper.isKeywordInText(a,e.textContent)||(n=!0)}),n?"nok":"ok"}},{id:"keyword-in-first-words",type:"check",label:__("Keyword present within first 100 words"),section:"keyword",test:e=>{var{keyword:t,postContent:e}=e;if(!t)return"nok";var t=t.trim(),a=(e=seoHelper.stripTags(e)).toLowerCase().split(/\s|\n/),l=100<=(a=a.filter(e=>e)).length?100:a.length;if(a=a.splice(0,l),!seoHelper.isKeywordInText(t,a.join(" ")))return"nok";if(1<t.split(" ").length)return"ok";if(a.length)for(let e=0;e<l;e++)a[e]=a[e].replace(".",""),a[e]=a[e].replace(",",""),a[e]=a[e].replace("?",""),a[e]=a[e].replace("!",""),a[e]=a[e].replace(":",""),a[e]=a[e].replace(";","");return a.includes(t)?"ok":"nok"}},{id:"more",type:"check",label:__("Many more powerful SEO checkpoints"),inPro:!0,section:"content"},{id:"more",type:"check",label:__("Many more powerful SEO checkpoints"),inPro:!0,section:"keyword"}],checkResults:{}},function(){"use strict";function l(){return(0,c.createElement)("svg",{"enable-background":"new 0 0 20 20",height:"20",width:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",className:"diagnoseo-icon"},(0,c.createElement)("clipPath",{id:"a"},(0,c.createElement)("path",{d:"m0 0h20v20h-20z"})),(0,c.createElement)("path",{className:"diagnoseo-icon-part-tick",d:"m12.377 5.866 1.835 1.612-4.839 5.508-4.11-3.576 1.672-1.902 2.256 1.982z"}),(0,c.createElement)("path",{className:"diagnoseo-icon-part-magnifier","clip-path":"url(#a)",d:"m16.298 15.209c1.745-1.983 2.548-4.603 2.208-7.228-.315-2.426-1.555-4.584-3.493-6.077s-4.341-2.139-6.768-1.828c-2.426.315-4.584 1.555-6.077 3.493s-2.142 4.341-1.827 6.767c.649 5.007 5.251 8.554 10.259 7.905 1.441-.188 2.824-.717 4.014-1.536l3.749 3.295 1.476-1.68zm-1.471-1.887c-1.111 1.443-2.72 2.368-4.527 2.602-1.808.235-3.598-.247-5.041-1.361-1.444-1.111-2.368-2.719-2.602-4.527-.483-3.73 2.158-7.158 5.889-7.642.296-.038.59-.057.881-.057 3.375 0 6.316 2.511 6.761 5.946.235 1.806-.249 3.596-1.361 5.039"}))}var c=window.wp.element,e=window.wp.plugins,i=window.wp.data;class t extends React.Component{constructor(e){super(e),this.state={score:0,timeout:null},this.handleCheckChanged=this.handleCheckChanged.bind(this),this.calculateScore=this.calculateScore.bind(this),this.runAllChecks=this.runAllChecks.bind(this)}calculateScore(){const e=window.diagnoseo.checks.filter(e=>"check"===e.type);var t=e.length+1,a=e.filter(e=>e.checked),a=window.diagnoseo.additionalKeywordCount===window.diagnoseo.RelatedKeywordsInPost?a.length+1:a.length,t=Math.round(100*a/t);this.setState({score:t})}runAllChecks(){const e=window.diagnoseo.checks.filter(e=>"check"===e.type),n={postTitle:(0,i.select)("core/editor").getEditedPostAttribute("title"),postContent:(0,i.select)("core/editor").getEditedPostContent(),keyword:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_keyword,featuredImageId:(0,i.select)("core/editor").getEditedPostAttribute("featured_media"),featuredImage:(0,i.select)("core").getMedia((0,i.select)("core/editor").getEditedPostAttribute("featured_media")),metaTitle:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_title,metaDescription:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_description,slug:(0,i.select)("core/editor").getEditedPostAttribute("slug"),blocks:(0,i.select)("core/block-editor").getBlocks(),optimalKeywordDensity:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_keyword_density,optimalWordNumber:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_word_number,optimalHeadingNumber:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_heading_number,optimalImageNumber:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_image_number};var t;!n.featuredImageId||n.featuredImage?(n.metaTitle=seoHelper.replaceVariables(n.metaTitle)||(document.querySelector("#seo-title")?seoHelper.replaceVariables(document.querySelector("#seo-title").getAttribute("placeholder")):""),n.metaDescription=seoHelper.replaceVariables(n.metaDescription)||(document.querySelector("#seo-description")?seoHelper.replaceVariables(document.querySelector("#seo-description").value):""),e.forEach((t,e)=>{var a,l;t.test&&(a="ok"===t.test(n),l=window.diagnoseo.checks.findIndex(e=>e.id===t.id),window.diagnoseo.checks[l].checked=a)}),this.calculateScore()):t=setInterval(()=>{(0,i.select)("core").getMedia(n.featuredImageId)&&(clearInterval(t),this.runAllChecks())},500)}handleCheckChanged(){clearTimeout(this.state.timeout),this.setState({timeout:setTimeout(this.calculateScore,300)})}async componentDidMount(){window.addEventListener("check-changed",this.handleCheckChanged),setTimeout(this.runAllChecks,1e3)}componentWillUnmount(){window.removeEventListener("check-changed",this.handleCheckChanged)}render(){let e,t=this.state.score;switch(!0){case t<60:e="score-low";break;case 60<=t&&t<80:e="score-medium";break;case 80<=t:e="score-high"}var a=`diagnoseo-button-content ${e}`;return(0,c.createElement)("span",{className:a},(0,c.createElement)(l,null),(0,c.createElement)("b",{className:"diagnoseo-score"},this.state.score,"/100"))}whenEditorIsReady(){return new Promise(e=>{const t=(0,i.subscribe)(()=>{((0,i.select)("core/editor").isCleanNewPost()||0<(0,i.select)("core/block-editor").getBlockCount())&&(t(),e())})})}}var a=t,n=window.wp.editPost,u=window.wp.components,p=window.wp.i18n,o=window.wp.compose,r=(0,o.compose)((0,i.withDispatch)((a,l)=>({setMetaValue:e=>{var t={};t[l.fieldName]=e,a("core/editor").editPost({meta:t}),l.changeCallback&&l.changeCallback(e)}})),(0,i.withSelect)((e,t)=>({metaValue:e("core/editor").getEditedPostAttribute("meta")[t.fieldName]})))(t=>(0,c.createElement)(u.TextControl,{label:t.label,value:t.metaValue,onChange:e=>t.setMetaValue(e)})),s=(0,o.compose)((0,i.withSelect)(e=>({content:e("core/editor").getEditedPostContent(),keyword:e("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_keyword,optimalKeywordDensity:e("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_keyword_density})))(e=>{var t,a,l=0;e.keyword&&(a=(a=(t=(t=(t=e.content.replace(/<\!--.*?-->/g,"")).replace(/(\r\n|\n|\r)/gm," ")).toLowerCase()).split(" ")).filter(e=>""!==e),(t=seoHelper.countOccurences(e.keyword,t))&&(l=(l=t/a.length*100).toFixed(2)));let n;return n=window.diagnoseoPro?(a="diagnoseo-check optimal-keyword-density",parseFloat(e.optimalKeywordDensity),parseFloat(e.optimalKeywordDensity),(0,c.createElement)("p",{className:a+=1<=l&&l<=3?" ok":" nok"},(0,p.__)("Optimal keyword density","diagnoseo")," ",(0,c.createElement)("b",{className:"value"},"1% - 3%"))):(0,c.createElement)("p",{className:"diagnoseo-check optimal-keyword-density"},(0,c.createElement)("i",{className:"dashicons dashicons-lock"})," ",(0,p.__)("Optimal keyword density","diagnoseo")),(0,c.createElement)(c.Fragment,null,(0,c.createElement)("p",{className:"diagnoseo-stats keyword-density"},(0,p.__)("Keyword density","diagnoseo")," ",(0,c.createElement)("b",{className:"value"},l,"%")),n)}),d=t=>{let e=["diagnoseo-check",t.id];var a;if(t.test&&("string"==typeof(a=t.test(t.postData))&&e.push(a),l="ok"===a,a=t.checkConfig.findIndex(e=>e.id===t.id),t.checkConfig[a].checked!==l&&window.dispatchEvent(new Event("check-changed")),t.checkConfig[a].checked=l),t.inPro)return(0,c.createElement)("p",{className:e.join(" ")},(0,c.createElement)("i",{className:"dashicons dashicons-lock"})," ",t.label," ",(0,c.createElement)("b",null,(0,c.createElement)("a",{href:"https://diagnoseo.com/wordpress-seo-plugin/?utm_source=wp&utm_medium=link&utm_campaign=available_in_pro",target:"_blank",rel:"noreferrer noopener"},(0,p.__)("Available in Pro","diagnoseo"))));var l=t.valueFieldName&&t.postData[t.valueFieldName]?(0,c.createElement)("b",null,t.postData[t.valueFieldName]):"";return(0,c.createElement)("p",{className:e.join(" ")},t.label," ",l)},m=e=>{let t=["diagnoseo-stats",e.id];if(e.inPro)return(0,c.createElement)("p",{className:t.join(" ")},(0,c.createElement)("i",{className:"dashicons dashicons-lock"})," ",e.label," ",(0,c.createElement)("b",null,(0,c.createElement)("a",{href:"https://diagnoseo.com/wordpress-seo-plugin/?utm_source=wp&utm_medium=link&utm_campaign=available_in_pro",target:"_blank",rel:"noreferrer noopener"},(0,p.__)("Available in Pro","diagnoseo"))));let a,l=(0,c.createElement)("b",{className:"value"}),n="";var i;return e.test&&(i=e.test(e.postData),l=(0,c.createElement)("b",{className:"value"},i.value),n=i.comment?(0,c.createElement)("span",{className:"comment"},i.comment):"",i.status&&t.push(i.status)),a=e.order&&"value label"!==e.order?(0,c.createElement)(c.Fragment,null,e.label," ",l," ",n):(0,c.createElement)(c.Fragment,null,l," ",e.label),(0,c.createElement)("p",{className:t.join(" ")},a)},y=(0,o.compose)((0,i.withSelect)(e=>({postTitle:e("core/editor").getEditedPostAttribute("title"),postContent:e("core/editor").getEditedPostContent(),featuredImage:e("core").getMedia(e("core/editor").getEditedPostAttribute("featured_media")),keyword:e("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_keyword,metaTitle:e("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_title,metaDescription:e("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_description,urlSlug:e("core/editor").getEditedPostAttribute("slug"),blocks:e("core/block-editor").getBlocks(),optimalKeywordDensity:2,optimalWordNumber:300,optimalHeadingNumber:1,optimalImageNumber:e("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_image_number,postType:e("core/editor").getCurrentPostType()})))(a=>{const l=window.diagnoseo.checks,e=l.filter(e=>e.section===a.sectionName),n={postTitle:a.postTitle,postContent:a.postContent,keyword:a.keyword,metaTitle:seoHelper.replaceVariables(a.metaTitle)||(document.querySelector("#seo-title")?seoHelper.replaceVariables(document.querySelector("#seo-title").getAttribute("placeholder")):""),metaDescription:seoHelper.replaceVariables(a.metaDescription)||(document.querySelector("#seo-description")?seoHelper.replaceVariables(document.querySelector("#seo-description").value):""),slug:a.urlSlug,blocks:a.blocks,featuredImage:a.featuredImage,optimalKeywordDensity:a.optimalKeywordDensity,optimalWordNumber:a.optimalWordNumber,optimalHeadingNumber:a.optimalHeadingNumber,optimalImageNumber:a.optimalImageNumber},t=e.map(e=>{let t=!0;if(e.postTypes&&(t=e.postTypes.includes(a.postType)),!e.hidden&&t)switch(e.type){case"check":return e.inPro?(0,c.createElement)(d,{id:e.id,label:e.label,inPro:e.inPro}):(0,c.createElement)(d,{id:e.id,label:e.label,test:e.test,postData:n,checkConfig:l,valueFieldName:e.valueFieldName});case"stats":return e.inPro?(0,c.createElement)(m,{id:e.id,label:e.label,inPro:e.inPro}):(0,c.createElement)(m,{id:e.id,label:e.label,test:e.test,order:e.order,postData:n})}});return(0,c.createElement)(c.Fragment,null,t.map((e,t)=>(0,c.createElement)(React.Fragment,{key:t},e)))});class g extends React.Component{constructor(e){super(e),this.state={keyword:"",keywordList:[],keywordLimit:(window.diagnoseoPro||window.diagnoseo).additionalKeywordLimit,apiKey:"",language:diagnoseo_settings?diagnoseo_settings.locale.substr(0,2):"",loading:!1},this.handleChange=this.handleChange.bind(this),this.handleLangChange=this.handleLangChange.bind(this),this.handleLoadButtonClick=this.handleLoadButtonClick.bind(this),this.relatedKeywordsApiUrl="diagnoseo/v1/related-keywords"}stripKeywordData(e){return(e=-1===e.indexOf("|")?e:e.substr(0,e.indexOf(" |"))).trim()}async loadRelatedKeywords(){var t=(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_keyword,a=(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_language;if(t)if(this.state.language){this.setState({loading:!0});let e=await this.getRelatedKeywords(t,a);if(e=e.split(","),e.length){let a=this.state.keywordList;e.forEach(t=>{t={name:t.trim()};var e=a.findIndex(e=>e.name===t);-1===e?a.push(t):(a[e].repeat_min=t.repeat_min,a[e].repeat_max=t.repeat_max)}),this.saveKeywords(a)}this.setState({loading:!1})}else alert((0,p.__)("Please select language.","diagnoseo"));else alert((0,p.__)('Please enter the "focus keyword" first',"diagnoseo"))}saveKeywords(e){const t=[...new Set(e)];t.splice(this.state.keywordLimit),this.setState({keywordList:t}),(window.onbeforeunload=null,i.dispatch)("core/editor").editPost({meta:{diagnoseo_meta_additional_keywords:JSON.stringify(t)}})}saveLanguage(e){(0,i.dispatch)("core/editor").editPost({meta:{diagnoseo_meta_language:e}})}componentDidMount(){let e=(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_additional_keywords,t=(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_language;try{e=JSON.parse(e)}catch{e=""}this.setState({language:t,keyword:this.props.focusKeyword,keywordList:e||[]})}async handleLoadButtonClick(){window.diagnoseoPro?this.loadRelatedKeywords():alert((0,p.__)("Related keywords and Pro data require DiagnoSEO Pro.","diagnoseo"))}handleChange(e){const l=this.state.keywordList,{stripKeywordData:n}=this;e=e.map(e=>{let t=n(e.value||e),a=l.findIndex(e=>t===e.name);return{name:t,repeat_min:-1!==a?l[a].repeat_min:0,repeat_max:-1!==a?l[a].repeat_max:0}});this.saveKeywords(e)}handleLangChange(e){this.setState({language:e}),this.saveLanguage(e)}render(){let{postTitle:i,postContent:o,featuredMedia:r}=this.props;const{countOccurences:s}=seoHelper;let d=0,e=this.state.keywordList.map(e=>{let t=e.name||"",a="error",l=function(e){o=seoHelper.stripTags(o);var t=0;return t+=s(e,i),t+=s(e,o),t+=seoHelper.isKeywordInAnyAlt(e,o),t+=r?s(e,r.alt_text):0}(t);l&&(a=!e.repeat_min||!e.repeat_max||l>=e.repeat_min&&l<=e.repeat_max?"success":"validating",d++);let n=` | ${l}`;return e.repeat_min&&e.repeat_max&&(n+=` (${e.repeat_min} - ${e.repeat_max})`),{value:t+n,status:a}}),t=!1;window.diagnoseo.RelatedKeywordsInPost!==d&&(window.diagnoseo.RelatedKeywordsInPost=d,t=!0),window.diagnoseo.additionalKeywordCount!==e.length&&(window.diagnoseo.additionalKeywordCount=e.length,t=!0),t&&window.dispatchEvent(new Event("check-changed"));var a=this.state.loading?(0,p.__)("Please wait... Loading related keywords. It can take up to a few minutes.","diagnoseo"):(0,c.createElement)("button",{className:"button get-related-keywords",onClick:this.handleLoadButtonClick},(0,p.__)("Get related keywords and Pro data","diagnoseo"));return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"components-base-control__field add-keyword diagnoseo-related-keywords"},(0,c.createElement)(u.FormTokenField,{label:(0,c.createElement)("b",null,(0,p.__)("Related keywords","diagnoseo")),onChange:this.handleChange,value:e,maxLength:this.state.keywordLimit+10}),(0,c.createElement)("p",{className:"components-form-token-field__help"},(0,p.__)("Limits: 10 keywords in free, 100 keywords in Pro","diagnoseo")),(0,c.createElement)(u.SelectControl,{options:[{value:"chinese",label:"Taiwan"},{value:"arabic",label:"Bahrain"},{value:"bulgarian",label:"Bulgaria"},{value:"croatian",label:"Croatia"},{value:"czech",label:"Czechia"},{value:"danish",label:"Denmark"},{value:"dutch",label:"Netherlands"},{value:"english",label:"United States"},{value:"finnish",label:"Finland"},{value:"french",label:"France"},{value:"austrian",label:"Austria"},{value:"greek",label:"Cyprus"},{value:"israeli",label:"Israel"},{value:"indian",label:"India"},{value:"hungarian",label:"Hungary"},{value:"indonesian",label:"Indonesia"},{value:"italian",label:"Italy"},{value:"japanese",label:"Japan"},{value:"korean",label:"South Korea"},{value:"latvian",label:"Latvia"},{value:"lithuanian",label:"Lithuania"},{value:"norwegian",label:"Norway"},{value:"polish",label:"Poland"},{value:"portugese",label:"Portugal"},{value:"romanian",label:"Romania"},{value:"russian",label:"Russia"},{value:"serbian",label:"Serbia"},{value:"slovak",label:"Slovakia"},{value:"slovenian",label:"Slovenia"},{value:"spanish",label:"Argentina"},{value:"swedish",label:"Sweden"},{value:"thai",label:"Thailand"},{value:"turkish",label:"Turkey"},{value:"ukrainian",label:"Ukraine"},{value:"vietnamese",label:"Vietnam"}],value:this.state.language,onChange:this.handleLangChange,label:(0,p.__)("Language","diagnoseo")}),(0,c.createElement)("p",null,a)))}getRelatedKeywords(a,l){return new Promise(t=>{const e=new FormData;e.append("keyword",a),e.append("language",l),e.append("count",30),fetch("/wp-json/diagnoseo/v1/related-keywords",{method:"POST",body:e}).then(e=>e.json()).then(e=>{"ok"===e.status?t(e.keywords):t("")}).catch(e=>{console.error(e),t("")})})}}var b=(0,o.compose)((0,i.withSelect)(e=>{var t=e("core/editor").getEditedPostAttribute("featured_media");return{postTitle:e("core/editor").getEditedPostAttribute("title"),postContent:e("core/editor").getEditedPostContent(),featuredMedia:e("core").getMedia(t,{context:"embed"})||{}}}))(e=>(0,c.createElement)(g,{postTitle:e.postTitle,postContent:e.postContent,featuredMedia:e.featuredMedia,seoDataCollector:e.seoDataCollector})),v=(0,o.compose)((0,i.withSelect)(e=>{if(!window.diagnoseoPro)return{};e={categories:e("core/editor").getEditedPostAttribute("categories"),status:"publish",per_page:10,exclude:[e("core/editor").getEditedPostAttribute("id")]};return{suggestedPosts:wp.data.select("core").getEntityRecords("postType","post",e)||[]}}))(e=>{if(window.diagnoseoPro){var t="";return t=e.suggestedPosts.length?(t=e.suggestedPosts.map(e=>(0,c.createElement)("li",null,(0,c.createElement)("a",{href:e.link},e.title.raw))),(0,c.createElement)("ol",null,t)):(0,c.createElement)("p",null,(0,p.__)("Could not prepare suggestions as there are no posts related to this one"))}return(0,c.createElement)("p",null,(0,c.createElement)("b",null,(0,c.createElement)("a",{href:"https://diagnoseo.com/wordpress-seo-plugin/?utm_source=wp&utm_medium=link&utm_campaign=available_in_pro",target:"_blank",rel:"noreferrer noopener"},(0,p.__)("Available in Pro","diagnoseo"))))}),o=(0,o.compose)((0,i.withDispatch)(t=>({setMetaValues:e=>{t("core/editor").editPost({meta:{diagnoseo_optimal_word_number:e.number_of_words.toString(),diagnoseo_optimal_keyword_density:e.focus_keyword_density.toString(),diagnoseo_optimal_heading_number:e.number_of_headings.toString(),diagnoseo_optimal_image_number:e.number_of_images.toString()}})}})))(e=>{var t=window.diagnoseoPro?"DiagnoSEO Pro":"DiagnoSEO";return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(n.PluginSidebarMoreMenuItem,{target:"diagnoseo-content-analyzer"},(0,p.__)("DiagnoSEO Content Watcher","diagnoseo")),(0,c.createElement)(n.PluginSidebar,{title:t,name:"diagnoseo-content-analyzer"},(0,c.createElement)(u.PanelBody,{title:(0,p.__)("Content analyzer","diagnoseo"),initialOpen:"true"},(0,c.createElement)(y,{sectionName:"content"})),(0,c.createElement)(u.PanelBody,{title:(0,p.__)("Keyword placement","diagnoseo"),initialOpen:"true"},(0,c.createElement)(r,{fieldName:"diagnoseo_meta_keyword",label:(0,c.createElement)("b",null,(0,p.__)("Focus keyword","diagnoseo"))}),(0,c.createElement)(s,null),(0,c.createElement)(b,{seoDataCollector:e.setMetaValues}),(0,c.createElement)(y,{sectionName:"keyword"})),(0,c.createElement)(u.PanelBody,{title:(0,p.__)("Internal linking suggestions","diagnoseo"),initialOpen:"true"},(0,c.createElement)(v,null))))});(0,e.registerPlugin)("diagnoseo-sidebar",{icon:(0,c.createElement)(a,null),render:o})}();class diagnoseoFormHelper{input(e,t,a,l="text",n=!1,i="1",o={}){const r=document.createElement("input");for(var s in this.setAttributes(r,{type:l,name:e,id:e,class:a||"components-textarea-control__input widefat",value:t,step:"number"===l?i:""}),n&&r.setAttribute("required","required"),o)r.addEventListener(s,o[s]);return r.addEventListener("input",this.saveSchemaData),r}textarea(e,t,a,l=!1,n={}){const i=document.createElement("textarea");for(var o in this.setAttributes(i,{name:e,id:e,class:a||"components-textarea-control__input widefat"}),i.value=t,l&&i.setAttribute("required","required"),n)i.addEventListener(o,n[o]);return i.addEventListener("input",this.saveSchemaData),i}select(e,a,t,l,n=!1,i={}){const o=document.createElement("select");for(var r in o.value=a,this.setAttributes(o,{name:e,id:e,class:l||"widefat"}),n&&o.setAttribute("required","required"),t.forEach(e=>{const t=document.createElement("option");t.setAttribute("value",e.value),t.textContent=e.label,e.value===a&&t.setAttribute("selected","selected"),o.appendChild(t)}),i)o.addEventListener(r,i[r]);return o.addEventListener("change",this.saveSchemaData),o}button(e,t,a,l,n="",i={}){const o=document.createElement("button");for(var r in o.textContent=a,this.setAttributes(o,{name:e,id:e,class:l,value:t,type:n||""}),i)o.addEventListener(r,i[r]);return o}sectionTitle(e){if(e){const t=document.createElement("h3");return t.classList.add("components-base-control__heading"),t.textContent=e,t}}wrapField(e,t,a="",l="components-base-control__field"){const n=document.createElement("div");l&&n.classList.add(l);const i=document.createElement("label");if(i.classList.add("components-base-control__label"),i.setAttribute("for",e.getAttribute("id")),i.textContent=t,e.getAttribute("required")){const o=document.createElement("span");o.classList.add("req"),o.textContent="*",i.appendChild(o)}if(n.appendChild(i),n.appendChild(e),a){const r=document.createElement("p");r.classList.add("hint"),r.textContent=a,n.appendChild(r)}return n}setAttributes(e,t){for(var a in t)e.setAttribute(a,t[a])}prepareField(e){var t,{fieldType:a,label:l,name:n,value:i,type:o,className:r,options:s,listeners:d,required:c,hint:e,text:u,step:p}=e;switch(a){case"input":t=this.input(n,i,r,o,c,p,d);break;case"textarea":t=this.textarea(n,i,r,c,d);break;case"select":t=this.select(n,i,s,r,c,d);break;case"button":t=this.button(n,i,l,r,o,d);break;case"sectionTitle":t=this.sectionTitle(u)}return"button"===a||"sectionTitle"===a?t:this.wrapField(t,l,e)}saveSchemaData(e){const n=e.target.closest(".diagnoseo-schema-form");if(n){const i={};n.formConfig.forEach(t=>{if("sectionTitle"!==t.fieldType){let e=t.name;var l=e.replaceAll("-","_");let a=n.querySelector(`#${e}`).value||"";t.splitLines&&(a=a.split(t.splitLines),a.forEach((e,t)=>{a[t]=e.trim()})),i[l]=a}});const t=document.querySelector("#schema-data");t.value=JSON.stringify(i);let e=document.querySelector(".diagnoseo-schema-generator");e.setAttribute("data-schema-data",t.value)}}buildSchemaForm(e){const t=document.createElement("div");return t.classList.add("diagnoseo-schema-form"),e.forEach(e=>{e=this.prepareField(e);t.appendChild(e)}),t.formConfig=e,t}}function permalinkWatcher(){"use strict";if(window.wp.data){var e,t=document.body.classList.contains("block-editor-page");const a=document.querySelector("#seo-slug"),l=document.querySelector(".editor-post-link input");a.addEventListener("input",e=>{const t=document.querySelector(".editor-post-link input");e=e.target.value;t&&t.value!==e&&(t.value=e,e=new Event("blur"),t.dispatchEvent(e))}),l&&(l.addEventListener("input",e=>{a.value!==e.target.value&&(a.value=e.target.value)}),a.value&&l&&l.value!==a.value&&(l.value=a.value,e=new Event("blur"),l.dispatchEvent(e))),t&&window.wp.data.subscribe(function(){var e=window.wp.data.select("core/editor").isSavingPost(),t=window.wp.data.select("core/editor").isAutosavingPost();e&&!t&&setTimeout(()=>{const e=document.querySelector("#seo-slug"),t=document.querySelector(".editor-post-link input");var a;e.value&&t?(a=seoHelper.slugify(e.value),e.value=a,t.value=a,a=new Event("blur"),t.dispatchEvent(a)):!e.value&&t&&(a=seoHelper.slugify(t.value),e.value=a)},500)})}}document.addEventListener("DOMContentLoaded",function(){"use strict";const e=document.querySelectorAll(".meta-template");e.forEach(e=>{const n=e.querySelector(".choose-variable"),t=e.querySelector(".add-variable"),i=e.querySelector("input, textarea");t&&t.addEventListener("click",e=>{e.preventDefault();var t,a,l=n.value;i.selectionStart||"0"==i.selectionStart?(t=i.selectionStart,a=i.selectionEnd,e=parseInt(t)?" ":"",i.value=i.value.substring(0,t)+e+l+i.value.substring(a,i.value.length)):i.value+=l,i.dispatchEvent(new Event("input"))})})}),document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".diagnoseo-image-select");e.forEach(n=>{const e=n.querySelector(".diagnoseo-img-upload"),l=n.querySelector(".diagnoseo-img-remove");e&&e.addEventListener("click",e=>{e.preventDefault();const l=wp.media({title:"Custom Image",button:{text:"Select Image"},multiple:!1}).on("select",()=>{var e=l.state().get("selection").first().toJSON();const t=n.querySelector(".diagnoseo-img"),a=n.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",e.url),a&&(a.value=e.url)}).open()}),l&&l.addEventListener("click",e=>{e.preventDefault();const t=n.querySelector(".diagnoseo-img"),a=n.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",l.dataset.fallbackImage||""),a&&(a.value="")})})}),window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(permalinkWatcher,500)});const schemaGeneratorInit=function(){var e,r="",t="";const a=function(e,t=!1){var a=null,l={},n=document.querySelector(".diagnoseo-schema-generator");n&&(l=(l=n.dataset.schemaData)&&JSON.parse(l));const i=["Article","NewsArticle","BlogPosting"];if(!t&&i.includes(e)&&i.includes(r))return r=e,!1;switch(r=e){case"Article":case"NewsArticle":case"BlogPosting":a=articleSchemaForm(l);break;case"Review":a=reviewSchemaForm(l);break;case"Service":a=serviceSchemaForm(l);break;case"Product":a=productSchemaForm(l);break;case"Course":a=courseSchemaForm(l);break;case"Recipe":a=recipeSchemaForm(l);break;case"Person":a=personSchemaForm(l);break;case"JobPosting":a=jobPostingSchemaForm(l);break;case"SoftwareApplication":a=appSchemaForm(l);break;case"Book":a=bookSchemaForm(l);break;case"Event":a=eventSchemaForm(l);break;case"VideoObject":a=videoSchemaForm(l);break;case"ImageObject":a=imageSchemaForm(l);break;case"WebPage":a=webPageSchemaForm(l);break;case"AboutPage":a=aboutPageSchemaForm(l);break;case"FAQPage":a=faqPageSchemaForm(l);break;case"ContactPage":a=contactPageSchemaForm(l);break;default:a=null}const o=document.querySelector(".diagnoseo-schema-fields");return a?(o&&(o.innerHTML="",o.appendChild(a)),!0):(o&&(o.innerHTML=""),!1)},l=function(){const t=document.querySelector(".diagnoseo-schema-generator");if(t){var{schemaData:a}=t.dataset;if(a)for(prop in a=JSON.parse(a)){var l=prop.replaceAll("_","-");let e=t.querySelector(`#${l}`);e&&!e.value&&(e.value=a[prop])}}},n=document.querySelector("#schema-type");n&&(n.addEventListener("change",e=>{a(e.target.value)&&l()}),(e=document.querySelector(".diagnoseo-schema-generator"))&&(t=e.dataset.defaultSchemaType),r=n.value||""),a(r||t,!0),l()};window.addEventListener("load",schemaGeneratorInit);const aboutPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},appSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"operating-system",type:"text",value:e.operating_system||"",label:"Operating system"},{fieldType:"input",name:"app-category",type:"text",value:e.app_category||"",label:"Application category",hint:"Example: Multimedia, Game"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Currency"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"input",name:"rating-count",type:"number",value:e.rating_count,label:"Rating count"}];return t.buildSchemaForm(e)},articleSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"headline",type:"text",value:e.headline||"",label:"Headline"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"keywords",type:"text",value:e.keywords||"",label:"Keywords"}];return t.buildSchemaForm(e)},bookSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"input",name:"url",type:"url",value:e.url||"",label:"URL"},{fieldType:"input",name:"author-name",type:"text",value:e.author_name||"",label:"Author name"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"}];return t.buildSchemaForm(e)},contactPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},courseSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Course name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Course description"},{fieldType:"sectionTitle",text:"Provider"},{fieldType:"select",name:"provider-type",value:e.provider_type,label:"Provider type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"provider-name",type:"text",value:e.provider_name||"",label:"Provider name"},{fieldType:"input",name:"provider-url",type:"text",value:e.provider_url||"",label:"Provider URL"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},eventSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"type",value:e.type,options:[{value:"Event",label:"Event"},{value:"BusinessEvent",label:"Business Event"},{value:"ChildrensEvent",label:"Childrens Event"},{value:"ComedyEvent",label:"Comedy Event"},{value:"DanceEvent",label:"Dance Event"},{value:"DeliveryEvent",label:"Delivery Event"},{value:"EducationEvent",label:"Education Event"},{value:"ExhibitionEvent",label:"Exhibition Event"},{value:"Festival",label:"Festival"},{value:"FoodEvent",label:"Food Event"},{value:"LiteraryEvent",label:"Literary Event"},{value:"MusicEvent",label:"Music Event"},{value:"PublicationEvent",label:"Publication Event"},{value:"SaleEvent",label:"Sale Event"},{value:"ScreeningEvent",label:"Screening Event"},{value:"SocialEvent",label:"Social Event"},{value:"SportsEvent",label:"Sports Event"},{value:"TheaterEvent",label:"Theater Event"},{value:"VisualArtsEvent",label:"Visual Arts Event"}],label:"Event type"},{fieldType:"select",name:"status",value:e.status,options:[{value:"",label:"None"},{value:"EventScheduled",label:"Scheduled"},{value:"EventCancelled",label:"Cancelled"},{value:"EventPostponed",label:"Postponed"},{value:"EventRescheduled",label:"Rescheduled"},{value:"EventMovedOnline",label:"Moved Online"}],label:"Event status"},{fieldType:"select",name:"mode",value:e.mode,options:[{value:"OfflineEventAttendanceMode",label:"Offline"},{value:"OnlineEventAttendanceMode",label:"Online"},{value:"MixedEventAttendanceMode",label:"Mixed (Offline + Online)"}],label:"Attendance mode"},{fieldType:"input",name:"date-start",type:"date",value:e.date_start,label:"Start date"},{fieldType:"input",name:"date-end",type:"date",value:e.date_end,label:"End date"},{fieldType:"sectionTitle",text:"Venue"},{fieldType:"input",name:"venue-name",type:"text",value:e.venue_name||"",label:"Venue name"},{fieldType:"input",name:"venue-url",type:"url",value:e.venue_url||"",label:"Venue URL"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"},{fieldType:"sectionTitle",text:"Performer"},{fieldType:"select",name:"performer-type",value:e.performer_type,options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}],label:"Performer"},{fieldType:"input",name:"performer-name",type:"text",value:e.performer_name||"",label:"Performer name"},{fieldType:"input",name:"performer-url",type:"url",value:e.performer_url||"",label:"Performer website or social link"},{fieldType:"sectionTitle",text:"Organizer"},{fieldType:"select",name:"organizer-type",value:e.organizer_type,options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}],label:"Organizer"},{fieldType:"input",name:"organizer-name",type:"text",value:e.organizer_name||"",label:"Organizer name"},{fieldType:"input",name:"organizer-url",type:"url",value:e.organizer_url||"",label:"Organizer website or social link"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-url",type:"url",value:e.offer_url||"",label:"Offer URL"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Offer price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Offer currency"},{fieldType:"select",name:"offer-availability",value:e.offer_availability,options:[{value:"InStock",label:"In Stock"},{value:"SoldOut",label:"Sold Out"},{value:"Preorder",label:"Preorder"}],label:"Availability"},{fieldType:"input",name:"price-valid-from",type:"date",value:e.price_valid_from,label:"Price valid from"},{fieldType:"input",name:"inv-level",type:"text",value:e.inv_level||"",label:"Inventory level"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"}];return t.buildSchemaForm(e)},faqPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"main-question",type:"text",value:e.main_question||"",label:"Main entity - question"},{fieldType:"textarea",name:"main-answer",type:"text",value:e.main_answer||"",label:"Main entity - answer"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},imageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"location",type:"text",value:e.location||"",label:"Location",hint:"Name of the place where the picture was taken, for example: Manhattan, New York"}];return t.buildSchemaForm(e)},jobPostingSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"salary-currency",type:"text",value:e.salary_currency||"",label:"Salary currency",hint:"ISO 4217 Currency code. Example: EUR"},{fieldType:"input",name:"salary-amount",type:"text",value:e.salary_amount||"",label:"Salary amount",hint:"Insert amount, e.g. 100.00, or a salary range, e.g. 120.00-160.00"},{fieldType:"select",name:"salary-payroll",value:e.salary_payroll,label:"Payroll",options:[{value:"None",label:""},{value:"Yearly",label:"YEAR"},{value:"Monthly",label:"MONTH"},{value:"Weekly",label:"WEEK"},{value:"Daily",label:"DAY"},{value:"Hourly",label:"HOUR"}]},{fieldType:"input",name:"date-posted",type:"date",value:e.date_posted,label:"Date posted",hint:"Choose date, post publication date will be used if this field is empty"},{fieldType:"input",name:"date-expires",type:"date",value:e.date_expires,label:"Expiry date",hint:"Leave empty if the job posting does not expire"},{fieldType:"select",name:"employment-type",value:e.employment_type,label:"Employment type",options:[{value:"FULL_TIME",label:"Full Time"},{value:"PART_TIME",label:"Part Time"},{value:"CONTRACTOR",label:"Contractor"},{value:"TEMPORARY",label:"Temporary"},{value:"INTERN",label:"Intern"},{value:"VOLUNTEER",label:"Volunteer"},{value:"PER_DIEM",label:"Per Diem"},{value:"OTHER",label:"Other"}]},{fieldType:"input",name:"posting-id",type:"text",value:e.posting_id||"",label:"Posting ID"},{fieldType:"sectionTitle",text:"Hiring organization"},{fieldType:"input",name:"company",type:"text",value:e.company||"",label:"Hiring organization"},{fieldType:"input",name:"org-url",type:"url",value:e.org_url||"",label:"Organization URL"},{fieldType:"input",name:"org-logo",type:"url",value:e.org_logo||"",label:"Organization logo URL"},{fieldType:"sectionTitle",text:"Job location"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"}];return t.buildSchemaForm(e)},personSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"email",type:"email",value:e.email||"",label:"E-mail"},{fieldType:"input",name:"gender",type:"text",value:e.gender||"",label:"Gender"},{fieldType:"input",name:"job-title",type:"text",value:e.job_title||"",label:"Job title"},{fieldType:"input",name:"url",type:"url",value:e.url||"",label:"URL"},{fieldType:"input",name:"image",type:"url",value:e.url||"",label:"Image URL"},{fieldType:"sectionTitle",text:"Address"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"}];return t.buildSchemaForm(e)},productSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Product name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Product description"},{fieldType:"input",name:"sku",type:"text",value:e.sku||"",label:"Product SKU"},{fieldType:"input",name:"identifier_name",type:"text",value:e.identifier_name||"",label:"Global identifier",hint:"GTIN, MPN, ISBN or other"},{fieldType:"input",name:"identifier_value",type:"text",value:e.identifier_value||"",label:"Global identifier value"},{fieldType:"input",name:"brand",type:"text",value:e.brand||"",label:"Brand name"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"price",type:"number",value:e.price,label:"Price",step:"0.01"},{fieldType:"input",name:"currency",type:"text",value:e.currency||"",label:"Currency"},{fieldType:"input",name:"deadline",type:"date",value:e.deadline,label:"Price valid until"},{fieldType:"select",name:"availability",value:e.availability,options:[{label:"In Stock",value:"InStock"},{label:"Sold Out",value:"SoldOut"},{label:"Preorder",value:"Preorder"}],label:"Availability"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"sectionTitle",text:"Review publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},recipeSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Recipe title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Recipe description"},{fieldType:"input",name:"prep-time",type:"text",value:e.prep_time||"",label:"Preparation time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"cook-time",type:"text",value:e.cook_time||"",label:"Cooking time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"total-time",type:"text",value:e.total_time||"",label:"Total time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"type",type:"text",value:e.type||"",label:"Type of dish",hint:"Example: appetizer or dessert"},{fieldType:"input",name:"cuisine",type:"text",value:e.cuisine||"",label:"Cuisine"},{fieldType:"input",name:"keywords",type:"text",value:e.keywords||"",label:"Keywords"},{fieldType:"input",name:"yield",type:"text",value:e.yield||"",label:"Recipe yield",hint:"Quantity of portions produced by the recipe, for example: 4"},{fieldType:"input",name:"calories",type:"number",value:e.calories,label:"Calories"},{fieldType:"textarea",name:"ingredients",value:e.ingredients?e.ingredients.join("; "):"",label:"Ingredients",hint:"Separate ingredients with semicolons (;)",splitLines:";"},{fieldType:"textarea",name:"instructions",value:e.instructions?e.instructions.join("; "):"",label:"Recipe instructions",hint:"Separate instructions with semicolons (;)",splitLines:";"},{fieldType:"sectionTitle",text:"Aggregate Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-count",type:"number",value:e.rating_count,label:"Rating count"},{fieldType:"sectionTitle",text:"Video"},{fieldType:"input",name:"video-title",type:"text",value:e.video_title||"",label:"Video title"},{fieldType:"textarea",name:"video-description",value:e.video_description||"",label:"Video description"},{fieldType:"input",name:"video-url",type:"url",value:e.video_url||"",label:"Video URL"},{fieldType:"input",name:"video-content-url",type:"url",value:e.video_content_url||"",label:"Video content URL",hint:"A URL pointing to the actual video media file"},{fieldType:"input",name:"video-thumbnail",type:"url",value:e.video_thumbnail||"",label:"Video thumbnail URL"},{fieldType:"input",name:"video-duration",type:"text",value:e.video_duration||"",label:"Video duration",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"video-uploaded",type:"date",value:e.video_uploaded,label:"Video upload date"}];return t.buildSchemaForm(e)},reviewSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Review title"},{fieldType:"sectionTitle",text:"Reviewed item"},{fieldType:"select",name:"reviewed-item",value:e.reviewed_item,label:"Reviewed item",options:[{value:"Book",label:"Book"},{value:"Course",label:"Course"},{value:"Event",label:"Event"},{value:"How-to",label:"How-to"},{value:"LocalBusiness",label:"Local Business"},{value:"Movie",label:"Movie"},{value:"Product",label:"Product"},{value:"Recipe",label:"Recipe"},{value:"SoftwareApp",label:"Software App"}]},{fieldType:"input",name:"reviewed-item-image",type:"url",value:e.reviewed_item_image||"",label:"Reviewed item image URL"},{fieldType:"input",name:"reviewed-item-name",type:"text",value:e.reviewed_item_name||"",label:"Reviewed item name"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",step:"0.01",value:e.rating,label:"Rating value"},{fieldType:"textarea",name:"review-body",value:e.review_body||"",label:"Review text"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},serviceSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"service-type",type:"text",value:e.service_type||"",label:"Service type"},{fieldType:"input",name:"service-name",type:"text",value:e.service_name||"",label:"Name"},{fieldType:"textarea",name:"service-description",value:e.service_description||"",label:"Service description"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Currency"}];return t.buildSchemaForm(e)},videoSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"embed-url",type:"url",value:e.embed_url||"",label:"Embed URL",hint:"A URL pointing to the embeddable player for the video. Example: https://www.youtube.com/embed/VIDEOID"},{fieldType:"input",name:"content-url",type:"url",value:e.content_url||"",label:"Content URL",hint:"A URL pointing to the actual video media file like MP4, MOV, etc. Please leave it empty if you don't know the URL"},{fieldType:"input",name:"duration",type:"text",value:e.duration||"",label:"Duration",hint:"ISO 8601 duration format. Example: PT1H30M"}];return t.buildSchemaForm(e)},webPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},seoHelper={slugify:function(e){e=(e=e.replace(/^\s+|\s+$/g,"")).toLowerCase();for(var t="àáãäâąèéëêęìíïîóòóöôùúüûñńśçćźżł·/_,:;",a=0,l=t.length;a<l;a++)e=e.replace(new RegExp(t.charAt(a),"g"),"aaaaaaeeeeeiiiiooooouuuunnscczzl------".charAt(a));return e=e.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},countOccurences:function(e,t){if(!t||!e)return 0;t=t.toLowerCase().replaceAll(/[:;,.!?-]/g,""),e=e.toLowerCase();e=new RegExp(e,"g");return(t.match(e)||[]).length},countSyllables:function(e){if(""===e)return 0;if(e.length<=3)return 1;e=(e=(e=(e=e.toLowerCase()).replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,"")).replace(/^y/,"")).match(/[aeiouy]{1,2}/g);return e?e.length:0},countWords:function(e){e=(e=(e=e.replace(/(\r\n|\n|\r)/gm," ")).replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g," ")).split(" ");return(e=(e=e.map(e=>e.trim())).filter(e=>e&&""!==e&&"\n"!==e)).length||0},countElements:function(e,t){if(!e||!t)return 0;const a=document.createElement("div");return a.innerHTML=e,a.querySelectorAll(t).length},replaceVariables:function(e){if(e){var{site:t,siteTagline:a,separator:l,excerpt:n,postTitle:i}=document.querySelector(".diagnoseo-preview").dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",document.body.classList.contains("block-editor-page")?window.wp.data.select("core/editor").getEditedPostAttribute("title"):i)).replaceAll("%sitename%",t)).replaceAll("%tagline%",a)).replaceAll("%sep%",l)).replaceAll("%page%"," ")).replaceAll("%excerpt%",n)).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))}},isKeywordInText:function(e,t){if(!e||!t)return!1;e=e.toLowerCase();let a=(t=t.toLowerCase()).toLowerCase().replaceAll(/[:;,.!?-]/g,"");return t.includes(e)||a.includes(e)},isKeywordInAnyElement:function(t,e,a){if(!t||!e||!a)return!1;var l=!1;const n=seoHelper.createMarkupEl(e);return elements=n.querySelectorAll(a),elements.forEach(e=>{seoHelper.isKeywordInText(t,e.textContent)&&(l=!0)}),l},isKeywordInAnyAlt:function(t,e,a=null){if(!t)return!1;if(a&&seoHelper.isKeywordInText(t,a.alt_text))return!0;var l=0;const n=seoHelper.createMarkupEl(e),i=n.querySelectorAll("img");return i.forEach(e=>{e=e.getAttribute("alt").toLowerCase();l+=seoHelper.countOccurences(t,e)}),l},createMarkupEl:function(e){const t=document.createElement("div");return t.innerHTML=e,t},stripTags:function(e){return e.replace(/(<([^>]+)>)/gi,"")}};function initSerpSimulator(){"use strict";const o=document.body.classList.contains("block-editor-page"),r=document.querySelector(".diagnoseo-preview");if(!r)return;const l=r.querySelector(".search-result .search-result-title"),a=r.querySelector(".search-result.mobile .search-result-title"),n=r.querySelector(".search-result .search-result-descr"),i=r.querySelector(".search-result.mobile .search-result-descr"),e=document.querySelector(".diagnoseo-meta-form")||document.querySelector(".diagnoseo-settings-form"),s=e.querySelector("#seo-title")||e.querySelector("#diagnoseo_home_title"),d=e.querySelector(".info-title-chars"),c=e.querySelector(".info-title-width"),u=e.querySelector(".seo-title-progress .diagnoseo-progress-fill"),p=e.querySelector("#seo-description")||e.querySelector("#diagnoseo_home_description"),m=e.querySelector(".info-descr-chars"),y=e.querySelector(".info-descr-width"),g=e.querySelector(".seo-descr-progress .diagnoseo-progress-fill"),b=e.querySelector("#seo-slug"),v=e.querySelector(".info-slug-chars"),h=e.querySelector(".seo-slug-progress .diagnoseo-progress-fill"),f=r.querySelector(".title-sample"),w=r.querySelector(".description-sample"),t=function(){for(var e=!1;function(){var e=l.offsetWidth-20;l.style.maxWidth="none",l.style.position="absolute";var t=l.offsetWidth;return l.removeAttribute("style"),e<t}();){var t=T(l.textContent);if(!t)break;t=(t=(t=t.replace(/\/$/," ...")).split(" ").slice(0,-1).join(" ")).replace(/,\s*$/,""),e=!0,l.textContent=t,a.textContent=t}e&&(l.textContent=l.textContent+" ...",a.textContent=a.textContent+" ...")},_=function(e,t,a=0){const l=e.split(" "),n=w;if(!n)return e;e=function(e,t){for(var a,l="",n=e.split(" "),i=0;i<n.length;i++)if(a=l,(l+=" "+n[i]).length>t){l=a+" ...";break}return l=l.replace(/,\s*$/,"")}(e,a),n.textContent=e;for(var i=!1;n.clientWidth>t;){l.pop();var i=!0,o=l.join(" ");n.textContent=o}return i?l.join(" ")+" ...":e},k=function(e){var t=T(e),e=_(t,960,158);n.textContent=e;e=_(t,680,158);i.textContent=e,w.textContent=t},T=function(e){if(!e)return"";var{site:t,siteTagline:a,separator:l,excerpt:n,postTitle:i}=r.dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",o?window.wp.data.select("core/editor").getEditedPostAttribute("title"):i)).replaceAll("%sitename%",t)).replaceAll("%tagline%",a)).replaceAll("%sep%",l)).replaceAll(" %page%","")).replaceAll("%excerpt%",n||x())).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))},E=function(e){e=T(e),f.textContent=e||l.dataset.fallback,l.textContent=e||l.dataset.fallback,a.textContent=e||l.dataset.fallback,t()},x=function(){if(!window.wp||!window.wp.data)return"";let a=o?window.wp.data.select("core/editor").getEditedPostAttribute("excerpt"):r.dataset.excerpt;if(!a){let e=o?window.wp.data.select("core/editor").getEditedPostContent():"";e=seoHelper.stripTags(e).trim();let t=e.split(" ");var l=Math.min(t.length,55);t=t.splice(0,l),a=t.join(" ")}return a},S=function(){var e,t,a,l;u&&(e=f.clientWidth,l=f.textContent,100<(a=e/600*100)&&(a=100),(t=(l=T(l)).length)||(a=0),a+="%",l="",30<=t&&e<=600&&(30<=t&&t<35||60<t&&e<=600?l="medium":35<=t&&t<=60&&(l="full")),d.textContent=t,c.textContent=e,u.style.width=a,l?u.classList.contains(l)||(u.classList.remove("medium","full"),u.classList.add(l)):u.classList.remove("medium","full"))},P=function(){var e,t,a,l;g&&(l=w.textContent,e=w.clientWidth,t=l.length,100<(a=e/990*100)&&(a=100),p.value.length||p.getAttribute("placeholder")||(a=0),a+="%",l="",70<=t&&e<=990&&(70<=t&&t<130||158<t&&e<=990?l="medium":130<=t&&t<=158&&(l="full")),m.textContent=t,y.textContent=e,g.style.width=a,l?g.classList.contains(l)||(g.classList.remove("medium","full"),g.classList.add(l)):g.classList.remove("medium","full"))},C=function(){var e,t,a;h&&(t="",(a=(e=(e=b.value).replaceAll(" ","-")).split("-")).length<=5&&e.length?e.length<=50?t="full":50<e.length&&e.length<=60&&(t="medium"):5<a.length&&e.length<60&&(t="medium"),100<(a=Math.round(e.length/60*100))&&(a=100),h.style.width=a+"%",v.textContent=e.length,t?h.classList.contains(t)||(h.classList.remove("medium","full"),h.classList.add(t)):h.classList.remove("medium","full"))};s&&(s.addEventListener("input",function(e){E(e.target.value),f.textContent=T(e.target.value),o&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_title:e.target.value}}),S()}),E(s.value||s.getAttribute("placeholder")),S());const A=l.dataset.fallback;o?window.wp.data.subscribe(()=>{var e=window.wp.data.select("core/editor").getEditedPostAttribute("title")||r.dataset.postTitle;l.dataset.fallback=e||A;var t=s.value||s.getAttribute("placeholder");E(t),S();const a=document.querySelector("#postlist-title");!(window.wp.data.select("core/editor").getEditedPostAttribute("meta")?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:e)&&a&&a.setAttribute("placeholder",e)}):s&&s.addEventListener("input",e=>{var t=o?window.wp.data.select("core/editor").getEditedPostAttribute("title"):r.dataset.postTitle;l.dataset.fallback=t||A;e=e.target.value||e.target.value.getAttribute("placeholder");E(e),S();const a=document.querySelector("#postlist-title");!(o?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:t)&&a&&a.setAttribute("placeholder",t)}),p&&(p.addEventListener("input",function(e){k(e.target.value||e.target.getAttribute("placeholder")),o&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_description:e.target.value}}),P()}),k(p.value||p.getAttribute("placeholder")),P()),b&&b.addEventListener("input",e=>{o&&window.wp.data.dispatch("core/editor").editPost({slug:seoHelper.slugify(e.target.value)}),C()});const L=document.querySelectorAll(".diagnoseo-var-input");L&&L.forEach(e=>{const l=e.querySelector(".var-input"),n=e.querySelector(".var-select"),t=e.querySelector(".var-button");t.addEventListener("click",e=>{e.preventDefault();var t,a=n.value;a&&(l.selectionStart||"0"==l.selectionStart?(t=l.selectionStart,e=l.selectionEnd,l.value=l.value.substring(0,t)+" "+a+l.value.substring(e,l.value.length)):l.value+=a,l.dispatchEvent(new Event("input")))})}),setTimeout(function(){t(),S(),P(),C()},500)}window._wpLoadBlockEditor?window._wpLoadBlockEditor.then(function(){setTimeout(initSerpSimulator,500)}):window.addEventListener("load",initSerpSimulator);const startSocialPreview=function(){ const{select:m,dispatch:l,subscribe:e}=window.wp.data,t=document.querySelectorAll(".diagnoseo-social-meta"),a=document.body.classList.contains("block-editor-page");if(t){const y=document.querySelector("#facebook-title"),g=document.querySelector("#twitter-title"),b=document.querySelector("#facebook-description"),v=document.querySelector("#twitter-description"),h=document.querySelector("#seo-title"),f=document.querySelector("#seo-description");if(h.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");y.setAttribute("placeholder",e),g.setAttribute("placeholder",e)}),f.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");b.setAttribute("placeholder",e),v.setAttribute("placeholder",e)}),t.forEach(e=>{e.addEventListener("input",e=>{a&&function(e,t){const a={};a[e]=t,l("core/editor").editPost({meta:a})}(e.target.dataset.customField,e.target.value)})}),a)e(()=>{const e=m("core/editor");var t=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_title||y.value||h.value||y.getAttribute("placeholder"),a=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_description||b.value||f.value||f.getAttribute("placeholder"),l=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_title||g.value||h.value||g.getAttribute("placeholder"),n=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_description||v.value||f.value||f.getAttribute("placeholder"),i=e.getEditedPostAttribute("featured_media");const o=document.querySelectorAll(".diagnoseo-social-preview"),r=document.querySelector(".preview-facebook"),s=document.querySelector(".preview-twitter"),d=r.querySelector(".facebook-post-title");d&&(d.textContent=seoHelper.replaceVariables(t));const c=r.querySelector(".facebook-post-description");c&&(c.textContent=seoHelper.replaceVariables(a));const u=s.querySelector(".twitter-post-title");u&&(u.textContent=seoHelper.replaceVariables(l));const p=s.querySelector(".twitter-post-description");p&&(p.textContent=seoHelper.replaceVariables(n)),o.forEach(e=>{var t=i?m("core").getMedia(i):null,t=t?t.guid.raw:e.dataset.placeholderImage;const a=e.querySelector(".preview-image img");a.setAttribute("src",t)})});else{const n=document.querySelector(".preview-facebook"),i=document.querySelector(".preview-twitter"),o=n.querySelector(".facebook-post-title"),r=n.querySelector(".facebook-post-description"),s=i.querySelector(".twitter-post-title"),d=i.querySelector(".twitter-post-description");o.textContent=seoHelper.replaceVariables(n.dataset.facebookTitle),r.textContent=seoHelper.replaceVariables(n.dataset.facebookDescription),s.textContent=seoHelper.replaceVariables(i.dataset.twitterTitle),d.textContent=seoHelper.replaceVariables(i.dataset.twitterDescription),y.addEventListener("input",e=>{e=e.target.value;o&&(o.textContent=seoHelper.replaceVariables(e))}),b.addEventListener("input",e=>{e=e.target.value;r&&(r.textContent=seoHelper.replaceVariables(e))}),g.addEventListener("input",e=>{e=e.target.value;s&&(s.textContent=seoHelper.replaceVariables(e))}),v.addEventListener("input",e=>{e=e.target.value;d&&(d.textContent=seoHelper.replaceVariables(e))})}}};window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(startSocialPreview,500)}),document.body.classList.contains("block-editor-page")||window.addEventListener("load",startSocialPreview),jQuery(document).on("ready",function(){jQuery(".toggle").each(function(){const t=jQuery(this).find(".toggle-trigger"),a=jQuery(this).find(".toggle-content");t.on("click",function(e){e.preventDefault(),a.slideToggle(),t.toggleClass("open")})})});1 const{__}=window.wp.i18n;window.diagnoseo={additionalKeywordLimit:10,additionalKeywordCount:0,RelatedKeywordsInPost:0,checks:[{id:"title-not-too-long",type:"check",label:__("Title not too long"),section:"content",test:e=>{var{metaTitle:t,postTitle:e}=e;if(!t&&!e)return"nok";t=t||e;const a=document.querySelector(".title-sample");a.textContent=t;e=a.clientWidth,t=t.length;return e<=600?60<t?"nok medium-nok":t<=60?"ok":"nok":"nok"}},{id:"title-not-too-short",type:"check",label:__("Title not too short"),section:"content",test:e=>{var{metaTitle:t,postTitle:e}=e;if(!t&&!e)return"nok";e=(t||e).length;return 30<=e?30<=e&&e<35?"nok medium-nok":35<=e?"ok":"nok":"nok"}},{id:"description-not-too-long",type:"check",label:__("Description not too long"),section:"content",test:e=>{var{metaDescription:t}=e;if(!t)return"nok";e=document.querySelector(".description-sample"),t=t.length;if(e.clientWidth<=990){if(155<t)return"nok medium-nok";if(t<=155)return"ok"}return"nok"}},{id:"description-not-too-short",type:"check",label:__("Description not too short"),section:"content",test:e=>{var{metaDescription:e}=e;if(!e)return"nok";e=e.length;if(70<=e){if(e<130)return"nok medium-nok";if(130<=e)return"ok"}return"nok"}},{id:"too-long-sentences",type:"check",label:__("No sentences with more than 20 words"),section:"content",test:e=>{var{postContent:e}=e;e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("</p>",".</p>")).replaceAll("</h1>",".</h1>")).replaceAll("</h2>",".</h2>")).replaceAll("</h3>",".</h3>")).replaceAll("</h4>",".</h4>")).replaceAll("</h5>",".</h5>")).replaceAll("</h6>",".</h6>")).replaceAll("</li>",".</li>");const t=(e=seoHelper.stripTags(e)).split(/\.|\?|!/);var a=!1;return t.length&&t.forEach(e=>{a=a||20<seoHelper.countWords(e)}),a?"nok":"ok"}},{id:"too-many-words",type:"check",label:__("No paragraphs with more than 100 words"),section:"content",test:e=>{const t=seoHelper.createMarkupEl(e.postContent),a=t.querySelectorAll("p");var l=!1;return a.length&&a.forEach(e=>{100<seoHelper.countWords(e.textContent)&&(l=!0)}),l?"nok":"ok"}},{id:"too-many-sentences",type:"check",label:__("No paragraphs with more than 5 sentences"),section:"content",test:e=>{const t=seoHelper.createMarkupEl(e.postContent),a=t.querySelectorAll("p");var l=!1;return a.length&&a.forEach(e=>{5<e.textContent.split(/\.|\?|!/).filter(e=>!!e.trim()).length&&(l=!0)}),l?"nok":"ok"}},{id:"internal-links-present",type:"check",label:__("Contains internal links"),section:"content",test:e=>{const t=seoHelper.createMarkupEl(e.postContent),a=t.querySelectorAll("a");var l=!1;return a.forEach(e=>{e=e.getAttribute("href")||"";e&&(e.includes("http://"+window.location.hostname)||e.includes("https://"+window.location.hostname)||"/"===e.substr(0,1)||"./"===e.substr(0,2))&&(l=!0)}),l?"ok":"nok"}},{id:"strong-present",type:"check",label:__("Contains bold text (strong tag)"),section:"content",test:e=>seoHelper.countElements(e.postContent,"strong")?"ok":"nok"},{id:"readability",type:"stats",label:__("Readability score"),order:"label value comment",section:"content",test:e=>{var{postContent:t}=e,a=(t=seoHelper.stripTags(t)).split(/\.|\?|!/);a=(a=a.map(e=>e.trim())).filter(e=>e&&" "!==e&&"\n"!==e);e=(t=t.replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g," ")).split(" ");e=(e=e.map(e=>e.trim())).filter(e=>e&&""!==e&&"\n"!==e);var t=seoHelper.countSyllables(t),l=206.835-e.length/a.length*1.015-t/e.length*84.6;(l=l.toFixed(2))<0?l=0:100<l&&(l=100);var n="",i="";switch(!0){case isNaN(l):l=__("N/A"),n="",i="nok";break;case 90<l:n=__("Very easy to read","diagnoseo"),i="ok";break;case 80<l&&l<=90:n=__("Easy to read","diagnoseo"),i="ok";break;case 70<l&&l<=80:n=__("Fairly easy to read","diagnoseo"),i="ok";break;case 60<l&&l<=70:n=__("Average reading ease","diagnoseo"),i="nok medium-nok";break;case 50<l&&l<=60:n=__("Fairly difficult to read","diagnoseo"),i="nok";break;case 30<l&&l<=50:n=__("Difficult to read","diagnoseo"),i="nok";break;case 10<l&&l<=30:n=__("Very difficult to read","diagnoseo"),i="nok";break;case l<=10:n=__("Extremely difficult to read","diagnoseo"),i="nok"}return{value:l,comment:n=n&&` (${n})`,status:i}}},{id:"est-reading-time",type:"stats",label:__("Estimated reading time"),section:"content",order:"label value",test:e=>{var{postContent:t}=e,e=seoHelper.countWords(t),t=Math.floor(e/225),e=Math.floor(e%225/3.75);return{value:`${t} ${__("min")} ${e} ${__("s")}`}}},{id:"minimal-word-count",type:"check",label:__("Minimal word count"),section:"content",postTypes:["post","page"],inPro:!0},{id:"words",type:"stats",label:__("words"),section:"content",test:e=>{var{postContent:e}=e;return{value:seoHelper.countWords(e)}}},{id:"chars",type:"stats",label:__("characters"),section:"content",test:e=>({value:e.postContent.length||0})},{id:"sentences",type:"stats",label:__("sentences"),section:"content",test:e=>{var{postContent:e}=e,e=(e=e.replace(/(\r\n|\n|\r)/gm," ")).split(/\.|\?|!/);return{value:(e=(e=e.map(e=>e.trim())).filter(e=>e&&" "!==e&&"\n"!==e)).length||0}}},{id:"paragraphs",type:"stats",label:__("paragraphs"),section:"content",test:e=>({value:seoHelper.countElements(e.postContent,"p")})},{id:"headings",type:"stats",label:__("Headings"),inPro:!0,section:"content"},{id:"optimal-heading-number",type:"check",label:__("Optimal number of headings"),inPro:!0,section:"content"},{id:"images",type:"stats",label:__("Images"),inPro:!0,section:"content"},{id:"optimal-image-number",type:"check",label:__("Optimal number of images"),inPro:!0,section:"content"},{id:"too-long-headings",type:"check",label:__("No too long headings"),inPro:!0,section:"content"},{id:"toc-block",type:"check",label:__("Use Table of Contents block"),inPro:!0,section:"content"},{id:"keyword-exists",type:"check",label:__("Keyword is provided"),section:"keyword",test:e=>e.keyword?"ok":"nok"},{id:"keyword-unique",type:"check",label:__("Focus Keyword not used before"),section:"keyword",test:async a=>{var l=document.querySelector(".keyword-unique");if(a.keyword){let e=new URLSearchParams(window.location.search);var n=Object.fromEntries(e.entries()),n=`${diagnoseoRestUrl}diagnoseo/v1/check-posts-keyword/${a.keyword}/${n.post||0}`;let t=0===await(await fetch(n)).json()?"ok":"nok";l?l&&(l.classList.remove("ok","nok"),l.classList.add(t)):setTimeout(()=>{(l=document.querySelector(".keyword-unique"))&&(l.classList.remove("ok","nok"),l.classList.add(t))},200)}else l&&l.classList.add("ok")}},{id:"keyword-in-title",type:"check",label:__("Keyword present in title tag"),section:"keyword",test:e=>{var{keyword:t,postTitle:a,metaTitle:e}=e,a=e||a;return seoHelper.isKeywordInText(t,a)?"ok":"nok"}},{id:"keyword-in-title-beginning",type:"check",label:__("Keyword in the beginning of the title tag"),section:"keyword",test:e=>{var{keyword:t,postTitle:a,metaTitle:e}=e;if(!t)return"nok";a=(a=e||a).toLowerCase(),t=t.toLowerCase();const l=new RegExp("^"+t);return l.test(a)?"ok":"nok"}},{id:"keyword-in-descr",type:"check",label:__("Keyword present in meta description tag"),section:"keyword",test:e=>{var{keyword:t,metaDescription:e}=e;return seoHelper.isKeywordInText(t,e)?"ok":"nok"}},{id:"keyword-in-slug",type:"check",label:__("Keyword present in URL slug"),section:"keyword",test:e=>{var{keyword:t,slug:a,postTitle:e}=e;return t&&(a=a||seoHelper.slugify(e)).includes(seoHelper.slugify(t))?"ok":"nok"}},{id:"slug-length-ok",type:"check",label:__("URL slug length"),section:"keyword",test:e=>{var{slug:t,postTitle:e}=e;if(!t&&!e)return"nok";if((t=t||seoHelper.slugify(e)).length<=60&&t.split("-").length<=5)return"ok";return"nok"}},{id:"keyword-in-h1",type:"check",label:__("Keyword present in H1 element"),section:"keyword",test:e=>{var{keyword:t,postContent:a,postTitle:e}=e;return seoHelper.isKeywordInText(t,e)||seoHelper.isKeywordInAnyElement(t,a,"h1")?"ok":"nok"}},{id:"keyword-in-image-alt",type:"check",label:__("Keyword present in any image alt attribute"),section:"keyword",test:e=>{var{keyword:t,postContent:a,featuredImage:e}=e;return seoHelper.isKeywordInAnyAlt(t,a,e)?"ok":"nok"}},{id:"keyword-in-image-filename",type:"check",label:__("Keyword in image file name"),section:"keyword",inPro:!0,hidden:!0},{id:"keyword-not-in-ext-link",type:"check",label:__("Keyword NOT present in external link text"),section:"keyword",test:e=>{const{keyword:a,postContent:t}=e;if(!a)return"ok";const l=seoHelper.createMarkupEl(t);var n=!1;const i=l.querySelectorAll("a");return i.forEach(e=>{const t=e.getAttribute("href")||"";t.includes("http://"+window.location.hostname)||t.includes("https://"+window.location.hostname)||"/"===t.substr(0,1)||"./"===t.substr(0,2)||!seoHelper.isKeywordInText(a,e.textContent)||(n=!0)}),n?"nok":"ok"}},{id:"keyword-in-first-words",type:"check",label:__("Keyword present within first 100 words"),section:"keyword",test:e=>{var{keyword:t,postContent:e}=e;if(!t)return"nok";var t=t.trim(),a=(e=seoHelper.stripTags(e)).toLowerCase().split(/\s|\n/),l=100<=(a=a.filter(e=>e)).length?100:a.length;if(a=a.splice(0,l),!seoHelper.isKeywordInText(t,a.join(" ")))return"nok";if(1<t.split(" ").length)return"ok";if(a.length)for(let e=0;e<l;e++)a[e]=a[e].replace(".",""),a[e]=a[e].replace(",",""),a[e]=a[e].replace("?",""),a[e]=a[e].replace("!",""),a[e]=a[e].replace(":",""),a[e]=a[e].replace(";","");return a.includes(t)?"ok":"nok"}},{id:"more",type:"check",label:__("Many more powerful SEO checkpoints"),inPro:!0,section:"content"},{id:"more",type:"check",label:__("Many more powerful SEO checkpoints"),inPro:!0,section:"keyword"}],checkResults:{}},function(){"use strict";function l(){return(0,c.createElement)("svg",{"enable-background":"new 0 0 20 20",height:"20",width:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",className:"diagnoseo-icon"},(0,c.createElement)("clipPath",{id:"a"},(0,c.createElement)("path",{d:"m0 0h20v20h-20z"})),(0,c.createElement)("path",{className:"diagnoseo-icon-part-tick",d:"m12.377 5.866 1.835 1.612-4.839 5.508-4.11-3.576 1.672-1.902 2.256 1.982z"}),(0,c.createElement)("path",{className:"diagnoseo-icon-part-magnifier","clip-path":"url(#a)",d:"m16.298 15.209c1.745-1.983 2.548-4.603 2.208-7.228-.315-2.426-1.555-4.584-3.493-6.077s-4.341-2.139-6.768-1.828c-2.426.315-4.584 1.555-6.077 3.493s-2.142 4.341-1.827 6.767c.649 5.007 5.251 8.554 10.259 7.905 1.441-.188 2.824-.717 4.014-1.536l3.749 3.295 1.476-1.68zm-1.471-1.887c-1.111 1.443-2.72 2.368-4.527 2.602-1.808.235-3.598-.247-5.041-1.361-1.444-1.111-2.368-2.719-2.602-4.527-.483-3.73 2.158-7.158 5.889-7.642.296-.038.59-.057.881-.057 3.375 0 6.316 2.511 6.761 5.946.235 1.806-.249 3.596-1.361 5.039"}))}var c=window.wp.element,e=window.wp.plugins,i=window.wp.data;class t extends React.Component{constructor(e){super(e),this.state={score:0,timeout:null},this.handleCheckChanged=this.handleCheckChanged.bind(this),this.calculateScore=this.calculateScore.bind(this),this.runAllChecks=this.runAllChecks.bind(this)}calculateScore(){const e=window.diagnoseo.checks.filter(e=>"check"===e.type);var t=e.length+1,a=e.filter(e=>e.checked),a=window.diagnoseo.additionalKeywordCount===window.diagnoseo.RelatedKeywordsInPost?a.length+1:a.length,t=Math.round(100*a/t);this.setState({score:t})}runAllChecks(){const e=window.diagnoseo.checks.filter(e=>"check"===e.type),n={postTitle:(0,i.select)("core/editor").getEditedPostAttribute("title"),postContent:(0,i.select)("core/editor").getEditedPostContent(),keyword:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_keyword,featuredImageId:(0,i.select)("core/editor").getEditedPostAttribute("featured_media"),featuredImage:(0,i.select)("core").getMedia((0,i.select)("core/editor").getEditedPostAttribute("featured_media")),metaTitle:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_title,metaDescription:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_description,slug:(0,i.select)("core/editor").getEditedPostAttribute("slug"),blocks:(0,i.select)("core/block-editor").getBlocks(),optimalKeywordDensity:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_keyword_density,optimalWordNumber:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_word_number,optimalHeadingNumber:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_heading_number,optimalImageNumber:(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_image_number};var t;!n.featuredImageId||n.featuredImage?(n.metaTitle=seoHelper.replaceVariables(n.metaTitle)||(document.querySelector("#seo-title")?seoHelper.replaceVariables(document.querySelector("#seo-title").getAttribute("placeholder")):""),n.metaDescription=seoHelper.replaceVariables(n.metaDescription)||(document.querySelector("#seo-description")?seoHelper.replaceVariables(document.querySelector("#seo-description").value):""),e.forEach((t,e)=>{var a,l;t.test&&(a="ok"===t.test(n),l=window.diagnoseo.checks.findIndex(e=>e.id===t.id),window.diagnoseo.checks[l].checked=a)}),this.calculateScore()):t=setInterval(()=>{(0,i.select)("core").getMedia(n.featuredImageId)&&(clearInterval(t),this.runAllChecks())},500)}handleCheckChanged(){clearTimeout(this.state.timeout),this.setState({timeout:setTimeout(this.calculateScore,300)})}async componentDidMount(){window.addEventListener("check-changed",this.handleCheckChanged),setTimeout(this.runAllChecks,1e3)}componentWillUnmount(){window.removeEventListener("check-changed",this.handleCheckChanged)}render(){let e,t=this.state.score;switch(!0){case t<60:e="score-low";break;case 60<=t&&t<80:e="score-medium";break;case 80<=t:e="score-high"}var a=`diagnoseo-button-content ${e}`;return(0,c.createElement)("span",{className:a},(0,c.createElement)(l,null),(0,c.createElement)("b",{className:"diagnoseo-score"},this.state.score,"/100"))}whenEditorIsReady(){return new Promise(e=>{const t=(0,i.subscribe)(()=>{((0,i.select)("core/editor").isCleanNewPost()||0<(0,i.select)("core/block-editor").getBlockCount())&&(t(),e())})})}}var a=t,n=window.wp.editPost,u=window.wp.components,p=window.wp.i18n,o=window.wp.compose,r=(0,o.compose)((0,i.withDispatch)((a,l)=>({setMetaValue:e=>{var t={};t[l.fieldName]=e,a("core/editor").editPost({meta:t}),l.changeCallback&&l.changeCallback(e)}})),(0,i.withSelect)((e,t)=>({metaValue:e("core/editor").getEditedPostAttribute("meta")[t.fieldName]})))(t=>(0,c.createElement)(u.TextControl,{label:t.label,value:t.metaValue,onChange:e=>t.setMetaValue(e)})),s=(0,o.compose)((0,i.withSelect)(e=>({content:e("core/editor").getEditedPostContent(),keyword:e("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_keyword,optimalKeywordDensity:e("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_keyword_density})))(e=>{var t,a,l=0;e.keyword&&(a=(a=(t=(t=(t=e.content.replace(/<\!--.*?-->/g,"")).replace(/(\r\n|\n|\r)/gm," ")).toLowerCase()).split(" ")).filter(e=>""!==e),(t=seoHelper.countOccurences(e.keyword,t))&&(l=(l=t/a.length*100).toFixed(2)));let n;return n=window.diagnoseoPro?(a="diagnoseo-check optimal-keyword-density",parseFloat(e.optimalKeywordDensity),parseFloat(e.optimalKeywordDensity),(0,c.createElement)("p",{className:a+=1<=l&&l<=3?" ok":" nok"},(0,p.__)("Optimal keyword density","diagnoseo")," ",(0,c.createElement)("b",{className:"value"},"1% - 3%"))):(0,c.createElement)("p",{className:"diagnoseo-check optimal-keyword-density"},(0,c.createElement)("i",{className:"dashicons dashicons-lock"})," ",(0,p.__)("Optimal keyword density","diagnoseo")),(0,c.createElement)(c.Fragment,null,(0,c.createElement)("p",{className:"diagnoseo-stats keyword-density"},(0,p.__)("Keyword density","diagnoseo")," ",(0,c.createElement)("b",{className:"value"},l,"%")),n)}),d=t=>{let e=["diagnoseo-check",t.id];var a;if(t.test&&("string"==typeof(a=t.test(t.postData))&&e.push(a),l="ok"===a,a=t.checkConfig.findIndex(e=>e.id===t.id),t.checkConfig[a].checked!==l&&window.dispatchEvent(new Event("check-changed")),t.checkConfig[a].checked=l),t.inPro)return(0,c.createElement)("p",{className:e.join(" ")},(0,c.createElement)("i",{className:"dashicons dashicons-lock"})," ",t.label," ",(0,c.createElement)("b",null,(0,c.createElement)("a",{href:"https://diagnoseo.com/wordpress-seo-plugin/?utm_source=wp&utm_medium=link&utm_campaign=available_in_pro",target:"_blank",rel:"noreferrer noopener"},(0,p.__)("Available in Pro","diagnoseo"))));var l=t.valueFieldName&&t.postData[t.valueFieldName]?(0,c.createElement)("b",null,t.postData[t.valueFieldName]):"";return(0,c.createElement)("p",{className:e.join(" ")},t.label," ",l)},m=e=>{let t=["diagnoseo-stats",e.id];if(e.inPro)return(0,c.createElement)("p",{className:t.join(" ")},(0,c.createElement)("i",{className:"dashicons dashicons-lock"})," ",e.label," ",(0,c.createElement)("b",null,(0,c.createElement)("a",{href:"https://diagnoseo.com/wordpress-seo-plugin/?utm_source=wp&utm_medium=link&utm_campaign=available_in_pro",target:"_blank",rel:"noreferrer noopener"},(0,p.__)("Available in Pro","diagnoseo"))));let a,l=(0,c.createElement)("b",{className:"value"}),n="";var i;return e.test&&(i=e.test(e.postData),l=(0,c.createElement)("b",{className:"value"},i.value),n=i.comment?(0,c.createElement)("span",{className:"comment"},i.comment):"",i.status&&t.push(i.status)),a=e.order&&"value label"!==e.order?(0,c.createElement)(c.Fragment,null,e.label," ",l," ",n):(0,c.createElement)(c.Fragment,null,l," ",e.label),(0,c.createElement)("p",{className:t.join(" ")},a)},y=(0,o.compose)((0,i.withSelect)(e=>({postTitle:e("core/editor").getEditedPostAttribute("title"),postContent:e("core/editor").getEditedPostContent(),featuredImage:e("core").getMedia(e("core/editor").getEditedPostAttribute("featured_media")),keyword:e("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_keyword,metaTitle:e("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_title,metaDescription:e("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_description,urlSlug:e("core/editor").getEditedPostAttribute("slug"),blocks:e("core/block-editor").getBlocks(),optimalKeywordDensity:2,optimalWordNumber:300,optimalHeadingNumber:1,optimalImageNumber:e("core/editor").getEditedPostAttribute("meta").diagnoseo_optimal_image_number,postType:e("core/editor").getCurrentPostType()})))(a=>{const l=window.diagnoseo.checks,e=l.filter(e=>e.section===a.sectionName),n={postTitle:a.postTitle,postContent:a.postContent,keyword:a.keyword,metaTitle:seoHelper.replaceVariables(a.metaTitle)||(document.querySelector("#seo-title")?seoHelper.replaceVariables(document.querySelector("#seo-title").getAttribute("placeholder")):""),metaDescription:seoHelper.replaceVariables(a.metaDescription)||(document.querySelector("#seo-description")?seoHelper.replaceVariables(document.querySelector("#seo-description").value):""),slug:a.urlSlug,blocks:a.blocks,featuredImage:a.featuredImage,optimalKeywordDensity:a.optimalKeywordDensity,optimalWordNumber:a.optimalWordNumber,optimalHeadingNumber:a.optimalHeadingNumber,optimalImageNumber:a.optimalImageNumber},t=e.map(e=>{let t=!0;if(e.postTypes&&(t=e.postTypes.includes(a.postType)),!e.hidden&&t)switch(e.type){case"check":return e.inPro?(0,c.createElement)(d,{id:e.id,label:e.label,inPro:e.inPro}):(0,c.createElement)(d,{id:e.id,label:e.label,test:e.test,postData:n,checkConfig:l,valueFieldName:e.valueFieldName});case"stats":return e.inPro?(0,c.createElement)(m,{id:e.id,label:e.label,inPro:e.inPro}):(0,c.createElement)(m,{id:e.id,label:e.label,test:e.test,order:e.order,postData:n})}});return(0,c.createElement)(c.Fragment,null,t.map((e,t)=>(0,c.createElement)(React.Fragment,{key:t},e)))});class g extends React.Component{constructor(e){super(e),this.state={keyword:"",keywordList:[],keywordLimit:(window.diagnoseoPro||window.diagnoseo).additionalKeywordLimit,apiKey:"",language:diagnoseo_settings?diagnoseo_settings.locale.substr(0,2):"",loading:!1},this.handleChange=this.handleChange.bind(this),this.handleLangChange=this.handleLangChange.bind(this),this.handleLoadButtonClick=this.handleLoadButtonClick.bind(this),this.relatedKeywordsApiUrl="diagnoseo/v1/related-keywords"}stripKeywordData(e){return(e=-1===e.indexOf("|")?e:e.substr(0,e.indexOf(" |"))).trim()}async loadRelatedKeywords(){var t=(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_keyword,a=(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_language;if(t)if(this.state.language){this.setState({loading:!0});let e=await this.getRelatedKeywords(t,a);if(e=e.split(","),e.length){let a=this.state.keywordList;e.forEach(t=>{t={name:t.trim()};var e=a.findIndex(e=>e.name===t);-1===e?a.push(t):(a[e].repeat_min=t.repeat_min,a[e].repeat_max=t.repeat_max)}),this.saveKeywords(a)}this.setState({loading:!1})}else alert((0,p.__)("Please select language.","diagnoseo"));else alert((0,p.__)('Please enter the "focus keyword" first',"diagnoseo"))}saveKeywords(e){const t=[...new Set(e)];t.splice(this.state.keywordLimit),this.setState({keywordList:t}),(window.onbeforeunload=null,i.dispatch)("core/editor").editPost({meta:{diagnoseo_meta_additional_keywords:JSON.stringify(t)}})}saveLanguage(e){(0,i.dispatch)("core/editor").editPost({meta:{diagnoseo_meta_language:e}})}componentDidMount(){let e=(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_additional_keywords,t=(0,i.select)("core/editor").getEditedPostAttribute("meta").diagnoseo_meta_language;try{e=JSON.parse(e)}catch{e=""}this.setState({language:t,keyword:this.props.focusKeyword,keywordList:e||[]})}async handleLoadButtonClick(){window.diagnoseoPro?this.loadRelatedKeywords():alert((0,p.__)("Related keywords and Pro data require DiagnoSEO Pro.","diagnoseo"))}handleChange(e){const l=this.state.keywordList,{stripKeywordData:n}=this;e=e.map(e=>{let t=n(e.value||e),a=l.findIndex(e=>t===e.name);return{name:t,repeat_min:-1!==a?l[a].repeat_min:0,repeat_max:-1!==a?l[a].repeat_max:0}});this.saveKeywords(e)}handleLangChange(e){this.setState({language:e}),this.saveLanguage(e)}render(){let{postTitle:i,postContent:o,featuredMedia:r}=this.props;const{countOccurences:s}=seoHelper;let d=0,e=this.state.keywordList.map(e=>{let t=e.name||"",a="error",l=function(e){o=seoHelper.stripTags(o);var t=0;return t+=s(e,i),t+=s(e,o),t+=seoHelper.isKeywordInAnyAlt(e,o),t+=r?s(e,r.alt_text):0}(t);l&&(a=!e.repeat_min||!e.repeat_max||l>=e.repeat_min&&l<=e.repeat_max?"success":"validating",d++);let n=` | ${l}`;return e.repeat_min&&e.repeat_max&&(n+=` (${e.repeat_min} - ${e.repeat_max})`),{value:t+n,status:a}}),t=!1;window.diagnoseo.RelatedKeywordsInPost!==d&&(window.diagnoseo.RelatedKeywordsInPost=d,t=!0),window.diagnoseo.additionalKeywordCount!==e.length&&(window.diagnoseo.additionalKeywordCount=e.length,t=!0),t&&window.dispatchEvent(new Event("check-changed"));var a=this.state.loading?(0,p.__)("Please wait... Loading related keywords. It can take up to a few minutes.","diagnoseo"):(0,c.createElement)("button",{className:"button get-related-keywords",onClick:this.handleLoadButtonClick},(0,p.__)("Get related keywords and Pro data","diagnoseo"));return(0,c.createElement)(c.Fragment,null,(0,c.createElement)("div",{className:"components-base-control__field add-keyword diagnoseo-related-keywords"},(0,c.createElement)(u.FormTokenField,{label:(0,c.createElement)("b",null,(0,p.__)("Related keywords","diagnoseo")),onChange:this.handleChange,value:e,maxLength:this.state.keywordLimit+10}),(0,c.createElement)("p",{className:"components-form-token-field__help"},(0,p.__)("Limits: 10 keywords in free, 100 keywords in Pro","diagnoseo")),(0,c.createElement)(u.SelectControl,{options:[{value:"chinese",label:"Taiwan"},{value:"arabic",label:"Bahrain"},{value:"bulgarian",label:"Bulgaria"},{value:"croatian",label:"Croatia"},{value:"czech",label:"Czechia"},{value:"danish",label:"Denmark"},{value:"dutch",label:"Netherlands"},{value:"english",label:"United States"},{value:"finnish",label:"Finland"},{value:"french",label:"France"},{value:"austrian",label:"Austria"},{value:"greek",label:"Cyprus"},{value:"israeli",label:"Israel"},{value:"indian",label:"India"},{value:"hungarian",label:"Hungary"},{value:"indonesian",label:"Indonesia"},{value:"italian",label:"Italy"},{value:"japanese",label:"Japan"},{value:"korean",label:"South Korea"},{value:"latvian",label:"Latvia"},{value:"lithuanian",label:"Lithuania"},{value:"norwegian",label:"Norway"},{value:"polish",label:"Poland"},{value:"portugese",label:"Portugal"},{value:"romanian",label:"Romania"},{value:"russian",label:"Russia"},{value:"serbian",label:"Serbia"},{value:"slovak",label:"Slovakia"},{value:"slovenian",label:"Slovenia"},{value:"spanish",label:"Argentina"},{value:"swedish",label:"Sweden"},{value:"thai",label:"Thailand"},{value:"turkish",label:"Turkey"},{value:"ukrainian",label:"Ukraine"},{value:"vietnamese",label:"Vietnam"}],value:this.state.language,onChange:this.handleLangChange,label:(0,p.__)("Language","diagnoseo")}),(0,c.createElement)("p",null,a)))}getRelatedKeywords(a,l){return new Promise(t=>{const e=new FormData;e.append("keyword",a),e.append("language",l),e.append("count",30),fetch("/wp-json/diagnoseo/v1/related-keywords",{method:"POST",body:e}).then(e=>e.json()).then(e=>{"ok"===e.status?t(e.keywords):t("")}).catch(e=>{console.error(e),t("")})})}}var b=(0,o.compose)((0,i.withSelect)(e=>{var t=e("core/editor").getEditedPostAttribute("featured_media");return{postTitle:e("core/editor").getEditedPostAttribute("title"),postContent:e("core/editor").getEditedPostContent(),featuredMedia:e("core").getMedia(t,{context:"embed"})||{}}}))(e=>(0,c.createElement)(g,{postTitle:e.postTitle,postContent:e.postContent,featuredMedia:e.featuredMedia,seoDataCollector:e.seoDataCollector})),v=(0,o.compose)((0,i.withSelect)(e=>{if(!window.diagnoseoPro)return{};e={categories:e("core/editor").getEditedPostAttribute("categories"),status:"publish",per_page:10,exclude:[e("core/editor").getEditedPostAttribute("id")]};return{suggestedPosts:wp.data.select("core").getEntityRecords("postType","post",e)||[]}}))(e=>{if(window.diagnoseoPro){var t="";return t=e.suggestedPosts.length?(t=e.suggestedPosts.map(e=>(0,c.createElement)("li",null,(0,c.createElement)("a",{href:e.link},e.title.raw))),(0,c.createElement)("ol",null,t)):(0,c.createElement)("p",null,(0,p.__)("Could not prepare suggestions as there are no posts related to this one"))}return(0,c.createElement)("p",null,(0,c.createElement)("b",null,(0,c.createElement)("a",{href:"https://diagnoseo.com/wordpress-seo-plugin/?utm_source=wp&utm_medium=link&utm_campaign=available_in_pro",target:"_blank",rel:"noreferrer noopener"},(0,p.__)("Available in Pro","diagnoseo"))))}),o=(0,o.compose)((0,i.withDispatch)(t=>({setMetaValues:e=>{t("core/editor").editPost({meta:{diagnoseo_optimal_word_number:e.number_of_words.toString(),diagnoseo_optimal_keyword_density:e.focus_keyword_density.toString(),diagnoseo_optimal_heading_number:e.number_of_headings.toString(),diagnoseo_optimal_image_number:e.number_of_images.toString()}})}})))(e=>{var t=window.diagnoseoPro?"DiagnoSEO Pro":"DiagnoSEO";return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(n.PluginSidebarMoreMenuItem,{target:"diagnoseo-content-analyzer"},(0,p.__)("DiagnoSEO Content Watcher","diagnoseo")),(0,c.createElement)(n.PluginSidebar,{title:t,name:"diagnoseo-content-analyzer"},(0,c.createElement)(u.PanelBody,{title:(0,p.__)("Content analyzer","diagnoseo"),initialOpen:"true"},(0,c.createElement)(y,{sectionName:"content"})),(0,c.createElement)(u.PanelBody,{title:(0,p.__)("Keyword placement","diagnoseo"),initialOpen:"true"},(0,c.createElement)(r,{fieldName:"diagnoseo_meta_keyword",label:(0,c.createElement)("b",null,(0,p.__)("Focus keyword","diagnoseo"))}),(0,c.createElement)(s,null),(0,c.createElement)(b,{seoDataCollector:e.setMetaValues}),(0,c.createElement)(y,{sectionName:"keyword"})),(0,c.createElement)(u.PanelBody,{title:(0,p.__)("Internal linking suggestions","diagnoseo"),initialOpen:"true"},(0,c.createElement)(v,null))))});(0,e.registerPlugin)("diagnoseo-sidebar",{icon:(0,c.createElement)(a,null),render:o})}();class diagnoseoFormHelper{input(e,t,a,l="text",n=!1,i="1",o={}){const r=document.createElement("input");for(var s in this.setAttributes(r,{type:l,name:e,id:e,class:a||"components-textarea-control__input widefat",value:t,step:"number"===l?i:""}),n&&r.setAttribute("required","required"),o)r.addEventListener(s,o[s]);return r.addEventListener("input",this.saveSchemaData),r}textarea(e,t,a,l=!1,n={}){const i=document.createElement("textarea");for(var o in this.setAttributes(i,{name:e,id:e,class:a||"components-textarea-control__input widefat"}),i.value=t,l&&i.setAttribute("required","required"),n)i.addEventListener(o,n[o]);return i.addEventListener("input",this.saveSchemaData),i}select(e,a,t,l,n=!1,i={}){const o=document.createElement("select");for(var r in o.value=a,this.setAttributes(o,{name:e,id:e,class:l||"widefat"}),n&&o.setAttribute("required","required"),t.forEach(e=>{const t=document.createElement("option");t.setAttribute("value",e.value),t.textContent=e.label,e.value===a&&t.setAttribute("selected","selected"),o.appendChild(t)}),i)o.addEventListener(r,i[r]);return o.addEventListener("change",this.saveSchemaData),o}button(e,t,a,l,n="",i={}){const o=document.createElement("button");for(var r in o.textContent=a,this.setAttributes(o,{name:e,id:e,class:l,value:t,type:n||""}),i)o.addEventListener(r,i[r]);return o}sectionTitle(e){if(e){const t=document.createElement("h3");return t.classList.add("components-base-control__heading"),t.textContent=e,t}}wrapField(e,t,a="",l="components-base-control__field"){const n=document.createElement("div");l&&n.classList.add(l);const i=document.createElement("label");if(i.classList.add("components-base-control__label"),i.setAttribute("for",e.getAttribute("id")),i.textContent=t,e.getAttribute("required")){const o=document.createElement("span");o.classList.add("req"),o.textContent="*",i.appendChild(o)}if(n.appendChild(i),n.appendChild(e),a){const r=document.createElement("p");r.classList.add("hint"),r.textContent=a,n.appendChild(r)}return n}setAttributes(e,t){for(var a in t)e.setAttribute(a,t[a])}prepareField(e){var t,{fieldType:a,label:l,name:n,value:i,type:o,className:r,options:s,listeners:d,required:c,hint:e,text:u,step:p}=e;switch(a){case"input":t=this.input(n,i,r,o,c,p,d);break;case"textarea":t=this.textarea(n,i,r,c,d);break;case"select":t=this.select(n,i,s,r,c,d);break;case"button":t=this.button(n,i,l,r,o,d);break;case"sectionTitle":t=this.sectionTitle(u)}return"button"===a||"sectionTitle"===a?t:this.wrapField(t,l,e)}saveSchemaData(e){const n=e.target.closest(".diagnoseo-schema-form");if(n){const i={};n.formConfig.forEach(t=>{if("sectionTitle"!==t.fieldType){let e=t.name;var l=e.replaceAll("-","_");let a=n.querySelector(`#${e}`).value||"";t.splitLines&&(a=a.split(t.splitLines),a.forEach((e,t)=>{a[t]=e.trim()})),i[l]=a}});const t=document.querySelector("#schema-data");t.value=JSON.stringify(i);let e=document.querySelector(".diagnoseo-schema-generator");e.setAttribute("data-schema-data",t.value)}}buildSchemaForm(e){const t=document.createElement("div");return t.classList.add("diagnoseo-schema-form"),e.forEach(e=>{e=this.prepareField(e);t.appendChild(e)}),t.formConfig=e,t}}function permalinkWatcher(){"use strict";if(window.wp.data){var e,t=document.body.classList.contains("block-editor-page");const a=document.querySelector("#seo-slug"),l=document.querySelector(".editor-post-link input");a.addEventListener("input",e=>{const t=document.querySelector(".editor-post-link input");e=e.target.value;t&&t.value!==e&&(t.value=e,e=new Event("blur"),t.dispatchEvent(e))}),l&&(l.addEventListener("input",e=>{a.value!==e.target.value&&(a.value=e.target.value)}),a.value&&l&&l.value!==a.value&&(l.value=a.value,e=new Event("blur"),l.dispatchEvent(e))),t&&window.wp.data.subscribe(function(){var e=window.wp.data.select("core/editor").isSavingPost(),t=window.wp.data.select("core/editor").isAutosavingPost();e&&!t&&setTimeout(()=>{const e=document.querySelector("#seo-slug"),t=document.querySelector(".editor-post-link input");var a;e.value&&t?(a=seoHelper.slugify(e.value),e.value=a,t.value=a,a=new Event("blur"),t.dispatchEvent(a)):!e.value&&t&&(a=seoHelper.slugify(t.value),e.value=a)},500)})}}document.addEventListener("DOMContentLoaded",function(){"use strict";const e=document.querySelectorAll(".meta-template");e.forEach(e=>{const n=e.querySelector(".choose-variable"),t=e.querySelector(".add-variable"),i=e.querySelector("input, textarea");t&&t.addEventListener("click",e=>{e.preventDefault();var t,a,l=n.value;i.selectionStart||"0"==i.selectionStart?(t=i.selectionStart,a=i.selectionEnd,e=parseInt(t)?" ":"",i.value=i.value.substring(0,t)+e+l+i.value.substring(a,i.value.length)):i.value+=l,i.dispatchEvent(new Event("input"))})})}),document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".diagnoseo-image-select");e.forEach(n=>{const e=n.querySelector(".diagnoseo-img-upload"),l=n.querySelector(".diagnoseo-img-remove");e&&e.addEventListener("click",e=>{e.preventDefault();const l=wp.media({title:"Custom Image",button:{text:"Select Image"},multiple:!1}).on("select",()=>{var e=l.state().get("selection").first().toJSON();const t=n.querySelector(".diagnoseo-img"),a=n.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",e.url),a&&(a.value=e.url)}).open()}),l&&l.addEventListener("click",e=>{e.preventDefault();const t=n.querySelector(".diagnoseo-img"),a=n.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",l.dataset.fallbackImage||""),a&&(a.value="")})})}),window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(permalinkWatcher,500)});const schemaGeneratorInit=function(){var e,r="",t="";const a=function(e,t=!1){var a=null,l={},n=document.querySelector(".diagnoseo-schema-generator");n&&(l=(l=n.dataset.schemaData)&&JSON.parse(l));const i=["Article","NewsArticle","BlogPosting"];if(!t&&i.includes(e)&&i.includes(r))return r=e,!1;switch(r=e){case"Article":case"NewsArticle":case"BlogPosting":a=articleSchemaForm(l);break;case"Review":a=reviewSchemaForm(l);break;case"Service":a=serviceSchemaForm(l);break;case"Product":a=productSchemaForm(l);break;case"Course":a=courseSchemaForm(l);break;case"Recipe":a=recipeSchemaForm(l);break;case"Person":a=personSchemaForm(l);break;case"JobPosting":a=jobPostingSchemaForm(l);break;case"SoftwareApplication":a=appSchemaForm(l);break;case"Book":a=bookSchemaForm(l);break;case"Event":a=eventSchemaForm(l);break;case"VideoObject":a=videoSchemaForm(l);break;case"ImageObject":a=imageSchemaForm(l);break;case"WebPage":a=webPageSchemaForm(l);break;case"AboutPage":a=aboutPageSchemaForm(l);break;case"FAQPage":a=faqPageSchemaForm(l);break;case"ContactPage":a=contactPageSchemaForm(l);break;default:a=null}const o=document.querySelector(".diagnoseo-schema-fields");return a?(o&&(o.innerHTML="",o.appendChild(a)),!0):(o&&(o.innerHTML=""),!1)},l=function(){const t=document.querySelector(".diagnoseo-schema-generator");if(t){var{schemaData:a}=t.dataset;if(a)for(prop in a=JSON.parse(a)){var l=prop.replaceAll("_","-");let e=t.querySelector(`#${l}`);e&&!e.value&&(e.value=a[prop])}}},n=document.querySelector("#schema-type");n&&(n.addEventListener("change",e=>{a(e.target.value)&&l()}),(e=document.querySelector(".diagnoseo-schema-generator"))&&(t=e.dataset.defaultSchemaType),r=n.value||""),a(r||t,!0),l()};window.addEventListener("load",schemaGeneratorInit);const aboutPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},appSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"operating-system",type:"text",value:e.operating_system||"",label:"Operating system"},{fieldType:"input",name:"app-category",type:"text",value:e.app_category||"",label:"Application category",hint:"Example: Multimedia, Game"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Currency"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"input",name:"rating-count",type:"number",value:e.rating_count,label:"Rating count"}];return t.buildSchemaForm(e)},articleSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"headline",type:"text",value:e.headline||"",label:"Headline"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"keywords",type:"text",value:e.keywords||"",label:"Keywords"}];return t.buildSchemaForm(e)},bookSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"input",name:"url",type:"url",value:e.url||"",label:"URL"},{fieldType:"input",name:"author-name",type:"text",value:e.author_name||"",label:"Author name"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"}];return t.buildSchemaForm(e)},contactPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},courseSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Course name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Course description"},{fieldType:"sectionTitle",text:"Provider"},{fieldType:"select",name:"provider-type",value:e.provider_type,label:"Provider type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"provider-name",type:"text",value:e.provider_name||"",label:"Provider name"},{fieldType:"input",name:"provider-url",type:"text",value:e.provider_url||"",label:"Provider URL"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},eventSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"select",name:"type",value:e.type,options:[{value:"Event",label:"Event"},{value:"BusinessEvent",label:"Business Event"},{value:"ChildrensEvent",label:"Childrens Event"},{value:"ComedyEvent",label:"Comedy Event"},{value:"DanceEvent",label:"Dance Event"},{value:"DeliveryEvent",label:"Delivery Event"},{value:"EducationEvent",label:"Education Event"},{value:"ExhibitionEvent",label:"Exhibition Event"},{value:"Festival",label:"Festival"},{value:"FoodEvent",label:"Food Event"},{value:"LiteraryEvent",label:"Literary Event"},{value:"MusicEvent",label:"Music Event"},{value:"PublicationEvent",label:"Publication Event"},{value:"SaleEvent",label:"Sale Event"},{value:"ScreeningEvent",label:"Screening Event"},{value:"SocialEvent",label:"Social Event"},{value:"SportsEvent",label:"Sports Event"},{value:"TheaterEvent",label:"Theater Event"},{value:"VisualArtsEvent",label:"Visual Arts Event"}],label:"Event type"},{fieldType:"select",name:"status",value:e.status,options:[{value:"",label:"None"},{value:"EventScheduled",label:"Scheduled"},{value:"EventCancelled",label:"Cancelled"},{value:"EventPostponed",label:"Postponed"},{value:"EventRescheduled",label:"Rescheduled"},{value:"EventMovedOnline",label:"Moved Online"}],label:"Event status"},{fieldType:"select",name:"mode",value:e.mode,options:[{value:"OfflineEventAttendanceMode",label:"Offline"},{value:"OnlineEventAttendanceMode",label:"Online"},{value:"MixedEventAttendanceMode",label:"Mixed (Offline + Online)"}],label:"Attendance mode"},{fieldType:"input",name:"date-start",type:"date",value:e.date_start,label:"Start date"},{fieldType:"input",name:"date-end",type:"date",value:e.date_end,label:"End date"},{fieldType:"sectionTitle",text:"Venue"},{fieldType:"input",name:"venue-name",type:"text",value:e.venue_name||"",label:"Venue name"},{fieldType:"input",name:"venue-url",type:"url",value:e.venue_url||"",label:"Venue URL"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"},{fieldType:"sectionTitle",text:"Performer"},{fieldType:"select",name:"performer-type",value:e.performer_type,options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}],label:"Performer"},{fieldType:"input",name:"performer-name",type:"text",value:e.performer_name||"",label:"Performer name"},{fieldType:"input",name:"performer-url",type:"url",value:e.performer_url||"",label:"Performer website or social link"},{fieldType:"sectionTitle",text:"Organizer"},{fieldType:"select",name:"organizer-type",value:e.organizer_type,options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}],label:"Organizer"},{fieldType:"input",name:"organizer-name",type:"text",value:e.organizer_name||"",label:"Organizer name"},{fieldType:"input",name:"organizer-url",type:"url",value:e.organizer_url||"",label:"Organizer website or social link"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-url",type:"url",value:e.offer_url||"",label:"Offer URL"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Offer price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Offer currency"},{fieldType:"select",name:"offer-availability",value:e.offer_availability,options:[{value:"InStock",label:"In Stock"},{value:"SoldOut",label:"Sold Out"},{value:"Preorder",label:"Preorder"}],label:"Availability"},{fieldType:"input",name:"price-valid-from",type:"date",value:e.price_valid_from,label:"Price valid from"},{fieldType:"input",name:"inv-level",type:"text",value:e.inv_level||"",label:"Inventory level"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"}];return t.buildSchemaForm(e)},faqPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"main-question",type:"text",value:e.main_question||"",label:"Main entity - question"},{fieldType:"textarea",name:"main-answer",type:"text",value:e.main_answer||"",label:"Main entity - answer"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},imageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"location",type:"text",value:e.location||"",label:"Location",hint:"Name of the place where the picture was taken, for example: Manhattan, New York"}];return t.buildSchemaForm(e)},jobPostingSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"salary-currency",type:"text",value:e.salary_currency||"",label:"Salary currency",hint:"ISO 4217 Currency code. Example: EUR"},{fieldType:"input",name:"salary-amount",type:"text",value:e.salary_amount||"",label:"Salary amount",hint:"Insert amount, e.g. 100.00, or a salary range, e.g. 120.00-160.00"},{fieldType:"select",name:"salary-payroll",value:e.salary_payroll,label:"Payroll",options:[{value:"None",label:""},{value:"Yearly",label:"YEAR"},{value:"Monthly",label:"MONTH"},{value:"Weekly",label:"WEEK"},{value:"Daily",label:"DAY"},{value:"Hourly",label:"HOUR"}]},{fieldType:"input",name:"date-posted",type:"date",value:e.date_posted,label:"Date posted",hint:"Choose date, post publication date will be used if this field is empty"},{fieldType:"input",name:"date-expires",type:"date",value:e.date_expires,label:"Expiry date",hint:"Leave empty if the job posting does not expire"},{fieldType:"select",name:"employment-type",value:e.employment_type,label:"Employment type",options:[{value:"FULL_TIME",label:"Full Time"},{value:"PART_TIME",label:"Part Time"},{value:"CONTRACTOR",label:"Contractor"},{value:"TEMPORARY",label:"Temporary"},{value:"INTERN",label:"Intern"},{value:"VOLUNTEER",label:"Volunteer"},{value:"PER_DIEM",label:"Per Diem"},{value:"OTHER",label:"Other"}]},{fieldType:"input",name:"posting-id",type:"text",value:e.posting_id||"",label:"Posting ID"},{fieldType:"sectionTitle",text:"Hiring organization"},{fieldType:"input",name:"company",type:"text",value:e.company||"",label:"Hiring organization"},{fieldType:"input",name:"org-url",type:"url",value:e.org_url||"",label:"Organization URL"},{fieldType:"input",name:"org-logo",type:"url",value:e.org_logo||"",label:"Organization logo URL"},{fieldType:"sectionTitle",text:"Job location"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"}];return t.buildSchemaForm(e)},personSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"email",type:"email",value:e.email||"",label:"E-mail"},{fieldType:"input",name:"gender",type:"text",value:e.gender||"",label:"Gender"},{fieldType:"input",name:"job-title",type:"text",value:e.job_title||"",label:"Job title"},{fieldType:"input",name:"url",type:"url",value:e.url||"",label:"URL"},{fieldType:"input",name:"image",type:"url",value:e.url||"",label:"Image URL"},{fieldType:"sectionTitle",text:"Address"},{fieldType:"input",name:"street-address",type:"text",value:e.street_address||"",label:"Street address"},{fieldType:"input",name:"locality",type:"text",value:e.locality||"",label:"Locality"},{fieldType:"input",name:"region",type:"text",value:e.region||"",label:"Region"},{fieldType:"input",name:"postal-code",type:"text",value:e.postal_code||"",label:"Postal code"},{fieldType:"input",name:"country",type:"text",value:e.country||"",label:"Country"}];return t.buildSchemaForm(e)},productSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Product name"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Product description"},{fieldType:"input",name:"sku",type:"text",value:e.sku||"",label:"Product SKU"},{fieldType:"input",name:"identifier_name",type:"text",value:e.identifier_name||"",label:"Global identifier",hint:"GTIN, MPN, ISBN or other"},{fieldType:"input",name:"identifier_value",type:"text",value:e.identifier_value||"",label:"Global identifier value"},{fieldType:"input",name:"brand",type:"text",value:e.brand||"",label:"Brand name"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"price",type:"number",value:e.price,label:"Price",step:"0.01"},{fieldType:"input",name:"currency",type:"text",value:e.currency||"",label:"Currency"},{fieldType:"input",name:"deadline",type:"date",value:e.deadline,label:"Price valid until"},{fieldType:"select",name:"availability",value:e.availability,options:[{label:"In Stock",value:"InStock"},{label:"Sold Out",value:"SoldOut"},{label:"Preorder",value:"Preorder"}],label:"Availability"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-min",type:"number",value:e.rating_min,label:"Rating minimum"},{fieldType:"input",name:"rating-max",type:"number",value:e.rating_max,label:"Rating maximum"},{fieldType:"sectionTitle",text:"Review publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},recipeSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"name",type:"text",value:e.name||"",label:"Recipe title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Recipe description"},{fieldType:"input",name:"prep-time",type:"text",value:e.prep_time||"",label:"Preparation time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"cook-time",type:"text",value:e.cook_time||"",label:"Cooking time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"total-time",type:"text",value:e.total_time||"",label:"Total time",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"type",type:"text",value:e.type||"",label:"Type of dish",hint:"Example: appetizer or dessert"},{fieldType:"input",name:"cuisine",type:"text",value:e.cuisine||"",label:"Cuisine"},{fieldType:"input",name:"keywords",type:"text",value:e.keywords||"",label:"Keywords"},{fieldType:"input",name:"yield",type:"text",value:e.yield||"",label:"Recipe yield",hint:"Quantity of portions produced by the recipe, for example: 4"},{fieldType:"input",name:"calories",type:"number",value:e.calories,label:"Calories"},{fieldType:"textarea",name:"ingredients",value:e.ingredients?e.ingredients.join("; "):"",label:"Ingredients",hint:"Separate ingredients with semicolons (;)",splitLines:";"},{fieldType:"textarea",name:"instructions",value:e.instructions?e.instructions.join("; "):"",label:"Recipe instructions",hint:"Separate instructions with semicolons (;)",splitLines:";"},{fieldType:"sectionTitle",text:"Aggregate Rating"},{fieldType:"input",name:"rating",type:"number",value:e.rating,label:"Rating",step:"0.01"},{fieldType:"input",name:"rating-count",type:"number",value:e.rating_count,label:"Rating count"},{fieldType:"sectionTitle",text:"Video"},{fieldType:"input",name:"video-title",type:"text",value:e.video_title||"",label:"Video title"},{fieldType:"textarea",name:"video-description",value:e.video_description||"",label:"Video description"},{fieldType:"input",name:"video-url",type:"url",value:e.video_url||"",label:"Video URL"},{fieldType:"input",name:"video-content-url",type:"url",value:e.video_content_url||"",label:"Video content URL",hint:"A URL pointing to the actual video media file"},{fieldType:"input",name:"video-thumbnail",type:"url",value:e.video_thumbnail||"",label:"Video thumbnail URL"},{fieldType:"input",name:"video-duration",type:"text",value:e.video_duration||"",label:"Video duration",hint:"ISO 8601 duration format. Example: PT1H30M"},{fieldType:"input",name:"video-uploaded",type:"date",value:e.video_uploaded,label:"Video upload date"}];return t.buildSchemaForm(e)},reviewSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Review title"},{fieldType:"sectionTitle",text:"Reviewed item"},{fieldType:"select",name:"reviewed-item",value:e.reviewed_item,label:"Reviewed item",options:[{value:"Book",label:"Book"},{value:"Course",label:"Course"},{value:"Event",label:"Event"},{value:"How-to",label:"How-to"},{value:"LocalBusiness",label:"Local Business"},{value:"Movie",label:"Movie"},{value:"Product",label:"Product"},{value:"Recipe",label:"Recipe"},{value:"SoftwareApp",label:"Software App"}]},{fieldType:"input",name:"reviewed-item-image",type:"url",value:e.reviewed_item_image||"",label:"Reviewed item image URL"},{fieldType:"input",name:"reviewed-item-name",type:"text",value:e.reviewed_item_name||"",label:"Reviewed item name"},{fieldType:"sectionTitle",text:"Rating"},{fieldType:"input",name:"rating",type:"number",step:"0.01",value:e.rating,label:"Rating value"},{fieldType:"textarea",name:"review-body",value:e.review_body||"",label:"Review text"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},serviceSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"service-type",type:"text",value:e.service_type||"",label:"Service type"},{fieldType:"input",name:"service-name",type:"text",value:e.service_name||"",label:"Name"},{fieldType:"textarea",name:"service-description",value:e.service_description||"",label:"Service description"},{fieldType:"sectionTitle",text:"Offer"},{fieldType:"input",name:"offer-price",type:"number",value:e.offer_price,label:"Price",step:"0.01"},{fieldType:"input",name:"offer-currency",type:"text",value:e.offer_currency||"",label:"Currency"}];return t.buildSchemaForm(e)},videoSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"input",name:"title",type:"text",value:e.title||"",label:"Title"},{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"input",name:"embed-url",type:"url",value:e.embed_url||"",label:"Embed URL",hint:"A URL pointing to the embeddable player for the video. Example: https://www.youtube.com/embed/VIDEOID"},{fieldType:"input",name:"content-url",type:"url",value:e.content_url||"",label:"Content URL",hint:"A URL pointing to the actual video media file like MP4, MOV, etc. Please leave it empty if you don't know the URL"},{fieldType:"input",name:"duration",type:"text",value:e.duration||"",label:"Duration",hint:"ISO 8601 duration format. Example: PT1H30M"}];return t.buildSchemaForm(e)},webPageSchemaForm=function(e){const t=new diagnoseoFormHelper;e=[{fieldType:"textarea",name:"description",value:e.description||"",label:"Description"},{fieldType:"sectionTitle",text:"Publisher"},{fieldType:"select",name:"publisher-type",value:e.publisher_type,label:"Publisher type",options:[{value:"Person",label:"Person"},{value:"Organization",label:"Organization"},{value:"ProfilePage",label:"Profile page"}]},{fieldType:"input",name:"publisher-name",type:"text",value:e.publisher_name||"",label:"Publisher name"}];return t.buildSchemaForm(e)},seoHelper={slugify:function(e){e=(e=e.replace(/^\s+|\s+$/g,"")).toLowerCase();for(var t="àáãäâąèéëêęìíïîóòóöôùúüûñńśçćźżł·/_,:;",a=0,l=t.length;a<l;a++)e=e.replace(new RegExp(t.charAt(a),"g"),"aaaaaaeeeeeiiiiooooouuuunnscczzl------".charAt(a));return e=e.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},countOccurences:function(e,t){if(!t||!e)return 0;t=t.toLowerCase().replaceAll(/[:;,.!?-]/g,""),e=e.toLowerCase();e=new RegExp(e,"g");return(t.match(e)||[]).length},countSyllables:function(e){if(""===e)return 0;if(e.length<=3)return 1;e=(e=(e=(e=e.toLowerCase()).replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,"")).replace(/^y/,"")).match(/[aeiouy]{1,2}/g);return e?e.length:0},countWords:function(e){e=(e=(e=e.replace(/(\r\n|\n|\r)/gm," ")).replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g," ")).split(" ");return(e=(e=e.map(e=>e.trim())).filter(e=>e&&""!==e&&"\n"!==e)).length||0},countElements:function(e,t){if(!e||!t)return 0;const a=document.createElement("div");return a.innerHTML=e,a.querySelectorAll(t).length},replaceVariables:function(e){if(e){var{site:t,siteTagline:a,separator:l,excerpt:n,postTitle:i}=document.querySelector(".diagnoseo-preview").dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",document.body.classList.contains("block-editor-page")?window.wp.data.select("core/editor").getEditedPostAttribute("title"):i)).replaceAll("%sitename%",t)).replaceAll("%tagline%",a)).replaceAll("%sep%",l)).replaceAll("%page%"," ")).replaceAll("%excerpt%",n)).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))}},isKeywordInText:function(e,t){if(!e||!t)return!1;e=e.toLowerCase();let a=(t=t.toLowerCase()).toLowerCase().replaceAll(/[:;,.!?-]/g,"");return t.includes(e)||a.includes(e)},isKeywordInAnyElement:function(t,e,a){if(!t||!e||!a)return!1;var l=!1;const n=seoHelper.createMarkupEl(e);return elements=n.querySelectorAll(a),elements.forEach(e=>{seoHelper.isKeywordInText(t,e.textContent)&&(l=!0)}),l},isKeywordInAnyAlt:function(t,e,a=null){if(!t)return!1;if(a&&seoHelper.isKeywordInText(t,a.alt_text))return!0;var l=0;const n=seoHelper.createMarkupEl(e),i=n.querySelectorAll("img");return i.forEach(e=>{e=e.getAttribute("alt").toLowerCase();l+=seoHelper.countOccurences(t,e)}),l},createMarkupEl:function(e){const t=document.createElement("div");return t.innerHTML=e,t},stripTags:function(e){return e.replace(/(<([^>]+)>)/gi,"")}};function initSerpSimulator(){"use strict";const o=document.body.classList.contains("block-editor-page"),r=document.querySelector(".diagnoseo-preview");if(!r)return;const l=r.querySelector(".search-result .search-result-title"),a=r.querySelector(".search-result.mobile .search-result-title"),n=r.querySelector(".search-result .search-result-descr"),i=r.querySelector(".search-result.mobile .search-result-descr"),e=document.querySelector(".diagnoseo-meta-form")||document.querySelector(".diagnoseo-settings-form"),s=e.querySelector("#seo-title")||e.querySelector("#diagnoseo_home_title"),d=e.querySelector(".info-title-chars"),c=e.querySelector(".info-title-width"),u=e.querySelector(".seo-title-progress .diagnoseo-progress-fill"),p=e.querySelector("#seo-description")||e.querySelector("#diagnoseo_home_description"),m=e.querySelector(".info-descr-chars"),y=e.querySelector(".info-descr-width"),g=e.querySelector(".seo-descr-progress .diagnoseo-progress-fill"),b=e.querySelector("#seo-slug"),v=e.querySelector(".info-slug-chars"),h=e.querySelector(".seo-slug-progress .diagnoseo-progress-fill"),f=r.querySelector(".title-sample"),w=r.querySelector(".description-sample"),t=function(){for(var e=!1;function(){var e=l.offsetWidth-20;l.style.maxWidth="none",l.style.position="absolute";var t=l.offsetWidth;return l.removeAttribute("style"),e<t}();){var t=T(l.textContent);if(!t)break;t=(t=(t=t.replace(/\/$/," ...")).split(" ").slice(0,-1).join(" ")).replace(/,\s*$/,""),e=!0,l.textContent=t,a.textContent=t}e&&(l.textContent=l.textContent+" ...",a.textContent=a.textContent+" ...")},_=function(e,t,a=0){const l=e.split(" "),n=w;if(!n)return e;e=function(e,t){for(var a,l="",n=e.split(" "),i=0;i<n.length;i++)if(a=l,(l+=" "+n[i]).length>t){l=a+" ...";break}return l=l.replace(/,\s*$/,"")}(e,a),n.textContent=e;for(var i=!1;n.clientWidth>t;){l.pop();var i=!0,o=l.join(" ");n.textContent=o}return i?l.join(" ")+" ...":e},k=function(e){var t=T(e),e=_(t,960,158);n.textContent=e;e=_(t,680,158);i.textContent=e,w.textContent=t},T=function(e){if(!e)return"";var{site:t,siteTagline:a,separator:l,excerpt:n,postTitle:i}=r.dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",o?window.wp.data.select("core/editor").getEditedPostAttribute("title"):i)).replaceAll("%sitename%",t)).replaceAll("%tagline%",a)).replaceAll("%sep%",l)).replaceAll(" %page%","")).replaceAll("%excerpt%",n||x())).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))},E=function(e){e=T(e),f.textContent=e||l.dataset.fallback,l.textContent=e||l.dataset.fallback,a.textContent=e||l.dataset.fallback,t()},x=function(){if(!window.wp||!window.wp.data)return"";let a=o?window.wp.data.select("core/editor").getEditedPostAttribute("excerpt"):r.dataset.excerpt;if(!a){let e=o?window.wp.data.select("core/editor").getEditedPostContent():"";e=seoHelper.stripTags(e).trim();let t=e.split(" ");var l=Math.min(t.length,55);t=t.splice(0,l),a=t.join(" ")}return a},S=function(){var e,t,a,l;u&&(e=f.clientWidth,l=f.textContent,100<(a=e/600*100)&&(a=100),(t=(l=T(l)).length)||(a=0),a+="%",l="",30<=t&&e<=600&&(30<=t&&t<35||60<t&&e<=600?l="medium":35<=t&&t<=60&&(l="full")),d.textContent=t,c.textContent=e,u.style.width=a,l?u.classList.contains(l)||(u.classList.remove("medium","full"),u.classList.add(l)):u.classList.remove("medium","full"))},P=function(){var e,t,a,l;g&&(l=w.textContent,e=w.clientWidth,t=l.length,100<(a=e/990*100)&&(a=100),p.value.length||p.getAttribute("placeholder")||(a=0),a+="%",l="",70<=t&&e<=990&&(70<=t&&t<130||158<t&&e<=990?l="medium":130<=t&&t<=158&&(l="full")),m.textContent=t,y.textContent=e,g.style.width=a,l?g.classList.contains(l)||(g.classList.remove("medium","full"),g.classList.add(l)):g.classList.remove("medium","full"))},C=function(){var e,t,a;h&&(t="",(a=(e=(e=b.value).replaceAll(" ","-")).split("-")).length<=5&&e.length?e.length<=50?t="full":50<e.length&&e.length<=60&&(t="medium"):5<a.length&&e.length<60&&(t="medium"),100<(a=Math.round(e.length/60*100))&&(a=100),h.style.width=a+"%",v.textContent=e.length,t?h.classList.contains(t)||(h.classList.remove("medium","full"),h.classList.add(t)):h.classList.remove("medium","full"))};s&&(s.addEventListener("input",function(e){E(e.target.value),f.textContent=T(e.target.value),o&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_title:e.target.value}}),S()}),E(s.value||s.getAttribute("placeholder")),S());const A=l.dataset.fallback;o?window.wp.data.subscribe(()=>{var e=window.wp.data.select("core/editor").getEditedPostAttribute("title")||r.dataset.postTitle;l.dataset.fallback=e||A;var t=s.value||s.getAttribute("placeholder");E(t),S();const a=document.querySelector("#postlist-title");!(window.wp.data.select("core/editor").getEditedPostAttribute("meta")?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:e)&&a&&a.setAttribute("placeholder",e)}):s&&s.addEventListener("input",e=>{var t=o?window.wp.data.select("core/editor").getEditedPostAttribute("title"):r.dataset.postTitle;l.dataset.fallback=t||A;e=e.target.value||e.target.value.getAttribute("placeholder");E(e),S();const a=document.querySelector("#postlist-title");!(o?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:t)&&a&&a.setAttribute("placeholder",t)}),p&&(p.addEventListener("input",function(e){k(e.target.value||e.target.getAttribute("placeholder")),o&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_description:e.target.value}}),P()}),k(p.value||p.getAttribute("placeholder")),P()),b&&b.addEventListener("input",e=>{o&&window.wp.data.dispatch("core/editor").editPost({slug:seoHelper.slugify(e.target.value)}),C()});const L=document.querySelectorAll(".diagnoseo-var-input");L&&L.forEach(e=>{const l=e.querySelector(".var-input"),n=e.querySelector(".var-select"),t=e.querySelector(".var-button");t.addEventListener("click",e=>{e.preventDefault();var t,a=n.value;a&&(l.selectionStart||"0"==l.selectionStart?(t=l.selectionStart,e=l.selectionEnd,l.value=l.value.substring(0,t)+" "+a+l.value.substring(e,l.value.length)):l.value+=a,l.dispatchEvent(new Event("input")))})}),setTimeout(function(){t(),S(),P(),C()},500)}window._wpLoadBlockEditor?window._wpLoadBlockEditor.then(function(){setTimeout(initSerpSimulator,500)}):window.addEventListener("load",initSerpSimulator);const startSocialPreview=function(){if(window.wp.data){const{select,dispatch,subscribe}=window.wp.data}const e=document.querySelectorAll(".diagnoseo-social-meta"),t=document.body.classList.contains("block-editor-page");if(e){const m=document.querySelector("#facebook-title"),y=document.querySelector("#twitter-title"),g=document.querySelector("#facebook-description"),b=document.querySelector("#twitter-description"),v=document.querySelector("#seo-title"),h=document.querySelector("#seo-description");if(v&&v.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");m.setAttribute("placeholder",e),y.setAttribute("placeholder",e)}),h&&h.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");g.setAttribute("placeholder",e),b.setAttribute("placeholder",e)}),e.forEach(e=>{e.addEventListener("input",e=>{t&&function(e,t){const a={};a[e]=t,dispatch("core/editor").editPost({meta:a})}(e.target.dataset.customField,e.target.value)})}),t)subscribe(()=>{const e=select("core/editor");var t=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_title||m.value||v.value||m.getAttribute("placeholder"),a=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_description||g.value||h.value||h.getAttribute("placeholder"),l=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_title||y.value||v.value||y.getAttribute("placeholder"),n=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_description||b.value||h.value||h.getAttribute("placeholder"),i=e.getEditedPostAttribute("featured_media");const o=document.querySelectorAll(".diagnoseo-social-preview"),r=document.querySelector(".preview-facebook"),s=document.querySelector(".preview-twitter");if(o){const d=r?r.querySelector(".facebook-post-title"):null;d&&(d.textContent=seoHelper.replaceVariables(t));const c=r?r.querySelector(".facebook-post-description"):null;c&&(c.textContent=seoHelper.replaceVariables(a));const u=s?s.querySelector(".twitter-post-title"):null;u&&(u.textContent=seoHelper.replaceVariables(l));const p=s?s.querySelector(".twitter-post-description"):null;p&&(p.textContent=seoHelper.replaceVariables(n)),o.forEach(e=>{var t=i?select("core").getMedia(i):null,t=t?t.guid.raw:e.dataset.placeholderImage;const a=e.querySelector(".preview-image img");a.setAttribute("src",t)})}});else{const a=document.querySelector(".preview-facebook"),l=document.querySelector(".preview-twitter");if(a&&l){const n=a.querySelector(".facebook-post-title"),i=a.querySelector(".facebook-post-description"),o=l.querySelector(".twitter-post-title"),r=l.querySelector(".twitter-post-description");n.textContent=seoHelper.replaceVariables(a.dataset.facebookTitle),i.textContent=seoHelper.replaceVariables(a.dataset.facebookDescription),o.textContent=seoHelper.replaceVariables(l.dataset.twitterTitle),r.textContent=seoHelper.replaceVariables(l.dataset.twitterDescription),m.addEventListener("input",e=>{e=e.target.value;n&&(n.textContent=seoHelper.replaceVariables(e))}),g.addEventListener("input",e=>{e=e.target.value;i&&(i.textContent=seoHelper.replaceVariables(e))}),y.addEventListener("input",e=>{e=e.target.value;o&&(o.textContent=seoHelper.replaceVariables(e))}),b.addEventListener("input",e=>{e=e.target.value;r&&(r.textContent=seoHelper.replaceVariables(e))})}}}};window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(startSocialPreview,500)}),document.body.classList.contains("block-editor-page")||window.addEventListener("load",startSocialPreview),jQuery(document).on("ready",function(){jQuery(".toggle").each(function(){const t=jQuery(this).find(".toggle-trigger"),a=jQuery(this).find(".toggle-content");t.on("click",function(e){e.preventDefault(),a.slideToggle(),t.toggleClass("open")})})}); -
diagnoseo/trunk/js/diagnoseo.min.js
r2990168 r2992578 1 const seoHelper={slugify:function(e){e=(e=e.replace(/^\s+|\s+$/g,"")).toLowerCase();for(var t="àáãäâąèéëêęìíïîóòóöôùúüûñńśçćźżł·/_,:;",r=0,o=t.length;r<o;r++)e=e.replace(new RegExp(t.charAt(r),"g"),"aaaaaaeeeeeiiiiooooouuuunnscczzl------".charAt(r));return e=e.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},countOccurences:function(e,t){if(!t||!e)return 0;t=t.toLowerCase().replaceAll(/[:;,.!?-]/g,""),e=e.toLowerCase();e=new RegExp(e,"g");return(t.match(e)||[]).length},countSyllables:function(e){if(""===e)return 0;if(e.length<=3)return 1;e=(e=(e=(e=e.toLowerCase()).replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,"")).replace(/^y/,"")).match(/[aeiouy]{1,2}/g);return e?e.length:0},countWords:function(e){e=(e=(e=e.replace(/(\r\n|\n|\r)/gm," ")).replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g," ")).split(" ");return(e=(e=e.map(e=>e.trim())).filter(e=>e&&""!==e&&"\n"!==e)).length||0},countElements:function(e,t){if(!e||!t)return 0;const r=document.createElement("div");return r.innerHTML=e,r.querySelectorAll(t).length},replaceVariables:function(e){if(e){var{site:t,siteTagline:r,separator:o,excerpt:a,postTitle:n}=document.querySelector(".diagnoseo-preview").dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",document.body.classList.contains("block-editor-page")?window.wp.data.select("core/editor").getEditedPostAttribute("title"):n)).replaceAll("%sitename%",t)).replaceAll("%tagline%",r)).replaceAll("%sep%",o)).replaceAll("%page%"," ")).replaceAll("%excerpt%",a)).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))}},isKeywordInText:function(e,t){if(!e||!t)return!1;e=e.toLowerCase();let r=(t=t.toLowerCase()).toLowerCase().replaceAll(/[:;,.!?-]/g,"");return t.includes(e)||r.includes(e)},isKeywordInAnyElement:function(t,e,r){if(!t||!e||!r)return!1;var o=!1;const a=seoHelper.createMarkupEl(e);return elements=a.querySelectorAll(r),elements.forEach(e=>{seoHelper.isKeywordInText(t,e.textContent)&&(o=!0)}),o},isKeywordInAnyAlt:function(t,e,r=null){if(!t)return!1;if(r&&seoHelper.isKeywordInText(t,r.alt_text))return!0;var o=0;const a=seoHelper.createMarkupEl(e),n=a.querySelectorAll("img");return n.forEach(e=>{e=e.getAttribute("alt").toLowerCase();o+=seoHelper.countOccurences(t,e)}),o},createMarkupEl:function(e){const t=document.createElement("div");return t.innerHTML=e,t},stripTags:function(e){return e.replace(/(<([^>]+)>)/gi,"")}};class diagnoseoFormHelper{input(e,t,r,o="text",a=!1,n="1", i={}){const l=document.createElement("input");for(var s in this.setAttributes(l,{type:o,name:e,id:e,class:r||"components-textarea-control__input widefat",value:t,step:"number"===o?n:""}),a&&l.setAttribute("required","required"),i)l.addEventListener(s,i[s]);return l.addEventListener("input",this.saveSchemaData),l}textarea(e,t,r,o=!1,a={}){const n=document.createElement("textarea");for(var i in this.setAttributes(n,{name:e,id:e,class:r||"components-textarea-control__input widefat"}),n.value=t,o&&n.setAttribute("required","required"),a)n.addEventListener(i,a[i]);return n.addEventListener("input",this.saveSchemaData),n}select(e,r,t,o,a=!1,n={}){const i=document.createElement("select");for(var l in i.value=r,this.setAttributes(i,{name:e,id:e,class:o||"widefat"}),a&&i.setAttribute("required","required"),t.forEach(e=>{const t=document.createElement("option");t.setAttribute("value",e.value),t.textContent=e.label,e.value===r&&t.setAttribute("selected","selected"),i.appendChild(t)}),n)i.addEventListener(l,n[l]);return i.addEventListener("change",this.saveSchemaData),i}button(e,t,r,o,a="",n={}){const i=document.createElement("button");for(var l in i.textContent=r,this.setAttributes(i,{name:e,id:e,class:o,value:t,type:a||""}),n)i.addEventListener(l,n[l]);return i}sectionTitle(e){if(e){const t=document.createElement("h3");return t.classList.add("components-base-control__heading"),t.textContent=e,t}}wrapField(e,t,r="",o="components-base-control__field"){const a=document.createElement("div");o&&a.classList.add(o);const n=document.createElement("label");if(n.classList.add("components-base-control__label"),n.setAttribute("for",e.getAttribute("id")),n.textContent=t,e.getAttribute("required")){const i=document.createElement("span");i.classList.add("req"),i.textContent="*",n.appendChild(i)}if(a.appendChild(n),a.appendChild(e),r){const l=document.createElement("p");l.classList.add("hint"),l.textContent=r,a.appendChild(l)}return a}setAttributes(e,t){for(var r in t)e.setAttribute(r,t[r])}prepareField(e){var t,{fieldType:r,label:o,name:a,value:n,type:i,className:l,options:s,listeners:c,required:u,hint:e,text:d,step:p}=e;switch(r){case"input":t=this.input(a,n,l,i,u,p,c);break;case"textarea":t=this.textarea(a,n,l,u,c);break;case"select":t=this.select(a,n,s,l,u,c);break;case"button":t=this.button(a,n,o,l,i,c);break;case"sectionTitle":t=this.sectionTitle(d)}return"button"===r||"sectionTitle"===r?t:this.wrapField(t,o,e)}saveSchemaData(e){const a=e.target.closest(".diagnoseo-schema-form");if(a){const n={};a.formConfig.forEach(t=>{if("sectionTitle"!==t.fieldType){let e=t.name;var o=e.replaceAll("-","_");let r=a.querySelector(`#${e}`).value||"";t.splitLines&&(r=r.split(t.splitLines),r.forEach((e,t)=>{r[t]=e.trim()})),n[o]=r}});const t=document.querySelector("#schema-data");t.value=JSON.stringify(n);let e=document.querySelector(".diagnoseo-schema-generator");e.setAttribute("data-schema-data",t.value)}}buildSchemaForm(e){const t=document.createElement("div");return t.classList.add("diagnoseo-schema-form"),e.forEach(e=>{e=this.prepareField(e);t.appendChild(e)}),t.formConfig=e,t}}function initSerpSimulator(){"use strict";const i=document.body.classList.contains("block-editor-page"),l=document.querySelector(".diagnoseo-preview");if(!l)return;const o=l.querySelector(".search-result .search-result-title"),r=l.querySelector(".search-result.mobile .search-result-title"),a=l.querySelector(".search-result .search-result-descr"),n=l.querySelector(".search-result.mobile .search-result-descr"),e=document.querySelector(".diagnoseo-meta-form")||document.querySelector(".diagnoseo-settings-form"),s=e.querySelector("#seo-title")||e.querySelector("#diagnoseo_home_title"),c=e.querySelector(".info-title-chars"),u=e.querySelector(".info-title-width"),d=e.querySelector(".seo-title-progress .diagnoseo-progress-fill"),p=e.querySelector("#seo-description")||e.querySelector("#diagnoseo_home_description"),m=e.querySelector(".info-descr-chars"),g=e.querySelector(".info-descr-width"),f=e.querySelector(".seo-descr-progress .diagnoseo-progress-fill"),v=e.querySelector("#seo-slug"),h=e.querySelector(".info-slug-chars"),b=e.querySelector(".seo-slug-progress .diagnoseo-progress-fill"),w=l.querySelector(".title-sample"),y=l.querySelector(".description-sample"),t=function(){for(var e=!1;function(){var e=o.offsetWidth-20;o.style.maxWidth="none",o.style.position="absolute";var t=o.offsetWidth;return o.removeAttribute("style"),e<t}();){var t=E(o.textContent);if(!t)break;t=(t=(t=t.replace(/\/$/," ...")).split(" ").slice(0,-1).join(" ")).replace(/,\s*$/,""),e=!0,o.textContent=t,r.textContent=t}e&&(o.textContent=o.textContent+" ...",r.textContent=r.textContent+" ...")},S=function(e,t,r=0){const o=e.split(" "),a=y;if(!a)return e;e=function(e,t){for(var r,o="",a=e.split(" "),n=0;n<a.length;n++)if(r=o,(o+=" "+a[n]).length>t){o=r+" ...";break}return o=o.replace(/,\s*$/,"")}(e,r),a.textContent=e;for(var n=!1;a.clientWidth>t;){o.pop();var n=!0,i=o.join(" ");a.textContent=i}return n?o.join(" ")+" ...":e},A=function(e){var t=E(e),e=S(t,960,158);a.textContent=e;e=S(t,680,158);n.textContent=e,y.textContent=t},E=function(e){if(!e)return"";var{site:t,siteTagline:r,separator:o,excerpt:a,postTitle:n}=l.dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",i?window.wp.data.select("core/editor").getEditedPostAttribute("title"):n)).replaceAll("%sitename%",t)).replaceAll("%tagline%",r)).replaceAll("%sep%",o)).replaceAll(" %page%","")).replaceAll("%excerpt%",a||L())).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))},q=function(e){e=E(e),w.textContent=e||o.dataset.fallback,o.textContent=e||o.dataset.fallback,r.textContent=e||o.dataset.fallback,t()},L=function(){if(!window.wp||!window.wp.data)return"";let r=i?window.wp.data.select("core/editor").getEditedPostAttribute("excerpt"):l.dataset.excerpt;if(!r){let e=i?window.wp.data.select("core/editor").getEditedPostContent():"";e=seoHelper.stripTags(e).trim();let t=e.split(" ");var o=Math.min(t.length,55);t=t.splice(0,o),r=t.join(" ")}return r},x=function(){var e,t,r,o;d&&(e=w.clientWidth,o=w.textContent,100<(r=e/600*100)&&(r=100),(t=(o=E(o)).length)||(r=0),r+="%",o="",30<=t&&e<=600&&(30<=t&&t<35||60<t&&e<=600?o="medium":35<=t&&t<=60&&(o="full")),c.textContent=t,u.textContent=e,d.style.width=r,o?d.classList.contains(o)||(d.classList.remove("medium","full"),d.classList.add(o)):d.classList.remove("medium","full"))},C=function(){var e,t,r,o;f&&(o=y.textContent,e=y.clientWidth,t=o.length,100<(r=e/990*100)&&(r=100),p.value.length||p.getAttribute("placeholder")||(r=0),r+="%",o="",70<=t&&e<=990&&(70<=t&&t<130||158<t&&e<=990?o="medium":130<=t&&t<=158&&(o="full")),m.textContent=t,g.textContent=e,f.style.width=r,o?f.classList.contains(o)||(f.classList.remove("medium","full"),f.classList.add(o)):f.classList.remove("medium","full"))},_=function(){var e,t,r;b&&(t="",(r=(e=(e=v.value).replaceAll(" ","-")).split("-")).length<=5&&e.length?e.length<=50?t="full":50<e.length&&e.length<=60&&(t="medium"):5<r.length&&e.length<60&&(t="medium"),100<(r=Math.round(e.length/60*100))&&(r=100),b.style.width=r+"%",h.textContent=e.length,t?b.classList.contains(t)||(b.classList.remove("medium","full"),b.classList.add(t)):b.classList.remove("medium","full"))};s&&(s.addEventListener("input",function(e){q(e.target.value),w.textContent=E(e.target.value),i&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_title:e.target.value}}),x()}),q(s.value||s.getAttribute("placeholder")),x());const k=o.dataset.fallback;i?window.wp.data.subscribe(()=>{var e=window.wp.data.select("core/editor").getEditedPostAttribute("title")||l.dataset.postTitle;o.dataset.fallback=e||k;var t=s.value||s.getAttribute("placeholder");q(t),x();const r=document.querySelector("#postlist-title");!(window.wp.data.select("core/editor").getEditedPostAttribute("meta")?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:e)&&r&&r.setAttribute("placeholder",e)}):s&&s.addEventListener("input",e=>{var t=i?window.wp.data.select("core/editor").getEditedPostAttribute("title"):l.dataset.postTitle;o.dataset.fallback=t||k;e=e.target.value||e.target.value.getAttribute("placeholder");q(e),x();const r=document.querySelector("#postlist-title");!(i?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:t)&&r&&r.setAttribute("placeholder",t)}),p&&(p.addEventListener("input",function(e){A(e.target.value||e.target.getAttribute("placeholder")),i&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_description:e.target.value}}),C()}),A(p.value||p.getAttribute("placeholder")),C()),v&&v.addEventListener("input",e=>{i&&window.wp.data.dispatch("core/editor").editPost({slug:seoHelper.slugify(e.target.value)}),_()});const T=document.querySelectorAll(".diagnoseo-var-input");T&&T.forEach(e=>{const o=e.querySelector(".var-input"),a=e.querySelector(".var-select"),t=e.querySelector(".var-button");t.addEventListener("click",e=>{e.preventDefault();var t,r=a.value;r&&(o.selectionStart||"0"==o.selectionStart?(t=o.selectionStart,e=o.selectionEnd,o.value=o.value.substring(0,t)+" "+r+o.value.substring(e,o.value.length)):o.value+=r,o.dispatchEvent(new Event("input")))})}),setTimeout(function(){t(),x(),C(),_()},500)}document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".diagnoseo-image-select");e.forEach(a=>{const e=a.querySelector(".diagnoseo-img-upload"),o=a.querySelector(".diagnoseo-img-remove");e&&e.addEventListener("click",e=>{e.preventDefault();const o=wp.media({title:"Custom Image",button:{text:"Select Image"},multiple:!1}).on("select",()=>{var e=o.state().get("selection").first().toJSON();const t=a.querySelector(".diagnoseo-img"),r=a.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",e.url),r&&(r.value=e.url)}).open()}),o&&o.addEventListener("click",e=>{e.preventDefault();const t=a.querySelector(".diagnoseo-img"),r=a.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",o.dataset.fallbackImage||""),r&&(r.value="")})})}),window._wpLoadBlockEditor?window._wpLoadBlockEditor.then(function(){setTimeout(initSerpSimulator,500)}):window.addEventListener("load",initSerpSimulator);const startSocialPreview=function(){const{select:m,dispatch:o,subscribe:e}=window.wp.data,t=document.querySelectorAll(".diagnoseo-social-meta"),r=document.body.classList.contains("block-editor-page");if(t){const g=document.querySelector("#facebook-title"),f=document.querySelector("#twitter-title"),v=document.querySelector("#facebook-description"),h=document.querySelector("#twitter-description"),b=document.querySelector("#seo-title"),w=document.querySelector("#seo-description");if(b.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");g.setAttribute("placeholder",e),f.setAttribute("placeholder",e)}),w.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");v.setAttribute("placeholder",e),h.setAttribute("placeholder",e)}),t.forEach(e=>{e.addEventListener("input",e=>{r&&function(e,t){const r={};r[e]=t,o("core/editor").editPost({meta:r})}(e.target.dataset.customField,e.target.value)})}),r)e(()=>{const e=m("core/editor");var t=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_title||g.value||b.value||g.getAttribute("placeholder"),r=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_description||v.value||w.value||w.getAttribute("placeholder"),o=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_title||f.value||b.value||f.getAttribute("placeholder"),a=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_description||h.value||w.value||w.getAttribute("placeholder"),n=e.getEditedPostAttribute("featured_media");const i=document.querySelectorAll(".diagnoseo-social-preview"),l=document.querySelector(".preview-facebook"),s=document.querySelector(".preview-twitter"),c=l.querySelector(".facebook-post-title");c&&(c.textContent=seoHelper.replaceVariables(t));const u=l.querySelector(".facebook-post-description");u&&(u.textContent=seoHelper.replaceVariables(r));const d=s.querySelector(".twitter-post-title");d&&(d.textContent=seoHelper.replaceVariables(o));const p=s.querySelector(".twitter-post-description");p&&(p.textContent=seoHelper.replaceVariables(a)),i.forEach(e=>{var t=n?m("core").getMedia(n):null,t=t?t.guid.raw:e.dataset.placeholderImage;const r=e.querySelector(".preview-image img");r.setAttribute("src",t)})});else{const a=document.querySelector(".preview-facebook"),n=document.querySelector(".preview-twitter"),i=a.querySelector(".facebook-post-title"),l=a.querySelector(".facebook-post-description"),s=n.querySelector(".twitter-post-title"),c=n.querySelector(".twitter-post-description");i.textContent=seoHelper.replaceVariables(a.dataset.facebookTitle),l.textContent=seoHelper.replaceVariables(a.dataset.facebookDescription),s.textContent=seoHelper.replaceVariables(n.dataset.twitterTitle),c.textContent=seoHelper.replaceVariables(n.dataset.twitterDescription),g.addEventListener("input",e=>{e=e.target.value;i&&(i.textContent=seoHelper.replaceVariables(e))}),v.addEventListener("input",e=>{e=e.target.value;l&&(l.textContent=seoHelper.replaceVariables(e))}),f.addEventListener("input",e=>{e=e.target.value;s&&(s.textContent=seoHelper.replaceVariables(e))}),h.addEventListener("input",e=>{e=e.target.value;c&&(c.textContent=seoHelper.replaceVariables(e))})}}};window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(startSocialPreview,500)}),document.body.classList.contains("block-editor-page")||window.addEventListener("load",startSocialPreview);1 const seoHelper={slugify:function(e){e=(e=e.replace(/^\s+|\s+$/g,"")).toLowerCase();for(var t="àáãäâąèéëêęìíïîóòóöôùúüûñńśçćźżł·/_,:;",r=0,o=t.length;r<o;r++)e=e.replace(new RegExp(t.charAt(r),"g"),"aaaaaaeeeeeiiiiooooouuuunnscczzl------".charAt(r));return e=e.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},countOccurences:function(e,t){if(!t||!e)return 0;t=t.toLowerCase().replaceAll(/[:;,.!?-]/g,""),e=e.toLowerCase();e=new RegExp(e,"g");return(t.match(e)||[]).length},countSyllables:function(e){if(""===e)return 0;if(e.length<=3)return 1;e=(e=(e=(e=e.toLowerCase()).replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,"")).replace(/^y/,"")).match(/[aeiouy]{1,2}/g);return e?e.length:0},countWords:function(e){e=(e=(e=e.replace(/(\r\n|\n|\r)/gm," ")).replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`{|}~]/g," ")).split(" ");return(e=(e=e.map(e=>e.trim())).filter(e=>e&&""!==e&&"\n"!==e)).length||0},countElements:function(e,t){if(!e||!t)return 0;const r=document.createElement("div");return r.innerHTML=e,r.querySelectorAll(t).length},replaceVariables:function(e){if(e){var{site:t,siteTagline:r,separator:o,excerpt:a,postTitle:n}=document.querySelector(".diagnoseo-preview").dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",document.body.classList.contains("block-editor-page")?window.wp.data.select("core/editor").getEditedPostAttribute("title"):n)).replaceAll("%sitename%",t)).replaceAll("%tagline%",r)).replaceAll("%sep%",o)).replaceAll("%page%"," ")).replaceAll("%excerpt%",a)).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))}},isKeywordInText:function(e,t){if(!e||!t)return!1;e=e.toLowerCase();let r=(t=t.toLowerCase()).toLowerCase().replaceAll(/[:;,.!?-]/g,"");return t.includes(e)||r.includes(e)},isKeywordInAnyElement:function(t,e,r){if(!t||!e||!r)return!1;var o=!1;const a=seoHelper.createMarkupEl(e);return elements=a.querySelectorAll(r),elements.forEach(e=>{seoHelper.isKeywordInText(t,e.textContent)&&(o=!0)}),o},isKeywordInAnyAlt:function(t,e,r=null){if(!t)return!1;if(r&&seoHelper.isKeywordInText(t,r.alt_text))return!0;var o=0;const a=seoHelper.createMarkupEl(e),n=a.querySelectorAll("img");return n.forEach(e=>{e=e.getAttribute("alt").toLowerCase();o+=seoHelper.countOccurences(t,e)}),o},createMarkupEl:function(e){const t=document.createElement("div");return t.innerHTML=e,t},stripTags:function(e){return e.replace(/(<([^>]+)>)/gi,"")}};class diagnoseoFormHelper{input(e,t,r,o="text",a=!1,n="1",l={}){const i=document.createElement("input");for(var s in this.setAttributes(i,{type:o,name:e,id:e,class:r||"components-textarea-control__input widefat",value:t,step:"number"===o?n:""}),a&&i.setAttribute("required","required"),l)i.addEventListener(s,l[s]);return i.addEventListener("input",this.saveSchemaData),i}textarea(e,t,r,o=!1,a={}){const n=document.createElement("textarea");for(var l in this.setAttributes(n,{name:e,id:e,class:r||"components-textarea-control__input widefat"}),n.value=t,o&&n.setAttribute("required","required"),a)n.addEventListener(l,a[l]);return n.addEventListener("input",this.saveSchemaData),n}select(e,r,t,o,a=!1,n={}){const l=document.createElement("select");for(var i in l.value=r,this.setAttributes(l,{name:e,id:e,class:o||"widefat"}),a&&l.setAttribute("required","required"),t.forEach(e=>{const t=document.createElement("option");t.setAttribute("value",e.value),t.textContent=e.label,e.value===r&&t.setAttribute("selected","selected"),l.appendChild(t)}),n)l.addEventListener(i,n[i]);return l.addEventListener("change",this.saveSchemaData),l}button(e,t,r,o,a="",n={}){const l=document.createElement("button");for(var i in l.textContent=r,this.setAttributes(l,{name:e,id:e,class:o,value:t,type:a||""}),n)l.addEventListener(i,n[i]);return l}sectionTitle(e){if(e){const t=document.createElement("h3");return t.classList.add("components-base-control__heading"),t.textContent=e,t}}wrapField(e,t,r="",o="components-base-control__field"){const a=document.createElement("div");o&&a.classList.add(o);const n=document.createElement("label");if(n.classList.add("components-base-control__label"),n.setAttribute("for",e.getAttribute("id")),n.textContent=t,e.getAttribute("required")){const l=document.createElement("span");l.classList.add("req"),l.textContent="*",n.appendChild(l)}if(a.appendChild(n),a.appendChild(e),r){const i=document.createElement("p");i.classList.add("hint"),i.textContent=r,a.appendChild(i)}return a}setAttributes(e,t){for(var r in t)e.setAttribute(r,t[r])}prepareField(e){var t,{fieldType:r,label:o,name:a,value:n,type:l,className:i,options:s,listeners:c,required:u,hint:e,text:d,step:p}=e;switch(r){case"input":t=this.input(a,n,i,l,u,p,c);break;case"textarea":t=this.textarea(a,n,i,u,c);break;case"select":t=this.select(a,n,s,i,u,c);break;case"button":t=this.button(a,n,o,i,l,c);break;case"sectionTitle":t=this.sectionTitle(d)}return"button"===r||"sectionTitle"===r?t:this.wrapField(t,o,e)}saveSchemaData(e){const a=e.target.closest(".diagnoseo-schema-form");if(a){const n={};a.formConfig.forEach(t=>{if("sectionTitle"!==t.fieldType){let e=t.name;var o=e.replaceAll("-","_");let r=a.querySelector(`#${e}`).value||"";t.splitLines&&(r=r.split(t.splitLines),r.forEach((e,t)=>{r[t]=e.trim()})),n[o]=r}});const t=document.querySelector("#schema-data");t.value=JSON.stringify(n);let e=document.querySelector(".diagnoseo-schema-generator");e.setAttribute("data-schema-data",t.value)}}buildSchemaForm(e){const t=document.createElement("div");return t.classList.add("diagnoseo-schema-form"),e.forEach(e=>{e=this.prepareField(e);t.appendChild(e)}),t.formConfig=e,t}}function initSerpSimulator(){"use strict";const l=document.body.classList.contains("block-editor-page"),i=document.querySelector(".diagnoseo-preview");if(!i)return;const o=i.querySelector(".search-result .search-result-title"),r=i.querySelector(".search-result.mobile .search-result-title"),a=i.querySelector(".search-result .search-result-descr"),n=i.querySelector(".search-result.mobile .search-result-descr"),e=document.querySelector(".diagnoseo-meta-form")||document.querySelector(".diagnoseo-settings-form"),s=e.querySelector("#seo-title")||e.querySelector("#diagnoseo_home_title"),c=e.querySelector(".info-title-chars"),u=e.querySelector(".info-title-width"),d=e.querySelector(".seo-title-progress .diagnoseo-progress-fill"),p=e.querySelector("#seo-description")||e.querySelector("#diagnoseo_home_description"),m=e.querySelector(".info-descr-chars"),g=e.querySelector(".info-descr-width"),f=e.querySelector(".seo-descr-progress .diagnoseo-progress-fill"),v=e.querySelector("#seo-slug"),h=e.querySelector(".info-slug-chars"),b=e.querySelector(".seo-slug-progress .diagnoseo-progress-fill"),w=i.querySelector(".title-sample"),y=i.querySelector(".description-sample"),t=function(){for(var e=!1;function(){var e=o.offsetWidth-20;o.style.maxWidth="none",o.style.position="absolute";var t=o.offsetWidth;return o.removeAttribute("style"),e<t}();){var t=E(o.textContent);if(!t)break;t=(t=(t=t.replace(/\/$/," ...")).split(" ").slice(0,-1).join(" ")).replace(/,\s*$/,""),e=!0,o.textContent=t,r.textContent=t}e&&(o.textContent=o.textContent+" ...",r.textContent=r.textContent+" ...")},S=function(e,t,r=0){const o=e.split(" "),a=y;if(!a)return e;e=function(e,t){for(var r,o="",a=e.split(" "),n=0;n<a.length;n++)if(r=o,(o+=" "+a[n]).length>t){o=r+" ...";break}return o=o.replace(/,\s*$/,"")}(e,r),a.textContent=e;for(var n=!1;a.clientWidth>t;){o.pop();var n=!0,l=o.join(" ");a.textContent=l}return n?o.join(" ")+" ...":e},A=function(e){var t=E(e),e=S(t,960,158);a.textContent=e;e=S(t,680,158);n.textContent=e,y.textContent=t},E=function(e){if(!e)return"";var{site:t,siteTagline:r,separator:o,excerpt:a,postTitle:n}=i.dataset;return e=(e=(e=(e=(e=(e=(e=(e=e.replaceAll("%title%",l?window.wp.data.select("core/editor").getEditedPostAttribute("title"):n)).replaceAll("%sitename%",t)).replaceAll("%tagline%",r)).replaceAll("%sep%",o)).replaceAll(" %page%","")).replaceAll("%excerpt%",a||L())).replaceAll("%currentyear%",(new Date).getFullYear())).replaceAll("%currentmonth%",(new Date).toLocaleString("default",{month:"long"}))},q=function(e){e=E(e),w.textContent=e||o.dataset.fallback,o.textContent=e||o.dataset.fallback,r.textContent=e||o.dataset.fallback,t()},L=function(){if(!window.wp||!window.wp.data)return"";let r=l?window.wp.data.select("core/editor").getEditedPostAttribute("excerpt"):i.dataset.excerpt;if(!r){let e=l?window.wp.data.select("core/editor").getEditedPostContent():"";e=seoHelper.stripTags(e).trim();let t=e.split(" ");var o=Math.min(t.length,55);t=t.splice(0,o),r=t.join(" ")}return r},x=function(){var e,t,r,o;d&&(e=w.clientWidth,o=w.textContent,100<(r=e/600*100)&&(r=100),(t=(o=E(o)).length)||(r=0),r+="%",o="",30<=t&&e<=600&&(30<=t&&t<35||60<t&&e<=600?o="medium":35<=t&&t<=60&&(o="full")),c.textContent=t,u.textContent=e,d.style.width=r,o?d.classList.contains(o)||(d.classList.remove("medium","full"),d.classList.add(o)):d.classList.remove("medium","full"))},C=function(){var e,t,r,o;f&&(o=y.textContent,e=y.clientWidth,t=o.length,100<(r=e/990*100)&&(r=100),p.value.length||p.getAttribute("placeholder")||(r=0),r+="%",o="",70<=t&&e<=990&&(70<=t&&t<130||158<t&&e<=990?o="medium":130<=t&&t<=158&&(o="full")),m.textContent=t,g.textContent=e,f.style.width=r,o?f.classList.contains(o)||(f.classList.remove("medium","full"),f.classList.add(o)):f.classList.remove("medium","full"))},_=function(){var e,t,r;b&&(t="",(r=(e=(e=v.value).replaceAll(" ","-")).split("-")).length<=5&&e.length?e.length<=50?t="full":50<e.length&&e.length<=60&&(t="medium"):5<r.length&&e.length<60&&(t="medium"),100<(r=Math.round(e.length/60*100))&&(r=100),b.style.width=r+"%",h.textContent=e.length,t?b.classList.contains(t)||(b.classList.remove("medium","full"),b.classList.add(t)):b.classList.remove("medium","full"))};s&&(s.addEventListener("input",function(e){q(e.target.value),w.textContent=E(e.target.value),l&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_title:e.target.value}}),x()}),q(s.value||s.getAttribute("placeholder")),x());const k=o.dataset.fallback;l?window.wp.data.subscribe(()=>{var e=window.wp.data.select("core/editor").getEditedPostAttribute("title")||i.dataset.postTitle;o.dataset.fallback=e||k;var t=s.value||s.getAttribute("placeholder");q(t),x();const r=document.querySelector("#postlist-title");!(window.wp.data.select("core/editor").getEditedPostAttribute("meta")?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:e)&&r&&r.setAttribute("placeholder",e)}):s&&s.addEventListener("input",e=>{var t=l?window.wp.data.select("core/editor").getEditedPostAttribute("title"):i.dataset.postTitle;o.dataset.fallback=t||k;e=e.target.value||e.target.value.getAttribute("placeholder");q(e),x();const r=document.querySelector("#postlist-title");!(l?window.wp.data.select("core/editor").getEditedPostAttribute("meta").diagnoseo_postlist_title:t)&&r&&r.setAttribute("placeholder",t)}),p&&(p.addEventListener("input",function(e){A(e.target.value||e.target.getAttribute("placeholder")),l&&window.wp.data.dispatch("core/editor").editPost({meta:{diagnoseo_meta_description:e.target.value}}),C()}),A(p.value||p.getAttribute("placeholder")),C()),v&&v.addEventListener("input",e=>{l&&window.wp.data.dispatch("core/editor").editPost({slug:seoHelper.slugify(e.target.value)}),_()});const T=document.querySelectorAll(".diagnoseo-var-input");T&&T.forEach(e=>{const o=e.querySelector(".var-input"),a=e.querySelector(".var-select"),t=e.querySelector(".var-button");t.addEventListener("click",e=>{e.preventDefault();var t,r=a.value;r&&(o.selectionStart||"0"==o.selectionStart?(t=o.selectionStart,e=o.selectionEnd,o.value=o.value.substring(0,t)+" "+r+o.value.substring(e,o.value.length)):o.value+=r,o.dispatchEvent(new Event("input")))})}),setTimeout(function(){t(),x(),C(),_()},500)}document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".diagnoseo-image-select");e.forEach(a=>{const e=a.querySelector(".diagnoseo-img-upload"),o=a.querySelector(".diagnoseo-img-remove");e&&e.addEventListener("click",e=>{e.preventDefault();const o=wp.media({title:"Custom Image",button:{text:"Select Image"},multiple:!1}).on("select",()=>{var e=o.state().get("selection").first().toJSON();const t=a.querySelector(".diagnoseo-img"),r=a.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",e.url),r&&(r.value=e.url)}).open()}),o&&o.addEventListener("click",e=>{e.preventDefault();const t=a.querySelector(".diagnoseo-img"),r=a.querySelector(".diagnoseo-img-address");t&&t.setAttribute("src",o.dataset.fallbackImage||""),r&&(r.value="")})})}),window._wpLoadBlockEditor?window._wpLoadBlockEditor.then(function(){setTimeout(initSerpSimulator,500)}):window.addEventListener("load",initSerpSimulator);const startSocialPreview=function(){if(window.wp.data){const{select,dispatch,subscribe}=window.wp.data}const e=document.querySelectorAll(".diagnoseo-social-meta"),t=document.body.classList.contains("block-editor-page");if(e){const m=document.querySelector("#facebook-title"),g=document.querySelector("#twitter-title"),f=document.querySelector("#facebook-description"),v=document.querySelector("#twitter-description"),h=document.querySelector("#seo-title"),b=document.querySelector("#seo-description");if(h&&h.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");m.setAttribute("placeholder",e),g.setAttribute("placeholder",e)}),b&&b.addEventListener("input",e=>{e=e.target.value||e.target.getAttribute("placeholder");f.setAttribute("placeholder",e),v.setAttribute("placeholder",e)}),e.forEach(e=>{e.addEventListener("input",e=>{t&&function(e,t){const r={};r[e]=t,dispatch("core/editor").editPost({meta:r})}(e.target.dataset.customField,e.target.value)})}),t)subscribe(()=>{const e=select("core/editor");var t=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_title||m.value||h.value||m.getAttribute("placeholder"),r=e.getEditedPostAttribute("meta").diagnoseo_meta_facebook_description||f.value||b.value||b.getAttribute("placeholder"),o=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_title||g.value||h.value||g.getAttribute("placeholder"),a=e.getEditedPostAttribute("meta").diagnoseo_meta_twitter_description||v.value||b.value||b.getAttribute("placeholder"),n=e.getEditedPostAttribute("featured_media");const l=document.querySelectorAll(".diagnoseo-social-preview"),i=document.querySelector(".preview-facebook"),s=document.querySelector(".preview-twitter");if(l){const c=i?i.querySelector(".facebook-post-title"):null;c&&(c.textContent=seoHelper.replaceVariables(t));const u=i?i.querySelector(".facebook-post-description"):null;u&&(u.textContent=seoHelper.replaceVariables(r));const d=s?s.querySelector(".twitter-post-title"):null;d&&(d.textContent=seoHelper.replaceVariables(o));const p=s?s.querySelector(".twitter-post-description"):null;p&&(p.textContent=seoHelper.replaceVariables(a)),l.forEach(e=>{var t=n?select("core").getMedia(n):null,t=t?t.guid.raw:e.dataset.placeholderImage;const r=e.querySelector(".preview-image img");r.setAttribute("src",t)})}});else{const r=document.querySelector(".preview-facebook"),o=document.querySelector(".preview-twitter");if(r&&o){const a=r.querySelector(".facebook-post-title"),n=r.querySelector(".facebook-post-description"),l=o.querySelector(".twitter-post-title"),i=o.querySelector(".twitter-post-description");a.textContent=seoHelper.replaceVariables(r.dataset.facebookTitle),n.textContent=seoHelper.replaceVariables(r.dataset.facebookDescription),l.textContent=seoHelper.replaceVariables(o.dataset.twitterTitle),i.textContent=seoHelper.replaceVariables(o.dataset.twitterDescription),m.addEventListener("input",e=>{e=e.target.value;a&&(a.textContent=seoHelper.replaceVariables(e))}),f.addEventListener("input",e=>{e=e.target.value;n&&(n.textContent=seoHelper.replaceVariables(e))}),g.addEventListener("input",e=>{e=e.target.value;l&&(l.textContent=seoHelper.replaceVariables(e))}),v.addEventListener("input",e=>{e=e.target.value;i&&(i.textContent=seoHelper.replaceVariables(e))})}}}};window._wpLoadBlockEditor&&window._wpLoadBlockEditor.then(function(){setTimeout(startSocialPreview,500)}),document.body.classList.contains("block-editor-page")||window.addEventListener("load",startSocialPreview); -
diagnoseo/trunk/readme.txt
r2992575 r2992578 4 4 Requires at least: 4.7 5 5 Tested up to: 6.3.2 6 Stable tag: 1.2. 196 Stable tag: 1.2.20 7 7 Requires PHP: 5.0 8 8 License: GPLv2 or later
Note: See TracChangeset
for help on using the changeset viewer.