-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
10 lines (10 loc) · 36.3 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
var Wt=Object.defineProperty;var Vt=(l,y,z)=>y in l?Wt(l,y,{enumerable:!0,configurable:!0,writable:!0,value:z}):l[y]=z;var D=(l,y,z)=>Vt(l,typeof y!="symbol"?y+"":y,z);(function(){"use strict";const l=window.Vue;function y(){return window.panel}function z(){return y().api}const J=()=>window.panel.plugins.viewButtons!==void 0;function Ae(){const r=y().app.$store;return r||new Proxy({},{get(){throw new Error("Vuex store is not available. Are you using Kirby 5? Use the `useContent` composable instead.")}})}function Z(){const r=y(),t=Ae(),n=J(),e=x(n?()=>r.view.props.content:()=>t.getters["content/values"]()),s=x(n?()=>r.content.changes():()=>t.getters["content/changes"]()),o=x(n?()=>Object.keys(s.value).length>0:()=>t.getters["content/hasChanges"]()),i=n?r.content:new Proxy({},{get(){return()=>{}}});return{content:i,currentContent:e,contentChanges:s,hasChanges:o,update:async(a,d=!0)=>{if(!n&&a)for(const[h,u]of Object.entries(a))t.dispatch("content/update",[h,u]);const p=i.merge(a);d&&await i.save(p)}}}function we(){const r=z();return{load:({parent:n,name:e})=>r.get(`${n}/sections/${e}`)}}const xe={error:0,warn:1,log:2,info:3,success:3};function Le(r){const t=new Ce;return new Proxy({},{get(n,e){return(...s)=>{t.log({level:xe[e],type:e,tag:r,args:s})}}})}class Ce{constructor(){D(this,"defaultColor","#7f8c8d");D(this,"levelColorMap",{0:"#c0392b",1:"#f39c12",3:"#00BCD4"});D(this,"typeColorMap",{success:"#2ecc71"})}log(t){const n=Re(t.level),e=t.type==="log"?"":t.type,s=t.tag||"",i=`
background: ${this.typeColorMap[t.type]||this.levelColorMap[t.level]||this.defaultColor};
border-radius: 0.5em;
color: white;
font-weight: bold;
padding: 2px 0.5em;
`.trimStart(),c=`%c${[s,e].filter(Boolean).join(":")}`;typeof t.args[0]=="string"?n(`${c}%c ${t.args[0]}`,i,"",...t.args.slice(1)):n(c,i,...t.args)}}function Re(r){return r<1?console.error:console.log}const H=[],U=new Map;async function Ee(r){if(!Array.isArray(r))throw new TypeError(`Expected an array, got ${typeof r}`);for(const t of r)H.some(n=>n.filename===t.filename)||H.push(t)}function ze(r){if(H.length===0)throw new Error("Plugin assets not registered");const t=H.find(n=>n.filename===r);if(!t)throw new Error(`Plugin asset "${r}" not found`);return t}async function P(r){if(r.endsWith(".js")||(r+=".js"),U.has(r))return U.get(r);const n=await import(ze(r).url);return U.set(r,n),n}const x=l.computed;l.customRef,l.defineAsyncComponent,l.defineComponent,l.effectScope,l.getCurrentInstance,l.getCurrentScope,l.h,l.inject,l.isProxy,l.isReactive,l.isReadonly,l.isRef,l.isShallow,l.markRaw,l.nextTick,l.onActivated,l.onBeforeMount,l.onBeforeUnmount,l.onBeforeUpdate,l.onDeactivated,l.onErrorCaptured;const Oe=l.onMounted;l.onRenderTracked,l.onRenderTriggered,l.onScopeDispose,l.onServerPrefetch,l.onUnmounted,l.onUpdated,l.provide,l.proxyRefs,l.reactive,l.readonly;const b=l.ref;l.shallowReactive,l.shallowReadonly,l.shallowRef,l.toRaw,l.toRef,l.toRefs,l.triggerRef;const X=l.unref;l.useAttrs,l.useCssModule,l.useCssVars,l.useListeners,l.useSlots;const Be=l.watch;l.watchEffect,l.watchPostEffect,l.watchSyncEffect;const Te={blueprint:String,lock:[Boolean,Object],help:String,name:String,parent:String,timestamp:Number};function F(r,t,n,e,s,o,i,c){var a=typeof r=="function"?r.options:r;return t&&(a.render=t,a.staticRenderFns=n,a._compiled=!0),{exports:r,options:a}}const G={en:{"modal.info":"Thanks for purchasing {label}! Please enter your email address and order ID to activate your license.","modal.fields.orderId.help":'<a href="https://app.lemonsqueezy.com/my-orders" target="_blank">Find your order number</a> on Lemon Squeezy or <a href="mailto:hello@kirby.tools">contact us</a> if you cannot find it.',"modal.error.required.fields":"Email address and order ID are required","modal.error.invalid.unauthorized":"Email address or order ID is incorrect","modal.error.invalid.licenseKey":"License key invalid for this plugin","modal.error.incompatible":"License key invalid for this plugin version","modal.error.upgradeable":"License key invalid for this plugin version. Upgrade now on https://hub.kirby.tools.","modal.error.activated":"License key already activated",activate:"Activate",activated:"Plugin activated",buy:"Buy a license",upgrade:"Upgrade"},de:{"modal.info":"Dankeschön für den Kauf von {label}! Bitte gib deine E-Mail-Adresse und Bestellnummer ein, um deine Lizenz zu aktivieren.","modal.fields.orderId.help":'<a href="https://app.lemonsqueezy.com/my-orders" target="_blank">Finde deine Bestellnummer</a> bei Lemon Squeezy oder <a href="mailto:hello@kirby.tools">kontaktiere uns</a>, wenn du sie nicht finden kannst.',"modal.error.required.fields":"E-Mail-Adresse und Bestellnummer sind notwendig","modal.error.invalid.unauthorized":"E-Mail-Adresse oder Bestellnummer ist falsch","modal.error.invalid.licenseKey":"Lizenzschlüssel ungültig für dieses Plugin","modal.error.incompatible":"Lizenzschlüssel ungültig für diese Plugin-Version","modal.error.upgradeable":"Lizenzschlüssel ungültig für diese Plugin-Version. Aktualisiere jetzt auf https://hub.kirby.tools.","modal.error.activated":"Lizenzschlüssel bereits aktiviert",activate:"Aktivieren",activated:"Plugin aktiviert",buy:"Lizenz kaufen",upgrade:"Upgrade"},fr:{"modal.info":"Merci d'avoir acheté {label} ! Veuillez saisir votre adresse e-mail et votre numéro de commande pour activer votre licence.","modal.fields.orderId.help":'<a href="https://app.lemonsqueezy.com/my-orders" target="_blank">Trouvez votre numéro de commande</a> sur Lemon Squeezy ou <a href="mailto:hello@kirby.tools">contactez-nous</a> si vous ne le trouvez pas.',"modal.error.required.fields":"Adresse e-mail et numéro de commande requis","modal.error.invalid.unauthorized":"Adresse e-mail ou numéro de commande incorrect","modal.error.invalid.licenseKey":"Clé de licence invalide pour ce plugin","modal.error.incompatible":"Clé de licence invalide pour cette version du plugin","modal.error.upgradeable":"Clé de licence invalide pour cette version du plugin. Mettez à niveau maintenant sur https://hub.kirby.tools.","modal.error.activated":"Clé de licence déjà activée",activate:"Activer",activated:"Plugin activé",buy:"Acheter une licence",upgrade:"Upgrade"},nl:{"modal.info":"Bedankt voor het kopen van {label}! Voer je e-mailadres en bestelnummer in om je licentie te activeren.","modal.fields.orderId.help":'<a href="https://app.lemonsqueezy.com/my-orders" target="_blank">Vind je bestelnummer</a> op Lemon Squeezy of <a href="mailto:hello@kirby.tools">neem contact met ons op</a> als je het niet kunt vinden.',"modal.error.required.fields":"E-mailadres en bestelnummer zijn verplicht","modal.error.invalid.unauthorized":"E-mailadres of bestelnummer is onjuist","modal.error.invalid.licenseKey":"Licentiesleutel ongeldig voor dit plug-in","modal.error.incompatible":"Licentiesleutel ongeldig voor deze plug-inversie","modal.error.upgradeable":"Licentiesleutel ongeldig voor deze plug-inversie. Upgrade nu op https://hub.kirby.tools.","modal.error.activated":"Licentiesleutel al geactiveerd",activate:"Activeren",activated:"Plugin geactiveerd",buy:"Koop een licentie",upgrade:"Upgrade"}},je=["localhost","127.0.0.1","[::1]"],Pe=["local","test","ddev.site"];function O(r="",t){var s;const n=window.panel.translation.code,e=((s=G==null?void 0:G[n])==null?void 0:s[r])??r;return t?$e(e,t):e}function $e(r,t,n){return r.replace(/\{(\w+)\}/g,(e,s)=>t[s]||s)}function Ie(){const{hostname:r}=window.location,t=je.includes(r),n=Pe.some(e=>r.endsWith(`.${e}`));return t||n}const Q={Unauthorized:"modal.error.invalid.unauthorized","License key not valid for this plugin":"modal.error.invalid.licenseKey","License key not valid for this plugin version":"modal.error.incompatible","License key not valid for this plugin version, please upgrade your license":"modal.error.upgradeable","License key already activated":"modal.error.activated"};function Me(r){const t=y();return{isLocalhost:Ie(),assertActivationIntegrity:async({component:o,licenseStatus:i})=>{if(X(i)==="active")return;const c=X(o);if(!(c!=null&&c.$el)||window.getComputedStyle(c.$el).display==="none"||window.getComputedStyle(c.$el).visibility==="hidden"||window.getComputedStyle(c.$el).opacity==="0")throw new Error("Are you trying to hide the activation buttons? Please buy a license.")},openLicenseModal:()=>{let o=!1;const{label:i}=r,c={info:{type:"info",text:O("modal.info",{label:i})},email:{label:t.t("email"),type:"email"},orderId:{label:"Order ID",type:"text",help:O("modal.fields.orderId.help",{label:i})}};return new Promise(a=>{t.dialog.open({component:"k-form-dialog",props:{submitButton:{icon:"check",theme:"love",text:O("activate",{label:i})},fields:c},on:{close:()=>{a({isLicenseActive:o})},submit:async d=>{o=await He(d,r),o&&(t.dialog.close(),t.notification.success(O("activated")))}}})})}}}async function He(r,t){const n=y(),{email:e,orderId:s}=r;if(!e||!s)return n.notification.error(O("modal.error.required.fields")),!1;try{const o=await n.api.post(`${t.apiNamespace}/activate`,{email:e,orderId:Number(s)});if((o==null?void 0:o.status)!=="ok")throw new Error("Failed to activate license key");return!0}catch(o){const i=o.message;return n.notification.error(Q[i]?O(Q[i]):i),!1}}const Fe=Vue.defineComponent({__name:"LicensingButtonGroup",props:{label:{type:String,required:!0},apiNamespace:{type:String,required:!0},licenseStatus:{type:String,required:!0},pricingUrl:{type:String,required:!0}},setup(r){const t=r,{openLicenseModal:n,assertActivationIntegrity:e}=Me({label:t.label,apiNamespace:t.apiNamespace}),s=b(t.licenseStatus),o=b();Oe(()=>{e({component:o,licenseStatus:t.licenseStatus})});async function i(){const{isLicenseActive:c}=await n();c&&window.location.reload()}return{__sfc:!0,props:t,openLicenseModal:n,assertActivationIntegrity:e,currentLicenseStatus:s,licenseButtonGroup:o,handleRegistration:i,t:O}}});var Ke=function(){var t=this,n=t._self._c,e=t._self._setupProxy;return e.currentLicenseStatus!=="active"?n("k-button-group",{ref:"licenseButtonGroup",attrs:{layout:"collapsed"}},[n("k-button",{attrs:{theme:"love",variant:"filled",size:"xs",link:e.currentLicenseStatus==="upgradeable"?"https://hub.kirby.tools":t.pricingUrl,target:"_blank",text:e.currentLicenseStatus==="upgradeable"?e.t("upgrade"):e.t("buy")}}),n("k-button",{attrs:{theme:"love",variant:"filled",size:"xs",icon:"key",text:e.t("activate")},on:{click:function(s){return e.handleRegistration()}}})],1):t._e()},Ne=[],qe=F(Fe,Ke,Ne);const De=qe.exports;let Ue;function ee(){return Ue??(Ue=Le("seo-audit"))}const te=["TaxonomyTextLengthAssessment","UrlLengthAssessment","UrlStopWordsAssessment","SingleH1Assessment"],Ge={FleschReadingEaseAssessment:"fleschReading",SentenceLengthInTextAssessment:"sentenceLength"},se=["FunctionWordsInKeyphraseAssessment","IntroductionKeywordAssessment","KeyphraseLengthAssessment","KeywordDensityAssessment","KeyphraseDistributionAssessment","MetaDescriptionKeywordAssessment","SubheadingsKeywordAssessment","TitleKeywordAssessment","UrlKeywordAssessment"],We={WordComplexityAssessment:["de","en","es","fr"],KeyphraseDistributionAssessment:["ar","cs","de","el","en","es","fr","he","hu","id","it","ja","nl","no","pl","pt","ru","sk","sv","tr"],SentenceLengthInDescriptionAssessment:["ar","cs","de","el","en","es","fa","fr","he","hu","id","it","ja","nl","no","pl","pt","ru","sk","sv","tr"],SentenceLengthInTextAssessment:["ar","cs","de","el","en","es","fa","fr","he","hu","id","it","ja","nl","no","pl","pt","ru","sk","sv","tr"],PassiveVoiceAssessment:["ar","cs","de","el","en","es","fa","fr","he","hu","id","it","nl","no","pl","pt","ru","sk","sv","tr"],TransitionWordsAssessment:["ar","ca","cs","de","el","en","es","fa","fr","he","hu","id","it","nl","no","pl","pt","ru","sk","sv","tr"],FunctionWordsInKeyphraseAssessment:["ar","cs","de","el","en","es","fa","fr","he","hu","id","it","ja","nl","no","pl","pt","ru","sk","sv","tr"],FleschReadingEaseAssessment:["de","en","es","fr","it","nl","pt","ru"]},$=Object.freeze({af:"af-ZA",ar:"ar-SA",az:"az-Latn-AZ",be:"be-BY",bg:"bg-BG",ca:"ca-ES",cs:"cs-CZ",da:"da-DK",de:"de-DE",dv:"dv-MV",el:"el-GR",en:"en-US",es:"es-ES",et:"et-EE",eu:"eu-ES",fa:"fa-IR",fi:"fi-FI",fo:"fo-FO",fr:"fr-FR",gl:"gl-ES",gu:"gu-IN",he:"he-IL",hi:"hi-IN",hr:"hr-HR",hu:"hu-HU",hy:"hy-AM",id:"id-ID",is:"is-IS",it:"it-IT",ja:"ja-JP",ka:"ka-GE",kk:"kk-KZ",kn:"kn-IN",ko:"ko-KR",kok:"kok-IN",ky:"ky-KG",lt:"lt-LT",lv:"lv-LV",mk:"mk-MK",mn:"mn-MN",mr:"mr-IN",ms:"ms-MY",nl:"nl-NL",no:"nb-NO",pa:"pa-IN",pl:"pl-PL",pt:"pt-BR",ro:"ro-RO",ru:"ru-RU",sa:"sa-IN",sk:"sk-SK",sl:"sl-SI",sq:"sq-AL",sr:"sr-Latn-CS",sv:"sv-SE",sw:"sw-KE",syr:"syr-SY",ta:"ta-IN",te:"te-IN",th:"th-TH",tr:"tr-TR",tt:"tt-RU",uk:"uk-UA",ur:"ur-PK",uz:"uz-Latn-UZ",vi:"vi-VN"}),Ve="__seo-audit__/context",Ye=["error","warn","info","debug"],Je="kirby$seo-audit$";let K,I;function Ze(){return K||I||(I=window.panel.api.get(Ve).then(r=>(Ee(r.assets),K=r,I=void 0,K)),I)}async function ne(r){const t=await r;return t.default||t}class re extends Error{constructor({locale:t,assessment:n,compatibleLocales:e}){super(`Locale ${t.toUpperCase()} is not supported by the assessment ${n}.`),this.locale=t,this.assessment=n,this.compatibleLocales=e}}var oe={};Object.defineProperty(oe,"__esModule",{value:!0});var W=oe.default={sentenceLength:{recommendedWordCount:20,slightlyTooMany:25,farTooMany:30},fleschReading:{borders:{veryEasy:90,easy:80,fairlyEasy:70,okay:60,fairlyDifficult:50,difficult:30,veryDifficult:0},scores:{veryEasy:9,easy:9,fairlyEasy:9,okay:9,fairlyDifficult:6,difficult:3,veryDifficult:3}}};const Xe={AltAttributeAssessment:{_label:"Alt-Attribut für Bilder",na:"Der Text enthält keine Bilder.",none:"Keines der {imagesWithoutAltAttribute} Bilder enthält ein Attribut für alternativen Text. Fügen Sie sie hinzu!",some:"Einige der {imagesWithoutAltAttribute} Bilder enthalten ein Attribut für alternativen Text. Fügen Sie sie hinzu!",every:"Alle Bilder enthalten ein Attribut für alternativen Text. Gute Arbeit!"},HeadingStructureOrderAssessment:{_label:"Reihenfolge der Überschriften",sequential:"Die Überschriftenstruktur ist in sequenzieller Reihenfolge. Gute Arbeit!",nonSequential:"Die Überschriftenstruktur ist nicht in sequenzieller Reihenfolge. Korrigieren Sie Ihre Überschriftenstruktur!"},SingleH1Assessment:{_label:"Einzelne H1",one:"Der Text enthält einen H1-Tag. Gute Arbeit!",multiple:"Der Text enthält mehrere H1-Tags. Überdenken Sie Ihre Überschriftenstruktur!",none:"Der Text enthält keinen H1-Tag. Fügen Sie ihn hinzu!"}},Qe={AltAttributeAssessment:{_label:"Image alt attribute",na:"The text doesn't contain any images.",none:"None of the {imagesWithoutAltAttribute} images contain an alternative text attribute. Add them!",some:"Some of the {imagesWithoutAltAttribute} images contain an alternative text attribute. Add them!",every:"All images contain an alternative text attribute. Good job!"},HeadingStructureOrderAssessment:{_label:"Heading structure",sequential:"The heading structure is in sequential order. Good job!",nonSequential:"The heading structure is not in sequential order. Fix your heading structure!"},SingleH1Assessment:{_label:"Single H1",one:"The text contains a single H1 tag. Good job!",multiple:"The text contains multiple H1 tags. Rethink your heading structure!",none:"The text contains no H1 tag. Add it!"}},et={AltAttributeAssessment:{_label:"Alt-tekst voor afbeeldingen",na:"De tekst bevat geen afbeeldingen.",none:"Geen van de {imagesWithoutAltAttribute} afbeeldingen bevat alt-tekst. Voeg ze toe!",some:"Sommige van de {imagesWithoutAltAttribute} afbeeldingen bevatten alt-tekst. Voeg ze toe!",every:"Alle afbeeldingen bevatten alt-tekst. Goed gedaan!"},HeadingStructureOrderAssessment:{_label:"Kopstructuur volgorde",sequential:"De kopstructuur is in opeenvolgende volgorde. Goed gedaan!",nonSequential:"De kopstructuur is niet in opeenvolgende volgorde. Corrigeer je kopstructuur!"},SingleH1Assessment:{_label:"Enkele H1",one:"De tekst bevat één H1-tag. Goed gedaan!",multiple:"De tekst bevat meerdere H1-tags. Herzie je kopstructuur!",none:"De tekst bevat geen H1-tag. Voeg er een toe!"}};function tt({htmlDocument:r,contentSelector:t}){const e=[...r.querySelectorAll(t)].flatMap(s=>s.tagName.toLowerCase()==="h1"?[s]:[...s.querySelectorAll("h1")]);return{score:e.length===1?9:3,translation:e.length===1?"one":e.length>1?"multiple":"none"}}function st({htmlDocument:r,contentSelector:t}){const e=[...r.querySelectorAll(t)].flatMap(i=>i.tagName.toLowerCase()==="img"?[i]:[...i.querySelectorAll("img")]);if(e.length===0)return{score:9,translation:"na"};const o=e.filter(i=>i.getAttribute("alt")===null).length;return{score:o===e.length||o>0?3:9,translation:o===e.length?"none":o>0?"some":"every",...o>0&&{context:{imagesWithoutAltAttribute:o}}}}function nt({htmlDocument:r,contentSelector:t}){const e=[...r.querySelectorAll(t)].flatMap(c=>["h1","h2","h3","h4","h5","h6"].includes(c.tagName.toLowerCase())?[c]:[...c.querySelectorAll("h1, h2, h3, h4, h5, h6")]);let s=0;const o=[];for(const c of e){const a=Number.parseInt(c.tagName.substring(1),10);a-s>1&&o.push(c),s=a}const i=o.length===0;return{score:i?9:3,translation:i?"sequential":"nonSequential",...!i&&{details:{text:`<ul>${o.map(c=>`<li><strong>${c.tagName}</strong>: ${c.innerText}</li>`).join("")}</ul>`}}}}function ie(r,t,n){if(!r)return n;let e,s;if(Array.isArray(t)?e=[...t]:typeof t=="string"?e=t.split("."):typeof t=="symbol"&&(e=[t]),!Array.isArray(e))throw new TypeError(`Expected props to be an array, a string or a symbol, got ${typeof e}`);for(;e.length;)if(s=e.shift(),!r||(r=r[s],r===void 0))return n;return r}function rt(r,t,n){return r.replace(/\{\s*(\w+)\s*\}/g,(e,s)=>t[s.toLowerCase()]||s)}const ae={de:Xe,en:Qe,nl:et},ot={seo:{AltAttributeAssessment:st,HeadingStructureOrderAssessment:nt,SingleH1Assessment:tt}};function it({htmlDocument:r,contentSelector:t,assessments:n,locale:e}){const s=ae[e]||ae.en,o={};for(const[i,c]of Object.entries(ot)){const a=[];for(const[d,p]of Object.entries(c)){if(n.length>0&&!n.includes(d.toLowerCase()))continue;const{score:h,translation:u,context:f={},details:L}=p({htmlDocument:r,contentSelector:t}),_=ie(s,`${d}.${u}`);if(!_)continue;const k=ie(s,`${d}._label`,d),S=Object.fromEntries(Object.entries(f).map(([C,A])=>[C.toLowerCase(),A]));a.push({score:h,rating:le(h),text:`${k}: ${rt(_,S)}`,details:L})}o[i]=a}return o}async function at(r,t){const n=await P("yoastseo"),e=Object.fromEntries(Object.entries(We).map(([s,o])=>[s.toLowerCase(),o]));for(const s of Object.values(n.assessments))for(const o of Object.keys(s)){if(te.includes(o)||!t.keyword&&t.assessments.length===0&&se.includes(o)||t.assessments.length>0&&!t.assessments.includes(o.toLowerCase()))continue;const i=e[o.toLowerCase()];if(!(!i||i.includes(r)))return{assessment:o,compatibleLocales:i}}}async function lt({htmlDocument:r,contentSelector:t,options:n,translations:e}){const s=await P("yoastseo"),{Jed:o}=await P("jed"),i=await ne(P("string-pixel-width")),c=ce(r,t),a=new s.Paper(c,{keyword:n.keyword,synonyms:n.synonyms.join(","),url:new URL(n.url).pathname,permalink:n.url,title:n.title,titleWidth:n.title?i(n.title,{font:"arial",size:20}):void 0,description:n.description,locale:n.langCulture.replace("-","_")}),d=new s.Researcher(a),p=new o({domain:"js-text-analysis",locale_data:{"js-text-analysis":e||{"":{}}}}),h=Object.entries(s.assessments).reduce((u,[f,L])=>{for(const[_,k]of Object.entries(L))if(!te.includes(_)&&!(!n.keyword&&n.assessments.length===0&&se.includes(_))&&!(n.assessments.length>0&&!n.assessments.includes(_.toLowerCase()))){if(typeof k=="object"&&Object.prototype.hasOwnProperty.call(k,"getResult")){const S=k.getResult(a,d,p);u[f].push(S)}else if(typeof k=="function"){const S=Ge[_],C=(W==null?void 0:W[S])||{},A=new k(C).getResult(a,d,p);u[f].push(A)}}return u},{seo:[],readability:[]});for(const u of Object.keys(h))h[u]=h[u].filter(f=>f.text).map(f=>({score:f.score,rating:le(f.score),text:f.text}));return h}function le(r){return r===-1?"error":r===0?"feedback":r<=4?"bad":r<=7?"ok":r>7?"good":""}async function ct(r){var i,c,a;const n=new DOMParser().parseFromString(r,"text/html");for(const d of Array.from(n.body.querySelectorAll("script, style")))d.remove();let e=n.documentElement.lang??$.en;e.includes("-")||(e=($==null?void 0:$[e.toLowerCase()])??$.en);const s=n.title||((i=n.querySelector("h1"))==null?void 0:i.innerText)||((c=n.querySelector("h2"))==null?void 0:c.innerText)||"",o=((a=n.querySelector('meta[name="description"]'))==null?void 0:a.content)||"";return{htmlDocument:n,locale:e,title:s,description:o}}function ce(r,t){const n=r.querySelectorAll(t);return Array.from(n).map(e=>e.innerHTML).join(`
`)}function ut(){const r=y();Z();const t=ee();return{generateReport:async(e,s,o)=>{const i=await ne(P("yoastseo-translations"));if(o.logLevel>1){s&&t.info("Content selector:",s);const u=e.querySelectorAll(s),f=ce(e,s);t.info("Selected elements:",u),t.info("Selected content:",f)}o.assessments=o.assessments.map(u=>{let f=u.toLowerCase();return f.endsWith("assessment")||(f+="assessment"),f});const c=r.translation.code,a={seo:[],readability:[]},d=it({htmlDocument:e,contentSelector:s,assessments:o.assessments,locale:c});for(const[u,f]of Object.entries(d))a[u]=a[u].concat(f);const p=await at(c,o);if(p)throw new re({...p,locale:c});const h=await lt({htmlDocument:e,contentSelector:s,options:o,translations:i[c]});for(const[u,f]of Object.entries(h))a[u]=a[u].concat(f);return a}}}const ue=Object.freeze({ignoreUnknown:!1,respectType:!1,respectFunctionNames:!1,respectFunctionProperties:!1,unorderedObjects:!0,unorderedArrays:!1,unorderedSets:!1,excludeKeys:void 0,excludeValues:void 0,replacer:void 0});function dt(r,t){t?t={...ue,...t}:t=ue;const n=de(t);return n.dispatch(r),n.toString()}const ft=Object.freeze(["prototype","__proto__","constructor"]);function de(r){let t="",n=new Map;const e=s=>{t+=s};return{toString(){return t},getContext(){return n},dispatch(s){return r.replacer&&(s=r.replacer(s)),this[s===null?"null":typeof s](s)},object(s){if(s&&typeof s.toJSON=="function")return this.object(s.toJSON());const o=Object.prototype.toString.call(s);let i="";const c=o.length;c<10?i="unknown:["+o+"]":i=o.slice(8,c-1),i=i.toLowerCase();let a=null;if((a=n.get(s))===void 0)n.set(s,n.size);else return this.dispatch("[CIRCULAR:"+a+"]");if(typeof Buffer<"u"&&Buffer.isBuffer&&Buffer.isBuffer(s))return e("buffer:"),e(s.toString("utf8"));if(i!=="object"&&i!=="function"&&i!=="asyncfunction")this[i]?this[i](s):r.ignoreUnknown||this.unkown(s,i);else{let d=Object.keys(s);r.unorderedObjects&&(d=d.sort());let p=[];r.respectType!==!1&&!pe(s)&&(p=ft),r.excludeKeys&&(d=d.filter(u=>!r.excludeKeys(u)),p=p.filter(u=>!r.excludeKeys(u))),e("object:"+(d.length+p.length)+":");const h=u=>{this.dispatch(u),e(":"),r.excludeValues||this.dispatch(s[u]),e(",")};for(const u of d)h(u);for(const u of p)h(u)}},array(s,o){if(o=o===void 0?r.unorderedArrays!==!1:o,e("array:"+s.length+":"),!o||s.length<=1){for(const a of s)this.dispatch(a);return}const i=new Map,c=s.map(a=>{const d=de(r);d.dispatch(a);for(const[p,h]of d.getContext())i.set(p,h);return d.toString()});return n=i,c.sort(),this.array(c,!1)},date(s){return e("date:"+s.toJSON())},symbol(s){return e("symbol:"+s.toString())},unkown(s,o){if(e(o),!!s&&(e(":"),s&&typeof s.entries=="function"))return this.array(Array.from(s.entries()),!0)},error(s){return e("error:"+s.toString())},boolean(s){return e("bool:"+s)},string(s){e("string:"+s.length+":"),e(s)},function(s){e("fn:"),pe(s)?this.dispatch("[native]"):this.dispatch(s.toString()),r.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(s.name)),r.respectFunctionProperties&&this.object(s)},number(s){return e("number:"+s)},xml(s){return e("xml:"+s.toString())},null(){return e("Null")},undefined(){return e("Undefined")},regexp(s){return e("regex:"+s.toString())},uint8array(s){return e("uint8array:"),this.dispatch(Array.prototype.slice.call(s))},uint8clampedarray(s){return e("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(s))},int8array(s){return e("int8array:"),this.dispatch(Array.prototype.slice.call(s))},uint16array(s){return e("uint16array:"),this.dispatch(Array.prototype.slice.call(s))},int16array(s){return e("int16array:"),this.dispatch(Array.prototype.slice.call(s))},uint32array(s){return e("uint32array:"),this.dispatch(Array.prototype.slice.call(s))},int32array(s){return e("int32array:"),this.dispatch(Array.prototype.slice.call(s))},float32array(s){return e("float32array:"),this.dispatch(Array.prototype.slice.call(s))},float64array(s){return e("float64array:"),this.dispatch(Array.prototype.slice.call(s))},arraybuffer(s){return e("arraybuffer:"),this.dispatch(new Uint8Array(s))},url(s){return e("url:"+s.toString())},map(s){e("map:");const o=[...s];return this.array(o,r.unorderedSets!==!1)},set(s){e("set:");const o=[...s];return this.array(o,r.unorderedSets!==!1)},file(s){return e("file:"),this.dispatch([s.name,s.size,s.type,s.lastModfied])},blob(){if(r.ignoreUnknown)return e("[blob]");throw new Error(`Hashing Blob objects is currently not supported
Use "options.replacer" or "options.ignoreUnknown"
`)},domwindow(){return e("domwindow")},bigint(s){return e("bigint:"+s.toString())},process(){return e("process")},timer(){return e("timer")},pipe(){return e("pipe")},tcp(){return e("tcp")},udp(){return e("udp")},tty(){return e("tty")},statwatcher(){return e("statwatcher")},securecontext(){return e("securecontext")},connection(){return e("connection")},zlib(){return e("zlib")},context(){return e("context")},nodescript(){return e("nodescript")},httpparser(){return e("httpparser")},dataview(){return e("dataview")},signal(){return e("signal")},fsevent(){return e("fsevent")},tlswrap(){return e("tlswrap")}}}const fe="[native code] }",pt=fe.length;function pe(r){return typeof r!="function"?!1:Function.prototype.toString.call(r).slice(-pt)===fe}var ht=Object.defineProperty,mt=(r,t,n)=>t in r?ht(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n,T=(r,t,n)=>(mt(r,typeof t!="symbol"?t+"":t,n),n);class R{constructor(t,n){T(this,"words"),T(this,"sigBytes"),t=this.words=t||[],this.sigBytes=n===void 0?t.length*4:n}toString(t){return(t||gt).stringify(this)}concat(t){if(this.clamp(),this.sigBytes%4)for(let n=0;n<t.sigBytes;n++){const e=t.words[n>>>2]>>>24-n%4*8&255;this.words[this.sigBytes+n>>>2]|=e<<24-(this.sigBytes+n)%4*8}else for(let n=0;n<t.sigBytes;n+=4)this.words[this.sigBytes+n>>>2]=t.words[n>>>2];return this.sigBytes+=t.sigBytes,this}clamp(){this.words[this.sigBytes>>>2]&=4294967295<<32-this.sigBytes%4*8,this.words.length=Math.ceil(this.sigBytes/4)}clone(){return new R([...this.words])}}const gt={stringify(r){const t=[];for(let n=0;n<r.sigBytes;n++){const e=r.words[n>>>2]>>>24-n%4*8&255;t.push((e>>>4).toString(16),(e&15).toString(16))}return t.join("")}},yt={stringify(r){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=[];for(let e=0;e<r.sigBytes;e+=3){const s=r.words[e>>>2]>>>24-e%4*8&255,o=r.words[e+1>>>2]>>>24-(e+1)%4*8&255,i=r.words[e+2>>>2]>>>24-(e+2)%4*8&255,c=s<<16|o<<8|i;for(let a=0;a<4&&e*8+a*6<r.sigBytes*8;a++)n.push(t.charAt(c>>>6*(3-a)&63))}return n.join("")}},bt={parse(r){const t=r.length,n=[];for(let e=0;e<t;e++)n[e>>>2]|=(r.charCodeAt(e)&255)<<24-e%4*8;return new R(n,t)}},vt={parse(r){return bt.parse(unescape(encodeURIComponent(r)))}};class _t{constructor(){T(this,"_data",new R),T(this,"_nDataBytes",0),T(this,"_minBufferSize",0),T(this,"blockSize",512/32)}reset(){this._data=new R,this._nDataBytes=0}_append(t){typeof t=="string"&&(t=vt.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes}_doProcessBlock(t,n){}_process(t){let n,e=this._data.sigBytes/(this.blockSize*4);t?e=Math.ceil(e):e=Math.max((e|0)-this._minBufferSize,0);const s=e*this.blockSize,o=Math.min(s*4,this._data.sigBytes);if(s){for(let i=0;i<s;i+=this.blockSize)this._doProcessBlock(this._data.words,i);n=this._data.words.splice(0,s),this._data.sigBytes-=o}return new R(n,o)}}class St extends _t{update(t){return this._append(t),this._process(),this}finalize(t){t&&this._append(t)}}var kt=Object.defineProperty,At=(r,t,n)=>t in r?kt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n,wt=(r,t,n)=>(At(r,t+"",n),n);const he=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],xt=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],B=[];class Lt extends St{constructor(){super(...arguments),wt(this,"_hash",new R([...he]))}reset(){super.reset(),this._hash=new R([...he])}_doProcessBlock(t,n){const e=this._hash.words;let s=e[0],o=e[1],i=e[2],c=e[3],a=e[4],d=e[5],p=e[6],h=e[7];for(let u=0;u<64;u++){if(u<16)B[u]=t[n+u]|0;else{const A=B[u-15],M=(A<<25|A>>>7)^(A<<14|A>>>18)^A>>>3,E=B[u-2],j=(E<<15|E>>>17)^(E<<13|E>>>19)^E>>>10;B[u]=M+B[u-7]+j+B[u-16]}const f=a&d^~a&p,L=s&o^s&i^o&i,_=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),k=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25),S=h+k+f+xt[u]+B[u],C=_+L;h=p,p=d,d=a,a=c+S|0,c=i,i=o,o=s,s=S+C|0}e[0]=e[0]+s|0,e[1]=e[1]+o|0,e[2]=e[2]+i|0,e[3]=e[3]+c|0,e[4]=e[4]+a|0,e[5]=e[5]+d|0,e[6]=e[6]+p|0,e[7]=e[7]+h|0}finalize(t){super.finalize(t);const n=this._nDataBytes*8,e=this._data.sigBytes*8;return this._data.words[e>>>5]|=128<<24-e%32,this._data.words[(e+64>>>9<<4)+14]=Math.floor(n/4294967296),this._data.words[(e+64>>>9<<4)+15]=n,this._data.sigBytes=this._data.words.length*4,this._process(),this._hash}}function Ct(r){return new Lt().finalize(r).toString(yt)}function Rt(r,t={}){const n=typeof r=="string"?r:dt(r,t);return Ct(n).slice(0,10)}function Et(...r){return`${Je}${Rt([...r])}`}const zt={__name:"SeoRatingBubble",props:{rating:{type:String,required:!0}},setup(r){return{__sfc:!0,COLOR_MAP:{good:"green",ok:"orange",bad:"red"}}}};var Ot=function(){var t=this,n=t._self._c,e=t._self._setupProxy;return n("div",{staticClass:"ksr-mt-[0.375em] ksr-h-[12px] ksr-w-[12px] ksr-rounded-full",style:{backgroundColor:`var(--color-${e.COLOR_MAP[t.rating]??"gray"}-600)`}},[n("span",{staticClass:"ksr-sr-only"},[t._v(t._s(t.rating))])])},Bt=[],Tt=F(zt,Ot,Bt);const jt=Tt.exports,Pt={__name:"SeoResultEntry",props:{result:{type:Object,required:!0},links:{type:Boolean,default:!0}},setup(r){const t=r,n=y(),e=x(()=>{const o=t.result.text.replace(/!$/,".");return t.links?o:s(o)});function s(o){return new DOMParser().parseFromString(o,"text/html").body.textContent||""}return{__sfc:!0,props:t,panel:n,parseText:e,stripTags:s,SeoRatingBubble:jt}}};var $t=function(){var t=this,n=t._self._c,e=t._self._setupProxy;return n("div",{staticClass:"ksr-flex ksr-items-start ksr-gap-2"},[n(e.SeoRatingBubble,{staticClass:"ksr-mx-1 ksr-shrink-0",attrs:{rating:t.result.rating}}),n("div",[n("div",{domProps:{innerHTML:t._s(e.parseText)}}),t.result.details?n("details",[n("summary",[t._v(t._s(e.panel.t("johannschopplich.seo-audit.issues")))]),n("div",{staticClass:"ksr-mb-1 ksr-rounded-[var(--rounded)] ksr-bg-[var(--color-border)] ksr-py-0.5",domProps:{innerHTML:t._s(t.result.details.text)}})]):t._e()])],1)},It=[],Mt=F(Pt,$t,It);const Ht=Mt.exports,me={...Te},Ft=Object.assign({inheritAttrs:!1},{__name:"SeoAudit",props:me,setup(r){const t=r,n=J(),e=y(),s=z(),o=ee(),{generateReport:i}=ut(),c=Et(e.view.path);let a;const d=b(),p=b(),h=b(),u=b(),f=b(),L=b(),_=b(),k=b(),S=b(),C=b(),A=b(!1),M=b(!1),E=b(),j=b(),{currentContent:V}=Z(),ge=x(()=>p.value||V.value[h.value]||""),ye=x(()=>{if(!u.value&&!f.value)return[];const m=u.value||V.value[f.value];return Array.isArray(m)?m:typeof m=="string"?m.split(",").map(g=>g.trim()):[]});Be(()=>e.language.code,()=>{Y()}),Y(!0);const{format:Ut}=new Intl.DateTimeFormat(e.translation.code.replace("_","-"),{dateStyle:"short",timeStyle:"short"});async function Y(m=!1){const{load:g}=we(),[w,v]=await Promise.all([Ze(),g({parent:t.parent,name:t.name})]);if(m){if(d.value=be(v.label)||e.t("johannschopplich.seo-audit.label"),h.value=v.keyphraseField,f.value=v.synonymsField,L.value=v.assessments,_.value=v.contentSelector,k.value=v.links,S.value=v.persisted,C.value=Ye.indexOf(w.config.logLevel??v.logLevel),E.value=w.licenseStatus,S.value){const N=JSON.parse(localStorage.getItem(c));N&&(j.value=N)}A.value=!0}p.value=v.keyphrase,u.value=v.synonyms,a=(await s.get(e.view.path,{select:"previewUrl"})).previewUrl}function be(m){return!m||typeof m=="string"?m:m[e.translation.code]??Object.values(m)[0]}async function Gt(){if(!a){e.notification.error(e.t("johannschopplich.seo-audit.error.missingPreviewUrl"));return}const m=a;e.isLoading=!0,M.value=!0;try{const g=await _e(m),{htmlDocument:w,locale:v,title:Se,description:N}=await ct(g),q=await i(w,_.value,{assessments:L.value,logLevel:C.value,url:m,title:Se,description:N,langCulture:v,keyword:ge.value,synonyms:ye.value});for(const ke of Object.keys(q))q[ke]=ve(q[ke]);j.value={result:q,timestamp:Date.now()},S.value&&localStorage.setItem(c,JSON.stringify(j.value))}catch(g){console.error(g),g instanceof re?e.notification.error(e.t("johannschopplich.seo-audit.error.incompatibleLocale",{locale:g.locale.toUpperCase(),assessment:g.assessment,compatibleLocales:g.compatibleLocales.map(w=>w.toUpperCase()).join(", ")})):e.notification.error(e.t("johannschopplich.seo-audit.analyze.error"))}e.isLoading=!1,M.value=!1,e.notification.success({icon:"check",message:e.t("johannschopplich.seo-audit.analyze.success")})}function ve(m){return m.toSorted((g,w)=>g.rating==="feedback"?-1:w.rating==="feedback"?1:g.score<w.score?-1:1)}async function _e(m){if(location.origin===new URL(m).origin){const v=await fetch(m);return v.ok||o.warn(`Response status code ${v.status} for URL ${m} is an indication that the error page is being analyzed.`),await v.text()}const{code:g,html:w}=await s.post("__seo-audit__/proxy",{url:m});return g!==200&&o.warn(`Response status code ${g} for URL ${m} is an indication that the error page is being analyzed.`),w}return{__sfc:!0,propsDefinition:me,props:t,_isKirby5:n,panel:e,api:s,logger:o,generateReport:i,storageKey:c,previewUrl:a,label:d,keyphrase:p,keyphraseField:h,synonyms:u,synonymsField:f,assessments:L,contentSelector:_,links:k,persisted:S,logLevel:C,isInitialized:A,isGenerating:M,licenseStatus:E,report:j,currentContent:V,resolvedKeyphrase:ge,resolvedSynonyms:ye,format:Ut,updateSectionData:Y,t:be,analyze:Gt,sortResults:ve,fetchHtml:_e,LicensingButtonGroup:De,SeoResultEntry:Ht}}});var Kt=function(){var t=this,n=t._self._c,e=t._self._setupProxy;return e.isInitialized?n("k-section",{attrs:{label:e.label}},[e.licenseStatus!==void 0?n("template",{slot:"options"},[n(e.LicensingButtonGroup,{attrs:{label:"Kirby SEO Audit","api-namespace":"__seo-audit__","license-status":e.licenseStatus,"pricing-url":"https://kirbyseo.com/buy"}})],1):t._e(),n("div",{staticClass:"ksr-space-y-4"},[n("k-button-group",{attrs:{layout:"collapsed"}},[n("k-button",{attrs:{icon:e.isGenerating?"loader":"seo-audit-analyze",text:e.panel.t("johannschopplich.seo-audit.analyze"),variant:"filled",theme:"positive",disabled:e.isGenerating},on:{click:function(s){return e.analyze()}}})],1),e.report?n("div",[n("k-box",{class:[e.isGenerating&&"ksr-cusor-wait ksr-pointer-events-none ksr-animate-pulse"],style:e._isKirby5?{"--box-color-text":"light-dark(var(--theme-color-900), var(--color-gray-200))","--box-color-back":"light-dark(var(--theme-color-back), var(--color-gray-850))"}:void 0,attrs:{theme:"passive"}},[n("k-text",{staticClass:"ksr-space-y-4",class:[e.isGenerating&&"ksr-opacity-50"],style:{"--link-color":"var(--color-text)","--link-color-hover":"light-dark(var(--color-blue-800), var(--color-blue-500))"}},[e.report.result.seo.length>0?n("div",t._l(e.report.result.seo,function(s,o){return n("div",{key:o},[n(e.SeoResultEntry,{attrs:{result:s,links:e.links}})],1)}),0):t._e(),e.report.result.readability.length>0?n("div",[n("k-label",{staticClass:"ksr-mb-1",style:{color:"var(--color-text)"}},[t._v(" "+t._s(e.panel.t("johannschopplich.seo-audit.readability"))+" ")]),t._l(e.report.result.readability,function(s,o){return n("div",{key:o},[n(e.SeoResultEntry,{attrs:{result:s,links:e.links}})],1)})],2):t._e()])],1),n("k-box",{staticClass:"ksr-border-transparent",attrs:{theme:"empty",icon:"clock"}},[t._v(" "+t._s(e.format(e.report.timestamp))+" ")])],1):t._e()],1)],2):t._e()},Nt=[],qt=F(Ft,Kt,Nt);const Dt=qt.exports;window.panel.plugin("johannschopplich/seo-audit",{sections:{"seo-audit":Dt},icons:{"seo-audit-analyze":'<path d="M8 3a7 7 0 0 0 0 14h1.07a7.06 7.06 0 0 1 0-2H8A5 5 0 0 1 8 5h8a5 5 0 0 1 4.9 6a7.021 7.021 0 0 1 1.426 2A7 7 0 0 0 16 3zm8 10a3 3 0 1 0 0 6a3 3 0 0 0 0-6m-5 3a5 5 0 1 1 9.172 2.757l2.535 2.536l-1.414 1.414l-2.536-2.535A5 5 0 0 1 11 16" />'}})})();