htmlhint-invalid-attribute-rule
Advanced tools
Comparing version 0.0.4 to 0.0.5
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const html_element_attributes_1 = require("html-element-attributes"); | ||
const html_event_attributes_1 = require("html-event-attributes"); | ||
exports.default = { | ||
@@ -9,2 +10,3 @@ id: 'attr-invalid', | ||
const commonAttributes = html_element_attributes_1.htmlElementAttributes['*'] || []; | ||
const eventAttributes = html_event_attributes_1.htmlEventAttributes || []; | ||
parser.addListener('tagstart', (event) => { | ||
@@ -14,4 +16,14 @@ const tagName = event.tagName.toLowerCase(); | ||
const specificAttributes = html_element_attributes_1.htmlElementAttributes[tagName] || []; | ||
const validAttributesForTag = [...commonAttributes, ...specificAttributes]; | ||
const validAttributesForTag = [ | ||
...commonAttributes, | ||
...eventAttributes, | ||
...specificAttributes, | ||
]; | ||
for (const attr of attrs) { | ||
if (/^data-.+$/.test(attr.name)) | ||
continue; | ||
if (/^aria-.+$|^role$/.test(attr.name)) | ||
continue; | ||
if (/^adapt-.+$/.test(attr.name)) | ||
continue; | ||
if (!validAttributesForTag.includes(attr.name)) { | ||
@@ -24,2 +36,2 @@ reporter.error(`The attribute [ ${attr.name} ] is not valid for the tag [ ${tagName} ].`, event.line, event.col + event.tagName.length + 1 + attr.index, this, attr.raw); | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0ci1pbnZhbGlkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvcmUvcnVsZXMvYXR0ci1pbnZhbGlkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQ0EscUVBQStEO0FBRS9ELGtCQUFlO0lBQ2IsRUFBRSxFQUFFLGNBQWM7SUFDbEIsV0FBVyxFQUFFLG1EQUFtRDtJQUNoRSxJQUFJLENBQUMsTUFBTSxFQUFFLFFBQVE7UUFDbkIsTUFBTSxnQkFBZ0IsR0FBRywrQ0FBcUIsQ0FBQyxHQUFHLENBQUMsSUFBSSxFQUFFLENBQUE7UUFFekQsTUFBTSxDQUFDLFdBQVcsQ0FBQyxVQUFVLEVBQUUsQ0FBQyxLQUFLLEVBQUUsRUFBRTtZQUN2QyxNQUFNLE9BQU8sR0FBRyxLQUFLLENBQUMsT0FBTyxDQUFDLFdBQVcsRUFBRSxDQUFBO1lBQzNDLE1BQU0sS0FBSyxHQUFHLEtBQUssQ0FBQyxLQUFLLENBQUE7WUFHekIsTUFBTSxrQkFBa0IsR0FBRywrQ0FBcUIsQ0FBQyxPQUFPLENBQUMsSUFBSSxFQUFFLENBQUE7WUFFL0QsTUFBTSxxQkFBcUIsR0FBRyxDQUFDLEdBQUcsZ0JBQWdCLEVBQUUsR0FBRyxrQkFBa0IsQ0FBQyxDQUFBO1lBRTFFLEtBQUssTUFBTSxJQUFJLElBQUksS0FBSyxFQUFFO2dCQUN4QixJQUFJLENBQUMscUJBQXFCLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsRUFBRTtvQkFDOUMsUUFBUSxDQUFDLEtBQUssQ0FDWixtQkFBbUIsSUFBSSxDQUFDLElBQUksaUNBQWlDLE9BQU8sS0FBSyxFQUN6RSxLQUFLLENBQUMsSUFBSSxFQUNWLEtBQUssQ0FBQyxHQUFHLEdBQUcsS0FBSyxDQUFDLE9BQU8sQ0FBQyxNQUFNLEdBQUcsQ0FBQyxHQUFHLElBQUksQ0FBQyxLQUFLLEVBQ2pELElBQUksRUFDSixJQUFJLENBQUMsR0FBRyxDQUNULENBQUE7aUJBQ0Y7YUFDRjtRQUNILENBQUMsQ0FBQyxDQUFBO0lBQ0osQ0FBQztDQUNNLENBQUEifQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0ci1pbnZhbGlkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvcmUvcnVsZXMvYXR0ci1pbnZhbGlkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQ0EscUVBQStEO0FBQy9ELGlFQUEyRDtBQUUzRCxrQkFBZTtJQUNiLEVBQUUsRUFBRSxjQUFjO0lBQ2xCLFdBQVcsRUFBRSxtREFBbUQ7SUFDaEUsSUFBSSxDQUFDLE1BQU0sRUFBRSxRQUFRO1FBQ25CLE1BQU0sZ0JBQWdCLEdBQUcsK0NBQXFCLENBQUMsR0FBRyxDQUFDLElBQUksRUFBRSxDQUFBO1FBQ3pELE1BQU0sZUFBZSxHQUFHLDJDQUFtQixJQUFJLEVBQUUsQ0FBQTtRQUVqRCxNQUFNLENBQUMsV0FBVyxDQUFDLFVBQVUsRUFBRSxDQUFDLEtBQUssRUFBRSxFQUFFO1lBQ3ZDLE1BQU0sT0FBTyxHQUFHLEtBQUssQ0FBQyxPQUFPLENBQUMsV0FBVyxFQUFFLENBQUE7WUFDM0MsTUFBTSxLQUFLLEdBQUcsS0FBSyxDQUFDLEtBQUssQ0FBQTtZQUd6QixNQUFNLGtCQUFrQixHQUFHLCtDQUFxQixDQUFDLE9BQU8sQ0FBQyxJQUFJLEVBQUUsQ0FBQTtZQUMvRCxNQUFNLHFCQUFxQixHQUFHO2dCQUM1QixHQUFHLGdCQUFnQjtnQkFDbkIsR0FBRyxlQUFlO2dCQUNsQixHQUFHLGtCQUFrQjthQUN0QixDQUFBO1lBRUQsS0FBSyxNQUFNLElBQUksSUFBSSxLQUFLLEVBQUU7Z0JBRXhCLElBQUksV0FBVyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDO29CQUFFLFNBQVE7Z0JBQ3pDLElBQUksa0JBQWtCLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUM7b0JBQUUsU0FBUTtnQkFDaEQsSUFBSSxZQUFZLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUM7b0JBQUUsU0FBUTtnQkFFMUMsSUFBSSxDQUFDLHFCQUFxQixDQUFDLFFBQVEsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLEVBQUU7b0JBQzlDLFFBQVEsQ0FBQyxLQUFLLENBQ1osbUJBQW1CLElBQUksQ0FBQyxJQUFJLGlDQUFpQyxPQUFPLEtBQUssRUFDekUsS0FBSyxDQUFDLElBQUksRUFDVixLQUFLLENBQUMsR0FBRyxHQUFHLEtBQUssQ0FBQyxPQUFPLENBQUMsTUFBTSxHQUFHLENBQUMsR0FBRyxJQUFJLENBQUMsS0FBSyxFQUNqRCxJQUFJLEVBQ0osSUFBSSxDQUFDLEdBQUcsQ0FDVCxDQUFBO2lCQUNGO2FBQ0Y7UUFDSCxDQUFDLENBQUMsQ0FBQTtJQUNKLENBQUM7Q0FDTSxDQUFBIn0= |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).HTMLHint=t()}(this,(function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function t(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})})),t}var a={},r={};Object.defineProperty(r,"__esModule",{value:!0});r.default=class{constructor(){this._listeners={},this._mapCdataTags=this.makeMap("script,style"),this._arrBlocks=[],this.lastEvent=null}makeMap(e){const t={},a=e.split(",");for(let e=0;e<a.length;e++)t[a[e]]=!0;return t}parse(e){const t=this._mapCdataTags,a=/<(?:\/([^\s>]+)\s*|!--([\s\S]*?)--|!([^>]*?)|([\w\-:]+)((?:\s+[^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'>]*))?)*?)\s*(\/?))>/g,r=/\s*([^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+)(?:\s*=\s*(?:(")([^"]*)"|(')([^']*)'|([^\s"'>]*)))?/g,n=/\r?\n/g;let i,s,l,o,d,c,u=0,g=null,f=[],p=0,h=0,m=1;const b=this._arrBlocks;this.fire("start",{pos:0,line:1,col:1});const v=()=>{const e=o.find((e=>"type"===e.name))||{value:""};return t[l]&&-1===e.value.indexOf("text/ng-template")},y=(e,t,a,r)=>{const i=a-h+1;for(void 0===r&&(r={}),r.raw=t,r.pos=a,r.line=m,r.col=i,b.push(r),this.fire(e,r);n.exec(t);)m++,h=a+n.lastIndex};for(;i=a.exec(e);)if(s=i.index,s>u&&(c=e.substring(u,s),g?f.push(c):y("text",c,u)),u=a.lastIndex,!(l=i[1])||(g&&l===g&&(c=f.join(""),y("cdata",c,p,{tagName:g,attrs:d}),g=null,d=void 0,f=[]),g))if(g)f.push(i[0]);else if(l=i[4]){o=[];const e=i[5];let t,a=0;for(;t=r.exec(e);){const e=t[1],r=t[2]?t[2]:t[4]?t[4]:"",n=t[3]?t[3]:t[5]?t[5]:t[6]?t[6]:"";o.push({name:e,value:n,quote:r,index:t.index,raw:t[0]}),a+=t[0].length}a===e.length?(y("tagstart",i[0],s,{tagName:l,attrs:o,close:i[6]}),v()&&(g=l,d=o.concat(),f=[],p=u)):y("text",i[0],s)}else(i[2]||i[3])&&y("comment",i[0],s,{content:i[2]||i[3],long:!!i[2]});else y("tagend",i[0],s,{tagName:l});e.length>u&&(c=e.substring(u,e.length),y("text",c,u)),this.fire("end",{pos:u,line:m,col:e.length-h+1})}addListener(e,t){const a=this._listeners,r=e.split(/[,\s]/);let n;for(let e=0,i=r.length;e<i;e++)n=r[e],void 0===a[n]&&(a[n]=[]),a[n].push(t)}fire(e,t){void 0===t&&(t={}),t.type=e;let a=[];const r=this._listeners[e],n=this._listeners.all;void 0!==r&&(a=a.concat(r)),void 0!==n&&(a=a.concat(n));const i=this.lastEvent;null!==i&&(delete i.lastEvent,t.lastEvent=i),this.lastEvent=t;for(let e=0,r=a.length;e<r;e++)a[e].call(this,t)}removeListener(e,t){const a=this._listeners[e];if(void 0!==a)for(let e=0,r=a.length;e<r;e++)if(a[e]===t){a.splice(e,1);break}}fixPos(e,t){const a=e.raw.substr(0,t).split(/\r?\n/),r=a.length-1;let n,i=e.line;return r>0?(i+=r,n=a[r].length+1):n=e.col+t,{line:i,col:n}}getMapAttrs(e){const t={};let a;for(let r=0,n=e.length;r<n;r++)a=e[r],t[a.name]=a.value;return t}};var n={};Object.defineProperty(n,"__esModule",{value:!0});n.default=class{constructor(e,t){this.html=e,this.lines=e.split(/\r?\n/);const a=/\r?\n/.exec(e);this.brLen=null!==a?a[0].length:0,this.ruleset=t,this.messages=[]}info(e,t,a,r,n){this.report("info",e,t,a,r,n)}warn(e,t,a,r,n){this.report("warning",e,t,a,r,n)}error(e,t,a,r,n){this.report("error",e,t,a,r,n)}report(e,t,a,r,n,i){const s=this.lines,l=this.brLen;let o="",d=0;for(let e=a-1,t=s.length;e<t&&(o=s[e],d=o.length,r>d&&a<t);e++)a++,1!==(r-=d)&&(r-=l);this.messages.push({type:e,message:t,raw:i,evidence:o,line:a,col:r,rule:{id:n.id,description:n.description,link:`https://htmlhint.com/docs/user-guide/rules/${n.id}`}})}};var i={},s={};Object.defineProperty(s,"__esModule",{value:!0}),s.default={id:"alt-require",description:"The alt attribute of an <img> element must be present and alt attribute of area[href] and input[type=image] must have a value.",init(e,t){e.addListener("tagstart",(a=>{const r=a.tagName.toLowerCase(),n=e.getMapAttrs(a.attrs),i=a.col+r.length+1;let s;"img"!==r||"alt"in n?("area"===r&&"href"in n||"input"===r&&"image"===n.type)&&("alt"in n&&""!==n.alt||(s="area"===r?"area[href]":"input[type=image]",t.warn(`The alt attribute of ${s} must have a value.`,a.line,i,this,a.raw))):t.warn("An alt attribute must be present on <img> elements.",a.line,i,this,a.raw)}))}};var l={};Object.defineProperty(l,"__esModule",{value:!0});const o=["allowReorder","attributeName","attributeType","autoReverse","baseFrequency","baseProfile","calcMode","clipPath","clipPathUnits","contentScriptType","contentStyleType","diffuseConstant","edgeMode","externalResourcesRequired","filterRes","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","onBlur","onChange","onClick","onFocus","onKeyUp","onLoad","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"];function d(e,t){if(t instanceof RegExp)return!!t.test(e)&&{match:e,pattern:t};const a=t[0],r=t[t.length-1],n=t[t.length-2],i="/"===a&&("/"===r||"/"===n&&"i"===r);if(i){return i&&"i"===r?new RegExp(t.slice(1,-2),"i").test(e):new RegExp(t.slice(1,-1)).test(e)}return e===t}l.default={id:"attr-lowercase",description:"All attribute names must be in lowercase.",init(e,t,a){const r=(Array.isArray(a)?a:[]).concat(o);e.addListener("tagstart",(e=>{const a=e.attrs;let n;const i=e.col+e.tagName.length+1;for(let s=0,l=a.length;s<l;s++){n=a[s];const l=n.name;r.find((e=>d(l,e)))||l===l.toLowerCase()||t.error(`The attribute name of [ ${l} ] must be in lowercase.`,e.line,i+n.index,this,n.raw)}}))}};var c={};Object.defineProperty(c,"__esModule",{value:!0}),c.default={id:"attr-sorted",description:"Attribute tags must be in proper order.",init(e,t){const a={},r=["class","id","name","src","for","type","href","value","title","alt","role"];for(let e=0;e<r.length;e++)a[r[e]]=e;e.addListener("tagstart",(e=>{const r=e.attrs,n=[];for(let e=0;e<r.length;e++)n.push(r[e].name);const i=JSON.stringify(n);n.sort(((e,t)=>null==a[e]&&null==a[t]?0:null==a[e]?1:null==a[t]?-1:a[e]-a[t]||e.localeCompare(t))),i!==JSON.stringify(n)&&t.error(`Inaccurate order ${i} should be in hierarchy ${JSON.stringify(n)} `,e.line,e.col,this,e.raw)}))}};var u={};Object.defineProperty(u,"__esModule",{value:!0}),u.default={id:"attr-no-duplication",description:"Elements cannot have duplicate attributes.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r,n;const i=e.col+e.tagName.length+1,s={};for(let l=0,o=a.length;l<o;l++)r=a[l],n=r.name,!0===s[n]&&t.error(`Duplicate of attribute name [ ${r.name} ] was found.`,e.line,i+r.index,this,r.raw),s[n]=!0}))}};var g={};Object.defineProperty(g,"__esModule",{value:!0}),g.default={id:"attr-unsafe-chars",description:"Attribute values cannot contain unsafe chars.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1,i=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;let s;for(let l=0,o=a.length;l<o;l++)if(r=a[l],s=i.exec(r.value),null!==s){const a=escape(s[0]).replace(/%u/,"\\u").replace(/%/,"\\x");t.warn(`The value of attribute [ ${r.name} ] cannot contain an unsafe char [ ${a} ].`,e.line,n+r.index,this,r.raw)}}))}};var f={};Object.defineProperty(f,"__esModule",{value:!0}),f.default={id:"attr-value-double-quotes",description:"Attribute values must be in double quotes.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;for(let i=0,s=a.length;i<s;i++)r=a[i],(""!==r.value&&'"'!==r.quote||""===r.value&&"'"===r.quote)&&t.error(`The value of attribute [ ${r.name} ] must be in double quotes.`,e.line,n+r.index,this,r.raw)}))}};var p={};Object.defineProperty(p,"__esModule",{value:!0}),p.default={id:"attr-value-not-empty",description:"All attributes must have values.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;for(let i=0,s=a.length;i<s;i++)r=a[i],""===r.quote&&""===r.value&&t.warn(`The attribute [ ${r.name} ] must have a value.`,e.line,n+r.index,this,r.raw)}))}};var h={};Object.defineProperty(h,"__esModule",{value:!0}),h.default={id:"attr-value-single-quotes",description:"Attribute values must be in single quotes.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;for(let i=0,s=a.length;i<s;i++)r=a[i],(""!==r.value&&"'"!==r.quote||""===r.value&&'"'===r.quote)&&t.error(`The value of attribute [ ${r.name} ] must be in single quotes.`,e.line,n+r.index,this,r.raw)}))}};var m={};Object.defineProperty(m,"__esModule",{value:!0}),m.default={id:"attr-whitespace",description:"All attributes should be separated by only one space and not have leading/trailing whitespace.",init(e,t,a){const r=Array.isArray(a)?a:[];e.addListener("tagstart",(e=>{const a=e.attrs;let n;const i=e.col+e.tagName.length+1;a.forEach((a=>{n=a;const s=a.name;-1===r.indexOf(s)&&(a.value.trim()!==a.value&&t.error(`The attributes of [ ${s} ] must not have leading or trailing whitespace.`,e.line,i+n.index,this,n.raw),a.value.replace(/ +(?= )/g,"")!==a.value&&t.error(`The attributes of [ ${s} ] must be separated by only one space.`,e.line,i+n.index,this,n.raw))}))}))}};var b={};Object.defineProperty(b,"__esModule",{value:!0}),b.default={id:"doctype-first",description:"Doctype must be declared first.",init(e,t){const a=r=>{"start"===r.type||"text"===r.type&&/^\s*$/.test(r.raw)||(("comment"!==r.type&&!1===r.long||!1===/^DOCTYPE\s+/i.test(r.content))&&t.error("Doctype must be declared first.",r.line,r.col,this,r.raw),e.removeListener("all",a))};e.addListener("all",a)}};var v={};Object.defineProperty(v,"__esModule",{value:!0}),v.default={id:"doctype-html5",description:'Invalid doctype. Use: "<!DOCTYPE html>"',init(e,t){const a=e=>{!1===e.long&&"doctype html"!==e.content.toLowerCase()&&t.warn('Invalid doctype. Use: "<!DOCTYPE html>"',e.line,e.col,this,e.raw)},r=()=>{e.removeListener("comment",a),e.removeListener("tagstart",r)};e.addListener("all",a),e.addListener("tagstart",r)}};var y={};Object.defineProperty(y,"__esModule",{value:!0}),y.default={id:"head-script-disabled",description:"The <script> tag cannot be used in a <head> tag.",init(e,t){const a=/^(text\/javascript|application\/javascript)$/i;let r=!1;const n=n=>{const i=e.getMapAttrs(n.attrs).type,s=n.tagName.toLowerCase();"head"===s&&(r=!0),!0!==r||"script"!==s||i&&!0!==a.test(i)||t.warn("The <script> tag cannot be used in a <head> tag.",n.line,n.col,this,n.raw)},i=t=>{"head"===t.tagName.toLowerCase()&&(e.removeListener("tagstart",n),e.removeListener("tagend",i))};e.addListener("tagstart",n),e.addListener("tagend",i)}};var w={};Object.defineProperty(w,"__esModule",{value:!0}),w.default={id:"href-abs-or-rel",description:"An href attribute must be either absolute or relative.",init(e,t,a){const r="abs"===a?"absolute":"relative";e.addListener("tagstart",(e=>{const a=e.attrs;let n;const i=e.col+e.tagName.length+1;for(let s=0,l=a.length;s<l;s++)if(n=a[s],"href"===n.name){("absolute"===r&&!1===/^\w+?:/.test(n.value)||"relative"===r&&!0===/^https?:\/\//.test(n.value))&&t.warn(`The value of the href attribute [ ${n.value} ] must be ${r}.`,e.line,i+n.index,this,n.raw);break}}))}};var x={};Object.defineProperty(x,"__esModule",{value:!0});x.default={id:"html-lang-require",description:"The lang attribute of an <html> element must be present and should be valid.",init(e,t){e.addListener("tagstart",(a=>{const r=a.tagName.toLowerCase(),n=e.getMapAttrs(a.attrs),i=a.col+r.length+1,s=new RegExp("((?<grandfathered>(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUse>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUse2>x(-[A-Za-z0-9]{1,8})+))","g");"html"===r&&("lang"in n?n.lang?s.test(n.lang)||t.warn("The lang attribute value of <html> element must be a valid BCP47.",a.line,i,this,a.raw):t.warn("The lang attribute of <html> element must have a value.",a.line,i,this,a.raw):t.warn("An lang attribute must be present on <html> elements.",a.line,i,this,a.raw))}))}};var O={};Object.defineProperty(O,"__esModule",{value:!0}),O.default={id:"id-class-ad-disabled",description:"The id and class attributes cannot use the ad keyword, it will be blocked by adblock software.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r,n;const i=e.col+e.tagName.length+1;for(let s=0,l=a.length;s<l;s++)r=a[s],n=r.name,/^(id|class)$/i.test(n)&&/(^|[-_])ad([-_]|$)/i.test(r.value)&&t.warn(`The value of attribute ${n} cannot use the ad keyword.`,e.line,i+r.index,this,r.raw)}))}};var L={};Object.defineProperty(L,"__esModule",{value:!0}),L.default={id:"id-class-value",description:"The id and class attribute values must meet the specified rules.",init(e,t,a){let r;if(r="string"==typeof a?{underline:{regId:/^[a-z\d]+(_[a-z\d]+)*$/,message:"The id and class attribute values must be in lowercase and split by an underscore."},dash:{regId:/^[a-z\d]+(-[a-z\d]+)*$/,message:"The id and class attribute values must be in lowercase and split by a dash."},hump:{regId:/^[a-z][a-zA-Z\d]*([A-Z][a-zA-Z\d]*)*$/,message:"The id and class attribute values must meet the camelCase style."}}[a]:a,"object"==typeof r&&r.regId){let a=r.regId;const n=r.message;a instanceof RegExp||(a=new RegExp(a)),e.addListener("tagstart",(e=>{const r=e.attrs;let i;const s=e.col+e.tagName.length+1;for(let l=0,o=r.length;l<o;l++)if(i=r[l],"id"===i.name.toLowerCase()&&!1===a.test(i.value)&&t.warn(n,e.line,s+i.index,this,i.raw),"class"===i.name.toLowerCase()){const r=i.value.split(/\s+/g);let l;for(let o=0,d=r.length;o<d;o++)l=r[o],l&&!1===a.test(l)&&t.warn(n,e.line,s+i.index,this,l)}}))}}};var j={};Object.defineProperty(j,"__esModule",{value:!0}),j.default={id:"id-unique",description:"The value of id attributes must be unique.",init(e,t){const a={};e.addListener("tagstart",(e=>{const r=e.attrs;let n,i;const s=e.col+e.tagName.length+1;for(let l=0,o=r.length;l<o;l++)if(n=r[l],"id"===n.name.toLowerCase()){i=n.value,i&&(void 0===a[i]?a[i]=1:a[i]++,a[i]>1&&t.error(`The id value [ ${i} ] must be unique.`,e.line,s+n.index,this,n.raw));break}}))}};var _={};Object.defineProperty(_,"__esModule",{value:!0}),_.default={id:"inline-script-disabled",description:"Inline script cannot be used.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;let i;const s=/^on(unload|message|submit|select|scroll|resize|mouseover|mouseout|mousemove|mouseleave|mouseenter|mousedown|load|keyup|keypress|keydown|focus|dblclick|click|change|blur|error)$/i;for(let l=0,o=a.length;l<o;l++)r=a[l],i=r.name.toLowerCase(),!0===s.test(i)?t.warn(`Inline script [ ${r.raw} ] cannot be used.`,e.line,n+r.index,this,r.raw):"src"!==i&&"href"!==i||/^\s*javascript:/i.test(r.value)&&t.warn(`Inline script [ ${r.raw} ] cannot be used.`,e.line,n+r.index,this,r.raw)}))}};var P={};Object.defineProperty(P,"__esModule",{value:!0}),P.default={id:"inline-style-disabled",description:"Inline style cannot be used.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;for(let i=0,s=a.length;i<s;i++)r=a[i],"style"===r.name.toLowerCase()&&t.warn(`Inline style [ ${r.raw} ] cannot be used.`,e.line,n+r.index,this,r.raw)}))}};var T={};Object.defineProperty(T,"__esModule",{value:!0}),T.default={id:"input-requires-label",description:"All [ input ] tags must have a corresponding [ label ] tag. ",init(e,t){const a=[],r=[];e.addListener("tagstart",(t=>{const n=t.tagName.toLowerCase(),i=e.getMapAttrs(t.attrs),s=t.col+n.length+1;"input"===n&&"hidden"!==i.type&&r.push({event:t,col:s,id:i.id}),"label"===n&&"for"in i&&""!==i.for&&a.push({event:t,col:s,forValue:i.for})})),e.addListener("end",(()=>{r.forEach((e=>{(function(e){let t=!1;return a.forEach((a=>{e.id&&e.id===a.forValue&&(t=!0)})),t})(e)||t.warn("No matching [ label ] tag found.",e.event.line,e.col,this,e.event.raw)}))}))}};var $={};Object.defineProperty($,"__esModule",{value:!0}),$.default={id:"script-disabled",description:"The <script> tag cannot be used.",init(e,t){e.addListener("tagstart",(e=>{"script"===e.tagName.toLowerCase()&&t.error("The <script> tag cannot be used.",e.line,e.col,this,e.raw)}))}};var A={};Object.defineProperty(A,"__esModule",{value:!0}),A.default={id:"space-tab-mixed-disabled",description:"Do not mix tabs and spaces for indentation.",init(e,t,a){let r="nomix",n=null;if("string"==typeof a){const e=/^([a-z]+)(\d+)?/.exec(a);e&&(r=e[1],n=e[2]&&parseInt(e[2],10))}e.addListener("text",(a=>{const i=a.raw,s=/(^|\r?\n)([ \t]+)/g;let l;for(;l=s.exec(i);){const i=e.fixPos(a,l.index+l[1].length);if(1!==i.col)continue;const s=l[2];"space"===r?n?!1!==/^ +$/.test(s)&&s.length%n==0||t.warn(`Please use space for indentation and keep ${n} length.`,i.line,1,this,a.raw):!1===/^ +$/.test(s)&&t.warn("Please use space for indentation.",i.line,1,this,a.raw):"tab"===r&&!1===/^\t+$/.test(s)?t.warn("Please use tab for indentation.",i.line,1,this,a.raw):!0===/ +\t|\t+ /.test(s)&&t.warn("Do not mix tabs and spaces for indentation.",i.line,1,this,a.raw)}}))}};var k={};Object.defineProperty(k,"__esModule",{value:!0}),k.default={id:"spec-char-escape",description:"Special characters must be escaped.",init(e,t){e.addListener("text",(a=>{const r=a.raw,n=/([<>])|( \& )/g;let i;for(;i=n.exec(r);){const r=e.fixPos(a,i.index);t.error(`Special characters must be escaped : [ ${i[0]} ].`,r.line,r.col,this,a.raw)}}))}};var M={};Object.defineProperty(M,"__esModule",{value:!0}),M.default={id:"src-not-empty",description:"The src attribute of an img(script,link) must have a value.",init(e,t){e.addListener("tagstart",(e=>{const a=e.tagName,r=e.attrs;let n;const i=e.col+a.length+1;for(let s=0,l=r.length;s<l;s++)n=r[s],(!0===/^(img|script|embed|bgsound|iframe)$/.test(a)&&"src"===n.name||"link"===a&&"href"===n.name||"object"===a&&"data"===n.name)&&""===n.value&&t.error(`The attribute [ ${n.name} ] of the tag [ ${a} ] must have a value.`,e.line,i+n.index,this,n.raw)}))}};var N={};Object.defineProperty(N,"__esModule",{value:!0}),N.default={id:"style-disabled",description:"<style> tags cannot be used.",init(e,t){e.addListener("tagstart",(e=>{"style"===e.tagName.toLowerCase()&&t.warn("The <style> tag cannot be used.",e.line,e.col,this,e.raw)}))}};var C={};Object.defineProperty(C,"__esModule",{value:!0}),C.default={id:"tag-pair",description:"Tag must be paired.",init(e,t){const a=[],r=e.makeMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr");e.addListener("tagstart",(e=>{const t=e.tagName.toLowerCase();void 0!==r[t]||e.close||a.push({tagName:t,line:e.line,raw:e.raw})})),e.addListener("tagend",(e=>{const r=e.tagName.toLowerCase();let n;for(n=a.length-1;n>=0&&a[n].tagName!==r;n--);if(n>=0){const r=[];for(let e=a.length-1;e>n;e--)r.push(`</${a[e].tagName}>`);if(r.length>0){const n=a[a.length-1];t.error(`Tag must be paired, missing: [ ${r.join("")} ], start tag match failed [ ${n.raw} ] on line ${n.line}.`,e.line,e.col,this,e.raw)}a.length=n}else t.error(`Tag must be paired, no start tag: [ ${e.raw} ]`,e.line,e.col,this,e.raw)})),e.addListener("end",(e=>{const r=[];for(let e=a.length-1;e>=0;e--)r.push(`</${a[e].tagName}>`);if(r.length>0){const n=a[a.length-1];t.error(`Tag must be paired, missing: [ ${r.join("")} ], open tag match failed [ ${n.raw} ] on line ${n.line}.`,e.line,e.col,this,"")}}))}};var q={};Object.defineProperty(q,"__esModule",{value:!0}),q.default={id:"tag-self-close",description:"Empty tags must be self closed.",init(e,t){const a=e.makeMap("area,base,basefont,bgsound,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr");e.addListener("tagstart",(e=>{const r=e.tagName.toLowerCase();void 0!==a[r]&&(e.close||t.warn(`The empty tag : [ ${r} ] must be self closed.`,e.line,e.col,this,e.raw))}))}};var E={};Object.defineProperty(E,"__esModule",{value:!0}),E.default={id:"empty-tag-not-self-closed",description:"Empty tags must not use self closed syntax.",init(e,t){const a=e.makeMap("area,base,basefont,bgsound,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr");e.addListener("tagstart",(e=>{const r=e.tagName.toLowerCase();void 0!==a[r]&&e.close&&t.error(`The empty tag : [ ${r} ] must not use self closed syntax.`,e.line,e.col,this,e.raw)}))}};var z={};Object.defineProperty(z,"__esModule",{value:!0}),z.default={id:"tagname-lowercase",description:"All html element names must be in lowercase.",init(e,t,a){const r=Array.isArray(a)?a:[];e.addListener("tagstart,tagend",(e=>{const a=e.tagName;-1===r.indexOf(a)&&a!==a.toLowerCase()&&t.error(`The html element name of [ ${a} ] must be in lowercase.`,e.line,e.col,this,e.raw)}))}};var R={};Object.defineProperty(R,"__esModule",{value:!0}),R.default={id:"tagname-specialchars",description:"All special characters must be escaped.",init(e,t){const a=/[^a-zA-Z0-9\-:_]/;e.addListener("tagstart,tagend",(e=>{const r=e.tagName;a.test(r)&&t.error(`The html element name of [ ${r} ] contains special character.`,e.line,e.col,this,e.raw)}))}};var D={};Object.defineProperty(D,"__esModule",{value:!0}),D.default={id:"title-require",description:"<title> must be present in <head> tag.",init(e,t){let a=!1,r=!1;const n=e=>{const t=e.tagName.toLowerCase();"head"===t?a=!0:"title"===t&&a&&(r=!0)},i=a=>{const s=a.tagName.toLowerCase();if(r&&"title"===s){const e=a.lastEvent;("text"!==e.type||"text"===e.type&&!0===/^\s*$/.test(e.raw))&&t.error("<title></title> must not be empty.",a.line,a.col,this,a.raw)}else"head"===s&&(!1===r&&t.error("<title> must be present in <head> tag.",a.line,a.col,this,a.raw),e.removeListener("tagstart",n),e.removeListener("tagend",i))};e.addListener("tagstart",n),e.addListener("tagend",i)}};var S={};Object.defineProperty(S,"__esModule",{value:!0});let U={a:{selfclosing:!1,attrsRequired:["href","title"],redundantAttrs:["alt"]},div:{selfclosing:!1},main:{selfclosing:!1,redundantAttrs:["role"]},nav:{selfclosing:!1,redundantAttrs:["role"]},script:{attrsOptional:[["async","async"],["defer","defer"]]},img:{selfclosing:!0,attrsRequired:["src","alt","title"]}};S.default={id:"tags-check",description:"Checks html tags.",init(e,t,a){U=Object.assign(Object.assign({},U),a),e.addListener("tagstart",(e=>{const a=e.attrs,r=e.col+e.tagName.length+1,n=e.tagName.toLowerCase();if(U[n]){const i=U[n];if(!0!==i.selfclosing||e.close?!1===i.selfclosing&&e.close&&t.warn(`The <${n}> tag must not be selfclosing.`,e.line,e.col,this,e.raw):t.warn(`The <${n}> tag must be selfclosing.`,e.line,e.col,this,e.raw),Array.isArray(i.attrsRequired)){i.attrsRequired.forEach((i=>{if(Array.isArray(i)){const s=i.map((e=>e)),l=s.shift(),o=s;a.some((e=>e.name===l))?a.forEach((a=>{a.name===l&&-1===o.indexOf(a.value)&&t.error(`The <${n}> tag must have attr '${l}' with one value of '${o.join("' or '")}'.`,e.line,r,this,e.raw)})):t.error(`The <${n}> tag must have attr '${l}'.`,e.line,r,this,e.raw)}else a.some((e=>-1!==i.split("|").indexOf(e.name)))||t.error(`The <${n}> tag must have attr '${i}'.`,e.line,r,this,e.raw)}))}if(Array.isArray(i.attrsOptional)){i.attrsOptional.forEach((i=>{if(Array.isArray(i)){const s=i.map((e=>e)),l=s.shift(),o=s;a.some((e=>e.name===l))&&a.forEach((a=>{a.name===l&&-1===o.indexOf(a.value)&&t.error(`The <${n}> tag must have optional attr '${l}' with one value of '${o.join("' or '")}'.`,e.line,r,this,e.raw)}))}}))}if(Array.isArray(i.redundantAttrs)){i.redundantAttrs.forEach((i=>{a.some((e=>e.name===i))&&t.error(`The attr '${i}' is redundant for <${n}> and should be omitted.`,e.line,r,this,e.raw)}))}}}))}};var H={};Object.defineProperty(H,"__esModule",{value:!0}),H.default={id:"attr-no-unnecessary-whitespace",description:"No spaces between attribute names and values.",init(e,t,a){const r=Array.isArray(a)?a:[];e.addListener("tagstart",(e=>{const a=e.attrs,n=e.col+e.tagName.length+1;for(let i=0;i<a.length;i++)if(-1===r.indexOf(a[i].name)){const r=/(\s*)=(\s*)/.exec(a[i].raw.trim());!r||0===r[1].length&&0===r[2].length||t.error(`The attribute '${a[i].name}' must not have spaces between the name and value.`,e.line,n+a[i].index,this,a[i].raw)}}))}};var I={};var Z=t(Object.freeze({__proto__:null,htmlElementAttributes:{"*":["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","popover","slot","spellcheck","style","tabindex","title","translate"],a:["charset","coords","download","href","hreflang","name","ping","referrerpolicy","rel","rev","shape","target","type"],applet:["align","alt","archive","code","codebase","height","hspace","name","object","vspace","width"],area:["alt","coords","download","href","hreflang","nohref","ping","referrerpolicy","rel","shape","target","type"],audio:["autoplay","controls","crossorigin","loop","muted","preload","src"],base:["href","target"],basefont:["color","face","size"],blockquote:["cite"],body:["alink","background","bgcolor","link","text","vlink"],br:["clear"],button:["disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","name","popovertarget","popovertargetaction","type","value"],canvas:["height","width"],caption:["align"],col:["align","char","charoff","span","valign","width"],colgroup:["align","char","charoff","span","valign","width"],data:["value"],del:["cite","datetime"],details:["open"],dialog:["open"],dir:["compact"],div:["align"],dl:["compact"],embed:["height","src","type","width"],fieldset:["disabled","form","name"],font:["color","face","size"],form:["accept","accept-charset","action","autocomplete","enctype","method","name","novalidate","target"],frame:["frameborder","longdesc","marginheight","marginwidth","name","noresize","scrolling","src"],frameset:["cols","rows"],h1:["align"],h2:["align"],h3:["align"],h4:["align"],h5:["align"],h6:["align"],head:["profile"],hr:["align","noshade","size","width"],html:["manifest","version"],iframe:["align","allow","allowfullscreen","allowpaymentrequest","allowusermedia","frameborder","height","loading","longdesc","marginheight","marginwidth","name","referrerpolicy","sandbox","scrolling","src","srcdoc","width"],img:["align","alt","border","crossorigin","decoding","fetchpriority","height","hspace","ismap","loading","longdesc","name","referrerpolicy","sizes","src","srcset","usemap","vspace","width"],input:["accept","align","alt","autocomplete","checked","dirname","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","ismap","list","max","maxlength","min","minlength","multiple","name","pattern","placeholder","popovertarget","popovertargetaction","readonly","required","size","src","step","type","usemap","value","width"],ins:["cite","datetime"],isindex:["prompt"],label:["for","form"],legend:["align"],li:["type","value"],link:["as","blocking","charset","color","crossorigin","disabled","fetchpriority","href","hreflang","imagesizes","imagesrcset","integrity","media","referrerpolicy","rel","rev","sizes","target","type"],map:["name"],menu:["compact"],meta:["charset","content","http-equiv","media","name","scheme"],meter:["high","low","max","min","optimum","value"],object:["align","archive","border","classid","codebase","codetype","data","declare","form","height","hspace","name","standby","type","typemustmatch","usemap","vspace","width"],ol:["compact","reversed","start","type"],optgroup:["disabled","label"],option:["disabled","label","selected","value"],output:["for","form","name"],p:["align"],param:["name","type","value","valuetype"],pre:["width"],progress:["max","value"],q:["cite"],script:["async","blocking","charset","crossorigin","defer","fetchpriority","integrity","language","nomodule","referrerpolicy","src","type"],select:["autocomplete","disabled","form","multiple","name","required","size"],slot:["name"],source:["height","media","sizes","src","srcset","type","width"],style:["blocking","media","type"],table:["align","bgcolor","border","cellpadding","cellspacing","frame","rules","summary","width"],tbody:["align","char","charoff","valign"],td:["abbr","align","axis","bgcolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"],textarea:["autocomplete","cols","dirname","disabled","form","maxlength","minlength","name","placeholder","readonly","required","rows","wrap"],tfoot:["align","char","charoff","valign"],th:["abbr","align","axis","bgcolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"],thead:["align","char","charoff","valign"],time:["datetime"],tr:["align","bgcolor","char","charoff","valign"],track:["default","kind","label","src","srclang"],ul:["compact","type"],video:["autoplay","controls","crossorigin","height","loop","muted","playsinline","poster","preload","src","width"]}}));Object.defineProperty(I,"__esModule",{value:!0});const F=Z;I.default={id:"attr-invalid",description:"Attributes must be valid for the given HTML tags.",init(e,t){const a=F.htmlElementAttributes["*"]||[];e.addListener("tagstart",(e=>{const r=e.tagName.toLowerCase(),n=e.attrs,i=F.htmlElementAttributes[r]||[],s=[...a,...i];for(const a of n)s.includes(a.name)||t.error(`The attribute [ ${a.name} ] is not valid for the tag [ ${r} ].`,e.line,e.col+e.tagName.length+1+a.index,this,a.raw)}))}};var V={};Object.defineProperty(V,"__esModule",{value:!0});const B=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"];return V.default={id:"invalid-tag",description:"All tags must be valid HTML tags.",init(e,t){const a=[];e.addListener("tagstart",(e=>{const r=e.tagName;B.includes(r)?a.push(r):t.error(`The tag [ ${r} ] is not a valid HTML tag.`,e.line,e.col,this,e.raw)})),e.addListener("tagend",(e=>{const r=e.tagName;if(B.includes(r)){const e=a.lastIndexOf(r);-1!==e&&a.splice(e,1)}else t.error(`The closing tag [ ${r} ] is not a valid HTML tag.`,e.line,e.col,this,e.raw)})),e.addListener("end",(()=>{a.forEach((e=>{t.error(`The tag [ ${e} ] was opened but never closed.`,0,0,this,"")}))}))}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.invalidTag=e.attrInvalid=e.attrNoUnnecessaryWhitespace=e.tagsCheck=e.titleRequire=e.tagnameSpecialChars=e.tagnameLowercase=e.emptyTagNotSelfClosed=e.tagSelfClose=e.tagPair=e.styleDisabled=e.srcNotEmpty=e.specCharEscape=e.spaceTabMixedDisabled=e.scriptDisabled=e.inputRequiresLabel=e.inlineStyleDisabled=e.inlineScriptDisabled=e.idUnique=e.idClassValue=e.idClsasAdDisabled=e.htmlLangRequire=e.hrefAbsOrRel=e.headScriptDisabled=e.doctypeHTML5=e.doctypeFirst=e.attrWhitespace=e.attrValueSingleQuotes=e.attrValueNotEmpty=e.attrValueDoubleQuotes=e.attrUnsafeChars=e.attrNoDuplication=e.attrSort=e.attrLowercase=e.altRequire=void 0;var t=s;Object.defineProperty(e,"altRequire",{enumerable:!0,get:function(){return t.default}});var a=l;Object.defineProperty(e,"attrLowercase",{enumerable:!0,get:function(){return a.default}});var r=c;Object.defineProperty(e,"attrSort",{enumerable:!0,get:function(){return r.default}});var n=u;Object.defineProperty(e,"attrNoDuplication",{enumerable:!0,get:function(){return n.default}});var i=g;Object.defineProperty(e,"attrUnsafeChars",{enumerable:!0,get:function(){return i.default}});var o=f;Object.defineProperty(e,"attrValueDoubleQuotes",{enumerable:!0,get:function(){return o.default}});var d=p;Object.defineProperty(e,"attrValueNotEmpty",{enumerable:!0,get:function(){return d.default}});var U=h;Object.defineProperty(e,"attrValueSingleQuotes",{enumerable:!0,get:function(){return U.default}});var Z=m;Object.defineProperty(e,"attrWhitespace",{enumerable:!0,get:function(){return Z.default}});var F=b;Object.defineProperty(e,"doctypeFirst",{enumerable:!0,get:function(){return F.default}});var B=v;Object.defineProperty(e,"doctypeHTML5",{enumerable:!0,get:function(){return B.default}});var Y=y;Object.defineProperty(e,"headScriptDisabled",{enumerable:!0,get:function(){return Y.default}});var W=w;Object.defineProperty(e,"hrefAbsOrRel",{enumerable:!0,get:function(){return W.default}});var J=x;Object.defineProperty(e,"htmlLangRequire",{enumerable:!0,get:function(){return J.default}});var Q=O;Object.defineProperty(e,"idClsasAdDisabled",{enumerable:!0,get:function(){return Q.default}});var X=L;Object.defineProperty(e,"idClassValue",{enumerable:!0,get:function(){return X.default}});var G=j;Object.defineProperty(e,"idUnique",{enumerable:!0,get:function(){return G.default}});var K=_;Object.defineProperty(e,"inlineScriptDisabled",{enumerable:!0,get:function(){return K.default}});var ee=P;Object.defineProperty(e,"inlineStyleDisabled",{enumerable:!0,get:function(){return ee.default}});var te=T;Object.defineProperty(e,"inputRequiresLabel",{enumerable:!0,get:function(){return te.default}});var ae=$;Object.defineProperty(e,"scriptDisabled",{enumerable:!0,get:function(){return ae.default}});var re=A;Object.defineProperty(e,"spaceTabMixedDisabled",{enumerable:!0,get:function(){return re.default}});var ne=k;Object.defineProperty(e,"specCharEscape",{enumerable:!0,get:function(){return ne.default}});var ie=M;Object.defineProperty(e,"srcNotEmpty",{enumerable:!0,get:function(){return ie.default}});var se=N;Object.defineProperty(e,"styleDisabled",{enumerable:!0,get:function(){return se.default}});var le=C;Object.defineProperty(e,"tagPair",{enumerable:!0,get:function(){return le.default}});var oe=q;Object.defineProperty(e,"tagSelfClose",{enumerable:!0,get:function(){return oe.default}});var de=E;Object.defineProperty(e,"emptyTagNotSelfClosed",{enumerable:!0,get:function(){return de.default}});var ce=z;Object.defineProperty(e,"tagnameLowercase",{enumerable:!0,get:function(){return ce.default}});var ue=R;Object.defineProperty(e,"tagnameSpecialChars",{enumerable:!0,get:function(){return ue.default}});var ge=D;Object.defineProperty(e,"titleRequire",{enumerable:!0,get:function(){return ge.default}});var fe=S;Object.defineProperty(e,"tagsCheck",{enumerable:!0,get:function(){return fe.default}});var pe=H;Object.defineProperty(e,"attrNoUnnecessaryWhitespace",{enumerable:!0,get:function(){return pe.default}});var he=I;Object.defineProperty(e,"attrInvalid",{enumerable:!0,get:function(){return he.default}});var me=V;Object.defineProperty(e,"invalidTag",{enumerable:!0,get:function(){return me.default}})}(i),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.HTMLParser=e.Reporter=e.HTMLRules=e.HTMLHint=void 0;const t=r;e.HTMLParser=t.default;const a=n;e.Reporter=a.default;const s=i;e.HTMLRules=s;function l(e,t){return new Array(e+1).join(t||" ")}e.HTMLHint=new class{constructor(){this.rules={},this.defaultRuleset={"tagname-lowercase":!0,"attr-lowercase":!0,"attr-value-double-quotes":!0,"doctype-first":!0,"tag-pair":!0,"spec-char-escape":!0,"id-unique":!0,"src-not-empty":!0,"attr-no-duplication":!0,"title-require":!0}}addRule(e){this.rules[e.id]=e}verify(e,r=this.defaultRuleset){0===Object.keys(r).length&&(r=this.defaultRuleset),e=e.replace(/^\s*<!--\s*htmlhint\s+([^\r\n]+?)\s*-->/i,((e,t)=>(t.replace(/(?:^|,)\s*([^:,]+)\s*(?:\:\s*([^,\s]+))?/g,((e,t,a)=>(r[t]=!(void 0!==a&&a.length>0)||JSON.parse(a),""))),"")));const n=new t.default,i=new a.default(e,r),s=this.rules;let l;for(const e in r)l=s[e],void 0!==l&&!1!==r[e]&&l.init(n,i,r[e]);return n.parse(e),i.messages}format(e,t={}){const a=[],r={white:"",grey:"",red:"",reset:""};t.colors&&(r.white="[37m",r.grey="[90m",r.red="[31m",r.reset="[39m");const n=t.indent||0;return e.forEach((e=>{let t=e.evidence;const i=e.line,s=e.col,o=t.length;let d=s>41?s-40:1,c=t.length>s+60?s+60:o;s<41&&(c+=40-s+1),t=t.replace(/\t/g," ").substring(d-1,c),d>1&&(t=`...${t}`,d-=3),c<o&&(t+="..."),a.push(`${r.white+l(n)}L${i} |${r.grey}${t}${r.reset}`);let u=s-d;const g=t.substring(0,u).match(/[^\u0000-\u00ff]/g);null!==g&&(u+=g.length),a.push(`${r.white+l(n)+l(String(i).length+3+u)}^ ${r.red}${e.message} (${e.rule.id})${r.reset}`)})),a}},Object.keys(s).forEach((t=>{e.HTMLHint.addRule(s[t])}))}(a),e(a)})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).HTMLHint=t()}(this,(function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function t(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})})),t}var a={},r={};Object.defineProperty(r,"__esModule",{value:!0});r.default=class{constructor(){this._listeners={},this._mapCdataTags=this.makeMap("script,style"),this._arrBlocks=[],this.lastEvent=null}makeMap(e){const t={},a=e.split(",");for(let e=0;e<a.length;e++)t[a[e]]=!0;return t}parse(e){const t=this._mapCdataTags,a=/<(?:\/([^\s>]+)\s*|!--([\s\S]*?)--|!([^>]*?)|([\w\-:]+)((?:\s+[^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'>]*))?)*?)\s*(\/?))>/g,r=/\s*([^\s"'>\/=\x00-\x0F\x7F\x80-\x9F]+)(?:\s*=\s*(?:(")([^"]*)"|(')([^']*)'|([^\s"'>]*)))?/g,n=/\r?\n/g;let i,s,o,l,d,c,u=0,g=null,p=[],h=0,f=0,m=1;const b=this._arrBlocks;this.fire("start",{pos:0,line:1,col:1});const v=()=>{const e=l.find((e=>"type"===e.name))||{value:""};return t[o]&&-1===e.value.indexOf("text/ng-template")},y=(e,t,a,r)=>{const i=a-f+1;for(void 0===r&&(r={}),r.raw=t,r.pos=a,r.line=m,r.col=i,b.push(r),this.fire(e,r);n.exec(t);)m++,f=a+n.lastIndex};for(;i=a.exec(e);)if(s=i.index,s>u&&(c=e.substring(u,s),g?p.push(c):y("text",c,u)),u=a.lastIndex,!(o=i[1])||(g&&o===g&&(c=p.join(""),y("cdata",c,h,{tagName:g,attrs:d}),g=null,d=void 0,p=[]),g))if(g)p.push(i[0]);else if(o=i[4]){l=[];const e=i[5];let t,a=0;for(;t=r.exec(e);){const e=t[1],r=t[2]?t[2]:t[4]?t[4]:"",n=t[3]?t[3]:t[5]?t[5]:t[6]?t[6]:"";l.push({name:e,value:n,quote:r,index:t.index,raw:t[0]}),a+=t[0].length}a===e.length?(y("tagstart",i[0],s,{tagName:o,attrs:l,close:i[6]}),v()&&(g=o,d=l.concat(),p=[],h=u)):y("text",i[0],s)}else(i[2]||i[3])&&y("comment",i[0],s,{content:i[2]||i[3],long:!!i[2]});else y("tagend",i[0],s,{tagName:o});e.length>u&&(c=e.substring(u,e.length),y("text",c,u)),this.fire("end",{pos:u,line:m,col:e.length-f+1})}addListener(e,t){const a=this._listeners,r=e.split(/[,\s]/);let n;for(let e=0,i=r.length;e<i;e++)n=r[e],void 0===a[n]&&(a[n]=[]),a[n].push(t)}fire(e,t){void 0===t&&(t={}),t.type=e;let a=[];const r=this._listeners[e],n=this._listeners.all;void 0!==r&&(a=a.concat(r)),void 0!==n&&(a=a.concat(n));const i=this.lastEvent;null!==i&&(delete i.lastEvent,t.lastEvent=i),this.lastEvent=t;for(let e=0,r=a.length;e<r;e++)a[e].call(this,t)}removeListener(e,t){const a=this._listeners[e];if(void 0!==a)for(let e=0,r=a.length;e<r;e++)if(a[e]===t){a.splice(e,1);break}}fixPos(e,t){const a=e.raw.substr(0,t).split(/\r?\n/),r=a.length-1;let n,i=e.line;return r>0?(i+=r,n=a[r].length+1):n=e.col+t,{line:i,col:n}}getMapAttrs(e){const t={};let a;for(let r=0,n=e.length;r<n;r++)a=e[r],t[a.name]=a.value;return t}};var n={};Object.defineProperty(n,"__esModule",{value:!0});n.default=class{constructor(e,t){this.html=e,this.lines=e.split(/\r?\n/);const a=/\r?\n/.exec(e);this.brLen=null!==a?a[0].length:0,this.ruleset=t,this.messages=[]}info(e,t,a,r,n){this.report("info",e,t,a,r,n)}warn(e,t,a,r,n){this.report("warning",e,t,a,r,n)}error(e,t,a,r,n){this.report("error",e,t,a,r,n)}report(e,t,a,r,n,i){const s=this.lines,o=this.brLen;let l="",d=0;for(let e=a-1,t=s.length;e<t&&(l=s[e],d=l.length,r>d&&a<t);e++)a++,1!==(r-=d)&&(r-=o);this.messages.push({type:e,message:t,raw:i,evidence:l,line:a,col:r,rule:{id:n.id,description:n.description,link:`https://htmlhint.com/docs/user-guide/rules/${n.id}`}})}};var i={},s={};Object.defineProperty(s,"__esModule",{value:!0}),s.default={id:"alt-require",description:"The alt attribute of an <img> element must be present and alt attribute of area[href] and input[type=image] must have a value.",init(e,t){e.addListener("tagstart",(a=>{const r=a.tagName.toLowerCase(),n=e.getMapAttrs(a.attrs),i=a.col+r.length+1;let s;"img"!==r||"alt"in n?("area"===r&&"href"in n||"input"===r&&"image"===n.type)&&("alt"in n&&""!==n.alt||(s="area"===r?"area[href]":"input[type=image]",t.warn(`The alt attribute of ${s} must have a value.`,a.line,i,this,a.raw))):t.warn("An alt attribute must be present on <img> elements.",a.line,i,this,a.raw)}))}};var o={};Object.defineProperty(o,"__esModule",{value:!0});const l=["allowReorder","attributeName","attributeType","autoReverse","baseFrequency","baseProfile","calcMode","clipPath","clipPathUnits","contentScriptType","contentStyleType","diffuseConstant","edgeMode","externalResourcesRequired","filterRes","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","onBlur","onChange","onClick","onFocus","onKeyUp","onLoad","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"];function d(e,t){if(t instanceof RegExp)return!!t.test(e)&&{match:e,pattern:t};const a=t[0],r=t[t.length-1],n=t[t.length-2],i="/"===a&&("/"===r||"/"===n&&"i"===r);if(i){return i&&"i"===r?new RegExp(t.slice(1,-2),"i").test(e):new RegExp(t.slice(1,-1)).test(e)}return e===t}o.default={id:"attr-lowercase",description:"All attribute names must be in lowercase.",init(e,t,a){const r=(Array.isArray(a)?a:[]).concat(l);e.addListener("tagstart",(e=>{const a=e.attrs;let n;const i=e.col+e.tagName.length+1;for(let s=0,o=a.length;s<o;s++){n=a[s];const o=n.name;r.find((e=>d(o,e)))||o===o.toLowerCase()||t.error(`The attribute name of [ ${o} ] must be in lowercase.`,e.line,i+n.index,this,n.raw)}}))}};var c={};Object.defineProperty(c,"__esModule",{value:!0}),c.default={id:"attr-sorted",description:"Attribute tags must be in proper order.",init(e,t){const a={},r=["class","id","name","src","for","type","href","value","title","alt","role"];for(let e=0;e<r.length;e++)a[r[e]]=e;e.addListener("tagstart",(e=>{const r=e.attrs,n=[];for(let e=0;e<r.length;e++)n.push(r[e].name);const i=JSON.stringify(n);n.sort(((e,t)=>null==a[e]&&null==a[t]?0:null==a[e]?1:null==a[t]?-1:a[e]-a[t]||e.localeCompare(t))),i!==JSON.stringify(n)&&t.error(`Inaccurate order ${i} should be in hierarchy ${JSON.stringify(n)} `,e.line,e.col,this,e.raw)}))}};var u={};Object.defineProperty(u,"__esModule",{value:!0}),u.default={id:"attr-no-duplication",description:"Elements cannot have duplicate attributes.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r,n;const i=e.col+e.tagName.length+1,s={};for(let o=0,l=a.length;o<l;o++)r=a[o],n=r.name,!0===s[n]&&t.error(`Duplicate of attribute name [ ${r.name} ] was found.`,e.line,i+r.index,this,r.raw),s[n]=!0}))}};var g={};Object.defineProperty(g,"__esModule",{value:!0}),g.default={id:"attr-unsafe-chars",description:"Attribute values cannot contain unsafe chars.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1,i=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;let s;for(let o=0,l=a.length;o<l;o++)if(r=a[o],s=i.exec(r.value),null!==s){const a=escape(s[0]).replace(/%u/,"\\u").replace(/%/,"\\x");t.warn(`The value of attribute [ ${r.name} ] cannot contain an unsafe char [ ${a} ].`,e.line,n+r.index,this,r.raw)}}))}};var p={};Object.defineProperty(p,"__esModule",{value:!0}),p.default={id:"attr-value-double-quotes",description:"Attribute values must be in double quotes.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;for(let i=0,s=a.length;i<s;i++)r=a[i],(""!==r.value&&'"'!==r.quote||""===r.value&&"'"===r.quote)&&t.error(`The value of attribute [ ${r.name} ] must be in double quotes.`,e.line,n+r.index,this,r.raw)}))}};var h={};Object.defineProperty(h,"__esModule",{value:!0}),h.default={id:"attr-value-not-empty",description:"All attributes must have values.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;for(let i=0,s=a.length;i<s;i++)r=a[i],""===r.quote&&""===r.value&&t.warn(`The attribute [ ${r.name} ] must have a value.`,e.line,n+r.index,this,r.raw)}))}};var f={};Object.defineProperty(f,"__esModule",{value:!0}),f.default={id:"attr-value-single-quotes",description:"Attribute values must be in single quotes.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;for(let i=0,s=a.length;i<s;i++)r=a[i],(""!==r.value&&"'"!==r.quote||""===r.value&&'"'===r.quote)&&t.error(`The value of attribute [ ${r.name} ] must be in single quotes.`,e.line,n+r.index,this,r.raw)}))}};var m={};Object.defineProperty(m,"__esModule",{value:!0}),m.default={id:"attr-whitespace",description:"All attributes should be separated by only one space and not have leading/trailing whitespace.",init(e,t,a){const r=Array.isArray(a)?a:[];e.addListener("tagstart",(e=>{const a=e.attrs;let n;const i=e.col+e.tagName.length+1;a.forEach((a=>{n=a;const s=a.name;-1===r.indexOf(s)&&(a.value.trim()!==a.value&&t.error(`The attributes of [ ${s} ] must not have leading or trailing whitespace.`,e.line,i+n.index,this,n.raw),a.value.replace(/ +(?= )/g,"")!==a.value&&t.error(`The attributes of [ ${s} ] must be separated by only one space.`,e.line,i+n.index,this,n.raw))}))}))}};var b={};Object.defineProperty(b,"__esModule",{value:!0}),b.default={id:"doctype-first",description:"Doctype must be declared first.",init(e,t){const a=r=>{"start"===r.type||"text"===r.type&&/^\s*$/.test(r.raw)||(("comment"!==r.type&&!1===r.long||!1===/^DOCTYPE\s+/i.test(r.content))&&t.error("Doctype must be declared first.",r.line,r.col,this,r.raw),e.removeListener("all",a))};e.addListener("all",a)}};var v={};Object.defineProperty(v,"__esModule",{value:!0}),v.default={id:"doctype-html5",description:'Invalid doctype. Use: "<!DOCTYPE html>"',init(e,t){const a=e=>{!1===e.long&&"doctype html"!==e.content.toLowerCase()&&t.warn('Invalid doctype. Use: "<!DOCTYPE html>"',e.line,e.col,this,e.raw)},r=()=>{e.removeListener("comment",a),e.removeListener("tagstart",r)};e.addListener("all",a),e.addListener("tagstart",r)}};var y={};Object.defineProperty(y,"__esModule",{value:!0}),y.default={id:"head-script-disabled",description:"The <script> tag cannot be used in a <head> tag.",init(e,t){const a=/^(text\/javascript|application\/javascript)$/i;let r=!1;const n=n=>{const i=e.getMapAttrs(n.attrs).type,s=n.tagName.toLowerCase();"head"===s&&(r=!0),!0!==r||"script"!==s||i&&!0!==a.test(i)||t.warn("The <script> tag cannot be used in a <head> tag.",n.line,n.col,this,n.raw)},i=t=>{"head"===t.tagName.toLowerCase()&&(e.removeListener("tagstart",n),e.removeListener("tagend",i))};e.addListener("tagstart",n),e.addListener("tagend",i)}};var w={};Object.defineProperty(w,"__esModule",{value:!0}),w.default={id:"href-abs-or-rel",description:"An href attribute must be either absolute or relative.",init(e,t,a){const r="abs"===a?"absolute":"relative";e.addListener("tagstart",(e=>{const a=e.attrs;let n;const i=e.col+e.tagName.length+1;for(let s=0,o=a.length;s<o;s++)if(n=a[s],"href"===n.name){("absolute"===r&&!1===/^\w+?:/.test(n.value)||"relative"===r&&!0===/^https?:\/\//.test(n.value))&&t.warn(`The value of the href attribute [ ${n.value} ] must be ${r}.`,e.line,i+n.index,this,n.raw);break}}))}};var x={};Object.defineProperty(x,"__esModule",{value:!0});x.default={id:"html-lang-require",description:"The lang attribute of an <html> element must be present and should be valid.",init(e,t){e.addListener("tagstart",(a=>{const r=a.tagName.toLowerCase(),n=e.getMapAttrs(a.attrs),i=a.col+r.length+1,s=new RegExp("((?<grandfathered>(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUse>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUse2>x(-[A-Za-z0-9]{1,8})+))","g");"html"===r&&("lang"in n?n.lang?s.test(n.lang)||t.warn("The lang attribute value of <html> element must be a valid BCP47.",a.line,i,this,a.raw):t.warn("The lang attribute of <html> element must have a value.",a.line,i,this,a.raw):t.warn("An lang attribute must be present on <html> elements.",a.line,i,this,a.raw))}))}};var O={};Object.defineProperty(O,"__esModule",{value:!0}),O.default={id:"id-class-ad-disabled",description:"The id and class attributes cannot use the ad keyword, it will be blocked by adblock software.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r,n;const i=e.col+e.tagName.length+1;for(let s=0,o=a.length;s<o;s++)r=a[s],n=r.name,/^(id|class)$/i.test(n)&&/(^|[-_])ad([-_]|$)/i.test(r.value)&&t.warn(`The value of attribute ${n} cannot use the ad keyword.`,e.line,i+r.index,this,r.raw)}))}};var L={};Object.defineProperty(L,"__esModule",{value:!0}),L.default={id:"id-class-value",description:"The id and class attribute values must meet the specified rules.",init(e,t,a){let r;if(r="string"==typeof a?{underline:{regId:/^[a-z\d]+(_[a-z\d]+)*$/,message:"The id and class attribute values must be in lowercase and split by an underscore."},dash:{regId:/^[a-z\d]+(-[a-z\d]+)*$/,message:"The id and class attribute values must be in lowercase and split by a dash."},hump:{regId:/^[a-z][a-zA-Z\d]*([A-Z][a-zA-Z\d]*)*$/,message:"The id and class attribute values must meet the camelCase style."}}[a]:a,"object"==typeof r&&r.regId){let a=r.regId;const n=r.message;a instanceof RegExp||(a=new RegExp(a)),e.addListener("tagstart",(e=>{const r=e.attrs;let i;const s=e.col+e.tagName.length+1;for(let o=0,l=r.length;o<l;o++)if(i=r[o],"id"===i.name.toLowerCase()&&!1===a.test(i.value)&&t.warn(n,e.line,s+i.index,this,i.raw),"class"===i.name.toLowerCase()){const r=i.value.split(/\s+/g);let o;for(let l=0,d=r.length;l<d;l++)o=r[l],o&&!1===a.test(o)&&t.warn(n,e.line,s+i.index,this,o)}}))}}};var j={};Object.defineProperty(j,"__esModule",{value:!0}),j.default={id:"id-unique",description:"The value of id attributes must be unique.",init(e,t){const a={};e.addListener("tagstart",(e=>{const r=e.attrs;let n,i;const s=e.col+e.tagName.length+1;for(let o=0,l=r.length;o<l;o++)if(n=r[o],"id"===n.name.toLowerCase()){i=n.value,i&&(void 0===a[i]?a[i]=1:a[i]++,a[i]>1&&t.error(`The id value [ ${i} ] must be unique.`,e.line,s+n.index,this,n.raw));break}}))}};var _={};Object.defineProperty(_,"__esModule",{value:!0}),_.default={id:"inline-script-disabled",description:"Inline script cannot be used.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;let i;const s=/^on(unload|message|submit|select|scroll|resize|mouseover|mouseout|mousemove|mouseleave|mouseenter|mousedown|load|keyup|keypress|keydown|focus|dblclick|click|change|blur|error)$/i;for(let o=0,l=a.length;o<l;o++)r=a[o],i=r.name.toLowerCase(),!0===s.test(i)?t.warn(`Inline script [ ${r.raw} ] cannot be used.`,e.line,n+r.index,this,r.raw):"src"!==i&&"href"!==i||/^\s*javascript:/i.test(r.value)&&t.warn(`Inline script [ ${r.raw} ] cannot be used.`,e.line,n+r.index,this,r.raw)}))}};var P={};Object.defineProperty(P,"__esModule",{value:!0}),P.default={id:"inline-style-disabled",description:"Inline style cannot be used.",init(e,t){e.addListener("tagstart",(e=>{const a=e.attrs;let r;const n=e.col+e.tagName.length+1;for(let i=0,s=a.length;i<s;i++)r=a[i],"style"===r.name.toLowerCase()&&t.warn(`Inline style [ ${r.raw} ] cannot be used.`,e.line,n+r.index,this,r.raw)}))}};var $={};Object.defineProperty($,"__esModule",{value:!0}),$.default={id:"input-requires-label",description:"All [ input ] tags must have a corresponding [ label ] tag. ",init(e,t){const a=[],r=[];e.addListener("tagstart",(t=>{const n=t.tagName.toLowerCase(),i=e.getMapAttrs(t.attrs),s=t.col+n.length+1;"input"===n&&"hidden"!==i.type&&r.push({event:t,col:s,id:i.id}),"label"===n&&"for"in i&&""!==i.for&&a.push({event:t,col:s,forValue:i.for})})),e.addListener("end",(()=>{r.forEach((e=>{(function(e){let t=!1;return a.forEach((a=>{e.id&&e.id===a.forValue&&(t=!0)})),t})(e)||t.warn("No matching [ label ] tag found.",e.event.line,e.col,this,e.event.raw)}))}))}};var k={};Object.defineProperty(k,"__esModule",{value:!0}),k.default={id:"script-disabled",description:"The <script> tag cannot be used.",init(e,t){e.addListener("tagstart",(e=>{"script"===e.tagName.toLowerCase()&&t.error("The <script> tag cannot be used.",e.line,e.col,this,e.raw)}))}};var T={};Object.defineProperty(T,"__esModule",{value:!0}),T.default={id:"space-tab-mixed-disabled",description:"Do not mix tabs and spaces for indentation.",init(e,t,a){let r="nomix",n=null;if("string"==typeof a){const e=/^([a-z]+)(\d+)?/.exec(a);e&&(r=e[1],n=e[2]&&parseInt(e[2],10))}e.addListener("text",(a=>{const i=a.raw,s=/(^|\r?\n)([ \t]+)/g;let o;for(;o=s.exec(i);){const i=e.fixPos(a,o.index+o[1].length);if(1!==i.col)continue;const s=o[2];"space"===r?n?!1!==/^ +$/.test(s)&&s.length%n==0||t.warn(`Please use space for indentation and keep ${n} length.`,i.line,1,this,a.raw):!1===/^ +$/.test(s)&&t.warn("Please use space for indentation.",i.line,1,this,a.raw):"tab"===r&&!1===/^\t+$/.test(s)?t.warn("Please use tab for indentation.",i.line,1,this,a.raw):!0===/ +\t|\t+ /.test(s)&&t.warn("Do not mix tabs and spaces for indentation.",i.line,1,this,a.raw)}}))}};var A={};Object.defineProperty(A,"__esModule",{value:!0}),A.default={id:"spec-char-escape",description:"Special characters must be escaped.",init(e,t){e.addListener("text",(a=>{const r=a.raw,n=/([<>])|( \& )/g;let i;for(;i=n.exec(r);){const r=e.fixPos(a,i.index);t.error(`Special characters must be escaped : [ ${i[0]} ].`,r.line,r.col,this,a.raw)}}))}};var M={};Object.defineProperty(M,"__esModule",{value:!0}),M.default={id:"src-not-empty",description:"The src attribute of an img(script,link) must have a value.",init(e,t){e.addListener("tagstart",(e=>{const a=e.tagName,r=e.attrs;let n;const i=e.col+a.length+1;for(let s=0,o=r.length;s<o;s++)n=r[s],(!0===/^(img|script|embed|bgsound|iframe)$/.test(a)&&"src"===n.name||"link"===a&&"href"===n.name||"object"===a&&"data"===n.name)&&""===n.value&&t.error(`The attribute [ ${n.name} ] of the tag [ ${a} ] must have a value.`,e.line,i+n.index,this,n.raw)}))}};var N={};Object.defineProperty(N,"__esModule",{value:!0}),N.default={id:"style-disabled",description:"<style> tags cannot be used.",init(e,t){e.addListener("tagstart",(e=>{"style"===e.tagName.toLowerCase()&&t.warn("The <style> tag cannot be used.",e.line,e.col,this,e.raw)}))}};var C={};Object.defineProperty(C,"__esModule",{value:!0}),C.default={id:"tag-pair",description:"Tag must be paired.",init(e,t){const a=[],r=e.makeMap("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr");e.addListener("tagstart",(e=>{const t=e.tagName.toLowerCase();void 0!==r[t]||e.close||a.push({tagName:t,line:e.line,raw:e.raw})})),e.addListener("tagend",(e=>{const r=e.tagName.toLowerCase();let n;for(n=a.length-1;n>=0&&a[n].tagName!==r;n--);if(n>=0){const r=[];for(let e=a.length-1;e>n;e--)r.push(`</${a[e].tagName}>`);if(r.length>0){const n=a[a.length-1];t.error(`Tag must be paired, missing: [ ${r.join("")} ], start tag match failed [ ${n.raw} ] on line ${n.line}.`,e.line,e.col,this,e.raw)}a.length=n}else t.error(`Tag must be paired, no start tag: [ ${e.raw} ]`,e.line,e.col,this,e.raw)})),e.addListener("end",(e=>{const r=[];for(let e=a.length-1;e>=0;e--)r.push(`</${a[e].tagName}>`);if(r.length>0){const n=a[a.length-1];t.error(`Tag must be paired, missing: [ ${r.join("")} ], open tag match failed [ ${n.raw} ] on line ${n.line}.`,e.line,e.col,this,"")}}))}};var q={};Object.defineProperty(q,"__esModule",{value:!0}),q.default={id:"tag-self-close",description:"Empty tags must be self closed.",init(e,t){const a=e.makeMap("area,base,basefont,bgsound,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr");e.addListener("tagstart",(e=>{const r=e.tagName.toLowerCase();void 0!==a[r]&&(e.close||t.warn(`The empty tag : [ ${r} ] must be self closed.`,e.line,e.col,this,e.raw))}))}};var E={};Object.defineProperty(E,"__esModule",{value:!0}),E.default={id:"empty-tag-not-self-closed",description:"Empty tags must not use self closed syntax.",init(e,t){const a=e.makeMap("area,base,basefont,bgsound,br,col,frame,hr,img,input,isindex,link,meta,param,embed,track,command,source,keygen,wbr");e.addListener("tagstart",(e=>{const r=e.tagName.toLowerCase();void 0!==a[r]&&e.close&&t.error(`The empty tag : [ ${r} ] must not use self closed syntax.`,e.line,e.col,this,e.raw)}))}};var z={};Object.defineProperty(z,"__esModule",{value:!0}),z.default={id:"tagname-lowercase",description:"All html element names must be in lowercase.",init(e,t,a){const r=Array.isArray(a)?a:[];e.addListener("tagstart,tagend",(e=>{const a=e.tagName;-1===r.indexOf(a)&&a!==a.toLowerCase()&&t.error(`The html element name of [ ${a} ] must be in lowercase.`,e.line,e.col,this,e.raw)}))}};var R={};Object.defineProperty(R,"__esModule",{value:!0}),R.default={id:"tagname-specialchars",description:"All special characters must be escaped.",init(e,t){const a=/[^a-zA-Z0-9\-:_]/;e.addListener("tagstart,tagend",(e=>{const r=e.tagName;a.test(r)&&t.error(`The html element name of [ ${r} ] contains special character.`,e.line,e.col,this,e.raw)}))}};var D={};Object.defineProperty(D,"__esModule",{value:!0}),D.default={id:"title-require",description:"<title> must be present in <head> tag.",init(e,t){let a=!1,r=!1;const n=e=>{const t=e.tagName.toLowerCase();"head"===t?a=!0:"title"===t&&a&&(r=!0)},i=a=>{const s=a.tagName.toLowerCase();if(r&&"title"===s){const e=a.lastEvent;("text"!==e.type||"text"===e.type&&!0===/^\s*$/.test(e.raw))&&t.error("<title></title> must not be empty.",a.line,a.col,this,a.raw)}else"head"===s&&(!1===r&&t.error("<title> must be present in <head> tag.",a.line,a.col,this,a.raw),e.removeListener("tagstart",n),e.removeListener("tagend",i))};e.addListener("tagstart",n),e.addListener("tagend",i)}};var S={};Object.defineProperty(S,"__esModule",{value:!0});let U={a:{selfclosing:!1,attrsRequired:["href","title"],redundantAttrs:["alt"]},div:{selfclosing:!1},main:{selfclosing:!1,redundantAttrs:["role"]},nav:{selfclosing:!1,redundantAttrs:["role"]},script:{attrsOptional:[["async","async"],["defer","defer"]]},img:{selfclosing:!0,attrsRequired:["src","alt","title"]}};S.default={id:"tags-check",description:"Checks html tags.",init(e,t,a){U=Object.assign(Object.assign({},U),a),e.addListener("tagstart",(e=>{const a=e.attrs,r=e.col+e.tagName.length+1,n=e.tagName.toLowerCase();if(U[n]){const i=U[n];if(!0!==i.selfclosing||e.close?!1===i.selfclosing&&e.close&&t.warn(`The <${n}> tag must not be selfclosing.`,e.line,e.col,this,e.raw):t.warn(`The <${n}> tag must be selfclosing.`,e.line,e.col,this,e.raw),Array.isArray(i.attrsRequired)){i.attrsRequired.forEach((i=>{if(Array.isArray(i)){const s=i.map((e=>e)),o=s.shift(),l=s;a.some((e=>e.name===o))?a.forEach((a=>{a.name===o&&-1===l.indexOf(a.value)&&t.error(`The <${n}> tag must have attr '${o}' with one value of '${l.join("' or '")}'.`,e.line,r,this,e.raw)})):t.error(`The <${n}> tag must have attr '${o}'.`,e.line,r,this,e.raw)}else a.some((e=>-1!==i.split("|").indexOf(e.name)))||t.error(`The <${n}> tag must have attr '${i}'.`,e.line,r,this,e.raw)}))}if(Array.isArray(i.attrsOptional)){i.attrsOptional.forEach((i=>{if(Array.isArray(i)){const s=i.map((e=>e)),o=s.shift(),l=s;a.some((e=>e.name===o))&&a.forEach((a=>{a.name===o&&-1===l.indexOf(a.value)&&t.error(`The <${n}> tag must have optional attr '${o}' with one value of '${l.join("' or '")}'.`,e.line,r,this,e.raw)}))}}))}if(Array.isArray(i.redundantAttrs)){i.redundantAttrs.forEach((i=>{a.some((e=>e.name===i))&&t.error(`The attr '${i}' is redundant for <${n}> and should be omitted.`,e.line,r,this,e.raw)}))}}}))}};var H={};Object.defineProperty(H,"__esModule",{value:!0}),H.default={id:"attr-no-unnecessary-whitespace",description:"No spaces between attribute names and values.",init(e,t,a){const r=Array.isArray(a)?a:[];e.addListener("tagstart",(e=>{const a=e.attrs,n=e.col+e.tagName.length+1;for(let i=0;i<a.length;i++)if(-1===r.indexOf(a[i].name)){const r=/(\s*)=(\s*)/.exec(a[i].raw.trim());!r||0===r[1].length&&0===r[2].length||t.error(`The attribute '${a[i].name}' must not have spaces between the name and value.`,e.line,n+a[i].index,this,a[i].raw)}}))}};var I={};var Z=t(Object.freeze({__proto__:null,htmlElementAttributes:{"*":["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","popover","slot","spellcheck","style","tabindex","title","translate"],a:["charset","coords","download","href","hreflang","name","ping","referrerpolicy","rel","rev","shape","target","type"],applet:["align","alt","archive","code","codebase","height","hspace","name","object","vspace","width"],area:["alt","coords","download","href","hreflang","nohref","ping","referrerpolicy","rel","shape","target","type"],audio:["autoplay","controls","crossorigin","loop","muted","preload","src"],base:["href","target"],basefont:["color","face","size"],blockquote:["cite"],body:["alink","background","bgcolor","link","text","vlink"],br:["clear"],button:["disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","name","popovertarget","popovertargetaction","type","value"],canvas:["height","width"],caption:["align"],col:["align","char","charoff","span","valign","width"],colgroup:["align","char","charoff","span","valign","width"],data:["value"],del:["cite","datetime"],details:["open"],dialog:["open"],dir:["compact"],div:["align"],dl:["compact"],embed:["height","src","type","width"],fieldset:["disabled","form","name"],font:["color","face","size"],form:["accept","accept-charset","action","autocomplete","enctype","method","name","novalidate","target"],frame:["frameborder","longdesc","marginheight","marginwidth","name","noresize","scrolling","src"],frameset:["cols","rows"],h1:["align"],h2:["align"],h3:["align"],h4:["align"],h5:["align"],h6:["align"],head:["profile"],hr:["align","noshade","size","width"],html:["manifest","version"],iframe:["align","allow","allowfullscreen","allowpaymentrequest","allowusermedia","frameborder","height","loading","longdesc","marginheight","marginwidth","name","referrerpolicy","sandbox","scrolling","src","srcdoc","width"],img:["align","alt","border","crossorigin","decoding","fetchpriority","height","hspace","ismap","loading","longdesc","name","referrerpolicy","sizes","src","srcset","usemap","vspace","width"],input:["accept","align","alt","autocomplete","checked","dirname","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","ismap","list","max","maxlength","min","minlength","multiple","name","pattern","placeholder","popovertarget","popovertargetaction","readonly","required","size","src","step","type","usemap","value","width"],ins:["cite","datetime"],isindex:["prompt"],label:["for","form"],legend:["align"],li:["type","value"],link:["as","blocking","charset","color","crossorigin","disabled","fetchpriority","href","hreflang","imagesizes","imagesrcset","integrity","media","referrerpolicy","rel","rev","sizes","target","type"],map:["name"],menu:["compact"],meta:["charset","content","http-equiv","media","name","scheme"],meter:["high","low","max","min","optimum","value"],object:["align","archive","border","classid","codebase","codetype","data","declare","form","height","hspace","name","standby","type","typemustmatch","usemap","vspace","width"],ol:["compact","reversed","start","type"],optgroup:["disabled","label"],option:["disabled","label","selected","value"],output:["for","form","name"],p:["align"],param:["name","type","value","valuetype"],pre:["width"],progress:["max","value"],q:["cite"],script:["async","blocking","charset","crossorigin","defer","fetchpriority","integrity","language","nomodule","referrerpolicy","src","type"],select:["autocomplete","disabled","form","multiple","name","required","size"],slot:["name"],source:["height","media","sizes","src","srcset","type","width"],style:["blocking","media","type"],table:["align","bgcolor","border","cellpadding","cellspacing","frame","rules","summary","width"],tbody:["align","char","charoff","valign"],td:["abbr","align","axis","bgcolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"],textarea:["autocomplete","cols","dirname","disabled","form","maxlength","minlength","name","placeholder","readonly","required","rows","wrap"],tfoot:["align","char","charoff","valign"],th:["abbr","align","axis","bgcolor","char","charoff","colspan","headers","height","nowrap","rowspan","scope","valign","width"],thead:["align","char","charoff","valign"],time:["datetime"],tr:["align","bgcolor","char","charoff","valign"],track:["default","kind","label","src","srclang"],ul:["compact","type"],video:["autoplay","controls","crossorigin","height","loop","muted","playsinline","poster","preload","src","width"]}}));var F=t(Object.freeze({__proto__:null,htmlEventAttributes:["onabort","onafterprint","onauxclick","onbeforematch","onbeforeprint","onbeforeunload","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onrejectionhandled","onreset","onresize","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"]}));Object.defineProperty(I,"__esModule",{value:!0});const V=Z,B=F;I.default={id:"attr-invalid",description:"Attributes must be valid for the given HTML tags.",init(e,t){const a=V.htmlElementAttributes["*"]||[],r=B.htmlEventAttributes||[];e.addListener("tagstart",(e=>{const n=e.tagName.toLowerCase(),i=e.attrs,s=V.htmlElementAttributes[n]||[],o=[...a,...r,...s];for(const a of i)/^data-.+$/.test(a.name)||/^aria-.+$|^role$/.test(a.name)||/^adapt-.+$/.test(a.name)||o.includes(a.name)||t.error(`The attribute [ ${a.name} ] is not valid for the tag [ ${n} ].`,e.line,e.col+e.tagName.length+1+a.index,this,a.raw)}))}};var Y={};Object.defineProperty(Y,"__esModule",{value:!0});const W=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"];return Y.default={id:"invalid-tag",description:"All tags must be valid HTML tags.",init(e,t){const a=[];e.addListener("tagstart",(e=>{const r=e.tagName;W.includes(r)?a.push(r):t.error(`The tag [ ${r} ] is not a valid HTML tag.`,e.line,e.col,this,e.raw)})),e.addListener("tagend",(e=>{const r=e.tagName;if(W.includes(r)){const e=a.lastIndexOf(r);-1!==e&&a.splice(e,1)}else t.error(`The closing tag [ ${r} ] is not a valid HTML tag.`,e.line,e.col,this,e.raw)})),e.addListener("end",(()=>{a.forEach((e=>{t.error(`The tag [ ${e} ] was opened but never closed.`,0,0,this,"")}))}))}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.invalidTag=e.attrInvalid=e.attrNoUnnecessaryWhitespace=e.tagsCheck=e.titleRequire=e.tagnameSpecialChars=e.tagnameLowercase=e.emptyTagNotSelfClosed=e.tagSelfClose=e.tagPair=e.styleDisabled=e.srcNotEmpty=e.specCharEscape=e.spaceTabMixedDisabled=e.scriptDisabled=e.inputRequiresLabel=e.inlineStyleDisabled=e.inlineScriptDisabled=e.idUnique=e.idClassValue=e.idClsasAdDisabled=e.htmlLangRequire=e.hrefAbsOrRel=e.headScriptDisabled=e.doctypeHTML5=e.doctypeFirst=e.attrWhitespace=e.attrValueSingleQuotes=e.attrValueNotEmpty=e.attrValueDoubleQuotes=e.attrUnsafeChars=e.attrNoDuplication=e.attrSort=e.attrLowercase=e.altRequire=void 0;var t=s;Object.defineProperty(e,"altRequire",{enumerable:!0,get:function(){return t.default}});var a=o;Object.defineProperty(e,"attrLowercase",{enumerable:!0,get:function(){return a.default}});var r=c;Object.defineProperty(e,"attrSort",{enumerable:!0,get:function(){return r.default}});var n=u;Object.defineProperty(e,"attrNoDuplication",{enumerable:!0,get:function(){return n.default}});var i=g;Object.defineProperty(e,"attrUnsafeChars",{enumerable:!0,get:function(){return i.default}});var l=p;Object.defineProperty(e,"attrValueDoubleQuotes",{enumerable:!0,get:function(){return l.default}});var d=h;Object.defineProperty(e,"attrValueNotEmpty",{enumerable:!0,get:function(){return d.default}});var U=f;Object.defineProperty(e,"attrValueSingleQuotes",{enumerable:!0,get:function(){return U.default}});var Z=m;Object.defineProperty(e,"attrWhitespace",{enumerable:!0,get:function(){return Z.default}});var F=b;Object.defineProperty(e,"doctypeFirst",{enumerable:!0,get:function(){return F.default}});var V=v;Object.defineProperty(e,"doctypeHTML5",{enumerable:!0,get:function(){return V.default}});var B=y;Object.defineProperty(e,"headScriptDisabled",{enumerable:!0,get:function(){return B.default}});var W=w;Object.defineProperty(e,"hrefAbsOrRel",{enumerable:!0,get:function(){return W.default}});var J=x;Object.defineProperty(e,"htmlLangRequire",{enumerable:!0,get:function(){return J.default}});var Q=O;Object.defineProperty(e,"idClsasAdDisabled",{enumerable:!0,get:function(){return Q.default}});var X=L;Object.defineProperty(e,"idClassValue",{enumerable:!0,get:function(){return X.default}});var G=j;Object.defineProperty(e,"idUnique",{enumerable:!0,get:function(){return G.default}});var K=_;Object.defineProperty(e,"inlineScriptDisabled",{enumerable:!0,get:function(){return K.default}});var ee=P;Object.defineProperty(e,"inlineStyleDisabled",{enumerable:!0,get:function(){return ee.default}});var te=$;Object.defineProperty(e,"inputRequiresLabel",{enumerable:!0,get:function(){return te.default}});var ae=k;Object.defineProperty(e,"scriptDisabled",{enumerable:!0,get:function(){return ae.default}});var re=T;Object.defineProperty(e,"spaceTabMixedDisabled",{enumerable:!0,get:function(){return re.default}});var ne=A;Object.defineProperty(e,"specCharEscape",{enumerable:!0,get:function(){return ne.default}});var ie=M;Object.defineProperty(e,"srcNotEmpty",{enumerable:!0,get:function(){return ie.default}});var se=N;Object.defineProperty(e,"styleDisabled",{enumerable:!0,get:function(){return se.default}});var oe=C;Object.defineProperty(e,"tagPair",{enumerable:!0,get:function(){return oe.default}});var le=q;Object.defineProperty(e,"tagSelfClose",{enumerable:!0,get:function(){return le.default}});var de=E;Object.defineProperty(e,"emptyTagNotSelfClosed",{enumerable:!0,get:function(){return de.default}});var ce=z;Object.defineProperty(e,"tagnameLowercase",{enumerable:!0,get:function(){return ce.default}});var ue=R;Object.defineProperty(e,"tagnameSpecialChars",{enumerable:!0,get:function(){return ue.default}});var ge=D;Object.defineProperty(e,"titleRequire",{enumerable:!0,get:function(){return ge.default}});var pe=S;Object.defineProperty(e,"tagsCheck",{enumerable:!0,get:function(){return pe.default}});var he=H;Object.defineProperty(e,"attrNoUnnecessaryWhitespace",{enumerable:!0,get:function(){return he.default}});var fe=I;Object.defineProperty(e,"attrInvalid",{enumerable:!0,get:function(){return fe.default}});var me=Y;Object.defineProperty(e,"invalidTag",{enumerable:!0,get:function(){return me.default}})}(i),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.HTMLParser=e.Reporter=e.HTMLRules=e.HTMLHint=void 0;const t=r;e.HTMLParser=t.default;const a=n;e.Reporter=a.default;const s=i;e.HTMLRules=s;function o(e,t){return new Array(e+1).join(t||" ")}e.HTMLHint=new class{constructor(){this.rules={},this.defaultRuleset={"tagname-lowercase":!0,"attr-lowercase":!0,"attr-value-double-quotes":!0,"doctype-first":!0,"tag-pair":!0,"spec-char-escape":!0,"id-unique":!0,"src-not-empty":!0,"attr-no-duplication":!0,"title-require":!0}}addRule(e){this.rules[e.id]=e}verify(e,r=this.defaultRuleset){0===Object.keys(r).length&&(r=this.defaultRuleset),e=e.replace(/^\s*<!--\s*htmlhint\s+([^\r\n]+?)\s*-->/i,((e,t)=>(t.replace(/(?:^|,)\s*([^:,]+)\s*(?:\:\s*([^,\s]+))?/g,((e,t,a)=>(r[t]=!(void 0!==a&&a.length>0)||JSON.parse(a),""))),"")));const n=new t.default,i=new a.default(e,r),s=this.rules;let o;for(const e in r)o=s[e],void 0!==o&&!1!==r[e]&&o.init(n,i,r[e]);return n.parse(e),i.messages}format(e,t={}){const a=[],r={white:"",grey:"",red:"",reset:""};t.colors&&(r.white="[37m",r.grey="[90m",r.red="[31m",r.reset="[39m");const n=t.indent||0;return e.forEach((e=>{let t=e.evidence;const i=e.line,s=e.col,l=t.length;let d=s>41?s-40:1,c=t.length>s+60?s+60:l;s<41&&(c+=40-s+1),t=t.replace(/\t/g," ").substring(d-1,c),d>1&&(t=`...${t}`,d-=3),c<l&&(t+="..."),a.push(`${r.white+o(n)}L${i} |${r.grey}${t}${r.reset}`);let u=s-d;const g=t.substring(0,u).match(/[^\u0000-\u00ff]/g);null!==g&&(u+=g.length),a.push(`${r.white+o(n)+o(String(i).length+3+u)}^ ${r.red}${e.message} (${e.rule.id})${r.reset}`)})),a}},Object.keys(s).forEach((t=>{e.HTMLHint.addRule(s[t])}))}(a),e(a)})); |
{ | ||
"name": "htmlhint-invalid-attribute-rule", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Add invalid attribute rule to htmlhint", | ||
@@ -64,2 +64,3 @@ "keywords": [ | ||
"html-element-attributes": "^3.2.0", | ||
"html-event-attributes": "^2.1.0", | ||
"is-glob": "^4.0.3", | ||
@@ -66,0 +67,0 @@ "node-fetch": "^2.6.2", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
329363
4799
10
+ Addedhtml-event-attributes@^2.1.0
+ Addedhtml-event-attributes@2.2.0(transitive)