aiseo-audit 1.4.16 → 1.4.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,6 +9,7 @@
9
9
  [![Tests](https://img.shields.io/badge/tests-459%20passed-8FBC8F)](https://github.com/agencyenterprise/aiseo-audit)
10
10
  [![Coverage](https://img.shields.io/codecov/c/github/agencyenterprise/aiseo-audit?color=8FBC8F&label=coverage)](https://codecov.io/gh/agencyenterprise/aiseo-audit)
11
11
  [![GitHub Stars](https://img.shields.io/github/stars/agencyenterprise/aiseo-audit?style=flat&color=8FBC8F)](https://github.com/agencyenterprise/aiseo-audit/stargazers)
12
+ ![npm downloads](https://img.shields.io/npm/dt/aiseo-audit?label=Total%20Downloads)
12
13
 
13
14
  <div align="center">
14
15
  <strong>Testing example</strong><br /><br />
@@ -217,7 +218,10 @@ The audit also checks for three domain-level files that AI crawlers look for:
217
218
  - **`llms.txt`** is a proposed standard that provides LLMs with a concise summary of your site's purpose, key pages, and preferred citation format.
218
219
  - **`llms-full.txt`** is the extended version of `llms.txt` with more comprehensive site documentation.
219
220
 
220
- When auditing over HTTP, these files are checked against your local server. If your local server serves them, they will pass. If not, they will show as missing. Keep in mind that your local and production configurations for these files may differ, so verify them separately against your production domain.
221
+ When auditing over HTTP, these files are checked against your local server. If your local server serves them, they will pass. If not, they will show as missing.
222
+
223
+ > [!NOTE]
224
+ > Local audit results may differ slightly from production. Domain signal files (`robots.txt`, `llms.txt`, `llms-full.txt`) are often configured at the hosting or CDN level and may not be present on your local dev server. Always verify these signals separately against your production domain.
221
225
 
222
226
  ## Audit Categories
223
227
 
@@ -1,5 +1,5 @@
1
- var j="1.4.16";var oe={Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Accept-Language":"en-US,en;q=0.9","Accept-Encoding":"gzip, deflate, br","Cache-Control":"no-cache"};var z=class extends Error{code;url;constructor(e,o,s){super(s),this.name="FetchError",this.code=e,this.url=o}};function Ae(t,e){if(t instanceof z)return t;let o=t instanceof Error?t.message:String(t),s=t instanceof Error&&t.cause instanceof Error?t.cause.message:"",r=`${o} ${s}`.toLowerCase();if(t instanceof DOMException||t instanceof Error&&t.name==="AbortError"||r.includes("abort"))return new z("TIMEOUT",e,`Request timed out. The server at "${new URL(e).hostname}" did not respond in time.`);if(r.includes("getaddrinfo")||r.includes("enotfound")){let n=new URL(e).hostname;return new z("DNS_FAILURE",e,`DNS lookup failed for "${n}". Check that the domain exists and is spelled correctly.`)}return r.includes("econnrefused")?new z("CONNECTION_REFUSED",e,`Connection refused by "${new URL(e).hostname}". The server may be down or not accepting connections.`):r.includes("cert")||r.includes("ssl")||r.includes("tls")||r.includes("unable to verify")?new z("TLS_ERROR",e,`TLS/SSL error connecting to "${new URL(e).hostname}". The site may have an invalid or expired certificate.`):new z("NETWORK_ERROR",e,`Network error fetching "${e}": ${o}`)}async function G(t){let e=new AbortController,o=setTimeout(()=>e.abort(),t.timeout);try{let s=await fetch(t.url,{method:"GET",headers:{"User-Agent":t.userAgent,...oe},signal:e.signal,redirect:"follow"}),r=s.headers.get("content-length");if(r&&parseInt(r,10)>10485760)throw new z("TOO_LARGE",t.url,`Response from "${new URL(t.url).hostname}" exceeds the ${Math.round(10485760/1024/1024)}MB size limit.`);let n=await s.text();if(n.length>10485760)throw new z("TOO_LARGE",t.url,`Response from "${new URL(t.url).hostname}" exceeds the ${Math.round(10485760/1024/1024)}MB size limit.`);let a={};return s.headers.forEach((i,c)=>{a[c]=i}),{status:s.status,data:n,headers:a,finalUrl:s.url}}catch(s){throw Ae(s,t.url)}finally{clearTimeout(o)}}async function se(t){let e=new AbortController,o=setTimeout(()=>e.abort(),t.timeout);try{let s=await fetch(t.url,{method:"HEAD",headers:{"User-Agent":t.userAgent,...oe},signal:e.signal,redirect:"follow"}),r={};return s.headers.forEach((n,a)=>{r[a]=n}),{status:s.status,data:"",headers:r,finalUrl:s.url}}catch(s){throw Ae(s,t.url)}finally{clearTimeout(o)}}function V(t){let e=t.trim();return/^https?:\/\//i.test(e)||(e=`https://${e}`),new URL(e).toString().replace(/\/+$/,"")}function _o(t){try{let e=V(t);return new URL(e),!0}catch{return!1}}function re(t){try{return new URL(t).hostname}catch{return t}}import Qt from"compromise";var ne=new Set(["a","an","the","and","or","but","in","on","at","to","for","of","with","by","from","as","is","was","are","were","been","be","have","has","had","do","does","did","will","would","could","should","may","might","shall","can","need","must","that","which","who","whom","this","these","those","it","its","he","she","they","we","you","i","me","him","her","us","them","my","your","his","our","their","what","when","where","how","why","all","each","every","both","few","more","most","other","some","such","no","nor","not","only","own","same","so","than","too","very","just","about","above","after","again","also","any","because","before","between","during","here","if","into","like","new","now","over","then","there","through","under","up","out","off","down","much","well","back","even","still","also","get","got","one","two","make","many","say","said","see","go","come","take","know","think","good","great","first","last","long","way","find","use","used","using","while","being","made","however","since","per","via","based","within","without","across","along","around","among","until","another","www","http","https","com"]),Te=new Set(["I","A","OK","AM","PM","US","UK","EU","VS","EG","IE","ET","AL","HTML","CSS","JS","TS","URL","HTTP","HTTPS","API","SDK","CLI","GUI","PDF","CSV","JSON","XML","SQL","RSS","FTP","SSH","SSL","TLS","DNS","TCP","UDP","IP","RAM","ROM","CPU","GPU","SSD","HDD","USB","HDMI","FAQ","DIY","ASAP","FYI","TBD","TBA","ETA","ROI","KPI","CEO","CTO","CFO","COO","CIO","VP","SVP","EVP","HR","PR","QA","IT","RD","RND","LLC","INC","LTD","CORP","PLC","USD","EUR","GBP","JPY","CAD","ID","NO","RE","CC","BCC","GEO","SEO","SEM","PPC","CMS","CRM","ERP","SaaS","AI","ML","NLP","LLM","GPT","NER","TLDR","AKA","RSVP","PS"]),$e=/\b(?:Inc|Corp|Corporation|LLC|Ltd|Limited|Co|Company|Group|Foundation|Institute|University|Association|Society|Agency|Authority|Bureau|Commission|Council|Department|Board|Trust|Fund|Partners|Ventures|Labs|Technologies|Solutions|Systems|Services|Consulting|Media|Network|Studios|Entertainment|Healthcare|Pharmaceuticals|Dynamics|Holdings|Capital|Enterprises|International)\b/i,Ee=/\b(?:Mr|Mrs|Ms|Miss|Dr|Prof|Professor|Rev|Reverend|Sen|Senator|Rep|Representative|Gov|Governor|Pres|President|Gen|General|Col|Colonel|Sgt|Sergeant|Cpl|Corporal|Pvt|Private|Adm|Admiral|Capt|Captain|Lt|Lieutenant|Maj|Major|Sir|Dame|Lord|Lady|Hon|Honorable|Judge|Justice|Chancellor|Dean|Provost)\.\s*/;function Ce(t){let e=t.match(/\b[A-Z]{2,6}\b/g);if(!e)return[];let o=new Set,s=[];for(let r of e)!Te.has(r)&&!o.has(r)&&(o.add(r),s.push(r));return s}function Re(t){let e=/\b([A-Z][a-z]+(?:\s+(?:of|the|and|for|de|van|von|al|el|la|le|del|der|den|das|di|du))?\s+(?:[A-Z][a-z]+)(?:\s+[A-Z][a-z]+){0,3})\b/g,o=t.split(/[.!?]\s+/),s=new Set;for(let i of o){let l=i.trim().split(/\s+/)[0];l&&s.add(l)}let r=new Set,n=[],a;for(;(a=e.exec(t))!==null;){let i=a[1],c=i.split(/\s+/)[0];if(s.has(c)&&!t.includes(`. ${i}`)&&!t.includes(`, ${i}`)){let l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),p=t.match(new RegExp(l,"g"));if(!p||p.length<2)continue}!r.has(i)&&i.split(/\s+/).length>=2&&(r.add(i),n.push(i))}return n}function Ie(t){return $e.test(t)}function Oe(t,e){let o=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(?:${Ee.source})\\s*${o}`,"i").test(t)}function ae(t){if(t.length===0)return[];let e=[...t].sort((r,n)=>n.length-r.length),o=[],s=new Set;for(let r of e){let n=r.toLowerCase();if(s.has(n))continue;let a=!1;for(let i of s)if(i.includes(n)){a=!0;break}a||(o.push(r),s.add(n))}return o}function ie(t,e){let o=[...t,...e];return ae(o)}function Pe(t){let e=new Set(t.nouns().out("array").flatMap(n=>n.toLowerCase().replace(/[^a-z0-9\s'-]/g," ").split(/\s+/).filter(a=>a.length>2&&!ne.has(a)))),o=t.text().toLowerCase().replace(/[^a-z0-9\s'-]/g," ").split(/\s+/).filter(n=>n.length>2&&!ne.has(n)&&e.has(n));if(o.length===0)return[];let s=new Map;for(let n of o)s.set(n,(s.get(n)||0)+1);for(let n=0;n<o.length-1;n++){let a=`${o[n]} ${o[n+1]}`;s.set(a,(s.get(a)||0)+1)}let r=[];for(let[n,a]of s)if(a>=3){let c=n.includes(" ")?a*1.5:a;r.push([n,c])}return r.sort((n,a)=>a[1]-n[1]),r.map(([n])=>n)}function U(t,e){let o=0;for(let s of e){let r=new RegExp(s.source,s.flags),n=t.match(r);n&&(o+=n.length)}return o}function ce(t,e){let o=t.toLowerCase();return e.filter(s=>o.includes(s)).length}function Y(t){return t.split(/\s+/).filter(e=>e.length>0).length}function ke(t){return t.split(/[.!?]+/).filter(e=>e.trim().length>5).length}function le(t){if(t=t.toLowerCase().replace(/[^a-z]/g,""),t.length<=3)return 1;t=t.replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,""),t=t.replace(/^y/,"");let e=t.match(/[aeiouy]{1,2}/g);return e?Math.max(e.length,1):1}function pe(t){let e=t.split(/\s+/).filter(a=>a.length>0),o=t.split(/[.!?]+/).filter(a=>a.trim().length>5),s=e.reduce((a,i)=>a+le(i),0);if(e.length===0||o.length===0)return 0;let r=e.length/o.length,n=s/e.length;return 206.835-1.015*r-84.6*n}function ue(t){return t.split(/\s+/).filter(o=>o.length>0).filter(o=>le(o)>=4).length}function de(t){let e=t.split(/\s+/).filter(s=>s.length>0),o=t.split(/[.!?]+/).filter(s=>s.trim().length>5);return o.length===0?0:Math.round(e.length/o.length)}function B(t){let e=Qt(t),o=[...new Set(e.people().out("array"))],s=[...new Set(e.organizations().out("array"))],r=[...new Set(e.places().out("array"))],n=Ce(t),a=Re(t),i=[],c=[],l=[];for(let x of a)Oe(t,x)?i.push(x):Ie(x)?c.push(x):l.push(x);l.push(...n);let p=ie(o,i),f=ie(s,[...c,...l]),d=ae([...new Set(r)]),T=Pe(e),b=e.verbs().isImperative().length,A=e.numbers().length;return{people:p,organizations:f,places:d,topics:T,imperativeVerbCount:b,numberCount:A}}var Le=[[93,"A"],[90,"A-"],[87,"B+"],[83,"B"],[80,"B-"],[77,"C+"],[73,"C"],[70,"C-"],[67,"D+"],[63,"D"],[60,"D-"],[0,"F"]];function w(t,e,o="higher"){return o==="range"?Zt(t,e):o==="lower"?Xt(t,e):Kt(t,e)}function Kt(t,e){for(let[o,s]of e)if(t>=o)return s;return 0}function Xt(t,e){for(let[o,s]of e)if(t<=o)return s;return 0}function Zt(t,e){for(let[o,s,r]of e)if(t>=o&&t<=s)return r;return 0}function eo(t,e){let o=e>0?t/e:0;return o>=.7?"good":o>=.3?"needs_improvement":"critical"}function g(t,e,o,s,r){return{name:t,score:Math.round(Math.min(e,o)),maxScore:o,value:s,status:r??eo(e,o)}}function O(t){return t.reduce((e,o)=>e+o.score,0)}function P(t){return t.reduce((e,o)=>e+o.maxScore,0)}function De(t,e){let o={contentExtractability:e.contentExtractability,contentStructure:e.contentStructure,answerability:e.answerability,entityClarity:e.entityClarity,groundingSignals:e.groundingSignals,authorityContext:e.authorityContext,readabilityForCompression:e.readabilityForCompression},s=Object.values(o).reduce((l,p)=>l+p,0),r=0,n=0,a=0;for(let[l,p]of Object.entries(t)){r+=p.score,n+=p.maxScore;let f=o[l]??1,d=s>0?f/s:1/7,T=p.maxScore>0?p.score/p.maxScore*100:0;a+=T*d}let i=Math.round(a),c=me(i);return{overallScore:i,grade:c,totalPoints:r,maxPoints:n}}function me(t){for(let[e,o]of Le)if(t>=e)return o;return"F"}var k={contentExtractability:"Content Extractability",contentStructure:"Content Structure for Reuse",answerability:"Answerability",entityClarity:"Entity Clarity",groundingSignals:"Grounding Signals",authorityContext:"Authority Context",readabilityForCompression:"Readability for Compression"};var Me=[/\bis\s+defined\s+as\b/gi,/\brefers?\s+to\b/gi,/\bmeans?\s+that\b/gi,/\bis\s+a\s+type\s+of\b/gi,/\bcan\s+be\s+described\s+as\b/gi,/\balso\s+known\s+as\b/gi],Fe=[/\[\d+\]/g,/\([\w\s]+,?\s*\d{4}\)/g,/according\s+to/gi,/research\s+(?:shows|indicates|suggests)/gi,/studies?\s+(?:show|indicate|suggest|found)/gi,/data\s+from/gi,/as\s+reported\s+by/gi],Ue=[/according\s+to/gi,/\bsaid\b/gi,/\bstated\b/gi,/\breported\b/gi,/\bcited\s+by\b/gi],Ne=[/\d+(?:\.\d+)?\s*%/g,/\d+(?:\.\d+)?\s*(?:million|billion|thousand|trillion)/gi,/\$[\d,.]+/g,/increased\s+by/gi,/decreased\s+by/gi,/grew\s+by/gi],ze=[/step\s+\d+/gi,/^\s*\d+\.\s+\w/gm,/\bfirst(?:ly)?,?\s/gi,/\bsecond(?:ly)?,?\s/gi,/\bfinally,?\s/gi,/\bhow\s+to\b/gi],_e=[/\bin\s+summary\b/gi,/\bin\s+conclusion\b/gi,/\bto\s+summarize\b/gi,/\bkey\s+takeaways?\b/gi,/\bbottom\s+line\b/gi,/\btl;?dr\b/gi],je=[/what\s+is/gi,/what\s+are/gi,/how\s+to/gi,/how\s+do/gi,/why\s+is/gi,/why\s+do/gi,/when\s+to/gi,/where\s+to/gi,/which\s+is/gi,/who\s+is/gi],Be=[/^The\s+\w+\s+is\b/gm,/^It\s+is\b/gm,/^This\s+is\b/gm,/^They\s+are\b/gm,/\bsimply\s+put\b/gi,/\bin\s+short\b/gi],He=["however","therefore","moreover","furthermore","consequently","additionally","in contrast","similarly","as a result","for example","for instance","on the other hand","nevertheless","meanwhile","likewise","in addition","specifically","in particular","notably","importantly"],Ge=['[rel="author"]',".author",".byline",'[itemprop="author"]',".post-author",".entry-author",'meta[name="author"]'],We=["time[datetime]",'[itemprop="datePublished"]','[itemprop="dateModified"]',".published",".post-date",".entry-date",'meta[property="article:published_time"]','meta[property="article:modified_time"]'],qe=/^(?:what|how|why|when|where|which|who|can|do|does|is|are|should|will)\b/i,Ye=[/"[^"]{10,}"\s*[-\u2013\u2014]\s*[A-Z][a-z]+/g,/"[^"]{10,}",?\s+said\s+[A-Z]/g,/"[^"]{10,}",?\s+according\s+to\s+[A-Z]/g,/according\s+to\s+[A-Z][a-z]+[^,]*,\s*"[^"]{10,}"/g,/\u201c[^\u201d]{10,}\u201d\s*[-\u2013\u2014]\s*[A-Z][a-z]+/g,/\u201c[^\u201d]{10,}\u201d,?\s+said\s+[A-Z]/g],he=["GPTBot","ChatGPT-User","ClaudeBot","PerplexityBot","Google-Extended"],Je=['[itemprop="dateModified"]','meta[property="article:modified_time"]'],Ve=["time[datetime]",'[itemprop="datePublished"]','meta[property="article:published_time"]'];function Qe(t){let e=0,o=0;return t("h2").each((s,r)=>{let n=t(r).text().trim();if(!(n.includes("?")||qe.test(n)))return;e++;let i=t(r).nextAll("p").first();if(!i.length)return;let l=i.text().trim().split(/[.!?]/)[0]||"";l.length>0&&l.length<=200&&o++}),{total:e,withCapsule:o}}function Ke(t){let e=t("h1, h2, h3, h4, h5, h6");if(e.length===0)return{sectionCount:0,avgWordsPerSection:0,sections:[]};let o=[];e.each((r,n)=>{let a=0,i=t(n).next();for(;i.length&&!i.is("h1, h2, h3, h4, h5, h6");){let c=i.text().trim();a+=c.split(/\s+/).filter(l=>l.length>0).length,i=i.next()}a>0&&o.push(a)});let s=o.length>0?Math.round(o.reduce((r,n)=>r+n,0)/o.length):0;return{sectionCount:o.length,avgWordsPerSection:s,sections:o}}function Xe(t){let e=[];return t('script[type="application/ld+json"]').each((o,s)=>{try{let r=JSON.parse(t(s).html()||"{}");Array.isArray(r)?e.push(...r):e.push(r)}catch{}}),e}function Ze(t,e){let o=t.cleanText,s=t.$,r=[],{imperativeVerbCount:n=0}=e??B(o),a=U(o,Me),i=w(a,[[6,10],[3,7],[1,4],[0,0]]);r.push(g("Definition Patterns",i,10,`${a} definition patterns`));let c=U(o,Be),l=w(c,[[5,11],[2,8],[1,4],[0,0]]);r.push(g("Direct Answer Statements",l,11,`${c} direct statements`));let p=Qe(t.$),f=p.total>0?p.withCapsule/p.total:0,d=p.total===0?0:w(f,[[.7,13],[.4,9],[.01,5]]);r.push(g("Answer Capsules",d,13,p.total>0?`${p.withCapsule}/${p.total} question headings have answer capsules`:"No question-framed H2s found",p.total===0?"neutral":void 0));let T=U(o,ze),b=s("ol").length>0,A=T+n+(b?2:0),x=w(A,[[5,10],[2,7],[1,3],[0,0]]);r.push(g("Step-by-Step Content",x,10,`${T} step indicators, ${n} instruction verbs${b?", ordered lists found":""}`));let S=o.match(/[^.!?]*\?/g)||[],y=U(o,je),$=w(S.length+y,[[10,11],[5,8],[2,5],[1,2],[0,0]]);r.push(g("Q/A Patterns",$,11,`${S.length} questions, ${y} query patterns`));let C=U(o,_e),E=w(C,[[2,9],[1,5]]);return r.push(g("Summary/Conclusion",E,9,C>0?`${C} summary markers`:"No summary markers")),{category:{name:k.answerability,key:"answerability",score:O(r),maxScore:P(r),factors:r},rawData:{answerCapsules:p,questionsFound:S.slice(0,5)}}}function et(t){let e=t('meta[property="og:site_name"]').attr("content")?.trim();if(e)return e;let o=t('script[type="application/ld+json"]'),s=null;return o.each((r,n)=>{try{let a=JSON.parse(t(n).html()||"{}");a["@type"]==="Organization"&&a.name&&(s=String(a.name).trim()),a.publisher?.name&&(s=s||String(a.publisher.name).trim())}catch{}}),s||null}function tt(t,e,o){if(!o)return{score:0,surfacesFound:0,surfacesChecked:0};let s=o.toLowerCase(),r=4,n=0;e.toLowerCase().includes(s)&&n++,(t('meta[property="og:title"]').attr("content")||"").toLowerCase().includes(s)&&n++,t("footer").text().toLowerCase().includes(s)&&n++;let c=t('[class*="copyright"], [class*="legal"]').text().toLowerCase(),l=t("header").text().toLowerCase();return(c.includes(s)||l.includes(s))&&n++,{score:n>=4?10:n>=3?7:n>=2?4:n>=1?2:0,surfacesFound:n,surfacesChecked:r}}function ot(t){let e=null,o=null;for(let n of Je){let a=t(n).first();if(a.length){e=a.attr("datetime")||a.attr("content")||a.text().trim();break}}for(let n of Ve){let a=t(n).first();if(a.length){o=a.attr("datetime")||a.attr("content")||a.text().trim();break}}let s=e||o,r=null;if(s){let n=new Date(s);if(!isNaN(n.getTime())){let a=new Date;r=(a.getFullYear()-n.getFullYear())*12+(a.getMonth()-n.getMonth())}}return{publishDate:o,modifiedDate:e,ageInMonths:r,hasModifiedDate:!!e}}var to={Article:["headline","author","datePublished"],NewsArticle:["headline","author","datePublished"],BlogPosting:["headline","author","datePublished"],FAQPage:["mainEntity"],HowTo:["name","step"],Organization:["name","url"],LocalBusiness:["name","address"],Product:["name"],WebPage:["name"]};function st(t){let e=[];for(let s of t){let r=String(s["@type"]||""),n=to[r];if(!n)continue;let a=n.filter(c=>s[c]!=null),i=n.filter(c=>s[c]==null);e.push({type:r,present:a,missing:i})}let o=e.length>0?e.reduce((s,r)=>s+r.present.length/(r.present.length+r.missing.length),0)/e.length:0;return{totalTypes:e.length,avgCompleteness:o,details:e}}function rt(t){let e=t.$,o=[],s={},r=!1,n="";for(let F of Ge){let I=e(F).first();if(I.length){r=!0,n=I.text().trim()||I.attr("content")||"Found";break}}o.push(g("Author Attribution",r?10:0,10,r?n:"Not found"));let a=t.html.includes('"@type":"Organization"')||t.html.includes('"@type": "Organization"'),i=e('meta[property="og:site_name"]').attr("content")||"",c=a||i.length>0;o.push(g("Organization Identity",c?10:0,10,c?i||"Schema found":"Not found"));let l=e('a[href*="about"], a[href*="team"], a[href*="company"]').length>0,p=e('a[href*="contact"]').length>0,f=l&&p?10:l||p?5:0;o.push(g("Contact/About Links",f,10,`${l?"About":""}${l&&p?" + ":""}${p?"Contact":""}${!l&&!p?"Not found":""}`));let d=!1,T="";for(let F of We){let I=e(F).first();if(I.length){d=!0,T=I.attr("datetime")||I.attr("content")||I.text().trim();break}}o.push(g("Publication Date",d?8:0,8,d?T:"Not found"));let b=ot(t.$),A=0;b.ageInMonths!==null&&(A=w(b.ageInMonths,[[6,12],[12,9],[24,5]],"lower"),b.hasModifiedDate&&A<12&&(A=Math.min(A+2,12))),o.push(g("Content Freshness",A,12,b.ageInMonths!==null?`${b.ageInMonths} months old${b.hasModifiedDate?", modified date present":""}`:"No parseable date found")),s.freshness=b;let x=Xe(t.$),S=x.map(F=>F["@type"]).filter(Boolean),$=["og:title","og:description","og:image","og:type"].filter(F=>e(`meta[property="${F}"]`).length>0),C=e('link[rel="canonical"]').attr("href"),E=0;S.length>0&&(E+=4),$.length>=3?E+=4:$.length>0&&(E+=2),C&&(E+=4),s.structuredDataTypes=S,o.push(g("Structured Data",E,12,`${S.length>0?S.join(", "):"No JSON-LD"}, ${$.length}/4 OG tags${C?", canonical":""}`));let R=st(x),W=R.totalTypes===0?0:w(R.avgCompleteness,[[.8,10],[.5,7],[.01,4]]);o.push(g("Schema Completeness",W,10,R.totalTypes>0?`${R.totalTypes} schema types, ${Math.round(R.avgCompleteness*100)}% complete`:"No recognized JSON-LD schemas found",R.totalTypes===0?"neutral":void 0)),s.schemaCompleteness=R;let N=et(t.$),M=tt(t.$,t.title,N);return o.push(g("Entity Consistency",M.score,10,N?`"${N}" found in ${M.surfacesFound}/${M.surfacesChecked} surfaces`:"No identifiable entity name",N?void 0:"neutral")),s.entityConsistency={entityName:N||null,surfacesFound:M.surfacesFound,surfacesChecked:M.surfacesChecked},{category:{name:k.authorityContext,key:"authorityContext",score:O(o),maxScore:P(o),factors:o},rawData:s}}function oo(t){let e=[],o=null;for(let s of t.split(`
2
- `)){let r=s.split("#")[0].trim();if(!r){o=null;continue}let n=r.indexOf(":");if(n===-1)continue;let a=r.slice(0,n).trim().toLowerCase(),i=r.slice(n+1).trim();a==="user-agent"?(o||(o={agents:[],rules:[]},e.push(o)),o.agents.push(i.toLowerCase())):(a==="disallow"||a==="allow")&&o&&o.rules.push({type:a,path:i})}return e}function so(t,e){let o=[],s=[];for(let r of t)r.agents.includes(e)?o.push(...r.rules):r.agents.includes("*")&&s.push(...r.rules);return{specific:o,wildcard:s}}function ro(t,e){let o=-1,s=!1;for(let r of t){let n=r.path;!n||!e.startsWith(n)||(n.length>o?(o=n.length,s=r.type==="disallow"):n.length===o&&r.type==="allow"&&(s=!1))}return o>=0&&s}function no(t){return t.filter(e=>e.type==="disallow"&&e.path&&e.path!=="/").map(e=>e.path)}function nt(t){if(!t)return{allowed:[],blocked:[],unknown:[...he]};let e=oo(t),o=[],s=[],r=[],n=[];for(let a of he){let i=a.toLowerCase(),{specific:c,wildcard:l}=so(e,i),p=c.length>0?c:l;if(p.length===0){r.push(a);continue}if(ro(p,"/"))s.push(a);else{o.push(a);let d=no(p);for(let T of d){let b=`${a}: ${T}`;n.includes(b)||n.push(b)}}}return{allowed:o,blocked:s,unknown:r,...n.length>0&&{partiallyBlocked:n}}}function at(t,e,o){let s=[],r={},n=e.statusCode===200?12:e.statusCode<400?8:0;s.push(g("Fetch Success",n,12,`HTTP ${e.statusCode} in ${e.fetchTimeMs}ms`));let a=t.stats.rawByteLength>0?t.stats.cleanTextLength/t.stats.rawByteLength:0,i=w(a,[[.05,.15,12],[.16,1/0,10],[.01,.049,8],[1e-4,.009,2]],"range");s.push(g("Text Extraction Quality",i,12,`${(a*100).toFixed(1)}% content ratio`));let c=t.stats.boilerplateRatio,l=w(1-c,[[.7,12],[.5,9],[.3,6],[.01,2]]);s.push(g("Boilerplate Ratio",l,12,`${(c*100).toFixed(0)}% boilerplate`));let p=t.stats.wordCount,f=w(p,[[300,3e3,12],[3001,1/0,10],[100,299,8],[1,99,2]],"range");if(s.push(g("Word Count Adequacy",f,12,`${p} words`)),o){let S=nt(o.robotsTxt),y=S.blocked.length,$=w(y,[[0,10],[2,6],[4,3]],"lower");s.push(g("AI Crawler Access",$,10,y===0?"All major AI crawlers allowed":`${S.blocked.join(", ")} blocked in robots.txt`)),r.crawlerAccess=S,r.llmsTxt={llmsTxtExists:o.llmsTxtExists,llmsFullTxtExists:o.llmsFullTxtExists};let C=o.llmsTxtExists,E=o.llmsFullTxtExists,R=C&&E?6:C||E?4:0;s.push(g("LLMs.txt Presence",R,6,C&&E?"llms.txt + llms-full.txt found":C?"llms.txt found":E?"llms-full.txt found":"Not found",!C&&!E?"neutral":void 0))}let d=t.stats.imageCount,T=t.stats.imagesWithAlt,b=t.$("figure figcaption").length,A=d>0?T/d:0,x=0;return d>0&&(A>=.9?x+=5:A>=.5?x+=3:x+=1,b>0&&(x+=3)),s.push(g("Image Accessibility",x,8,d>0?`${T}/${d} images have alt text${b>0?`, ${b} figcaptions`:""}`:"No images found",d===0?"neutral":void 0)),r.imageAccessibility={imageCount:d,imagesWithAlt:T,figcaptionCount:b},{category:{name:k.contentExtractability,key:"contentExtractability",score:O(s),maxScore:P(s),factors:s},rawData:r}}function it(t){let e=t.$,o=[],s=t.stats.h1Count,r=t.stats.h2Count,n=t.stats.h3Count,a=0;s===1?a+=4:s>0&&(a+=2),r>=2?a+=4:r>0&&(a+=2),n>0&&(a+=3),o.push(g("Heading Hierarchy",a,11,`${s} H1, ${r} H2, ${n} H3`));let i=t.stats.listItemCount,c=w(i,[[10,11],[5,8],[1,4],[0,0]]);o.push(g("Lists Presence",c,11,`${i} list items`));let l=t.stats.tableCount,p=w(l,[[2,8],[1,5]]);o.push(g("Tables Presence",p,8,`${l} table(s)`,l===0?"neutral":void 0));let f=t.stats.paragraphCount,d=f>0?Math.round(t.stats.wordCount/f):0,T=w(d,[[30,150,11],[1,199,7],[200,1/0,2]],"range");o.push(g("Paragraph Structure",T,11,`${f} paragraphs, avg ${d} words`));let b=e("strong, b").length>0,A=f>0?t.stats.headingCount/f:0,x=0;b&&(x+=4),d<=150&&(x+=4),A>=.1&&(x+=3),o.push(g("Scannability",x,11,`${b?"Bold text found":"No bold text"}, ${A.toFixed(2)} heading ratio`));let S=Ke(t.$),y=S.sectionCount===0?0:w(S.avgWordsPerSection,[[120,180,12],[80,250,8],[1,1/0,4]],"range");return o.push(g("Section Length",y,12,S.sectionCount>0?`${S.sectionCount} sections, avg ${S.avgWordsPerSection} words`:"No headed sections found",S.sectionCount===0?"neutral":void 0)),{category:{name:k.contentStructure,key:"contentStructure",score:O(o),maxScore:P(o),factors:o},rawData:{sectionLengths:S}}}function ct(t,e){let o=t.cleanText,s=[],r=e??B(o),n=r.people.length+r.organizations.length+r.places.length+r.topics.length,a=w(n,[[9,20],[4,14],[1,7],[0,0]]);s.push(g("Entity Richness",a,20,`${n} entities (${r.people.length} people, ${r.organizations.length} orgs, ${r.places.length} places)`,n===0?"neutral":void 0));let i=t.title.toLowerCase().split(/\s+/).filter(y=>y.length>3),l=t.$("h1").first().text().toLowerCase().split(/\s+/).filter(y=>y.length>3),p=[...new Set([...i,...l])],f=r.topics.map(y=>y.toLowerCase()),d=0;for(let y of p)(f.some($=>$.includes(y))||o.toLowerCase().split(y).length>3)&&d++;let T=p.length>0?d/p.length:0,b=p.length===0?0:w(T,[[.5,25],[.01,15]]);s.push(g("Topic Consistency",b,25,`${d}/${p.length} title keywords align with content topics`,p.length===0?"neutral":void 0));let A=Y(o),x=A>0?n/A*100:0,S=w(x,[[2,8,15],[1,1/0,10],[.01,.99,3]],"range");return s.push(g("Entity Density",S,15,`${x.toFixed(1)} entities per 100 words`)),{category:{name:k.entityClarity,key:"entityClarity",score:O(s),maxScore:P(s),factors:s},rawData:{entities:r}}}function lt(t,e){let o=t.$,s=t.cleanText,r=[],{numberCount:n=0}=e??B(s),a=t.externalLinks,i=w(a.length,[[6,13],[3,10],[1,6],[0,0]]);r.push(g("External References",i,13,`${a.length} external links`));let c=U(s,Fe),l=o("blockquote, cite, q").length,p=c+l,f=w(p,[[6,13],[3,9],[1,5],[0,0]]);r.push(g("Citation Patterns",f,13,`${c} citation indicators, ${l} quote elements`));let d=U(s,Ne),T=d+n,b=w(T,[[9,13],[4,9],[1,5],[0,0]]);r.push(g("Numeric Claims",b,13,`${d} statistical references, ${n} numeric values`));let A=U(s,Ue),x=w(A,[[5,11],[2,8],[1,4],[0,0]]);r.push(g("Attribution Indicators",x,11,`${A} attribution patterns`));let S=U(s,Ye),y=o("blockquote").filter((E,R)=>o(R).find("cite, footer, figcaption").length>0).length,$=S+y,C=w($,[[4,10],[2,7],[1,4],[0,0]]);return r.push(g("Quoted Attribution",C,10,`${$} attributed quotes`,$===0?"neutral":void 0)),{category:{name:k.groundingSignals,key:"groundingSignals",score:O(r),maxScore:P(r),factors:r},rawData:{externalLinks:a.slice(0,10)}}}function pt(t){let e=t.cleanText,o=[],s=de(e),r=w(s,[[12,22,15],[8,29,10],[1,1/0,5]],"range");o.push(g("Sentence Length",r,15,`Avg ${s} words/sentence`));let n=pe(e),a=w(n,[[60,70,15],[71,1/0,13],[50,59,10],[30,49,6]],"range");o.push(g("Readability",a,15,`Flesch Reading Ease: ${n.toFixed(1)}`));let i=Y(e),c=ue(e),l=i>0?c/i:0,p=w(l,[[.02,15],[.05,12],[.1,8]],"lower");o.push(g("Jargon Density",p,15,`${(l*100).toFixed(1)}% complex words`));let f=ce(e,He),d=w(f,[[10,15],[5,11],[2,7],[1,3],[0,0]]);return o.push(g("Transition Usage",d,15,`${f} transition types found`)),{category:{name:k.readabilityForCompression,key:"readabilityForCompression",score:O(o),maxScore:P(o),factors:o},rawData:{avgSentenceLength:s,readabilityScore:n}}}function ut(t,e,o){let s=B(t.cleanText),r=at(t,e,o),n=it(t),a=Ze(t,s),i=ct(t,s),c=lt(t,s),l=rt(t),p=pt(t);return{categories:{contentExtractability:r.category,contentStructure:n.category,answerability:a.category,entityClarity:i.category,groundingSignals:c.category,authorityContext:l.category,readabilityForCompression:p.category},rawData:{title:t.title,metaDescription:t.metaDescription,wordCount:t.stats.wordCount,...r.rawData,...n.rawData,...a.rawData,...i.rawData,...c.rawData,...l.rawData,...p.rawData}}}import*as X from"cheerio";var ao=["script","style","noscript","svg","iframe","nav","header","footer","aside",'[role="navigation"]','[role="banner"]','[role="contentinfo"]',".sidebar","#sidebar",".cookie-banner","#cookie-consent",".cookie-notice",".nav",".navbar",".footer",".header",".menu",".ad",".ads",".advertisement",'[class*="cookie"]','[class*="consent"]','[class*="popup"]','[class*="modal"]'];function dt(t){for(let e of ao)t(e).remove()}function io(t){return t.replace(/\s+/g," ").trim()}var co="p,div,td,th,li,h1,h2,h3,h4,h5,h6,dt,dd,br,blockquote,section,article";function mt(t){return t(co).each((e,o)=>{t(o).append(" ")}),io(t("body").text())}function ht(t,e){let o=X.load(t),s=o("title").text().trim()||o('meta[property="og:title"]').attr("content")?.trim()||"",r=o('meta[name="description"]').attr("content")?.trim()||o('meta[property="og:description"]').attr("content")?.trim()||"",n=X.load(t);n("script, style, noscript").remove();let a=n("body").text().replace(/\s+/g," ").trim(),i=Buffer.byteLength(t,"utf-8"),c=o("h1").length,l=o("h2").length,p=o("h3").length,f=c+l+p+o("h4, h5, h6").length,d=o("a[href]").length,T=o("img").length,b=o("ul, ol").length,A=o("li").length,x=o("table").length,S=o("p").length,y=new Set(["image","photo","logo","icon","picture","img","graphic","thumbnail"]),$=0;o("img").each((Q,H)=>{let q=o(H).attr("alt")?.trim()??"";q.split(/\s+/).filter(Vt=>Vt.length>0).length>1&&q.length<200&&!y.has(q.toLowerCase())&&$++});let C=re(e),E=[];o('a[href^="http"]').each((Q,H)=>{let q=o(H).attr("href");try{re(q)!==C&&E.push({url:q,text:o(H).text().trim().substring(0,50)})}catch{}});let R=E.length,W=X.load(t);dt(W);let N=mt(W),M=N.length,F=a.length>0?Math.max(0,Math.min(1,1-M/a.length)):0,I={wordCount:Y(N),sentenceCount:ke(N),paragraphCount:S,headingCount:f,h1Count:c,h2Count:l,h3Count:p,linkCount:d,externalLinkCount:R,imageCount:T,imagesWithAlt:$,listCount:b,listItemCount:A,tableCount:x,boilerplateRatio:F,rawByteLength:i,cleanTextLength:M};return{url:e,html:t,cleanText:N,title:s,metaDescription:r,stats:I,$:o,externalLinks:E}}import{z as L}from"zod";var gt=L.object({url:L.url(),timeout:L.number().positive().default(45e3),userAgent:L.string().default(`AISEOAudit/${j}`)}),qr=L.object({url:L.string(),finalUrl:L.string(),statusCode:L.number(),contentType:L.string(),html:L.string(),byteLength:L.number(),fetchTimeMs:L.number(),redirected:L.boolean()});async function Z(t){let e=gt.parse(t),o=Date.now(),s=await G({url:e.url,timeout:e.timeout,userAgent:e.userAgent}),r=Date.now()-o,n=s.data,a=s.finalUrl||e.url,i=s.headers["content-type"]||"unknown";return{url:e.url,finalUrl:a,statusCode:s.status,contentType:i,html:n,byteLength:Buffer.byteLength(n,"utf-8"),fetchTimeMs:r,redirected:a!==e.url}}var ft=`<!-- Before: prose enumeration -->
1
+ var j="1.4.19";var oe={Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Accept-Language":"en-US,en;q=0.9","Accept-Encoding":"gzip, deflate, br","Cache-Control":"no-cache"};var z=class extends Error{code;url;constructor(e,o,s){super(s),this.name="FetchError",this.code=e,this.url=o}};function Ae(t,e){if(t instanceof z)return t;let o=t instanceof Error?t.message:String(t),s=t instanceof Error&&t.cause instanceof Error?t.cause.message:"",r=`${o} ${s}`.toLowerCase();if(t instanceof DOMException||t instanceof Error&&t.name==="AbortError"||r.includes("abort"))return new z("TIMEOUT",e,`Request timed out. The server at "${new URL(e).hostname}" did not respond in time.`);if(r.includes("getaddrinfo")||r.includes("enotfound")){let n=new URL(e).hostname;return new z("DNS_FAILURE",e,`DNS lookup failed for "${n}". Check that the domain exists and is spelled correctly.`)}return r.includes("econnrefused")?new z("CONNECTION_REFUSED",e,`Connection refused by "${new URL(e).hostname}". The server may be down or not accepting connections.`):r.includes("cert")||r.includes("ssl")||r.includes("tls")||r.includes("unable to verify")?new z("TLS_ERROR",e,`TLS/SSL error connecting to "${new URL(e).hostname}". The site may have an invalid or expired certificate.`):new z("NETWORK_ERROR",e,`Network error fetching "${e}": ${o}`)}async function G(t){let e=new AbortController,o=setTimeout(()=>e.abort(),t.timeout);try{let s=await fetch(t.url,{method:"GET",headers:{"User-Agent":t.userAgent,...oe},signal:e.signal,redirect:"follow"}),r=s.headers.get("content-length");if(r&&parseInt(r,10)>10485760)throw new z("TOO_LARGE",t.url,`Response from "${new URL(t.url).hostname}" exceeds the ${Math.round(10485760/1024/1024)}MB size limit.`);let n=await s.text();if(n.length>10485760)throw new z("TOO_LARGE",t.url,`Response from "${new URL(t.url).hostname}" exceeds the ${Math.round(10485760/1024/1024)}MB size limit.`);let a={};return s.headers.forEach((i,c)=>{a[c]=i}),{status:s.status,data:n,headers:a,finalUrl:s.url}}catch(s){throw Ae(s,t.url)}finally{clearTimeout(o)}}async function se(t){let e=new AbortController,o=setTimeout(()=>e.abort(),t.timeout);try{let s=await fetch(t.url,{method:"HEAD",headers:{"User-Agent":t.userAgent,...oe},signal:e.signal,redirect:"follow"}),r={};return s.headers.forEach((n,a)=>{r[a]=n}),{status:s.status,data:"",headers:r,finalUrl:s.url}}catch(s){throw Ae(s,t.url)}finally{clearTimeout(o)}}function V(t){let e=t.trim();return/^https?:\/\//i.test(e)||(e=`https://${e}`),new URL(e).toString().replace(/\/+$/,"")}function jo(t){try{let e=V(t);return new URL(e),!0}catch{return!1}}function re(t){try{return new URL(t).hostname}catch{return t}}import Kt from"compromise";var ne=new Set(["a","an","the","and","or","but","in","on","at","to","for","of","with","by","from","as","is","was","are","were","been","be","have","has","had","do","does","did","will","would","could","should","may","might","shall","can","need","must","that","which","who","whom","this","these","those","it","its","he","she","they","we","you","i","me","him","her","us","them","my","your","his","our","their","what","when","where","how","why","all","each","every","both","few","more","most","other","some","such","no","nor","not","only","own","same","so","than","too","very","just","about","above","after","again","also","any","because","before","between","during","here","if","into","like","new","now","over","then","there","through","under","up","out","off","down","much","well","back","even","still","also","get","got","one","two","make","many","say","said","see","go","come","take","know","think","good","great","first","last","long","way","find","use","used","using","while","being","made","however","since","per","via","based","within","without","across","along","around","among","until","another","www","http","https","com"]),Te=new Set(["I","A","OK","AM","PM","US","UK","EU","VS","EG","IE","ET","AL","HTML","CSS","JS","TS","URL","HTTP","HTTPS","API","SDK","CLI","GUI","PDF","CSV","JSON","XML","SQL","RSS","FTP","SSH","SSL","TLS","DNS","TCP","UDP","IP","RAM","ROM","CPU","GPU","SSD","HDD","USB","HDMI","FAQ","DIY","ASAP","FYI","TBD","TBA","ETA","ROI","KPI","CEO","CTO","CFO","COO","CIO","VP","SVP","EVP","HR","PR","QA","IT","RD","RND","LLC","INC","LTD","CORP","PLC","USD","EUR","GBP","JPY","CAD","ID","NO","RE","CC","BCC","GEO","SEO","SEM","PPC","CMS","CRM","ERP","SaaS","AI","ML","NLP","LLM","GPT","NER","TLDR","AKA","RSVP","PS"]),$e=/\b(?:Inc|Corp|Corporation|LLC|Ltd|Limited|Co|Company|Group|Foundation|Institute|University|Association|Society|Agency|Authority|Bureau|Commission|Council|Department|Board|Trust|Fund|Partners|Ventures|Labs|Technologies|Solutions|Systems|Services|Consulting|Media|Network|Studios|Entertainment|Healthcare|Pharmaceuticals|Dynamics|Holdings|Capital|Enterprises|International)\b/i,Ee=/\b(?:Mr|Mrs|Ms|Miss|Dr|Prof|Professor|Rev|Reverend|Sen|Senator|Rep|Representative|Gov|Governor|Pres|President|Gen|General|Col|Colonel|Sgt|Sergeant|Cpl|Corporal|Pvt|Private|Adm|Admiral|Capt|Captain|Lt|Lieutenant|Maj|Major|Sir|Dame|Lord|Lady|Hon|Honorable|Judge|Justice|Chancellor|Dean|Provost)\.\s*/;function Ce(t){let e=t.match(/\b[A-Z]{2,6}\b/g);if(!e)return[];let o=new Set,s=[];for(let r of e)!Te.has(r)&&!o.has(r)&&(o.add(r),s.push(r));return s}function Re(t){let e=/\b([A-Z][a-z]+(?:\s+(?:of|the|and|for|de|van|von|al|el|la|le|del|der|den|das|di|du))?\s+(?:[A-Z][a-z]+)(?:\s+[A-Z][a-z]+){0,3})\b/g,o=t.split(/[.!?]\s+/),s=new Set;for(let i of o){let l=i.trim().split(/\s+/)[0];l&&s.add(l)}let r=new Set,n=[],a;for(;(a=e.exec(t))!==null;){let i=a[1],c=i.split(/\s+/)[0];if(s.has(c)&&!t.includes(`. ${i}`)&&!t.includes(`, ${i}`)){let l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),p=t.match(new RegExp(l,"g"));if(!p||p.length<2)continue}!r.has(i)&&i.split(/\s+/).length>=2&&(r.add(i),n.push(i))}return n}function Ie(t){return $e.test(t)}function Pe(t,e){let o=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(?:${Ee.source})\\s*${o}`,"i").test(t)}function ae(t){if(t.length===0)return[];let e=[...t].sort((r,n)=>n.length-r.length),o=[],s=new Set;for(let r of e){let n=r.toLowerCase();if(s.has(n))continue;let a=!1;for(let i of s)if(i.includes(n)){a=!0;break}a||(o.push(r),s.add(n))}return o}function ie(t,e){let o=[...t,...e];return ae(o)}function Oe(t){let e=new Set(t.nouns().out("array").flatMap(n=>n.toLowerCase().replace(/[^a-z0-9\s'-]/g," ").split(/\s+/).filter(a=>a.length>2&&!ne.has(a)))),o=t.text().toLowerCase().replace(/[^a-z0-9\s'-]/g," ").split(/\s+/).filter(n=>n.length>2&&!ne.has(n)&&e.has(n));if(o.length===0)return[];let s=new Map;for(let n of o)s.set(n,(s.get(n)||0)+1);for(let n=0;n<o.length-1;n++){let a=`${o[n]} ${o[n+1]}`;s.set(a,(s.get(a)||0)+1)}let r=[];for(let[n,a]of s)if(a>=3){let c=n.includes(" ")?a*1.5:a;r.push([n,c])}return r.sort((n,a)=>a[1]-n[1]),r.map(([n])=>n)}function U(t,e){let o=0;for(let s of e){let r=new RegExp(s.source,s.flags),n=t.match(r);n&&(o+=n.length)}return o}function ce(t,e){let o=t.toLowerCase();return e.filter(s=>o.includes(s)).length}function Y(t){return t.split(/\s+/).filter(e=>e.length>0).length}function ke(t){return t.split(/[.!?]+/).filter(e=>e.trim().length>5).length}function le(t){if(t=t.toLowerCase().replace(/[^a-z]/g,""),t.length<=3)return 1;t=t.replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,""),t=t.replace(/^y/,"");let e=t.match(/[aeiouy]{1,2}/g);return e?Math.max(e.length,1):1}function pe(t){let e=t.split(/\s+/).filter(a=>a.length>0),o=t.split(/[.!?]+/).filter(a=>a.trim().length>5),s=e.reduce((a,i)=>a+le(i),0);if(e.length===0||o.length===0)return 0;let r=e.length/o.length,n=s/e.length;return 206.835-1.015*r-84.6*n}function ue(t){return t.split(/\s+/).filter(o=>o.length>0).filter(o=>le(o)>=4).length}function de(t){let e=t.split(/\s+/).filter(s=>s.length>0),o=t.split(/[.!?]+/).filter(s=>s.trim().length>5);return o.length===0?0:Math.round(e.length/o.length)}function H(t){let e=Kt(t),o=[...new Set(e.people().out("array"))],s=[...new Set(e.organizations().out("array"))],r=[...new Set(e.places().out("array"))],n=Ce(t),a=Re(t),i=[],c=[],l=[];for(let x of a)Pe(t,x)?i.push(x):Ie(x)?c.push(x):l.push(x);l.push(...n);let p=ie(o,i),f=ie(s,[...c,...l]),d=ae([...new Set(r)]),T=Oe(e),b=e.verbs().isImperative().length,A=e.numbers().length;return{people:p,organizations:f,places:d,topics:T,imperativeVerbCount:b,numberCount:A}}var Le=[[93,"A"],[90,"A-"],[87,"B+"],[83,"B"],[80,"B-"],[77,"C+"],[73,"C"],[70,"C-"],[67,"D+"],[63,"D"],[60,"D-"],[0,"F"]];function w(t,e,o="higher"){return o==="range"?eo(t,e):o==="lower"?Zt(t,e):Xt(t,e)}function Xt(t,e){for(let[o,s]of e)if(t>=o)return s;return 0}function Zt(t,e){for(let[o,s]of e)if(t<=o)return s;return 0}function eo(t,e){for(let[o,s,r]of e)if(t>=o&&t<=s)return r;return 0}function to(t,e){let o=e>0?t/e:0;return o>=.7?"good":o>=.3?"needs_improvement":"critical"}function g(t,e,o,s,r){return{name:t,score:Math.round(Math.min(e,o)),maxScore:o,value:s,status:r??to(e,o)}}function P(t){return t.reduce((e,o)=>e+o.score,0)}function O(t){return t.reduce((e,o)=>e+o.maxScore,0)}function De(t,e){let o={contentExtractability:e.contentExtractability,contentStructure:e.contentStructure,answerability:e.answerability,entityClarity:e.entityClarity,groundingSignals:e.groundingSignals,authorityContext:e.authorityContext,readabilityForCompression:e.readabilityForCompression},s=Object.values(o).reduce((l,p)=>l+p,0),r=0,n=0,a=0;for(let[l,p]of Object.entries(t)){r+=p.score,n+=p.maxScore;let f=o[l]??1,d=s>0?f/s:1/7,T=p.maxScore>0?p.score/p.maxScore*100:0;a+=T*d}let i=Math.round(a),c=me(i);return{overallScore:i,grade:c,totalPoints:r,maxPoints:n}}function me(t){for(let[e,o]of Le)if(t>=e)return o;return"F"}var k={contentExtractability:"Content Extractability",contentStructure:"Content Structure for Reuse",answerability:"Answerability",entityClarity:"Entity Clarity",groundingSignals:"Grounding Signals",authorityContext:"Authority Context",readabilityForCompression:"Readability for Compression"};var Me=[/\bis\s+defined\s+as\b/gi,/\brefers?\s+to\b/gi,/\bmeans?\s+that\b/gi,/\bis\s+a\s+type\s+of\b/gi,/\bcan\s+be\s+described\s+as\b/gi,/\balso\s+known\s+as\b/gi],Fe=[/\[\d+\]/g,/\([\w\s]+,?\s*\d{4}\)/g,/according\s+to/gi,/research\s+(?:shows|indicates|suggests)/gi,/studies?\s+(?:show|indicate|suggest|found)/gi,/data\s+from/gi,/as\s+reported\s+by/gi],Ue=[/according\s+to/gi,/\bsaid\b/gi,/\bstated\b/gi,/\breported\b/gi,/\bcited\s+by\b/gi],Ne=[/\d+(?:\.\d+)?\s*%/g,/\d+(?:\.\d+)?\s*(?:million|billion|thousand|trillion)/gi,/\$[\d,.]+/g,/increased\s+by/gi,/decreased\s+by/gi,/grew\s+by/gi],ze=[/step\s+\d+/gi,/^\s*\d+\.\s+\w/gm,/\bfirst(?:ly)?,?\s/gi,/\bsecond(?:ly)?,?\s/gi,/\bfinally,?\s/gi,/\bhow\s+to\b/gi],_e=[/\bin\s+summary\b/gi,/\bin\s+conclusion\b/gi,/\bto\s+summarize\b/gi,/\bkey\s+takeaways?\b/gi,/\bbottom\s+line\b/gi,/\btl;?dr\b/gi],je=[/what\s+is/gi,/what\s+are/gi,/how\s+to/gi,/how\s+do/gi,/why\s+is/gi,/why\s+do/gi,/when\s+to/gi,/where\s+to/gi,/which\s+is/gi,/who\s+is/gi],He=[/^The\s+\w+\s+is\b/gm,/^It\s+is\b/gm,/^This\s+is\b/gm,/^They\s+are\b/gm,/\bsimply\s+put\b/gi,/\bin\s+short\b/gi],Be=["however","therefore","moreover","furthermore","consequently","additionally","in contrast","similarly","as a result","for example","for instance","on the other hand","nevertheless","meanwhile","likewise","in addition","specifically","in particular","notably","importantly"],Ge=['[rel="author"]',".author",".byline",'[itemprop="author"]',".post-author",".entry-author",'meta[name="author"]'],We=["time[datetime]",'[itemprop="datePublished"]','[itemprop="dateModified"]',".published",".post-date",".entry-date",'meta[property="article:published_time"]','meta[property="article:modified_time"]'],qe=/^(?:what|how|why|when|where|which|who|can|do|does|is|are|should|will)\b/i,Ye=[/"[^"]{10,}"\s*[-\u2013\u2014]\s*[A-Z][a-z]+/g,/"[^"]{10,}",?\s+said\s+[A-Z]/g,/"[^"]{10,}",?\s+according\s+to\s+[A-Z]/g,/according\s+to\s+[A-Z][a-z]+[^,]*,\s*"[^"]{10,}"/g,/\u201c[^\u201d]{10,}\u201d\s*[-\u2013\u2014]\s*[A-Z][a-z]+/g,/\u201c[^\u201d]{10,}\u201d,?\s+said\s+[A-Z]/g],he=["GPTBot","ChatGPT-User","ClaudeBot","PerplexityBot","Google-Extended"],Je=['[itemprop="dateModified"]','meta[property="article:modified_time"]'],Ve=["time[datetime]",'[itemprop="datePublished"]','meta[property="article:published_time"]'];function Qe(t){let e=0,o=0;return t("h2").each((s,r)=>{let n=t(r).text().trim();if(!(n.includes("?")||qe.test(n)))return;e++;let i=t(r).nextAll("p").first();if(!i.length)return;let l=i.text().trim().split(/[.!?]/)[0]||"";l.length>0&&l.length<=200&&o++}),{total:e,withCapsule:o}}function Ke(t){let e=t("h1, h2, h3, h4, h5, h6");if(e.length===0)return{sectionCount:0,avgWordsPerSection:0,sections:[]};let o=[];e.each((r,n)=>{let a=0,i=t(n).next();for(;i.length&&!i.is("h1, h2, h3, h4, h5, h6");){let c=i.text().trim();a+=c.split(/\s+/).filter(l=>l.length>0).length,i=i.next()}a>0&&o.push(a)});let s=o.length>0?Math.round(o.reduce((r,n)=>r+n,0)/o.length):0;return{sectionCount:o.length,avgWordsPerSection:s,sections:o}}function Xe(t){let e=[];return t('script[type="application/ld+json"]').each((o,s)=>{try{let r=JSON.parse(t(s).html()||"{}");Array.isArray(r)?e.push(...r):e.push(r)}catch{}}),e}function Ze(t,e){let o=t.cleanText,s=t.$,r=[],{imperativeVerbCount:n=0}=e??H(o),a=U(o,Me),i=w(a,[[6,10],[3,7],[1,4],[0,0]]);r.push(g("Definition Patterns",i,10,`${a} definition patterns`));let c=U(o,He),l=w(c,[[5,11],[2,8],[1,4],[0,0]]);r.push(g("Direct Answer Statements",l,11,`${c} direct statements`));let p=Qe(t.$),f=p.total>0?p.withCapsule/p.total:0,d=p.total===0?0:w(f,[[.7,13],[.4,9],[.01,5]]);r.push(g("Answer Capsules",d,13,p.total>0?`${p.withCapsule}/${p.total} question headings have answer capsules`:"No question-framed H2s found",p.total===0?"neutral":void 0));let T=U(o,ze),b=s("ol").length>0,A=T+n+(b?2:0),x=w(A,[[5,10],[2,7],[1,3],[0,0]]);r.push(g("Step-by-Step Content",x,10,`${T} step indicators, ${n} instruction verbs${b?", ordered lists found":""}`));let S=o.match(/[^.!?]*\?/g)||[],y=U(o,je),$=w(S.length+y,[[10,11],[5,8],[2,5],[1,2],[0,0]]);r.push(g("Q/A Patterns",$,11,`${S.length} questions, ${y} query patterns`));let C=U(o,_e),E=w(C,[[2,9],[1,5]]);return r.push(g("Summary/Conclusion",E,9,C>0?`${C} summary markers`:"No summary markers")),{category:{name:k.answerability,key:"answerability",score:P(r),maxScore:O(r),factors:r},rawData:{answerCapsules:p,questionsFound:S.slice(0,5)}}}function et(t){let e=t('meta[property="og:site_name"]').attr("content")?.trim();if(e)return e;let o=t('script[type="application/ld+json"]'),s=null;return o.each((r,n)=>{try{let a=JSON.parse(t(n).html()||"{}");a["@type"]==="Organization"&&a.name&&(s=String(a.name).trim()),a.publisher?.name&&(s=s||String(a.publisher.name).trim())}catch{}}),s||null}function tt(t,e,o){if(!o)return{score:0,surfacesFound:0,surfacesChecked:0};let s=o.toLowerCase(),r=4,n=0;e.toLowerCase().includes(s)&&n++,(t('meta[property="og:title"]').attr("content")||"").toLowerCase().includes(s)&&n++,t("footer").text().toLowerCase().includes(s)&&n++;let c=t('[class*="copyright"], [class*="legal"]').text().toLowerCase(),l=t("header").text().toLowerCase();return(c.includes(s)||l.includes(s))&&n++,{score:n>=4?10:n>=3?7:n>=2?4:n>=1?2:0,surfacesFound:n,surfacesChecked:r}}function ot(t){let e=null,o=null;for(let n of Je){let a=t(n).first();if(a.length){e=a.attr("datetime")||a.attr("content")||a.text().trim();break}}for(let n of Ve){let a=t(n).first();if(a.length){o=a.attr("datetime")||a.attr("content")||a.text().trim();break}}let s=e||o,r=null;if(s){let n=new Date(s);if(!isNaN(n.getTime())){let a=new Date;r=(a.getFullYear()-n.getFullYear())*12+(a.getMonth()-n.getMonth())}}return{publishDate:o,modifiedDate:e,ageInMonths:r,hasModifiedDate:!!e}}var oo={Article:["headline","author","datePublished"],NewsArticle:["headline","author","datePublished"],BlogPosting:["headline","author","datePublished"],FAQPage:["mainEntity"],HowTo:["name","step"],Organization:["name","url"],LocalBusiness:["name","address"],Product:["name"],WebPage:["name"]};function st(t){let e=[];for(let s of t){let r=String(s["@type"]||""),n=oo[r];if(!n)continue;let a=n.filter(c=>s[c]!=null),i=n.filter(c=>s[c]==null);e.push({type:r,present:a,missing:i})}let o=e.length>0?e.reduce((s,r)=>s+r.present.length/(r.present.length+r.missing.length),0)/e.length:0;return{totalTypes:e.length,avgCompleteness:o,details:e}}function rt(t){let e=t.$,o=[],s={},r=!1,n="";for(let F of Ge){let I=e(F).first();if(I.length){r=!0,n=I.text().trim()||I.attr("content")||"Found";break}}o.push(g("Author Attribution",r?10:0,10,r?n:"Not found"));let a=t.html.includes('"@type":"Organization"')||t.html.includes('"@type": "Organization"'),i=e('meta[property="og:site_name"]').attr("content")||"",c=a||i.length>0;o.push(g("Organization Identity",c?10:0,10,c?i||"Schema found":"Not found"));let l=e('a[href*="about"], a[href*="team"], a[href*="company"]').length>0,p=e('a[href*="contact"]').length>0,f=l&&p?10:l||p?5:0;o.push(g("Contact/About Links",f,10,`${l?"About":""}${l&&p?" + ":""}${p?"Contact":""}${!l&&!p?"Not found":""}`));let d=!1,T="";for(let F of We){let I=e(F).first();if(I.length){d=!0,T=I.attr("datetime")||I.attr("content")||I.text().trim();break}}o.push(g("Publication Date",d?8:0,8,d?T:"Not found"));let b=ot(t.$),A=0;b.ageInMonths!==null&&(A=w(b.ageInMonths,[[6,12],[12,9],[24,5]],"lower"),b.hasModifiedDate&&A<12&&(A=Math.min(A+2,12))),o.push(g("Content Freshness",A,12,b.ageInMonths!==null?`${b.ageInMonths} months old${b.hasModifiedDate?", modified date present":""}`:"No parseable date found")),s.freshness=b;let x=Xe(t.$),S=x.map(F=>F["@type"]).filter(Boolean),$=["og:title","og:description","og:image","og:type"].filter(F=>e(`meta[property="${F}"]`).length>0),C=e('link[rel="canonical"]').attr("href"),E=0;S.length>0&&(E+=4),$.length>=3?E+=4:$.length>0&&(E+=2),C&&(E+=4),s.structuredDataTypes=S,o.push(g("Structured Data",E,12,`${S.length>0?S.join(", "):"No JSON-LD"}, ${$.length}/4 OG tags${C?", canonical":""}`));let R=st(x),W=R.totalTypes===0?0:w(R.avgCompleteness,[[.8,10],[.5,7],[.01,4]]);o.push(g("Schema Completeness",W,10,R.totalTypes>0?`${R.totalTypes} schema types, ${Math.round(R.avgCompleteness*100)}% complete`:"No recognized JSON-LD schemas found",R.totalTypes===0?"neutral":void 0)),s.schemaCompleteness=R;let N=et(t.$),M=tt(t.$,t.title,N);return o.push(g("Entity Consistency",M.score,10,N?`"${N}" found in ${M.surfacesFound}/${M.surfacesChecked} surfaces`:"No identifiable entity name",N?void 0:"neutral")),s.entityConsistency={entityName:N||null,surfacesFound:M.surfacesFound,surfacesChecked:M.surfacesChecked},{category:{name:k.authorityContext,key:"authorityContext",score:P(o),maxScore:O(o),factors:o},rawData:s}}function so(t){let e=[],o=null;for(let s of t.split(`
2
+ `)){let r=s.split("#")[0].trim();if(!r){o=null;continue}let n=r.indexOf(":");if(n===-1)continue;let a=r.slice(0,n).trim().toLowerCase(),i=r.slice(n+1).trim();a==="user-agent"?(o||(o={agents:[],rules:[]},e.push(o)),o.agents.push(i.toLowerCase())):(a==="disallow"||a==="allow")&&o&&o.rules.push({type:a,path:i})}return e}function ro(t,e){let o=[],s=[];for(let r of t)r.agents.includes(e)?o.push(...r.rules):r.agents.includes("*")&&s.push(...r.rules);return{specific:o,wildcard:s}}function no(t,e){let o=-1,s=!1;for(let r of t){let n=r.path;!n||!e.startsWith(n)||(n.length>o?(o=n.length,s=r.type==="disallow"):n.length===o&&r.type==="allow"&&(s=!1))}return o>=0&&s}function ao(t){return t.filter(e=>e.type==="disallow"&&e.path&&e.path!=="/").map(e=>e.path)}function nt(t){if(!t)return{allowed:[],blocked:[],unknown:[...he]};let e=so(t),o=[],s=[],r=[],n=[];for(let a of he){let i=a.toLowerCase(),{specific:c,wildcard:l}=ro(e,i),p=c.length>0?c:l;if(p.length===0){r.push(a);continue}if(no(p,"/"))s.push(a);else{o.push(a);let d=ao(p);for(let T of d){let b=`${a}: ${T}`;n.includes(b)||n.push(b)}}}return{allowed:o,blocked:s,unknown:r,...n.length>0&&{partiallyBlocked:n}}}function at(t,e,o){let s=[],r={},n=e.statusCode===200?12:e.statusCode<400?8:0;s.push(g("Fetch Success",n,12,`HTTP ${e.statusCode} in ${e.fetchTimeMs}ms`));let a=t.stats.rawByteLength>0?t.stats.cleanTextLength/t.stats.rawByteLength:0,i=w(a,[[.05,.159,12],[.16,1/0,10],[.01,.049,8],[1e-4,.009,2]],"range");s.push(g("Text Extraction Quality",i,12,`${(a*100).toFixed(1)}% content ratio`));let c=t.stats.boilerplateRatio,l=w(1-c,[[.7,12],[.5,9],[.3,6],[.01,2]]);s.push(g("Boilerplate Ratio",l,12,`${(c*100).toFixed(0)}% boilerplate`));let p=t.stats.wordCount,f=w(p,[[300,3e3,12],[3001,1/0,10],[100,299,8],[1,99,2]],"range");if(s.push(g("Word Count Adequacy",f,12,`${p} words`)),o){let S=nt(o.robotsTxt),y=S.blocked.length,$=w(y,[[0,10],[2,6],[4,3]],"lower");s.push(g("AI Crawler Access",$,10,y===0?"All major AI crawlers allowed":`${S.blocked.join(", ")} blocked in robots.txt`)),r.crawlerAccess=S,r.llmsTxt={llmsTxtExists:o.llmsTxtExists,llmsFullTxtExists:o.llmsFullTxtExists};let C=o.llmsTxtExists,E=o.llmsFullTxtExists,R=C&&E?6:C||E?4:0;s.push(g("LLMs.txt Presence",R,6,C&&E?"llms.txt + llms-full.txt found":C?"llms.txt found":E?"llms-full.txt found":"Not found",!C&&!E?"neutral":void 0))}let d=t.stats.imageCount,T=t.stats.imagesWithAlt,b=t.$("figure figcaption").length,A=d>0?T/d:0,x=0;return d>0&&(A>=.9?x+=5:A>=.5?x+=3:x+=1,b>0&&(x+=3)),s.push(g("Image Accessibility",x,8,d>0?`${T}/${d} images have alt text${b>0?`, ${b} figcaptions`:""}`:"No images found",d===0?"neutral":void 0)),r.imageAccessibility={imageCount:d,imagesWithAlt:T,figcaptionCount:b},{category:{name:k.contentExtractability,key:"contentExtractability",score:P(s),maxScore:O(s),factors:s},rawData:r}}function it(t){let e=t.$,o=[],s=t.stats.h1Count,r=t.stats.h2Count,n=t.stats.h3Count,a=0;s===1?a+=4:s>0&&(a+=2),r>=2?a+=4:r>0&&(a+=2),n>0&&(a+=3),o.push(g("Heading Hierarchy",a,11,`${s} H1, ${r} H2, ${n} H3`));let i=t.stats.listItemCount,c=w(i,[[10,11],[5,8],[1,4],[0,0]]);o.push(g("Lists Presence",c,11,`${i} list items`));let l=t.stats.tableCount,p=w(l,[[2,8],[1,5]]);o.push(g("Tables Presence",p,8,`${l} table(s)`,l===0?"neutral":void 0));let f=t.stats.paragraphCount,d=f>0?Math.round(t.stats.wordCount/f):0,T=w(d,[[30,150,11],[1,199,7],[200,1/0,2]],"range");o.push(g("Paragraph Structure",T,11,`${f} paragraphs, avg ${d} words`));let b=e("strong, b").length>0,A=f>0?t.stats.headingCount/f:0,x=0;b&&(x+=4),d<=150&&(x+=4),A>=.1&&(x+=3),o.push(g("Scannability",x,11,`${b?"Bold text found":"No bold text"}, ${A.toFixed(2)} heading ratio`));let S=Ke(t.$),y=S.sectionCount===0?0:w(S.avgWordsPerSection,[[120,180,12],[80,250,8],[1,1/0,4]],"range");return o.push(g("Section Length",y,12,S.sectionCount>0?`${S.sectionCount} sections, avg ${S.avgWordsPerSection} words`:"No headed sections found",S.sectionCount===0?"neutral":void 0)),{category:{name:k.contentStructure,key:"contentStructure",score:P(o),maxScore:O(o),factors:o},rawData:{sectionLengths:S}}}function ct(t,e){let o=t.cleanText,s=[],r=e??H(o),n=r.people.length+r.organizations.length+r.places.length+r.topics.length,a=w(n,[[9,20],[4,14],[1,7],[0,0]]);s.push(g("Entity Richness",a,20,`${n} entities (${r.people.length} people, ${r.organizations.length} orgs, ${r.places.length} places)`,n===0?"neutral":void 0));let i=t.title.toLowerCase().split(/\s+/).filter(y=>y.length>3),l=t.$("h1").first().text().toLowerCase().split(/\s+/).filter(y=>y.length>3),p=[...new Set([...i,...l])],f=r.topics.map(y=>y.toLowerCase()),d=0;for(let y of p)(f.some($=>$.includes(y))||o.toLowerCase().split(y).length>3)&&d++;let T=p.length>0?d/p.length:0,b=p.length===0?0:w(T,[[.5,25],[.01,15]]);s.push(g("Topic Consistency",b,25,`${d}/${p.length} title keywords align with content topics`,p.length===0?"neutral":void 0));let A=Y(o),x=A>0?n/A*100:0,S=w(x,[[2,8,15],[1,1/0,10],[.01,.99,3]],"range");return s.push(g("Entity Density",S,15,`${x.toFixed(1)} entities per 100 words`)),{category:{name:k.entityClarity,key:"entityClarity",score:P(s),maxScore:O(s),factors:s},rawData:{entities:r}}}function lt(t,e){let o=t.$,s=t.cleanText,r=[],{numberCount:n=0}=e??H(s),a=t.externalLinks,i=w(a.length,[[6,13],[3,10],[1,6],[0,0]]);r.push(g("External References",i,13,`${a.length} external links`));let c=U(s,Fe),l=o("blockquote, cite, q").length,p=c+l,f=w(p,[[6,13],[3,9],[1,5],[0,0]]);r.push(g("Citation Patterns",f,13,`${c} citation indicators, ${l} quote elements`));let d=U(s,Ne),T=d+n,b=w(T,[[9,13],[4,9],[1,5],[0,0]]);r.push(g("Numeric Claims",b,13,`${d} statistical references, ${n} numeric values`));let A=U(s,Ue),x=w(A,[[5,11],[2,8],[1,4],[0,0]]);r.push(g("Attribution Indicators",x,11,`${A} attribution patterns`));let S=U(s,Ye),y=o("blockquote").filter((E,R)=>o(R).find("cite, footer, figcaption").length>0).length,$=S+y,C=w($,[[4,10],[2,7],[1,4],[0,0]]);return r.push(g("Quoted Attribution",C,10,`${$} attributed quotes`,$===0?"neutral":void 0)),{category:{name:k.groundingSignals,key:"groundingSignals",score:P(r),maxScore:O(r),factors:r},rawData:{externalLinks:a.slice(0,10)}}}function pt(t){let e=t.cleanText,o=[],s=de(e),r=w(s,[[12,22,15],[8,29,10],[1,1/0,5]],"range");o.push(g("Sentence Length",r,15,`Avg ${s} words/sentence`));let n=pe(e),a=w(n,[[60,70,15],[71,1/0,13],[50,59,10],[30,49,6]],"range");o.push(g("Readability",a,15,`Flesch Reading Ease: ${n.toFixed(1)}`));let i=Y(e),c=ue(e),l=i>0?c/i:0,p=w(l,[[.02,15],[.05,12],[.1,8]],"lower");o.push(g("Jargon Density",p,15,`${(l*100).toFixed(1)}% complex words`));let f=ce(e,Be),d=w(f,[[10,15],[5,11],[2,7],[1,3],[0,0]]);return o.push(g("Transition Usage",d,15,`${f} transition types found`)),{category:{name:k.readabilityForCompression,key:"readabilityForCompression",score:P(o),maxScore:O(o),factors:o},rawData:{avgSentenceLength:s,readabilityScore:n}}}function ut(t,e,o){let s=H(t.cleanText),r=at(t,e,o),n=it(t),a=Ze(t,s),i=ct(t,s),c=lt(t,s),l=rt(t),p=pt(t);return{categories:{contentExtractability:r.category,contentStructure:n.category,answerability:a.category,entityClarity:i.category,groundingSignals:c.category,authorityContext:l.category,readabilityForCompression:p.category},rawData:{title:t.title,metaDescription:t.metaDescription,wordCount:t.stats.wordCount,...r.rawData,...n.rawData,...a.rawData,...i.rawData,...c.rawData,...l.rawData,...p.rawData}}}import*as X from"cheerio";var io=["script","style","noscript","svg","iframe","nav","header","footer","aside",'[role="navigation"]','[role="banner"]','[role="contentinfo"]',".sidebar","#sidebar",".cookie-banner","#cookie-consent",".cookie-notice",".nav",".navbar",".footer",".header",".menu",".ad",".ads",".advertisement",'[class*="cookie"]','[class*="consent"]','[class*="popup"]','[class*="modal"]'];function dt(t){for(let e of io)t(e).remove()}function co(t){return t.replace(/\s+/g," ").trim()}var lo="p,div,td,th,li,h1,h2,h3,h4,h5,h6,dt,dd,br,blockquote,section,article";function mt(t){return t(lo).each((e,o)=>{t(o).append(" ")}),co(t("body").text())}function ht(t,e){let o=X.load(t),s=o("title").text().trim()||o('meta[property="og:title"]').attr("content")?.trim()||"",r=o('meta[name="description"]').attr("content")?.trim()||o('meta[property="og:description"]').attr("content")?.trim()||"",n=X.load(t);n("script, style, noscript").remove();let a=n("body").text().replace(/\s+/g," ").trim(),i=Buffer.byteLength(t,"utf-8"),c=o("h1").length,l=o("h2").length,p=o("h3").length,f=c+l+p+o("h4, h5, h6").length,d=o("a[href]").length,T=o("img").length,b=o("ul, ol").length,A=o("li").length,x=o("table").length,S=o("p").length,y=new Set(["image","photo","logo","icon","picture","img","graphic","thumbnail"]),$=0;o("img").each((Q,B)=>{let q=o(B).attr("alt")?.trim()??"";q.split(/\s+/).filter(Qt=>Qt.length>0).length>1&&q.length<200&&!y.has(q.toLowerCase())&&$++});let C=re(e),E=[];o('a[href^="http"]').each((Q,B)=>{let q=o(B).attr("href");try{re(q)!==C&&E.push({url:q,text:o(B).text().trim().substring(0,50)})}catch{}});let R=E.length,W=X.load(t);dt(W);let N=mt(W),M=N.length,F=a.length>0?Math.max(0,Math.min(1,1-M/a.length)):0,I={wordCount:Y(N),sentenceCount:ke(N),paragraphCount:S,headingCount:f,h1Count:c,h2Count:l,h3Count:p,linkCount:d,externalLinkCount:R,imageCount:T,imagesWithAlt:$,listCount:b,listItemCount:A,tableCount:x,boilerplateRatio:F,rawByteLength:i,cleanTextLength:M};return{url:e,html:t,cleanText:N,title:s,metaDescription:r,stats:I,$:o,externalLinks:E}}import{z as L}from"zod";var gt=L.object({url:L.url(),timeout:L.number().positive().default(45e3),userAgent:L.string().default(`AISEOAudit/${j}`)}),Yr=L.object({url:L.string(),finalUrl:L.string(),statusCode:L.number(),contentType:L.string(),html:L.string(),byteLength:L.number(),fetchTimeMs:L.number(),redirected:L.boolean()});async function Z(t){let e=gt.parse(t),o=Date.now(),s=await G({url:e.url,timeout:e.timeout,userAgent:e.userAgent}),r=Date.now()-o,n=s.data,a=s.finalUrl||e.url,i=s.headers["content-type"]||"unknown";return{url:e.url,finalUrl:a,statusCode:s.status,contentType:i,html:n,byteLength:Buffer.byteLength(n,"utf-8"),fetchTimeMs:r,redirected:a!==e.url}}var ft=`<!-- Before: prose enumeration -->
3
3
  <p>We offer design, development, and strategy services.</p>
4
4
 
5
5
  <!-- After: unordered list -->
@@ -260,7 +260,7 @@ ${t.questionsFound.slice(0,3).map(l=>` {
260
260
  {
261
261
  ${a.join(`,
262
262
  `)}
263
- }`;return{text:`Your ${s.join("; ")}. Adding these properties helps AI engines attribute and trust your content.`,steps:o.map(c=>`Add ${c.missing.join(", ")} to your ${c.type} schema`),codeExample:i,learnMoreUrl:`https://schema.org/${r.type}`}},"Entity Consistency":t=>{let e=t.entityConsistency;return!e||!e.entityName?{text:"Add a consistent brand or organization name across your page title, OG tags, JSON-LD schema, and footer. Consistent entity signals help AI engines confidently attribute content to your brand."}:{text:`"${e.entityName}" was found on ${e.surfacesFound} of ${e.surfacesChecked} page surfaces. Ensure it appears consistently in the page title, OG tags, schema, and footer for strong brand attribution.`}},"Sentence Length":t=>{let e=t.avgSentenceLength;if(e===void 0)return{text:"Aim for an average sentence length of 12-22 words for optimal readability and compressibility."};let o=Math.round(e);return o>22?{text:`Your average sentence is ${o} words. The ideal range for AI compression is 12-22 words. Break long sentences into shorter, more direct statements.`}:o<12?{text:`Your average sentence is ${o} words. While short sentences are readable, combining some into 12-22 word sentences provides better context for AI summarization.`}:{text:`Your average sentence length is ${o} words. Fine-tune toward the 12-22 word sweet spot for optimal AI compression.`}},Readability:t=>{let e=t.readabilityScore;if(e===void 0)return{text:"Simplify language where possible. A Flesch Reading Ease score of 60-70 is ideal for broad AI reusability."};let o=Math.round(e);return o<30?{text:`Your Flesch Reading Ease score is ${o} (very difficult). A score of 60-70 is ideal. Shorten sentences, use simpler vocabulary, and break up complex ideas.`}:o<50?{text:`Your Flesch Reading Ease score is ${o} (difficult). A score of 60-70 is ideal for broad AI reusability. Simplify where possible without losing meaning.`}:o<60?{text:`Your Flesch Reading Ease score is ${o} (fairly difficult). You're close to the ideal 60-70 range. Minor simplification would improve AI compressibility.`}:{text:`Your Flesch Reading Ease score is ${o}. A score of 60-70 is ideal for broad AI reusability.`}},"Jargon Density":()=>({text:"Define technical terms or replace with simpler alternatives. High jargon density reduces AI reusability.",steps:["List the 5 most domain-specific terms on the page","For each term: either add a plain-English definition on first use, or replace with simpler language","Use the 'is defined as' or 'also known as' pattern for terms you must keep","Aim for a Flesch Reading Ease score of 60 to 70 by simplifying sentence structure"],codeExample:Tt}),"Transition Usage":()=>({text:"Use transition words (however, therefore, additionally) to improve content flow and logical structure.",steps:["Add contrast transitions between opposing ideas: 'however', 'although', 'on the other hand'","Add sequence transitions between steps or points: 'first', 'next', 'finally'","Add addition transitions to build on a point: 'additionally', 'furthermore', 'in addition'","Add conclusion transitions at the end of sections: 'therefore', 'as a result', 'in summary'"],codeExample:At})};function Rt(t){let e=[];for(let s of Object.values(t.categories))for(let r of s.factors){let n=r.maxScore>0?r.score/r.maxScore:1;if(n>=.7)continue;let a=n<.3?"high":n<.5?"medium":"low",i=Ct[r.name],c=i?i(t.rawData):{text:`Review and improve "${r.name}" based on best practices for AI search readiness.`};e.push({category:s.name,factor:r.name,currentValue:r.value,priority:a,recommendation:c.text,...c.steps&&{steps:c.steps},...c.codeExample&&{codeExample:c.codeExample},...c.learnMoreUrl&&{learnMoreUrl:c.learnMoreUrl}})}let o={high:0,medium:1,low:2};return e.sort((s,r)=>{let n=o[s.priority]-o[r.priority];return n!==0?n:s.factor.localeCompare(r.factor)}),e}async function fe(t,e,o){let s=Math.min(e,5e3),[r,n,a]=await Promise.allSettled([G({url:`${t}/robots.txt`,timeout:s,userAgent:o}),se({url:`${t}/llms.txt`,timeout:s,userAgent:o}),se({url:`${t}/llms-full.txt`,timeout:s,userAgent:o})]);return{signalsBase:t,robotsTxt:r.status==="fulfilled"&&r.value.status===200?r.value.data:null,llmsTxtExists:n.status==="fulfilled"&&n.value.status===200,llmsFullTxtExists:a.status==="fulfilled"&&a.value.status===200}}function It(t,e,o,s){let r=ht(e.html,t),n=ut(r,e,o),a=De(n.categories,s.weights),i=Rt(n);return{url:t,signalsBase:o.signalsBase,analyzedAt:new Date().toISOString(),overallScore:a.overallScore,grade:a.grade,totalPoints:a.totalPoints,maxPoints:a.maxPoints,categories:n.categories,recommendations:i,rawData:n.rawData,meta:{version:j}}}async function Ot(t,e,o,s){let r=Date.now(),n=It(t,e,o,s);return{...n,meta:{...n.meta,analysisDurationMs:Date.now()-r}}}async function fn(t,e){let o=Date.now(),s=V(t.url),r=t.timeout??e.timeout,n=t.userAgent??e.userAgent,a=await Z({url:s,timeout:r,userAgent:n}),i=t.signalsBase??a.finalUrl??s,c=await fe(i,r,n),l=It(s,a,c,e);return{...l,meta:{...l.meta,analysisDurationMs:Date.now()-o}}}import{access as po,writeFile as uo}from"fs/promises";async function Pt(t){try{return await po(t),!0}catch{return!1}}async function wn(t,e){await uo(t,e,"utf-8")}import{readFile as Mt}from"fs/promises";import{dirname as ho,join as go,resolve as Ft}from"path";var kt=["aiseo.config.json",".aiseo.config.json","aiseo-audit.config.json"];import{z as D}from"zod";var Lt=`AISEOAudit/${j}`,Dt={contentExtractability:1,contentStructure:1,answerability:1,entityClarity:1,groundingSignals:1,authorityContext:1,readabilityForCompression:1},mo=D.object({contentExtractability:D.number().min(0).default(1),contentStructure:D.number().min(0).default(1),answerability:D.number().min(0).default(1),entityClarity:D.number().min(0).default(1),groundingSignals:D.number().min(0).default(1),authorityContext:D.number().min(0).default(1),readabilityForCompression:D.number().min(0).default(1)}).default(Dt),ee=D.object({timeout:D.number().positive().default(45e3),userAgent:D.string().default(Lt),format:D.enum(["pretty","json","md","html"]).default("pretty"),failUnder:D.number().min(0).max(100).optional(),weights:mo}).default({timeout:45e3,userAgent:Lt,format:"pretty",weights:Dt});async function fo(t){let e=Ft(t);for(;;){for(let s of kt){let r=go(e,s);if(await Pt(r))return r}let o=ho(e);if(o===e)return null;e=o}}async function Dn(t){if(t){let o=Ft(t),s=await Mt(o,"utf-8");try{return ee.parse(JSON.parse(s))}catch(r){throw new Error(`Invalid config file "${o}": ${r instanceof Error?r.message:String(r)}`)}}let e=await fo(process.cwd());if(e){let o=await Mt(e,"utf-8");try{return ee.parse(JSON.parse(o))}catch(s){throw new Error(`Invalid config file "${e}": ${s instanceof Error?s.message:String(s)}`)}}return ee.parse({})}function te(t){return t>=90?"#00cc66":t>=50?"#ffaa33":"#ff3333"}function ye(t){return t>=90?"#008800":t>=50?"#ffaa33":"#cc0000"}function xe(t){return t>=90?"pass":t>=50?"average":"fail"}function yo(t){return t==="good"?"&#10003;":t==="neutral"?"&#8212;":t==="needs_improvement"?"&#9650;":"&#10007;"}function xo(t){return t==="good"?"good":t==="neutral"?"neutral":t==="needs_improvement"?"warn":"fail"}function v(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Ut(){return`:root {
263
+ }`;return{text:`Your ${s.join("; ")}. Adding these properties helps AI engines attribute and trust your content.`,steps:o.map(c=>`Add ${c.missing.join(", ")} to your ${c.type} schema`),codeExample:i,learnMoreUrl:`https://schema.org/${r.type}`}},"Entity Consistency":t=>{let e=t.entityConsistency;return!e||!e.entityName?{text:"Add a consistent brand or organization name across your page title, OG tags, JSON-LD schema, and footer. Consistent entity signals help AI engines confidently attribute content to your brand."}:{text:`"${e.entityName}" was found on ${e.surfacesFound} of ${e.surfacesChecked} page surfaces. Ensure it appears consistently in the page title, OG tags, schema, and footer for strong brand attribution.`}},"Sentence Length":t=>{let e=t.avgSentenceLength;if(e===void 0)return{text:"Aim for an average sentence length of 12-22 words for optimal readability and compressibility."};let o=Math.round(e);return o>22?{text:`Your average sentence is ${o} words. The ideal range for AI compression is 12-22 words. Break long sentences into shorter, more direct statements.`}:o<12?{text:`Your average sentence is ${o} words. While short sentences are readable, combining some into 12-22 word sentences provides better context for AI summarization.`}:{text:`Your average sentence length is ${o} words. Fine-tune toward the 12-22 word sweet spot for optimal AI compression.`}},Readability:t=>{let e=t.readabilityScore;if(e===void 0)return{text:"Simplify language where possible. A Flesch Reading Ease score of 60-70 is ideal for broad AI reusability."};let o=Math.round(e);return o<30?{text:`Your Flesch Reading Ease score is ${o} (very difficult). A score of 60-70 is ideal. Shorten sentences, use simpler vocabulary, and break up complex ideas.`}:o<50?{text:`Your Flesch Reading Ease score is ${o} (difficult). A score of 60-70 is ideal for broad AI reusability. Simplify where possible without losing meaning.`}:o<60?{text:`Your Flesch Reading Ease score is ${o} (fairly difficult). You're close to the ideal 60-70 range. Minor simplification would improve AI compressibility.`}:{text:`Your Flesch Reading Ease score is ${o}. A score of 60-70 is ideal for broad AI reusability.`}},"Jargon Density":()=>({text:"Define technical terms or replace with simpler alternatives. High jargon density reduces AI reusability.",steps:["List the 5 most domain-specific terms on the page","For each term: either add a plain-English definition on first use, or replace with simpler language","Use the 'is defined as' or 'also known as' pattern for terms you must keep","Aim for a Flesch Reading Ease score of 60 to 70 by simplifying sentence structure"],codeExample:Tt}),"Transition Usage":()=>({text:"Use transition words (however, therefore, additionally) to improve content flow and logical structure.",steps:["Add contrast transitions between opposing ideas: 'however', 'although', 'on the other hand'","Add sequence transitions between steps or points: 'first', 'next', 'finally'","Add addition transitions to build on a point: 'additionally', 'furthermore', 'in addition'","Add conclusion transitions at the end of sections: 'therefore', 'as a result', 'in summary'"],codeExample:At})};function Rt(t){let e=[];for(let s of Object.values(t.categories))for(let r of s.factors){let n=r.maxScore>0?r.score/r.maxScore:1;if(n>=.7)continue;let a=n<.3?"high":n<.5?"medium":"low",i=Ct[r.name],c=i?i(t.rawData):{text:`Review and improve "${r.name}" based on best practices for AI search readiness.`};e.push({category:s.name,factor:r.name,currentValue:r.value,priority:a,recommendation:c.text,...c.steps&&{steps:c.steps},...c.codeExample&&{codeExample:c.codeExample},...c.learnMoreUrl&&{learnMoreUrl:c.learnMoreUrl}})}let o={high:0,medium:1,low:2};return e.sort((s,r)=>{let n=o[s.priority]-o[r.priority];return n!==0?n:s.factor.localeCompare(r.factor)}),e}function It(t){return t.status!=="fulfilled"||t.value.status!==200?!1:!(t.value.headers["content-type"]??"").includes("text/html")}async function fe(t,e,o){let s=Math.min(e,5e3),[r,n,a]=await Promise.allSettled([G({url:`${t}/robots.txt`,timeout:s,userAgent:o}),se({url:`${t}/llms.txt`,timeout:s,userAgent:o}),se({url:`${t}/llms-full.txt`,timeout:s,userAgent:o})]);return{signalsBase:t,robotsTxt:r.status==="fulfilled"&&r.value.status===200?r.value.data:null,llmsTxtExists:It(n),llmsFullTxtExists:It(a)}}function Pt(t,e,o,s){let r=ht(e.html,t),n=ut(r,e,o),a=De(n.categories,s.weights),i=Rt(n);return{url:t,signalsBase:o.signalsBase,analyzedAt:new Date().toISOString(),overallScore:a.overallScore,grade:a.grade,totalPoints:a.totalPoints,maxPoints:a.maxPoints,categories:n.categories,recommendations:i,rawData:n.rawData,meta:{version:j}}}async function Ot(t,e,o,s){let r=Date.now(),n=Pt(t,e,o,s);return{...n,meta:{...n.meta,analysisDurationMs:Date.now()-r}}}async function yn(t,e){let o=Date.now(),s=V(t.url),r=t.timeout??e.timeout,n=t.userAgent??e.userAgent,a=await Z({url:s,timeout:r,userAgent:n}),i=t.signalsBase??a.finalUrl??s,c=await fe(i,r,n),l=Pt(s,a,c,e);return{...l,meta:{...l.meta,analysisDurationMs:Date.now()-o}}}import{access as uo,writeFile as mo}from"fs/promises";async function kt(t){try{return await uo(t),!0}catch{return!1}}async function Sn(t,e){await mo(t,e,"utf-8")}import{readFile as Ft}from"fs/promises";import{dirname as go,join as fo,resolve as Ut}from"path";var Lt=["aiseo.config.json",".aiseo.config.json","aiseo-audit.config.json"];import{z as D}from"zod";var Dt=`AISEOAudit/${j}`,Mt={contentExtractability:1,contentStructure:1,answerability:1,entityClarity:1,groundingSignals:1,authorityContext:1,readabilityForCompression:1},ho=D.object({contentExtractability:D.number().min(0).default(1),contentStructure:D.number().min(0).default(1),answerability:D.number().min(0).default(1),entityClarity:D.number().min(0).default(1),groundingSignals:D.number().min(0).default(1),authorityContext:D.number().min(0).default(1),readabilityForCompression:D.number().min(0).default(1)}).default(Mt),ee=D.object({timeout:D.number().positive().default(45e3),userAgent:D.string().default(Dt),format:D.enum(["pretty","json","md","html"]).default("pretty"),failUnder:D.number().min(0).max(100).optional(),weights:ho}).default({timeout:45e3,userAgent:Dt,format:"pretty",weights:Mt});async function yo(t){let e=Ut(t);for(;;){for(let s of Lt){let r=fo(e,s);if(await kt(r))return r}let o=go(e);if(o===e)return null;e=o}}async function Mn(t){if(t){let o=Ut(t),s=await Ft(o,"utf-8");try{return ee.parse(JSON.parse(s))}catch(r){throw new Error(`Invalid config file "${o}": ${r instanceof Error?r.message:String(r)}`)}}let e=await yo(process.cwd());if(e){let o=await Ft(e,"utf-8");try{return ee.parse(JSON.parse(o))}catch(s){throw new Error(`Invalid config file "${e}": ${s instanceof Error?s.message:String(s)}`)}}return ee.parse({})}function te(t){return t>=90?"#00cc66":t>=50?"#ffaa33":"#ff3333"}function ye(t){return t>=90?"#008800":t>=50?"#ffaa33":"#cc0000"}function xe(t){return t>=90?"pass":t>=50?"average":"fail"}function xo(t){return t==="good"?"&#10003;":t==="neutral"?"&#8212;":t==="needs_improvement"?"&#9650;":"&#10007;"}function bo(t){return t==="good"?"good":t==="neutral"?"neutral":t==="needs_improvement"?"warn":"fail"}function v(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Nt(){return`:root {
264
264
  --pass: #00cc66;
265
265
  --pass-text: #008800;
266
266
  --average: #ffaa33;
@@ -283,20 +283,20 @@ body { font-family: var(--font); background: var(--bg); color: var(--text); line
283
283
  .footer { padding: 16px 0; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-secondary); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
284
284
  .pass { color: var(--pass-text); }
285
285
  .average { color: var(--average-text); }
286
- .fail { color: var(--fail-text); }`}function bo(t){let e=Math.max(0,Math.min(100,t)),o=te(e),s=ye(e),r=56,n=2*Math.PI*r,a=n*(1-e/100),i=64,c=22,l=7;return`<svg class="gauge" viewBox="0 0 120 120" width="${i}" height="${i}">
286
+ .fail { color: var(--fail-text); }`}function wo(t){let e=Math.max(0,Math.min(100,t)),o=te(e),s=ye(e),r=56,n=2*Math.PI*r,a=n*(1-e/100),i=64,c=22,l=7;return`<svg class="gauge" viewBox="0 0 120 120" width="${i}" height="${i}">
287
287
  <circle cx="60" cy="60" r="${r}" fill="none" stroke="#e0e0e0" stroke-width="${l}"/>
288
288
  <circle cx="60" cy="60" r="${r}" fill="none" stroke="${o}" stroke-width="${l}"
289
289
  stroke-dasharray="${n}" stroke-dashoffset="${a}"
290
290
  stroke-linecap="round" transform="rotate(-90 60 60)"/>
291
291
  <text x="60" y="${60+c*.35}" text-anchor="middle" font-size="${c}" font-weight="700" fill="${s}">${t}</text>
292
- </svg>`}function wo(t,e,o,s,r){let f=2*Math.PI*80,d=ye(t),T='<circle cx="95" cy="95" r="80" fill="none" stroke="#e8e8e8" stroke-width="14"/>',b=[],A=0,x=0;for(let y of r){let $=s>0?y.score/s*360:0;if($<.1){A+=$;continue}let C=y.maxScore>0?Math.round(y.score/y.maxScore*100):0,E=te(C),R=$/360*f,W=f*.25-A/360*f,N=v(y.name),M=x;b.push(`<circle cx="95" cy="95" r="80" fill="none"
292
+ </svg>`}function So(t,e,o,s,r){let f=2*Math.PI*80,d=ye(t),T='<circle cx="95" cy="95" r="80" fill="none" stroke="#e8e8e8" stroke-width="14"/>',b=[],A=0,x=0;for(let y of r){let $=s>0?y.score/s*360:0;if($<.1){A+=$;continue}let C=y.maxScore>0?Math.round(y.score/y.maxScore*100):0,E=te(C),R=$/360*f,W=f*.25-A/360*f,N=v(y.name),M=x;b.push(`<circle cx="95" cy="95" r="80" fill="none"
293
293
  stroke="${E}" stroke-width="14"
294
294
  stroke-dasharray="${R.toFixed(2)} ${(f-R).toFixed(2)}"
295
295
  stroke-dashoffset="${W.toFixed(2)}"
296
296
  class="seg-arc" data-idx="${M}"
297
297
  onmouseenter="document.getElementById('seg-pop-${M}').style.display='flex'"
298
- onmouseleave="document.getElementById('seg-pop-${M}').style.display='none'"/>`),A+=$;let F=A/360*2*Math.PI-Math.PI/2,I=14/2+1,Q=Math.cos(F),H=Math.sin(F);b.push(`<line x1="${(95+(80-I)*Q).toFixed(2)}" y1="${(95+(80-I)*H).toFixed(2)}"
299
- x2="${(95+(80+I)*Q).toFixed(2)}" y2="${(95+(80+I)*H).toFixed(2)}"
298
+ onmouseleave="document.getElementById('seg-pop-${M}').style.display='none'"/>`),A+=$;let F=A/360*2*Math.PI-Math.PI/2,I=14/2+1,Q=Math.cos(F),B=Math.sin(F);b.push(`<line x1="${(95+(80-I)*Q).toFixed(2)}" y1="${(95+(80-I)*B).toFixed(2)}"
299
+ x2="${(95+(80+I)*Q).toFixed(2)}" y2="${(95+(80+I)*B).toFixed(2)}"
300
300
  stroke="#fff" stroke-width="2" pointer-events="none"/>`),x++}let S=r.filter(y=>y.score>0).map((y,$)=>{let C=y.maxScore>0?Math.round(y.score/y.maxScore*100):0,E=te(C);return`<div id="seg-pop-${$}" class="seg-popover">
301
301
  <span class="seg-popover-dot" style="background:${E}"></span>
302
302
  <span class="seg-popover-name">${v(y.name)}</span>
@@ -317,12 +317,12 @@ body { font-family: var(--font); background: var(--bg); color: var(--text); line
317
317
  <span class="scale-average">50-89</span>
318
318
  <span class="scale-pass">90-100</span>
319
319
  </div>
320
- </div>`}function So(t){let e=t.maxScore>0?Math.round(t.score/t.maxScore*100):0;return`<a class="gauge-item" href="#cat-${v(t.name.replace(/\s+/g,"-").toLowerCase())}">
321
- ${bo(e)}
320
+ </div>`}function vo(t){let e=t.maxScore>0?Math.round(t.score/t.maxScore*100):0;return`<a class="gauge-item" href="#cat-${v(t.name.replace(/\s+/g,"-").toLowerCase())}">
321
+ ${wo(e)}
322
322
  <span class="gauge-label">${v(t.name)}</span>
323
- </a>`}function vo(t){let e=t.maxScore>0?Math.round(t.score/t.maxScore*100):0,o=xe(e),s=t.name.replace(/\s+/g,"-").toLowerCase(),r=t.factors.map(n=>`
323
+ </a>`}function Ao(t){let e=t.maxScore>0?Math.round(t.score/t.maxScore*100):0,o=xe(e),s=t.name.replace(/\s+/g,"-").toLowerCase(),r=t.factors.map(n=>`
324
324
  <div class="audit-row">
325
- <span class="audit-icon ${xo(n.status)}">${yo(n.status)}</span>
325
+ <span class="audit-icon ${bo(n.status)}">${xo(n.status)}</span>
326
326
  <span class="audit-name">${v(n.name)}</span>
327
327
  <span class="audit-detail">${v(n.value)}</span>
328
328
  <span class="audit-score">${n.score}/${n.maxScore}</span>
@@ -333,21 +333,21 @@ body { font-family: var(--font); background: var(--bg); color: var(--text); line
333
333
  <div class="category-score ${o}">${e}%</div>
334
334
  </div>
335
335
  <div class="audits">${r}</div>
336
- </div>`}function Ao(t){let e=t.priority==="high"?"priority-high":t.priority==="medium"?"priority-med":"priority-low",o=t.priority==="high"?"HIGH":t.priority==="medium"?"MED":"LOW",s="";if(t.steps||t.codeExample||t.learnMoreUrl){let r="";if(t.steps&&t.steps.length>0){let n=t.steps.map(a=>`<li>${v(a)}</li>`).join("");r+=`<ol class="rec-steps">${n}</ol>`}t.codeExample&&(r+=`<pre class="rec-code"><code>${v(t.codeExample)}</code></pre>`),t.learnMoreUrl&&(r+=`<a class="rec-learn-more" href="${v(t.learnMoreUrl)}" target="_blank" rel="noopener">Learn more &rarr;</a>`),s=`<div class="rec-detail">${r}</div>`}return`
336
+ </div>`}function To(t){let e=t.priority==="high"?"priority-high":t.priority==="medium"?"priority-med":"priority-low",o=t.priority==="high"?"HIGH":t.priority==="medium"?"MED":"LOW",s="";if(t.steps||t.codeExample||t.learnMoreUrl){let r="";if(t.steps&&t.steps.length>0){let n=t.steps.map(a=>`<li>${v(a)}</li>`).join("");r+=`<ol class="rec-steps">${n}</ol>`}t.codeExample&&(r+=`<pre class="rec-code"><code>${v(t.codeExample)}</code></pre>`),t.learnMoreUrl&&(r+=`<a class="rec-learn-more" href="${v(t.learnMoreUrl)}" target="_blank" rel="noopener">Learn more &rarr;</a>`),s=`<div class="rec-detail">${r}</div>`}return`
337
337
  <div class="rec-row ${e}">
338
338
  <span class="rec-tag">${o}</span>
339
339
  <span class="rec-factor">${v(t.factor)}</span>
340
340
  <span class="rec-text">${v(t.recommendation)}</span>
341
- </div>${s}`}function To(t,e){let o=Object.values(e).map(n=>n.name),s=new Map;for(let n of o){let a=t.filter(i=>i.category===n);a.length>0&&s.set(n,a)}if(s.size===0)return"";let r=`<div class="recs-section">
341
+ </div>${s}`}function $o(t,e){let o=Object.values(e).map(n=>n.name),s=new Map;for(let n of o){let a=t.filter(i=>i.category===n);a.length>0&&s.set(n,a)}if(s.size===0)return"";let r=`<div class="recs-section">
342
342
  <div class="recs-title">Recommendations</div>`;for(let[n,a]of s)r+=`<div class="rec-group">
343
- <div class="rec-group-name">${v(n)}</div>`,r+=a.map(Ao).join(""),r+="</div>";return r+="</div>",r}function Nt(t){let e=Object.entries(t.categories),o=e.map(([,c])=>c),s=e.map(([c,l])=>({key:c,name:l.name,score:l.score,maxScore:l.maxScore})),r=o.map(So).join(""),n=o.map(vo).join(""),a=To(t.recommendations,t.categories),i=wo(t.overallScore,t.grade,t.totalPoints,t.maxPoints,s);return`<!DOCTYPE html>
343
+ <div class="rec-group-name">${v(n)}</div>`,r+=a.map(To).join(""),r+="</div>";return r+="</div>",r}function zt(t){let e=Object.entries(t.categories),o=e.map(([,c])=>c),s=e.map(([c,l])=>({key:c,name:l.name,score:l.score,maxScore:l.maxScore})),r=o.map(vo).join(""),n=o.map(Ao).join(""),a=$o(t.recommendations,t.categories),i=So(t.overallScore,t.grade,t.totalPoints,t.maxPoints,s);return`<!DOCTYPE html>
344
344
  <html lang="en">
345
345
  <head>
346
346
  <meta charset="utf-8">
347
347
  <meta name="viewport" content="width=device-width, initial-scale=1">
348
348
  <title>AI SEO Audit - ${v(t.url)}</title>
349
349
  <style>
350
- ${Ut()}
350
+ ${Nt()}
351
351
  .gauges-row {
352
352
  display: flex;
353
353
  flex-wrap: wrap;
@@ -637,7 +637,7 @@ ${Ut()}
637
637
  </div>
638
638
 
639
639
  </body>
640
- </html>`}function $o(t,e){if(t.status==="failed")return`
640
+ </html>`}function Eo(t,e){if(t.status==="failed")return`
641
641
  <div class="sitemap-url-section failed">
642
642
  <div class="sitemap-url-header">
643
643
  <span class="sitemap-url-status fail">&#10007;</span>
@@ -659,17 +659,17 @@ ${Ut()}
659
659
  <div class="sitemap-cats">${i}</div>
660
660
  ${c}
661
661
  </div>
662
- </div>`}function zt(t){let e=ye(t.averageScore),o=t.urlResults.some(n=>n.status==="success"&&n.result.url.startsWith("http://")),s=Object.values(t.categoryAverages).map(n=>{let a=xe(n.averagePct);return`<div class="sitemap-cat-row">
662
+ </div>`}function _t(t){let e=ye(t.averageScore),o=t.urlResults.some(n=>n.status==="success"&&n.result.url.startsWith("http://")),s=Object.values(t.categoryAverages).map(n=>{let a=xe(n.averagePct);return`<div class="sitemap-cat-row">
663
663
  <span class="sitemap-cat-name">${v(n.name)}</span>
664
664
  <span class="sitemap-cat-score ${a}">${n.averagePct}%</span>
665
- </div>`}).join(""),r=t.urlResults.map((n,a)=>$o(n,a)).join("");return`<!DOCTYPE html>
665
+ </div>`}).join(""),r=t.urlResults.map((n,a)=>Eo(n,a)).join("");return`<!DOCTYPE html>
666
666
  <html lang="en">
667
667
  <head>
668
668
  <meta charset="utf-8">
669
669
  <meta name="viewport" content="width=device-width, initial-scale=1">
670
670
  <title>AI SEO Sitemap Audit - ${v(t.sitemapUrl)}</title>
671
671
  <style>
672
- ${Ut()}
672
+ ${Nt()}
673
673
  .summary { display: flex; gap: 32px; padding: 32px 0 24px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
674
674
  .summary-score { display: flex; flex-direction: column; align-items: center; }
675
675
  .summary-score-value { font-size: 64px; font-weight: 700; line-height: 1; }
@@ -743,11 +743,11 @@ ${Ut()}
743
743
  </div>
744
744
 
745
745
  </body>
746
- </html>`}function _t(t){let e=[];t.url.startsWith("http://")&&e.push("Audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.");let o=e.length>0?{...t,notes:e}:t;return JSON.stringify(o,null,2)}function jt(t){let e=[];t.urlResults.some(r=>r.status==="success"&&r.result.url.startsWith("http://"))&&e.push("Some URLs were audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.");let s=e.length>0?{...t,notes:e}:t;return JSON.stringify(s,null,2)}function Bt(t){let e=[];e.push("# AI SEO Audit"),e.push(""),e.push(`**URL:** ${t.url}`),e.push(""),e.push(`**Domain signals checked at:** \`${t.signalsBase}\``),e.push(""),e.push("| Category | Score | Percentage |"),e.push("|----------|-------|------------|");for(let o of Object.values(t.categories)){let s=o.maxScore>0?Math.round(o.score/o.maxScore*100):0;e.push(`| ${o.name} | ${o.score}/${o.maxScore} | ${s}% |`)}e.push(""),e.push(`## Overall: ${t.overallScore}/100 (${t.grade}) - ${t.totalPoints}/${t.maxPoints} pts`),e.push("");for(let o of Object.values(t.categories)){let s=o.maxScore>0?Math.round(o.score/o.maxScore*100):0;e.push(`### ${o.name} (${s}%)`),e.push(""),e.push("| Factor | Score | Status | Details |"),e.push("|--------|-------|--------|---------|");for(let r of o.factors){let n=r.status==="good"?"pass":r.status==="neutral"?"-":r.status==="needs_improvement"?"warn":"fail";e.push(`| ${r.name} | ${r.score}/${r.maxScore} | ${n} | ${r.value} |`)}e.push("")}if(t.recommendations.length>0){e.push("## Recommendations"),e.push("");let o=Object.values(t.categories).map(s=>s.name);for(let s of o){let r=t.recommendations.filter(n=>n.category===s);if(r.length!==0){e.push(`### ${s}`),e.push("");for(let n of r){let a=n.priority==="high"?"**HIGH**":n.priority==="medium"?"*MED*":"LOW";e.push(`- [${a}] **${n.factor}**: ${n.recommendation}`),n.steps&&n.steps.length>0&&n.steps.forEach((i,c)=>{e.push(` ${c+1}. ${i}`)}),n.codeExample&&(e.push(""),e.push(" ```"),n.codeExample.split(`
746
+ </html>`}function jt(t){let e=[];t.url.startsWith("http://")&&e.push("Audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.");let o=e.length>0?{...t,notes:e}:t;return JSON.stringify(o,null,2)}function Ht(t){let e=[];t.urlResults.some(r=>r.status==="success"&&r.result.url.startsWith("http://"))&&e.push("Some URLs were audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.");let s=e.length>0?{...t,notes:e}:t;return JSON.stringify(s,null,2)}function Bt(t){let e=[];e.push("# AI SEO Audit"),e.push(""),e.push(`**URL:** ${t.url}`),e.push(""),e.push(`**Domain signals checked at:** \`${t.signalsBase}\``),e.push(""),e.push("| Category | Score | Percentage |"),e.push("|----------|-------|------------|");for(let o of Object.values(t.categories)){let s=o.maxScore>0?Math.round(o.score/o.maxScore*100):0;e.push(`| ${o.name} | ${o.score}/${o.maxScore} | ${s}% |`)}e.push(""),e.push(`## Overall: ${t.overallScore}/100 (${t.grade}) - ${t.totalPoints}/${t.maxPoints} pts`),e.push("");for(let o of Object.values(t.categories)){let s=o.maxScore>0?Math.round(o.score/o.maxScore*100):0;e.push(`### ${o.name} (${s}%)`),e.push(""),e.push("| Factor | Score | Status | Details |"),e.push("|--------|-------|--------|---------|");for(let r of o.factors){let n=r.status==="good"?"pass":r.status==="neutral"?"-":r.status==="needs_improvement"?"warn":"fail";e.push(`| ${r.name} | ${r.score}/${r.maxScore} | ${n} | ${r.value} |`)}e.push("")}if(t.recommendations.length>0){e.push("## Recommendations"),e.push("");let o=Object.values(t.categories).map(s=>s.name);for(let s of o){let r=t.recommendations.filter(n=>n.category===s);if(r.length!==0){e.push(`### ${s}`),e.push("");for(let n of r){let a=n.priority==="high"?"**HIGH**":n.priority==="medium"?"*MED*":"LOW";e.push(`- [${a}] **${n.factor}**: ${n.recommendation}`),n.steps&&n.steps.length>0&&n.steps.forEach((i,c)=>{e.push(` ${c+1}. ${i}`)}),n.codeExample&&(e.push(""),e.push(" ```"),n.codeExample.split(`
747
747
  `).forEach(i=>{e.push(` ${i}`)}),e.push(" ```")),n.learnMoreUrl&&(e.push(""),e.push(` [Learn more](${n.learnMoreUrl})`)),(n.steps||n.codeExample||n.learnMoreUrl)&&e.push("")}e.push("")}}}return e.push("---"),e.push(`*Generated by aiseo-audit v${t.meta.version} | ${t.analyzedAt} | ${t.meta.analysisDurationMs}ms*`),t.url.startsWith("http://")&&(e.push(""),e.push("> **Note:** Audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.")),e.join(`
748
- `)}function Ht(t){let e=[];if(e.push("# AI SEO Sitemap Audit Report"),e.push(""),e.push(`**Sitemap:** ${t.sitemapUrl}`),e.push(`**Domain signals checked at:** \`${t.signalsBase}\``),e.push(`**Analyzed at:** ${t.analyzedAt}`),e.push(""),e.push("## Summary"),e.push(""),e.push("| Metric | Value |"),e.push("|--------|-------|"),e.push(`| Average Score | ${t.averageScore}/100 |`),e.push(`| Average Grade | ${t.averageGrade} |`),e.push(`| Total URLs | ${t.totalUrls} |`),e.push(`| Succeeded | ${t.succeededCount} |`),e.push(`| Failed | ${t.failedCount} |`),e.push(""),Object.keys(t.categoryAverages).length>0){e.push("## Site-Wide Category Averages"),e.push(""),e.push("| Category | Average Score |"),e.push("|----------|---------------|");for(let s of Object.values(t.categoryAverages))e.push(`| ${s.name} | ${s.averagePct}% |`);e.push("")}e.push("## URL Results"),e.push("");for(let s of t.urlResults){if(s.status==="failed"){e.push(`### \u274C ${s.url}`),e.push(""),e.push(`**Error:** ${s.error}`),e.push("");continue}let{result:r}=s;e.push(`### ${r.url}`),e.push(""),e.push(`**Score:** ${r.overallScore}/100 | **Grade:** ${r.grade} | **Points:** ${r.totalPoints}/${r.maxPoints}`),e.push(""),e.push("| Category | Score | Percentage |"),e.push("|----------|-------|------------|");for(let n of Object.values(r.categories)){let a=n.maxScore>0?Math.round(n.score/n.maxScore*100):0;e.push(`| ${n.name} | ${n.score}/${n.maxScore} | ${a}% |`)}if(e.push(""),r.recommendations.length>0){e.push("**Recommendations:**"),e.push("");for(let n of r.recommendations){let a=n.priority==="high"?"**HIGH**":n.priority==="medium"?"*MED*":"LOW";e.push(`- [${a}] **${n.factor}**: ${n.recommendation}`)}e.push("")}}return e.push("---"),e.push(`*Generated by aiseo-audit v${t.meta.version} | ${t.analyzedAt} | ${t.meta.analysisDurationMs}ms*`),t.urlResults.some(s=>s.status==="success"&&s.result.url.startsWith("http://"))&&(e.push(""),e.push("> **Note:** Some URLs were audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.")),e.join(`
749
- `)}import u from"chalk";function J(t,e){let o=e>0?t/e*100:0;return o>=90?u.green:o>=50?u.yellow:u.red}function be(t){return t.startsWith("A")?u.green:t.startsWith("B")||t.startsWith("C")?u.yellow:u.red}function we(t,e){return t+" ".repeat(Math.max(0,e-t.length))}function Se(t){return u.dim(".".repeat(t))}function Eo(t,e,o){let s=o.crawlerAccess!==void 0,r=o.llmsTxt?.llmsTxtExists??!1,n=o.llmsTxt?.llmsFullTxtExists??!1;t.push(u.dim(` Domain signals checked at: ${e}`)),t.push(u.dim(` robots.txt ........ ${s?u.green("found"):u.red("not found")}`)),t.push(u.dim(` llms.txt .......... ${r?u.green("found"):u.red("not found")}`)),t.push(u.dim(` llms-full.txt ..... ${n?u.green("found"):u.red("not found")}`))}function Gt(t){let e=[],s=u.dim("=".repeat(60)),r=u.dim("-".repeat(60));e.push(""),e.push(s),e.push(u.bold(" AI SEO Audit Report")),e.push(u.dim(` ${t.url}`)),e.push(s),e.push("");let n=J(t.overallScore,100),a=be(t.grade);e.push(` Overall Score: ${n(`${t.overallScore}/100`)} Grade: ${a(t.grade)}`),e.push(u.dim(` Points: ${t.totalPoints}/${t.maxPoints}`)),e.push(""),Eo(e,t.signalsBase,t.rawData),e.push(""),e.push(r);for(let i of Object.values(t.categories)){let c=J(i.score,i.maxScore),l=i.maxScore>0?Math.round(i.score/i.maxScore*100):0,p=we(i.name,38),f=Se(Math.max(2,40-i.name.length));e.push(""),e.push(` ${u.bold(p)} ${f} ${c(`${i.score}/${i.maxScore}`)} ${u.dim(`(${l}%)`)}`);for(let d of i.factors){let T=J(d.score,d.maxScore),b=we(` ${d.name}`,40),A=Se(Math.max(2,42-d.name.length));e.push(` ${u.dim(b)} ${A} ${T(`${d.score}/${d.maxScore}`)} ${u.dim(d.value)}`)}}if(e.push(""),e.push(r),t.recommendations.length>0){e.push(""),e.push(u.bold(" Recommendations:")),e.push("");for(let i=0;i<t.recommendations.length;i++){let c=t.recommendations[i],l=c.priority==="high"?u.red("[HIGH]"):c.priority==="medium"?u.yellow("[MED] "):u.dim("[LOW] ");e.push(` ${i+1}. ${l} ${u.bold(c.factor)}`),e.push(` ${u.dim(c.recommendation)}`),c.steps&&c.steps.length>0&&(e.push(""),e.push(` ${u.dim("Steps:")}`),c.steps.forEach((p,f)=>{e.push(` ${u.dim(`${f+1}. ${p}`)}`)})),c.codeExample&&(e.push(""),e.push(` ${u.dim("Example:")}`),e.push(` ${u.dim("\u250C"+"\u2500".repeat(50))}`),c.codeExample.split(`
748
+ `)}function Gt(t){let e=[];if(e.push("# AI SEO Sitemap Audit Report"),e.push(""),e.push(`**Sitemap:** ${t.sitemapUrl}`),e.push(`**Domain signals checked at:** \`${t.signalsBase}\``),e.push(`**Analyzed at:** ${t.analyzedAt}`),e.push(""),e.push("## Summary"),e.push(""),e.push("| Metric | Value |"),e.push("|--------|-------|"),e.push(`| Average Score | ${t.averageScore}/100 |`),e.push(`| Average Grade | ${t.averageGrade} |`),e.push(`| Total URLs | ${t.totalUrls} |`),e.push(`| Succeeded | ${t.succeededCount} |`),e.push(`| Failed | ${t.failedCount} |`),e.push(""),Object.keys(t.categoryAverages).length>0){e.push("## Site-Wide Category Averages"),e.push(""),e.push("| Category | Average Score |"),e.push("|----------|---------------|");for(let s of Object.values(t.categoryAverages))e.push(`| ${s.name} | ${s.averagePct}% |`);e.push("")}e.push("## URL Results"),e.push("");for(let s of t.urlResults){if(s.status==="failed"){e.push(`### \u274C ${s.url}`),e.push(""),e.push(`**Error:** ${s.error}`),e.push("");continue}let{result:r}=s;e.push(`### ${r.url}`),e.push(""),e.push(`**Score:** ${r.overallScore}/100 | **Grade:** ${r.grade} | **Points:** ${r.totalPoints}/${r.maxPoints}`),e.push(""),e.push("| Category | Score | Percentage |"),e.push("|----------|-------|------------|");for(let n of Object.values(r.categories)){let a=n.maxScore>0?Math.round(n.score/n.maxScore*100):0;e.push(`| ${n.name} | ${n.score}/${n.maxScore} | ${a}% |`)}if(e.push(""),r.recommendations.length>0){e.push("**Recommendations:**"),e.push("");for(let n of r.recommendations){let a=n.priority==="high"?"**HIGH**":n.priority==="medium"?"*MED*":"LOW";e.push(`- [${a}] **${n.factor}**: ${n.recommendation}`)}e.push("")}}return e.push("---"),e.push(`*Generated by aiseo-audit v${t.meta.version} | ${t.analyzedAt} | ${t.meta.analysisDurationMs}ms*`),t.urlResults.some(s=>s.status==="success"&&s.result.url.startsWith("http://"))&&(e.push(""),e.push("> **Note:** Some URLs were audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.")),e.join(`
749
+ `)}import u from"chalk";function J(t,e){let o=e>0?t/e*100:0;return o>=90?u.green:o>=50?u.yellow:u.red}function be(t){return t.startsWith("A")?u.green:t.startsWith("B")||t.startsWith("C")?u.yellow:u.red}function we(t,e){return t+" ".repeat(Math.max(0,e-t.length))}function Se(t){return u.dim(".".repeat(t))}function Co(t,e,o){let s=o.crawlerAccess!==void 0,r=o.llmsTxt?.llmsTxtExists??!1,n=o.llmsTxt?.llmsFullTxtExists??!1;t.push(u.dim(` Domain signals checked at: ${e}`)),t.push(u.dim(` robots.txt ........ ${s?u.green("found"):u.red("not found")}`)),t.push(u.dim(` llms.txt .......... ${r?u.green("found"):u.red("not found")}`)),t.push(u.dim(` llms-full.txt ..... ${n?u.green("found"):u.red("not found")}`))}function Wt(t){let e=[],s=u.dim("=".repeat(60)),r=u.dim("-".repeat(60));e.push(""),e.push(s),e.push(u.bold(" AI SEO Audit Report")),e.push(u.dim(` ${t.url}`)),e.push(s),e.push("");let n=J(t.overallScore,100),a=be(t.grade);e.push(` Overall Score: ${n(`${t.overallScore}/100`)} Grade: ${a(t.grade)}`),e.push(u.dim(` Points: ${t.totalPoints}/${t.maxPoints}`)),e.push(""),Co(e,t.signalsBase,t.rawData),e.push(""),e.push(r);for(let i of Object.values(t.categories)){let c=J(i.score,i.maxScore),l=i.maxScore>0?Math.round(i.score/i.maxScore*100):0,p=we(i.name,38),f=Se(Math.max(2,40-i.name.length));e.push(""),e.push(` ${u.bold(p)} ${f} ${c(`${i.score}/${i.maxScore}`)} ${u.dim(`(${l}%)`)}`);for(let d of i.factors){let T=J(d.score,d.maxScore),b=we(` ${d.name}`,40),A=Se(Math.max(2,42-d.name.length));e.push(` ${u.dim(b)} ${A} ${T(`${d.score}/${d.maxScore}`)} ${u.dim(d.value)}`)}}if(e.push(""),e.push(r),t.recommendations.length>0){e.push(""),e.push(u.bold(" Recommendations:")),e.push("");for(let i=0;i<t.recommendations.length;i++){let c=t.recommendations[i],l=c.priority==="high"?u.red("[HIGH]"):c.priority==="medium"?u.yellow("[MED] "):u.dim("[LOW] ");e.push(` ${i+1}. ${l} ${u.bold(c.factor)}`),e.push(` ${u.dim(c.recommendation)}`),c.steps&&c.steps.length>0&&(e.push(""),e.push(` ${u.dim("Steps:")}`),c.steps.forEach((p,f)=>{e.push(` ${u.dim(`${f+1}. ${p}`)}`)})),c.codeExample&&(e.push(""),e.push(` ${u.dim("Example:")}`),e.push(` ${u.dim("\u250C"+"\u2500".repeat(50))}`),c.codeExample.split(`
750
750
  `).forEach(p=>{e.push(` ${u.dim("\u2502")} ${u.dim(p)}`)}),e.push(` ${u.dim("\u2514"+"\u2500".repeat(50))}`)),c.learnMoreUrl&&(e.push(""),e.push(` ${u.dim(`Learn more: ${c.learnMoreUrl}`)}`)),e.push("")}}return e.push(s),e.push(u.dim(` Analyzed at: ${t.analyzedAt}`)),e.push(u.dim(` Duration: ${t.meta.analysisDurationMs}ms`)),t.url.startsWith("http://")&&e.push(u.yellow(" Note: Audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.")),e.push(s),e.push(""),e.join(`
751
- `)}function Wt(t){let e=[],s=u.dim("=".repeat(60)),r=u.dim("-".repeat(60));e.push(""),e.push(s),e.push(u.bold(" AI SEO Sitemap Audit Report")),e.push(u.dim(` ${t.sitemapUrl}`)),e.push(s),e.push("");let n=J(t.averageScore,100),a=be(t.averageGrade);if(e.push(` Average Score: ${n(`${t.averageScore}/100`)} Grade: ${a(t.averageGrade)}`),e.push(u.dim(` URLs: ${t.succeededCount} audited, ${t.failedCount} failed, ${t.totalUrls} total`)),e.push(""),e.push(u.dim(` Domain signals checked at: ${t.signalsBase}`)),e.push(""),e.push(r),Object.keys(t.categoryAverages).length>0){e.push(""),e.push(u.bold(" Site-Wide Category Averages:")),e.push("");for(let c of Object.values(t.categoryAverages)){let l=J(c.averagePct,100),p=we(c.name,38),f=Se(Math.max(2,40-c.name.length));e.push(` ${u.bold(p)} ${f} ${l(`${c.averagePct}%`)}`)}e.push(""),e.push(r)}e.push(""),e.push(u.bold(" URL Results:")),e.push("");for(let c of t.urlResults){if(c.status==="failed"){e.push(` ${u.red("\u2717")} ${u.dim(c.url)}`),e.push(` ${u.red(`Error: ${c.error}`)}`),e.push("");continue}let{result:l}=c,p=J(l.overallScore,100),f=be(l.grade),d=l.recommendations[0];e.push(` ${u.green("\u2713")} ${u.dim(l.url)}`),e.push(` Score: ${p(`${l.overallScore}/100`)} Grade: ${f(l.grade)}`),d&&e.push(` ${u.dim(`Top rec: ${d.factor} \u2014 ${d.recommendation}`)}`),e.push("")}return e.push(s),e.push(u.dim(` Analyzed at: ${t.analyzedAt}`)),e.push(u.dim(` Duration: ${t.meta.analysisDurationMs}ms`)),t.urlResults.some(c=>c.status==="success"&&c.result.url.startsWith("http://"))&&e.push(u.yellow(" Note: Some URLs were audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.")),e.push(s),e.push(""),e.join(`
752
- `)}function Qn(t,e){switch(e.format){case"json":return _t(t);case"md":return Bt(t);case"html":return Nt(t);default:return Gt(t)}}function Kn(t,e){switch(e.format){case"json":return jt(t);case"md":return Ht(t);case"html":return zt(t);default:return Wt(t)}}import{scaffold as Yt}from"xml-to-html-converter";function Co(t){let e=t.trim();return e.startsWith("<![CDATA[")&&e.endsWith("]]>")?e.slice(9,-3):e}function ve(t,e){for(let o of t){if(o.xmlTag==="loc"&&o.children){let s=o.children.filter(r=>r.role==="textLeaf").map(r=>Co(r.raw)).join("").trim();s&&e.push(s)}o.children&&ve(o.children,e)}}function qt(t){let e=Yt(t),o=[];return ve(e,o),o}function Jt(t){for(let e of t)if(e.xmlTag==="sitemapindex"||e.children&&Jt(e.children))return!0;return!1}async function Ro(t,e,o){let s=await G({url:t,timeout:e,userAgent:o});if(s.status!==200)throw new Error(`Failed to fetch sitemap: HTTP ${s.status}`);let r=Yt(s.data);if(Jt(r))return Io(s.data,e,o);let n=[];return ve(r,n),n}async function Io(t,e,o){let s=qt(t),r=[];for(let n of s){let a=await G({url:n,timeout:e,userAgent:o});a.status===200&&r.push(...qt(a.data))}return r}function Oo(t){let e=t.filter(r=>r.status==="success").map(r=>r.result);if(e.length===0)return{};let o={};for(let r of e)for(let[n,a]of Object.entries(r.categories)){let i=a.maxScore>0?a.score/a.maxScore*100:0;o[n]||(o[n]={name:a.name,totalPct:0,count:0}),o[n].totalPct+=i,o[n].count+=1}let s={};for(let[r,n]of Object.entries(o))s[r]={name:n.name,averagePct:Math.round(n.totalPct/n.count)};return s}async function ia(t,e){let o=Date.now(),s=t.timeout??e.timeout,r=t.userAgent??e.userAgent,n=await Ro(t.sitemapUrl,s,r),a=t.sitemapUrl.substring(0,t.sitemapUrl.lastIndexOf("/")),i=t.signalsBase??a,c=await fe(i,s,r),l=[];for(let x of n){let S=V(x);try{let y=await Z({url:S,timeout:s,userAgent:r}),$=await Ot(S,y,c,e);l.push({status:"success",result:$})}catch(y){l.push({status:"failed",url:S,error:y instanceof Error?y.message:String(y)})}}let p=l.filter(x=>x.status==="success").map(x=>x.result),f=p.length,d=l.length-f,T=f>0?Math.round(p.reduce((x,S)=>x+S.overallScore,0)/f):0,b=me(T),A=Oo(l);return{sitemapUrl:t.sitemapUrl,signalsBase:c.signalsBase,analyzedAt:new Date().toISOString(),totalUrls:l.length,succeededCount:f,failedCount:d,averageScore:T,averageGrade:b,categoryAverages:A,urlResults:l,meta:{version:j,analysisDurationMs:Date.now()-o}}}export{j as a,z as b,_o as c,fn as d,wn as e,Dn as f,Qn as g,Kn as h,ia as i};
753
- //# sourceMappingURL=chunk-7ULHTMIY.mjs.map
751
+ `)}function qt(t){let e=[],s=u.dim("=".repeat(60)),r=u.dim("-".repeat(60));e.push(""),e.push(s),e.push(u.bold(" AI SEO Sitemap Audit Report")),e.push(u.dim(` ${t.sitemapUrl}`)),e.push(s),e.push("");let n=J(t.averageScore,100),a=be(t.averageGrade);if(e.push(` Average Score: ${n(`${t.averageScore}/100`)} Grade: ${a(t.averageGrade)}`),e.push(u.dim(` URLs: ${t.succeededCount} audited, ${t.failedCount} failed, ${t.totalUrls} total`)),e.push(""),e.push(u.dim(` Domain signals checked at: ${t.signalsBase}`)),e.push(""),e.push(r),Object.keys(t.categoryAverages).length>0){e.push(""),e.push(u.bold(" Site-Wide Category Averages:")),e.push("");for(let c of Object.values(t.categoryAverages)){let l=J(c.averagePct,100),p=we(c.name,38),f=Se(Math.max(2,40-c.name.length));e.push(` ${u.bold(p)} ${f} ${l(`${c.averagePct}%`)}`)}e.push(""),e.push(r)}e.push(""),e.push(u.bold(" URL Results:")),e.push("");for(let c of t.urlResults){if(c.status==="failed"){e.push(` ${u.red("\u2717")} ${u.dim(c.url)}`),e.push(` ${u.red(`Error: ${c.error}`)}`),e.push("");continue}let{result:l}=c,p=J(l.overallScore,100),f=be(l.grade),d=l.recommendations[0];e.push(` ${u.green("\u2713")} ${u.dim(l.url)}`),e.push(` Score: ${p(`${l.overallScore}/100`)} Grade: ${f(l.grade)}`),d&&e.push(` ${u.dim(`Top rec: ${d.factor} \u2014 ${d.recommendation}`)}`),e.push("")}return e.push(s),e.push(u.dim(` Analyzed at: ${t.analyzedAt}`)),e.push(u.dim(` Duration: ${t.meta.analysisDurationMs}ms`)),t.urlResults.some(c=>c.status==="success"&&c.result.url.startsWith("http://"))&&e.push(u.yellow(" Note: Some URLs were audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.")),e.push(s),e.push(""),e.join(`
752
+ `)}function Kn(t,e){switch(e.format){case"json":return jt(t);case"md":return Bt(t);case"html":return zt(t);default:return Wt(t)}}function Xn(t,e){switch(e.format){case"json":return Ht(t);case"md":return Gt(t);case"html":return _t(t);default:return qt(t)}}import{scaffold as Jt}from"xml-to-html-converter";function Ro(t){let e=t.trim();return e.startsWith("<![CDATA[")&&e.endsWith("]]>")?e.slice(9,-3):e}function ve(t,e){for(let o of t){if(o.xmlTag==="loc"&&o.children){let s=o.children.filter(r=>r.role==="textLeaf").map(r=>Ro(r.raw)).join("").trim();s&&e.push(s)}o.children&&ve(o.children,e)}}function Yt(t){let e=Jt(t),o=[];return ve(e,o),o}function Vt(t){for(let e of t)if(e.xmlTag==="sitemapindex"||e.children&&Vt(e.children))return!0;return!1}async function Io(t,e,o){let s=await G({url:t,timeout:e,userAgent:o});if(s.status!==200)throw new Error(`Failed to fetch sitemap: HTTP ${s.status}`);let r=Jt(s.data);if(Vt(r))return Po(s.data,e,o);let n=[];return ve(r,n),n}async function Po(t,e,o){let s=Yt(t),r=[];for(let n of s){let a=await G({url:n,timeout:e,userAgent:o});a.status===200&&r.push(...Yt(a.data))}return r}function Oo(t){let e=t.filter(r=>r.status==="success").map(r=>r.result);if(e.length===0)return{};let o={};for(let r of e)for(let[n,a]of Object.entries(r.categories)){let i=a.maxScore>0?a.score/a.maxScore*100:0;o[n]||(o[n]={name:a.name,totalPct:0,count:0}),o[n].totalPct+=i,o[n].count+=1}let s={};for(let[r,n]of Object.entries(o))s[r]={name:n.name,averagePct:Math.round(n.totalPct/n.count)};return s}async function ca(t,e){let o=Date.now(),s=t.timeout??e.timeout,r=t.userAgent??e.userAgent,n=await Io(t.sitemapUrl,s,r),a=t.sitemapUrl.substring(0,t.sitemapUrl.lastIndexOf("/")),i=t.signalsBase??a,c=await fe(i,s,r),l=[];for(let x of n){let S=V(x);try{let y=await Z({url:S,timeout:s,userAgent:r}),$=await Ot(S,y,c,e);l.push({status:"success",result:$})}catch(y){l.push({status:"failed",url:S,error:y instanceof Error?y.message:String(y)})}}let p=l.filter(x=>x.status==="success").map(x=>x.result),f=p.length,d=l.length-f,T=f>0?Math.round(p.reduce((x,S)=>x+S.overallScore,0)/f):0,b=me(T),A=Oo(l);return{sitemapUrl:t.sitemapUrl,signalsBase:c.signalsBase,analyzedAt:new Date().toISOString(),totalUrls:l.length,succeededCount:f,failedCount:d,averageScore:T,averageGrade:b,categoryAverages:A,urlResults:l,meta:{version:j,analysisDurationMs:Date.now()-o}}}export{j as a,z as b,jo as c,yn as d,Sn as e,Mn as f,Kn as g,Xn as h,ca as i};
753
+ //# sourceMappingURL=chunk-6DSWL6FS.mjs.map
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _="1.4.16";var te={Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Accept-Language":"en-US,en;q=0.9","Accept-Encoding":"gzip, deflate, br","Cache-Control":"no-cache"};var N=class extends Error{constructor(e,o,s){super(s),this.name="FetchError",this.code=e,this.url=o}};function ve(t,e){if(t instanceof N)return t;let o=t instanceof Error?t.message:String(t),s=t instanceof Error&&t.cause instanceof Error?t.cause.message:"",r=`${o} ${s}`.toLowerCase();if(t instanceof DOMException||t instanceof Error&&t.name==="AbortError"||r.includes("abort"))return new N("TIMEOUT",e,`Request timed out. The server at "${new URL(e).hostname}" did not respond in time.`);if(r.includes("getaddrinfo")||r.includes("enotfound")){let n=new URL(e).hostname;return new N("DNS_FAILURE",e,`DNS lookup failed for "${n}". Check that the domain exists and is spelled correctly.`)}return r.includes("econnrefused")?new N("CONNECTION_REFUSED",e,`Connection refused by "${new URL(e).hostname}". The server may be down or not accepting connections.`):r.includes("cert")||r.includes("ssl")||r.includes("tls")||r.includes("unable to verify")?new N("TLS_ERROR",e,`TLS/SSL error connecting to "${new URL(e).hostname}". The site may have an invalid or expired certificate.`):new N("NETWORK_ERROR",e,`Network error fetching "${e}": ${o}`)}async function H(t){let e=new AbortController,o=setTimeout(()=>e.abort(),t.timeout);try{let s=await fetch(t.url,{method:"GET",headers:{"User-Agent":t.userAgent,...te},signal:e.signal,redirect:"follow"}),r=s.headers.get("content-length");if(r&&parseInt(r,10)>10485760)throw new N("TOO_LARGE",t.url,`Response from "${new URL(t.url).hostname}" exceeds the ${Math.round(10485760/1024/1024)}MB size limit.`);let n=await s.text();if(n.length>10485760)throw new N("TOO_LARGE",t.url,`Response from "${new URL(t.url).hostname}" exceeds the ${Math.round(10485760/1024/1024)}MB size limit.`);let a={};return s.headers.forEach((i,c)=>{a[c]=i}),{status:s.status,data:n,headers:a,finalUrl:s.url}}catch(s){throw ve(s,t.url)}finally{clearTimeout(o)}}async function oe(t){let e=new AbortController,o=setTimeout(()=>e.abort(),t.timeout);try{let s=await fetch(t.url,{method:"HEAD",headers:{"User-Agent":t.userAgent,...te},signal:e.signal,redirect:"follow"}),r={};return s.headers.forEach((n,a)=>{r[a]=n}),{status:s.status,data:"",headers:r,finalUrl:s.url}}catch(s){throw ve(s,t.url)}finally{clearTimeout(o)}}function J(t){let e=t.trim();return/^https?:\/\//i.test(e)||(e=`https://${e}`),new URL(e).toString().replace(/\/+$/,"")}function zo(t){try{let e=J(t);return new URL(e),!0}catch (e2){return!1}}function se(t){try{return new URL(t).hostname}catch (e3){return t}}var _compromise = require('compromise'); var _compromise2 = _interopRequireDefault(_compromise);var re=new Set(["a","an","the","and","or","but","in","on","at","to","for","of","with","by","from","as","is","was","are","were","been","be","have","has","had","do","does","did","will","would","could","should","may","might","shall","can","need","must","that","which","who","whom","this","these","those","it","its","he","she","they","we","you","i","me","him","her","us","them","my","your","his","our","their","what","when","where","how","why","all","each","every","both","few","more","most","other","some","such","no","nor","not","only","own","same","so","than","too","very","just","about","above","after","again","also","any","because","before","between","during","here","if","into","like","new","now","over","then","there","through","under","up","out","off","down","much","well","back","even","still","also","get","got","one","two","make","many","say","said","see","go","come","take","know","think","good","great","first","last","long","way","find","use","used","using","while","being","made","however","since","per","via","based","within","without","across","along","around","among","until","another","www","http","https","com"]),Ae=new Set(["I","A","OK","AM","PM","US","UK","EU","VS","EG","IE","ET","AL","HTML","CSS","JS","TS","URL","HTTP","HTTPS","API","SDK","CLI","GUI","PDF","CSV","JSON","XML","SQL","RSS","FTP","SSH","SSL","TLS","DNS","TCP","UDP","IP","RAM","ROM","CPU","GPU","SSD","HDD","USB","HDMI","FAQ","DIY","ASAP","FYI","TBD","TBA","ETA","ROI","KPI","CEO","CTO","CFO","COO","CIO","VP","SVP","EVP","HR","PR","QA","IT","RD","RND","LLC","INC","LTD","CORP","PLC","USD","EUR","GBP","JPY","CAD","ID","NO","RE","CC","BCC","GEO","SEO","SEM","PPC","CMS","CRM","ERP","SaaS","AI","ML","NLP","LLM","GPT","NER","TLDR","AKA","RSVP","PS"]),Te=/\b(?:Inc|Corp|Corporation|LLC|Ltd|Limited|Co|Company|Group|Foundation|Institute|University|Association|Society|Agency|Authority|Bureau|Commission|Council|Department|Board|Trust|Fund|Partners|Ventures|Labs|Technologies|Solutions|Systems|Services|Consulting|Media|Network|Studios|Entertainment|Healthcare|Pharmaceuticals|Dynamics|Holdings|Capital|Enterprises|International)\b/i,$e=/\b(?:Mr|Mrs|Ms|Miss|Dr|Prof|Professor|Rev|Reverend|Sen|Senator|Rep|Representative|Gov|Governor|Pres|President|Gen|General|Col|Colonel|Sgt|Sergeant|Cpl|Corporal|Pvt|Private|Adm|Admiral|Capt|Captain|Lt|Lieutenant|Maj|Major|Sir|Dame|Lord|Lady|Hon|Honorable|Judge|Justice|Chancellor|Dean|Provost)\.\s*/;function Ee(t){let e=t.match(/\b[A-Z]{2,6}\b/g);if(!e)return[];let o=new Set,s=[];for(let r of e)!Ae.has(r)&&!o.has(r)&&(o.add(r),s.push(r));return s}function Ce(t){let e=/\b([A-Z][a-z]+(?:\s+(?:of|the|and|for|de|van|von|al|el|la|le|del|der|den|das|di|du))?\s+(?:[A-Z][a-z]+)(?:\s+[A-Z][a-z]+){0,3})\b/g,o=t.split(/[.!?]\s+/),s=new Set;for(let i of o){let l=i.trim().split(/\s+/)[0];l&&s.add(l)}let r=new Set,n=[],a;for(;(a=e.exec(t))!==null;){let i=a[1],c=i.split(/\s+/)[0];if(s.has(c)&&!t.includes(`. ${i}`)&&!t.includes(`, ${i}`)){let l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),p=t.match(new RegExp(l,"g"));if(!p||p.length<2)continue}!r.has(i)&&i.split(/\s+/).length>=2&&(r.add(i),n.push(i))}return n}function Re(t){return Te.test(t)}function Ie(t,e){let o=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(?:${$e.source})\\s*${o}`,"i").test(t)}function ne(t){if(t.length===0)return[];let e=[...t].sort((r,n)=>n.length-r.length),o=[],s=new Set;for(let r of e){let n=r.toLowerCase();if(s.has(n))continue;let a=!1;for(let i of s)if(i.includes(n)){a=!0;break}a||(o.push(r),s.add(n))}return o}function ae(t,e){let o=[...t,...e];return ne(o)}function Oe(t){let e=new Set(t.nouns().out("array").flatMap(n=>n.toLowerCase().replace(/[^a-z0-9\s'-]/g," ").split(/\s+/).filter(a=>a.length>2&&!re.has(a)))),o=t.text().toLowerCase().replace(/[^a-z0-9\s'-]/g," ").split(/\s+/).filter(n=>n.length>2&&!re.has(n)&&e.has(n));if(o.length===0)return[];let s=new Map;for(let n of o)s.set(n,(s.get(n)||0)+1);for(let n=0;n<o.length-1;n++){let a=`${o[n]} ${o[n+1]}`;s.set(a,(s.get(a)||0)+1)}let r=[];for(let[n,a]of s)if(a>=3){let c=n.includes(" ")?a*1.5:a;r.push([n,c])}return r.sort((n,a)=>a[1]-n[1]),r.map(([n])=>n)}function F(t,e){let o=0;for(let s of e){let r=new RegExp(s.source,s.flags),n=t.match(r);n&&(o+=n.length)}return o}function ie(t,e){let o=t.toLowerCase();return e.filter(s=>o.includes(s)).length}function q(t){return t.split(/\s+/).filter(e=>e.length>0).length}function Pe(t){return t.split(/[.!?]+/).filter(e=>e.trim().length>5).length}function ce(t){if(t=t.toLowerCase().replace(/[^a-z]/g,""),t.length<=3)return 1;t=t.replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,""),t=t.replace(/^y/,"");let e=t.match(/[aeiouy]{1,2}/g);return e?Math.max(e.length,1):1}function le(t){let e=t.split(/\s+/).filter(a=>a.length>0),o=t.split(/[.!?]+/).filter(a=>a.trim().length>5),s=e.reduce((a,i)=>a+ce(i),0);if(e.length===0||o.length===0)return 0;let r=e.length/o.length,n=s/e.length;return 206.835-1.015*r-84.6*n}function pe(t){return t.split(/\s+/).filter(o=>o.length>0).filter(o=>ce(o)>=4).length}function ue(t){let e=t.split(/\s+/).filter(s=>s.length>0),o=t.split(/[.!?]+/).filter(s=>s.trim().length>5);return o.length===0?0:Math.round(e.length/o.length)}function j(t){let e=_compromise2.default.call(void 0, t),o=[...new Set(e.people().out("array"))],s=[...new Set(e.organizations().out("array"))],r=[...new Set(e.places().out("array"))],n=Ee(t),a=Ce(t),i=[],c=[],l=[];for(let y of a)Ie(t,y)?i.push(y):Re(y)?c.push(y):l.push(y);l.push(...n);let p=ae(o,i),g=ae(s,[...c,...l]),d=ne([...new Set(r)]),A=Oe(e),x=e.verbs().isImperative().length,v=e.numbers().length;return{people:p,organizations:g,places:d,topics:A,imperativeVerbCount:x,numberCount:v}}var ke=[[93,"A"],[90,"A-"],[87,"B+"],[83,"B"],[80,"B-"],[77,"C+"],[73,"C"],[70,"C-"],[67,"D+"],[63,"D"],[60,"D-"],[0,"F"]];function b(t,e,o="higher"){return o==="range"?Xt(t,e):o==="lower"?Kt(t,e):Qt(t,e)}function Qt(t,e){for(let[o,s]of e)if(t>=o)return s;return 0}function Kt(t,e){for(let[o,s]of e)if(t<=o)return s;return 0}function Xt(t,e){for(let[o,s,r]of e)if(t>=o&&t<=s)return r;return 0}function Zt(t,e){let o=e>0?t/e:0;return o>=.7?"good":o>=.3?"needs_improvement":"critical"}function h(t,e,o,s,r){return{name:t,score:Math.round(Math.min(e,o)),maxScore:o,value:s,status:_nullishCoalesce(r, () => (Zt(e,o)))}}function I(t){return t.reduce((e,o)=>e+o.score,0)}function O(t){return t.reduce((e,o)=>e+o.maxScore,0)}function Le(t,e){let o={contentExtractability:e.contentExtractability,contentStructure:e.contentStructure,answerability:e.answerability,entityClarity:e.entityClarity,groundingSignals:e.groundingSignals,authorityContext:e.authorityContext,readabilityForCompression:e.readabilityForCompression},s=Object.values(o).reduce((l,p)=>l+p,0),r=0,n=0,a=0;for(let[l,p]of Object.entries(t)){r+=p.score,n+=p.maxScore;let g=_nullishCoalesce(o[l], () => (1)),d=s>0?g/s:1/7,A=p.maxScore>0?p.score/p.maxScore*100:0;a+=A*d}let i=Math.round(a),c=de(i);return{overallScore:i,grade:c,totalPoints:r,maxPoints:n}}function de(t){for(let[e,o]of ke)if(t>=e)return o;return"F"}var P={contentExtractability:"Content Extractability",contentStructure:"Content Structure for Reuse",answerability:"Answerability",entityClarity:"Entity Clarity",groundingSignals:"Grounding Signals",authorityContext:"Authority Context",readabilityForCompression:"Readability for Compression"};var De=[/\bis\s+defined\s+as\b/gi,/\brefers?\s+to\b/gi,/\bmeans?\s+that\b/gi,/\bis\s+a\s+type\s+of\b/gi,/\bcan\s+be\s+described\s+as\b/gi,/\balso\s+known\s+as\b/gi],Me=[/\[\d+\]/g,/\([\w\s]+,?\s*\d{4}\)/g,/according\s+to/gi,/research\s+(?:shows|indicates|suggests)/gi,/studies?\s+(?:show|indicate|suggest|found)/gi,/data\s+from/gi,/as\s+reported\s+by/gi],Fe=[/according\s+to/gi,/\bsaid\b/gi,/\bstated\b/gi,/\breported\b/gi,/\bcited\s+by\b/gi],Ue=[/\d+(?:\.\d+)?\s*%/g,/\d+(?:\.\d+)?\s*(?:million|billion|thousand|trillion)/gi,/\$[\d,.]+/g,/increased\s+by/gi,/decreased\s+by/gi,/grew\s+by/gi],Ne=[/step\s+\d+/gi,/^\s*\d+\.\s+\w/gm,/\bfirst(?:ly)?,?\s/gi,/\bsecond(?:ly)?,?\s/gi,/\bfinally,?\s/gi,/\bhow\s+to\b/gi],ze=[/\bin\s+summary\b/gi,/\bin\s+conclusion\b/gi,/\bto\s+summarize\b/gi,/\bkey\s+takeaways?\b/gi,/\bbottom\s+line\b/gi,/\btl;?dr\b/gi],_e=[/what\s+is/gi,/what\s+are/gi,/how\s+to/gi,/how\s+do/gi,/why\s+is/gi,/why\s+do/gi,/when\s+to/gi,/where\s+to/gi,/which\s+is/gi,/who\s+is/gi],je=[/^The\s+\w+\s+is\b/gm,/^It\s+is\b/gm,/^This\s+is\b/gm,/^They\s+are\b/gm,/\bsimply\s+put\b/gi,/\bin\s+short\b/gi],Be=["however","therefore","moreover","furthermore","consequently","additionally","in contrast","similarly","as a result","for example","for instance","on the other hand","nevertheless","meanwhile","likewise","in addition","specifically","in particular","notably","importantly"],He=['[rel="author"]',".author",".byline",'[itemprop="author"]',".post-author",".entry-author",'meta[name="author"]'],Ge=["time[datetime]",'[itemprop="datePublished"]','[itemprop="dateModified"]',".published",".post-date",".entry-date",'meta[property="article:published_time"]','meta[property="article:modified_time"]'],We=/^(?:what|how|why|when|where|which|who|can|do|does|is|are|should|will)\b/i,qe=[/"[^"]{10,}"\s*[-\u2013\u2014]\s*[A-Z][a-z]+/g,/"[^"]{10,}",?\s+said\s+[A-Z]/g,/"[^"]{10,}",?\s+according\s+to\s+[A-Z]/g,/according\s+to\s+[A-Z][a-z]+[^,]*,\s*"[^"]{10,}"/g,/\u201c[^\u201d]{10,}\u201d\s*[-\u2013\u2014]\s*[A-Z][a-z]+/g,/\u201c[^\u201d]{10,}\u201d,?\s+said\s+[A-Z]/g],me=["GPTBot","ChatGPT-User","ClaudeBot","PerplexityBot","Google-Extended"],Ye=['[itemprop="dateModified"]','meta[property="article:modified_time"]'],Je=["time[datetime]",'[itemprop="datePublished"]','meta[property="article:published_time"]'];function Ve(t){let e=0,o=0;return t("h2").each((s,r)=>{let n=t(r).text().trim();if(!(n.includes("?")||We.test(n)))return;e++;let i=t(r).nextAll("p").first();if(!i.length)return;let l=i.text().trim().split(/[.!?]/)[0]||"";l.length>0&&l.length<=200&&o++}),{total:e,withCapsule:o}}function Qe(t){let e=t("h1, h2, h3, h4, h5, h6");if(e.length===0)return{sectionCount:0,avgWordsPerSection:0,sections:[]};let o=[];e.each((r,n)=>{let a=0,i=t(n).next();for(;i.length&&!i.is("h1, h2, h3, h4, h5, h6");){let c=i.text().trim();a+=c.split(/\s+/).filter(l=>l.length>0).length,i=i.next()}a>0&&o.push(a)});let s=o.length>0?Math.round(o.reduce((r,n)=>r+n,0)/o.length):0;return{sectionCount:o.length,avgWordsPerSection:s,sections:o}}function Ke(t){let e=[];return t('script[type="application/ld+json"]').each((o,s)=>{try{let r=JSON.parse(t(s).html()||"{}");Array.isArray(r)?e.push(...r):e.push(r)}catch (e4){}}),e}function Xe(t,e){let o=t.cleanText,s=t.$,r=[],{imperativeVerbCount:n=0}=_nullishCoalesce(e, () => (j(o))),a=F(o,De),i=b(a,[[6,10],[3,7],[1,4],[0,0]]);r.push(h("Definition Patterns",i,10,`${a} definition patterns`));let c=F(o,je),l=b(c,[[5,11],[2,8],[1,4],[0,0]]);r.push(h("Direct Answer Statements",l,11,`${c} direct statements`));let p=Ve(t.$),g=p.total>0?p.withCapsule/p.total:0,d=p.total===0?0:b(g,[[.7,13],[.4,9],[.01,5]]);r.push(h("Answer Capsules",d,13,p.total>0?`${p.withCapsule}/${p.total} question headings have answer capsules`:"No question-framed H2s found",p.total===0?"neutral":void 0));let A=F(o,Ne),x=s("ol").length>0,v=A+n+(x?2:0),y=b(v,[[5,10],[2,7],[1,3],[0,0]]);r.push(h("Step-by-Step Content",y,10,`${A} step indicators, ${n} instruction verbs${x?", ordered lists found":""}`));let w=o.match(/[^.!?]*\?/g)||[],f=F(o,_e),T=b(w.length+f,[[10,11],[5,8],[2,5],[1,2],[0,0]]);r.push(h("Q/A Patterns",T,11,`${w.length} questions, ${f} query patterns`));let E=F(o,ze),$=b(E,[[2,9],[1,5]]);return r.push(h("Summary/Conclusion",$,9,E>0?`${E} summary markers`:"No summary markers")),{category:{name:P.answerability,key:"answerability",score:I(r),maxScore:O(r),factors:r},rawData:{answerCapsules:p,questionsFound:w.slice(0,5)}}}function Ze(t){let e=_optionalChain([t, 'call', _2 => _2('meta[property="og:site_name"]'), 'access', _3 => _3.attr, 'call', _4 => _4("content"), 'optionalAccess', _5 => _5.trim, 'call', _6 => _6()]);if(e)return e;let o=t('script[type="application/ld+json"]'),s=null;return o.each((r,n)=>{try{let a=JSON.parse(t(n).html()||"{}");a["@type"]==="Organization"&&a.name&&(s=String(a.name).trim()),_optionalChain([a, 'access', _7 => _7.publisher, 'optionalAccess', _8 => _8.name])&&(s=s||String(a.publisher.name).trim())}catch (e5){}}),s||null}function et(t,e,o){if(!o)return{score:0,surfacesFound:0,surfacesChecked:0};let s=o.toLowerCase(),r=4,n=0;e.toLowerCase().includes(s)&&n++,(t('meta[property="og:title"]').attr("content")||"").toLowerCase().includes(s)&&n++,t("footer").text().toLowerCase().includes(s)&&n++;let c=t('[class*="copyright"], [class*="legal"]').text().toLowerCase(),l=t("header").text().toLowerCase();return(c.includes(s)||l.includes(s))&&n++,{score:n>=4?10:n>=3?7:n>=2?4:n>=1?2:0,surfacesFound:n,surfacesChecked:r}}function tt(t){let e=null,o=null;for(let n of Ye){let a=t(n).first();if(a.length){e=a.attr("datetime")||a.attr("content")||a.text().trim();break}}for(let n of Je){let a=t(n).first();if(a.length){o=a.attr("datetime")||a.attr("content")||a.text().trim();break}}let s=e||o,r=null;if(s){let n=new Date(s);if(!isNaN(n.getTime())){let a=new Date;r=(a.getFullYear()-n.getFullYear())*12+(a.getMonth()-n.getMonth())}}return{publishDate:o,modifiedDate:e,ageInMonths:r,hasModifiedDate:!!e}}var eo={Article:["headline","author","datePublished"],NewsArticle:["headline","author","datePublished"],BlogPosting:["headline","author","datePublished"],FAQPage:["mainEntity"],HowTo:["name","step"],Organization:["name","url"],LocalBusiness:["name","address"],Product:["name"],WebPage:["name"]};function ot(t){let e=[];for(let s of t){let r=String(s["@type"]||""),n=eo[r];if(!n)continue;let a=n.filter(c=>s[c]!=null),i=n.filter(c=>s[c]==null);e.push({type:r,present:a,missing:i})}let o=e.length>0?e.reduce((s,r)=>s+r.present.length/(r.present.length+r.missing.length),0)/e.length:0;return{totalTypes:e.length,avgCompleteness:o,details:e}}function st(t){let e=t.$,o=[],s={},r=!1,n="";for(let M of He){let R=e(M).first();if(R.length){r=!0,n=R.text().trim()||R.attr("content")||"Found";break}}o.push(h("Author Attribution",r?10:0,10,r?n:"Not found"));let a=t.html.includes('"@type":"Organization"')||t.html.includes('"@type": "Organization"'),i=e('meta[property="og:site_name"]').attr("content")||"",c=a||i.length>0;o.push(h("Organization Identity",c?10:0,10,c?i||"Schema found":"Not found"));let l=e('a[href*="about"], a[href*="team"], a[href*="company"]').length>0,p=e('a[href*="contact"]').length>0,g=l&&p?10:l||p?5:0;o.push(h("Contact/About Links",g,10,`${l?"About":""}${l&&p?" + ":""}${p?"Contact":""}${!l&&!p?"Not found":""}`));let d=!1,A="";for(let M of Ge){let R=e(M).first();if(R.length){d=!0,A=R.attr("datetime")||R.attr("content")||R.text().trim();break}}o.push(h("Publication Date",d?8:0,8,d?A:"Not found"));let x=tt(t.$),v=0;x.ageInMonths!==null&&(v=b(x.ageInMonths,[[6,12],[12,9],[24,5]],"lower"),x.hasModifiedDate&&v<12&&(v=Math.min(v+2,12))),o.push(h("Content Freshness",v,12,x.ageInMonths!==null?`${x.ageInMonths} months old${x.hasModifiedDate?", modified date present":""}`:"No parseable date found")),s.freshness=x;let y=Ke(t.$),w=y.map(M=>M["@type"]).filter(Boolean),T=["og:title","og:description","og:image","og:type"].filter(M=>e(`meta[property="${M}"]`).length>0),E=e('link[rel="canonical"]').attr("href"),$=0;w.length>0&&($+=4),T.length>=3?$+=4:T.length>0&&($+=2),E&&($+=4),s.structuredDataTypes=w,o.push(h("Structured Data",$,12,`${w.length>0?w.join(", "):"No JSON-LD"}, ${T.length}/4 OG tags${E?", canonical":""}`));let C=ot(y),G=C.totalTypes===0?0:b(C.avgCompleteness,[[.8,10],[.5,7],[.01,4]]);o.push(h("Schema Completeness",G,10,C.totalTypes>0?`${C.totalTypes} schema types, ${Math.round(C.avgCompleteness*100)}% complete`:"No recognized JSON-LD schemas found",C.totalTypes===0?"neutral":void 0)),s.schemaCompleteness=C;let U=Ze(t.$),D=et(t.$,t.title,U);return o.push(h("Entity Consistency",D.score,10,U?`"${U}" found in ${D.surfacesFound}/${D.surfacesChecked} surfaces`:"No identifiable entity name",U?void 0:"neutral")),s.entityConsistency={entityName:U||null,surfacesFound:D.surfacesFound,surfacesChecked:D.surfacesChecked},{category:{name:P.authorityContext,key:"authorityContext",score:I(o),maxScore:O(o),factors:o},rawData:s}}function to(t){let e=[],o=null;for(let s of t.split(`
2
- `)){let r=s.split("#")[0].trim();if(!r){o=null;continue}let n=r.indexOf(":");if(n===-1)continue;let a=r.slice(0,n).trim().toLowerCase(),i=r.slice(n+1).trim();a==="user-agent"?(o||(o={agents:[],rules:[]},e.push(o)),o.agents.push(i.toLowerCase())):(a==="disallow"||a==="allow")&&o&&o.rules.push({type:a,path:i})}return e}function oo(t,e){let o=[],s=[];for(let r of t)r.agents.includes(e)?o.push(...r.rules):r.agents.includes("*")&&s.push(...r.rules);return{specific:o,wildcard:s}}function so(t,e){let o=-1,s=!1;for(let r of t){let n=r.path;!n||!e.startsWith(n)||(n.length>o?(o=n.length,s=r.type==="disallow"):n.length===o&&r.type==="allow"&&(s=!1))}return o>=0&&s}function ro(t){return t.filter(e=>e.type==="disallow"&&e.path&&e.path!=="/").map(e=>e.path)}function rt(t){if(!t)return{allowed:[],blocked:[],unknown:[...me]};let e=to(t),o=[],s=[],r=[],n=[];for(let a of me){let i=a.toLowerCase(),{specific:c,wildcard:l}=oo(e,i),p=c.length>0?c:l;if(p.length===0){r.push(a);continue}if(so(p,"/"))s.push(a);else{o.push(a);let d=ro(p);for(let A of d){let x=`${a}: ${A}`;n.includes(x)||n.push(x)}}}return{allowed:o,blocked:s,unknown:r,...n.length>0&&{partiallyBlocked:n}}}function nt(t,e,o){let s=[],r={},n=e.statusCode===200?12:e.statusCode<400?8:0;s.push(h("Fetch Success",n,12,`HTTP ${e.statusCode} in ${e.fetchTimeMs}ms`));let a=t.stats.rawByteLength>0?t.stats.cleanTextLength/t.stats.rawByteLength:0,i=b(a,[[.05,.15,12],[.16,1/0,10],[.01,.049,8],[1e-4,.009,2]],"range");s.push(h("Text Extraction Quality",i,12,`${(a*100).toFixed(1)}% content ratio`));let c=t.stats.boilerplateRatio,l=b(1-c,[[.7,12],[.5,9],[.3,6],[.01,2]]);s.push(h("Boilerplate Ratio",l,12,`${(c*100).toFixed(0)}% boilerplate`));let p=t.stats.wordCount,g=b(p,[[300,3e3,12],[3001,1/0,10],[100,299,8],[1,99,2]],"range");if(s.push(h("Word Count Adequacy",g,12,`${p} words`)),o){let w=rt(o.robotsTxt),f=w.blocked.length,T=b(f,[[0,10],[2,6],[4,3]],"lower");s.push(h("AI Crawler Access",T,10,f===0?"All major AI crawlers allowed":`${w.blocked.join(", ")} blocked in robots.txt`)),r.crawlerAccess=w,r.llmsTxt={llmsTxtExists:o.llmsTxtExists,llmsFullTxtExists:o.llmsFullTxtExists};let E=o.llmsTxtExists,$=o.llmsFullTxtExists,C=E&&$?6:E||$?4:0;s.push(h("LLMs.txt Presence",C,6,E&&$?"llms.txt + llms-full.txt found":E?"llms.txt found":$?"llms-full.txt found":"Not found",!E&&!$?"neutral":void 0))}let d=t.stats.imageCount,A=t.stats.imagesWithAlt,x=t.$("figure figcaption").length,v=d>0?A/d:0,y=0;return d>0&&(v>=.9?y+=5:v>=.5?y+=3:y+=1,x>0&&(y+=3)),s.push(h("Image Accessibility",y,8,d>0?`${A}/${d} images have alt text${x>0?`, ${x} figcaptions`:""}`:"No images found",d===0?"neutral":void 0)),r.imageAccessibility={imageCount:d,imagesWithAlt:A,figcaptionCount:x},{category:{name:P.contentExtractability,key:"contentExtractability",score:I(s),maxScore:O(s),factors:s},rawData:r}}function at(t){let e=t.$,o=[],s=t.stats.h1Count,r=t.stats.h2Count,n=t.stats.h3Count,a=0;s===1?a+=4:s>0&&(a+=2),r>=2?a+=4:r>0&&(a+=2),n>0&&(a+=3),o.push(h("Heading Hierarchy",a,11,`${s} H1, ${r} H2, ${n} H3`));let i=t.stats.listItemCount,c=b(i,[[10,11],[5,8],[1,4],[0,0]]);o.push(h("Lists Presence",c,11,`${i} list items`));let l=t.stats.tableCount,p=b(l,[[2,8],[1,5]]);o.push(h("Tables Presence",p,8,`${l} table(s)`,l===0?"neutral":void 0));let g=t.stats.paragraphCount,d=g>0?Math.round(t.stats.wordCount/g):0,A=b(d,[[30,150,11],[1,199,7],[200,1/0,2]],"range");o.push(h("Paragraph Structure",A,11,`${g} paragraphs, avg ${d} words`));let x=e("strong, b").length>0,v=g>0?t.stats.headingCount/g:0,y=0;x&&(y+=4),d<=150&&(y+=4),v>=.1&&(y+=3),o.push(h("Scannability",y,11,`${x?"Bold text found":"No bold text"}, ${v.toFixed(2)} heading ratio`));let w=Qe(t.$),f=w.sectionCount===0?0:b(w.avgWordsPerSection,[[120,180,12],[80,250,8],[1,1/0,4]],"range");return o.push(h("Section Length",f,12,w.sectionCount>0?`${w.sectionCount} sections, avg ${w.avgWordsPerSection} words`:"No headed sections found",w.sectionCount===0?"neutral":void 0)),{category:{name:P.contentStructure,key:"contentStructure",score:I(o),maxScore:O(o),factors:o},rawData:{sectionLengths:w}}}function it(t,e){let o=t.cleanText,s=[],r=_nullishCoalesce(e, () => (j(o))),n=r.people.length+r.organizations.length+r.places.length+r.topics.length,a=b(n,[[9,20],[4,14],[1,7],[0,0]]);s.push(h("Entity Richness",a,20,`${n} entities (${r.people.length} people, ${r.organizations.length} orgs, ${r.places.length} places)`,n===0?"neutral":void 0));let i=t.title.toLowerCase().split(/\s+/).filter(f=>f.length>3),l=t.$("h1").first().text().toLowerCase().split(/\s+/).filter(f=>f.length>3),p=[...new Set([...i,...l])],g=r.topics.map(f=>f.toLowerCase()),d=0;for(let f of p)(g.some(T=>T.includes(f))||o.toLowerCase().split(f).length>3)&&d++;let A=p.length>0?d/p.length:0,x=p.length===0?0:b(A,[[.5,25],[.01,15]]);s.push(h("Topic Consistency",x,25,`${d}/${p.length} title keywords align with content topics`,p.length===0?"neutral":void 0));let v=q(o),y=v>0?n/v*100:0,w=b(y,[[2,8,15],[1,1/0,10],[.01,.99,3]],"range");return s.push(h("Entity Density",w,15,`${y.toFixed(1)} entities per 100 words`)),{category:{name:P.entityClarity,key:"entityClarity",score:I(s),maxScore:O(s),factors:s},rawData:{entities:r}}}function ct(t,e){let o=t.$,s=t.cleanText,r=[],{numberCount:n=0}=_nullishCoalesce(e, () => (j(s))),a=t.externalLinks,i=b(a.length,[[6,13],[3,10],[1,6],[0,0]]);r.push(h("External References",i,13,`${a.length} external links`));let c=F(s,Me),l=o("blockquote, cite, q").length,p=c+l,g=b(p,[[6,13],[3,9],[1,5],[0,0]]);r.push(h("Citation Patterns",g,13,`${c} citation indicators, ${l} quote elements`));let d=F(s,Ue),A=d+n,x=b(A,[[9,13],[4,9],[1,5],[0,0]]);r.push(h("Numeric Claims",x,13,`${d} statistical references, ${n} numeric values`));let v=F(s,Fe),y=b(v,[[5,11],[2,8],[1,4],[0,0]]);r.push(h("Attribution Indicators",y,11,`${v} attribution patterns`));let w=F(s,qe),f=o("blockquote").filter(($,C)=>o(C).find("cite, footer, figcaption").length>0).length,T=w+f,E=b(T,[[4,10],[2,7],[1,4],[0,0]]);return r.push(h("Quoted Attribution",E,10,`${T} attributed quotes`,T===0?"neutral":void 0)),{category:{name:P.groundingSignals,key:"groundingSignals",score:I(r),maxScore:O(r),factors:r},rawData:{externalLinks:a.slice(0,10)}}}function lt(t){let e=t.cleanText,o=[],s=ue(e),r=b(s,[[12,22,15],[8,29,10],[1,1/0,5]],"range");o.push(h("Sentence Length",r,15,`Avg ${s} words/sentence`));let n=le(e),a=b(n,[[60,70,15],[71,1/0,13],[50,59,10],[30,49,6]],"range");o.push(h("Readability",a,15,`Flesch Reading Ease: ${n.toFixed(1)}`));let i=q(e),c=pe(e),l=i>0?c/i:0,p=b(l,[[.02,15],[.05,12],[.1,8]],"lower");o.push(h("Jargon Density",p,15,`${(l*100).toFixed(1)}% complex words`));let g=ie(e,Be),d=b(g,[[10,15],[5,11],[2,7],[1,3],[0,0]]);return o.push(h("Transition Usage",d,15,`${g} transition types found`)),{category:{name:P.readabilityForCompression,key:"readabilityForCompression",score:I(o),maxScore:O(o),factors:o},rawData:{avgSentenceLength:s,readabilityScore:n}}}function pt(t,e,o){let s=j(t.cleanText),r=nt(t,e,o),n=at(t),a=Xe(t,s),i=it(t,s),c=ct(t,s),l=st(t),p=lt(t);return{categories:{contentExtractability:r.category,contentStructure:n.category,answerability:a.category,entityClarity:i.category,groundingSignals:c.category,authorityContext:l.category,readabilityForCompression:p.category},rawData:{title:t.title,metaDescription:t.metaDescription,wordCount:t.stats.wordCount,...r.rawData,...n.rawData,...a.rawData,...i.rawData,...c.rawData,...l.rawData,...p.rawData}}}var _cheerio = require('cheerio'); var K = _interopRequireWildcard(_cheerio);var no=["script","style","noscript","svg","iframe","nav","header","footer","aside",'[role="navigation"]','[role="banner"]','[role="contentinfo"]',".sidebar","#sidebar",".cookie-banner","#cookie-consent",".cookie-notice",".nav",".navbar",".footer",".header",".menu",".ad",".ads",".advertisement",'[class*="cookie"]','[class*="consent"]','[class*="popup"]','[class*="modal"]'];function ut(t){for(let e of no)t(e).remove()}function ao(t){return t.replace(/\s+/g," ").trim()}var io="p,div,td,th,li,h1,h2,h3,h4,h5,h6,dt,dd,br,blockquote,section,article";function dt(t){return t(io).each((e,o)=>{t(o).append(" ")}),ao(t("body").text())}function mt(t,e){let o=K.load(t),s=o("title").text().trim()||_optionalChain([o, 'call', _9 => _9('meta[property="og:title"]'), 'access', _10 => _10.attr, 'call', _11 => _11("content"), 'optionalAccess', _12 => _12.trim, 'call', _13 => _13()])||"",r=_optionalChain([o, 'call', _14 => _14('meta[name="description"]'), 'access', _15 => _15.attr, 'call', _16 => _16("content"), 'optionalAccess', _17 => _17.trim, 'call', _18 => _18()])||_optionalChain([o, 'call', _19 => _19('meta[property="og:description"]'), 'access', _20 => _20.attr, 'call', _21 => _21("content"), 'optionalAccess', _22 => _22.trim, 'call', _23 => _23()])||"",n=K.load(t);n("script, style, noscript").remove();let a=n("body").text().replace(/\s+/g," ").trim(),i=Buffer.byteLength(t,"utf-8"),c=o("h1").length,l=o("h2").length,p=o("h3").length,g=c+l+p+o("h4, h5, h6").length,d=o("a[href]").length,A=o("img").length,x=o("ul, ol").length,v=o("li").length,y=o("table").length,w=o("p").length,f=new Set(["image","photo","logo","icon","picture","img","graphic","thumbnail"]),T=0;o("img").each((V,B)=>{let W=_nullishCoalesce(_optionalChain([o, 'call', _24 => _24(B), 'access', _25 => _25.attr, 'call', _26 => _26("alt"), 'optionalAccess', _27 => _27.trim, 'call', _28 => _28()]), () => (""));W.split(/\s+/).filter(Jt=>Jt.length>0).length>1&&W.length<200&&!f.has(W.toLowerCase())&&T++});let E=se(e),$=[];o('a[href^="http"]').each((V,B)=>{let W=o(B).attr("href");try{se(W)!==E&&$.push({url:W,text:o(B).text().trim().substring(0,50)})}catch (e6){}});let C=$.length,G=K.load(t);ut(G);let U=dt(G),D=U.length,M=a.length>0?Math.max(0,Math.min(1,1-D/a.length)):0,R={wordCount:q(U),sentenceCount:Pe(U),paragraphCount:w,headingCount:g,h1Count:c,h2Count:l,h3Count:p,linkCount:d,externalLinkCount:C,imageCount:A,imagesWithAlt:T,listCount:x,listItemCount:v,tableCount:y,boilerplateRatio:M,rawByteLength:i,cleanTextLength:D};return{url:e,html:t,cleanText:U,title:s,metaDescription:r,stats:R,$:o,externalLinks:$}}var _zod = require('zod');var ht=_zod.z.object({url:_zod.z.url(),timeout:_zod.z.number().positive().default(45e3),userAgent:_zod.z.string().default(`AISEOAudit/${_}`)}),Wr=_zod.z.object({url:_zod.z.string(),finalUrl:_zod.z.string(),statusCode:_zod.z.number(),contentType:_zod.z.string(),html:_zod.z.string(),byteLength:_zod.z.number(),fetchTimeMs:_zod.z.number(),redirected:_zod.z.boolean()});async function X(t){let e=ht.parse(t),o=Date.now(),s=await H({url:e.url,timeout:e.timeout,userAgent:e.userAgent}),r=Date.now()-o,n=s.data,a=s.finalUrl||e.url,i=s.headers["content-type"]||"unknown";return{url:e.url,finalUrl:a,statusCode:s.status,contentType:i,html:n,byteLength:Buffer.byteLength(n,"utf-8"),fetchTimeMs:r,redirected:a!==e.url}}var gt=`<!-- Before: prose enumeration -->
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _="1.4.19";var te={Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Accept-Language":"en-US,en;q=0.9","Accept-Encoding":"gzip, deflate, br","Cache-Control":"no-cache"};var N=class extends Error{constructor(e,o,s){super(s),this.name="FetchError",this.code=e,this.url=o}};function ve(t,e){if(t instanceof N)return t;let o=t instanceof Error?t.message:String(t),s=t instanceof Error&&t.cause instanceof Error?t.cause.message:"",r=`${o} ${s}`.toLowerCase();if(t instanceof DOMException||t instanceof Error&&t.name==="AbortError"||r.includes("abort"))return new N("TIMEOUT",e,`Request timed out. The server at "${new URL(e).hostname}" did not respond in time.`);if(r.includes("getaddrinfo")||r.includes("enotfound")){let n=new URL(e).hostname;return new N("DNS_FAILURE",e,`DNS lookup failed for "${n}". Check that the domain exists and is spelled correctly.`)}return r.includes("econnrefused")?new N("CONNECTION_REFUSED",e,`Connection refused by "${new URL(e).hostname}". The server may be down or not accepting connections.`):r.includes("cert")||r.includes("ssl")||r.includes("tls")||r.includes("unable to verify")?new N("TLS_ERROR",e,`TLS/SSL error connecting to "${new URL(e).hostname}". The site may have an invalid or expired certificate.`):new N("NETWORK_ERROR",e,`Network error fetching "${e}": ${o}`)}async function B(t){let e=new AbortController,o=setTimeout(()=>e.abort(),t.timeout);try{let s=await fetch(t.url,{method:"GET",headers:{"User-Agent":t.userAgent,...te},signal:e.signal,redirect:"follow"}),r=s.headers.get("content-length");if(r&&parseInt(r,10)>10485760)throw new N("TOO_LARGE",t.url,`Response from "${new URL(t.url).hostname}" exceeds the ${Math.round(10485760/1024/1024)}MB size limit.`);let n=await s.text();if(n.length>10485760)throw new N("TOO_LARGE",t.url,`Response from "${new URL(t.url).hostname}" exceeds the ${Math.round(10485760/1024/1024)}MB size limit.`);let a={};return s.headers.forEach((i,c)=>{a[c]=i}),{status:s.status,data:n,headers:a,finalUrl:s.url}}catch(s){throw ve(s,t.url)}finally{clearTimeout(o)}}async function oe(t){let e=new AbortController,o=setTimeout(()=>e.abort(),t.timeout);try{let s=await fetch(t.url,{method:"HEAD",headers:{"User-Agent":t.userAgent,...te},signal:e.signal,redirect:"follow"}),r={};return s.headers.forEach((n,a)=>{r[a]=n}),{status:s.status,data:"",headers:r,finalUrl:s.url}}catch(s){throw ve(s,t.url)}finally{clearTimeout(o)}}function J(t){let e=t.trim();return/^https?:\/\//i.test(e)||(e=`https://${e}`),new URL(e).toString().replace(/\/+$/,"")}function _o(t){try{let e=J(t);return new URL(e),!0}catch (e2){return!1}}function se(t){try{return new URL(t).hostname}catch (e3){return t}}var _compromise = require('compromise'); var _compromise2 = _interopRequireDefault(_compromise);var re=new Set(["a","an","the","and","or","but","in","on","at","to","for","of","with","by","from","as","is","was","are","were","been","be","have","has","had","do","does","did","will","would","could","should","may","might","shall","can","need","must","that","which","who","whom","this","these","those","it","its","he","she","they","we","you","i","me","him","her","us","them","my","your","his","our","their","what","when","where","how","why","all","each","every","both","few","more","most","other","some","such","no","nor","not","only","own","same","so","than","too","very","just","about","above","after","again","also","any","because","before","between","during","here","if","into","like","new","now","over","then","there","through","under","up","out","off","down","much","well","back","even","still","also","get","got","one","two","make","many","say","said","see","go","come","take","know","think","good","great","first","last","long","way","find","use","used","using","while","being","made","however","since","per","via","based","within","without","across","along","around","among","until","another","www","http","https","com"]),Ae=new Set(["I","A","OK","AM","PM","US","UK","EU","VS","EG","IE","ET","AL","HTML","CSS","JS","TS","URL","HTTP","HTTPS","API","SDK","CLI","GUI","PDF","CSV","JSON","XML","SQL","RSS","FTP","SSH","SSL","TLS","DNS","TCP","UDP","IP","RAM","ROM","CPU","GPU","SSD","HDD","USB","HDMI","FAQ","DIY","ASAP","FYI","TBD","TBA","ETA","ROI","KPI","CEO","CTO","CFO","COO","CIO","VP","SVP","EVP","HR","PR","QA","IT","RD","RND","LLC","INC","LTD","CORP","PLC","USD","EUR","GBP","JPY","CAD","ID","NO","RE","CC","BCC","GEO","SEO","SEM","PPC","CMS","CRM","ERP","SaaS","AI","ML","NLP","LLM","GPT","NER","TLDR","AKA","RSVP","PS"]),Te=/\b(?:Inc|Corp|Corporation|LLC|Ltd|Limited|Co|Company|Group|Foundation|Institute|University|Association|Society|Agency|Authority|Bureau|Commission|Council|Department|Board|Trust|Fund|Partners|Ventures|Labs|Technologies|Solutions|Systems|Services|Consulting|Media|Network|Studios|Entertainment|Healthcare|Pharmaceuticals|Dynamics|Holdings|Capital|Enterprises|International)\b/i,$e=/\b(?:Mr|Mrs|Ms|Miss|Dr|Prof|Professor|Rev|Reverend|Sen|Senator|Rep|Representative|Gov|Governor|Pres|President|Gen|General|Col|Colonel|Sgt|Sergeant|Cpl|Corporal|Pvt|Private|Adm|Admiral|Capt|Captain|Lt|Lieutenant|Maj|Major|Sir|Dame|Lord|Lady|Hon|Honorable|Judge|Justice|Chancellor|Dean|Provost)\.\s*/;function Ee(t){let e=t.match(/\b[A-Z]{2,6}\b/g);if(!e)return[];let o=new Set,s=[];for(let r of e)!Ae.has(r)&&!o.has(r)&&(o.add(r),s.push(r));return s}function Ce(t){let e=/\b([A-Z][a-z]+(?:\s+(?:of|the|and|for|de|van|von|al|el|la|le|del|der|den|das|di|du))?\s+(?:[A-Z][a-z]+)(?:\s+[A-Z][a-z]+){0,3})\b/g,o=t.split(/[.!?]\s+/),s=new Set;for(let i of o){let l=i.trim().split(/\s+/)[0];l&&s.add(l)}let r=new Set,n=[],a;for(;(a=e.exec(t))!==null;){let i=a[1],c=i.split(/\s+/)[0];if(s.has(c)&&!t.includes(`. ${i}`)&&!t.includes(`, ${i}`)){let l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),p=t.match(new RegExp(l,"g"));if(!p||p.length<2)continue}!r.has(i)&&i.split(/\s+/).length>=2&&(r.add(i),n.push(i))}return n}function Re(t){return Te.test(t)}function Ie(t,e){let o=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(?:${$e.source})\\s*${o}`,"i").test(t)}function ne(t){if(t.length===0)return[];let e=[...t].sort((r,n)=>n.length-r.length),o=[],s=new Set;for(let r of e){let n=r.toLowerCase();if(s.has(n))continue;let a=!1;for(let i of s)if(i.includes(n)){a=!0;break}a||(o.push(r),s.add(n))}return o}function ae(t,e){let o=[...t,...e];return ne(o)}function Pe(t){let e=new Set(t.nouns().out("array").flatMap(n=>n.toLowerCase().replace(/[^a-z0-9\s'-]/g," ").split(/\s+/).filter(a=>a.length>2&&!re.has(a)))),o=t.text().toLowerCase().replace(/[^a-z0-9\s'-]/g," ").split(/\s+/).filter(n=>n.length>2&&!re.has(n)&&e.has(n));if(o.length===0)return[];let s=new Map;for(let n of o)s.set(n,(s.get(n)||0)+1);for(let n=0;n<o.length-1;n++){let a=`${o[n]} ${o[n+1]}`;s.set(a,(s.get(a)||0)+1)}let r=[];for(let[n,a]of s)if(a>=3){let c=n.includes(" ")?a*1.5:a;r.push([n,c])}return r.sort((n,a)=>a[1]-n[1]),r.map(([n])=>n)}function F(t,e){let o=0;for(let s of e){let r=new RegExp(s.source,s.flags),n=t.match(r);n&&(o+=n.length)}return o}function ie(t,e){let o=t.toLowerCase();return e.filter(s=>o.includes(s)).length}function q(t){return t.split(/\s+/).filter(e=>e.length>0).length}function Oe(t){return t.split(/[.!?]+/).filter(e=>e.trim().length>5).length}function ce(t){if(t=t.toLowerCase().replace(/[^a-z]/g,""),t.length<=3)return 1;t=t.replace(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/,""),t=t.replace(/^y/,"");let e=t.match(/[aeiouy]{1,2}/g);return e?Math.max(e.length,1):1}function le(t){let e=t.split(/\s+/).filter(a=>a.length>0),o=t.split(/[.!?]+/).filter(a=>a.trim().length>5),s=e.reduce((a,i)=>a+ce(i),0);if(e.length===0||o.length===0)return 0;let r=e.length/o.length,n=s/e.length;return 206.835-1.015*r-84.6*n}function pe(t){return t.split(/\s+/).filter(o=>o.length>0).filter(o=>ce(o)>=4).length}function ue(t){let e=t.split(/\s+/).filter(s=>s.length>0),o=t.split(/[.!?]+/).filter(s=>s.trim().length>5);return o.length===0?0:Math.round(e.length/o.length)}function j(t){let e=_compromise2.default.call(void 0, t),o=[...new Set(e.people().out("array"))],s=[...new Set(e.organizations().out("array"))],r=[...new Set(e.places().out("array"))],n=Ee(t),a=Ce(t),i=[],c=[],l=[];for(let y of a)Ie(t,y)?i.push(y):Re(y)?c.push(y):l.push(y);l.push(...n);let p=ae(o,i),g=ae(s,[...c,...l]),d=ne([...new Set(r)]),A=Pe(e),x=e.verbs().isImperative().length,v=e.numbers().length;return{people:p,organizations:g,places:d,topics:A,imperativeVerbCount:x,numberCount:v}}var ke=[[93,"A"],[90,"A-"],[87,"B+"],[83,"B"],[80,"B-"],[77,"C+"],[73,"C"],[70,"C-"],[67,"D+"],[63,"D"],[60,"D-"],[0,"F"]];function b(t,e,o="higher"){return o==="range"?Zt(t,e):o==="lower"?Xt(t,e):Kt(t,e)}function Kt(t,e){for(let[o,s]of e)if(t>=o)return s;return 0}function Xt(t,e){for(let[o,s]of e)if(t<=o)return s;return 0}function Zt(t,e){for(let[o,s,r]of e)if(t>=o&&t<=s)return r;return 0}function eo(t,e){let o=e>0?t/e:0;return o>=.7?"good":o>=.3?"needs_improvement":"critical"}function h(t,e,o,s,r){return{name:t,score:Math.round(Math.min(e,o)),maxScore:o,value:s,status:_nullishCoalesce(r, () => (eo(e,o)))}}function I(t){return t.reduce((e,o)=>e+o.score,0)}function P(t){return t.reduce((e,o)=>e+o.maxScore,0)}function Le(t,e){let o={contentExtractability:e.contentExtractability,contentStructure:e.contentStructure,answerability:e.answerability,entityClarity:e.entityClarity,groundingSignals:e.groundingSignals,authorityContext:e.authorityContext,readabilityForCompression:e.readabilityForCompression},s=Object.values(o).reduce((l,p)=>l+p,0),r=0,n=0,a=0;for(let[l,p]of Object.entries(t)){r+=p.score,n+=p.maxScore;let g=_nullishCoalesce(o[l], () => (1)),d=s>0?g/s:1/7,A=p.maxScore>0?p.score/p.maxScore*100:0;a+=A*d}let i=Math.round(a),c=de(i);return{overallScore:i,grade:c,totalPoints:r,maxPoints:n}}function de(t){for(let[e,o]of ke)if(t>=e)return o;return"F"}var O={contentExtractability:"Content Extractability",contentStructure:"Content Structure for Reuse",answerability:"Answerability",entityClarity:"Entity Clarity",groundingSignals:"Grounding Signals",authorityContext:"Authority Context",readabilityForCompression:"Readability for Compression"};var De=[/\bis\s+defined\s+as\b/gi,/\brefers?\s+to\b/gi,/\bmeans?\s+that\b/gi,/\bis\s+a\s+type\s+of\b/gi,/\bcan\s+be\s+described\s+as\b/gi,/\balso\s+known\s+as\b/gi],Me=[/\[\d+\]/g,/\([\w\s]+,?\s*\d{4}\)/g,/according\s+to/gi,/research\s+(?:shows|indicates|suggests)/gi,/studies?\s+(?:show|indicate|suggest|found)/gi,/data\s+from/gi,/as\s+reported\s+by/gi],Fe=[/according\s+to/gi,/\bsaid\b/gi,/\bstated\b/gi,/\breported\b/gi,/\bcited\s+by\b/gi],Ue=[/\d+(?:\.\d+)?\s*%/g,/\d+(?:\.\d+)?\s*(?:million|billion|thousand|trillion)/gi,/\$[\d,.]+/g,/increased\s+by/gi,/decreased\s+by/gi,/grew\s+by/gi],Ne=[/step\s+\d+/gi,/^\s*\d+\.\s+\w/gm,/\bfirst(?:ly)?,?\s/gi,/\bsecond(?:ly)?,?\s/gi,/\bfinally,?\s/gi,/\bhow\s+to\b/gi],ze=[/\bin\s+summary\b/gi,/\bin\s+conclusion\b/gi,/\bto\s+summarize\b/gi,/\bkey\s+takeaways?\b/gi,/\bbottom\s+line\b/gi,/\btl;?dr\b/gi],_e=[/what\s+is/gi,/what\s+are/gi,/how\s+to/gi,/how\s+do/gi,/why\s+is/gi,/why\s+do/gi,/when\s+to/gi,/where\s+to/gi,/which\s+is/gi,/who\s+is/gi],je=[/^The\s+\w+\s+is\b/gm,/^It\s+is\b/gm,/^This\s+is\b/gm,/^They\s+are\b/gm,/\bsimply\s+put\b/gi,/\bin\s+short\b/gi],He=["however","therefore","moreover","furthermore","consequently","additionally","in contrast","similarly","as a result","for example","for instance","on the other hand","nevertheless","meanwhile","likewise","in addition","specifically","in particular","notably","importantly"],Be=['[rel="author"]',".author",".byline",'[itemprop="author"]',".post-author",".entry-author",'meta[name="author"]'],Ge=["time[datetime]",'[itemprop="datePublished"]','[itemprop="dateModified"]',".published",".post-date",".entry-date",'meta[property="article:published_time"]','meta[property="article:modified_time"]'],We=/^(?:what|how|why|when|where|which|who|can|do|does|is|are|should|will)\b/i,qe=[/"[^"]{10,}"\s*[-\u2013\u2014]\s*[A-Z][a-z]+/g,/"[^"]{10,}",?\s+said\s+[A-Z]/g,/"[^"]{10,}",?\s+according\s+to\s+[A-Z]/g,/according\s+to\s+[A-Z][a-z]+[^,]*,\s*"[^"]{10,}"/g,/\u201c[^\u201d]{10,}\u201d\s*[-\u2013\u2014]\s*[A-Z][a-z]+/g,/\u201c[^\u201d]{10,}\u201d,?\s+said\s+[A-Z]/g],me=["GPTBot","ChatGPT-User","ClaudeBot","PerplexityBot","Google-Extended"],Ye=['[itemprop="dateModified"]','meta[property="article:modified_time"]'],Je=["time[datetime]",'[itemprop="datePublished"]','meta[property="article:published_time"]'];function Ve(t){let e=0,o=0;return t("h2").each((s,r)=>{let n=t(r).text().trim();if(!(n.includes("?")||We.test(n)))return;e++;let i=t(r).nextAll("p").first();if(!i.length)return;let l=i.text().trim().split(/[.!?]/)[0]||"";l.length>0&&l.length<=200&&o++}),{total:e,withCapsule:o}}function Qe(t){let e=t("h1, h2, h3, h4, h5, h6");if(e.length===0)return{sectionCount:0,avgWordsPerSection:0,sections:[]};let o=[];e.each((r,n)=>{let a=0,i=t(n).next();for(;i.length&&!i.is("h1, h2, h3, h4, h5, h6");){let c=i.text().trim();a+=c.split(/\s+/).filter(l=>l.length>0).length,i=i.next()}a>0&&o.push(a)});let s=o.length>0?Math.round(o.reduce((r,n)=>r+n,0)/o.length):0;return{sectionCount:o.length,avgWordsPerSection:s,sections:o}}function Ke(t){let e=[];return t('script[type="application/ld+json"]').each((o,s)=>{try{let r=JSON.parse(t(s).html()||"{}");Array.isArray(r)?e.push(...r):e.push(r)}catch (e4){}}),e}function Xe(t,e){let o=t.cleanText,s=t.$,r=[],{imperativeVerbCount:n=0}=_nullishCoalesce(e, () => (j(o))),a=F(o,De),i=b(a,[[6,10],[3,7],[1,4],[0,0]]);r.push(h("Definition Patterns",i,10,`${a} definition patterns`));let c=F(o,je),l=b(c,[[5,11],[2,8],[1,4],[0,0]]);r.push(h("Direct Answer Statements",l,11,`${c} direct statements`));let p=Ve(t.$),g=p.total>0?p.withCapsule/p.total:0,d=p.total===0?0:b(g,[[.7,13],[.4,9],[.01,5]]);r.push(h("Answer Capsules",d,13,p.total>0?`${p.withCapsule}/${p.total} question headings have answer capsules`:"No question-framed H2s found",p.total===0?"neutral":void 0));let A=F(o,Ne),x=s("ol").length>0,v=A+n+(x?2:0),y=b(v,[[5,10],[2,7],[1,3],[0,0]]);r.push(h("Step-by-Step Content",y,10,`${A} step indicators, ${n} instruction verbs${x?", ordered lists found":""}`));let w=o.match(/[^.!?]*\?/g)||[],f=F(o,_e),T=b(w.length+f,[[10,11],[5,8],[2,5],[1,2],[0,0]]);r.push(h("Q/A Patterns",T,11,`${w.length} questions, ${f} query patterns`));let E=F(o,ze),$=b(E,[[2,9],[1,5]]);return r.push(h("Summary/Conclusion",$,9,E>0?`${E} summary markers`:"No summary markers")),{category:{name:O.answerability,key:"answerability",score:I(r),maxScore:P(r),factors:r},rawData:{answerCapsules:p,questionsFound:w.slice(0,5)}}}function Ze(t){let e=_optionalChain([t, 'call', _2 => _2('meta[property="og:site_name"]'), 'access', _3 => _3.attr, 'call', _4 => _4("content"), 'optionalAccess', _5 => _5.trim, 'call', _6 => _6()]);if(e)return e;let o=t('script[type="application/ld+json"]'),s=null;return o.each((r,n)=>{try{let a=JSON.parse(t(n).html()||"{}");a["@type"]==="Organization"&&a.name&&(s=String(a.name).trim()),_optionalChain([a, 'access', _7 => _7.publisher, 'optionalAccess', _8 => _8.name])&&(s=s||String(a.publisher.name).trim())}catch (e5){}}),s||null}function et(t,e,o){if(!o)return{score:0,surfacesFound:0,surfacesChecked:0};let s=o.toLowerCase(),r=4,n=0;e.toLowerCase().includes(s)&&n++,(t('meta[property="og:title"]').attr("content")||"").toLowerCase().includes(s)&&n++,t("footer").text().toLowerCase().includes(s)&&n++;let c=t('[class*="copyright"], [class*="legal"]').text().toLowerCase(),l=t("header").text().toLowerCase();return(c.includes(s)||l.includes(s))&&n++,{score:n>=4?10:n>=3?7:n>=2?4:n>=1?2:0,surfacesFound:n,surfacesChecked:r}}function tt(t){let e=null,o=null;for(let n of Ye){let a=t(n).first();if(a.length){e=a.attr("datetime")||a.attr("content")||a.text().trim();break}}for(let n of Je){let a=t(n).first();if(a.length){o=a.attr("datetime")||a.attr("content")||a.text().trim();break}}let s=e||o,r=null;if(s){let n=new Date(s);if(!isNaN(n.getTime())){let a=new Date;r=(a.getFullYear()-n.getFullYear())*12+(a.getMonth()-n.getMonth())}}return{publishDate:o,modifiedDate:e,ageInMonths:r,hasModifiedDate:!!e}}var to={Article:["headline","author","datePublished"],NewsArticle:["headline","author","datePublished"],BlogPosting:["headline","author","datePublished"],FAQPage:["mainEntity"],HowTo:["name","step"],Organization:["name","url"],LocalBusiness:["name","address"],Product:["name"],WebPage:["name"]};function ot(t){let e=[];for(let s of t){let r=String(s["@type"]||""),n=to[r];if(!n)continue;let a=n.filter(c=>s[c]!=null),i=n.filter(c=>s[c]==null);e.push({type:r,present:a,missing:i})}let o=e.length>0?e.reduce((s,r)=>s+r.present.length/(r.present.length+r.missing.length),0)/e.length:0;return{totalTypes:e.length,avgCompleteness:o,details:e}}function st(t){let e=t.$,o=[],s={},r=!1,n="";for(let M of Be){let R=e(M).first();if(R.length){r=!0,n=R.text().trim()||R.attr("content")||"Found";break}}o.push(h("Author Attribution",r?10:0,10,r?n:"Not found"));let a=t.html.includes('"@type":"Organization"')||t.html.includes('"@type": "Organization"'),i=e('meta[property="og:site_name"]').attr("content")||"",c=a||i.length>0;o.push(h("Organization Identity",c?10:0,10,c?i||"Schema found":"Not found"));let l=e('a[href*="about"], a[href*="team"], a[href*="company"]').length>0,p=e('a[href*="contact"]').length>0,g=l&&p?10:l||p?5:0;o.push(h("Contact/About Links",g,10,`${l?"About":""}${l&&p?" + ":""}${p?"Contact":""}${!l&&!p?"Not found":""}`));let d=!1,A="";for(let M of Ge){let R=e(M).first();if(R.length){d=!0,A=R.attr("datetime")||R.attr("content")||R.text().trim();break}}o.push(h("Publication Date",d?8:0,8,d?A:"Not found"));let x=tt(t.$),v=0;x.ageInMonths!==null&&(v=b(x.ageInMonths,[[6,12],[12,9],[24,5]],"lower"),x.hasModifiedDate&&v<12&&(v=Math.min(v+2,12))),o.push(h("Content Freshness",v,12,x.ageInMonths!==null?`${x.ageInMonths} months old${x.hasModifiedDate?", modified date present":""}`:"No parseable date found")),s.freshness=x;let y=Ke(t.$),w=y.map(M=>M["@type"]).filter(Boolean),T=["og:title","og:description","og:image","og:type"].filter(M=>e(`meta[property="${M}"]`).length>0),E=e('link[rel="canonical"]').attr("href"),$=0;w.length>0&&($+=4),T.length>=3?$+=4:T.length>0&&($+=2),E&&($+=4),s.structuredDataTypes=w,o.push(h("Structured Data",$,12,`${w.length>0?w.join(", "):"No JSON-LD"}, ${T.length}/4 OG tags${E?", canonical":""}`));let C=ot(y),G=C.totalTypes===0?0:b(C.avgCompleteness,[[.8,10],[.5,7],[.01,4]]);o.push(h("Schema Completeness",G,10,C.totalTypes>0?`${C.totalTypes} schema types, ${Math.round(C.avgCompleteness*100)}% complete`:"No recognized JSON-LD schemas found",C.totalTypes===0?"neutral":void 0)),s.schemaCompleteness=C;let U=Ze(t.$),D=et(t.$,t.title,U);return o.push(h("Entity Consistency",D.score,10,U?`"${U}" found in ${D.surfacesFound}/${D.surfacesChecked} surfaces`:"No identifiable entity name",U?void 0:"neutral")),s.entityConsistency={entityName:U||null,surfacesFound:D.surfacesFound,surfacesChecked:D.surfacesChecked},{category:{name:O.authorityContext,key:"authorityContext",score:I(o),maxScore:P(o),factors:o},rawData:s}}function oo(t){let e=[],o=null;for(let s of t.split(`
2
+ `)){let r=s.split("#")[0].trim();if(!r){o=null;continue}let n=r.indexOf(":");if(n===-1)continue;let a=r.slice(0,n).trim().toLowerCase(),i=r.slice(n+1).trim();a==="user-agent"?(o||(o={agents:[],rules:[]},e.push(o)),o.agents.push(i.toLowerCase())):(a==="disallow"||a==="allow")&&o&&o.rules.push({type:a,path:i})}return e}function so(t,e){let o=[],s=[];for(let r of t)r.agents.includes(e)?o.push(...r.rules):r.agents.includes("*")&&s.push(...r.rules);return{specific:o,wildcard:s}}function ro(t,e){let o=-1,s=!1;for(let r of t){let n=r.path;!n||!e.startsWith(n)||(n.length>o?(o=n.length,s=r.type==="disallow"):n.length===o&&r.type==="allow"&&(s=!1))}return o>=0&&s}function no(t){return t.filter(e=>e.type==="disallow"&&e.path&&e.path!=="/").map(e=>e.path)}function rt(t){if(!t)return{allowed:[],blocked:[],unknown:[...me]};let e=oo(t),o=[],s=[],r=[],n=[];for(let a of me){let i=a.toLowerCase(),{specific:c,wildcard:l}=so(e,i),p=c.length>0?c:l;if(p.length===0){r.push(a);continue}if(ro(p,"/"))s.push(a);else{o.push(a);let d=no(p);for(let A of d){let x=`${a}: ${A}`;n.includes(x)||n.push(x)}}}return{allowed:o,blocked:s,unknown:r,...n.length>0&&{partiallyBlocked:n}}}function nt(t,e,o){let s=[],r={},n=e.statusCode===200?12:e.statusCode<400?8:0;s.push(h("Fetch Success",n,12,`HTTP ${e.statusCode} in ${e.fetchTimeMs}ms`));let a=t.stats.rawByteLength>0?t.stats.cleanTextLength/t.stats.rawByteLength:0,i=b(a,[[.05,.159,12],[.16,1/0,10],[.01,.049,8],[1e-4,.009,2]],"range");s.push(h("Text Extraction Quality",i,12,`${(a*100).toFixed(1)}% content ratio`));let c=t.stats.boilerplateRatio,l=b(1-c,[[.7,12],[.5,9],[.3,6],[.01,2]]);s.push(h("Boilerplate Ratio",l,12,`${(c*100).toFixed(0)}% boilerplate`));let p=t.stats.wordCount,g=b(p,[[300,3e3,12],[3001,1/0,10],[100,299,8],[1,99,2]],"range");if(s.push(h("Word Count Adequacy",g,12,`${p} words`)),o){let w=rt(o.robotsTxt),f=w.blocked.length,T=b(f,[[0,10],[2,6],[4,3]],"lower");s.push(h("AI Crawler Access",T,10,f===0?"All major AI crawlers allowed":`${w.blocked.join(", ")} blocked in robots.txt`)),r.crawlerAccess=w,r.llmsTxt={llmsTxtExists:o.llmsTxtExists,llmsFullTxtExists:o.llmsFullTxtExists};let E=o.llmsTxtExists,$=o.llmsFullTxtExists,C=E&&$?6:E||$?4:0;s.push(h("LLMs.txt Presence",C,6,E&&$?"llms.txt + llms-full.txt found":E?"llms.txt found":$?"llms-full.txt found":"Not found",!E&&!$?"neutral":void 0))}let d=t.stats.imageCount,A=t.stats.imagesWithAlt,x=t.$("figure figcaption").length,v=d>0?A/d:0,y=0;return d>0&&(v>=.9?y+=5:v>=.5?y+=3:y+=1,x>0&&(y+=3)),s.push(h("Image Accessibility",y,8,d>0?`${A}/${d} images have alt text${x>0?`, ${x} figcaptions`:""}`:"No images found",d===0?"neutral":void 0)),r.imageAccessibility={imageCount:d,imagesWithAlt:A,figcaptionCount:x},{category:{name:O.contentExtractability,key:"contentExtractability",score:I(s),maxScore:P(s),factors:s},rawData:r}}function at(t){let e=t.$,o=[],s=t.stats.h1Count,r=t.stats.h2Count,n=t.stats.h3Count,a=0;s===1?a+=4:s>0&&(a+=2),r>=2?a+=4:r>0&&(a+=2),n>0&&(a+=3),o.push(h("Heading Hierarchy",a,11,`${s} H1, ${r} H2, ${n} H3`));let i=t.stats.listItemCount,c=b(i,[[10,11],[5,8],[1,4],[0,0]]);o.push(h("Lists Presence",c,11,`${i} list items`));let l=t.stats.tableCount,p=b(l,[[2,8],[1,5]]);o.push(h("Tables Presence",p,8,`${l} table(s)`,l===0?"neutral":void 0));let g=t.stats.paragraphCount,d=g>0?Math.round(t.stats.wordCount/g):0,A=b(d,[[30,150,11],[1,199,7],[200,1/0,2]],"range");o.push(h("Paragraph Structure",A,11,`${g} paragraphs, avg ${d} words`));let x=e("strong, b").length>0,v=g>0?t.stats.headingCount/g:0,y=0;x&&(y+=4),d<=150&&(y+=4),v>=.1&&(y+=3),o.push(h("Scannability",y,11,`${x?"Bold text found":"No bold text"}, ${v.toFixed(2)} heading ratio`));let w=Qe(t.$),f=w.sectionCount===0?0:b(w.avgWordsPerSection,[[120,180,12],[80,250,8],[1,1/0,4]],"range");return o.push(h("Section Length",f,12,w.sectionCount>0?`${w.sectionCount} sections, avg ${w.avgWordsPerSection} words`:"No headed sections found",w.sectionCount===0?"neutral":void 0)),{category:{name:O.contentStructure,key:"contentStructure",score:I(o),maxScore:P(o),factors:o},rawData:{sectionLengths:w}}}function it(t,e){let o=t.cleanText,s=[],r=_nullishCoalesce(e, () => (j(o))),n=r.people.length+r.organizations.length+r.places.length+r.topics.length,a=b(n,[[9,20],[4,14],[1,7],[0,0]]);s.push(h("Entity Richness",a,20,`${n} entities (${r.people.length} people, ${r.organizations.length} orgs, ${r.places.length} places)`,n===0?"neutral":void 0));let i=t.title.toLowerCase().split(/\s+/).filter(f=>f.length>3),l=t.$("h1").first().text().toLowerCase().split(/\s+/).filter(f=>f.length>3),p=[...new Set([...i,...l])],g=r.topics.map(f=>f.toLowerCase()),d=0;for(let f of p)(g.some(T=>T.includes(f))||o.toLowerCase().split(f).length>3)&&d++;let A=p.length>0?d/p.length:0,x=p.length===0?0:b(A,[[.5,25],[.01,15]]);s.push(h("Topic Consistency",x,25,`${d}/${p.length} title keywords align with content topics`,p.length===0?"neutral":void 0));let v=q(o),y=v>0?n/v*100:0,w=b(y,[[2,8,15],[1,1/0,10],[.01,.99,3]],"range");return s.push(h("Entity Density",w,15,`${y.toFixed(1)} entities per 100 words`)),{category:{name:O.entityClarity,key:"entityClarity",score:I(s),maxScore:P(s),factors:s},rawData:{entities:r}}}function ct(t,e){let o=t.$,s=t.cleanText,r=[],{numberCount:n=0}=_nullishCoalesce(e, () => (j(s))),a=t.externalLinks,i=b(a.length,[[6,13],[3,10],[1,6],[0,0]]);r.push(h("External References",i,13,`${a.length} external links`));let c=F(s,Me),l=o("blockquote, cite, q").length,p=c+l,g=b(p,[[6,13],[3,9],[1,5],[0,0]]);r.push(h("Citation Patterns",g,13,`${c} citation indicators, ${l} quote elements`));let d=F(s,Ue),A=d+n,x=b(A,[[9,13],[4,9],[1,5],[0,0]]);r.push(h("Numeric Claims",x,13,`${d} statistical references, ${n} numeric values`));let v=F(s,Fe),y=b(v,[[5,11],[2,8],[1,4],[0,0]]);r.push(h("Attribution Indicators",y,11,`${v} attribution patterns`));let w=F(s,qe),f=o("blockquote").filter(($,C)=>o(C).find("cite, footer, figcaption").length>0).length,T=w+f,E=b(T,[[4,10],[2,7],[1,4],[0,0]]);return r.push(h("Quoted Attribution",E,10,`${T} attributed quotes`,T===0?"neutral":void 0)),{category:{name:O.groundingSignals,key:"groundingSignals",score:I(r),maxScore:P(r),factors:r},rawData:{externalLinks:a.slice(0,10)}}}function lt(t){let e=t.cleanText,o=[],s=ue(e),r=b(s,[[12,22,15],[8,29,10],[1,1/0,5]],"range");o.push(h("Sentence Length",r,15,`Avg ${s} words/sentence`));let n=le(e),a=b(n,[[60,70,15],[71,1/0,13],[50,59,10],[30,49,6]],"range");o.push(h("Readability",a,15,`Flesch Reading Ease: ${n.toFixed(1)}`));let i=q(e),c=pe(e),l=i>0?c/i:0,p=b(l,[[.02,15],[.05,12],[.1,8]],"lower");o.push(h("Jargon Density",p,15,`${(l*100).toFixed(1)}% complex words`));let g=ie(e,He),d=b(g,[[10,15],[5,11],[2,7],[1,3],[0,0]]);return o.push(h("Transition Usage",d,15,`${g} transition types found`)),{category:{name:O.readabilityForCompression,key:"readabilityForCompression",score:I(o),maxScore:P(o),factors:o},rawData:{avgSentenceLength:s,readabilityScore:n}}}function pt(t,e,o){let s=j(t.cleanText),r=nt(t,e,o),n=at(t),a=Xe(t,s),i=it(t,s),c=ct(t,s),l=st(t),p=lt(t);return{categories:{contentExtractability:r.category,contentStructure:n.category,answerability:a.category,entityClarity:i.category,groundingSignals:c.category,authorityContext:l.category,readabilityForCompression:p.category},rawData:{title:t.title,metaDescription:t.metaDescription,wordCount:t.stats.wordCount,...r.rawData,...n.rawData,...a.rawData,...i.rawData,...c.rawData,...l.rawData,...p.rawData}}}var _cheerio = require('cheerio'); var K = _interopRequireWildcard(_cheerio);var ao=["script","style","noscript","svg","iframe","nav","header","footer","aside",'[role="navigation"]','[role="banner"]','[role="contentinfo"]',".sidebar","#sidebar",".cookie-banner","#cookie-consent",".cookie-notice",".nav",".navbar",".footer",".header",".menu",".ad",".ads",".advertisement",'[class*="cookie"]','[class*="consent"]','[class*="popup"]','[class*="modal"]'];function ut(t){for(let e of ao)t(e).remove()}function io(t){return t.replace(/\s+/g," ").trim()}var co="p,div,td,th,li,h1,h2,h3,h4,h5,h6,dt,dd,br,blockquote,section,article";function dt(t){return t(co).each((e,o)=>{t(o).append(" ")}),io(t("body").text())}function mt(t,e){let o=K.load(t),s=o("title").text().trim()||_optionalChain([o, 'call', _9 => _9('meta[property="og:title"]'), 'access', _10 => _10.attr, 'call', _11 => _11("content"), 'optionalAccess', _12 => _12.trim, 'call', _13 => _13()])||"",r=_optionalChain([o, 'call', _14 => _14('meta[name="description"]'), 'access', _15 => _15.attr, 'call', _16 => _16("content"), 'optionalAccess', _17 => _17.trim, 'call', _18 => _18()])||_optionalChain([o, 'call', _19 => _19('meta[property="og:description"]'), 'access', _20 => _20.attr, 'call', _21 => _21("content"), 'optionalAccess', _22 => _22.trim, 'call', _23 => _23()])||"",n=K.load(t);n("script, style, noscript").remove();let a=n("body").text().replace(/\s+/g," ").trim(),i=Buffer.byteLength(t,"utf-8"),c=o("h1").length,l=o("h2").length,p=o("h3").length,g=c+l+p+o("h4, h5, h6").length,d=o("a[href]").length,A=o("img").length,x=o("ul, ol").length,v=o("li").length,y=o("table").length,w=o("p").length,f=new Set(["image","photo","logo","icon","picture","img","graphic","thumbnail"]),T=0;o("img").each((V,H)=>{let W=_nullishCoalesce(_optionalChain([o, 'call', _24 => _24(H), 'access', _25 => _25.attr, 'call', _26 => _26("alt"), 'optionalAccess', _27 => _27.trim, 'call', _28 => _28()]), () => (""));W.split(/\s+/).filter(Vt=>Vt.length>0).length>1&&W.length<200&&!f.has(W.toLowerCase())&&T++});let E=se(e),$=[];o('a[href^="http"]').each((V,H)=>{let W=o(H).attr("href");try{se(W)!==E&&$.push({url:W,text:o(H).text().trim().substring(0,50)})}catch (e6){}});let C=$.length,G=K.load(t);ut(G);let U=dt(G),D=U.length,M=a.length>0?Math.max(0,Math.min(1,1-D/a.length)):0,R={wordCount:q(U),sentenceCount:Oe(U),paragraphCount:w,headingCount:g,h1Count:c,h2Count:l,h3Count:p,linkCount:d,externalLinkCount:C,imageCount:A,imagesWithAlt:T,listCount:x,listItemCount:v,tableCount:y,boilerplateRatio:M,rawByteLength:i,cleanTextLength:D};return{url:e,html:t,cleanText:U,title:s,metaDescription:r,stats:R,$:o,externalLinks:$}}var _zod = require('zod');var ht=_zod.z.object({url:_zod.z.url(),timeout:_zod.z.number().positive().default(45e3),userAgent:_zod.z.string().default(`AISEOAudit/${_}`)}),qr=_zod.z.object({url:_zod.z.string(),finalUrl:_zod.z.string(),statusCode:_zod.z.number(),contentType:_zod.z.string(),html:_zod.z.string(),byteLength:_zod.z.number(),fetchTimeMs:_zod.z.number(),redirected:_zod.z.boolean()});async function X(t){let e=ht.parse(t),o=Date.now(),s=await B({url:e.url,timeout:e.timeout,userAgent:e.userAgent}),r=Date.now()-o,n=s.data,a=s.finalUrl||e.url,i=s.headers["content-type"]||"unknown";return{url:e.url,finalUrl:a,statusCode:s.status,contentType:i,html:n,byteLength:Buffer.byteLength(n,"utf-8"),fetchTimeMs:r,redirected:a!==e.url}}var gt=`<!-- Before: prose enumeration -->
3
3
  <p>We offer design, development, and strategy services.</p>
4
4
 
5
5
  <!-- After: unordered list -->
@@ -260,7 +260,7 @@ ${t.questionsFound.slice(0,3).map(l=>` {
260
260
  {
261
261
  ${a.join(`,
262
262
  `)}
263
- }`;return{text:`Your ${s.join("; ")}. Adding these properties helps AI engines attribute and trust your content.`,steps:o.map(c=>`Add ${c.missing.join(", ")} to your ${c.type} schema`),codeExample:i,learnMoreUrl:`https://schema.org/${r.type}`}},"Entity Consistency":t=>{let e=t.entityConsistency;return!e||!e.entityName?{text:"Add a consistent brand or organization name across your page title, OG tags, JSON-LD schema, and footer. Consistent entity signals help AI engines confidently attribute content to your brand."}:{text:`"${e.entityName}" was found on ${e.surfacesFound} of ${e.surfacesChecked} page surfaces. Ensure it appears consistently in the page title, OG tags, schema, and footer for strong brand attribution.`}},"Sentence Length":t=>{let e=t.avgSentenceLength;if(e===void 0)return{text:"Aim for an average sentence length of 12-22 words for optimal readability and compressibility."};let o=Math.round(e);return o>22?{text:`Your average sentence is ${o} words. The ideal range for AI compression is 12-22 words. Break long sentences into shorter, more direct statements.`}:o<12?{text:`Your average sentence is ${o} words. While short sentences are readable, combining some into 12-22 word sentences provides better context for AI summarization.`}:{text:`Your average sentence length is ${o} words. Fine-tune toward the 12-22 word sweet spot for optimal AI compression.`}},Readability:t=>{let e=t.readabilityScore;if(e===void 0)return{text:"Simplify language where possible. A Flesch Reading Ease score of 60-70 is ideal for broad AI reusability."};let o=Math.round(e);return o<30?{text:`Your Flesch Reading Ease score is ${o} (very difficult). A score of 60-70 is ideal. Shorten sentences, use simpler vocabulary, and break up complex ideas.`}:o<50?{text:`Your Flesch Reading Ease score is ${o} (difficult). A score of 60-70 is ideal for broad AI reusability. Simplify where possible without losing meaning.`}:o<60?{text:`Your Flesch Reading Ease score is ${o} (fairly difficult). You're close to the ideal 60-70 range. Minor simplification would improve AI compressibility.`}:{text:`Your Flesch Reading Ease score is ${o}. A score of 60-70 is ideal for broad AI reusability.`}},"Jargon Density":()=>({text:"Define technical terms or replace with simpler alternatives. High jargon density reduces AI reusability.",steps:["List the 5 most domain-specific terms on the page","For each term: either add a plain-English definition on first use, or replace with simpler language","Use the 'is defined as' or 'also known as' pattern for terms you must keep","Aim for a Flesch Reading Ease score of 60 to 70 by simplifying sentence structure"],codeExample:At}),"Transition Usage":()=>({text:"Use transition words (however, therefore, additionally) to improve content flow and logical structure.",steps:["Add contrast transitions between opposing ideas: 'however', 'although', 'on the other hand'","Add sequence transitions between steps or points: 'first', 'next', 'finally'","Add addition transitions to build on a point: 'additionally', 'furthermore', 'in addition'","Add conclusion transitions at the end of sections: 'therefore', 'as a result', 'in summary'"],codeExample:vt})};function Ct(t){let e=[];for(let s of Object.values(t.categories))for(let r of s.factors){let n=r.maxScore>0?r.score/r.maxScore:1;if(n>=.7)continue;let a=n<.3?"high":n<.5?"medium":"low",i=Et[r.name],c=i?i(t.rawData):{text:`Review and improve "${r.name}" based on best practices for AI search readiness.`};e.push({category:s.name,factor:r.name,currentValue:r.value,priority:a,recommendation:c.text,...c.steps&&{steps:c.steps},...c.codeExample&&{codeExample:c.codeExample},...c.learnMoreUrl&&{learnMoreUrl:c.learnMoreUrl}})}let o={high:0,medium:1,low:2};return e.sort((s,r)=>{let n=o[s.priority]-o[r.priority];return n!==0?n:s.factor.localeCompare(r.factor)}),e}async function ge(t,e,o){let s=Math.min(e,5e3),[r,n,a]=await Promise.allSettled([H({url:`${t}/robots.txt`,timeout:s,userAgent:o}),oe({url:`${t}/llms.txt`,timeout:s,userAgent:o}),oe({url:`${t}/llms-full.txt`,timeout:s,userAgent:o})]);return{signalsBase:t,robotsTxt:r.status==="fulfilled"&&r.value.status===200?r.value.data:null,llmsTxtExists:n.status==="fulfilled"&&n.value.status===200,llmsFullTxtExists:a.status==="fulfilled"&&a.value.status===200}}function Rt(t,e,o,s){let r=mt(e.html,t),n=pt(r,e,o),a=Le(n.categories,s.weights),i=Ct(n);return{url:t,signalsBase:o.signalsBase,analyzedAt:new Date().toISOString(),overallScore:a.overallScore,grade:a.grade,totalPoints:a.totalPoints,maxPoints:a.maxPoints,categories:n.categories,recommendations:i,rawData:n.rawData,meta:{version:_}}}async function It(t,e,o,s){let r=Date.now(),n=Rt(t,e,o,s);return{...n,meta:{...n.meta,analysisDurationMs:Date.now()-r}}}async function gn(t,e){let o=Date.now(),s=J(t.url),r=_nullishCoalesce(t.timeout, () => (e.timeout)),n=_nullishCoalesce(t.userAgent, () => (e.userAgent)),a=await X({url:s,timeout:r,userAgent:n}),i=_nullishCoalesce(_nullishCoalesce(t.signalsBase, () => (a.finalUrl)), () => (s)),c=await ge(i,r,n),l=Rt(s,a,c,e);return{...l,meta:{...l.meta,analysisDurationMs:Date.now()-o}}}var _promises = require('fs/promises');async function Ot(t){try{return await _promises.access.call(void 0, t),!0}catch (e7){return!1}}async function bn(t,e){await _promises.writeFile.call(void 0, t,e,"utf-8")}var _path = require('path');var Pt=["aiseo.config.json",".aiseo.config.json","aiseo-audit.config.json"];var kt=`AISEOAudit/${_}`,Lt={contentExtractability:1,contentStructure:1,answerability:1,entityClarity:1,groundingSignals:1,authorityContext:1,readabilityForCompression:1},uo=_zod.z.object({contentExtractability:_zod.z.number().min(0).default(1),contentStructure:_zod.z.number().min(0).default(1),answerability:_zod.z.number().min(0).default(1),entityClarity:_zod.z.number().min(0).default(1),groundingSignals:_zod.z.number().min(0).default(1),authorityContext:_zod.z.number().min(0).default(1),readabilityForCompression:_zod.z.number().min(0).default(1)}).default(Lt),Z=_zod.z.object({timeout:_zod.z.number().positive().default(45e3),userAgent:_zod.z.string().default(kt),format:_zod.z.enum(["pretty","json","md","html"]).default("pretty"),failUnder:_zod.z.number().min(0).max(100).optional(),weights:uo}).default({timeout:45e3,userAgent:kt,format:"pretty",weights:Lt});async function go(t){let e=_path.resolve.call(void 0, t);for(;;){for(let s of Pt){let r=_path.join.call(void 0, e,s);if(await Ot(r))return r}let o=_path.dirname.call(void 0, e);if(o===e)return null;e=o}}async function Ln(t){if(t){let o=_path.resolve.call(void 0, t),s=await _promises.readFile.call(void 0, o,"utf-8");try{return Z.parse(JSON.parse(s))}catch(r){throw new Error(`Invalid config file "${o}": ${r instanceof Error?r.message:String(r)}`)}}let e=await go(process.cwd());if(e){let o=await _promises.readFile.call(void 0, e,"utf-8");try{return Z.parse(JSON.parse(o))}catch(s){throw new Error(`Invalid config file "${e}": ${s instanceof Error?s.message:String(s)}`)}}return Z.parse({})}function ee(t){return t>=90?"#00cc66":t>=50?"#ffaa33":"#ff3333"}function fe(t){return t>=90?"#008800":t>=50?"#ffaa33":"#cc0000"}function ye(t){return t>=90?"pass":t>=50?"average":"fail"}function fo(t){return t==="good"?"&#10003;":t==="neutral"?"&#8212;":t==="needs_improvement"?"&#9650;":"&#10007;"}function yo(t){return t==="good"?"good":t==="neutral"?"neutral":t==="needs_improvement"?"warn":"fail"}function S(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Ft(){return`:root {
263
+ }`;return{text:`Your ${s.join("; ")}. Adding these properties helps AI engines attribute and trust your content.`,steps:o.map(c=>`Add ${c.missing.join(", ")} to your ${c.type} schema`),codeExample:i,learnMoreUrl:`https://schema.org/${r.type}`}},"Entity Consistency":t=>{let e=t.entityConsistency;return!e||!e.entityName?{text:"Add a consistent brand or organization name across your page title, OG tags, JSON-LD schema, and footer. Consistent entity signals help AI engines confidently attribute content to your brand."}:{text:`"${e.entityName}" was found on ${e.surfacesFound} of ${e.surfacesChecked} page surfaces. Ensure it appears consistently in the page title, OG tags, schema, and footer for strong brand attribution.`}},"Sentence Length":t=>{let e=t.avgSentenceLength;if(e===void 0)return{text:"Aim for an average sentence length of 12-22 words for optimal readability and compressibility."};let o=Math.round(e);return o>22?{text:`Your average sentence is ${o} words. The ideal range for AI compression is 12-22 words. Break long sentences into shorter, more direct statements.`}:o<12?{text:`Your average sentence is ${o} words. While short sentences are readable, combining some into 12-22 word sentences provides better context for AI summarization.`}:{text:`Your average sentence length is ${o} words. Fine-tune toward the 12-22 word sweet spot for optimal AI compression.`}},Readability:t=>{let e=t.readabilityScore;if(e===void 0)return{text:"Simplify language where possible. A Flesch Reading Ease score of 60-70 is ideal for broad AI reusability."};let o=Math.round(e);return o<30?{text:`Your Flesch Reading Ease score is ${o} (very difficult). A score of 60-70 is ideal. Shorten sentences, use simpler vocabulary, and break up complex ideas.`}:o<50?{text:`Your Flesch Reading Ease score is ${o} (difficult). A score of 60-70 is ideal for broad AI reusability. Simplify where possible without losing meaning.`}:o<60?{text:`Your Flesch Reading Ease score is ${o} (fairly difficult). You're close to the ideal 60-70 range. Minor simplification would improve AI compressibility.`}:{text:`Your Flesch Reading Ease score is ${o}. A score of 60-70 is ideal for broad AI reusability.`}},"Jargon Density":()=>({text:"Define technical terms or replace with simpler alternatives. High jargon density reduces AI reusability.",steps:["List the 5 most domain-specific terms on the page","For each term: either add a plain-English definition on first use, or replace with simpler language","Use the 'is defined as' or 'also known as' pattern for terms you must keep","Aim for a Flesch Reading Ease score of 60 to 70 by simplifying sentence structure"],codeExample:At}),"Transition Usage":()=>({text:"Use transition words (however, therefore, additionally) to improve content flow and logical structure.",steps:["Add contrast transitions between opposing ideas: 'however', 'although', 'on the other hand'","Add sequence transitions between steps or points: 'first', 'next', 'finally'","Add addition transitions to build on a point: 'additionally', 'furthermore', 'in addition'","Add conclusion transitions at the end of sections: 'therefore', 'as a result', 'in summary'"],codeExample:vt})};function Ct(t){let e=[];for(let s of Object.values(t.categories))for(let r of s.factors){let n=r.maxScore>0?r.score/r.maxScore:1;if(n>=.7)continue;let a=n<.3?"high":n<.5?"medium":"low",i=Et[r.name],c=i?i(t.rawData):{text:`Review and improve "${r.name}" based on best practices for AI search readiness.`};e.push({category:s.name,factor:r.name,currentValue:r.value,priority:a,recommendation:c.text,...c.steps&&{steps:c.steps},...c.codeExample&&{codeExample:c.codeExample},...c.learnMoreUrl&&{learnMoreUrl:c.learnMoreUrl}})}let o={high:0,medium:1,low:2};return e.sort((s,r)=>{let n=o[s.priority]-o[r.priority];return n!==0?n:s.factor.localeCompare(r.factor)}),e}function Rt(t){return t.status!=="fulfilled"||t.value.status!==200?!1:!(_nullishCoalesce(t.value.headers["content-type"], () => (""))).includes("text/html")}async function ge(t,e,o){let s=Math.min(e,5e3),[r,n,a]=await Promise.allSettled([B({url:`${t}/robots.txt`,timeout:s,userAgent:o}),oe({url:`${t}/llms.txt`,timeout:s,userAgent:o}),oe({url:`${t}/llms-full.txt`,timeout:s,userAgent:o})]);return{signalsBase:t,robotsTxt:r.status==="fulfilled"&&r.value.status===200?r.value.data:null,llmsTxtExists:Rt(n),llmsFullTxtExists:Rt(a)}}function It(t,e,o,s){let r=mt(e.html,t),n=pt(r,e,o),a=Le(n.categories,s.weights),i=Ct(n);return{url:t,signalsBase:o.signalsBase,analyzedAt:new Date().toISOString(),overallScore:a.overallScore,grade:a.grade,totalPoints:a.totalPoints,maxPoints:a.maxPoints,categories:n.categories,recommendations:i,rawData:n.rawData,meta:{version:_}}}async function Pt(t,e,o,s){let r=Date.now(),n=It(t,e,o,s);return{...n,meta:{...n.meta,analysisDurationMs:Date.now()-r}}}async function fn(t,e){let o=Date.now(),s=J(t.url),r=_nullishCoalesce(t.timeout, () => (e.timeout)),n=_nullishCoalesce(t.userAgent, () => (e.userAgent)),a=await X({url:s,timeout:r,userAgent:n}),i=_nullishCoalesce(_nullishCoalesce(t.signalsBase, () => (a.finalUrl)), () => (s)),c=await ge(i,r,n),l=It(s,a,c,e);return{...l,meta:{...l.meta,analysisDurationMs:Date.now()-o}}}var _promises = require('fs/promises');async function Ot(t){try{return await _promises.access.call(void 0, t),!0}catch (e7){return!1}}async function wn(t,e){await _promises.writeFile.call(void 0, t,e,"utf-8")}var _path = require('path');var kt=["aiseo.config.json",".aiseo.config.json","aiseo-audit.config.json"];var Lt=`AISEOAudit/${_}`,Dt={contentExtractability:1,contentStructure:1,answerability:1,entityClarity:1,groundingSignals:1,authorityContext:1,readabilityForCompression:1},mo=_zod.z.object({contentExtractability:_zod.z.number().min(0).default(1),contentStructure:_zod.z.number().min(0).default(1),answerability:_zod.z.number().min(0).default(1),entityClarity:_zod.z.number().min(0).default(1),groundingSignals:_zod.z.number().min(0).default(1),authorityContext:_zod.z.number().min(0).default(1),readabilityForCompression:_zod.z.number().min(0).default(1)}).default(Dt),Z=_zod.z.object({timeout:_zod.z.number().positive().default(45e3),userAgent:_zod.z.string().default(Lt),format:_zod.z.enum(["pretty","json","md","html"]).default("pretty"),failUnder:_zod.z.number().min(0).max(100).optional(),weights:mo}).default({timeout:45e3,userAgent:Lt,format:"pretty",weights:Dt});async function fo(t){let e=_path.resolve.call(void 0, t);for(;;){for(let s of kt){let r=_path.join.call(void 0, e,s);if(await Ot(r))return r}let o=_path.dirname.call(void 0, e);if(o===e)return null;e=o}}async function Dn(t){if(t){let o=_path.resolve.call(void 0, t),s=await _promises.readFile.call(void 0, o,"utf-8");try{return Z.parse(JSON.parse(s))}catch(r){throw new Error(`Invalid config file "${o}": ${r instanceof Error?r.message:String(r)}`)}}let e=await fo(process.cwd());if(e){let o=await _promises.readFile.call(void 0, e,"utf-8");try{return Z.parse(JSON.parse(o))}catch(s){throw new Error(`Invalid config file "${e}": ${s instanceof Error?s.message:String(s)}`)}}return Z.parse({})}function ee(t){return t>=90?"#00cc66":t>=50?"#ffaa33":"#ff3333"}function fe(t){return t>=90?"#008800":t>=50?"#ffaa33":"#cc0000"}function ye(t){return t>=90?"pass":t>=50?"average":"fail"}function yo(t){return t==="good"?"&#10003;":t==="neutral"?"&#8212;":t==="needs_improvement"?"&#9650;":"&#10007;"}function xo(t){return t==="good"?"good":t==="neutral"?"neutral":t==="needs_improvement"?"warn":"fail"}function S(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Ut(){return`:root {
264
264
  --pass: #00cc66;
265
265
  --pass-text: #008800;
266
266
  --average: #ffaa33;
@@ -283,20 +283,20 @@ body { font-family: var(--font); background: var(--bg); color: var(--text); line
283
283
  .footer { padding: 16px 0; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-secondary); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
284
284
  .pass { color: var(--pass-text); }
285
285
  .average { color: var(--average-text); }
286
- .fail { color: var(--fail-text); }`}function xo(t){let e=Math.max(0,Math.min(100,t)),o=ee(e),s=fe(e),r=56,n=2*Math.PI*r,a=n*(1-e/100),i=64,c=22,l=7;return`<svg class="gauge" viewBox="0 0 120 120" width="${i}" height="${i}">
286
+ .fail { color: var(--fail-text); }`}function bo(t){let e=Math.max(0,Math.min(100,t)),o=ee(e),s=fe(e),r=56,n=2*Math.PI*r,a=n*(1-e/100),i=64,c=22,l=7;return`<svg class="gauge" viewBox="0 0 120 120" width="${i}" height="${i}">
287
287
  <circle cx="60" cy="60" r="${r}" fill="none" stroke="#e0e0e0" stroke-width="${l}"/>
288
288
  <circle cx="60" cy="60" r="${r}" fill="none" stroke="${o}" stroke-width="${l}"
289
289
  stroke-dasharray="${n}" stroke-dashoffset="${a}"
290
290
  stroke-linecap="round" transform="rotate(-90 60 60)"/>
291
291
  <text x="60" y="${60+c*.35}" text-anchor="middle" font-size="${c}" font-weight="700" fill="${s}">${t}</text>
292
- </svg>`}function bo(t,e,o,s,r){let g=2*Math.PI*80,d=fe(t),A='<circle cx="95" cy="95" r="80" fill="none" stroke="#e8e8e8" stroke-width="14"/>',x=[],v=0,y=0;for(let f of r){let T=s>0?f.score/s*360:0;if(T<.1){v+=T;continue}let E=f.maxScore>0?Math.round(f.score/f.maxScore*100):0,$=ee(E),C=T/360*g,G=g*.25-v/360*g,U=S(f.name),D=y;x.push(`<circle cx="95" cy="95" r="80" fill="none"
292
+ </svg>`}function wo(t,e,o,s,r){let g=2*Math.PI*80,d=fe(t),A='<circle cx="95" cy="95" r="80" fill="none" stroke="#e8e8e8" stroke-width="14"/>',x=[],v=0,y=0;for(let f of r){let T=s>0?f.score/s*360:0;if(T<.1){v+=T;continue}let E=f.maxScore>0?Math.round(f.score/f.maxScore*100):0,$=ee(E),C=T/360*g,G=g*.25-v/360*g,U=S(f.name),D=y;x.push(`<circle cx="95" cy="95" r="80" fill="none"
293
293
  stroke="${$}" stroke-width="14"
294
294
  stroke-dasharray="${C.toFixed(2)} ${(g-C).toFixed(2)}"
295
295
  stroke-dashoffset="${G.toFixed(2)}"
296
296
  class="seg-arc" data-idx="${D}"
297
297
  onmouseenter="document.getElementById('seg-pop-${D}').style.display='flex'"
298
- onmouseleave="document.getElementById('seg-pop-${D}').style.display='none'"/>`),v+=T;let M=v/360*2*Math.PI-Math.PI/2,R=14/2+1,V=Math.cos(M),B=Math.sin(M);x.push(`<line x1="${(95+(80-R)*V).toFixed(2)}" y1="${(95+(80-R)*B).toFixed(2)}"
299
- x2="${(95+(80+R)*V).toFixed(2)}" y2="${(95+(80+R)*B).toFixed(2)}"
298
+ onmouseleave="document.getElementById('seg-pop-${D}').style.display='none'"/>`),v+=T;let M=v/360*2*Math.PI-Math.PI/2,R=14/2+1,V=Math.cos(M),H=Math.sin(M);x.push(`<line x1="${(95+(80-R)*V).toFixed(2)}" y1="${(95+(80-R)*H).toFixed(2)}"
299
+ x2="${(95+(80+R)*V).toFixed(2)}" y2="${(95+(80+R)*H).toFixed(2)}"
300
300
  stroke="#fff" stroke-width="2" pointer-events="none"/>`),y++}let w=r.filter(f=>f.score>0).map((f,T)=>{let E=f.maxScore>0?Math.round(f.score/f.maxScore*100):0,$=ee(E);return`<div id="seg-pop-${T}" class="seg-popover">
301
301
  <span class="seg-popover-dot" style="background:${$}"></span>
302
302
  <span class="seg-popover-name">${S(f.name)}</span>
@@ -317,12 +317,12 @@ body { font-family: var(--font); background: var(--bg); color: var(--text); line
317
317
  <span class="scale-average">50-89</span>
318
318
  <span class="scale-pass">90-100</span>
319
319
  </div>
320
- </div>`}function wo(t){let e=t.maxScore>0?Math.round(t.score/t.maxScore*100):0;return`<a class="gauge-item" href="#cat-${S(t.name.replace(/\s+/g,"-").toLowerCase())}">
321
- ${xo(e)}
320
+ </div>`}function So(t){let e=t.maxScore>0?Math.round(t.score/t.maxScore*100):0;return`<a class="gauge-item" href="#cat-${S(t.name.replace(/\s+/g,"-").toLowerCase())}">
321
+ ${bo(e)}
322
322
  <span class="gauge-label">${S(t.name)}</span>
323
- </a>`}function So(t){let e=t.maxScore>0?Math.round(t.score/t.maxScore*100):0,o=ye(e),s=t.name.replace(/\s+/g,"-").toLowerCase(),r=t.factors.map(n=>`
323
+ </a>`}function vo(t){let e=t.maxScore>0?Math.round(t.score/t.maxScore*100):0,o=ye(e),s=t.name.replace(/\s+/g,"-").toLowerCase(),r=t.factors.map(n=>`
324
324
  <div class="audit-row">
325
- <span class="audit-icon ${yo(n.status)}">${fo(n.status)}</span>
325
+ <span class="audit-icon ${xo(n.status)}">${yo(n.status)}</span>
326
326
  <span class="audit-name">${S(n.name)}</span>
327
327
  <span class="audit-detail">${S(n.value)}</span>
328
328
  <span class="audit-score">${n.score}/${n.maxScore}</span>
@@ -333,21 +333,21 @@ body { font-family: var(--font); background: var(--bg); color: var(--text); line
333
333
  <div class="category-score ${o}">${e}%</div>
334
334
  </div>
335
335
  <div class="audits">${r}</div>
336
- </div>`}function vo(t){let e=t.priority==="high"?"priority-high":t.priority==="medium"?"priority-med":"priority-low",o=t.priority==="high"?"HIGH":t.priority==="medium"?"MED":"LOW",s="";if(t.steps||t.codeExample||t.learnMoreUrl){let r="";if(t.steps&&t.steps.length>0){let n=t.steps.map(a=>`<li>${S(a)}</li>`).join("");r+=`<ol class="rec-steps">${n}</ol>`}t.codeExample&&(r+=`<pre class="rec-code"><code>${S(t.codeExample)}</code></pre>`),t.learnMoreUrl&&(r+=`<a class="rec-learn-more" href="${S(t.learnMoreUrl)}" target="_blank" rel="noopener">Learn more &rarr;</a>`),s=`<div class="rec-detail">${r}</div>`}return`
336
+ </div>`}function Ao(t){let e=t.priority==="high"?"priority-high":t.priority==="medium"?"priority-med":"priority-low",o=t.priority==="high"?"HIGH":t.priority==="medium"?"MED":"LOW",s="";if(t.steps||t.codeExample||t.learnMoreUrl){let r="";if(t.steps&&t.steps.length>0){let n=t.steps.map(a=>`<li>${S(a)}</li>`).join("");r+=`<ol class="rec-steps">${n}</ol>`}t.codeExample&&(r+=`<pre class="rec-code"><code>${S(t.codeExample)}</code></pre>`),t.learnMoreUrl&&(r+=`<a class="rec-learn-more" href="${S(t.learnMoreUrl)}" target="_blank" rel="noopener">Learn more &rarr;</a>`),s=`<div class="rec-detail">${r}</div>`}return`
337
337
  <div class="rec-row ${e}">
338
338
  <span class="rec-tag">${o}</span>
339
339
  <span class="rec-factor">${S(t.factor)}</span>
340
340
  <span class="rec-text">${S(t.recommendation)}</span>
341
- </div>${s}`}function Ao(t,e){let o=Object.values(e).map(n=>n.name),s=new Map;for(let n of o){let a=t.filter(i=>i.category===n);a.length>0&&s.set(n,a)}if(s.size===0)return"";let r=`<div class="recs-section">
341
+ </div>${s}`}function To(t,e){let o=Object.values(e).map(n=>n.name),s=new Map;for(let n of o){let a=t.filter(i=>i.category===n);a.length>0&&s.set(n,a)}if(s.size===0)return"";let r=`<div class="recs-section">
342
342
  <div class="recs-title">Recommendations</div>`;for(let[n,a]of s)r+=`<div class="rec-group">
343
- <div class="rec-group-name">${S(n)}</div>`,r+=a.map(vo).join(""),r+="</div>";return r+="</div>",r}function Ut(t){let e=Object.entries(t.categories),o=e.map(([,c])=>c),s=e.map(([c,l])=>({key:c,name:l.name,score:l.score,maxScore:l.maxScore})),r=o.map(wo).join(""),n=o.map(So).join(""),a=Ao(t.recommendations,t.categories),i=bo(t.overallScore,t.grade,t.totalPoints,t.maxPoints,s);return`<!DOCTYPE html>
343
+ <div class="rec-group-name">${S(n)}</div>`,r+=a.map(Ao).join(""),r+="</div>";return r+="</div>",r}function Nt(t){let e=Object.entries(t.categories),o=e.map(([,c])=>c),s=e.map(([c,l])=>({key:c,name:l.name,score:l.score,maxScore:l.maxScore})),r=o.map(So).join(""),n=o.map(vo).join(""),a=To(t.recommendations,t.categories),i=wo(t.overallScore,t.grade,t.totalPoints,t.maxPoints,s);return`<!DOCTYPE html>
344
344
  <html lang="en">
345
345
  <head>
346
346
  <meta charset="utf-8">
347
347
  <meta name="viewport" content="width=device-width, initial-scale=1">
348
348
  <title>AI SEO Audit - ${S(t.url)}</title>
349
349
  <style>
350
- ${Ft()}
350
+ ${Ut()}
351
351
  .gauges-row {
352
352
  display: flex;
353
353
  flex-wrap: wrap;
@@ -637,7 +637,7 @@ ${Ft()}
637
637
  </div>
638
638
 
639
639
  </body>
640
- </html>`}function To(t,e){if(t.status==="failed")return`
640
+ </html>`}function $o(t,e){if(t.status==="failed")return`
641
641
  <div class="sitemap-url-section failed">
642
642
  <div class="sitemap-url-header">
643
643
  <span class="sitemap-url-status fail">&#10007;</span>
@@ -659,17 +659,17 @@ ${Ft()}
659
659
  <div class="sitemap-cats">${i}</div>
660
660
  ${c}
661
661
  </div>
662
- </div>`}function Nt(t){let e=fe(t.averageScore),o=t.urlResults.some(n=>n.status==="success"&&n.result.url.startsWith("http://")),s=Object.values(t.categoryAverages).map(n=>{let a=ye(n.averagePct);return`<div class="sitemap-cat-row">
662
+ </div>`}function zt(t){let e=fe(t.averageScore),o=t.urlResults.some(n=>n.status==="success"&&n.result.url.startsWith("http://")),s=Object.values(t.categoryAverages).map(n=>{let a=ye(n.averagePct);return`<div class="sitemap-cat-row">
663
663
  <span class="sitemap-cat-name">${S(n.name)}</span>
664
664
  <span class="sitemap-cat-score ${a}">${n.averagePct}%</span>
665
- </div>`}).join(""),r=t.urlResults.map((n,a)=>To(n,a)).join("");return`<!DOCTYPE html>
665
+ </div>`}).join(""),r=t.urlResults.map((n,a)=>$o(n,a)).join("");return`<!DOCTYPE html>
666
666
  <html lang="en">
667
667
  <head>
668
668
  <meta charset="utf-8">
669
669
  <meta name="viewport" content="width=device-width, initial-scale=1">
670
670
  <title>AI SEO Sitemap Audit - ${S(t.sitemapUrl)}</title>
671
671
  <style>
672
- ${Ft()}
672
+ ${Ut()}
673
673
  .summary { display: flex; gap: 32px; padding: 32px 0 24px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
674
674
  .summary-score { display: flex; flex-direction: column; align-items: center; }
675
675
  .summary-score-value { font-size: 64px; font-weight: 700; line-height: 1; }
@@ -743,11 +743,11 @@ ${Ft()}
743
743
  </div>
744
744
 
745
745
  </body>
746
- </html>`}function zt(t){let e=[];t.url.startsWith("http://")&&e.push("Audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.");let o=e.length>0?{...t,notes:e}:t;return JSON.stringify(o,null,2)}function _t(t){let e=[];t.urlResults.some(r=>r.status==="success"&&r.result.url.startsWith("http://"))&&e.push("Some URLs were audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.");let s=e.length>0?{...t,notes:e}:t;return JSON.stringify(s,null,2)}function jt(t){let e=[];e.push("# AI SEO Audit"),e.push(""),e.push(`**URL:** ${t.url}`),e.push(""),e.push(`**Domain signals checked at:** \`${t.signalsBase}\``),e.push(""),e.push("| Category | Score | Percentage |"),e.push("|----------|-------|------------|");for(let o of Object.values(t.categories)){let s=o.maxScore>0?Math.round(o.score/o.maxScore*100):0;e.push(`| ${o.name} | ${o.score}/${o.maxScore} | ${s}% |`)}e.push(""),e.push(`## Overall: ${t.overallScore}/100 (${t.grade}) - ${t.totalPoints}/${t.maxPoints} pts`),e.push("");for(let o of Object.values(t.categories)){let s=o.maxScore>0?Math.round(o.score/o.maxScore*100):0;e.push(`### ${o.name} (${s}%)`),e.push(""),e.push("| Factor | Score | Status | Details |"),e.push("|--------|-------|--------|---------|");for(let r of o.factors){let n=r.status==="good"?"pass":r.status==="neutral"?"-":r.status==="needs_improvement"?"warn":"fail";e.push(`| ${r.name} | ${r.score}/${r.maxScore} | ${n} | ${r.value} |`)}e.push("")}if(t.recommendations.length>0){e.push("## Recommendations"),e.push("");let o=Object.values(t.categories).map(s=>s.name);for(let s of o){let r=t.recommendations.filter(n=>n.category===s);if(r.length!==0){e.push(`### ${s}`),e.push("");for(let n of r){let a=n.priority==="high"?"**HIGH**":n.priority==="medium"?"*MED*":"LOW";e.push(`- [${a}] **${n.factor}**: ${n.recommendation}`),n.steps&&n.steps.length>0&&n.steps.forEach((i,c)=>{e.push(` ${c+1}. ${i}`)}),n.codeExample&&(e.push(""),e.push(" ```"),n.codeExample.split(`
746
+ </html>`}function _t(t){let e=[];t.url.startsWith("http://")&&e.push("Audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.");let o=e.length>0?{...t,notes:e}:t;return JSON.stringify(o,null,2)}function jt(t){let e=[];t.urlResults.some(r=>r.status==="success"&&r.result.url.startsWith("http://"))&&e.push("Some URLs were audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.");let s=e.length>0?{...t,notes:e}:t;return JSON.stringify(s,null,2)}function Ht(t){let e=[];e.push("# AI SEO Audit"),e.push(""),e.push(`**URL:** ${t.url}`),e.push(""),e.push(`**Domain signals checked at:** \`${t.signalsBase}\``),e.push(""),e.push("| Category | Score | Percentage |"),e.push("|----------|-------|------------|");for(let o of Object.values(t.categories)){let s=o.maxScore>0?Math.round(o.score/o.maxScore*100):0;e.push(`| ${o.name} | ${o.score}/${o.maxScore} | ${s}% |`)}e.push(""),e.push(`## Overall: ${t.overallScore}/100 (${t.grade}) - ${t.totalPoints}/${t.maxPoints} pts`),e.push("");for(let o of Object.values(t.categories)){let s=o.maxScore>0?Math.round(o.score/o.maxScore*100):0;e.push(`### ${o.name} (${s}%)`),e.push(""),e.push("| Factor | Score | Status | Details |"),e.push("|--------|-------|--------|---------|");for(let r of o.factors){let n=r.status==="good"?"pass":r.status==="neutral"?"-":r.status==="needs_improvement"?"warn":"fail";e.push(`| ${r.name} | ${r.score}/${r.maxScore} | ${n} | ${r.value} |`)}e.push("")}if(t.recommendations.length>0){e.push("## Recommendations"),e.push("");let o=Object.values(t.categories).map(s=>s.name);for(let s of o){let r=t.recommendations.filter(n=>n.category===s);if(r.length!==0){e.push(`### ${s}`),e.push("");for(let n of r){let a=n.priority==="high"?"**HIGH**":n.priority==="medium"?"*MED*":"LOW";e.push(`- [${a}] **${n.factor}**: ${n.recommendation}`),n.steps&&n.steps.length>0&&n.steps.forEach((i,c)=>{e.push(` ${c+1}. ${i}`)}),n.codeExample&&(e.push(""),e.push(" ```"),n.codeExample.split(`
747
747
  `).forEach(i=>{e.push(` ${i}`)}),e.push(" ```")),n.learnMoreUrl&&(e.push(""),e.push(` [Learn more](${n.learnMoreUrl})`)),(n.steps||n.codeExample||n.learnMoreUrl)&&e.push("")}e.push("")}}}return e.push("---"),e.push(`*Generated by aiseo-audit v${t.meta.version} | ${t.analyzedAt} | ${t.meta.analysisDurationMs}ms*`),t.url.startsWith("http://")&&(e.push(""),e.push("> **Note:** Audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.")),e.join(`
748
748
  `)}function Bt(t){let e=[];if(e.push("# AI SEO Sitemap Audit Report"),e.push(""),e.push(`**Sitemap:** ${t.sitemapUrl}`),e.push(`**Domain signals checked at:** \`${t.signalsBase}\``),e.push(`**Analyzed at:** ${t.analyzedAt}`),e.push(""),e.push("## Summary"),e.push(""),e.push("| Metric | Value |"),e.push("|--------|-------|"),e.push(`| Average Score | ${t.averageScore}/100 |`),e.push(`| Average Grade | ${t.averageGrade} |`),e.push(`| Total URLs | ${t.totalUrls} |`),e.push(`| Succeeded | ${t.succeededCount} |`),e.push(`| Failed | ${t.failedCount} |`),e.push(""),Object.keys(t.categoryAverages).length>0){e.push("## Site-Wide Category Averages"),e.push(""),e.push("| Category | Average Score |"),e.push("|----------|---------------|");for(let s of Object.values(t.categoryAverages))e.push(`| ${s.name} | ${s.averagePct}% |`);e.push("")}e.push("## URL Results"),e.push("");for(let s of t.urlResults){if(s.status==="failed"){e.push(`### \u274C ${s.url}`),e.push(""),e.push(`**Error:** ${s.error}`),e.push("");continue}let{result:r}=s;e.push(`### ${r.url}`),e.push(""),e.push(`**Score:** ${r.overallScore}/100 | **Grade:** ${r.grade} | **Points:** ${r.totalPoints}/${r.maxPoints}`),e.push(""),e.push("| Category | Score | Percentage |"),e.push("|----------|-------|------------|");for(let n of Object.values(r.categories)){let a=n.maxScore>0?Math.round(n.score/n.maxScore*100):0;e.push(`| ${n.name} | ${n.score}/${n.maxScore} | ${a}% |`)}if(e.push(""),r.recommendations.length>0){e.push("**Recommendations:**"),e.push("");for(let n of r.recommendations){let a=n.priority==="high"?"**HIGH**":n.priority==="medium"?"*MED*":"LOW";e.push(`- [${a}] **${n.factor}**: ${n.recommendation}`)}e.push("")}}return e.push("---"),e.push(`*Generated by aiseo-audit v${t.meta.version} | ${t.analyzedAt} | ${t.meta.analysisDurationMs}ms*`),t.urlResults.some(s=>s.status==="success"&&s.result.url.startsWith("http://"))&&(e.push(""),e.push("> **Note:** Some URLs were audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.")),e.join(`
749
- `)}var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);function Y(t,e){let o=e>0?t/e*100:0;return o>=90?_chalk2.default.green:o>=50?_chalk2.default.yellow:_chalk2.default.red}function xe(t){return t.startsWith("A")?_chalk2.default.green:t.startsWith("B")||t.startsWith("C")?_chalk2.default.yellow:_chalk2.default.red}function be(t,e){return t+" ".repeat(Math.max(0,e-t.length))}function we(t){return _chalk2.default.dim(".".repeat(t))}function $o(t,e,o){let s=o.crawlerAccess!==void 0,r=_nullishCoalesce(_optionalChain([o, 'access', _53 => _53.llmsTxt, 'optionalAccess', _54 => _54.llmsTxtExists]), () => (!1)),n=_nullishCoalesce(_optionalChain([o, 'access', _55 => _55.llmsTxt, 'optionalAccess', _56 => _56.llmsFullTxtExists]), () => (!1));t.push(_chalk2.default.dim(` Domain signals checked at: ${e}`)),t.push(_chalk2.default.dim(` robots.txt ........ ${s?_chalk2.default.green("found"):_chalk2.default.red("not found")}`)),t.push(_chalk2.default.dim(` llms.txt .......... ${r?_chalk2.default.green("found"):_chalk2.default.red("not found")}`)),t.push(_chalk2.default.dim(` llms-full.txt ..... ${n?_chalk2.default.green("found"):_chalk2.default.red("not found")}`))}function Ht(t){let e=[],s=_chalk2.default.dim("=".repeat(60)),r=_chalk2.default.dim("-".repeat(60));e.push(""),e.push(s),e.push(_chalk2.default.bold(" AI SEO Audit Report")),e.push(_chalk2.default.dim(` ${t.url}`)),e.push(s),e.push("");let n=Y(t.overallScore,100),a=xe(t.grade);e.push(` Overall Score: ${n(`${t.overallScore}/100`)} Grade: ${a(t.grade)}`),e.push(_chalk2.default.dim(` Points: ${t.totalPoints}/${t.maxPoints}`)),e.push(""),$o(e,t.signalsBase,t.rawData),e.push(""),e.push(r);for(let i of Object.values(t.categories)){let c=Y(i.score,i.maxScore),l=i.maxScore>0?Math.round(i.score/i.maxScore*100):0,p=be(i.name,38),g=we(Math.max(2,40-i.name.length));e.push(""),e.push(` ${_chalk2.default.bold(p)} ${g} ${c(`${i.score}/${i.maxScore}`)} ${_chalk2.default.dim(`(${l}%)`)}`);for(let d of i.factors){let A=Y(d.score,d.maxScore),x=be(` ${d.name}`,40),v=we(Math.max(2,42-d.name.length));e.push(` ${_chalk2.default.dim(x)} ${v} ${A(`${d.score}/${d.maxScore}`)} ${_chalk2.default.dim(d.value)}`)}}if(e.push(""),e.push(r),t.recommendations.length>0){e.push(""),e.push(_chalk2.default.bold(" Recommendations:")),e.push("");for(let i=0;i<t.recommendations.length;i++){let c=t.recommendations[i],l=c.priority==="high"?_chalk2.default.red("[HIGH]"):c.priority==="medium"?_chalk2.default.yellow("[MED] "):_chalk2.default.dim("[LOW] ");e.push(` ${i+1}. ${l} ${_chalk2.default.bold(c.factor)}`),e.push(` ${_chalk2.default.dim(c.recommendation)}`),c.steps&&c.steps.length>0&&(e.push(""),e.push(` ${_chalk2.default.dim("Steps:")}`),c.steps.forEach((p,g)=>{e.push(` ${_chalk2.default.dim(`${g+1}. ${p}`)}`)})),c.codeExample&&(e.push(""),e.push(` ${_chalk2.default.dim("Example:")}`),e.push(` ${_chalk2.default.dim("\u250C"+"\u2500".repeat(50))}`),c.codeExample.split(`
749
+ `)}var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);function Y(t,e){let o=e>0?t/e*100:0;return o>=90?_chalk2.default.green:o>=50?_chalk2.default.yellow:_chalk2.default.red}function xe(t){return t.startsWith("A")?_chalk2.default.green:t.startsWith("B")||t.startsWith("C")?_chalk2.default.yellow:_chalk2.default.red}function be(t,e){return t+" ".repeat(Math.max(0,e-t.length))}function we(t){return _chalk2.default.dim(".".repeat(t))}function Eo(t,e,o){let s=o.crawlerAccess!==void 0,r=_nullishCoalesce(_optionalChain([o, 'access', _53 => _53.llmsTxt, 'optionalAccess', _54 => _54.llmsTxtExists]), () => (!1)),n=_nullishCoalesce(_optionalChain([o, 'access', _55 => _55.llmsTxt, 'optionalAccess', _56 => _56.llmsFullTxtExists]), () => (!1));t.push(_chalk2.default.dim(` Domain signals checked at: ${e}`)),t.push(_chalk2.default.dim(` robots.txt ........ ${s?_chalk2.default.green("found"):_chalk2.default.red("not found")}`)),t.push(_chalk2.default.dim(` llms.txt .......... ${r?_chalk2.default.green("found"):_chalk2.default.red("not found")}`)),t.push(_chalk2.default.dim(` llms-full.txt ..... ${n?_chalk2.default.green("found"):_chalk2.default.red("not found")}`))}function Gt(t){let e=[],s=_chalk2.default.dim("=".repeat(60)),r=_chalk2.default.dim("-".repeat(60));e.push(""),e.push(s),e.push(_chalk2.default.bold(" AI SEO Audit Report")),e.push(_chalk2.default.dim(` ${t.url}`)),e.push(s),e.push("");let n=Y(t.overallScore,100),a=xe(t.grade);e.push(` Overall Score: ${n(`${t.overallScore}/100`)} Grade: ${a(t.grade)}`),e.push(_chalk2.default.dim(` Points: ${t.totalPoints}/${t.maxPoints}`)),e.push(""),Eo(e,t.signalsBase,t.rawData),e.push(""),e.push(r);for(let i of Object.values(t.categories)){let c=Y(i.score,i.maxScore),l=i.maxScore>0?Math.round(i.score/i.maxScore*100):0,p=be(i.name,38),g=we(Math.max(2,40-i.name.length));e.push(""),e.push(` ${_chalk2.default.bold(p)} ${g} ${c(`${i.score}/${i.maxScore}`)} ${_chalk2.default.dim(`(${l}%)`)}`);for(let d of i.factors){let A=Y(d.score,d.maxScore),x=be(` ${d.name}`,40),v=we(Math.max(2,42-d.name.length));e.push(` ${_chalk2.default.dim(x)} ${v} ${A(`${d.score}/${d.maxScore}`)} ${_chalk2.default.dim(d.value)}`)}}if(e.push(""),e.push(r),t.recommendations.length>0){e.push(""),e.push(_chalk2.default.bold(" Recommendations:")),e.push("");for(let i=0;i<t.recommendations.length;i++){let c=t.recommendations[i],l=c.priority==="high"?_chalk2.default.red("[HIGH]"):c.priority==="medium"?_chalk2.default.yellow("[MED] "):_chalk2.default.dim("[LOW] ");e.push(` ${i+1}. ${l} ${_chalk2.default.bold(c.factor)}`),e.push(` ${_chalk2.default.dim(c.recommendation)}`),c.steps&&c.steps.length>0&&(e.push(""),e.push(` ${_chalk2.default.dim("Steps:")}`),c.steps.forEach((p,g)=>{e.push(` ${_chalk2.default.dim(`${g+1}. ${p}`)}`)})),c.codeExample&&(e.push(""),e.push(` ${_chalk2.default.dim("Example:")}`),e.push(` ${_chalk2.default.dim("\u250C"+"\u2500".repeat(50))}`),c.codeExample.split(`
750
750
  `).forEach(p=>{e.push(` ${_chalk2.default.dim("\u2502")} ${_chalk2.default.dim(p)}`)}),e.push(` ${_chalk2.default.dim("\u2514"+"\u2500".repeat(50))}`)),c.learnMoreUrl&&(e.push(""),e.push(` ${_chalk2.default.dim(`Learn more: ${c.learnMoreUrl}`)}`)),e.push("")}}return e.push(s),e.push(_chalk2.default.dim(` Analyzed at: ${t.analyzedAt}`)),e.push(_chalk2.default.dim(` Duration: ${t.meta.analysisDurationMs}ms`)),t.url.startsWith("http://")&&e.push(_chalk2.default.yellow(" Note: Audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.")),e.push(s),e.push(""),e.join(`
751
- `)}function Gt(t){let e=[],s=_chalk2.default.dim("=".repeat(60)),r=_chalk2.default.dim("-".repeat(60));e.push(""),e.push(s),e.push(_chalk2.default.bold(" AI SEO Sitemap Audit Report")),e.push(_chalk2.default.dim(` ${t.sitemapUrl}`)),e.push(s),e.push("");let n=Y(t.averageScore,100),a=xe(t.averageGrade);if(e.push(` Average Score: ${n(`${t.averageScore}/100`)} Grade: ${a(t.averageGrade)}`),e.push(_chalk2.default.dim(` URLs: ${t.succeededCount} audited, ${t.failedCount} failed, ${t.totalUrls} total`)),e.push(""),e.push(_chalk2.default.dim(` Domain signals checked at: ${t.signalsBase}`)),e.push(""),e.push(r),Object.keys(t.categoryAverages).length>0){e.push(""),e.push(_chalk2.default.bold(" Site-Wide Category Averages:")),e.push("");for(let c of Object.values(t.categoryAverages)){let l=Y(c.averagePct,100),p=be(c.name,38),g=we(Math.max(2,40-c.name.length));e.push(` ${_chalk2.default.bold(p)} ${g} ${l(`${c.averagePct}%`)}`)}e.push(""),e.push(r)}e.push(""),e.push(_chalk2.default.bold(" URL Results:")),e.push("");for(let c of t.urlResults){if(c.status==="failed"){e.push(` ${_chalk2.default.red("\u2717")} ${_chalk2.default.dim(c.url)}`),e.push(` ${_chalk2.default.red(`Error: ${c.error}`)}`),e.push("");continue}let{result:l}=c,p=Y(l.overallScore,100),g=xe(l.grade),d=l.recommendations[0];e.push(` ${_chalk2.default.green("\u2713")} ${_chalk2.default.dim(l.url)}`),e.push(` Score: ${p(`${l.overallScore}/100`)} Grade: ${g(l.grade)}`),d&&e.push(` ${_chalk2.default.dim(`Top rec: ${d.factor} \u2014 ${d.recommendation}`)}`),e.push("")}return e.push(s),e.push(_chalk2.default.dim(` Analyzed at: ${t.analyzedAt}`)),e.push(_chalk2.default.dim(` Duration: ${t.meta.analysisDurationMs}ms`)),t.urlResults.some(c=>c.status==="success"&&c.result.url.startsWith("http://"))&&e.push(_chalk2.default.yellow(" Note: Some URLs were audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.")),e.push(s),e.push(""),e.join(`
752
- `)}function Vn(t,e){switch(e.format){case"json":return zt(t);case"md":return jt(t);case"html":return Ut(t);default:return Ht(t)}}function Qn(t,e){switch(e.format){case"json":return _t(t);case"md":return Bt(t);case"html":return Nt(t);default:return Gt(t)}}var _xmltohtmlconverter = require('xml-to-html-converter');function Eo(t){let e=t.trim();return e.startsWith("<![CDATA[")&&e.endsWith("]]>")?e.slice(9,-3):e}function Se(t,e){for(let o of t){if(o.xmlTag==="loc"&&o.children){let s=o.children.filter(r=>r.role==="textLeaf").map(r=>Eo(r.raw)).join("").trim();s&&e.push(s)}o.children&&Se(o.children,e)}}function Wt(t){let e=_xmltohtmlconverter.scaffold.call(void 0, t),o=[];return Se(e,o),o}function Yt(t){for(let e of t)if(e.xmlTag==="sitemapindex"||e.children&&Yt(e.children))return!0;return!1}async function Co(t,e,o){let s=await H({url:t,timeout:e,userAgent:o});if(s.status!==200)throw new Error(`Failed to fetch sitemap: HTTP ${s.status}`);let r=_xmltohtmlconverter.scaffold.call(void 0, s.data);if(Yt(r))return Ro(s.data,e,o);let n=[];return Se(r,n),n}async function Ro(t,e,o){let s=Wt(t),r=[];for(let n of s){let a=await H({url:n,timeout:e,userAgent:o});a.status===200&&r.push(...Wt(a.data))}return r}function Io(t){let e=t.filter(r=>r.status==="success").map(r=>r.result);if(e.length===0)return{};let o={};for(let r of e)for(let[n,a]of Object.entries(r.categories)){let i=a.maxScore>0?a.score/a.maxScore*100:0;o[n]||(o[n]={name:a.name,totalPct:0,count:0}),o[n].totalPct+=i,o[n].count+=1}let s={};for(let[r,n]of Object.entries(o))s[r]={name:n.name,averagePct:Math.round(n.totalPct/n.count)};return s}async function aa(t,e){let o=Date.now(),s=_nullishCoalesce(t.timeout, () => (e.timeout)),r=_nullishCoalesce(t.userAgent, () => (e.userAgent)),n=await Co(t.sitemapUrl,s,r),a=t.sitemapUrl.substring(0,t.sitemapUrl.lastIndexOf("/")),i=_nullishCoalesce(t.signalsBase, () => (a)),c=await ge(i,s,r),l=[];for(let y of n){let w=J(y);try{let f=await X({url:w,timeout:s,userAgent:r}),T=await It(w,f,c,e);l.push({status:"success",result:T})}catch(f){l.push({status:"failed",url:w,error:f instanceof Error?f.message:String(f)})}}let p=l.filter(y=>y.status==="success").map(y=>y.result),g=p.length,d=l.length-g,A=g>0?Math.round(p.reduce((y,w)=>y+w.overallScore,0)/g):0,x=de(A),v=Io(l);return{sitemapUrl:t.sitemapUrl,signalsBase:c.signalsBase,analyzedAt:new Date().toISOString(),totalUrls:l.length,succeededCount:g,failedCount:d,averageScore:A,averageGrade:x,categoryAverages:v,urlResults:l,meta:{version:_,analysisDurationMs:Date.now()-o}}}exports.a = _; exports.b = N; exports.c = zo; exports.d = gn; exports.e = bn; exports.f = Ln; exports.g = Vn; exports.h = Qn; exports.i = aa;
753
- //# sourceMappingURL=chunk-VFC7JVIL.js.map
751
+ `)}function Wt(t){let e=[],s=_chalk2.default.dim("=".repeat(60)),r=_chalk2.default.dim("-".repeat(60));e.push(""),e.push(s),e.push(_chalk2.default.bold(" AI SEO Sitemap Audit Report")),e.push(_chalk2.default.dim(` ${t.sitemapUrl}`)),e.push(s),e.push("");let n=Y(t.averageScore,100),a=xe(t.averageGrade);if(e.push(` Average Score: ${n(`${t.averageScore}/100`)} Grade: ${a(t.averageGrade)}`),e.push(_chalk2.default.dim(` URLs: ${t.succeededCount} audited, ${t.failedCount} failed, ${t.totalUrls} total`)),e.push(""),e.push(_chalk2.default.dim(` Domain signals checked at: ${t.signalsBase}`)),e.push(""),e.push(r),Object.keys(t.categoryAverages).length>0){e.push(""),e.push(_chalk2.default.bold(" Site-Wide Category Averages:")),e.push("");for(let c of Object.values(t.categoryAverages)){let l=Y(c.averagePct,100),p=be(c.name,38),g=we(Math.max(2,40-c.name.length));e.push(` ${_chalk2.default.bold(p)} ${g} ${l(`${c.averagePct}%`)}`)}e.push(""),e.push(r)}e.push(""),e.push(_chalk2.default.bold(" URL Results:")),e.push("");for(let c of t.urlResults){if(c.status==="failed"){e.push(` ${_chalk2.default.red("\u2717")} ${_chalk2.default.dim(c.url)}`),e.push(` ${_chalk2.default.red(`Error: ${c.error}`)}`),e.push("");continue}let{result:l}=c,p=Y(l.overallScore,100),g=xe(l.grade),d=l.recommendations[0];e.push(` ${_chalk2.default.green("\u2713")} ${_chalk2.default.dim(l.url)}`),e.push(` Score: ${p(`${l.overallScore}/100`)} Grade: ${g(l.grade)}`),d&&e.push(` ${_chalk2.default.dim(`Top rec: ${d.factor} \u2014 ${d.recommendation}`)}`),e.push("")}return e.push(s),e.push(_chalk2.default.dim(` Analyzed at: ${t.analyzedAt}`)),e.push(_chalk2.default.dim(` Duration: ${t.meta.analysisDurationMs}ms`)),t.urlResults.some(c=>c.status==="success"&&c.result.url.startsWith("http://"))&&e.push(_chalk2.default.yellow(" Note: Some URLs were audited over HTTP. Domain signals (robots.txt, llms.txt) may differ in production.")),e.push(s),e.push(""),e.join(`
752
+ `)}function Qn(t,e){switch(e.format){case"json":return _t(t);case"md":return Ht(t);case"html":return Nt(t);default:return Gt(t)}}function Kn(t,e){switch(e.format){case"json":return jt(t);case"md":return Bt(t);case"html":return zt(t);default:return Wt(t)}}var _xmltohtmlconverter = require('xml-to-html-converter');function Co(t){let e=t.trim();return e.startsWith("<![CDATA[")&&e.endsWith("]]>")?e.slice(9,-3):e}function Se(t,e){for(let o of t){if(o.xmlTag==="loc"&&o.children){let s=o.children.filter(r=>r.role==="textLeaf").map(r=>Co(r.raw)).join("").trim();s&&e.push(s)}o.children&&Se(o.children,e)}}function qt(t){let e=_xmltohtmlconverter.scaffold.call(void 0, t),o=[];return Se(e,o),o}function Jt(t){for(let e of t)if(e.xmlTag==="sitemapindex"||e.children&&Jt(e.children))return!0;return!1}async function Ro(t,e,o){let s=await B({url:t,timeout:e,userAgent:o});if(s.status!==200)throw new Error(`Failed to fetch sitemap: HTTP ${s.status}`);let r=_xmltohtmlconverter.scaffold.call(void 0, s.data);if(Jt(r))return Io(s.data,e,o);let n=[];return Se(r,n),n}async function Io(t,e,o){let s=qt(t),r=[];for(let n of s){let a=await B({url:n,timeout:e,userAgent:o});a.status===200&&r.push(...qt(a.data))}return r}function Po(t){let e=t.filter(r=>r.status==="success").map(r=>r.result);if(e.length===0)return{};let o={};for(let r of e)for(let[n,a]of Object.entries(r.categories)){let i=a.maxScore>0?a.score/a.maxScore*100:0;o[n]||(o[n]={name:a.name,totalPct:0,count:0}),o[n].totalPct+=i,o[n].count+=1}let s={};for(let[r,n]of Object.entries(o))s[r]={name:n.name,averagePct:Math.round(n.totalPct/n.count)};return s}async function ia(t,e){let o=Date.now(),s=_nullishCoalesce(t.timeout, () => (e.timeout)),r=_nullishCoalesce(t.userAgent, () => (e.userAgent)),n=await Ro(t.sitemapUrl,s,r),a=t.sitemapUrl.substring(0,t.sitemapUrl.lastIndexOf("/")),i=_nullishCoalesce(t.signalsBase, () => (a)),c=await ge(i,s,r),l=[];for(let y of n){let w=J(y);try{let f=await X({url:w,timeout:s,userAgent:r}),T=await Pt(w,f,c,e);l.push({status:"success",result:T})}catch(f){l.push({status:"failed",url:w,error:f instanceof Error?f.message:String(f)})}}let p=l.filter(y=>y.status==="success").map(y=>y.result),g=p.length,d=l.length-g,A=g>0?Math.round(p.reduce((y,w)=>y+w.overallScore,0)/g):0,x=de(A),v=Po(l);return{sitemapUrl:t.sitemapUrl,signalsBase:c.signalsBase,analyzedAt:new Date().toISOString(),totalUrls:l.length,succeededCount:g,failedCount:d,averageScore:A,averageGrade:x,categoryAverages:v,urlResults:l,meta:{version:_,analysisDurationMs:Date.now()-o}}}exports.a = _; exports.b = N; exports.c = _o; exports.d = fn; exports.e = wn; exports.f = Dn; exports.g = Qn; exports.h = Kn; exports.i = ia;
753
+ //# sourceMappingURL=chunk-7JEPIJKG.js.map
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict"; function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkVFC7JVILjs = require('./chunk-VFC7JVIL.js');var _commander = require('commander');var _zod = require('zod');var $=_zod.z.object({sitemap:_zod.z.string().optional(),signalsBase:_zod.z.string().optional(),json:_zod.z.boolean().optional(),md:_zod.z.boolean().optional(),html:_zod.z.boolean().optional(),out:_zod.z.string().optional(),failUnder:_zod.z.coerce.number().min(0).max(100).optional(),timeout:_zod.z.coerce.number().int().positive().optional(),userAgent:_zod.z.string().optional(),config:_zod.z.string().optional()}),S=new _commander.Command;S.name("aiseo-audit").description("Audit web pages for AI search readiness").version(_chunkVFC7JVILjs.a).argument("[url]","URL to audit").option("--sitemap <url>","Audit all URLs in a sitemap.xml").option("--signals-base <url>","Base URL to fetch domain signals from (robots.txt, llms.txt, llms-full.txt)").option("--json","Output as JSON").option("--md","Output as Markdown").option("--html","Output as HTML").option("--out <path>","Write rendered output to a file").option("--fail-under <score>","Exit with code 1 if score is below threshold (0-100)").option("--timeout <ms>","Request timeout in milliseconds").option("--user-agent <ua>","Custom User-Agent string").option("--config <path>","Path to aiseo.config.json config file").action(async(i,j)=>{try{let t=$.safeParse(j);t.success||(console.error("Error:",t.error.issues.map(s=>s.message).join(", ")),process.exit(2));let o=t.data;!i&&!o.sitemap&&(console.error("Error: Provide a URL to audit or use --sitemap <url>"),process.exit(2)),i&&o.sitemap&&(console.error("Error: Cannot use both a URL argument and --sitemap together"),process.exit(2));let r=await _chunkVFC7JVILjs.f.call(void 0, o.config),A=_optionalChain([o, 'access', _ => _.out, 'optionalAccess', _2 => _2.endsWith, 'call', _3 => _3(".html")])?"html":_optionalChain([o, 'access', _4 => _4.out, 'optionalAccess', _5 => _5.endsWith, 'call', _6 => _6(".md")])?"md":_optionalChain([o, 'access', _7 => _7.out, 'optionalAccess', _8 => _8.endsWith, 'call', _9 => _9(".json")])?"json":void 0,u=o.json?"json":o.md?"md":o.html?"html":_nullishCoalesce(A, () => (r.format)),c=_nullishCoalesce(o.timeout, () => (r.timeout)),d=_nullishCoalesce(o.userAgent, () => (r.userAgent));if(o.sitemap){_chunkVFC7JVILjs.c.call(void 0, o.sitemap)||(console.error(`Error: Invalid sitemap URL "${o.sitemap}"`),process.exit(2));let s=await _chunkVFC7JVILjs.i.call(void 0, {sitemapUrl:o.sitemap,signalsBase:o.signalsBase,timeout:c,userAgent:d},r),g=_chunkVFC7JVILjs.h.call(void 0, s,{format:u});o.out?(await _chunkVFC7JVILjs.e.call(void 0, o.out,g),console.error(`Results written to ${o.out}`)):console.log(g);let n=_nullishCoalesce(o.failUnder, () => (r.failUnder));if(n!==void 0&&s.averageScore<n){let y=s.urlResults.filter(h=>h.status==="success"&&h.result.overallScore<n).length;console.error(`
2
- Average score ${s.averageScore} is below threshold ${n} (${y} URLs individually below threshold)`),process.exit(1)}return}_chunkVFC7JVILjs.c.call(void 0, i)||(console.error(`Error: Invalid URL "${i}"`),process.exit(2));let a=await _chunkVFC7JVILjs.d.call(void 0, {url:i,signalsBase:o.signalsBase,timeout:c,userAgent:d},r),f=_chunkVFC7JVILjs.g.call(void 0, a,{format:u});o.out?(await _chunkVFC7JVILjs.e.call(void 0, o.out,f),console.error(`Results written to ${o.out}`)):console.log(f);let l=_nullishCoalesce(o.failUnder, () => (r.failUnder));l!==void 0&&a.overallScore<l&&(console.error(`
1
+ "use strict"; function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk7JEPIJKGjs = require('./chunk-7JEPIJKG.js');var _commander = require('commander');var _zod = require('zod');var $=_zod.z.object({sitemap:_zod.z.string().optional(),signalsBase:_zod.z.string().optional(),json:_zod.z.boolean().optional(),md:_zod.z.boolean().optional(),html:_zod.z.boolean().optional(),out:_zod.z.string().optional(),failUnder:_zod.z.coerce.number().min(0).max(100).optional(),timeout:_zod.z.coerce.number().int().positive().optional(),userAgent:_zod.z.string().optional(),config:_zod.z.string().optional()}),S=new _commander.Command;S.name("aiseo-audit").description("Audit web pages for AI search readiness").version(_chunk7JEPIJKGjs.a).argument("[url]","URL to audit").option("--sitemap <url>","Audit all URLs in a sitemap.xml").option("--signals-base <url>","Base URL to fetch domain signals from (robots.txt, llms.txt, llms-full.txt)").option("--json","Output as JSON").option("--md","Output as Markdown").option("--html","Output as HTML").option("--out <path>","Write rendered output to a file").option("--fail-under <score>","Exit with code 1 if score is below threshold (0-100)").option("--timeout <ms>","Request timeout in milliseconds").option("--user-agent <ua>","Custom User-Agent string").option("--config <path>","Path to aiseo.config.json config file").action(async(i,j)=>{try{let t=$.safeParse(j);t.success||(console.error("Error:",t.error.issues.map(s=>s.message).join(", ")),process.exit(2));let o=t.data;!i&&!o.sitemap&&(console.error("Error: Provide a URL to audit or use --sitemap <url>"),process.exit(2)),i&&o.sitemap&&(console.error("Error: Cannot use both a URL argument and --sitemap together"),process.exit(2));let r=await _chunk7JEPIJKGjs.f.call(void 0, o.config),A=_optionalChain([o, 'access', _ => _.out, 'optionalAccess', _2 => _2.endsWith, 'call', _3 => _3(".html")])?"html":_optionalChain([o, 'access', _4 => _4.out, 'optionalAccess', _5 => _5.endsWith, 'call', _6 => _6(".md")])?"md":_optionalChain([o, 'access', _7 => _7.out, 'optionalAccess', _8 => _8.endsWith, 'call', _9 => _9(".json")])?"json":void 0,u=o.json?"json":o.md?"md":o.html?"html":_nullishCoalesce(A, () => (r.format)),c=_nullishCoalesce(o.timeout, () => (r.timeout)),d=_nullishCoalesce(o.userAgent, () => (r.userAgent));if(o.sitemap){_chunk7JEPIJKGjs.c.call(void 0, o.sitemap)||(console.error(`Error: Invalid sitemap URL "${o.sitemap}"`),process.exit(2));let s=await _chunk7JEPIJKGjs.i.call(void 0, {sitemapUrl:o.sitemap,signalsBase:o.signalsBase,timeout:c,userAgent:d},r),g=_chunk7JEPIJKGjs.h.call(void 0, s,{format:u});o.out?(await _chunk7JEPIJKGjs.e.call(void 0, o.out,g),console.error(`Results written to ${o.out}`)):console.log(g);let n=_nullishCoalesce(o.failUnder, () => (r.failUnder));if(n!==void 0&&s.averageScore<n){let y=s.urlResults.filter(h=>h.status==="success"&&h.result.overallScore<n).length;console.error(`
2
+ Average score ${s.averageScore} is below threshold ${n} (${y} URLs individually below threshold)`),process.exit(1)}return}_chunk7JEPIJKGjs.c.call(void 0, i)||(console.error(`Error: Invalid URL "${i}"`),process.exit(2));let a=await _chunk7JEPIJKGjs.d.call(void 0, {url:i,signalsBase:o.signalsBase,timeout:c,userAgent:d},r),f=_chunk7JEPIJKGjs.g.call(void 0, a,{format:u});o.out?(await _chunk7JEPIJKGjs.e.call(void 0, o.out,f),console.error(`Results written to ${o.out}`)):console.log(f);let l=_nullishCoalesce(o.failUnder, () => (r.failUnder));l!==void 0&&a.overallScore<l&&(console.error(`
3
3
  Score ${a.overallScore} is below threshold ${l}`),process.exit(1))}catch(t){console.error("Audit failed:",t instanceof Error?t.message:String(t)),process.exit(2)}});S.parse();
4
4
  //# sourceMappingURL=cli.js.map
package/dist/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{a as R,c as m,d as U,e as p,f as w,g as b,h as x,i as v}from"./chunk-7ULHTMIY.mjs";import{Command as L}from"commander";import{z as e}from"zod";var $=e.object({sitemap:e.string().optional(),signalsBase:e.string().optional(),json:e.boolean().optional(),md:e.boolean().optional(),html:e.boolean().optional(),out:e.string().optional(),failUnder:e.coerce.number().min(0).max(100).optional(),timeout:e.coerce.number().int().positive().optional(),userAgent:e.string().optional(),config:e.string().optional()}),S=new L;S.name("aiseo-audit").description("Audit web pages for AI search readiness").version(R).argument("[url]","URL to audit").option("--sitemap <url>","Audit all URLs in a sitemap.xml").option("--signals-base <url>","Base URL to fetch domain signals from (robots.txt, llms.txt, llms-full.txt)").option("--json","Output as JSON").option("--md","Output as Markdown").option("--html","Output as HTML").option("--out <path>","Write rendered output to a file").option("--fail-under <score>","Exit with code 1 if score is below threshold (0-100)").option("--timeout <ms>","Request timeout in milliseconds").option("--user-agent <ua>","Custom User-Agent string").option("--config <path>","Path to aiseo.config.json config file").action(async(i,j)=>{try{let t=$.safeParse(j);t.success||(console.error("Error:",t.error.issues.map(s=>s.message).join(", ")),process.exit(2));let o=t.data;!i&&!o.sitemap&&(console.error("Error: Provide a URL to audit or use --sitemap <url>"),process.exit(2)),i&&o.sitemap&&(console.error("Error: Cannot use both a URL argument and --sitemap together"),process.exit(2));let r=await w(o.config),A=o.out?.endsWith(".html")?"html":o.out?.endsWith(".md")?"md":o.out?.endsWith(".json")?"json":void 0,u=o.json?"json":o.md?"md":o.html?"html":A??r.format,c=o.timeout??r.timeout,d=o.userAgent??r.userAgent;if(o.sitemap){m(o.sitemap)||(console.error(`Error: Invalid sitemap URL "${o.sitemap}"`),process.exit(2));let s=await v({sitemapUrl:o.sitemap,signalsBase:o.signalsBase,timeout:c,userAgent:d},r),g=x(s,{format:u});o.out?(await p(o.out,g),console.error(`Results written to ${o.out}`)):console.log(g);let n=o.failUnder??r.failUnder;if(n!==void 0&&s.averageScore<n){let y=s.urlResults.filter(h=>h.status==="success"&&h.result.overallScore<n).length;console.error(`
1
+ import{a as R,c as m,d as U,e as p,f as w,g as b,h as x,i as v}from"./chunk-6DSWL6FS.mjs";import{Command as L}from"commander";import{z as e}from"zod";var $=e.object({sitemap:e.string().optional(),signalsBase:e.string().optional(),json:e.boolean().optional(),md:e.boolean().optional(),html:e.boolean().optional(),out:e.string().optional(),failUnder:e.coerce.number().min(0).max(100).optional(),timeout:e.coerce.number().int().positive().optional(),userAgent:e.string().optional(),config:e.string().optional()}),S=new L;S.name("aiseo-audit").description("Audit web pages for AI search readiness").version(R).argument("[url]","URL to audit").option("--sitemap <url>","Audit all URLs in a sitemap.xml").option("--signals-base <url>","Base URL to fetch domain signals from (robots.txt, llms.txt, llms-full.txt)").option("--json","Output as JSON").option("--md","Output as Markdown").option("--html","Output as HTML").option("--out <path>","Write rendered output to a file").option("--fail-under <score>","Exit with code 1 if score is below threshold (0-100)").option("--timeout <ms>","Request timeout in milliseconds").option("--user-agent <ua>","Custom User-Agent string").option("--config <path>","Path to aiseo.config.json config file").action(async(i,j)=>{try{let t=$.safeParse(j);t.success||(console.error("Error:",t.error.issues.map(s=>s.message).join(", ")),process.exit(2));let o=t.data;!i&&!o.sitemap&&(console.error("Error: Provide a URL to audit or use --sitemap <url>"),process.exit(2)),i&&o.sitemap&&(console.error("Error: Cannot use both a URL argument and --sitemap together"),process.exit(2));let r=await w(o.config),A=o.out?.endsWith(".html")?"html":o.out?.endsWith(".md")?"md":o.out?.endsWith(".json")?"json":void 0,u=o.json?"json":o.md?"md":o.html?"html":A??r.format,c=o.timeout??r.timeout,d=o.userAgent??r.userAgent;if(o.sitemap){m(o.sitemap)||(console.error(`Error: Invalid sitemap URL "${o.sitemap}"`),process.exit(2));let s=await v({sitemapUrl:o.sitemap,signalsBase:o.signalsBase,timeout:c,userAgent:d},r),g=x(s,{format:u});o.out?(await p(o.out,g),console.error(`Results written to ${o.out}`)):console.log(g);let n=o.failUnder??r.failUnder;if(n!==void 0&&s.averageScore<n){let y=s.urlResults.filter(h=>h.status==="success"&&h.result.overallScore<n).length;console.error(`
2
2
  Average score ${s.averageScore} is below threshold ${n} (${y} URLs individually below threshold)`),process.exit(1)}return}m(i)||(console.error(`Error: Invalid URL "${i}"`),process.exit(2));let a=await U({url:i,signalsBase:o.signalsBase,timeout:c,userAgent:d},r),f=b(a,{format:u});o.out?(await p(o.out,f),console.error(`Results written to ${o.out}`)):console.log(f);let l=o.failUnder??r.failUnder;l!==void 0&&a.overallScore<l&&(console.error(`
3
3
  Score ${a.overallScore} is below threshold ${l}`),process.exit(1))}catch(t){console.error("Audit failed:",t instanceof Error?t.message:String(t)),process.exit(2)}});S.parse();
4
4
  //# sourceMappingURL=cli.mjs.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVFC7JVILjs = require('./chunk-VFC7JVIL.js');exports.FetchError = _chunkVFC7JVILjs.b; exports.analyzeSitemap = _chunkVFC7JVILjs.i; exports.analyzeUrl = _chunkVFC7JVILjs.d; exports.loadConfig = _chunkVFC7JVILjs.f; exports.renderReport = _chunkVFC7JVILjs.g; exports.renderSitemapReport = _chunkVFC7JVILjs.h;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7JEPIJKGjs = require('./chunk-7JEPIJKG.js');exports.FetchError = _chunk7JEPIJKGjs.b; exports.analyzeSitemap = _chunk7JEPIJKGjs.i; exports.analyzeUrl = _chunk7JEPIJKGjs.d; exports.loadConfig = _chunk7JEPIJKGjs.f; exports.renderReport = _chunk7JEPIJKGjs.g; exports.renderSitemapReport = _chunk7JEPIJKGjs.h;
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{b as e,d as t,f as o,g as r,h as p,i as m}from"./chunk-7ULHTMIY.mjs";export{e as FetchError,m as analyzeSitemap,t as analyzeUrl,o as loadConfig,r as renderReport,p as renderSitemapReport};
1
+ import{b as e,d as t,f as o,g as r,h as p,i as m}from"./chunk-6DSWL6FS.mjs";export{e as FetchError,m as analyzeSitemap,t as analyzeUrl,o as loadConfig,r as renderReport,p as renderSitemapReport};
2
2
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiseo-audit",
3
- "version": "1.4.16",
3
+ "version": "1.4.19",
4
4
  "description": "Lighthouse for AI SEO. Audit any webpage for AI search readiness. 7 categories, 30+ factors, research-backed scoring. Deterministic, engine-agnostic, zero API keys.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",