/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@silvermine/markdownlint-rule-indent-alignment@0.2.0/src/indent-alignment.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";const{addErrorDetailIf:addErrorDetailIf}=require("markdownlint-rule-helpers");function traverse(e,t,r){e.forEach((e=>{t&&!t.includes(e.type)||r(e),e.children&&"htmlFlow"!==e.type&&traverse(e.children,t,r)}))}function iterate(e,t,r){let n;(e||[]).forEach((e=>{n&&n===e.type&&(n=void 0),"htmlText"===e.type&&(n="lineEnding");const o=void 0!==n,i=!t||t.includes(e.type);!o&&i&&r(e,(e=>{n=e}))}))}function findFirstNonHTMLTokenOfType(e,t){let r;return(e||[]).find((e=>("htmlText"===e.type&&(r=e.endLine),t.includes(e.type)&&e.startLine!==r)))}function getReadableNameOfTokenForError(e){return{blockQuote:"blockquotes",codeFenced:"code blocks",content:"paragraphs",listOrdered:"ordered lists",listUnordered:"unordered lists"}[e.type]||e.type}module.exports={names:["indent-alignment"],description:"Indent alignment of list items, wrapped lines, and blocks",information:new URL("https://github.com/silvermine/markdownlint-rule-indent-alignment"),tags:["bullet","ul","il","indentation","paragraph"],parser:"micromark",function:function(e,t){iterate(e.parsers.micromark.tokens,["blockQuote","codeFenced","content"],(e=>{addErrorDetailIf(t,e.startLine,0,e.startColumn-1,`Top-level ${getReadableNameOfTokenForError(e)} should not be indented`,void 0,[1,e.startColumn-1],{deleteCount:e.startColumn-1})})),void 0!==e.config.start_indent&&iterate(e.parsers.micromark.tokens,["listOrdered","listUnordered"],(r=>{const n=r.startColumn-1;addErrorDetailIf(t,r.startLine,e.config.start_indent,n,`Top-level ${getReadableNameOfTokenForError(r)} should be indented ${e.config.start_indent} spaces.`,void 0,[1,Math.max(n,1)],{deleteCount:n,insertText:" ".repeat(r.startColumn-1)})})),traverse(e.parsers.micromark.tokens,["paragraph"],(e=>{const r=["autolink","characterEscape","codeText","data","emphasis","link","literalAutolink","strong"],n=findFirstNonHTMLTokenOfType(e.children,r);if(!n)return;const o=n.startColumn-1;iterate(e.children,r,((e,r)=>{const n=e.startColumn-1;addErrorDetailIf(t,e.startLine,o,n,"Wrapped text should be left-aligned with the preceding content",void 0,[1,Math.max(n,1)],{deleteCount:n,insertText:" ".repeat(o)}),r("lineEnding")}))})),traverse(e.parsers.micromark.tokens,["blockQuote","listOrdered","listUnordered"],(r=>{let n=["codeFenced","content","listItemPrefix","blockQuote","listOrdered","listUnordered"];const o=findFirstNonHTMLTokenOfType(r.children,["content"]);if(!o)return;"blockQuote"===r.type&&(n=["codeFenced","content","listItemPrefix"]);let i=o.startColumn-1;iterate(r.children,n,((n,o)=>{const d=n.startColumn-1;if("listItemPrefix"===n.type)return addErrorDetailIf(t,n.startLine,r.startColumn-1,d,"List items should be left-aligned with the preceding list items",void 0,[1,Math.max(d,1)],{deleteCount:d,insertText:" ".repeat(r.startColumn-1)}),i=r.startColumn+n.endColumn-n.startColumn-1,void o("lineEnding");if(e.config.ul_indent&&"listUnordered"===r.type&&["listOrdered","listUnordered"].includes(n.type)){const o=r.startColumn-1+e.config.ul_indent;addErrorDetailIf(t,n.startLine,o,d,`Child ${getReadableNameOfTokenForError(n)} should be indented ${e.config.ul_indent} from the parent list`,void 0,[1,d],{deleteCount:d,insertText:" ".repeat(o)})}else addErrorDetailIf(t,n.startLine,i,d,`Nested ${getReadableNameOfTokenForError(n)} should be left-aligned with the preceding content`,void 0,[1,d],{deleteCount:d,insertText:" ".repeat(i)})}))}))}};
//# sourceMappingURL=/sm/544299d84efb36b6440b42307dc7fa742170482bd002eb61abe5ed5868cf8b07.map