@likec4/mcp 1.50.0 → 1.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- import{stripVTControlCharacters as e}from"node:util";import t from"node:path";import n from"node:process";import{fileURLToPath as r}from"node:url";import i from"node:fs/promises";import{on as a,once as o}from"node:events";import{spawn as s}from"node:child_process";import{pipeline as c}from"node:stream/promises";import*as l from"node:readline/promises";const u=t=>({start:n.hrtime.bigint(),command:t.map(t=>d(e(t))).join(` `),state:{stdout:``,stderr:``,output:``,isIterating:{},nonIterable:[!1,!1]}}),d=e=>/[^\w./-]/.test(e)?`'${e.replaceAll(`'`,`'\\''`)}'`:e,f=({stdin:e,stdout:i,stderr:a,stdio:o=[e,i,a],env:s,preferLocal:c,cwd:l=`.`,...u})=>{let d=l instanceof URL?r(l):t.resolve(l),f=s?{...n.env,...s}:void 0,m=o[0]?.string;return{...u,input:m,stdio:m===void 0?o:[`pipe`,...o.slice(1)],env:c?p(f??n.env,d):f,cwd:d}},p=({Path:e=``,PATH:n=e,...r},i)=>{let a=n.split(t.delimiter),o=m([],t.resolve(i)).map(e=>t.join(e,`node_modules/.bin`)).filter(e=>!a.includes(e));return{...r,PATH:[...o,n].filter(Boolean).join(t.delimiter)}},m=(e,n)=>e.at(-1)===n?e:m([...e,n],t.resolve(n,`..`)),h=async(e,t,n)=>await g(e,n)?[w(e),t.map(e=>C(e)),{...n,shell:!0}]:[e,t,n],g=async(e,{shell:t,cwd:r,env:i=n.env})=>n.platform===`win32`&&!t&&!await _(e,r,i),_=(e,t,{Path:n=``,PATH:r=n})=>S.some(t=>e.toLowerCase().endsWith(t))||x(e,t,r),v={},y=e=>(...t)=>v[t.join(`\0`)]??=e(...t),b=y(i.access),x=y(async(e,n,r)=>{let i=r.split(t.delimiter).filter(Boolean).map(e=>e.replace(/^"(.*)"$/,`$1`));try{await Promise.any([n,...i].flatMap(n=>S.map(r=>b(`${t.resolve(n,e)}${r}`))))}catch{return!1}return!0}),S=[`.exe`,`.com`],C=e=>w(w(`"${e.replaceAll(/(\\*)"/g,`$1$1\\"`).replace(/(\\*)$/,`$1$1`)}"`)),w=e=>e.replaceAll(/([()\][%!^"`<>&|;, *?])/g,`^$1`),T=async(e,{input:t},n)=>{let r=await e;t!==void 0&&r.stdin.end(t);let i=o(r,`close`);try{return await Promise.race([i,...r.stdio.filter(Boolean).map(e=>E(e))]),D(n,j(r)),M(n)}catch(e){throw await Promise.allSettled([i]),O(e,r,n)}},E=async e=>{for await(let[t]of a(e,`error`))if(![`ERR_STREAM_PREMATURE_CLOSE`,`EPIPE`].includes(t?.code))throw t},D=({command:e},{exitCode:t,signalName:n})=>{if(n!==void 0)throw new A(`Command was terminated with ${n}: ${e}`);if(t!==void 0)throw new A(`Command failed with exit code ${t}: ${e}`)},O=(e,t,n)=>Object.assign(k(e,n),j(t),M(n)),k=(e,{command:t})=>e instanceof A?e:new A(`Command failed: ${t}`,{cause:e});var A=class extends Error{name=`SubprocessError`};const j=({exitCode:e,signalCode:t})=>({...e<1?{}:{exitCode:e},...t===null?{}:{signalName:t}}),M=({state:{stdout:e,stderr:t,output:r},command:i,start:a})=>({stdout:N(e),stderr:N(t),output:N(r),command:i,durationMs:Number(n.hrtime.bigint()-a)/1e6}),N=e=>e.at(-1)===`
2
- `?e.slice(0,e.at(-2)===`\r`?-2:-1):e,P=async(e,t,r,i)=>{try{[`node`,`node.exe`].includes(e.toLowerCase())&&(e=n.execPath,t=[...n.execArgv.filter(e=>!e.startsWith(`--inspect`)),...t]),[e,t,r]=await h(e,t,r),[e,t,r]=F(e,t,r);let a=s(e,t,r);return I(a.stdout,i,`stdout`),I(a.stderr,i,`stderr`),a.once(`error`,()=>{}),await o(a,`spawn`),a}catch(e){throw O(e,{},i)}},F=(e,t,n)=>n.shell&&t.length>0?[[e,...t].join(` `),[],n]:[e,t,n],I=(e,{state:t},n)=>{e&&(e.setEncoding(`utf8`),t.isIterating[n]||(t.isIterating[n]=!1,e.on(`data`,e=>{t[n]+=e,t.output+=e})))},L=async e=>{let[[t,n]]=await Promise.all([Promise.allSettled(e),R(e)]);if(n.reason)throw n.reason.pipedFrom=t.reason??t.value,n.reason;if(t.reason)throw t.reason;return{...n.value,pipedFrom:t.value}},R=async e=>{try{let[{stdout:t},{stdin:n}]=await Promise.all(e.map(({nodeChildProcess:e})=>e));if(n===null)throw Error(`The "stdin" option must be set on the first "spawn()" call in the pipeline.`);if(t===null)throw Error(`The "stdout" option must be set on the last "spawn()" call in the pipeline.`);c(t,n).catch(()=>{})}catch(t){throw await Promise.allSettled(e.map(({nodeChildProcess:e})=>z(e))),t}},z=async e=>{let{stdin:t}=await e;t.end()},B=async function*(e,{state:t},n,r){if(t.isIterating[n]===!1)throw Error(`The subprocess must be iterated right away, for example:
1
+ import e from"node:path";import t from"node:process";import{fileURLToPath as n}from"node:url";import{stripVTControlCharacters as r}from"node:util";import{spawn as i}from"node:child_process";import{on as a,once as o}from"node:events";import s from"node:fs/promises";import{pipeline as c}from"node:stream/promises";import*as l from"node:readline/promises";const u=e=>({start:t.hrtime.bigint(),command:e.map(e=>d(r(e))).join(` `),state:{stdout:``,stderr:``,output:``,isIterating:{},nonIterable:[!1,!1]}}),d=e=>/[^\w./-]/.test(e)?`'${e.replaceAll(`'`,`'\\''`)}'`:e,f=({stdin:r,stdout:i,stderr:a,stdio:o=[r,i,a],env:s,preferLocal:c,cwd:l=`.`,...u})=>{let d=l instanceof URL?n(l):e.resolve(l),f=s?{...t.env,...s}:void 0,m=o[0]?.string;return{...u,input:m,stdio:m===void 0?o:[`pipe`,...o.slice(1)],env:c?p(f??t.env,d):f,cwd:d}},p=({Path:t=``,PATH:n=t,...r},i)=>{let a=n.split(e.delimiter),o=m([],e.resolve(i)).map(t=>e.join(t,`node_modules/.bin`)).filter(e=>!a.includes(e));return{...r,PATH:[...o,n].filter(Boolean).join(e.delimiter)}},m=(t,n)=>t.at(-1)===n?t:m([...t,n],e.resolve(n,`..`)),h=async(e,t,n)=>await g(e,n)?[w(e),t.map(e=>C(e)),{...n,shell:!0}]:[e,t,n],g=async(e,{shell:n,cwd:r,env:i=t.env})=>t.platform===`win32`&&!n&&!await _(e,r,i),_=(e,t,{Path:n=``,PATH:r=n})=>S.some(t=>e.toLowerCase().endsWith(t))||x(e,t,r),v={},y=e=>(...t)=>v[t.join(`\0`)]??=e(...t),b=y(s.access),x=y(async(t,n,r)=>{let i=r.split(e.delimiter).filter(Boolean).map(e=>e.replace(/^"(.*)"$/,`$1`));try{await Promise.any([n,...i].flatMap(n=>S.map(r=>b(`${e.resolve(n,t)}${r}`))))}catch{return!1}return!0}),S=[`.exe`,`.com`],C=e=>w(w(`"${e.replaceAll(/(\\*)"/g,`$1$1\\"`).replace(/(\\*)$/,`$1$1`)}"`)),w=e=>e.replaceAll(/([()\][%!^"`<>&|;, *?])/g,`^$1`),T=async(e,{input:t},n)=>{let r=await e;t!==void 0&&r.stdin.end(t);let i=o(r,`close`);try{return await Promise.race([i,...r.stdio.filter(Boolean).map(e=>E(e))]),D(n,j(r)),M(n)}catch(e){throw await Promise.allSettled([i]),O(e,r,n)}},E=async e=>{for await(let[t]of a(e,`error`))if(![`ERR_STREAM_PREMATURE_CLOSE`,`EPIPE`].includes(t?.code))throw t},D=({command:e},{exitCode:t,signalName:n})=>{if(n!==void 0)throw new A(`Command was terminated with ${n}: ${e}`);if(t!==void 0)throw new A(`Command failed with exit code ${t}: ${e}`)},O=(e,t,n)=>Object.assign(k(e,n),j(t),M(n)),k=(e,{command:t})=>e instanceof A?e:new A(`Command failed: ${t}`,{cause:e});var A=class extends Error{name=`SubprocessError`};const j=({exitCode:e,signalCode:t})=>({...e<1?{}:{exitCode:e},...t===null?{}:{signalName:t}}),M=({state:{stdout:e,stderr:n,output:r},command:i,start:a})=>({stdout:N(e),stderr:N(n),output:N(r),command:i,durationMs:Number(t.hrtime.bigint()-a)/1e6}),N=e=>e.at(-1)===`
2
+ `?e.slice(0,e.at(-2)===`\r`?-2:-1):e,P=async(e,n,r,a)=>{try{[`node`,`node.exe`].includes(e.toLowerCase())&&(e=t.execPath,n=[...t.execArgv.filter(e=>!e.startsWith(`--inspect`)),...n]),[e,n,r]=await h(e,n,r),[e,n,r]=F(e,n,r);let s=i(e,n,r);return I(s.stdout,a,`stdout`),I(s.stderr,a,`stderr`),s.once(`error`,()=>{}),await o(s,`spawn`),s}catch(e){throw O(e,{},a)}},F=(e,t,n)=>n.shell&&t.length>0?[[e,...t].join(` `),[],n]:[e,t,n],I=(e,{state:t},n)=>{e&&(e.setEncoding(`utf8`),t.isIterating[n]||(t.isIterating[n]=!1,e.on(`data`,e=>{t[n]+=e,t.output+=e})))},L=async e=>{let[[t,n]]=await Promise.all([Promise.allSettled(e),R(e)]);if(n.reason)throw n.reason.pipedFrom=t.reason??t.value,n.reason;if(t.reason)throw t.reason;return{...n.value,pipedFrom:t.value}},R=async e=>{try{let[{stdout:t},{stdin:n}]=await Promise.all(e.map(({nodeChildProcess:e})=>e));if(n===null)throw Error(`The "stdin" option must be set on the first "spawn()" call in the pipeline.`);if(t===null)throw Error(`The "stdout" option must be set on the last "spawn()" call in the pipeline.`);c(t,n).catch(()=>{})}catch(t){throw await Promise.allSettled(e.map(({nodeChildProcess:e})=>z(e))),t}},z=async e=>{let{stdin:t}=await e;t.end()},B=async function*(e,{state:t},n,r){if(t.isIterating[n]===!1)throw Error(`The subprocess must be iterated right away, for example:
3
3
  for await (const line of spawn(...)) { ... }`);t.isIterating[n]=!0;try{let{[n]:i}=await e.nodeChildProcess;if(!i){t.nonIterable[r]=!0;let e=t.nonIterable.every(Boolean)?"either the option `stdout` or `stderr`":`the option \`${n}\``;throw TypeError(`The subprocess cannot be iterated unless ${e} is 'pipe'.`)}V(e),yield*l.createInterface({input:i})}finally{await e}},V=async e=>{try{await e}catch{}},H=async function*({state:e},...t){try{let n=[];for(;t.length>0;){n=t.map((t,r)=>n[r]??U(t,r,e));let[{value:r,done:i},a]=await Promise.race(n.map((e,t)=>Promise.all([e,t]))),[o]=t.splice(a,1);n.splice(a,1),i||(t.push(o),yield r)}}finally{await Promise.all(t.map(e=>e.return()))}},U=async(e,t,{nonIterable:n})=>{try{return await e.next()}catch(r){return W(n,t)?e.return():e.throw(r)}},W=(e,t)=>e.every(Boolean)?t!==e.length-1:e[t];function G(e,t,n,r){let[i=[],a={}]=Array.isArray(t)?[t,n]:[[],t],o=u([e,...i]),s=f(a),c=P(e,i,s,o),l=T(c,s,o);Object.assign(l,{nodeChildProcess:c}),l=r?L([r,l]):l;let d=B(l,o,`stdout`,0),p=B(l,o,`stderr`,1);return Object.assign(l,{nodeChildProcess:c,stdout:d,stderr:p,[Symbol.asyncIterator]:()=>H(o,d,p),pipe:(e,t,n)=>G(e,t,n,l)})}export{A as n,G as t};
@@ -0,0 +1 @@
1
+ const e=/^[A-Za-z]:\//;function t(t=``){return t&&t.replace(/\\/g,`/`).replace(e,e=>e.toUpperCase())}const n=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;function r(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const i=function(...e){e=e.map(e=>t(e));let n=``,i=!1;for(let t=e.length-1;t>=-1&&!i;t--){let a=t>=0?e[t]:r();!a||a.length===0||(n=`${a}/${n}`,i=o(a))}return n=a(n,!i),i&&!o(n)?`/${n}`:n.length>0?n:`.`};function a(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}const o=function(e){return n.test(e)},s=function(e,n){let r=t(e).split(`/`),i=``;for(let e=r.length-1;e>=0;e--){let t=r[e];if(t){i=t;break}}return n&&i.endsWith(n)?i.slice(0,-n.length):i};globalThis.process?.platform;export{i as n,s as t};
@@ -1,2 +1,2 @@
1
- function e(e,t,n){let r=n=>e(n,...t);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:t})}function t(t,n,r){let i=t.length-n.length;if(i===0)return t(...n);if(i===1)return e(t,n,r);throw Error(`Wrong number of arguments`)}function n(...e){return t(r,e)}const r=(e,t)=>t.every(t=>t(e));function i(...e){return t(a,e)}const a=(e,t)=>t.some(t=>t(e));function o(...e){return t(s,e)}function s(e,t){if(t<1)throw RangeError(`chunk: A chunk size of '${t.toString()}' would result in an infinite array`);if(e.length===0)return[];if(t>=e.length)return[[...e]];let n=Math.ceil(e.length/t),r=Array(n);if(t===1)for(let[t,n]of e.entries())r[t]=[n];else for(let i=0;i<n;i+=1){let n=i*t;r[i]=e.slice(n,n+t)}return r}function c(...e){return t(l,e)}const l=(e,{min:t,max:n})=>t!==void 0&&e<t?t:n!==void 0&&e>n?n:e;function u(...e){return t(d,e)}const d=(e,t)=>[...e,...t];function f(e){return()=>e}const ee={done:!0,hasNext:!1},p={done:!1,hasNext:!1},m=()=>ee,h=e=>({hasNext:!0,next:e,done:!1});function g(e,...t){let n=e,r=t.map(e=>`lazy`in e?te(e):void 0),i=0;for(;i<t.length;){if(r[i]===void 0||!ne(n)){let e=t[i];n=e(n),i+=1;continue}let e=[];for(let n=i;n<t.length;n++){let t=r[n];if(t===void 0||(e.push(t),t.isSingle))break}let a=[];for(let t of n)if(_(t,a,e))break;let{isSingle:o}=e.at(-1);n=o?a[0]:a,i+=e.length}return n}function _(e,t,n){if(n.length===0)return t.push(e),!1;let r=e,i=p,a=!1;for(let[e,o]of n.entries()){let{index:s,items:c}=o;if(c.push(r),i=o(r,s,c),o.index+=1,i.hasNext){if(i.hasMany??!1){for(let r of i.next)if(_(r,t,n.slice(e+1)))return!0;return a}r=i.next}if(!i.hasNext)break;i.done&&(a=!0)}return i.hasNext&&t.push(r),a}function te(e){let{lazy:t,lazyArgs:n}=e,r=t(...n);return Object.assign(r,{isSingle:t.single??!1,index:0,items:[]})}function ne(e){return typeof e==`string`||typeof e==`object`&&!!e&&Symbol.iterator in e}function v(e,t){let n=t.length-e.length;if(n===1){let[n,...r]=t;return g(n,{lazy:e,lazyArgs:r})}if(n===0){let n={lazy:e,lazyArgs:t};return Object.assign(e=>g(e,n),n)}throw Error(`Wrong number of arguments`)}function y(...e){return v(b,e)}function b(e){if(e.length===0)return h;let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return e=>{let n=t.get(e);return n===void 0||n===0?{done:!1,hasNext:!0,next:e}:(t.set(e,n-1),p)}}function x(...e){return t(re,e)}const re=(e,t)=>e.length>=t,S={asc:(e,t)=>e>t,desc:(e,t)=>e<t};function ie(e,t){let[n,...r]=t;if(!ae(n))return e(n,C(...r));let i=C(n,...r);return t=>e(t,i)}function C(e,t,...n){let r=typeof e==`function`?e:e[0],i=typeof e==`function`?`asc`:e[1],{[i]:a}=S,o=t===void 0?void 0:C(t,...n);return(e,t)=>{let n=r(e),i=r(t);return a(n,i)?1:a(i,n)?-1:o?.(e,t)??0}}function ae(e){if(w(e))return!0;if(typeof e!=`object`||!Array.isArray(e))return!1;let[t,n,...r]=e;return w(t)&&typeof n==`string`&&n in S&&r.length===0}const w=e=>typeof e==`function`&&e.length===1;function T(...e){return t(E,e)}function E(e,t){for(let[n,r]of e.entries())if(!t(r,n,e))return e.slice(n);return[]}function D(...e){return t(Object.entries,e)}function O(...e){return t(k,e,A)}const k=(e,t)=>e.filter(t),A=e=>(t,n,r)=>e(t,n,r)?{done:!1,hasNext:!0,next:t}:p,j=e=>Object.assign(e,{single:!0});function M(...e){return t(N,e,j(P))}const N=(e,t)=>e.find(t),P=e=>(t,n,r)=>e(t,n,r)?{done:!0,hasNext:!0,next:t}:p;function F(...e){return t(I,e)}const I=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}};function L(...e){return t(R,e,j(z))}const R=([e])=>e,z=()=>B,B=e=>({hasNext:!0,next:e,done:!0});function V(t,n){return typeof t==`object`?H(t,n):e(H,t===void 0?[]:[t],U)}const H=(e,t)=>t===void 0?e.flat():e.flat(t),U=e=>e===void 0||e===1?W:e<=0?h:t=>Array.isArray(t)?{next:t.flat(e-1),hasNext:!0,hasMany:!0,done:!1}:{next:t,hasNext:!0,done:!1},W=e=>Array.isArray(e)?{next:e,hasNext:!0,hasMany:!0,done:!1}:{next:e,hasNext:!0,done:!1};function G(...e){return t(K,e,q)}const K=(e,t)=>e.flatMap(t),q=e=>(t,n,r)=>{let i=e(t,n,r);return Array.isArray(i)?{done:!1,hasNext:!0,hasMany:!0,next:i}:{done:!1,hasNext:!0,next:i}};function J(...e){return t(oe,e,se)}function oe(e,t){return e.forEach(t),e}const se=e=>(t,n,r)=>(e(t,n,r),{done:!1,hasNext:!0,next:t});function ce(...e){return t(le,e)}function le(e,t){for(let[n,r]of Object.entries(e))t(r,n,e);return e}const Y=Symbol(`funnel/voidReducer`),ue=()=>Y;function de(e,{triggerAt:t=`end`,minQuietPeriodMs:n,maxBurstDurationMs:r,minGapMs:i,reducer:a=ue}){let o,s,c,l,u=()=>{let t=c;t!==void 0&&(c=void 0,t===Y?e():e(t),i!==void 0&&(s=setTimeout(d,i)))},d=()=>{clearTimeout(s),s=void 0,o===void 0&&u()},f=()=>{clearTimeout(o),o=void 0,l=void 0,s===void 0&&u()};return{call:(...e)=>{let d=o===void 0&&s===void 0;if((t!==`start`||d)&&(c=a(c,...e)),!(o===void 0&&!d)){if(n!==void 0||r!==void 0||i===void 0){clearTimeout(o);let e=Date.now();l??=e;let t=r===void 0?n??0:Math.min(n??r,Math.max(0,r-(e-l)));o=setTimeout(f,t)}t!==`end`&&d&&u()}},cancel:()=>{clearTimeout(o),o=void 0,l=void 0,clearTimeout(s),s=void 0,c=void 0},flush:()=>{f(),d()},get isIdle(){return o===void 0&&s===void 0}}}function fe(...e){return t(pe,e)}const pe=(e,t)=>{let n=Object.create(null);for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);if(a!==void 0){let e=n[a];e===void 0?n[a]=[i]:e.push(i)}}return Object.setPrototypeOf(n,Object.prototype),n};function me(...e){return t(he,e)}function he(e,t){let n=Object.create(null);for(let r of e){let e=r?.[t];if(e!==void 0){let t=n[e];t===void 0?n[e]=[r]:t.push(r)}}return Object.setPrototypeOf(n,Object.prototype),n}function ge(...e){return t(X,e)}function X(e,t){if(e===t||Object.is(e,t))return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(Array.isArray(e))return _e(e,t);if(e instanceof Map)return ve(e,t);if(e instanceof Set)return ye(e,t);if(e instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp)return e.toString()===t.toString();if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let[n,r]of Object.entries(e))if(!(n in t)||!X(r,t[n]))return!1;return!0}function _e(e,t){if(e.length!==t.length)return!1;for(let[n,r]of e.entries())if(!X(r,t[n]))return!1;return!0}function ve(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e.entries())if(!t.has(n)||!X(r,t.get(n)))return!1;return!0}function ye(e,t){if(e.size!==t.size)return!1;let n=[...t];for(let t of e){let e=!1;for(let[r,i]of n.entries())if(X(t,i)){e=!0,n.splice(r,1);break}if(!e)return!1}return!0}function be(){return xe}const xe=e=>e;function Se(...e){return t(Ce,e)}function Ce(e,t){let n={};for(let[r,i]of e.entries()){let a=t(i,r,e);n[a]=i}return n}function we(e){return Array.isArray(e)}function Te(e){return typeof e==`boolean`}function Ee(e){return e!==void 0}function De(e){return e===``||e===void 0?!0:Array.isArray(e)?e.length===0:Object.keys(e).length===0}function Oe(e){if(e==null||e===``)return!0;if(typeof e!=`object`)return!1;if(`length`in e&&typeof e.length==`number`)return e.length===0;if(`size`in e&&typeof e.size==`number`)return e.size===0;for(let t in e)return!1;return Object.getOwnPropertySymbols(e).length===0}const ke=e=>typeof e==`function`;function Ae(e){return e!=null}function je(e){return t=>!e(t)}function Me(e){return e==null}function Ne(e){return typeof e==`number`&&!Number.isNaN(e)}function Pe(e){return e instanceof Promise}function Fe(...e){return t(Ie,e)}function Ie(e,t){if(e===t||Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map)return Le(e,t);if(e instanceof Set&&t instanceof Set)return Re(e,t);let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n){if(!Object.hasOwn(t,r))return!1;let{[r]:n}=e,{[r]:i}=t;if(n!==i||!Object.is(n,i))return!1}return!0}function Le(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e){let e=t.get(n);if(r!==e||!Object.is(r,e))return!1}return!0}function Re(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ze(e){return typeof e==`string`}function Be(e){return!!e}function Ve(...e){return t(Object.keys,e)}function He(...e){return t(Ue,e)}const Ue=e=>e.at(-1);function We(...e){return t(Ge,e,Ke)}const Ge=(e,t)=>e.map(t),Ke=e=>(t,n,r)=>({done:!1,hasNext:!0,next:e(t,n,r)});function qe(...e){return t(Je,e)}function Je(e,t){let n={};for(let[r,i]of e.entries()){let[a,o]=t(i,r,e);n[a]=o}return n}function Ye(...e){return t(Xe,e)}function Xe(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=t(i,r,e);return n}function Ze(...e){return t(Qe,e)}function Qe(e,t){if(!x(t,1))return{...e};if(!x(t,2)){let{[t[0]]:n,...r}=e;return r}let n={...e};for(let e of t)delete n[e];return n}function $e(...e){return t(et,e)}function et(e,t){let n={...e};for(let[r,i]of Object.entries(n))t(i,r,e)&&delete n[r];return n}function tt(e){let t=!1,n;return()=>(t||=(n=e(),!0),n)}function nt(...e){return t(rt,e)}const rt=e=>e.length===1?e[0]:void 0;function it(...e){return t(at,e)}const at=(e,t)=>{let n=[[],[]];for(let[r,i]of e.entries())t(i,r,e)?n[0].push(i):n[1].push(i);return n};function ot(...e){return t(st,e)}function st(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function ct(...e){return t(lt,e)}function lt(e,t){let n={};for(let[r,i]of Object.entries(e))t(i,r,e)&&(n[r]=i);return n}function ut(...e){return t=>g(t,...e)}function dt(e,...t){return typeof e==`string`||typeof e==`number`||typeof e==`symbol`?n=>Z(n,e,...t):Z(e,...t)}function Z(e,...t){let n=e;for(let e of t){if(n==null)return;n=n[e]}return n}function ft(...e){return t(pt,e)}function pt(e,t,n){let r={};for(let[i,a]of e.entries()){let o=t(a,i,e);r[o]=n(a,i,e)}return r}function mt(e,t){let n=Math.ceil(e),r=Math.floor(t);if(r<n)throw RangeError(`randomInteger: The range [${e.toString()},${t.toString()}] contains no integer`);return Math.floor(Math.random()*(r-n+1)+n)}function ht(...e){return t(gt,e)}const gt=(e,t,n)=>e.reduce(t,n);function _t(...e){return t(vt,e)}function vt(e){return[...e].reverse()}function yt(...e){return t(bt,e)}function bt(e,t){let n=[...e];return n.sort(t),n}function xt(...e){return ie(St,e)}const St=(e,t)=>[...e].sort(t);function Ct(e,t,n){return typeof t==`number`||t===void 0?n=>n.split(e,t):e.split(t,n)}function wt(...e){return t(Tt,e,Et)}const Tt=(e,t)=>t<0?[]:e.slice(0,t);function Et(e){if(e<=0)return m;let t=e;return e=>(--t,{done:t<=0,hasNext:!0,next:e})}function Dt(...e){return t(Q,e)}function Q(e,t){let n=[];for(let[r,i]of e.entries()){if(!t(i,r,e))break;n.push(i)}return n}function Ot(...e){return t(kt,e)}function kt(e,t){return t(e),e}new Set([`-`,`_`,...` .
2
- .\v.\f.\r. .….\xA0. . . . . . . . . . . . .\u2028.\u2029. . . .`.split(`.`)]);function At(...e){return v(jt,e)}function jt(){let e=new Set;return t=>e.has(t)?p:(e.add(t),{done:!1,hasNext:!0,next:t})}function Mt(...e){return v(Nt,e)}function Nt(e){let t=e,n=new Set;return(e,r,i)=>{let a=t(e,r,i);return n.has(a)?p:(n.add(a),{done:!1,hasNext:!0,next:e})}}function Pt(...e){return t(Object.values,e)}function Ft(...e){return e.length===2?(t,...n)=>$(t,...e,...n):$(...e)}const $=(e,t,n,...r)=>t(e,...r)?typeof n==`function`?n(e,...r):n.onTrue(e,...r):typeof n==`function`?e:n.onFalse(e,...r);function It(...e){return t(Lt,e,Rt)}const Lt=(e,t)=>e.length<t.length?e.map((e,n)=>[e,t[n]]):t.map((t,n)=>[e[n],t]),Rt=e=>(t,n)=>({hasNext:!0,next:[t,e[n]],done:n>=e.length-1});export{V as $,Be as A,De as B,$e as C,We as D,qe as E,Me as F,be as G,Te as H,je as I,fe as J,ge as K,Ae as L,Fe as M,Pe as N,He as O,Ne as P,G as Q,ke as R,tt as S,Ye as T,we as U,Ee as V,Se as W,ce as X,de as Y,J as Z,ut as _,At as a,T as at,it as b,wt as c,g as ct,yt as d,c as dt,L as et,_t as f,o as ft,dt as g,ft as h,t as ht,Mt as i,D as it,ze as j,Ve as k,Ct as l,f as lt,mt as m,n as mt,Ft as n,M as nt,Ot as o,x as ot,ht as p,i as pt,me as q,Pt as r,O as rt,Dt as s,y as st,It as t,F as tt,xt as u,u as ut,ct as v,Ze as w,nt as x,ot as y,Oe as z};
1
+ function e(e,t,n){let r=n=>e(n,...t);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:t})}function t(t,n,r){let i=t.length-n.length;if(i===0)return t(...n);if(i===1)return e(t,n,r);throw Error(`Wrong number of arguments`)}function n(...e){return t(r,e)}const r=(e,t)=>t.every(t=>t(e));function i(...e){return t(a,e)}const a=(e,t)=>t.some(t=>t(e));function o(...e){return t(s,e)}function s(e,t){if(t<1)throw RangeError(`chunk: A chunk size of '${t.toString()}' would result in an infinite array`);if(e.length===0)return[];if(t>=e.length)return[[...e]];let n=Math.ceil(e.length/t),r=Array(n);if(t===1)for(let[t,n]of e.entries())r[t]=[n];else for(let i=0;i<n;i+=1){let n=i*t;r[i]=e.slice(n,n+t)}return r}function c(...e){return t(l,e)}const l=(e,{min:t,max:n})=>t!==void 0&&e<t?t:n!==void 0&&e>n?n:e;function u(...e){return t(d,e)}const d=(e,t)=>[...e,...t];function f(e){return()=>e}const ee={done:!0,hasNext:!1},p={done:!1,hasNext:!1},m=()=>ee,h=e=>({hasNext:!0,next:e,done:!1});function g(e,...t){let n=e,r=t.map(e=>`lazy`in e?te(e):void 0),i=0;for(;i<t.length;){if(r[i]===void 0||!ne(n)){let e=t[i];n=e(n),i+=1;continue}let e=[];for(let n=i;n<t.length;n++){let t=r[n];if(t===void 0||(e.push(t),t.isSingle))break}let a=[];for(let t of n)if(_(t,a,e))break;let{isSingle:o}=e.at(-1);n=o?a[0]:a,i+=e.length}return n}function _(e,t,n){if(n.length===0)return t.push(e),!1;let r=e,i=p,a=!1;for(let[e,o]of n.entries()){let{index:s,items:c}=o;if(c.push(r),i=o(r,s,c),o.index+=1,i.hasNext){if(i.hasMany??!1){for(let r of i.next)if(_(r,t,n.slice(e+1)))return!0;return a}r=i.next}if(!i.hasNext)break;i.done&&(a=!0)}return i.hasNext&&t.push(r),a}function te(e){let{lazy:t,lazyArgs:n}=e,r=t(...n);return Object.assign(r,{isSingle:t.single??!1,index:0,items:[]})}function ne(e){return typeof e==`string`||typeof e==`object`&&!!e&&Symbol.iterator in e}function v(e,t){let n=t.length-e.length;if(n===1){let[n,...r]=t;return g(n,{lazy:e,lazyArgs:r})}if(n===0){let n={lazy:e,lazyArgs:t};return Object.assign(e=>g(e,n),n)}throw Error(`Wrong number of arguments`)}function y(...e){return v(b,e)}function b(e){if(e.length===0)return h;let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return e=>{let n=t.get(e);return n===void 0||n===0?{done:!1,hasNext:!0,next:e}:(t.set(e,n-1),p)}}function x(...e){return t(re,e)}const re=(e,t)=>e.length>=t,S={asc:(e,t)=>e>t,desc:(e,t)=>e<t};function ie(e,t){let[n,...r]=t;if(!ae(n))return e(n,C(...r));let i=C(n,...r);return t=>e(t,i)}function C(e,t,...n){let r=typeof e==`function`?e:e[0],i=typeof e==`function`?`asc`:e[1],{[i]:a}=S,o=t===void 0?void 0:C(t,...n);return(e,t)=>{let n=r(e),i=r(t);return a(n,i)?1:a(i,n)?-1:o?.(e,t)??0}}function ae(e){if(w(e))return!0;if(typeof e!=`object`||!Array.isArray(e))return!1;let[t,n,...r]=e;return w(t)&&typeof n==`string`&&n in S&&r.length===0}const w=e=>typeof e==`function`&&e.length===1;function T(...e){return t(E,e)}function E(e,t){for(let[n,r]of e.entries())if(!t(r,n,e))return e.slice(n);return[]}function D(...e){return t(Object.entries,e)}function O(...e){return t(k,e,A)}const k=(e,t)=>e.filter(t),A=e=>(t,n,r)=>e(t,n,r)?{done:!1,hasNext:!0,next:t}:p,j=e=>Object.assign(e,{single:!0});function M(...e){return t(N,e,j(P))}const N=(e,t)=>e.find(t),P=e=>(t,n,r)=>e(t,n,r)?{done:!0,hasNext:!0,next:t}:p;function F(...e){return t(I,e)}const I=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}};function L(...e){return t(R,e,j(z))}const R=([e])=>e,z=()=>B,B=e=>({hasNext:!0,next:e,done:!0});function V(t,n){return typeof t==`object`?H(t,n):e(H,t===void 0?[]:[t],U)}const H=(e,t)=>t===void 0?e.flat():e.flat(t),U=e=>e===void 0||e===1?W:e<=0?h:t=>Array.isArray(t)?{next:t.flat(e-1),hasNext:!0,hasMany:!0,done:!1}:{next:t,hasNext:!0,done:!1},W=e=>Array.isArray(e)?{next:e,hasNext:!0,hasMany:!0,done:!1}:{next:e,hasNext:!0,done:!1};function G(...e){return t(K,e,q)}const K=(e,t)=>e.flatMap(t),q=e=>(t,n,r)=>{let i=e(t,n,r);return Array.isArray(i)?{done:!1,hasNext:!0,hasMany:!0,next:i}:{done:!1,hasNext:!0,next:i}};function J(...e){return t(oe,e,se)}function oe(e,t){return e.forEach(t),e}const se=e=>(t,n,r)=>(e(t,n,r),{done:!1,hasNext:!0,next:t});function ce(...e){return t(le,e)}function le(e,t){for(let[n,r]of Object.entries(e))t(r,n,e);return e}const Y=Symbol(`funnel/voidReducer`),ue=()=>Y;function de(e,{triggerAt:t=`end`,minQuietPeriodMs:n,maxBurstDurationMs:r,minGapMs:i,reducer:a=ue}){let o,s,c,l,u=()=>{let t=c;t!==void 0&&(c=void 0,t===Y?e():e(t),i!==void 0&&(s=setTimeout(d,i)))},d=()=>{clearTimeout(s),s=void 0,o===void 0&&u()},f=()=>{clearTimeout(o),o=void 0,l=void 0,s===void 0&&u()};return{call:(...e)=>{let d=o===void 0&&s===void 0;if((t!==`start`||d)&&(c=a(c,...e)),!(o===void 0&&!d)){if(n!==void 0||r!==void 0||i===void 0){clearTimeout(o);let e=Date.now();l??=e;let t=r===void 0?n??0:Math.min(n??r,Math.max(0,r-(e-l)));o=setTimeout(f,t)}t!==`end`&&d&&u()}},cancel:()=>{clearTimeout(o),o=void 0,l=void 0,clearTimeout(s),s=void 0,c=void 0},flush:()=>{f(),d()},get isIdle(){return o===void 0&&s===void 0}}}function fe(...e){return t(pe,e)}const pe=(e,t)=>{let n=Object.create(null);for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);if(a!==void 0){let e=n[a];e===void 0?n[a]=[i]:e.push(i)}}return Object.setPrototypeOf(n,Object.prototype),n};function me(...e){return t(he,e)}function he(e,t){let n=Object.create(null);for(let r of e){let e=r?.[t];if(e!==void 0){let t=n[e];t===void 0?n[e]=[r]:t.push(r)}}return Object.setPrototypeOf(n,Object.prototype),n}function ge(...e){return t(X,e)}function X(e,t){if(e===t||Object.is(e,t))return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(Array.isArray(e))return _e(e,t);if(e instanceof Map)return ve(e,t);if(e instanceof Set)return ye(e,t);if(e instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp)return e.toString()===t.toString();if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let[n,r]of Object.entries(e))if(!(n in t)||!X(r,t[n]))return!1;return!0}function _e(e,t){if(e.length!==t.length)return!1;for(let[n,r]of e.entries())if(!X(r,t[n]))return!1;return!0}function ve(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e.entries())if(!t.has(n)||!X(r,t.get(n)))return!1;return!0}function ye(e,t){if(e.size!==t.size)return!1;let n=[...t];for(let t of e){let e=!1;for(let[r,i]of n.entries())if(X(t,i)){e=!0,n.splice(r,1);break}if(!e)return!1}return!0}function be(){return xe}const xe=e=>e;function Se(...e){return t(Ce,e)}function Ce(e,t){let n={};for(let[r,i]of e.entries()){let a=t(i,r,e);n[a]=i}return n}function we(e){return Array.isArray(e)}function Te(e){return typeof e==`boolean`}function Ee(e){return e!==void 0}function De(e){return e===``||e===void 0?!0:Array.isArray(e)?e.length===0:Object.keys(e).length===0}function Oe(e){if(e==null||e===``)return!0;if(typeof e!=`object`)return!1;if(`length`in e&&typeof e.length==`number`)return e.length===0;if(`size`in e&&typeof e.size==`number`)return e.size===0;for(let t in e)return!1;return Object.getOwnPropertySymbols(e).length===0}const ke=e=>typeof e==`function`;function Ae(e){return e!=null}function je(e){return t=>!e(t)}function Me(e){return e==null}function Ne(e){return typeof e==`number`&&!Number.isNaN(e)}function Pe(e){return e instanceof Promise}function Fe(...e){return t(Ie,e)}function Ie(e,t){if(e===t||Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map)return Le(e,t);if(e instanceof Set&&t instanceof Set)return Re(e,t);let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n){if(!Object.hasOwn(t,r))return!1;let{[r]:n}=e,{[r]:i}=t;if(n!==i||!Object.is(n,i))return!1}return!0}function Le(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e){let e=t.get(n);if(r!==e||!Object.is(r,e))return!1}return!0}function Re(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ze(e){return typeof e==`string`}function Be(e){return!!e}function Ve(...e){return t(Object.keys,e)}function He(...e){return t(Ue,e)}const Ue=e=>e.at(-1);function We(...e){return t(Ge,e,Ke)}const Ge=(e,t)=>e.map(t),Ke=e=>(t,n,r)=>({done:!1,hasNext:!0,next:e(t,n,r)});function qe(...e){return t(Je,e)}function Je(e,t){let n={};for(let[r,i]of e.entries()){let[a,o]=t(i,r,e);n[a]=o}return n}function Ye(...e){return t(Xe,e)}function Xe(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=t(i,r,e);return n}function Ze(...e){return t(Qe,e)}function Qe(e,t){if(!x(t,1))return{...e};if(!x(t,2)){let{[t[0]]:n,...r}=e;return r}let n={...e};for(let e of t)delete n[e];return n}function $e(...e){return t(et,e)}function et(e,t){let n={...e};for(let[r,i]of Object.entries(n))t(i,r,e)&&delete n[r];return n}function tt(e){let t=!1,n;return()=>(t||=(n=e(),!0),n)}function nt(...e){return t(rt,e)}const rt=e=>e.length===1?e[0]:void 0;function it(...e){return t(at,e)}const at=(e,t)=>{let n=[[],[]];for(let[r,i]of e.entries())t(i,r,e)?n[0].push(i):n[1].push(i);return n};function ot(...e){return t(st,e)}function st(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function ct(...e){return t(lt,e)}function lt(e,t){let n={};for(let[r,i]of Object.entries(e))t(i,r,e)&&(n[r]=i);return n}function ut(...e){return t=>g(t,...e)}function dt(e,...t){return typeof e==`string`||typeof e==`number`||typeof e==`symbol`?n=>Z(n,e,...t):Z(e,...t)}function Z(e,...t){let n=e;for(let e of t){if(n==null)return;n=n[e]}return n}function ft(...e){return t(pt,e)}function pt(e,t,n){let r={};for(let[i,a]of e.entries()){let o=t(a,i,e);r[o]=n(a,i,e)}return r}function mt(e,t){let n=Math.ceil(e),r=Math.floor(t);if(r<n)throw RangeError(`randomInteger: The range [${e.toString()},${t.toString()}] contains no integer`);return Math.floor(Math.random()*(r-n+1)+n)}function ht(...e){return t(gt,e)}function gt(e){let t=[];for(let n=0;n<e;n++){let e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`[Math.floor(Math.random()*62)];t.push(e)}return t.join(``)}function _t(...e){return t(vt,e)}const vt=(e,t,n)=>e.reduce(t,n);function yt(...e){return t(bt,e)}function bt(e){return[...e].reverse()}function xt(...e){return t(St,e)}function St(e,t){let n=[...e];return n.sort(t),n}function Ct(...e){return ie(wt,e)}const wt=(e,t)=>[...e].sort(t);function Tt(e,t,n){return typeof t==`number`||t===void 0?n=>n.split(e,t):e.split(t,n)}function Et(...e){return t(Dt,e,Q)}const Dt=(e,t)=>t<0?[]:e.slice(0,t);function Q(e){if(e<=0)return m;let t=e;return e=>(--t,{done:t<=0,hasNext:!0,next:e})}function Ot(...e){return t(kt,e)}function kt(e,t){let n=[];for(let[r,i]of e.entries()){if(!t(i,r,e))break;n.push(i)}return n}function At(...e){return t(jt,e)}function jt(e,t){return t(e),e}new Set([`-`,`_`,...` .
2
+ .\v.\f.\r. .….\xA0. . . . . . . . . . . . .\u2028.\u2029. . . .`.split(`.`)]);function Mt(...e){return v(Nt,e)}function Nt(){let e=new Set;return t=>e.has(t)?p:(e.add(t),{done:!1,hasNext:!0,next:t})}function Pt(...e){return v(Ft,e)}function Ft(e){let t=e,n=new Set;return(e,r,i)=>{let a=t(e,r,i);return n.has(a)?p:(n.add(a),{done:!1,hasNext:!0,next:e})}}function It(...e){return t(Object.values,e)}function Lt(...e){return e.length===2?(t,...n)=>$(t,...e,...n):$(...e)}const $=(e,t,n,...r)=>t(e,...r)?typeof n==`function`?n(e,...r):n.onTrue(e,...r):typeof n==`function`?e:n.onFalse(e,...r);function Rt(...e){return t(zt,e,Bt)}const zt=(e,t)=>e.length<t.length?e.map((e,n)=>[e,t[n]]):t.map((t,n)=>[e[n],t]),Bt=e=>(t,n)=>({hasNext:!0,next:[t,e[n]],done:n>=e.length-1});export{G as $,Ve as A,Oe as B,tt as C,qe as D,Ye as E,Ne as F,Se as G,Ee as H,Me as I,me as J,be as K,je as L,ze as M,Fe as N,We as O,Pe as P,J as Q,Ae as R,nt as S,Ze as T,Te as U,De as V,we as W,de as X,fe as Y,ce as Z,dt as _,Mt as a,D as at,ot as b,Et as c,y as ct,xt as d,u as dt,V as et,yt as f,c as ft,ft as g,t as gt,mt as h,n as ht,Pt as i,O as it,Be as j,He as k,Tt as l,g as lt,ht as m,i as mt,Lt as n,F as nt,At as o,T as ot,_t as p,o as pt,ge as q,It as r,M as rt,Ot as s,x as st,Rt as t,L as tt,Ct as u,f as ut,ut as v,$e as w,it as x,ct as y,ke as z};
@@ -0,0 +1 @@
1
+ var e={reset:[0,0],bold:[1,22,`\x1B[22m\x1B[1m`],dim:[2,22,`\x1B[22m\x1B[2m`],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]};function t(e){return String(e)}t.open=``,t.close=``;function n(){let e=typeof process<`u`?process:void 0,t=e?.env||{},n=t.FORCE_TTY!==`false`,r=e?.argv||[];return!(`NO_COLOR`in t||r.includes(`--no-color`))&&(`FORCE_COLOR`in t||r.includes(`--color`)||e?.platform===`win32`||n&&t.TERM!==`dumb`||`CI`in t)||typeof window<`u`&&!!window.chrome}function r(){let r=n(),i=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},a=(e,t,n=e)=>{let r=r=>{let a=String(r),o=a.indexOf(t,e.length);return~o?e+i(a,t,n,o)+t:e+a+t};return r.open=e,r.close=t,r},o={isColorSupported:r},s=e=>`\x1B[${e}m`;for(let n in e){let i=e[n];o[n]=r?a(s(i[0]),s(i[1]),i[2]):t}return o}var i=r();export{i as t};
@@ -1 +1 @@
1
- import{s as e}from"../rolldown-runtime.mjs";import{t}from"./is-plain-obj.mjs";import"./devlop.mjs";import{n}from"./mdast-util-from-markdown.mjs";import{t as r}from"./bail.mjs";import{t as i}from"./extend.mjs";import{t as a}from"./trough.mjs";import o from"node:path";import s from"node:process";import{fileURLToPath as c}from"node:url";var l=class extends Error{constructor(e,t,r){super(),typeof t==`string`&&(r=t,t=void 0);let i=``,a={},o=!1;if(t&&(a=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?i=e:!a.cause&&e&&(o=!0,i=e.message,a.cause=e),!a.ruleId&&!a.source&&typeof r==`string`){let e=r.indexOf(`:`);e===-1?a.ruleId=r:(a.source=r.slice(0,e),a.ruleId=r.slice(e+1))}if(!a.place&&a.ancestors&&a.ancestors){let e=a.ancestors[a.ancestors.length-1];e&&(a.place=e.position)}let s=a.place&&`start`in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=s?s.line:void 0,this.name=n(a.place)||`1:1`,this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack==`string`?a.cause.stack:``,this.actual,this.expected,this.note,this.url}};l.prototype.file=``,l.prototype.name=``,l.prototype.reason=``,l.prototype.message=``,l.prototype.stack=``,l.prototype.column=void 0,l.prototype.line=void 0,l.prototype.ancestors=void 0,l.prototype.cause=void 0,l.prototype.fatal=void 0,l.prototype.place=void 0,l.prototype.ruleId=void 0,l.prototype.source=void 0;function u(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}const d=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`];var f=class{constructor(e){let t;t=e?u(e)?{path:e}:typeof e==`string`||g(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:s.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<d.length;){let e=d[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)d.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?o.basename(this.path):void 0}set basename(e){m(e,`basename`),p(e,`basename`),this.path=o.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?o.dirname(this.path):void 0}set dirname(e){h(this.basename,`dirname`),this.path=o.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?o.extname(this.path):void 0}set extname(e){if(p(e,`extname`),h(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=o.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){u(e)&&(e=c(e)),m(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?o.basename(this.path,this.extname):void 0}set stem(e){m(e,`stem`),p(e,`stem`),this.path=o.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new l(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function p(e,t){if(e&&e.includes(o.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+o.sep+"`")}function m(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function h(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function g(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}const _=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r});var v=e(i(),1);const y={}.hasOwnProperty,b=new class e extends _{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=a()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,v.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(C(`data`,this.frozen),this.namespace[e]=t,this):y.call(this.namespace,e)&&this.namespace[e]||void 0:e?(C(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=E(e),n=this.parser||this.Parser;return x(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),x(`process`,this.parser||this.Parser),S(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=E(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);O(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),x(`processSync`,this.parser||this.Parser),S(`processSync`,this.compiler||this.Compiler),this.process(e,i),T(`processSync`,`process`,t),n;function i(e,i){t=!0,r(e),n=i}}run(e,t,n){w(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=E(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,i;return this.run(e,t,a),T(`runSync`,`run`,n),i;function a(e,t){r(e),i=t,n=!0}}stringify(e,t){this.freeze();let n=E(t),r=this.compiler||this.Compiler;return S(`stringify`,r),w(e),r(e,n)}use(e,...n){let r=this.attachers,i=this.namespace;if(C(`use`,this.frozen),e!=null)if(typeof e==`function`)c(e,n);else if(typeof e==`object`)Array.isArray(e)?s(e):o(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function a(e){if(typeof e==`function`)c(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;c(t,n)}else o(e);else throw TypeError("Expected usable value, not `"+e+"`")}function o(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(e.plugins),e.settings&&(i.settings=(0,v.default)(!0,i.settings,e.settings))}function s(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];a(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function c(e,n){let i=-1,a=-1;for(;++i<r.length;)if(r[i][0]===e){a=i;break}if(a===-1)r.push([e,...n]);else if(n.length>0){let[i,...o]=n,s=r[a][1];t(s)&&t(i)&&(i=(0,v.default)(!0,s,i)),r[a]=[e,i,...o]}}}}().freeze();function x(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function S(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function C(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function w(e){if(!t(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function T(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function E(e){return D(e)?e:new f(e)}function D(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function O(e){return typeof e==`string`||k(e)}function k(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}export{b as t};
1
+ import{s as e}from"../rolldown-runtime.mjs";import"./devlop.mjs";import{n as t}from"./mdast-util-from-markdown.mjs";import{t as n}from"./bail.mjs";import{t as r}from"./extend.mjs";import{t as i}from"./is-plain-obj.mjs";import{t as a}from"./trough.mjs";import o from"node:path";import s from"node:process";import{fileURLToPath as c}from"node:url";var l=class extends Error{constructor(e,n,r){super(),typeof n==`string`&&(r=n,n=void 0);let i=``,a={},o=!1;if(n&&(a=`line`in n&&`column`in n||`start`in n&&`end`in n?{place:n}:`type`in n?{ancestors:[n],place:n.position}:{...n}),typeof e==`string`?i=e:!a.cause&&e&&(o=!0,i=e.message,a.cause=e),!a.ruleId&&!a.source&&typeof r==`string`){let e=r.indexOf(`:`);e===-1?a.ruleId=r:(a.source=r.slice(0,e),a.ruleId=r.slice(e+1))}if(!a.place&&a.ancestors&&a.ancestors){let e=a.ancestors[a.ancestors.length-1];e&&(a.place=e.position)}let s=a.place&&`start`in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=s?s.line:void 0,this.name=t(a.place)||`1:1`,this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack==`string`?a.cause.stack:``,this.actual,this.expected,this.note,this.url}};l.prototype.file=``,l.prototype.name=``,l.prototype.reason=``,l.prototype.message=``,l.prototype.stack=``,l.prototype.column=void 0,l.prototype.line=void 0,l.prototype.ancestors=void 0,l.prototype.cause=void 0,l.prototype.fatal=void 0,l.prototype.place=void 0,l.prototype.ruleId=void 0,l.prototype.source=void 0;function u(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}const d=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`];var f=class{constructor(e){let t;t=e?u(e)?{path:e}:typeof e==`string`||g(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:s.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<d.length;){let e=d[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)d.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?o.basename(this.path):void 0}set basename(e){m(e,`basename`),p(e,`basename`),this.path=o.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?o.dirname(this.path):void 0}set dirname(e){h(this.basename,`dirname`),this.path=o.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?o.extname(this.path):void 0}set extname(e){if(p(e,`extname`),h(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=o.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){u(e)&&(e=c(e)),m(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?o.basename(this.path,this.extname):void 0}set stem(e){m(e,`stem`),p(e,`stem`),this.path=o.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new l(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function p(e,t){if(e&&e.includes(o.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+o.sep+"`")}function m(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function h(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function g(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}const _=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r});var v=e(r(),1);const y={}.hasOwnProperty,b=new class e extends _{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=a()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,v.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(C(`data`,this.frozen),this.namespace[e]=t,this):y.call(this.namespace,e)&&this.namespace[e]||void 0:e?(C(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=E(e),n=this.parser||this.Parser;return x(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),x(`process`,this.parser||this.Parser),S(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=E(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);O(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,r;return this.freeze(),x(`processSync`,this.parser||this.Parser),S(`processSync`,this.compiler||this.Compiler),this.process(e,i),T(`processSync`,`process`,t),r;function i(e,i){t=!0,n(e),r=i}}run(e,t,n){w(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=E(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let r=!1,i;return this.run(e,t,a),T(`runSync`,`run`,r),i;function a(e,t){n(e),i=t,r=!0}}stringify(e,t){this.freeze();let n=E(t),r=this.compiler||this.Compiler;return S(`stringify`,r),w(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(C(`use`,this.frozen),e!=null)if(typeof e==`function`)c(e,t);else if(typeof e==`object`)Array.isArray(e)?s(e):o(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function a(e){if(typeof e==`function`)c(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;c(t,n)}else o(e);else throw TypeError("Expected usable value, not `"+e+"`")}function o(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(e.plugins),e.settings&&(r.settings=(0,v.default)(!0,r.settings,e.settings))}function s(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];a(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function c(e,t){let r=-1,a=-1;for(;++r<n.length;)if(n[r][0]===e){a=r;break}if(a===-1)n.push([e,...t]);else if(t.length>0){let[r,...o]=t,s=n[a][1];i(s)&&i(r)&&(r=(0,v.default)(!0,s,r)),n[a]=[e,r,...o]}}}}().freeze();function x(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function S(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function C(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function w(e){if(!i(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function T(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function E(e){return D(e)?e:new f(e)}function D(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function O(e){return typeof e==`string`||k(e)}function k(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}export{b as t};