"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../../../../devlop@1.1.0/node_modules/devlop/lib/default.cjs.js"),R=require("../../../../markdown-table@3.0.4/node_modules/markdown-table/index.cjs.js"),v=require("../../../../mdast-util-to-markdown@2.1.2/node_modules/mdast-util-to-markdown/lib/handle/index.cjs.js");function y(){return{enter:{table:D,tableData:g,tableHeader:g,tableRow:_},exit:{codeText:P,table:M,tableData:s,tableHeader:s,tableRow:s}}}function D(e){const l=e._align;this.enter({type:"table",align:l.map(function(o){return o==="none"?null:o}),children:[]},e),this.data.inTable=!0}function M(e){this.exit(e),this.data.inTable=void 0}function _(e){this.enter({type:"tableRow",children:[]},e)}function s(e){this.exit(e)}function g(e){this.enter({type:"tableCell",children:[]},e)}function P(e){let l=this.resume();this.data.inTable&&(l=l.replace(/\\([\\|])/g,q));const o=this.stack[this.stack.length-1];m.ok(o.type==="inlineCode"),o.value=l,this.exit(e)}function q(e,l){return l==="|"?l:e}function A(e){const l=e||{},o=l.tableCellPadding,T=l.tablePipeAlign,x=l.stringLength,b=o?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:k,table:C,tableCell:d,tableRow:w}};function C(t,r,a,n){return h(p(t,a,n),t.align)}function w(t,r,a,n){const i=f(t,a,n),c=h([i]);return c.slice(0,c.indexOf(`
`))}function d(t,r,a,n){const i=a.enter("tableCell"),c=a.enter("phrasing"),u=a.containerPhrasing(t,{...n,before:b,after:b});return c(),i(),u}function h(t,r){return R.markdownTable(t,{align:r,alignDelimiters:T,padding:o,stringLength:x})}function p(t,r,a){const n=t.children;let i=-1;const c=[],u=r.enter("table");for(;++i<n.length;)c[i]=f(n[i],r,a);return u(),c}function f(t,r,a){const n=t.children;let i=-1;const c=[],u=r.enter("tableRow");for(;++i<n.length;)c[i]=d(n[i],t,r,a);return u(),c}function k(t,r,a){let n=v.handle.inlineCode(t,r,a);return a.stack.includes("tableCell")&&(n=n.replace(/\|/g,"\\$&")),n}}exports.gfmTableFromMarkdown=y;exports.gfmTableToMarkdown=A;
//# sourceMappingURL=index.cjs.js.map
