@visulima/cerebro 3.0.6 → 3.1.1
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.
- package/CHANGELOG.md +14 -0
- package/LICENSE.md +5 -811
- package/README.md +41 -0
- package/dist/commands/completion-command.d.ts +1 -1
- package/dist/commands/completion-command.js +5 -5
- package/dist/commands/help-command.d.ts +1 -1
- package/dist/commands/help-command.js +1 -1
- package/dist/commands/readme-command.d.ts +1 -1
- package/dist/commands/readme-command.js +20 -20
- package/dist/commands/version-command.d.ts +1 -1
- package/dist/commands/version-command.js +1 -1
- package/dist/index.d.ts +284 -7
- package/dist/index.js +1 -1
- package/dist/logger/create-pail-logger.d.ts +36 -1
- package/dist/logger/create-pail-logger.js +1 -1
- package/dist/packem_chunks/has-new-version.js +1 -1
- package/dist/packem_shared/Cerebro-B02RU3RC.js +4 -0
- package/dist/packem_shared/InvalidArgumentChoiceError-BpovuqrZ.js +1 -0
- package/dist/packem_shared/MissingArgumentError-D78kza2a.js +1 -0
- package/dist/packem_shared/SurplusArgumentError-BLwT9lo0.js +1 -0
- package/dist/packem_shared/VERBOSITY_DEBUG-D7HfSD5l.js +1 -0
- package/dist/packem_shared/VisulimaError-BDqtOVL5-Db_MJ_p7.js +1 -0
- package/dist/packem_shared/VisulimaError-CuhG0hlQ.js +76 -0
- package/dist/packem_shared/cerebro-error-Dv3FuXO8.js +1 -0
- package/dist/packem_shared/{command.d-B_G9vIYJ.d.ts → command.d-Dz7hkMI0.d.ts} +160 -4
- package/dist/packem_shared/constants-BKuEbBw1-BRv49X2l.js +1 -0
- package/dist/packem_shared/defineCommand-C_isHeEs.js +1 -0
- package/dist/packem_shared/format-positional-usage-DWL9qN10.js +6 -0
- package/dist/packem_shared/format-user-facing-error-Cb7ySnUi.js +2 -0
- package/dist/packem_shared/lazyNamed-BKSCmVsV.js +1 -0
- package/dist/packem_shared/renderError-CIIYTTfx-BdX-afLI.js +27 -0
- package/dist/packem_shared/runtime-process-BN-eTlwy.js +1 -0
- package/dist/plugins/error-handler-plugin.d.ts +1 -1
- package/dist/plugins/error-handler-plugin.js +1 -1
- package/dist/plugins/runtime-version-check-plugin.d.ts +1 -1
- package/dist/plugins/runtime-version-check-plugin.js +1 -1
- package/dist/plugins/update-notifier/update-notifier-plugin.d.ts +1 -1
- package/dist/plugins/update-notifier/update-notifier-plugin.js +1 -1
- package/dist/util/general/heap-tuning.js +1 -1
- package/package.json +4 -4
- package/dist/packem_shared/Cerebro-58LHN3_T.js +0 -4
- package/dist/packem_shared/VERBOSITY_DEBUG-XPultrIA.js +0 -1
- package/dist/packem_shared/VisulimaError-DTMgXonA-CzaryRgZ.js +0 -1
- package/dist/packem_shared/VisulimaError-k1qGkvab.js +0 -76
- package/dist/packem_shared/cerebro-error-DWpjBY_M.js +0 -1
- package/dist/packem_shared/index-Dpm7gUHe.js +0 -29
- package/dist/packem_shared/lazyNamed-DMUm8mZe.js +0 -1
- package/dist/packem_shared/renderError-BISXNU8L-B47ZikMV.js +0 -27
- package/dist/packem_shared/runtime-process-BEw54Ar-.js +0 -1
- package/dist/packem_shared/split-by-case-BZ6XOTIf.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=(a,t)=>async()=>({default:(await a())[t]});export{e as lazyNamed};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const q=globalThis.process??Object.create(null),M={versions:{}},w=new Proxy(q,{get(e,t){if(t in e)return e[t];if(t in M)return M[t]}}),D=e=>e.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
2
|
-
`),Y=(e,t,r,n)=>{const o={column:0,line:-1,...e.start},i={...o,...e.end},l=o.line,s=o.column,a=i.line,d=i.column;let c=Math.max(l-(r+1),0),m=Math.min(t.length,a+n);l===-1&&(c=0),a===-1&&(m=t.length);const p=a-l,f={};if(p)for(let u=0;u<=p;u++){const h=u+l;if(!s)f[h]=!0;else if(u===0){const $=t[h-1]?.length;f[h]=[s,($??0)-s+1]}else if(u===p)f[h]=[0,d];else{const $=t[h-u]?.length;f[h]=[0,$]}}else s===d?f[l]=s?[s,0]:!0:f[l]=[s,(d??0)-(s??0)];return{end:m,markerLines:f,start:c}},H=w.platform==="win32"&&!w.env?.WT_SESSION?">":"❯",K=(e,t,r)=>{const n={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...r,color:{gutter:u=>u,marker:u=>u,message:u=>u,...r?.color}},o=typeof t.start.column=="number";let i=(e.includes("\r")?D(e):e).split(`
|
|
3
|
-
`);typeof n.tabWidth=="number"&&e.includes(" ")&&(i=i.map(u=>u.replaceAll(" "," ".repeat(n.tabWidth))));const{end:l,markerLines:s,start:a}=Y(t,i,n.linesAbove,n.linesBelow),d=String(l).length,{gutter:c,marker:m,message:p}=n.color;let f=i.slice(a,l).map((u,h)=>{const $=a+1+h,x=s[$],R=String($).padStart(d),_=!s[$+1],N=` ${R}${n.showGutter?" |":""}`;if(x){let E="";if(Array.isArray(x)){const z=u.replaceAll(/[^\t]/g," ").slice(0,Math.max(x[0]-1,0)),U=x[1]||1;E=[`
|
|
4
|
-
`,n.prefix+c(N.replaceAll(/\d/g," "))," ",z,m("^").repeat(U)].join(""),_&&n.message&&(E+=` ${p(n.message)}`)}return[n.prefix+m(H),c(N),u.length>0?` ${u}`:"",E].join("")}return`${n.prefix} ${c(N)}${u.length>0?` ${u}`:""}`}).join(`
|
|
5
|
-
`);return n.message&&!o&&(f=`${n.prefix+" ".repeat(d+1)+n.message}
|
|
6
|
-
${f}`),f},b=e=>{let t;return()=>{if(t===void 0){if(typeof w.getBuiltinModule!="function")throw new TypeError(`[@visulima/error] Cannot load ${e}: this runtime implements no process.getBuiltinModule(). Requires Node ^22.14.0 || >=24.10.0, or another runtime providing process.getBuiltinModule().`);t=w.getBuiltinModule(e)}return t}},Q=()=>w.env?.DEBUG==="true",g=(e,...t)=>{if(Q()){const r=t.map(n=>typeof n=="function"?n():n);console.debug(`error:parse-stacktrace: ${e}`,...r)}},y="<unknown>",X=/^(?:node:internal\/|node:|internal\/)/,Z=e=>e!==void 0&&X.test(e),ee=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,te=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,re=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,ne=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,ie=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,oe=/in\s(.*)\s\(at\s(.+)\)\sat/,se=/^(?:.*@)?(.*):(\d+):(\d+)$/,le=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ae=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ce=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,L=/\(error: ([^)]*)\)/,de=/at\s/,ue=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,fe=/Error: |AggregateError:/,C=/^Anonymous function$/,me=/^\s*in\s.*/,pe=/^.*?\s*at\s.*/,he=/^.*?\s*@.*|\[native code\]/,O=(e,t)=>{const r=e.includes("safari-extension"),n=e.includes("safari-web-extension");return r||n?[e.includes("@")?e.split("@")[0]:y,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},B=(e,t)=>{const r=re.exec(t);r&&(e.file=r[1],e.line=+r[2],e.column=+r[3])},ve=e=>{const t=oe.exec(e);if(t){g(`parse nested node error stack line: "${e}"`,()=>`found: ${JSON.stringify(t)}`);const n=t[2].split(":");return{column:n[2]?+n[2]:void 0,file:n[0],line:n[1]?+n[1]:void 0,methodName:t[1]??y,raw:e,type:void 0}}const r=ie.exec(e);if(r){g(`parse node error stack line: "${e}"`,()=>`found: ${JSON.stringify(r)}`);const n={column:r[4]?+r[4]:void 0,file:r[2]?r[2].replace(de,""):void 0,line:r[3]?+r[3]:void 0,methodName:r[1]??y,raw:e,type:e.startsWith("internal")?"internal":void 0};return B(n,`${r[2]}:${r[3]}:${r[4]}`),n}},$e=e=>{const t=ee.exec(e);if(t){g(`parse chrome error stack line: "${e}"`,()=>`found: ${JSON.stringify(t)}`);const r=t[2]?.startsWith("native"),n=t[2]?.startsWith("eval")||t[1]?.startsWith("eval");let o,i;if(n){const d=te.exec(e);if(d){const c=ue.exec(d[1]);c?(t[2]=c[4]??c[1],t[3]=c[5]??c[2],t[4]=c[3]):d[2]&&(t[2]=d[1]),d[2]&&(o={column:d[4]?+d[4]:void 0,file:d[2],line:d[3]?+d[3]:void 0,methodName:"eval",raw:e,type:"eval"})}else{const c=ne.exec(e);c&&(i={column:c[4]?+c[4]:void 0,file:c[2],line:c[3]?+c[3]:void 0},o={column:c[6]?+c[6]:void 0,file:c[1],line:c[5]?+c[5]:void 0,methodName:"eval",raw:c[0],type:"eval"})}}const[l,s]=O(t[1]?t[1].replace(C,"<anonymous>"):y,t[2]),a={column:t[4]?+t[4]:void 0,evalOrigin:o,file:s,line:t[3]?+t[3]:void 0,methodName:l,raw:e,type:n?"eval":r?"native":Z(s)?"internal":void 0};return i?(a.column=i.column,a.file=i.file,a.line=i.line):B(a,`${s}:${t[3]}:${t[4]}`),a}},ge=(e,t)=>{const r=le.exec(e);if(r){g(`parse gecko error stack line: "${e}"`,()=>`found: ${JSON.stringify(r)}`);const n=r[3]?.includes(" > eval"),o=n&&r[3]&&ae.exec(r[3]);let i;n&&o&&(r[3]=o[1],i={column:r[5]?+r[5]:void 0,file:r[3],line:r[4]?+r[4]:void 0,methodName:"eval",raw:e,type:"eval"},r[4]=o[2]);const[l,s]=O(r[1]?r[1].replace(C,"<anonymous>"):y,r[3]);let a;(t?.type==="safari"||!n&&t?.type==="firefox")&&t.column?a=t.column:!n&&r[5]&&(a=+r[5]);let d;return(t?.type==="safari"||!n&&t?.type==="firefox")&&t.line?d=t.line:r[4]&&(d=+r[4]),{column:a,evalOrigin:i,file:s,line:d,methodName:l,raw:e,type:n?"eval":s.includes("[native code]")?"native":void 0}}},ye=(e,t)=>{const r=ce.exec(e);if(!(r&&r[2].includes(" > eval"))&&r)return g(`parse firefox error stack line: "${e}"`,()=>`found: ${JSON.stringify(r)}`),{column:r[4]?+r[4]:t?.column??void 0,file:r[2],line:r[3]?+r[3]:t?.line??void 0,methodName:r[1]||y,raw:e,type:void 0}},we=e=>{const t=se.exec(e);if(t)return g(`parse react android native error stack line: "${e}"`,()=>`found: ${JSON.stringify(t)}`),{column:t[3]?+t[3]:void 0,file:t[1],line:t[2]?+t[2]:void 0,methodName:y,raw:e,type:void 0}},xe=/(?:^|[(@\s])(?:node:internal\/|node:|internal\/)/,Se=/node_modules[/\\]/,Oe={internals:e=>!xe.test(e),nodeModules:e=>!Se.test(e)},Be=(...e)=>t=>e.every(r=>r(t)),j=(e,{filter:t,frameLimit:r=50}={})=>{const n=e;let o=(typeof n.stacktrace=="string"?n.stacktrace:e.stack??"").split(`
|
|
7
|
-
`).map(i=>(L.test(i)?i.replace(L,"$1"):i).trim()).filter(i=>!fe.test(i)&&i!=="eval code");return t&&(o=o.filter(i=>t(i))),o=o.slice(0,r),o.reduce((i,l,s)=>{if(!l||l.length>1024)return i;let a;if(me.test(l))a=ve(l);else if(pe.test(l))a=$e(l);else if(he.test(l)){let d;if(s===0){const c=e,m=c.columnNumber,p=c.lineNumber,f=c.line,u=c.column;m||p?d={column:m,line:p,type:"firefox"}:(f||u)&&(d={column:u,line:f,type:"safari"})}a=ye(l,d)??ge(l,d)}else a=we(l);return a?i.push(a):g(`parse error stack line: "${l}"`,"not parser found"),i},[])},W=b("node:fs"),S=b("node:path"),be=b("node:process"),Ne=b("node:url"),v=(e,t,r)=>r===0?e:t===" "?e+" ".repeat(r):e+" ".repeat(t*r),T=e=>e.replaceAll("\\","/"),Ee=e=>{if(!e.startsWith("file:"))return e;try{return Ne().fileURLToPath(e)}catch{return e}},ke=(e,t)=>{const r=e.replace("async file:","file:");return T(S().relative(t,Ee(r)))},Ae=(e,t,r)=>{if(t)return r.title(e.message);const n=e.message?`: ${e.message}`:"";return r.title(e.name+n)},P=(e,{color:t,hideErrorTitle:r,indentation:n,prefix:o},i)=>`${v(o,n,i)}${Ae(e,r,t)}
|
|
8
|
-
`,G=(e,{color:t,indentation:r,prefix:n},o)=>{if(e.hint===void 0)return;const i=v(n,r,o);let l="";if(Array.isArray(e.hint))for(const s of e.hint)l+=`${i+s}
|
|
9
|
-
`;else l+=i+e.hint;return t.hint(l)},k=(e,t)=>{if(!t||e.file===void 0||e.line===void 0)return{trace:e};try{const r=t({column:e.column,file:e.file,line:e.line});return r?{source:r.source,trace:{...e,column:r.column??e.column,file:r.file??e.file,line:r.line??e.line}}:{trace:e}}catch{return{trace:e}}},A=(e,t,r=0)=>{const{color:n,cwd:o,displayShortPath:i,indentation:l,prefix:s}=t,{trace:a}=e;let d;a.file===void 0?d="<unknown>":d=i?ke(a.file,o):T(a.file);const{fileLine:c,method:m}=n;return`${v(s,l,r)}at ${a.methodName?`${m(a.methodName)} `:""}${c(d)}:${c(a.line?.toString()??"")}`},Me=(e,t)=>{if(t.allowAllFilePaths)return!0;const r=S().resolve(t.cwd),n=S().resolve(r,e);return n===r||n.startsWith(r+S().sep)},Le=e=>{try{return W().existsSync(e)?W().readFileSync(e,"utf8"):void 0}catch{return}},I=(e,t,r)=>{const{color:n,indentation:o,linesAbove:i,linesBelow:l,prefix:s,showGutter:a,showLineNumbers:d,tabWidth:c}=t,{source:m,trace:p}=e;if(p.file===void 0)return;let f;if(m===void 0){const u=p.file.replace("file://","");if(!Me(u,t))return;const h=Le(u);if(h===void 0)return;f=h}else f=m;return K(f,{start:{column:p.column,line:p.line}},{color:n,linesAbove:i,linesBelow:l,prefix:v(s,o,r),showGutter:a,showLineNumbers:d,tabWidth:c})},J=(e,t,r)=>{if(e.errors.length===0)return;let n=`${v(t.prefix,t.indentation,r)}Errors:
|
|
10
|
-
|
|
11
|
-
`,o=!0;for(const i of e.errors)o?o=!1:n+=`
|
|
12
|
-
|
|
13
|
-
`,n+=F(i,{...t,framesMaxLimit:1,hideErrorCodeView:t.hideErrorErrorsCodeView},r+1);return`
|
|
14
|
-
${n}`},We=e=>{if(typeof e=="object"&&e!==null)try{return JSON.stringify(e)}catch{return Object.prototype.toString.call(e)}return String(e)},V=(e,t,r,n=new Set)=>{n.add(e);let o=`${v(t.prefix,t.indentation,r)}Caused by:
|
|
15
|
-
|
|
16
|
-
`;const{cause:i}=e;if(!(i instanceof Error)){const a=We(i);return o+=`${v(t.prefix,t.indentation,r)}${t.color.title(a)}
|
|
17
|
-
`,`
|
|
18
|
-
${o}`}o+=P(i,t,r);const l=j(i).shift(),s=G(i,t,r);if(s&&(o+=`${s}
|
|
19
|
-
`),l){const a=k(l,t.sourceMap);if(o+=A(a,t,r),!t.hideErrorCauseCodeView){const d=I(a,t,r);d!==void 0&&(o+=`
|
|
20
|
-
${d}`)}}if(i instanceof AggregateError){const a=J(i,t,r);a!==void 0&&(o+=`
|
|
21
|
-
${a}`)}return i.cause&&(o+=n.has(i)?`
|
|
22
|
-
${v(t.prefix,t.indentation,r+1)}Caused by: [Circular]`:`
|
|
23
|
-
${V(i,t,r+1,n)}`),`
|
|
24
|
-
${o}`},Ce=(e,t)=>(e.length>0?`
|
|
25
|
-
`:"")+e.map(r=>A(k(r,t.sourceMap),t)).join(`
|
|
26
|
-
`),F=(e,t,r)=>{const n={allowAllFilePaths:!1,cwd:be().cwd(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...t,color:{fileLine:s=>s,gutter:s=>s,hint:s=>s,marker:s=>s,message:s=>s,method:s=>s,title:s=>s,...t.color}},o=j(e,{filter:t.filterStacktrace,frameLimit:n.framesMaxLimit}),i=o.shift(),l=i?k(i,n.sourceMap):void 0;return[t.hideMessage?void 0:P(e,n,r),G(e,n,r),l?A(l,n,r):void 0,l&&!n.hideErrorCodeView?I(l,n,r):void 0,e instanceof AggregateError?J(e,n,r):void 0,e.cause===void 0||e.cause===null?void 0:V(e,n,r),o.length>0?Ce(o,n):void 0].filter(Boolean).join(`
|
|
27
|
-
`)},je=(e,t={})=>{if(t.framesMaxLimit!==void 0&&t.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return F(e,t,0)};export{je as G,Oe as R,H as S,K as W,Be as X,j as Y,b as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const r=e=>"Deno"in e,t=e=>"Bun"in e,i=()=>{if(r(globalThis)){const e=globalThis.Deno,s=e.execPath();let o=s;try{const{importMeta:n}=globalThis;n?.url&&(o=n.url)}catch{}return[s,o,...e.args]}return process.argv},a=()=>r(globalThis)?globalThis.Deno.cwd():process.cwd(),l=()=>{if(r(globalThis)){const e=globalThis.Deno;return new Proxy(e.env.toObject(),{get:(s,o)=>typeof o=="string"?e.env.get(o):s[o],has:(s,o)=>typeof o=="string"?e.env.has(o):o in s,set:(s,o,n)=>typeof o=="string"?(n===void 0||e.env.set(o,n),!0):!1})}return process.env},c=()=>r(globalThis)?[]:process.execArgv,g=()=>r(globalThis)?globalThis.Deno.execPath():process.execPath,h=()=>{if(r(globalThis)){const e=globalThis.Deno.build?.os??"unknown";return e==="windows"?"win32":e}return process.platform},b=()=>{if(r(globalThis)){const e=globalThis.Deno.build?.arch??"unknown";return e==="x86_64"?"x64":e==="aarch64"?"arm64":e}return process.arch},v=()=>{if(r(globalThis)){const e=globalThis.Deno,s={};return e.version?.deno&&(s.deno=e.version.deno),e.version?.v8&&(s.v8=e.version.v8),e.version?.typescript&&(s.typescript=e.version.typescript),s}if(t(globalThis)){const e=globalThis.Bun,s={...process.versions};return e.version&&(s.bun=e.version),s}return process.versions},p=(e=0)=>{if(r(globalThis))throw globalThis.Deno.exit(e),new Error("Deno exit failed");process.exit(e)},u=(e,s)=>{if(r(globalThis))return()=>{};const o=process;return o.on(e,s),()=>{o.removeListener(e,s)}};export{h as a,b,l as c,i as d,p as e,a as f,v as g,g as h,c as i,u as o};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const M=String.raw,z=M`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,J=()=>new RegExp(M`\p{RI}{2}|(?)${z}(?:\u200D${z})*`,"gu");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const Ue=/^[ \t]*(?:\r\n|\r|\n)/,We=/(?:\r\n|\r|\n)[ \t]*$/,ye=/^(?:[\r\n]|$)/,Ae=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,be=/^[ \t]*[\r\n][ \t\r\n]*$/,$e=/\r\n|\n|\r/g,me=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,Be=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,W=J(),N=/[-_./\s]+/g,A=/(\u001B\[[0-9;]*[a-z])/i,F=new RegExp("\\p{Script=Arabic}","u"),Q=new RegExp("\\p{Script=Bengali}","u"),y=new RegExp("\\p{Script=Cyrillic}","u"),V=new RegExp("\\p{Script=Devanagari}","u"),X=new RegExp("\\p{Script=Ethiopic}","u"),b=new RegExp("\\p{Script=Greek}","u"),I=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),Y=new RegExp("\\p{Script=Gujarati}","u"),ee=new RegExp("\\p{Script=Gurmukhi}","u"),O=new RegExp("\\p{Script=Hangul}","u"),T=new RegExp("\\p{Script=Hebrew}","u"),te=new RegExp("\\p{Script=Hiragana}","u"),v=new RegExp("\\p{Script=Han}","u"),se=new RegExp("\\p{Script=Kannada}","u"),ne=new RegExp("\\p{Script=Katakana}","u"),ae=new RegExp("\\p{Script=Khmer}","u"),ie=new RegExp("\\p{Script=Lao}","u"),S=new RegExp("\\p{Script=Latin}","u"),le=new RegExp("\\p{Script=Malayalam}","u"),re=new RegExp("\\p{Script=Myanmar}","u"),pe=new RegExp("\\p{Script=Oriya}","u"),ce=new RegExp("\\p{Script=Sinhala}","u"),oe=new RegExp("\\p{Script=Tamil}","u"),ue=new RegExp("\\p{Script=Telugu}","u"),he=new RegExp("\\p{Script=Thai}","u"),fe=new RegExp("\\p{Script=Tibetan}","u"),G=/[\u02BB\u02BC\u0027]/u,ge=e=>e.replace(W,"");class xe{capacity;cache;constructor(s){this.capacity=s,this.cache=new Map}get(s){if(!this.cache.has(s))return;const o=this.cache.get(s);return this.cache.delete(s),this.cache.set(s,o),o}has(s){return this.cache.has(s)}set(s,o){if(this.cache.has(s))this.cache.delete(s);else if(this.cache.size>=this.capacity){const f=this.cache.keys().next().value;f!==void 0&&this.cache.delete(f)}this.cache.set(s,o)}delete(s){this.cache.delete(s)}clear(){this.cache.clear()}size(){return this.cache.size}}const de=new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))","g"),we=e=>{if(typeof e!="string")throw new TypeError(`The "value" argument must be of type string. Received ${typeof e}`);return e.replaceAll(de,"")},$=new xe(1e3),Ee=/[.*+?^${}()|[\]\\]/g,ke=e=>{const s=e.join("");if($.has(s)){const x=$.get(s);return x.lastIndex=0,x}const o=e.map(x=>x.replaceAll(Ee,String.raw`\$&`)).join("|"),f=new RegExp(o,"g");return $.set(s,f),f},Se=e=>{const s=[];let o=0,f;for(W.lastIndex=0;(f=W.exec(e))!==null;)f.index>o&&s.push(e.slice(o,f.index)),s.push(f[0]),o=W.lastIndex;return o<e.length&&s.push(e.slice(o)),s.filter(Boolean)},Re=/[ČŠŽĐ]/i,P=new Uint8Array(128),Z=new Uint8Array(128),K=new Uint8Array(128);for(let e=0;e<128;e++)P[e]=e>=65&&e<=90?1:0,Z[e]=e>=97&&e<=122?1:0,K[e]=e>=48&&e<=57?1:0;const m=e=>P[e],H=e=>Z[e],B=e=>K[e],U=(e,s,o,f,x)=>{if(e.length===0)return[];let h=!1;const k=Object.values(s);for(const i of k)if(i(e[0])){h=!0;break}if(!h&&!o)return[e];const g=[...e],w=[];let n=g[0],l="other";const c=Object.entries(s);for(const i of c){const[a,p]=i;if(p(g[0])){l=a;break}}let t=o&&f?g[0]===g[0].toLocaleUpperCase(f):!1;for(let i=1;i<g.length;i++){const a=g[i];let p="other";for(const d of c){const[E,R]=d;if(R(a)){p=E;break}}const u=o&&f?a===a.toLocaleUpperCase(f):!1;let r=!1;x?r=x(l,p,t,u,a,i,g):(l!==p&&l!=="other"&&p!=="other"&&(r=!0),o&&p!=="other"&&!t&&u&&(r=!0)),r?(w.push(n),n=a):n+=a,l=p,o&&(t=u)}return n&&n.length>0&&w.push(n),w.length>0?w:[e]},Ce=(e,s,o,f)=>{if(o.size===0)return s;for(const x of o)if(e.startsWith(x,s))return f.push(x),s+x.length;return s},q=(e,s=new Set)=>{if(e.length===0)return[];if(e.toUpperCase()===e)return[e];let o=0;const f=[],x=e.length;for(let h=1;h<x;h++){const k=Ce(e,o,s,f);if(k!==o){o=k,h=o-1;continue}const g=e.codePointAt(h-1),w=e.codePointAt(h),n=g&&g<128&&m(g),l=w&&w<128&&m(w),c=g&&g<128&&H(g),t=g&&g<128&&B(g),i=w&&w<128&&B(w);if(c&&l){f.push(e.slice(o,h)),o=h;continue}if(t&&!i||!t&&i){f.push(e.slice(o,h)),o=h;continue}if(i&&!t){let a=!1,p=!1;if(h+1<x){const u=e.codePointAt(h+1);a=u&&u<128&&m(u),p=u&&u<128&&B(u)}if(!p&&a){f.push(e.slice(o,h),e.slice(h,h+1)),o=h+1;continue}}if(h+1<x){const a=e.codePointAt(h+1),p=a&&a<128&&H(a);if(n&&l&&p){const u=e.slice(o,h+1);s.has(u)||(f.push(e.slice(o,h)),o=h)}}}return o<x&&f.push(e.slice(o)),f.filter(h=>h!=="")},D=(e,s,o)=>{if(e.length===0)return[];const f=e===e.toLocaleUpperCase(s);if(s.startsWith("de")){if(!f&&e.replaceAll("ß","SS")===e.toLocaleUpperCase(s))return[e];const n=[...e],l=n.length,c=[];let t=n[0],i=n[0]===n[0].toLocaleUpperCase(s),a=i,p=i?0:-1;for(let u=1;u<l;u++){const r=n[u],d=r===r.toLocaleUpperCase(s);if(d===i)t+=r;else if(d)t&&t.length>0&&(c.push(t),t=r),a=!0,p=u;else{if(a&&u-p>1){const E=n[u-1],R=t.slice(0,-1);R&&R.length>0&&c.push(R),t=E+r}else t+=r;a=!1,p=-1}i=d}return t&&t.length>0&&c.push(t),c}if(s.startsWith("uk")||s.startsWith("ru")||s.startsWith("bg")||s.startsWith("sr")||s.startsWith("mk")||s.startsWith("be")){if(!y.test(e)&&!S.test(e))return[e];const n=[...e],l=n.length,c=[];let t=n[0];const i=n[0];let a;y.test(i)?a=1:S.test(i)?a=2:a=0;let p=i===i.toLocaleUpperCase(s);for(let r=1;r<l;r++){const d=n[r];let E;y.test(d)?E=1:S.test(d)?E=2:E=0;const R=d===d.toLocaleUpperCase(s);a!==E&&(a===1||a===2)&&(E===1||E===2)||E===a&&!p&&R?(c.push(t),t=d):t+=d,a=E,p=R}t&&t.length>0&&c.push(t);const u=[];for(let r=0;r<c.length;r++)r<c.length-1&&c[r].length===1&&S.test(c[r])&&y.test(c[r+1][0])?(u.push(c[r]+c[r+1]),r+=1):u.push(c[r]);return u}if(s.startsWith("el")){if(!b.test(e)&&!S.test(e))return[e];const n=[];I.lastIndex=0;let l;for(;(l=I.exec(e))!==null;)n.push(l[0]);n.length===0&&n.push(e);const c=[];if(n.length===1){const t=n[0];if(!t||!b.test(t[0])||t.length===1)return[t??e]}for(const t of n){if(!t)continue;if(!b.test(t[0])||t.length===1){c.push(t);continue}const i=t.length;let a=t[0],p=t[0]===t[0].toLocaleUpperCase(s);for(let u=1;u<i;u++){const r=t[u],d=r===r.toLocaleUpperCase(s);!p&&d?(c.push(a),a=r):a+=r,p=d}a&&c.push(a)}return c}if(s.startsWith("ja")||s.startsWith("ko")){const n=s.startsWith("ja"),l=n?{hiragana:t=>te.test(t),kanji:t=>v.test(t),katakana:t=>ne.test(t),latin:t=>S.test(t)}:{hangul:t=>O.test(t),latin:t=>S.test(t)},c=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(n){const t=U(e,l,!1,s,(a,p)=>a==="hiragana"&&p==="katakana"||a==="katakana"&&p==="hiragana"||a==="hiragana"&&p==="latin"||a==="katakana"&&p==="latin"||a==="kanji"&&p==="latin"||a==="latin"&&(p==="hiragana"||p==="katakana"||p==="kanji")),i=[];for(const a of t){const p=a;p.length===1&&c.has(p)&&i.length>0?i[i.length-1]=i.at(-1)+p:i.push(p)}return i.length>0?i:[e]}return U(e,l,!1,s,(t,i)=>t==="hangul"&&i==="latin"||t==="latin"&&i==="hangul")}if(s.startsWith("sl")){const n=[...e],l=n.length,c=[];let t=n[0],i=n[0]===n[0].toLocaleUpperCase(s);for(let a=1;a<l;a++){const p=n[a],u=p===p.toLocaleUpperCase(s),r=Re.test(p),d=a<l-1&&n[a+1]===n[a+1].toLocaleUpperCase(s);!i&&u||r&&d?(c.push(t),t=p,r&&d&&(c.push(t),t="")):t+=p,i=u}return t&&t.length>0&&c.push(t),c}if(s.startsWith("zh"))return U(e,{han:n=>v.test(n),latin:n=>S.test(n)},!1,s);if(["ar","fa","he","ur"].includes(s.split("-")[0])){const n=l=>T.test(l)||F.test(l);return U(e,{latin:l=>S.test(l),rtl:l=>n(l)},!1,s)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(s.split("-")[0])){const n=l=>V.test(l)||Q.test(l)||Y.test(l)||ee.test(l)||se.test(l)||oe.test(l)||ue.test(l)||le.test(l)||ce.test(l)||he.test(l)||ie.test(l)||fe.test(l)||re.test(l)||X.test(l)||ae.test(l)||pe.test(l);return U(e,{indic:l=>n(l),latin:l=>S.test(l)},!1,s)}if(["be","bg","ru","sr","uk"].includes(s))return U(e,{cyrillic:n=>y.test(n),latin:n=>S.test(n)},!0,s);if(["ar","fa","he"].includes(s))return U(e,{latin:n=>S.test(n),rtl:n=>T.test(n)||F.test(n)},!1,s);if(s.startsWith("ko"))return U(e,{hangul:n=>O.test(n),latin:n=>S.test(n)},!1,s);if(s.startsWith("uz")){if(!y.test(e)&&!S.test(e))return[e];const n=[...e],l=n.length,c=[];let t=n[0],i=n[0]===n[0].toLocaleUpperCase(s);for(let a=1;a<l;a++){const p=n[a],u=p===p.toLocaleUpperCase(s);if(G.test(p)||G.test(n[a-1])){t+=p;continue}!i&&u?(c.push(t),t=p):t+=p,i=u}return t&&t.length>0&&c.push(t),c}const x=[...e],h=x.length,k=[];let g=x[0],w=x[0]===x[0].toLocaleUpperCase(s);for(const n of o)if(e.startsWith(n)){k.push(n),g=x[n.length],w=g===g.toLocaleUpperCase(s);break}for(let n=1;n<h;n++){const l=x[n],c=l===l.toLocaleUpperCase(s);let t=0;for(const i of o)if(e.startsWith(i,n)){k.push(g,i),t=i.length,g="";const a=i.at(-1);a&&(w=a===a.toLocaleUpperCase(s));break}if(t>0){n+=t-1;continue}!w&&c?(k.push(g),g=l):g+=l,w=c}return g&&k.push(g),k},Le=(e,s,o)=>{const f=[],x=A.test(e)?e.split(A).filter(Boolean):[e];for(const h of x){const k=h;if(A.test(k))f.push(k);else{W.lastIndex=0;const g=W.test(k)?Se(k).filter(Boolean):[k];for(const w of g)if(W.lastIndex=0,W.test(w))f.push(w);else if(s){const n=s.toLowerCase().split("-")[0];f.push(...D(w,n,o))}else f.push(...q(w,o))}}return f},je=(e,s={})=>{if(!e||typeof e!="string")return[];const{handleAnsi:o=!1,handleEmoji:f=!1,knownAcronyms:x=[],locale:h,normalize:k=!1,separators:g,stripAnsi:w=!1,stripEmoji:n=!1}=s,l=new Set([...x].toSorted((r,d)=>d.length-r.length));let c=e;w&&(c=we(c)),n&&(c=ge(c));let t;Array.isArray(g)?t=ke(g):g instanceof RegExp?t=g:t=N;const i=[];let a=c;const p=t.flags.includes("g")?t:new RegExp(t.source,`${t.flags}g`);for(;a.length>0;){const r=p.exec(a);if(!r){a===".."?i.push(".."):a==="."?i.push("."):a.length>0&&i.push(a);break}const d=r.index,E=r[0],R=E.length,j=a.slice(0,d),_=a.slice(d+R);if(E.startsWith("../"))i.push(".."),a=a.slice(d+3);else if(E.startsWith("./"))i.push("."),a=a.slice(d+2);else if(d===0&&E==="..")i.push(".."),a=a.slice(2);else if(d===0&&E===".")i.push("."),a=a.slice(1);else{j.length>0&&i.push(j);let C=0;for(;(C=E.indexOf("../",C))!==-1;)i.push(".."),C+=3;for(C=0;(C=E.indexOf("./",C))!==-1;)(C===0||E[C-1]!==".")&&i.push("."),C+=2;let L=_;for(;L.startsWith("../");)i.push(".."),L=L.slice(3);for(;L.startsWith("./");)i.push("."),L=L.slice(2);if(L===".."){i.push("..");break}else if(L==="."){i.push(".");break}else a=L}p.lastIndex=0}if(i.length===0){const r=c.split(t).filter(Boolean);i.push(...r)}let u=[];for(const r of i)o||f?u.push(...Le(r,h,l)):h?u.push(...D(r,h,l)):u.push(...q(r,l));return k&&(u=u.map(r=>l.has(r)?r:h&&r===r.toLocaleUpperCase(h)?r[0]+r.slice(1).toLocaleLowerCase(h):r.toUpperCase()===r&&!l.has(r)?r.slice(0,1)+r.slice(1).toLowerCase():r)),u};export{ye as B,Ae as F,We as R,je as W,me as d,A as k,be as l,$e as m,W as n,Ue as x,Be as y};
|