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