function t(t){return t.length}function e(e,i){const l=i||{},r=(l.align||[]).concat(),s=l.stringLength||t,o=[],g=[],a=[],c=[];let p=0,h=-1;for(;++h<e.length;){const t=[],n=[];let i=-1;for(e[h].length>p&&(p=e[h].length);++i<e[h].length;){const r=null==(u=e[h][i])?"":String(u);if(!1!==l.alignDelimiters){const t=s(r);n[i]=t,(void 0===c[i]||t>c[i])&&(c[i]=t)}t.push(r)}g[h]=t,a[h]=n}var u;let f=-1;if("object"==typeof r&&"length"in r)for(;++f<p;)o[f]=n(r[f]);else{const t=n(r);for(;++f<p;)o[f]=t}f=-1;const m=[],d=[];for(;++f<p;){const t=o[f];let e="",n="";99===t?(e=":",n=":"):108===t?e=":":114===t&&(n=":");let i=!1===l.alignDelimiters?1:Math.max(1,c[f]-e.length-n.length);const r=e+"-".repeat(i)+n;!1!==l.alignDelimiters&&(i=e.length+i+n.length,i>c[f]&&(c[f]=i),d[f]=i),m[f]=r}g.splice(1,0,m),a.splice(1,0,d),h=-1;const D=[];for(;++h<g.length;){const t=g[h],e=a[h];f=-1;const n=[];for(;++f<p;){const i=t[f]||"";let r="",s="";if(!1!==l.alignDelimiters){const t=c[f]-(e[f]||0),n=o[f];114===n?r=" ".repeat(t):99===n?t%2?(r=" ".repeat(t/2+.5),s=" ".repeat(t/2-.5)):(r=" ".repeat(t/2),s=r):s=" ".repeat(t)}!1===l.delimiterStart||f||n.push("|"),!1===l.padding||!1===l.alignDelimiters&&""===i||!1===l.delimiterStart&&!f||n.push(" "),!1!==l.alignDelimiters&&n.push(r),n.push(i),!1!==l.alignDelimiters&&n.push(s),!1!==l.padding&&n.push(" "),!1===l.delimiterEnd&&f===p-1||n.push("|")}D.push(!1===l.delimiterEnd?n.join("").replace(/ +$/,""):n.join(""))}return D.join("\n")}function n(t){const e="string"==typeof t?t.codePointAt(0):0;return 67===e||99===e?99:76===e||108===e?108:82===e||114===e?114:0}export{e as m};
