@visulima/string 1.4.1 → 1.5.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.
Files changed (153) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/LICENSE.md +62 -0
  3. package/dist/case/camel-case.cjs +1 -1
  4. package/dist/case/camel-case.d.cts +2 -2
  5. package/dist/case/camel-case.d.mts +2 -2
  6. package/dist/case/camel-case.d.ts +2 -2
  7. package/dist/case/camel-case.mjs +1 -1
  8. package/dist/case/capital-case.cjs +1 -1
  9. package/dist/case/capital-case.d.cts +2 -2
  10. package/dist/case/capital-case.d.mts +2 -2
  11. package/dist/case/capital-case.d.ts +2 -2
  12. package/dist/case/capital-case.mjs +1 -1
  13. package/dist/case/constant-case.d.cts +2 -2
  14. package/dist/case/constant-case.d.mts +2 -2
  15. package/dist/case/constant-case.d.ts +2 -2
  16. package/dist/case/dot-case.d.cts +2 -2
  17. package/dist/case/dot-case.d.mts +2 -2
  18. package/dist/case/dot-case.d.ts +2 -2
  19. package/dist/case/flat-case.d.cts +2 -2
  20. package/dist/case/flat-case.d.mts +2 -2
  21. package/dist/case/flat-case.d.ts +2 -2
  22. package/dist/case/flip-case.cjs +1 -1
  23. package/dist/case/flip-case.d.cts +2 -2
  24. package/dist/case/flip-case.d.mts +2 -2
  25. package/dist/case/flip-case.d.ts +2 -2
  26. package/dist/case/flip-case.mjs +1 -1
  27. package/dist/case/identify-case.d.cts +2 -2
  28. package/dist/case/identify-case.d.mts +2 -2
  29. package/dist/case/identify-case.d.ts +2 -2
  30. package/dist/case/index.cjs +1 -1
  31. package/dist/case/index.d.cts +2 -2
  32. package/dist/case/index.d.mts +2 -2
  33. package/dist/case/index.d.ts +2 -2
  34. package/dist/case/index.mjs +1 -1
  35. package/dist/case/kebab-case.cjs +1 -1
  36. package/dist/case/kebab-case.d.cts +2 -2
  37. package/dist/case/kebab-case.d.mts +2 -2
  38. package/dist/case/kebab-case.d.ts +2 -2
  39. package/dist/case/kebab-case.mjs +1 -1
  40. package/dist/case/lower-first.d.cts +2 -2
  41. package/dist/case/lower-first.d.mts +2 -2
  42. package/dist/case/lower-first.d.ts +2 -2
  43. package/dist/case/no-case.d.cts +2 -2
  44. package/dist/case/no-case.d.mts +2 -2
  45. package/dist/case/no-case.d.ts +2 -2
  46. package/dist/case/pascal-case.cjs +1 -1
  47. package/dist/case/pascal-case.d.cts +2 -2
  48. package/dist/case/pascal-case.d.mts +2 -2
  49. package/dist/case/pascal-case.d.ts +2 -2
  50. package/dist/case/pascal-case.mjs +1 -1
  51. package/dist/case/pascal-snake-case.d.cts +2 -2
  52. package/dist/case/pascal-snake-case.d.mts +2 -2
  53. package/dist/case/pascal-snake-case.d.ts +2 -2
  54. package/dist/case/path-case.d.cts +2 -2
  55. package/dist/case/path-case.d.mts +2 -2
  56. package/dist/case/path-case.d.ts +2 -2
  57. package/dist/case/sentence-case.cjs +1 -1
  58. package/dist/case/sentence-case.d.cts +2 -2
  59. package/dist/case/sentence-case.d.mts +2 -2
  60. package/dist/case/sentence-case.d.ts +2 -2
  61. package/dist/case/sentence-case.mjs +1 -1
  62. package/dist/case/snake-case.d.cts +2 -2
  63. package/dist/case/snake-case.d.mts +2 -2
  64. package/dist/case/snake-case.d.ts +2 -2
  65. package/dist/case/split-by-case.cjs +1 -1
  66. package/dist/case/split-by-case.d.cts +2 -2
  67. package/dist/case/split-by-case.d.mts +2 -2
  68. package/dist/case/split-by-case.d.ts +2 -2
  69. package/dist/case/split-by-case.mjs +1 -1
  70. package/dist/case/title-case.d.cts +2 -2
  71. package/dist/case/title-case.d.mts +2 -2
  72. package/dist/case/title-case.d.ts +2 -2
  73. package/dist/case/train-case.cjs +1 -1
  74. package/dist/case/train-case.d.cts +2 -2
  75. package/dist/case/train-case.d.mts +2 -2
  76. package/dist/case/train-case.d.ts +2 -2
  77. package/dist/case/train-case.mjs +1 -1
  78. package/dist/case/upper-first.d.cts +2 -2
  79. package/dist/case/upper-first.d.mts +2 -2
  80. package/dist/case/upper-first.d.ts +2 -2
  81. package/dist/closest-string.cjs +1 -0
  82. package/dist/closest-string.d.cts +8 -0
  83. package/dist/closest-string.d.mts +8 -0
  84. package/dist/closest-string.d.ts +8 -0
  85. package/dist/closest-string.mjs +1 -0
  86. package/dist/compare-similarity.cjs +1 -0
  87. package/dist/compare-similarity.d.cts +8 -0
  88. package/dist/compare-similarity.d.mts +8 -0
  89. package/dist/compare-similarity.d.ts +8 -0
  90. package/dist/compare-similarity.mjs +1 -0
  91. package/dist/get-string-truncated-width.cjs +1 -1
  92. package/dist/get-string-truncated-width.mjs +1 -1
  93. package/dist/index.cjs +1 -1
  94. package/dist/index.d.cts +14 -6
  95. package/dist/index.d.mts +14 -6
  96. package/dist/index.d.ts +14 -6
  97. package/dist/index.mjs +1 -1
  98. package/dist/native-string-types.d.cts +1 -1
  99. package/dist/native-string-types.d.mts +1 -1
  100. package/dist/native-string-types.d.ts +1 -1
  101. package/dist/outdent.cjs +1 -1
  102. package/dist/outdent.mjs +1 -1
  103. package/dist/packem_shared/closest-DGumBGH9.cjs +1 -0
  104. package/dist/packem_shared/closest-uarbVSbs.mjs +1 -0
  105. package/dist/packem_shared/closestN-D4wF4I-I.mjs +1 -0
  106. package/dist/packem_shared/closestN-DqYIV5u3.cjs +1 -0
  107. package/dist/packem_shared/{constants-Cd17VNEv.mjs → constants-CDcaCZKC.mjs} +1 -1
  108. package/dist/packem_shared/{constants-D3K8u3G8.cjs → constants-DEcMFLn8.cjs} +1 -1
  109. package/dist/packem_shared/{joinSegments-H7QJ7rwJ.mjs → joinSegments-BNRq9dVI.mjs} +1 -1
  110. package/dist/packem_shared/{joinSegments-CDHNMXsF.cjs → joinSegments-Cs5mfgdt.cjs} +1 -1
  111. package/dist/packem_shared/replaceString-9jUkfJB5.cjs +1 -0
  112. package/dist/packem_shared/replaceString-DwIZyvoL.mjs +1 -0
  113. package/dist/packem_shared/{transliterate-BXaP38Sh.mjs → transliterate-DNh-jM0e.mjs} +2 -2
  114. package/dist/packem_shared/{transliterate-CToQ-aeM.cjs → transliterate-wQMEsr3l.cjs} +2 -2
  115. package/dist/packem_shared/{types-mlwFVBiS.d.mts → types-CNJfNczL.d.mts} +1 -1
  116. package/dist/packem_shared/{types-BfGNLD2K.d.ts → types-CfPsw9ix.d.ts} +1 -1
  117. package/dist/packem_shared/{types-DrtiqNkK.d.cts → types-Cnu8OB9S.d.cts} +1 -1
  118. package/dist/packem_shared/{types-BSdIWVzn.d.cts → types-Daae0hGf.d.cts} +1 -1
  119. package/dist/packem_shared/{types-BSdIWVzn.d.mts → types-Daae0hGf.d.mts} +1 -1
  120. package/dist/packem_shared/{types-BSdIWVzn.d.ts → types-Daae0hGf.d.ts} +1 -1
  121. package/dist/slice.cjs +1 -1
  122. package/dist/slice.mjs +1 -1
  123. package/dist/slugify.cjs +1 -0
  124. package/dist/slugify.d.cts +5 -0
  125. package/dist/slugify.d.mts +5 -0
  126. package/dist/slugify.d.ts +5 -0
  127. package/dist/slugify.mjs +1 -0
  128. package/dist/test/utils.cjs +2 -2
  129. package/dist/test/utils.mjs +1 -1
  130. package/dist/truncate.cjs +1 -1
  131. package/dist/truncate.mjs +1 -1
  132. package/dist/utilities.cjs +1 -0
  133. package/dist/{utils.d.cts → utilities.d.cts} +1 -1
  134. package/dist/{utils.d.mts → utilities.d.mts} +1 -1
  135. package/dist/{utils.d.ts → utilities.d.ts} +1 -1
  136. package/dist/utilities.mjs +1 -0
  137. package/dist/word-similarity-sort.cjs +1 -0
  138. package/dist/word-similarity-sort.d.cts +8 -0
  139. package/dist/word-similarity-sort.d.mts +8 -0
  140. package/dist/word-similarity-sort.d.ts +8 -0
  141. package/dist/word-similarity-sort.mjs +1 -0
  142. package/dist/word-wrap.cjs +3 -3
  143. package/dist/word-wrap.d.cts +1 -1
  144. package/dist/word-wrap.d.mts +1 -1
  145. package/dist/word-wrap.d.ts +1 -1
  146. package/dist/word-wrap.mjs +6 -6
  147. package/package.json +58 -6
  148. package/dist/packem_shared/replaceString-Ce8TI_-L.cjs +0 -1
  149. package/dist/packem_shared/replaceString-D7R-5VFX.mjs +0 -1
  150. package/dist/packem_shared/slugify-B1vlQQO1.mjs +0 -1
  151. package/dist/packem_shared/slugify-CH3GI7E5.cjs +0 -1
  152. package/dist/utils.cjs +0 -1
  153. package/dist/utils.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import { N as NodeLocale, j as IsStringLiteral } from './types-BSdIWVzn.mjs';
1
+ import { N as NodeLocale, k as IsStringLiteral } from './types-Daae0hGf.mjs';
2
2
  import { L as LRUCache } from './lru-cache-B_t27XwI.mjs';
3
3
 
4
4
  type SplitterCharacter = " " | "_" | "-" | "." | "/";
@@ -1,4 +1,4 @@
1
- import { N as NodeLocale, j as IsStringLiteral } from './types-BSdIWVzn.js';
1
+ import { N as NodeLocale, k as IsStringLiteral } from './types-Daae0hGf.js';
2
2
  import { L as LRUCache } from './lru-cache-B_t27XwI.js';
3
3
 
4
4
  type SplitterCharacter = " " | "_" | "-" | "." | "/";
@@ -1,4 +1,4 @@
1
- import { N as NodeLocale, j as IsStringLiteral } from './types-BSdIWVzn.cjs';
1
+ import { N as NodeLocale, k as IsStringLiteral } from './types-Daae0hGf.cjs';
2
2
  import { L as LRUCache } from './lru-cache-B_t27XwI.cjs';
3
3
 
4
4
  type SplitterCharacter = " " | "_" | "-" | "." | "/";
@@ -61,4 +61,4 @@ interface SlugifyOptions extends OptionsTransliterate {
61
61
  }
62
62
 
63
63
  export { Math as M };
64
- export type { All as A, CharAt as C, EndsWith as E, Includes as I, Join as J, Length as L, NodeLocale as N, OptionReplaceArray as O, PadEnd as P, Replace as R, Slice as S, ToLowerCase as T, Concat as a, PadStart as b, ReplaceAll as c, Split as d, StartsWith as e, ToUpperCase as f, Trim as g, TrimEnd as h, TrimStart as i, IsStringLiteral as j, IntervalArray as k, SlugifyOptions as l, OptionsTransliterate as m, Any as n, Charmap as o, Interval as p, IsBooleanLiteral as q, IsNumberLiteral as r, IsStringLiteralArray as s, OptionReplaceCombined as t, OptionReplaceObject as u, Repeat as v, Reverse as w };
64
+ export type { All as A, CharAt as C, EndsWith as E, Includes as I, Join as J, Length as L, NodeLocale as N, OptionReplaceArray as O, PadEnd as P, Replace as R, Slice as S, ToLowerCase as T, Concat as a, PadStart as b, ReplaceAll as c, Split as d, StartsWith as e, ToUpperCase as f, Trim as g, TrimEnd as h, TrimStart as i, SlugifyOptions as j, IsStringLiteral as k, IntervalArray as l, OptionsTransliterate as m, Any as n, Charmap as o, Interval as p, IsBooleanLiteral as q, IsNumberLiteral as r, IsStringLiteralArray as s, OptionReplaceCombined as t, OptionReplaceObject as u, Repeat as v, Reverse as w };
@@ -61,4 +61,4 @@ interface SlugifyOptions extends OptionsTransliterate {
61
61
  }
62
62
 
63
63
  export { Math as M };
64
- export type { All as A, CharAt as C, EndsWith as E, Includes as I, Join as J, Length as L, NodeLocale as N, OptionReplaceArray as O, PadEnd as P, Replace as R, Slice as S, ToLowerCase as T, Concat as a, PadStart as b, ReplaceAll as c, Split as d, StartsWith as e, ToUpperCase as f, Trim as g, TrimEnd as h, TrimStart as i, IsStringLiteral as j, IntervalArray as k, SlugifyOptions as l, OptionsTransliterate as m, Any as n, Charmap as o, Interval as p, IsBooleanLiteral as q, IsNumberLiteral as r, IsStringLiteralArray as s, OptionReplaceCombined as t, OptionReplaceObject as u, Repeat as v, Reverse as w };
64
+ export type { All as A, CharAt as C, EndsWith as E, Includes as I, Join as J, Length as L, NodeLocale as N, OptionReplaceArray as O, PadEnd as P, Replace as R, Slice as S, ToLowerCase as T, Concat as a, PadStart as b, ReplaceAll as c, Split as d, StartsWith as e, ToUpperCase as f, Trim as g, TrimEnd as h, TrimStart as i, SlugifyOptions as j, IsStringLiteral as k, IntervalArray as l, OptionsTransliterate as m, Any as n, Charmap as o, Interval as p, IsBooleanLiteral as q, IsNumberLiteral as r, IsStringLiteralArray as s, OptionReplaceCombined as t, OptionReplaceObject as u, Repeat as v, Reverse as w };
@@ -61,4 +61,4 @@ interface SlugifyOptions extends OptionsTransliterate {
61
61
  }
62
62
 
63
63
  export { Math as M };
64
- export type { All as A, CharAt as C, EndsWith as E, Includes as I, Join as J, Length as L, NodeLocale as N, OptionReplaceArray as O, PadEnd as P, Replace as R, Slice as S, ToLowerCase as T, Concat as a, PadStart as b, ReplaceAll as c, Split as d, StartsWith as e, ToUpperCase as f, Trim as g, TrimEnd as h, TrimStart as i, IsStringLiteral as j, IntervalArray as k, SlugifyOptions as l, OptionsTransliterate as m, Any as n, Charmap as o, Interval as p, IsBooleanLiteral as q, IsNumberLiteral as r, IsStringLiteralArray as s, OptionReplaceCombined as t, OptionReplaceObject as u, Repeat as v, Reverse as w };
64
+ export type { All as A, CharAt as C, EndsWith as E, Includes as I, Join as J, Length as L, NodeLocale as N, OptionReplaceArray as O, PadEnd as P, Replace as R, Slice as S, ToLowerCase as T, Concat as a, PadStart as b, ReplaceAll as c, Split as d, StartsWith as e, ToUpperCase as f, Trim as g, TrimEnd as h, TrimStart as i, SlugifyOptions as j, IsStringLiteral as k, IntervalArray as l, OptionsTransliterate as m, Any as n, Charmap as o, Interval as p, IsBooleanLiteral as q, IsNumberLiteral as r, IsStringLiteralArray as s, OptionReplaceCombined as t, OptionReplaceObject as u, Repeat as v, Reverse as w };
package/dist/slice.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var I=Object.defineProperty;var O=(t,f)=>I(t,"name",{value:f,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("./packem_shared/constants-D3K8u3G8.cjs"),k=require("./get-string-width.cjs"),F=require("./packem_shared/LRUCache-TYqfUYE5.cjs");var _=Object.defineProperty,S=O((t,f)=>_(t,"name",{value:f,configurable:!0}),"y");const y=new F(100),E=new Intl.Segmenter("en",{granularity:"grapheme"}),N=new Set(["0","22","23","24","27","28","29","39","49"]),P=new Set(["1","3","4","7","8","9"]),j=new Map([["22","1"],["23","3"],["24","4"],["27","7"],["28","8"],["29","9"]]),v=S(t=>t>="30"&&t<="37"||t>="90"&&t<="97"||t.startsWith("38;"),"isForegroundColor"),w=S(t=>t>="40"&&t<="47"||t>="100"&&t<="107"||t.startsWith("48;"),"isBackgroundColor"),R=[{close:"\x1B[22m",open:"\x1B[1m"},{close:"\x1B[23m",open:"\x1B[3m"},{close:"\x1B[24m",open:"\x1B[4m"},{close:"\x1B[27m",open:"\x1B[7m"},{close:"\x1B[28m",open:"\x1B[8m"},{close:"\x1B[29m",open:"\x1B[9m"}],L=S((t,f)=>{let l=-1;for(const d of f){const h=t.indexOf(d);h>=0&&(l===-1||h<l)&&(l=h)}return l},"findFirstPositionOfAny"),q=S((t,f)=>{if(!t.includes("\x1B"))return[{after:"",before:"",content:t,visibleLength:k.getStringWidth(t,f.width)}];const l=y.get(t);if(l)return l;const d=[],h=[];let p=0,a;for(b.c.lastIndex=0;(a=b.c.exec(t))!==null;){const c=a[0];d.push(t.slice(p,a.index)),h.push(c),p=a.index+c.length}p<t.length&&d.push(t.slice(p));const m=[];for(const c of h){if(c==="\x1B[0m"||c==="\x1B]8;;\x07"){m.push(c);continue}if(c.startsWith("\x1B[")&&c.endsWith("m")){const x=c.slice(2,-1);if(N.has(x)){m.push(c);continue}}}const s=new Set,B=[];for(const[c,x]of d.entries()){if(c>0&&h[c-1]){const n=h[c-1];if(n==="\x1B[0m")s.clear();else if(n==="\x1B]8;;\x07"){for(const i of s)if(i.startsWith("\x1B]8;;")&&!i.endsWith("\x1B]8;;\x07")){s.delete(i);break}}else if(n.startsWith("\x1B[")&&n.endsWith("m")){const i=n.slice(2,-1);if(i==="39"){for(const e of s)if(e.startsWith("\x1B[")&&e.endsWith("m")){const o=e.slice(2,-1);if(v(o)){s.delete(e);break}}}else if(i==="49"){for(const e of s)if(e.startsWith("\x1B[")&&e.endsWith("m")){const o=e.slice(2,-1);if(w(o)){s.delete(e);break}}}else if(j.has(i)){const e=j.get(i);for(const o of s)if(o===`\x1B[${e}m`){s.delete(o);break}}else{if(v(i)){for(const e of s)if(e.startsWith("\x1B[")&&e.endsWith("m")){const o=e.slice(2,-1);if(v(o)){s.delete(e);break}}}else if(w(i)){for(const e of s)if(e.startsWith("\x1B[")&&e.endsWith("m")){const o=e.slice(2,-1);if(w(o)){s.delete(e);break}}}else if(P.has(i)){const e=`\x1B[${i}m`;s.has(e)&&s.delete(e)}s.add(n)}}else if(n.startsWith("\x1B]8;;")&&!n.endsWith("\x1B]8;;\x07")){for(const i of s)if(i.startsWith("\x1B]8;;")&&!i.endsWith("\x1B]8;;\x07")){s.delete(i);break}s.add(n)}}if(x==="")continue;let u="";if(s.size>0)if(m.includes("\x1B[0m"))u="\x1B[0m";else{const n=[];let i=!1;for(const r of s)if(r.startsWith("\x1B]8;;")&&!r.endsWith("\x1B]8;;\x07")){i=!0;break}i&&m.includes("\x1B]8;;\x07")&&n.push("\x1B]8;;\x07");let e=!1,o=!1;for(const r of s)if(r.startsWith("\x1B[")&&r.endsWith("m")){const W=r.slice(2,-1);v(W)?e=!0:w(W)&&(o=!0)}if(e&&o){const r=L(t,["\x1B[3","\x1B[9","\x1B[38;"]),W=L(t,["\x1B[4","\x1B[10","\x1B[48;"]);r>=0&&W>=0?r>W?n.push("\x1B[39m","\x1B[49m"):n.push("\x1B[49m","\x1B[39m"):n.push("\x1B[39m","\x1B[49m")}else e&&n.push("\x1B[39m"),o&&n.push("\x1B[49m");e&&o&&t.includes("\x1B[39m")&&t.includes("\x1B[49m")&&(t.indexOf("\x1B[39m")<t.indexOf("\x1B[49m")?(n.length-=e&&o?2:e||o?1:0,n.push("\x1B[39m","\x1B[49m")):t.indexOf("\x1B[49m")<t.indexOf("\x1B[39m")&&(n.length-=e&&o?2:e||o?1:0,n.push("\x1B[49m","\x1B[39m")));const M=R.filter(r=>s.has(r.open)).map(r=>({position:t.indexOf(r.open),style:r})).filter(r=>r.position>=0).sort((r,W)=>W.position-r.position);for(const r of M)m.includes(r.style.close)&&n.push(r.style.close);u=n.join("")}const g=[...s].join("");B.push({after:u,before:g,content:x,visibleLength:k.getStringWidth(x,{fullWidth:1,wideWidth:1})})}return y.set(t,B),B},"processIntoStyledSegments"),A=S((t,f,l,d)=>{const h=[...d.segmenter.segment(t)],p=[];let a=0,m=!1;for(const s of h){const B=k.getStringWidth(s.segment,d.width),c=a,x=a+B;if(!m)if(c<f){a=x;continue}else m=!0;if(c>=l||x>l)break;p.push(s.segment),a=x}return p.join("")},"fastSlice"),C=S((t,f=0,l=Number.MAX_SAFE_INTEGER,d={})=>{const h={segmenter:E,...d};if(f>=l||t==="")return"";const p=k.getStringWidth(t,h.width);if(f===0&&l>=p)return t;if(f<0||l<0)throw new RangeError("Negative indices aren't supported");if(!t.includes("\x1B"))return/^[\u0000-\u007F]*$/.test(t)?t.slice(f,l):A(t,f,l,h);if(b.a.lastIndex=0,b.b.lastIndex=0,!b.a.test(t)&&!b.b.test(t))return t;const a=q(t,h);if(a.length===0)return"";let m=0;const s=[];for(const[x,u]of a.entries()){const g=m,n=m+u.visibleLength;if(n>f&&g<l){const i=Math.max(0,f-g),e=Math.min(u.visibleLength,l-g);s.push({end:e,index:x,segment:u,start:i})}m=n}if(s.length===0)return"";const B=[],c=s[0].segment;B.push(c.before);for(let x=0;x<s.length;x++){const{end:u,segment:g,start:n}=s[x];if(n===0&&u===g.visibleLength)B.push(g.content);else{const i=[...h.segmenter.segment(g.content)];B.push(i.slice(n,u).map(e=>e.segment).join(""))}if(x<s.length-1){const i=s[x+1].segment,e=g.after,o=i.before;e!==o&&(e||o)&&B.push(e,o)}}return B.push(s.at(-1).segment.after),B.join("")},"slice");exports.slice=C;
1
+ "use strict";var I=Object.defineProperty;var O=(t,f)=>I(t,"name",{value:f,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("./packem_shared/constants-DEcMFLn8.cjs"),k=require("./get-string-width.cjs"),F=require("./packem_shared/LRUCache-TYqfUYE5.cjs");var _=Object.defineProperty,S=O((t,f)=>_(t,"name",{value:f,configurable:!0}),"y");const y=new F(100),E=new Intl.Segmenter("en",{granularity:"grapheme"}),N=new Set(["0","22","23","24","27","28","29","39","49"]),P=new Set(["1","3","4","7","8","9"]),j=new Map([["22","1"],["23","3"],["24","4"],["27","7"],["28","8"],["29","9"]]),v=S(t=>t>="30"&&t<="37"||t>="90"&&t<="97"||t.startsWith("38;"),"isForegroundColor"),w=S(t=>t>="40"&&t<="47"||t>="100"&&t<="107"||t.startsWith("48;"),"isBackgroundColor"),R=[{close:"\x1B[22m",open:"\x1B[1m"},{close:"\x1B[23m",open:"\x1B[3m"},{close:"\x1B[24m",open:"\x1B[4m"},{close:"\x1B[27m",open:"\x1B[7m"},{close:"\x1B[28m",open:"\x1B[8m"},{close:"\x1B[29m",open:"\x1B[9m"}],L=S((t,f)=>{let l=-1;for(const d of f){const h=t.indexOf(d);h!==-1&&(l===-1||h<l)&&(l=h)}return l},"findFirstPositionOfAny"),q=S((t,f)=>{if(!t.includes("\x1B"))return[{after:"",before:"",content:t,visibleLength:k.getStringWidth(t,f.width)}];const l=y.get(t);if(l)return l;const d=[],h=[];let p=0,a;for(b.c.lastIndex=0;(a=b.c.exec(t))!==null;){const c=a[0];d.push(t.slice(p,a.index)),h.push(c),p=a.index+c.length}p<t.length&&d.push(t.slice(p));const m=[];for(const c of h){if(c==="\x1B[0m"||c==="\x1B]8;;\x07"){m.push(c);continue}if(c.startsWith("\x1B[")&&c.endsWith("m")){const x=c.slice(2,-1);if(N.has(x)){m.push(c);continue}}}const s=new Set,B=[];for(const[c,x]of d.entries()){if(c>0&&h[c-1]){const n=h[c-1];if(n==="\x1B[0m")s.clear();else if(n==="\x1B]8;;\x07"){for(const i of s)if(i.startsWith("\x1B]8;;")&&!i.endsWith("\x1B]8;;\x07")){s.delete(i);break}}else if(n.startsWith("\x1B[")&&n.endsWith("m")){const i=n.slice(2,-1);if(i==="39"){for(const e of s)if(e.startsWith("\x1B[")&&e.endsWith("m")){const o=e.slice(2,-1);if(v(o)){s.delete(e);break}}}else if(i==="49"){for(const e of s)if(e.startsWith("\x1B[")&&e.endsWith("m")){const o=e.slice(2,-1);if(w(o)){s.delete(e);break}}}else if(j.has(i)){const e=j.get(i);for(const o of s)if(o===`\x1B[${e}m`){s.delete(o);break}}else{if(v(i)){for(const e of s)if(e.startsWith("\x1B[")&&e.endsWith("m")){const o=e.slice(2,-1);if(v(o)){s.delete(e);break}}}else if(w(i)){for(const e of s)if(e.startsWith("\x1B[")&&e.endsWith("m")){const o=e.slice(2,-1);if(w(o)){s.delete(e);break}}}else if(P.has(i)){const e=`\x1B[${i}m`;s.has(e)&&s.delete(e)}s.add(n)}}else if(n.startsWith("\x1B]8;;")&&!n.endsWith("\x1B]8;;\x07")){for(const i of s)if(i.startsWith("\x1B]8;;")&&!i.endsWith("\x1B]8;;\x07")){s.delete(i);break}s.add(n)}}if(x==="")continue;let u="";if(s.size>0)if(m.includes("\x1B[0m"))u="\x1B[0m";else{const n=[];let i=!1;for(const r of s)if(r.startsWith("\x1B]8;;")&&!r.endsWith("\x1B]8;;\x07")){i=!0;break}i&&m.includes("\x1B]8;;\x07")&&n.push("\x1B]8;;\x07");let e=!1,o=!1;for(const r of s)if(r.startsWith("\x1B[")&&r.endsWith("m")){const W=r.slice(2,-1);v(W)?e=!0:w(W)&&(o=!0)}if(e&&o){const r=L(t,["\x1B[3","\x1B[9","\x1B[38;"]),W=L(t,["\x1B[4","\x1B[10","\x1B[48;"]);r>=0&&W>=0?r>W?n.push("\x1B[39m","\x1B[49m"):n.push("\x1B[49m","\x1B[39m"):n.push("\x1B[39m","\x1B[49m")}else e&&n.push("\x1B[39m"),o&&n.push("\x1B[49m");e&&o&&t.includes("\x1B[39m")&&t.includes("\x1B[49m")&&(t.indexOf("\x1B[39m")<t.indexOf("\x1B[49m")?(n.length-=e&&o?2:e||o?1:0,n.push("\x1B[39m","\x1B[49m")):t.indexOf("\x1B[49m")<t.indexOf("\x1B[39m")&&(n.length-=e&&o?2:e||o?1:0,n.push("\x1B[49m","\x1B[39m")));const M=R.filter(r=>s.has(r.open)).map(r=>({position:t.indexOf(r.open),style:r})).filter(r=>r.position>=0).sort((r,W)=>W.position-r.position);for(const r of M)m.includes(r.style.close)&&n.push(r.style.close);u=n.join("")}const g=[...s].join("");B.push({after:u,before:g,content:x,visibleLength:k.getStringWidth(x,{fullWidth:1,wideWidth:1})})}return y.set(t,B),B},"processIntoStyledSegments"),A=S((t,f,l,d)=>{const h=[...d.segmenter.segment(t)],p=[];let a=0,m=!1;for(const s of h){const B=k.getStringWidth(s.segment,d.width),c=a,x=a+B;if(!m)if(c<f){a=x;continue}else m=!0;if(c>=l||x>l)break;p.push(s.segment),a=x}return p.join("")},"fastSlice"),C=S((t,f=0,l=Number.MAX_SAFE_INTEGER,d={})=>{const h={segmenter:E,...d};if(f>=l||t==="")return"";const p=k.getStringWidth(t,h.width);if(f===0&&l>=p)return t;if(f<0||l<0)throw new RangeError("Negative indices aren't supported");if(!t.includes("\x1B"))return/^[\u0000-\u007F]*$/.test(t)?t.slice(f,l):A(t,f,l,h);if(b.a.lastIndex=0,b.b.lastIndex=0,!b.a.test(t)&&!b.b.test(t))return t;const a=q(t,h);if(a.length===0)return"";let m=0;const s=[];for(const[x,u]of a.entries()){const g=m,n=m+u.visibleLength;if(n>f&&g<l){const i=Math.max(0,f-g),e=Math.min(u.visibleLength,l-g);s.push({end:e,index:x,segment:u,start:i})}m=n}if(s.length===0)return"";const B=[],c=s[0].segment;B.push(c.before);for(let x=0;x<s.length;x++){const{end:u,segment:g,start:n}=s[x];if(n===0&&u===g.visibleLength)B.push(g.content);else{const i=[...h.segmenter.segment(g.content)];B.push(i.slice(n,u).map(e=>e.segment).join(""))}if(x<s.length-1){const i=s[x+1].segment,e=g.after,o=i.before;e!==o&&(e||o)&&B.push(e,o)}}return B.push(s.at(-1).segment.after),B.join("")},"slice");exports.slice=C;
package/dist/slice.mjs CHANGED
@@ -1 +1 @@
1
- var R=Object.defineProperty;var k=(t,l)=>R(t,"name",{value:l,configurable:!0});import{a as v,b as L,c as O}from"./packem_shared/constants-Cd17VNEv.mjs";import{getStringWidth as I}from"./get-string-width.mjs";import N from"./packem_shared/LRUCache-Bjo6gsbC.mjs";var j=Object.defineProperty,b=k((t,l)=>j(t,"name",{value:l,configurable:!0}),"y");const _=new N(100),F=new Intl.Segmenter("en",{granularity:"grapheme"}),M=new Set(["0","22","23","24","27","28","29","39","49"]),P=new Set(["1","3","4","7","8","9"]),y=new Map([["22","1"],["23","3"],["24","4"],["27","7"],["28","8"],["29","9"]]),S=b(t=>t>="30"&&t<="37"||t>="90"&&t<="97"||t.startsWith("38;"),"isForegroundColor"),w=b(t=>t>="40"&&t<="47"||t>="100"&&t<="107"||t.startsWith("48;"),"isBackgroundColor"),V=[{close:"\x1B[22m",open:"\x1B[1m"},{close:"\x1B[23m",open:"\x1B[3m"},{close:"\x1B[24m",open:"\x1B[4m"},{close:"\x1B[27m",open:"\x1B[7m"},{close:"\x1B[28m",open:"\x1B[8m"},{close:"\x1B[29m",open:"\x1B[9m"}],A=b((t,l)=>{let c=-1;for(const d of l){const h=t.indexOf(d);h>=0&&(c===-1||h<c)&&(c=h)}return c},"findFirstPositionOfAny"),$=b((t,l)=>{if(!t.includes("\x1B"))return[{after:"",before:"",content:t,visibleLength:I(t,l.width)}];const c=_.get(t);if(c)return c;const d=[],h=[];let g=0,m;for(O.lastIndex=0;(m=O.exec(t))!==null;){const f=m[0];d.push(t.slice(g,m.index)),h.push(f),g=m.index+f.length}g<t.length&&d.push(t.slice(g));const a=[];for(const f of h){if(f==="\x1B[0m"||f==="\x1B]8;;\x07"){a.push(f);continue}if(f.startsWith("\x1B[")&&f.endsWith("m")){const x=f.slice(2,-1);if(M.has(x)){a.push(f);continue}}}const s=new Set,B=[];for(const[f,x]of d.entries()){if(f>0&&h[f-1]){const n=h[f-1];if(n==="\x1B[0m")s.clear();else if(n==="\x1B]8;;\x07"){for(const i of s)if(i.startsWith("\x1B]8;;")&&!i.endsWith("\x1B]8;;\x07")){s.delete(i);break}}else if(n.startsWith("\x1B[")&&n.endsWith("m")){const i=n.slice(2,-1);if(i==="39"){for(const e of s)if(e.startsWith("\x1B[")&&e.endsWith("m")){const o=e.slice(2,-1);if(S(o)){s.delete(e);break}}}else if(i==="49"){for(const e of s)if(e.startsWith("\x1B[")&&e.endsWith("m")){const o=e.slice(2,-1);if(w(o)){s.delete(e);break}}}else if(y.has(i)){const e=y.get(i);for(const o of s)if(o===`\x1B[${e}m`){s.delete(o);break}}else{if(S(i)){for(const e of s)if(e.startsWith("\x1B[")&&e.endsWith("m")){const o=e.slice(2,-1);if(S(o)){s.delete(e);break}}}else if(w(i)){for(const e of s)if(e.startsWith("\x1B[")&&e.endsWith("m")){const o=e.slice(2,-1);if(w(o)){s.delete(e);break}}}else if(P.has(i)){const e=`\x1B[${i}m`;s.has(e)&&s.delete(e)}s.add(n)}}else if(n.startsWith("\x1B]8;;")&&!n.endsWith("\x1B]8;;\x07")){for(const i of s)if(i.startsWith("\x1B]8;;")&&!i.endsWith("\x1B]8;;\x07")){s.delete(i);break}s.add(n)}}if(x==="")continue;let u="";if(s.size>0)if(a.includes("\x1B[0m"))u="\x1B[0m";else{const n=[];let i=!1;for(const r of s)if(r.startsWith("\x1B]8;;")&&!r.endsWith("\x1B]8;;\x07")){i=!0;break}i&&a.includes("\x1B]8;;\x07")&&n.push("\x1B]8;;\x07");let e=!1,o=!1;for(const r of s)if(r.startsWith("\x1B[")&&r.endsWith("m")){const W=r.slice(2,-1);S(W)?e=!0:w(W)&&(o=!0)}if(e&&o){const r=A(t,["\x1B[3","\x1B[9","\x1B[38;"]),W=A(t,["\x1B[4","\x1B[10","\x1B[48;"]);r>=0&&W>=0?r>W?n.push("\x1B[39m","\x1B[49m"):n.push("\x1B[49m","\x1B[39m"):n.push("\x1B[39m","\x1B[49m")}else e&&n.push("\x1B[39m"),o&&n.push("\x1B[49m");e&&o&&t.includes("\x1B[39m")&&t.includes("\x1B[49m")&&(t.indexOf("\x1B[39m")<t.indexOf("\x1B[49m")?(n.length-=e&&o?2:e||o?1:0,n.push("\x1B[39m","\x1B[49m")):t.indexOf("\x1B[49m")<t.indexOf("\x1B[39m")&&(n.length-=e&&o?2:e||o?1:0,n.push("\x1B[49m","\x1B[39m")));const E=V.filter(r=>s.has(r.open)).map(r=>({position:t.indexOf(r.open),style:r})).filter(r=>r.position>=0).sort((r,W)=>W.position-r.position);for(const r of E)a.includes(r.style.close)&&n.push(r.style.close);u=n.join("")}const p=[...s].join("");B.push({after:u,before:p,content:x,visibleLength:I(x,{fullWidth:1,wideWidth:1})})}return _.set(t,B),B},"processIntoStyledSegments"),C=b((t,l,c,d)=>{const h=[...d.segmenter.segment(t)],g=[];let m=0,a=!1;for(const s of h){const B=I(s.segment,d.width),f=m,x=m+B;if(!a)if(f<l){m=x;continue}else a=!0;if(f>=c||x>c)break;g.push(s.segment),m=x}return g.join("")},"fastSlice"),H=b((t,l=0,c=Number.MAX_SAFE_INTEGER,d={})=>{const h={segmenter:F,...d};if(l>=c||t==="")return"";const g=I(t,h.width);if(l===0&&c>=g)return t;if(l<0||c<0)throw new RangeError("Negative indices aren't supported");if(!t.includes("\x1B"))return/^[\u0000-\u007F]*$/.test(t)?t.slice(l,c):C(t,l,c,h);if(v.lastIndex=0,L.lastIndex=0,!v.test(t)&&!L.test(t))return t;const m=$(t,h);if(m.length===0)return"";let a=0;const s=[];for(const[x,u]of m.entries()){const p=a,n=a+u.visibleLength;if(n>l&&p<c){const i=Math.max(0,l-p),e=Math.min(u.visibleLength,c-p);s.push({end:e,index:x,segment:u,start:i})}a=n}if(s.length===0)return"";const B=[],f=s[0].segment;B.push(f.before);for(let x=0;x<s.length;x++){const{end:u,segment:p,start:n}=s[x];if(n===0&&u===p.visibleLength)B.push(p.content);else{const i=[...h.segmenter.segment(p.content)];B.push(i.slice(n,u).map(e=>e.segment).join(""))}if(x<s.length-1){const i=s[x+1].segment,e=p.after,o=i.before;e!==o&&(e||o)&&B.push(e,o)}}return B.push(s.at(-1).segment.after),B.join("")},"slice");export{H as slice};
1
+ var R=Object.defineProperty;var k=(t,l)=>R(t,"name",{value:l,configurable:!0});import{a as v,b as L,c as O}from"./packem_shared/constants-CDcaCZKC.mjs";import{getStringWidth as I}from"./get-string-width.mjs";import N from"./packem_shared/LRUCache-Bjo6gsbC.mjs";var j=Object.defineProperty,b=k((t,l)=>j(t,"name",{value:l,configurable:!0}),"y");const _=new N(100),F=new Intl.Segmenter("en",{granularity:"grapheme"}),M=new Set(["0","22","23","24","27","28","29","39","49"]),P=new Set(["1","3","4","7","8","9"]),y=new Map([["22","1"],["23","3"],["24","4"],["27","7"],["28","8"],["29","9"]]),S=b(t=>t>="30"&&t<="37"||t>="90"&&t<="97"||t.startsWith("38;"),"isForegroundColor"),w=b(t=>t>="40"&&t<="47"||t>="100"&&t<="107"||t.startsWith("48;"),"isBackgroundColor"),V=[{close:"\x1B[22m",open:"\x1B[1m"},{close:"\x1B[23m",open:"\x1B[3m"},{close:"\x1B[24m",open:"\x1B[4m"},{close:"\x1B[27m",open:"\x1B[7m"},{close:"\x1B[28m",open:"\x1B[8m"},{close:"\x1B[29m",open:"\x1B[9m"}],A=b((t,l)=>{let c=-1;for(const d of l){const h=t.indexOf(d);h!==-1&&(c===-1||h<c)&&(c=h)}return c},"findFirstPositionOfAny"),$=b((t,l)=>{if(!t.includes("\x1B"))return[{after:"",before:"",content:t,visibleLength:I(t,l.width)}];const c=_.get(t);if(c)return c;const d=[],h=[];let g=0,m;for(O.lastIndex=0;(m=O.exec(t))!==null;){const f=m[0];d.push(t.slice(g,m.index)),h.push(f),g=m.index+f.length}g<t.length&&d.push(t.slice(g));const a=[];for(const f of h){if(f==="\x1B[0m"||f==="\x1B]8;;\x07"){a.push(f);continue}if(f.startsWith("\x1B[")&&f.endsWith("m")){const x=f.slice(2,-1);if(M.has(x)){a.push(f);continue}}}const s=new Set,B=[];for(const[f,x]of d.entries()){if(f>0&&h[f-1]){const n=h[f-1];if(n==="\x1B[0m")s.clear();else if(n==="\x1B]8;;\x07"){for(const i of s)if(i.startsWith("\x1B]8;;")&&!i.endsWith("\x1B]8;;\x07")){s.delete(i);break}}else if(n.startsWith("\x1B[")&&n.endsWith("m")){const i=n.slice(2,-1);if(i==="39"){for(const e of s)if(e.startsWith("\x1B[")&&e.endsWith("m")){const o=e.slice(2,-1);if(S(o)){s.delete(e);break}}}else if(i==="49"){for(const e of s)if(e.startsWith("\x1B[")&&e.endsWith("m")){const o=e.slice(2,-1);if(w(o)){s.delete(e);break}}}else if(y.has(i)){const e=y.get(i);for(const o of s)if(o===`\x1B[${e}m`){s.delete(o);break}}else{if(S(i)){for(const e of s)if(e.startsWith("\x1B[")&&e.endsWith("m")){const o=e.slice(2,-1);if(S(o)){s.delete(e);break}}}else if(w(i)){for(const e of s)if(e.startsWith("\x1B[")&&e.endsWith("m")){const o=e.slice(2,-1);if(w(o)){s.delete(e);break}}}else if(P.has(i)){const e=`\x1B[${i}m`;s.has(e)&&s.delete(e)}s.add(n)}}else if(n.startsWith("\x1B]8;;")&&!n.endsWith("\x1B]8;;\x07")){for(const i of s)if(i.startsWith("\x1B]8;;")&&!i.endsWith("\x1B]8;;\x07")){s.delete(i);break}s.add(n)}}if(x==="")continue;let u="";if(s.size>0)if(a.includes("\x1B[0m"))u="\x1B[0m";else{const n=[];let i=!1;for(const r of s)if(r.startsWith("\x1B]8;;")&&!r.endsWith("\x1B]8;;\x07")){i=!0;break}i&&a.includes("\x1B]8;;\x07")&&n.push("\x1B]8;;\x07");let e=!1,o=!1;for(const r of s)if(r.startsWith("\x1B[")&&r.endsWith("m")){const W=r.slice(2,-1);S(W)?e=!0:w(W)&&(o=!0)}if(e&&o){const r=A(t,["\x1B[3","\x1B[9","\x1B[38;"]),W=A(t,["\x1B[4","\x1B[10","\x1B[48;"]);r>=0&&W>=0?r>W?n.push("\x1B[39m","\x1B[49m"):n.push("\x1B[49m","\x1B[39m"):n.push("\x1B[39m","\x1B[49m")}else e&&n.push("\x1B[39m"),o&&n.push("\x1B[49m");e&&o&&t.includes("\x1B[39m")&&t.includes("\x1B[49m")&&(t.indexOf("\x1B[39m")<t.indexOf("\x1B[49m")?(n.length-=e&&o?2:e||o?1:0,n.push("\x1B[39m","\x1B[49m")):t.indexOf("\x1B[49m")<t.indexOf("\x1B[39m")&&(n.length-=e&&o?2:e||o?1:0,n.push("\x1B[49m","\x1B[39m")));const E=V.filter(r=>s.has(r.open)).map(r=>({position:t.indexOf(r.open),style:r})).filter(r=>r.position>=0).sort((r,W)=>W.position-r.position);for(const r of E)a.includes(r.style.close)&&n.push(r.style.close);u=n.join("")}const p=[...s].join("");B.push({after:u,before:p,content:x,visibleLength:I(x,{fullWidth:1,wideWidth:1})})}return _.set(t,B),B},"processIntoStyledSegments"),C=b((t,l,c,d)=>{const h=[...d.segmenter.segment(t)],g=[];let m=0,a=!1;for(const s of h){const B=I(s.segment,d.width),f=m,x=m+B;if(!a)if(f<l){m=x;continue}else a=!0;if(f>=c||x>c)break;g.push(s.segment),m=x}return g.join("")},"fastSlice"),H=b((t,l=0,c=Number.MAX_SAFE_INTEGER,d={})=>{const h={segmenter:F,...d};if(l>=c||t==="")return"";const g=I(t,h.width);if(l===0&&c>=g)return t;if(l<0||c<0)throw new RangeError("Negative indices aren't supported");if(!t.includes("\x1B"))return/^[\u0000-\u007F]*$/.test(t)?t.slice(l,c):C(t,l,c,h);if(v.lastIndex=0,L.lastIndex=0,!v.test(t)&&!L.test(t))return t;const m=$(t,h);if(m.length===0)return"";let a=0;const s=[];for(const[x,u]of m.entries()){const p=a,n=a+u.visibleLength;if(n>l&&p<c){const i=Math.max(0,l-p),e=Math.min(u.visibleLength,c-p);s.push({end:e,index:x,segment:u,start:i})}a=n}if(s.length===0)return"";const B=[],f=s[0].segment;B.push(f.before);for(let x=0;x<s.length;x++){const{end:u,segment:p,start:n}=s[x];if(n===0&&u===p.visibleLength)B.push(p.content);else{const i=[...h.segmenter.segment(p.content)];B.push(i.slice(n,u).map(e=>e.segment).join(""))}if(x<s.length-1){const i=s[x+1].segment,e=p.after,o=i.before;e!==o&&(e||o)&&B.push(e,o)}}return B.push(s.at(-1).segment.after),B.join("")},"slice");export{H as slice};
@@ -0,0 +1 @@
1
+ "use strict";var c=Object.defineProperty;var l=(a,s)=>c(a,"name",{value:s,configurable:!0});const i=require("./packem_shared/transliterate-wQMEsr3l.cjs"),o=require("./utilities.cjs");var u=Object.defineProperty,p=l((a,s)=>u(a,"name",{value:s,configurable:!0}),"o");const g=p((a,s,e)=>{const r=o.escapeRegExp(s).replaceAll(String.raw`\-`,"-"),t=new RegExp(`[^${r}]`,"g");return a.replaceAll(t,e)},"removeDisallowedChars"),w=p((a,s)=>{const e={allowedChars:"a-zA-Z0-9-_.~",fixChineseSpacing:!0,ignore:[],lowercase:!0,replaceAfter:[],replaceBefore:[],separator:"-",transliterate:!0,trim:!1,unknown:"",uppercase:!1,...s};e.lowercase&&e.uppercase&&(console.warn("slugify: Both lowercase and uppercase options are true. Defaulting to lowercase."),e.uppercase=!1);let r=e.transliterate?i(a,e):a.normalize("NFC");e.lowercase?r=r.toLowerCase():e.uppercase&&(r=r.toUpperCase()),r=g(r,e.allowedChars,e.separator);const t=o.escapeRegExp(e.separator);if(t){const n=new RegExp(`${t}+`,"g");r=r.replace(n,e.separator)}return t?r.replaceAll(new RegExp(`^${t}+|${t}+$`,"g"),""):r},"slugify");module.exports=w;
@@ -0,0 +1,5 @@
1
+ import { j as SlugifyOptions } from './packem_shared/types-Daae0hGf.cjs';
2
+
3
+ declare const slugify: (input: string, options?: SlugifyOptions) => string;
4
+
5
+ export = slugify;
@@ -0,0 +1,5 @@
1
+ import { j as SlugifyOptions } from './packem_shared/types-Daae0hGf.mjs';
2
+
3
+ declare const slugify: (input: string, options?: SlugifyOptions) => string;
4
+
5
+ export { slugify as default };
@@ -0,0 +1,5 @@
1
+ import { j as SlugifyOptions } from './packem_shared/types-Daae0hGf.js';
2
+
3
+ declare const slugify: (input: string, options?: SlugifyOptions) => string;
4
+
5
+ export = slugify;
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var s=(a,o)=>c(a,"name",{value:o,configurable:!0});import i from"./packem_shared/transliterate-DNh-jM0e.mjs";import{escapeRegExp as t}from"./utilities.mjs";var u=Object.defineProperty,p=s((a,o)=>u(a,"name",{value:o,configurable:!0}),"o");const f=p((a,o,e)=>{const r=t(o).replaceAll(String.raw`\-`,"-"),l=new RegExp(`[^${r}]`,"g");return a.replaceAll(l,e)},"removeDisallowedChars"),C=p((a,o)=>{const e={allowedChars:"a-zA-Z0-9-_.~",fixChineseSpacing:!0,ignore:[],lowercase:!0,replaceAfter:[],replaceBefore:[],separator:"-",transliterate:!0,trim:!1,unknown:"",uppercase:!1,...o};e.lowercase&&e.uppercase&&(console.warn("slugify: Both lowercase and uppercase options are true. Defaulting to lowercase."),e.uppercase=!1);let r=e.transliterate?i(a,e):a.normalize("NFC");e.lowercase?r=r.toLowerCase():e.uppercase&&(r=r.toUpperCase()),r=f(r,e.allowedChars,e.separator);const l=t(e.separator);if(l){const n=new RegExp(`${l}+`,"g");r=r.replace(n,e.separator)}return l?r.replaceAll(new RegExp(`^${l}+|${l}+$`,"g"),""):r},"slugify");export{C as default};
@@ -1,4 +1,4 @@
1
- "use strict";var d=Object.defineProperty;var c=(e,t)=>d(e,"name",{value:t,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("node:util"),l=require("../get-string-width.cjs");var o=Object.defineProperty,a=c((e,t)=>o(e,"name",{value:t,configurable:!0}),"r");const n=a(e=>{const t=g.stripVTControlCharacters(e);return{ansi:e,json:JSON.stringify(e),lengthDifference:e.length-t.length,stripped:t,visible:e.replaceAll("\x1B","\\u001B")}},"formatAnsiString"),u=a((e,t)=>{const i=n(e),s=n(t);return{message:a(()=>{if(e===t)return"ANSI strings are identical";const r=i.stripped===s.stripped;return g.format(`ANSI string comparison failed:
1
+ "use strict";var d=Object.defineProperty;var c=(e,t)=>d(e,"name",{value:t,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("node:util"),g=require("../get-string-width.cjs");var o=Object.defineProperty,a=c((e,t)=>o(e,"name",{value:t,configurable:!0}),"r");const n=a(e=>{const t=l.stripVTControlCharacters(e);return{ansi:e,json:JSON.stringify(e),lengthDifference:e.length-t.length,stripped:t,visible:e.replaceAll("\x1B",String.raw`\u001B`)}},"formatAnsiString"),u=a((e,t)=>{const i=n(e),s=n(t);return{message:a(()=>{if(e===t)return"ANSI strings are identical";const r=i.stripped===s.stripped;return l.format(`ANSI string comparison failed:
2
2
 
3
3
  Actual:
4
4
  - Visible content: %s
@@ -13,4 +13,4 @@ Expected:
13
13
  - Length: %d
14
14
 
15
15
  %s
16
- `,i.stripped,i.visible,i.json,l.getStringWidth(i.ansi),s.stripped,s.visible,s.json,l.getStringWidth(s.ansi),r?"✓ Visible content is identical, but escape codes differ":"✗ Visible content differs")},"message"),pass:e===t}},"expectAnsiStrings"),S=a((e,t)=>{const i=n(e),s=n(t),r=i.stripped===s.stripped,p=e===t;return{actual:i,ansiEqual:p,expected:s,strippedEqual:r,summary:{actualLength:e.length,actualStrippedLength:i.stripped.length,ansiEqual:p,expectedLength:t.length,expectedStrippedLength:s.stripped.length,strippedEqual:r}}},"compareAnsiStrings");exports.compareAnsiStrings=S;exports.expectAnsiStrings=u;exports.formatAnsiString=n;
16
+ `,i.stripped,i.visible,i.json,g.getStringWidth(i.ansi),s.stripped,s.visible,s.json,g.getStringWidth(s.ansi),r?"✓ Visible content is identical, but escape codes differ":"✗ Visible content differs")},"message"),pass:e===t}},"expectAnsiStrings"),S=a((e,t)=>{const i=n(e),s=n(t),r=i.stripped===s.stripped,p=e===t;return{actual:i,ansiEqual:p,expected:s,strippedEqual:r,summary:{actualLength:e.length,actualStrippedLength:i.stripped.length,ansiEqual:p,expectedLength:t.length,expectedStrippedLength:s.stripped.length,strippedEqual:r}}},"compareAnsiStrings");exports.compareAnsiStrings=S;exports.expectAnsiStrings=u;exports.formatAnsiString=n;
@@ -1,4 +1,4 @@
1
- var o=Object.defineProperty;var c=(e,t)=>o(e,"name",{value:t,configurable:!0});import{stripVTControlCharacters as d,format as g}from"node:util";import{getStringWidth as l}from"../get-string-width.mjs";var u=Object.defineProperty,r=c((e,t)=>u(e,"name",{value:t,configurable:!0}),"r");const p=r(e=>{const t=d(e);return{ansi:e,json:JSON.stringify(e),lengthDifference:e.length-t.length,stripped:t,visible:e.replaceAll("\x1B","\\u001B")}},"formatAnsiString"),S=r((e,t)=>{const s=p(e),i=p(t);return{message:r(()=>{if(e===t)return"ANSI strings are identical";const n=s.stripped===i.stripped;return g(`ANSI string comparison failed:
1
+ var o=Object.defineProperty;var c=(e,t)=>o(e,"name",{value:t,configurable:!0});import{stripVTControlCharacters as d,format as g}from"node:util";import{getStringWidth as l}from"../get-string-width.mjs";var u=Object.defineProperty,r=c((e,t)=>u(e,"name",{value:t,configurable:!0}),"r");const p=r(e=>{const t=d(e);return{ansi:e,json:JSON.stringify(e),lengthDifference:e.length-t.length,stripped:t,visible:e.replaceAll("\x1B",String.raw`\u001B`)}},"formatAnsiString"),S=r((e,t)=>{const s=p(e),i=p(t);return{message:r(()=>{if(e===t)return"ANSI strings are identical";const n=s.stripped===i.stripped;return g(`ANSI string comparison failed:
2
2
 
3
3
  Actual:
4
4
  - Visible content: %s
package/dist/truncate.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var m=Object.defineProperty;var a=(t,i)=>m(t,"name",{value:i,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("./get-string-truncated-width.cjs"),c=require("./slice.cjs");var b=Object.defineProperty,p=a((t,i)=>b(t,"name",{value:i,configurable:!0}),"h");const f="…",T=3,u=p((t,i,e=!1)=>{if(t.charAt(i)===" ")return i;const r=e?1:-1,l=Math.min(T,e?t.length-i:i);for(let d=1;d<=l;d++){const n=i+d*r;if(t.charAt(n)===" ")return n}return i},"findNearestSpace"),v=p((t,i,e={})=>{if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof t}`);if(typeof i!="number")throw new TypeError(`Expected \`limit\` to be a number, got ${typeof i}`);if(t===""||i<=0)return"";t=t.normalize("NFC");const{ellipsis:r=f,position:l="end",preferTruncationOnSpace:d=!1}=e;let n=e.ellipsisWidth??r===f?1:void 0;if(n===void 0&&(n=h.getStringTruncatedWidth(r,{...e.width,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width),i===1&&n===1)return r;if(i===1)return"";const{width:s}=h.getStringTruncatedWidth(t,{...e.width,ellipsis:r,ellipsisWidth:n});if(s<=i)return t;switch(l){case"start":{if(d){const o=u(t,s-i+1,!0);return r+c.slice(t,o,s).trim()}return r+c.slice(t,s-i+n,s,{width:e.width})}case"middle":{const o=Math.floor(i/2);if(d){const w=u(t,o),g=u(t,s-(i-o)+1,!0);return c.slice(t,0,w)+r+c.slice(t,g,s).trim()}return c.slice(t,0,o,{width:e.width})+r+c.slice(t,s-(i-o)+n,s,{width:e.width})}case"end":{if(d){const o=u(t,i-1);return c.slice(t,0,o,{width:e.width})+r}return c.slice(t,0,i-n,{width:e.width})+r}default:throw new Error(`Invalid position: expected 'start', 'middle' or 'end', got '${l}'`)}},"truncate");exports.truncate=v;
1
+ "use strict";var m=Object.defineProperty;var a=(t,i)=>m(t,"name",{value:i,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("./get-string-truncated-width.cjs"),c=require("./slice.cjs");var b=Object.defineProperty,p=a((t,i)=>b(t,"name",{value:i,configurable:!0}),"h");const f="…",T=3,u=p((t,i,e=!1)=>{if(t.charAt(i)===" ")return i;const r=e?1:-1,l=Math.min(T,e?t.length-i:i);for(let d=1;d<=l;d++){const n=i+d*r;if(t.charAt(n)===" ")return n}return i},"findNearestSpace"),v=p((t,i,e={})=>{if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof t}`);if(typeof i!="number")throw new TypeError(`Expected \`limit\` to be a number, got ${typeof i}`);if(t===""||i<=0)return"";t=t.normalize("NFC");const{ellipsis:r=f,position:l="end",preferTruncationOnSpace:d=!1}=e;let n=e.ellipsisWidth??r===f?1:void 0;if(n===void 0&&(n=h.getStringTruncatedWidth(r,{...e.width,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width),i===1&&n===1)return r;if(i===1)return"";const{width:s}=h.getStringTruncatedWidth(t,{...e.width,ellipsis:r,ellipsisWidth:n});if(s<=i)return t;switch(l){case"end":{if(d){const o=u(t,i-1);return c.slice(t,0,o,{width:e.width})+r}return c.slice(t,0,i-n,{width:e.width})+r}case"middle":{const o=Math.floor(i/2);if(d){const w=u(t,o),g=u(t,s-(i-o)+1,!0);return c.slice(t,0,w)+r+c.slice(t,g,s).trim()}return c.slice(t,0,o,{width:e.width})+r+c.slice(t,s-(i-o)+n,s,{width:e.width})}case"start":{if(d){const o=u(t,s-i+1,!0);return r+c.slice(t,o,s).trim()}return r+c.slice(t,s-i+n,s,{width:e.width})}default:throw new Error(`Invalid position: expected 'start', 'middle' or 'end', got '${l}'`)}},"truncate");exports.truncate=v;
package/dist/truncate.mjs CHANGED
@@ -1 +1 @@
1
- var g=Object.defineProperty;var h=(t,i)=>g(t,"name",{value:i,configurable:!0});import{getStringTruncatedWidth as l}from"./get-string-truncated-width.mjs";import{slice as d}from"./slice.mjs";var b=Object.defineProperty,p=h((t,i)=>b(t,"name",{value:i,configurable:!0}),"h");const u="…",y=3,f=p((t,i,e=!1)=>{if(t.charAt(i)===" ")return i;const r=e?1:-1,a=Math.min(y,e?t.length-i:i);for(let c=1;c<=a;c++){const n=i+c*r;if(t.charAt(n)===" ")return n}return i},"findNearestSpace"),T=p((t,i,e={})=>{if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof t}`);if(typeof i!="number")throw new TypeError(`Expected \`limit\` to be a number, got ${typeof i}`);if(t===""||i<=0)return"";t=t.normalize("NFC");const{ellipsis:r=u,position:a="end",preferTruncationOnSpace:c=!1}=e;let n=e.ellipsisWidth??r===u?1:void 0;if(n===void 0&&(n=l(r,{...e.width,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width),i===1&&n===1)return r;if(i===1)return"";const{width:o}=l(t,{...e.width,ellipsis:r,ellipsisWidth:n});if(o<=i)return t;switch(a){case"start":{if(c){const s=f(t,o-i+1,!0);return r+d(t,s,o).trim()}return r+d(t,o-i+n,o,{width:e.width})}case"middle":{const s=Math.floor(i/2);if(c){const w=f(t,s),m=f(t,o-(i-s)+1,!0);return d(t,0,w)+r+d(t,m,o).trim()}return d(t,0,s,{width:e.width})+r+d(t,o-(i-s)+n,o,{width:e.width})}case"end":{if(c){const s=f(t,i-1);return d(t,0,s,{width:e.width})+r}return d(t,0,i-n,{width:e.width})+r}default:throw new Error(`Invalid position: expected 'start', 'middle' or 'end', got '${a}'`)}},"truncate");export{T as truncate};
1
+ var g=Object.defineProperty;var h=(t,i)=>g(t,"name",{value:i,configurable:!0});import{getStringTruncatedWidth as l}from"./get-string-truncated-width.mjs";import{slice as d}from"./slice.mjs";var b=Object.defineProperty,p=h((t,i)=>b(t,"name",{value:i,configurable:!0}),"h");const u="…",y=3,f=p((t,i,e=!1)=>{if(t.charAt(i)===" ")return i;const r=e?1:-1,a=Math.min(y,e?t.length-i:i);for(let c=1;c<=a;c++){const n=i+c*r;if(t.charAt(n)===" ")return n}return i},"findNearestSpace"),T=p((t,i,e={})=>{if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof t}`);if(typeof i!="number")throw new TypeError(`Expected \`limit\` to be a number, got ${typeof i}`);if(t===""||i<=0)return"";t=t.normalize("NFC");const{ellipsis:r=u,position:a="end",preferTruncationOnSpace:c=!1}=e;let n=e.ellipsisWidth??r===u?1:void 0;if(n===void 0&&(n=l(r,{...e.width,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width),i===1&&n===1)return r;if(i===1)return"";const{width:o}=l(t,{...e.width,ellipsis:r,ellipsisWidth:n});if(o<=i)return t;switch(a){case"end":{if(c){const s=f(t,i-1);return d(t,0,s,{width:e.width})+r}return d(t,0,i-n,{width:e.width})+r}case"middle":{const s=Math.floor(i/2);if(c){const w=f(t,s),m=f(t,o-(i-s)+1,!0);return d(t,0,w)+r+d(t,m,o).trim()}return d(t,0,s,{width:e.width})+r+d(t,o-(i-s)+n,o,{width:e.width})}case"start":{if(c){const s=f(t,o-i+1,!0);return r+d(t,s,o).trim()}return r+d(t,o-i+n,o,{width:e.width})}default:throw new Error(`Invalid position: expected 'start', 'middle' or 'end', got '${a}'`)}},"truncate");export{T as truncate};
@@ -0,0 +1 @@
1
+ "use strict";var o=Object.defineProperty;var c=(u,n)=>o(u,"name",{value:n,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("./packem_shared/LRUCache-TYqfUYE5.cjs");var g=Object.defineProperty,r=c((u,n)=>g(u,"name",{value:n,configurable:!0}),"n");const p=r(u=>u.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),"escapeRegExp"),C=r((u,n)=>n.some(t=>u>=t[0]&&u<=t[1]),"inRange"),E=r(u=>/[\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u3005\u3007\u3021-\u3029\u3038-\u303B\u3400-\u4DBF\u4E00-\u9FFC\uF900-\uFA6D\uFA70-\uFAD9]|\uD81B[\uDFF0\uDFF1]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]/.test(u),"hasChinese"),f=r(u=>/[\p{P}\p{Z}]/u.test(u),"hasPunctuationOrSpace"),l=r((u,n)=>{const t=[];if(!Array.isArray(n))return t;if(n.forEach(e=>{if(typeof e!="string"||e.length===0)return;let a=0,F;for(;(F=u.indexOf(e,a))>-1;){const i=F+e.length-1;t.push([F,i]),a=F+1}}),t.length===0)return[];t.sort((e,a)=>e[0]-a[0]);const s=[];let D;for(const e of t)D===void 0?D=[...e]:e[0]<=D[1]+1?D[1]=Math.max(D[1],e[1]):(s.push(D),D=[...e]);return D!==void 0&&s.push(D),s},"findStringOccurrences");exports.LRUCache=h;exports.escapeRegExp=p;exports.findStringOccurrences=l;exports.hasChinese=E;exports.hasPunctuationOrSpace=f;exports.inRange=C;
@@ -1,4 +1,4 @@
1
- import { k as IntervalArray } from './packem_shared/types-BSdIWVzn.cjs';
1
+ import { l as IntervalArray } from './packem_shared/types-Daae0hGf.cjs';
2
2
  export { L as LRUCache } from './packem_shared/lru-cache-B_t27XwI.cjs';
3
3
 
4
4
  declare const escapeRegExp: (char: string) => string;
@@ -1,4 +1,4 @@
1
- import { k as IntervalArray } from './packem_shared/types-BSdIWVzn.mjs';
1
+ import { l as IntervalArray } from './packem_shared/types-Daae0hGf.mjs';
2
2
  export { L as LRUCache } from './packem_shared/lru-cache-B_t27XwI.mjs';
3
3
 
4
4
  declare const escapeRegExp: (char: string) => string;
@@ -1,4 +1,4 @@
1
- import { k as IntervalArray } from './packem_shared/types-BSdIWVzn.js';
1
+ import { l as IntervalArray } from './packem_shared/types-Daae0hGf.js';
2
2
  export { L as LRUCache } from './packem_shared/lru-cache-B_t27XwI.js';
3
3
 
4
4
  declare const escapeRegExp: (char: string) => string;
@@ -0,0 +1 @@
1
+ var o=Object.defineProperty;var c=(u,t)=>o(u,"name",{value:t,configurable:!0});import{default as x}from"./packem_shared/LRUCache-Bjo6gsbC.mjs";var p=Object.defineProperty,n=c((u,t)=>p(u,"name",{value:t,configurable:!0}),"n");const h=n(u=>u.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),"escapeRegExp"),C=n((u,t)=>t.some(F=>u>=F[0]&&u<=F[1]),"inRange"),E=n(u=>/[\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u3005\u3007\u3021-\u3029\u3038-\u303B\u3400-\u4DBF\u4E00-\u9FFC\uF900-\uFA6D\uFA70-\uFAD9]|\uD81B[\uDFF0\uDFF1]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]/.test(u),"hasChinese"),g=n(u=>/[\p{P}\p{Z}]/u.test(u),"hasPunctuationOrSpace"),l=n((u,t)=>{const F=[];if(!Array.isArray(t))return F;if(t.forEach(D=>{if(typeof D!="string"||D.length===0)return;let r=0,a;for(;(a=u.indexOf(D,r))>-1;){const i=a+D.length-1;F.push([a,i]),r=a+1}}),F.length===0)return[];F.sort((D,r)=>D[0]-r[0]);const s=[];let e;for(const D of F)e===void 0?e=[...D]:D[0]<=e[1]+1?e[1]=Math.max(e[1],D[1]):(s.push(e),e=[...D]);return e!==void 0&&s.push(e),s},"findStringOccurrences");export{x as LRUCache,h as escapeRegExp,l as findStringOccurrences,E as hasChinese,g as hasPunctuationOrSpace,C as inRange};
@@ -0,0 +1 @@
1
+ "use strict";var d=Object.defineProperty;var n=(o,r)=>d(o,"name",{value:r,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("./packem_shared/closest-DGumBGH9.cjs");var m=Object.defineProperty,S=n((o,r)=>m(o,"name",{value:r,configurable:!0}),"s");const g=S((o,r,s)=>{const{caseSensitive:i=!1,compareFunction:c=u.distance}=s??{},l=i?o:o.toLowerCase(),a=r.map(e=>{const t=i?e:e.toLowerCase();return{distance:c(l,t),originalWord:e}});return a.sort((e,t)=>e.distance!==t.distance?e.distance-t.distance:e.originalWord.localeCompare(t.originalWord)),a.map(e=>e.originalWord)},"wordSimilaritySort");exports.wordSimilaritySort=g;
@@ -0,0 +1,8 @@
1
+ interface WordSimilaritySortOptions {
2
+ caseSensitive?: boolean;
3
+ compareFunction?: (a: string, b: string) => number;
4
+ }
5
+ declare const wordSimilaritySort: (givenWord: string, possibleWords: ReadonlyArray<string>, options?: WordSimilaritySortOptions) => string[];
6
+
7
+ export { wordSimilaritySort };
8
+ export type { WordSimilaritySortOptions };
@@ -0,0 +1,8 @@
1
+ interface WordSimilaritySortOptions {
2
+ caseSensitive?: boolean;
3
+ compareFunction?: (a: string, b: string) => number;
4
+ }
5
+ declare const wordSimilaritySort: (givenWord: string, possibleWords: ReadonlyArray<string>, options?: WordSimilaritySortOptions) => string[];
6
+
7
+ export { wordSimilaritySort };
8
+ export type { WordSimilaritySortOptions };
@@ -0,0 +1,8 @@
1
+ interface WordSimilaritySortOptions {
2
+ caseSensitive?: boolean;
3
+ compareFunction?: (a: string, b: string) => number;
4
+ }
5
+ declare const wordSimilaritySort: (givenWord: string, possibleWords: ReadonlyArray<string>, options?: WordSimilaritySortOptions) => string[];
6
+
7
+ export { wordSimilaritySort };
8
+ export type { WordSimilaritySortOptions };
@@ -0,0 +1 @@
1
+ var l=Object.defineProperty;var n=(e,r)=>l(e,"name",{value:r,configurable:!0});import{distance as m}from"./packem_shared/closest-uarbVSbs.mjs";var p=Object.defineProperty,u=n((e,r)=>p(e,"name",{value:r,configurable:!0}),"s");const f=u((e,r,s)=>{const{caseSensitive:i=!1,compareFunction:c=m}=s??{},d=i?e:e.toLowerCase(),t=r.map(o=>{const a=i?o:o.toLowerCase();return{distance:c(d,a),originalWord:o}});return t.sort((o,a)=>o.distance!==a.distance?o.distance-a.distance:o.originalWord.localeCompare(a.originalWord)),t.map(o=>o.originalWord)},"wordSimilaritySort");export{f as wordSimilaritySort};
@@ -1,8 +1,8 @@
1
- "use strict";var O=Object.defineProperty;var m=(t,e)=>O(t,"name",{value:e,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("./packem_shared/constants-D3K8u3G8.cjs"),S=require("./get-string-width.cjs");var T=Object.defineProperty,_=m((t,e)=>T(t,"name",{value:e,configurable:!0}),"n");let R=class{static{m(this,"m")}static{_(this,"AnsiStateTracker")}activeForeground=null;activeBackground=null;activeFormatting=[];processEscape(e){const i=/\x1B\[(\d+)m/.exec(e);if(!i)return;const r=Number.parseInt(i[1],10);switch(r){case 0:{this.activeForeground=null,this.activeBackground=null,this.activeFormatting=[];break}case 39:{this.activeForeground=null;break}case 49:{this.activeBackground=null;break}default:if(r>=30&&r<=37||r>=90&&r<=97)this.activeForeground=e;else if(r>=40&&r<=47||r>=100&&r<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(r))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(r)){const l={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[r];l&&(this.activeFormatting=this.activeFormatting.filter(a=>!a.includes(l)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const i={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].reverse().forEach(r=>{const l=i[r];l&&e.push(l)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}};var $=Object.defineProperty,w=m((t,e)=>$(t,"name",{value:e,configurable:!0}),"o");const F=w((t,e)=>{if(!f.O.has(t[e]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const i=!0,r=t.slice(e+1,e+1+f.P.length).join("")===f.P;return{isInsideEscape:i,isInsideLinkEscape:r}},"checkEscapeSequence"),C=w((t,e={})=>{const i=new R;let r="",l=!1,a=!1,n="",s="",u=!1;const h=[...t];for(let c=0;c<h.length;c++){const o=h[c];if(o&&f.O.has(o)){if(r){const p=e.getWidth?.(r)??0,E={isEscapeSequence:!1,isGrapheme:!0,text:r,width:p};if(u&&(E.isHyperlink=!0,E.hyperlinkUrl=s),e.onSegment?.(E,i)===!1)return;r=""}if(l=!0,n=o,a=F(h,c).isInsideLinkEscape,a){let p=c+1;for(s="";p<h.length;){const k=h[p];if(k===f.S)break;s+=k,p++}s=s.slice(4);const E={hyperlinkUrl:s,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(e.onSegment?.(E,i)===!1)return;c=p,u=!0,l=!1,a=!1,n="";continue}if(c+1<h.length&&h[c+1]==="\\"&&u){const p={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(e.onSegment?.(p,i)===!1)return;u=!1,s="",c++,l=!1,n="";continue}}if(l){if(n!==o&&(n+=o),o===f.Q){l=!1,i.processEscape(n);const p={isEscapeSequence:!0,isGrapheme:!1,text:n,width:0};if(e.onSegment?.(p,i)===!1)return;n=""}continue}r+=o;const g=e.getWidth?.(r)??0,d={isEscapeSequence:!1,isGrapheme:!0,text:r,width:g};if(u&&(d.isHyperlink=!0,d.hyperlinkUrl=s),e.onSegment?.(d,i)===!1)return;r=""}if(r){const c=e.getWidth?.(r)??0,o={isEscapeSequence:!1,isGrapheme:!0,text:r,width:c};u&&(o.isHyperlink=!0,o.hyperlinkUrl=s),e.onSegment?.(o,i)}if(n){const c={isEscapeSequence:!0,isGrapheme:!1,text:n,width:0};e.onSegment?.(c,i)}},"processAnsiString");var H=Object.defineProperty,j=m((t,e)=>H(t,"name",{value:e,configurable:!0}),"t$1");const b=j(t=>`${f.O.values().next().value}${f.T}${t}${f.Q}`,"wrapAnsiCode");var I=Object.defineProperty,P=m((t,e)=>I(t,"name",{value:e,configurable:!0}),"t");const W=P(t=>`${f.O.values().next().value}${f.P}${t}${f.S}`,"wrapAnsiHyperlink");var q=Object.defineProperty,D=m((t,e)=>q(t,"name",{value:e,configurable:!0}),"l");const G=D(t=>{if(t.length===0)return"";if(t.length===1)return t[0];let e="",i,r;const l=t.join(`
1
+ "use strict";var O=Object.defineProperty;var m=(t,e)=>O(t,"name",{value:e,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("./packem_shared/constants-DEcMFLn8.cjs"),S=require("./get-string-width.cjs");var T=Object.defineProperty,_=m((t,e)=>T(t,"name",{value:e,configurable:!0}),"n");class R{static{m(this,"u")}static{_(this,"AnsiStateTracker")}activeForeground=null;activeBackground=null;activeFormatting=[];processEscape(e){const i=/\x1B\[(\d+)m/.exec(e);if(!i)return;const r=Number.parseInt(i[1],10);switch(r){case 0:{this.activeForeground=null,this.activeBackground=null,this.activeFormatting=[];break}case 39:{this.activeForeground=null;break}case 49:{this.activeBackground=null;break}default:if(r>=30&&r<=37||r>=90&&r<=97)this.activeForeground=e;else if(r>=40&&r<=47||r>=100&&r<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(r))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(r)){const l={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[r];l&&(this.activeFormatting=this.activeFormatting.filter(a=>!a.includes(l)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const i={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].reverse().forEach(r=>{const l=i[r];l&&e.push(l)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}}var $=Object.defineProperty,w=m((t,e)=>$(t,"name",{value:e,configurable:!0}),"o");const F=w((t,e)=>{if(!f.O.has(t[e]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const i=!0,r=t.slice(e+1,e+1+f.S.length).join("")===f.S;return{isInsideEscape:i,isInsideLinkEscape:r}},"checkEscapeSequence"),C=w((t,e={})=>{const i=new R;let r="",l=!1,a=!1,n="",s="",u=!1;const h=[...t];for(let c=0;c<h.length;c++){const o=h[c];if(o&&f.O.has(o)){if(r){const p=e.getWidth?.(r)??0,E={isEscapeSequence:!1,isGrapheme:!0,text:r,width:p};if(u&&(E.isHyperlink=!0,E.hyperlinkUrl=s),e.onSegment?.(E,i)===!1)return;r=""}if(l=!0,n=o,a=F(h,c).isInsideLinkEscape,a){let p=c+1;for(s="";p<h.length;){const k=h[p];if(k===f.Q)break;s+=k,p+=1}s=s.slice(4);const E={hyperlinkUrl:s,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(e.onSegment?.(E,i)===!1)return;c=p,u=!0,l=!1,a=!1,n="";continue}if(c+1<h.length&&h[c+1]==="\\"&&u){const p={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(e.onSegment?.(p,i)===!1)return;u=!1,s="",c+=1,l=!1,n="";continue}}if(l){if(n!==o&&(n+=o),o===f.P){l=!1,i.processEscape(n);const p={isEscapeSequence:!0,isGrapheme:!1,text:n,width:0};if(e.onSegment?.(p,i)===!1)return;n=""}continue}r+=o;const g=e.getWidth?.(r)??0,d={isEscapeSequence:!1,isGrapheme:!0,text:r,width:g};if(u&&(d.isHyperlink=!0,d.hyperlinkUrl=s),e.onSegment?.(d,i)===!1)return;r=""}if(r){const c=e.getWidth?.(r)??0,o={isEscapeSequence:!1,isGrapheme:!0,text:r,width:c};u&&(o.isHyperlink=!0,o.hyperlinkUrl=s),e.onSegment?.(o,i)}if(n){const c={isEscapeSequence:!0,isGrapheme:!1,text:n,width:0};e.onSegment?.(c,i)}},"processAnsiString");var H=Object.defineProperty,j=m((t,e)=>H(t,"name",{value:e,configurable:!0}),"t$1");const b=j(t=>`${f.O.values().next().value}${f.T}${t}${f.P}`,"wrapAnsiCode");var I=Object.defineProperty,P=m((t,e)=>I(t,"name",{value:e,configurable:!0}),"t");const W=P(t=>`${f.O.values().next().value}${f.S}${t}${f.Q}`,"wrapAnsiHyperlink");var q=Object.defineProperty,D=m((t,e)=>q(t,"name",{value:e,configurable:!0}),"l");const G=D(t=>{if(t.length===0)return"";if(t.length===1)return t[0];let e="",i,r;const l=t.join(`
2
2
  `),a=[...l];let n=0;for(const[s,u]of a.entries()){if(e+=u,f.O.has(u)){const c=f.U.exec(l.slice(n))?.groups??{};if(c.code!==void 0){const o=Number.parseFloat(c.code);i=o===f.W?void 0:o}else c.uri!==void 0&&(r=c.uri.length===0?void 0:c.uri)}const h=f.V.get(Number(i));a[s+1]===`
3
3
  `?(r&&(e+=W("")),i&&h&&(e+=b(h))):u===`
4
- `&&(i&&h&&(e+=b(i)),r&&(e+=W(r))),n+=u.length}return e},"preserveAnsi");var K=Object.defineProperty,v=m((t,e)=>K(t,"name",{value:e,configurable:!0}),"h");const x=v(t=>{if(!t.includes("\x1B"))return t;let e=t;return t.includes("\x1B[30m")&&(e+="\x1B[39m"),t.includes("\x1B[42m")&&(e+="\x1B[49m"),e},"resetAnsiAtLineBreak"),A=v(t=>{const e=t.split(" ");let i=e.length;for(;i>0&&S.getStringWidth(e[i-1])===0;)i--;return i===e.length?t:e.slice(0,i).join(" ")+e.slice(i).join("")},"stringVisibleTrimSpacesRight"),y=v((t,e,i)=>{if(t.length===0)return[""];if(e<=0)return[t];const r=[],l=new R;let a="",n=0,s=!1,u=!1,h="";for(let c=0;c<t.length;c++){const o=t[c];if(f.O.has(o)){s=!0,h=o,a+=o,u=F([...t],c).isInsideLinkEscape;continue}if(s){h+=o,a+=o,u?o===f.S&&(s=u=!1):o===f.Q&&(s=!1,l.processEscape(h));continue}const g=S.getStringWidth(o),d=o===" ";if(g===0){a+=o;continue}if(n+g>e&&(a&&r.push(a+l.getEndEscapesForAllActiveAttributes()),a=l.getStartEscapesForAllActiveAttributes(),n=S.getStringWidth(a),d&&i)){for(;c<t.length&&t[c]===" "&&(c++,!(c>=t.length)););c<t.length&&c--;continue}if(a+=o,n+=g,n===e&&c<t.length-1&&(r.push(a+l.getEndEscapesForAllActiveAttributes()),a=l.getStartEscapesForAllActiveAttributes(),n=S.getStringWidth(a),c+1<t.length&&t[c+1]===" "&&i)){for(c++;c<t.length&&t[c]===" ";)c++;c--}}return a&&r.push(a+l.getEndEscapesForAllActiveAttributes()),i?r.map(c=>A(c)):r},"wrapWithBreakAtWidth"),L=v((t,e,i)=>{if(t.length===0)return[];const r=i?t.trim():t;if(r.length===0)return[];const l=[];let a="",n=0;return C(r,{getWidth:S.getStringWidth,onSegment:v((s,u)=>{if(s.isEscapeSequence)a+=s.text;else{const h=s.text===" ";if(s.width===0)return a+=s.text,!0;if(n+s.width>e&&(a&&l.push(a),a=u.getStartEscapesForAllActiveAttributes(),n=0,h))return i||l.push(u.getStartEscapesForAllActiveAttributes()+s.text),!0;a+=s.text,n+=s.width}return!0},"onSegment")}),a&&l.push(a),i?l.map(s=>A(s)):l},"wrapCharByChar"),M=v((t,e,i)=>{if(t.length===0)return[];const r=i?t.trim():t;if(r.length===0)return[];const l=r.split(/(?=\s)|(?<=\s)/),a=[];let n="",s=0,u=0;for(;u<l.length;){const h=l[u],c=/^\s+$/.test(h),o=S.getStringWidth(h);if(h.length===0){u++;continue}if(i&&c&&s===0){u++;continue}if(s+o>e&&s>0){i?a.push(A(n)):a.push(n),n="",s=0;continue}n+=h,s+=o,u++}return n&&(i?a.push(A(n)):a.push(n)),a},"wrapWithWordBoundaries"),U=v((t,e,i)=>{if(t.length===0)return[];const r=i?t.trim():t;if(r.length===0)return[];const l=r.split(/(?=\s)|(?<=\s)/),a=[];let n="",s=0,u=0;for(;u<l.length;){const h=l[u],c=/^\s+$/.test(h),o=S.getStringWidth(h);if(h.length===0){u++;continue}if(i&&c&&s===0){u++;continue}if(o>e){n&&a.push(x(i?A(n):n));const g=y(h,e,i);if(g.length>0){for(let d=0;d<g.length-1;d++)a.push(g[d]);n=g[g.length-1],s=S.getStringWidth(n)}else n="",s=0;u++;continue}if(s+o>e&&s>0&&(a.push(x(i?A(n):n)),n="",s=0,i&&c)){u++;continue}n+=h,s+=o,u++}return n&&a.push(x(i?A(n):n)),a},"wrapAndBreakWords"),B={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH",BREAK_WORDS:"BREAK_WORDS"},V=v((t,e={})=>{const{removeZeroWidthCharacters:i=!0,trim:r=!0,width:l=80,wrapMode:a=B.PRESERVE_WORDS}=e;if(r&&t.trim()==="")return"";let n=String(t).normalize("NFC").replaceAll(`\r
4
+ `&&(i&&h&&(e+=b(i)),r&&(e+=W(r))),n+=u.length}return e},"preserveAnsi");var K=Object.defineProperty,v=m((t,e)=>K(t,"name",{value:e,configurable:!0}),"h");const x=v(t=>{if(!t.includes("\x1B"))return t;let e=t;return t.includes("\x1B[30m")&&(e+="\x1B[39m"),t.includes("\x1B[42m")&&(e+="\x1B[49m"),e},"resetAnsiAtLineBreak"),A=v(t=>{const e=t.split(" ");let i=e.length;for(;i>0&&S.getStringWidth(e[i-1])===0;)i--;return i===e.length?t:e.slice(0,i).join(" ")+e.slice(i).join("")},"stringVisibleTrimSpacesRight"),y=v((t,e,i)=>{if(t.length===0)return[""];if(e<=0)return[t];const r=[],l=new R;let a="",n=0,s=!1,u=!1,h="";for(let c=0;c<t.length;c++){const o=t[c];if(f.O.has(o)){s=!0,h=o,a+=o,u=F([...t],c).isInsideLinkEscape;continue}if(s){h+=o,a+=o,u?o===f.Q&&(s=u=!1):o===f.P&&(s=!1,l.processEscape(h));continue}const g=S.getStringWidth(o),d=o===" ";if(g===0){a+=o;continue}if(n+g>e&&(a&&r.push(a+l.getEndEscapesForAllActiveAttributes()),a=l.getStartEscapesForAllActiveAttributes(),n=S.getStringWidth(a),d&&i)){for(;c<t.length&&t[c]===" "&&(c+=1,!(c>=t.length)););c<t.length&&c--;continue}if(a+=o,n+=g,n===e&&c<t.length-1&&(r.push(a+l.getEndEscapesForAllActiveAttributes()),a=l.getStartEscapesForAllActiveAttributes(),n=S.getStringWidth(a),c+1<t.length&&t[c+1]===" "&&i)){for(c+=1;c<t.length&&t[c]===" ";)c+=1;c--}}return a&&r.push(a+l.getEndEscapesForAllActiveAttributes()),i?r.map(c=>A(c)):r},"wrapWithBreakAtWidth"),L=v((t,e,i)=>{if(t.length===0)return[];const r=i?t.trim():t;if(r.length===0)return[];const l=[];let a="",n=0;return C(r,{getWidth:S.getStringWidth,onSegment:v((s,u)=>{if(s.isEscapeSequence)a+=s.text;else{const h=s.text===" ";if(s.width===0)return a+=s.text,!0;if(n+s.width>e&&(a&&l.push(a),a=u.getStartEscapesForAllActiveAttributes(),n=0,h))return i||l.push(u.getStartEscapesForAllActiveAttributes()+s.text),!0;a+=s.text,n+=s.width}return!0},"onSegment")}),a&&l.push(a),i?l.map(s=>A(s)):l},"wrapCharByChar"),M=v((t,e,i)=>{if(t.length===0)return[];const r=i?t.trim():t;if(r.length===0)return[];const l=r.split(/(?=\s)|(?<=\s)/),a=[];let n="",s=0,u=0;for(;u<l.length;){const h=l[u],c=/^\s+$/.test(h),o=S.getStringWidth(h);if(h.length===0){u+=1;continue}if(i&&c&&s===0){u+=1;continue}if(s+o>e&&s>0){i?a.push(A(n)):a.push(n),n="",s=0;continue}n+=h,s+=o,u+=1}return n&&(i?a.push(A(n)):a.push(n)),a},"wrapWithWordBoundaries"),U=v((t,e,i)=>{if(t.length===0)return[];const r=i?t.trim():t;if(r.length===0)return[];const l=r.split(/(?=\s)|(?<=\s)/),a=[];let n="",s=0,u=0;for(;u<l.length;){const h=l[u],c=/^\s+$/.test(h),o=S.getStringWidth(h);if(h.length===0){u+=1;continue}if(i&&c&&s===0){u+=1;continue}if(o>e){n&&a.push(x(i?A(n):n));const g=y(h,e,i);if(g.length>0){for(let d=0;d<g.length-1;d++)a.push(g[d]);n=g[g.length-1],s=S.getStringWidth(n)}else n="",s=0;u+=1;continue}if(s+o>e&&s>0&&(a.push(x(i?A(n):n)),n="",s=0,i&&c)){u+=1;continue}n+=h,s+=o,u+=1}return n&&a.push(x(i?A(n):n)),a},"wrapAndBreakWords"),B={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},V=v((t,e={})=>{const{removeZeroWidthCharacters:i=!0,trim:r=!0,width:l=80,wrapMode:a=B.PRESERVE_WORDS}=e;if(r&&t.trim()==="")return"";let n=String(t).normalize("NFC").replaceAll(`\r
5
5
  `,`
6
6
  `);return i&&(n=n.replaceAll(f.X,"")),n.split(`
7
- `).map(s=>{if(r&&s.trim()==="")return"";let u;switch(a){case B.STRICT_WIDTH:{u=y(s,l,r);break}case B.BREAK_AT_CHARACTERS:{u=L(s,l,r);break}case B.BREAK_WORDS:{u=U(s,l,r);break}default:u=M(s,l,r)}return G(u)}).join(`
7
+ `).map(s=>{if(r&&s.trim()==="")return"";let u;switch(a){case B.BREAK_AT_CHARACTERS:{u=L(s,l,r);break}case B.BREAK_WORDS:{u=U(s,l,r);break}case B.STRICT_WIDTH:{u=y(s,l,r);break}default:u=M(s,l,r)}return G(u)}).join(`
8
8
  `)},"wordWrap");exports.WrapMode=B;exports.wordWrap=V;
@@ -1,8 +1,8 @@
1
1
  declare const WrapMode: {
2
2
  readonly BREAK_AT_CHARACTERS: "BREAK_AT_CHARACTERS";
3
+ readonly BREAK_WORDS: "BREAK_WORDS";
3
4
  readonly PRESERVE_WORDS: "PRESERVE_WORDS";
4
5
  readonly STRICT_WIDTH: "STRICT_WIDTH";
5
- readonly BREAK_WORDS: "BREAK_WORDS";
6
6
  };
7
7
  interface WordWrapOptions {
8
8
  removeZeroWidthCharacters?: boolean;
@@ -1,8 +1,8 @@
1
1
  declare const WrapMode: {
2
2
  readonly BREAK_AT_CHARACTERS: "BREAK_AT_CHARACTERS";
3
+ readonly BREAK_WORDS: "BREAK_WORDS";
3
4
  readonly PRESERVE_WORDS: "PRESERVE_WORDS";
4
5
  readonly STRICT_WIDTH: "STRICT_WIDTH";
5
- readonly BREAK_WORDS: "BREAK_WORDS";
6
6
  };
7
7
  interface WordWrapOptions {
8
8
  removeZeroWidthCharacters?: boolean;
@@ -1,8 +1,8 @@
1
1
  declare const WrapMode: {
2
2
  readonly BREAK_AT_CHARACTERS: "BREAK_AT_CHARACTERS";
3
+ readonly BREAK_WORDS: "BREAK_WORDS";
3
4
  readonly PRESERVE_WORDS: "PRESERVE_WORDS";
4
5
  readonly STRICT_WIDTH: "STRICT_WIDTH";
5
- readonly BREAK_WORDS: "BREAK_WORDS";
6
6
  };
7
7
  interface WordWrapOptions {
8
8
  removeZeroWidthCharacters?: boolean;
@@ -1,8 +1,8 @@
1
- var y=Object.defineProperty;var m=(t,e)=>y(t,"name",{value:e,configurable:!0});import{O as S,P as R,Q as k,S as b,T as O,U as H,V as $,W as P,X as j}from"./packem_shared/constants-Cd17VNEv.mjs";import{getStringWidth as d}from"./get-string-width.mjs";var D=Object.defineProperty,N=m((t,e)=>D(t,"name",{value:e,configurable:!0}),"n");let w=class{static{m(this,"m")}static{N(this,"AnsiStateTracker")}activeForeground=null;activeBackground=null;activeFormatting=[];processEscape(e){const i=/\x1B\[(\d+)m/.exec(e);if(!i)return;const r=Number.parseInt(i[1],10);switch(r){case 0:{this.activeForeground=null,this.activeBackground=null,this.activeFormatting=[];break}case 39:{this.activeForeground=null;break}case 49:{this.activeBackground=null;break}default:if(r>=30&&r<=37||r>=90&&r<=97)this.activeForeground=e;else if(r>=40&&r<=47||r>=100&&r<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(r))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(r)){const l={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[r];l&&(this.activeFormatting=this.activeFormatting.filter(a=>!a.includes(l)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const i={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].reverse().forEach(r=>{const l=i[r];l&&e.push(l)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}};var q=Object.defineProperty,T=m((t,e)=>q(t,"name",{value:e,configurable:!0}),"o");const I=T((t,e)=>{if(!S.has(t[e]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const i=!0,r=t.slice(e+1,e+1+R.length).join("")===R;return{isInsideEscape:i,isInsideLinkEscape:r}},"checkEscapeSequence"),G=T((t,e={})=>{const i=new w;let r="",l=!1,a=!1,n="",s="",u=!1;const h=[...t];for(let c=0;c<h.length;c++){const o=h[c];if(o&&S.has(o)){if(r){const p=e.getWidth?.(r)??0,v={isEscapeSequence:!1,isGrapheme:!0,text:r,width:p};if(u&&(v.isHyperlink=!0,v.hyperlinkUrl=s),e.onSegment?.(v,i)===!1)return;r=""}if(l=!0,n=o,a=I(h,c).isInsideLinkEscape,a){let p=c+1;for(s="";p<h.length;){const _=h[p];if(_===b)break;s+=_,p++}s=s.slice(4);const v={hyperlinkUrl:s,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(e.onSegment?.(v,i)===!1)return;c=p,u=!0,l=!1,a=!1,n="";continue}if(c+1<h.length&&h[c+1]==="\\"&&u){const p={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(e.onSegment?.(p,i)===!1)return;u=!1,s="",c++,l=!1,n="";continue}}if(l){if(n!==o&&(n+=o),o===k){l=!1,i.processEscape(n);const p={isEscapeSequence:!0,isGrapheme:!1,text:n,width:0};if(e.onSegment?.(p,i)===!1)return;n=""}continue}r+=o;const f=e.getWidth?.(r)??0,g={isEscapeSequence:!1,isGrapheme:!0,text:r,width:f};if(u&&(g.isHyperlink=!0,g.hyperlinkUrl=s),e.onSegment?.(g,i)===!1)return;r=""}if(r){const c=e.getWidth?.(r)??0,o={isEscapeSequence:!1,isGrapheme:!0,text:r,width:c};u&&(o.isHyperlink=!0,o.hyperlinkUrl=s),e.onSegment?.(o,i)}if(n){const c={isEscapeSequence:!0,isGrapheme:!1,text:n,width:0};e.onSegment?.(c,i)}},"processAnsiString");var L=Object.defineProperty,K=m((t,e)=>L(t,"name",{value:e,configurable:!0}),"t$1");const F=K(t=>`${S.values().next().value}${O}${t}${k}`,"wrapAnsiCode");var U=Object.defineProperty,V=m((t,e)=>U(t,"name",{value:e,configurable:!0}),"t");const W=V(t=>`${S.values().next().value}${R}${t}${b}`,"wrapAnsiHyperlink");var M=Object.defineProperty,Z=m((t,e)=>M(t,"name",{value:e,configurable:!0}),"l");const z=Z(t=>{if(t.length===0)return"";if(t.length===1)return t[0];let e="",i,r;const l=t.join(`
2
- `),a=[...l];let n=0;for(const[s,u]of a.entries()){if(e+=u,S.has(u)){const c=H.exec(l.slice(n))?.groups??{};if(c.code!==void 0){const o=Number.parseFloat(c.code);i=o===P?void 0:o}else c.uri!==void 0&&(r=c.uri.length===0?void 0:c.uri)}const h=$.get(Number(i));a[s+1]===`
3
- `?(r&&(e+=W("")),i&&h&&(e+=F(h))):u===`
4
- `&&(i&&h&&(e+=F(i)),r&&(e+=W(r))),n+=u.length}return e},"preserveAnsi");var Q=Object.defineProperty,E=m((t,e)=>Q(t,"name",{value:e,configurable:!0}),"h");const x=E(t=>{if(!t.includes("\x1B"))return t;let e=t;return t.includes("\x1B[30m")&&(e+="\x1B[39m"),t.includes("\x1B[42m")&&(e+="\x1B[49m"),e},"resetAnsiAtLineBreak"),A=E(t=>{const e=t.split(" ");let i=e.length;for(;i>0&&d(e[i-1])===0;)i--;return i===e.length?t:e.slice(0,i).join(" ")+e.slice(i).join("")},"stringVisibleTrimSpacesRight"),C=E((t,e,i)=>{if(t.length===0)return[""];if(e<=0)return[t];const r=[],l=new w;let a="",n=0,s=!1,u=!1,h="";for(let c=0;c<t.length;c++){const o=t[c];if(S.has(o)){s=!0,h=o,a+=o,u=I([...t],c).isInsideLinkEscape;continue}if(s){h+=o,a+=o,u?o===b&&(s=u=!1):o===k&&(s=!1,l.processEscape(h));continue}const f=d(o),g=o===" ";if(f===0){a+=o;continue}if(n+f>e&&(a&&r.push(a+l.getEndEscapesForAllActiveAttributes()),a=l.getStartEscapesForAllActiveAttributes(),n=d(a),g&&i)){for(;c<t.length&&t[c]===" "&&(c++,!(c>=t.length)););c<t.length&&c--;continue}if(a+=o,n+=f,n===e&&c<t.length-1&&(r.push(a+l.getEndEscapesForAllActiveAttributes()),a=l.getStartEscapesForAllActiveAttributes(),n=d(a),c+1<t.length&&t[c+1]===" "&&i)){for(c++;c<t.length&&t[c]===" ";)c++;c--}}return a&&r.push(a+l.getEndEscapesForAllActiveAttributes()),i?r.map(c=>A(c)):r},"wrapWithBreakAtWidth"),X=E((t,e,i)=>{if(t.length===0)return[];const r=i?t.trim():t;if(r.length===0)return[];const l=[];let a="",n=0;return G(r,{getWidth:d,onSegment:E((s,u)=>{if(s.isEscapeSequence)a+=s.text;else{const h=s.text===" ";if(s.width===0)return a+=s.text,!0;if(n+s.width>e&&(a&&l.push(a),a=u.getStartEscapesForAllActiveAttributes(),n=0,h))return i||l.push(u.getStartEscapesForAllActiveAttributes()+s.text),!0;a+=s.text,n+=s.width}return!0},"onSegment")}),a&&l.push(a),i?l.map(s=>A(s)):l},"wrapCharByChar"),J=E((t,e,i)=>{if(t.length===0)return[];const r=i?t.trim():t;if(r.length===0)return[];const l=r.split(/(?=\s)|(?<=\s)/),a=[];let n="",s=0,u=0;for(;u<l.length;){const h=l[u],c=/^\s+$/.test(h),o=d(h);if(h.length===0){u++;continue}if(i&&c&&s===0){u++;continue}if(s+o>e&&s>0){i?a.push(A(n)):a.push(n),n="",s=0;continue}n+=h,s+=o,u++}return n&&(i?a.push(A(n)):a.push(n)),a},"wrapWithWordBoundaries"),Y=E((t,e,i)=>{if(t.length===0)return[];const r=i?t.trim():t;if(r.length===0)return[];const l=r.split(/(?=\s)|(?<=\s)/),a=[];let n="",s=0,u=0;for(;u<l.length;){const h=l[u],c=/^\s+$/.test(h),o=d(h);if(h.length===0){u++;continue}if(i&&c&&s===0){u++;continue}if(o>e){n&&a.push(x(i?A(n):n));const f=C(h,e,i);if(f.length>0){for(let g=0;g<f.length-1;g++)a.push(f[g]);n=f[f.length-1],s=d(n)}else n="",s=0;u++;continue}if(s+o>e&&s>0&&(a.push(x(i?A(n):n)),n="",s=0,i&&c)){u++;continue}n+=h,s+=o,u++}return n&&a.push(x(i?A(n):n)),a},"wrapAndBreakWords"),B={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH",BREAK_WORDS:"BREAK_WORDS"},ne=E((t,e={})=>{const{removeZeroWidthCharacters:i=!0,trim:r=!0,width:l=80,wrapMode:a=B.PRESERVE_WORDS}=e;if(r&&t.trim()==="")return"";let n=String(t).normalize("NFC").replaceAll(`\r
1
+ var y=Object.defineProperty;var m=(t,e)=>y(t,"name",{value:e,configurable:!0});import{O as S,P as k,Q as b,S as R,T as O,U as H,V as $,W as P,X as j}from"./packem_shared/constants-CDcaCZKC.mjs";import{getStringWidth as d}from"./get-string-width.mjs";var D=Object.defineProperty,N=m((t,e)=>D(t,"name",{value:e,configurable:!0}),"n");class w{static{m(this,"u")}static{N(this,"AnsiStateTracker")}activeForeground=null;activeBackground=null;activeFormatting=[];processEscape(e){const n=/\x1B\[(\d+)m/.exec(e);if(!n)return;const r=Number.parseInt(n[1],10);switch(r){case 0:{this.activeForeground=null,this.activeBackground=null,this.activeFormatting=[];break}case 39:{this.activeForeground=null;break}case 49:{this.activeBackground=null;break}default:if(r>=30&&r<=37||r>=90&&r<=97)this.activeForeground=e;else if(r>=40&&r<=47||r>=100&&r<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(r))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(r)){const l={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[r];l&&(this.activeFormatting=this.activeFormatting.filter(a=>!a.includes(l)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const n={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].reverse().forEach(r=>{const l=n[r];l&&e.push(l)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}}var q=Object.defineProperty,T=m((t,e)=>q(t,"name",{value:e,configurable:!0}),"o");const I=T((t,e)=>{if(!S.has(t[e]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const n=!0,r=t.slice(e+1,e+1+R.length).join("")===R;return{isInsideEscape:n,isInsideLinkEscape:r}},"checkEscapeSequence"),G=T((t,e={})=>{const n=new w;let r="",l=!1,a=!1,i="",s="",u=!1;const h=[...t];for(let c=0;c<h.length;c++){const o=h[c];if(o&&S.has(o)){if(r){const p=e.getWidth?.(r)??0,v={isEscapeSequence:!1,isGrapheme:!0,text:r,width:p};if(u&&(v.isHyperlink=!0,v.hyperlinkUrl=s),e.onSegment?.(v,n)===!1)return;r=""}if(l=!0,i=o,a=I(h,c).isInsideLinkEscape,a){let p=c+1;for(s="";p<h.length;){const _=h[p];if(_===b)break;s+=_,p+=1}s=s.slice(4);const v={hyperlinkUrl:s,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(e.onSegment?.(v,n)===!1)return;c=p,u=!0,l=!1,a=!1,i="";continue}if(c+1<h.length&&h[c+1]==="\\"&&u){const p={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(e.onSegment?.(p,n)===!1)return;u=!1,s="",c+=1,l=!1,i="";continue}}if(l){if(i!==o&&(i+=o),o===k){l=!1,n.processEscape(i);const p={isEscapeSequence:!0,isGrapheme:!1,text:i,width:0};if(e.onSegment?.(p,n)===!1)return;i=""}continue}r+=o;const f=e.getWidth?.(r)??0,g={isEscapeSequence:!1,isGrapheme:!0,text:r,width:f};if(u&&(g.isHyperlink=!0,g.hyperlinkUrl=s),e.onSegment?.(g,n)===!1)return;r=""}if(r){const c=e.getWidth?.(r)??0,o={isEscapeSequence:!1,isGrapheme:!0,text:r,width:c};u&&(o.isHyperlink=!0,o.hyperlinkUrl=s),e.onSegment?.(o,n)}if(i){const c={isEscapeSequence:!0,isGrapheme:!1,text:i,width:0};e.onSegment?.(c,n)}},"processAnsiString");var L=Object.defineProperty,K=m((t,e)=>L(t,"name",{value:e,configurable:!0}),"t$1");const F=K(t=>`${S.values().next().value}${O}${t}${k}`,"wrapAnsiCode");var U=Object.defineProperty,V=m((t,e)=>U(t,"name",{value:e,configurable:!0}),"t");const W=V(t=>`${S.values().next().value}${R}${t}${b}`,"wrapAnsiHyperlink");var M=Object.defineProperty,Z=m((t,e)=>M(t,"name",{value:e,configurable:!0}),"l");const z=Z(t=>{if(t.length===0)return"";if(t.length===1)return t[0];let e="",n,r;const l=t.join(`
2
+ `),a=[...l];let i=0;for(const[s,u]of a.entries()){if(e+=u,S.has(u)){const c=H.exec(l.slice(i))?.groups??{};if(c.code!==void 0){const o=Number.parseFloat(c.code);n=o===P?void 0:o}else c.uri!==void 0&&(r=c.uri.length===0?void 0:c.uri)}const h=$.get(Number(n));a[s+1]===`
3
+ `?(r&&(e+=W("")),n&&h&&(e+=F(h))):u===`
4
+ `&&(n&&h&&(e+=F(n)),r&&(e+=W(r))),i+=u.length}return e},"preserveAnsi");var Q=Object.defineProperty,E=m((t,e)=>Q(t,"name",{value:e,configurable:!0}),"h");const x=E(t=>{if(!t.includes("\x1B"))return t;let e=t;return t.includes("\x1B[30m")&&(e+="\x1B[39m"),t.includes("\x1B[42m")&&(e+="\x1B[49m"),e},"resetAnsiAtLineBreak"),A=E(t=>{const e=t.split(" ");let n=e.length;for(;n>0&&d(e[n-1])===0;)n--;return n===e.length?t:e.slice(0,n).join(" ")+e.slice(n).join("")},"stringVisibleTrimSpacesRight"),C=E((t,e,n)=>{if(t.length===0)return[""];if(e<=0)return[t];const r=[],l=new w;let a="",i=0,s=!1,u=!1,h="";for(let c=0;c<t.length;c++){const o=t[c];if(S.has(o)){s=!0,h=o,a+=o,u=I([...t],c).isInsideLinkEscape;continue}if(s){h+=o,a+=o,u?o===b&&(s=u=!1):o===k&&(s=!1,l.processEscape(h));continue}const f=d(o),g=o===" ";if(f===0){a+=o;continue}if(i+f>e&&(a&&r.push(a+l.getEndEscapesForAllActiveAttributes()),a=l.getStartEscapesForAllActiveAttributes(),i=d(a),g&&n)){for(;c<t.length&&t[c]===" "&&(c+=1,!(c>=t.length)););c<t.length&&c--;continue}if(a+=o,i+=f,i===e&&c<t.length-1&&(r.push(a+l.getEndEscapesForAllActiveAttributes()),a=l.getStartEscapesForAllActiveAttributes(),i=d(a),c+1<t.length&&t[c+1]===" "&&n)){for(c+=1;c<t.length&&t[c]===" ";)c+=1;c--}}return a&&r.push(a+l.getEndEscapesForAllActiveAttributes()),n?r.map(c=>A(c)):r},"wrapWithBreakAtWidth"),X=E((t,e,n)=>{if(t.length===0)return[];const r=n?t.trim():t;if(r.length===0)return[];const l=[];let a="",i=0;return G(r,{getWidth:d,onSegment:E((s,u)=>{if(s.isEscapeSequence)a+=s.text;else{const h=s.text===" ";if(s.width===0)return a+=s.text,!0;if(i+s.width>e&&(a&&l.push(a),a=u.getStartEscapesForAllActiveAttributes(),i=0,h))return n||l.push(u.getStartEscapesForAllActiveAttributes()+s.text),!0;a+=s.text,i+=s.width}return!0},"onSegment")}),a&&l.push(a),n?l.map(s=>A(s)):l},"wrapCharByChar"),J=E((t,e,n)=>{if(t.length===0)return[];const r=n?t.trim():t;if(r.length===0)return[];const l=r.split(/(?=\s)|(?<=\s)/),a=[];let i="",s=0,u=0;for(;u<l.length;){const h=l[u],c=/^\s+$/.test(h),o=d(h);if(h.length===0){u+=1;continue}if(n&&c&&s===0){u+=1;continue}if(s+o>e&&s>0){n?a.push(A(i)):a.push(i),i="",s=0;continue}i+=h,s+=o,u+=1}return i&&(n?a.push(A(i)):a.push(i)),a},"wrapWithWordBoundaries"),Y=E((t,e,n)=>{if(t.length===0)return[];const r=n?t.trim():t;if(r.length===0)return[];const l=r.split(/(?=\s)|(?<=\s)/),a=[];let i="",s=0,u=0;for(;u<l.length;){const h=l[u],c=/^\s+$/.test(h),o=d(h);if(h.length===0){u+=1;continue}if(n&&c&&s===0){u+=1;continue}if(o>e){i&&a.push(x(n?A(i):i));const f=C(h,e,n);if(f.length>0){for(let g=0;g<f.length-1;g++)a.push(f[g]);i=f[f.length-1],s=d(i)}else i="",s=0;u+=1;continue}if(s+o>e&&s>0&&(a.push(x(n?A(i):i)),i="",s=0,n&&c)){u+=1;continue}i+=h,s+=o,u+=1}return i&&a.push(x(n?A(i):i)),a},"wrapAndBreakWords"),B={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},ne=E((t,e={})=>{const{removeZeroWidthCharacters:n=!0,trim:r=!0,width:l=80,wrapMode:a=B.PRESERVE_WORDS}=e;if(r&&t.trim()==="")return"";let i=String(t).normalize("NFC").replaceAll(`\r
5
5
  `,`
6
- `);return i&&(n=n.replaceAll(j,"")),n.split(`
7
- `).map(s=>{if(r&&s.trim()==="")return"";let u;switch(a){case B.STRICT_WIDTH:{u=C(s,l,r);break}case B.BREAK_AT_CHARACTERS:{u=X(s,l,r);break}case B.BREAK_WORDS:{u=Y(s,l,r);break}default:u=J(s,l,r)}return z(u)}).join(`
6
+ `);return n&&(i=i.replaceAll(j,"")),i.split(`
7
+ `).map(s=>{if(r&&s.trim()==="")return"";let u;switch(a){case B.BREAK_AT_CHARACTERS:{u=X(s,l,r);break}case B.BREAK_WORDS:{u=Y(s,l,r);break}case B.STRICT_WIDTH:{u=C(s,l,r);break}default:u=J(s,l,r)}return z(u)}).join(`
8
8
  `)},"wordWrap");export{B as WrapMode,ne as wordWrap};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/string",
3
- "version": "1.4.1",
3
+ "version": "1.5.1",
4
4
  "description": "Functions for manipulating strings.",
5
5
  "keywords": [
6
6
  "visulima",
@@ -245,6 +245,16 @@
245
245
  "default": "./dist/slice.mjs"
246
246
  }
247
247
  },
248
+ "./slugify": {
249
+ "require": {
250
+ "types": "./dist/slugify.d.cts",
251
+ "default": "./dist/slugify.cjs"
252
+ },
253
+ "import": {
254
+ "types": "./dist/slugify.d.mts",
255
+ "default": "./dist/slugify.mjs"
256
+ }
257
+ },
248
258
  "./truncate": {
249
259
  "require": {
250
260
  "types": "./dist/truncate.d.cts",
@@ -387,12 +397,42 @@
387
397
  },
388
398
  "./utils": {
389
399
  "require": {
390
- "types": "./dist/utils.d.cts",
391
- "default": "./dist/utils.cjs"
400
+ "types": "./dist/utilities.d.cts",
401
+ "default": "./dist/utilities.cjs"
402
+ },
403
+ "import": {
404
+ "types": "./dist/utilities.d.mts",
405
+ "default": "./dist/utilities.mjs"
406
+ }
407
+ },
408
+ "./closest-string": {
409
+ "require": {
410
+ "types": "./dist/closest-string.d.cts",
411
+ "default": "./dist/closest-string.cjs"
412
+ },
413
+ "import": {
414
+ "types": "./dist/closest-string.d.mts",
415
+ "default": "./dist/closest-string.mjs"
416
+ }
417
+ },
418
+ "./compare-similarity": {
419
+ "require": {
420
+ "types": "./dist/compare-similarity.d.cts",
421
+ "default": "./dist/compare-similarity.cjs"
422
+ },
423
+ "import": {
424
+ "types": "./dist/compare-similarity.d.mts",
425
+ "default": "./dist/compare-similarity.mjs"
426
+ }
427
+ },
428
+ "./word-similarity-sort": {
429
+ "require": {
430
+ "types": "./dist/word-similarity-sort.d.cts",
431
+ "default": "./dist/word-similarity-sort.cjs"
392
432
  },
393
433
  "import": {
394
- "types": "./dist/utils.d.mts",
395
- "default": "./dist/utils.mjs"
434
+ "types": "./dist/word-similarity-sort.d.mts",
435
+ "default": "./dist/word-similarity-sort.mjs"
396
436
  }
397
437
  },
398
438
  "./package.json": "./package.json"
@@ -454,6 +494,9 @@
454
494
  "slice": [
455
495
  "./dist/slice.d.ts"
456
496
  ],
497
+ "slugify": [
498
+ "./dist/slugify.d.ts"
499
+ ],
457
500
  "truncate": [
458
501
  "./dist/truncate.d.ts"
459
502
  ],
@@ -497,7 +540,16 @@
497
540
  "./dist/test/vitest.d.ts"
498
541
  ],
499
542
  "utils": [
500
- "./dist/utils.d.ts"
543
+ "./dist/utilities.d.ts"
544
+ ],
545
+ "closest-string": [
546
+ "./dist/closest-string.d.ts"
547
+ ],
548
+ "compare-similarity": [
549
+ "./dist/compare-similarity.d.ts"
550
+ ],
551
+ "word-similarity-sort": [
552
+ "./dist/word-similarity-sort.d.ts"
501
553
  ]
502
554
  }
503
555
  },
@@ -1 +0,0 @@
1
- "use strict";var y=Object.defineProperty;var b=(l,c)=>y(l,"name",{value:c,configurable:!0});var S=Object.defineProperty,$=b((l,c)=>S(l,"name",{value:c,configurable:!0}),"A");const A=$(l=>{if(l.length===0)return[];const c=[];let p=[...l[0]];for(let o=1;o<l.length;o++){const g=l[o];g&&g[0]<=p[1]+1?p[1]=Math.max(p[1],g[1]):(c.push(p),p=[...g])}return c.push(p),c},"mergeIntervals"),E=$((l,c,p)=>{if(!l)return"";const o=[];let g=0;for(const e of c){if(!e||e.length<2)continue;const[t,n]=e;if(n!==void 0)try{if(t instanceof RegExp){const a=new RegExp(t.source,`${t.flags.replace("g","")}g`);let s;for(;(s=a.exec(l))!==null;){const i=s.index,u=s[0];u.length===0&&a.lastIndex===s.index&&a.lastIndex++;const I=i+u.length-1,R=n.replaceAll(/\$([\d&$`'])/g,(M,f)=>{if(f==="&")return u;if(f==="$")return"$";if(f==="`")return l.substring(0,i);if(f==="'")return l.substring(i+u.length);const h=Number.parseInt(f,10);return s&&h>0&&h<s.length?s[h]??"":M});o.push({end:I,id:g++,original:u,replacement:R,start:i}),u.length===0&&a.lastIndex===i&&a.lastIndex++}}else if(typeof t=="string"&&t.length>0)for(let a=0;(a=l.indexOf(t,a))!==-1;a++){const s=a,i=t,u=s+i.length-1,I=Object.assign([i],{index:s,input:l}),R=n.replaceAll(/\$(\d+|&|\$)/g,(M,f)=>{if(f==="&")return i;if(f==="$")return"$";const h=Number.parseInt(f,10);return I&&h>0&&h<I.length?I[h]??"":M});o.push({end:u,id:g++,original:i,replacement:R,start:s})}else continue}catch{continue}}o.sort((e,t)=>e.start!==t.start?e.start-t.start:t.end-e.end);const v=[...p].sort((e,t)=>e[0]-t[0]),B=A(v),r=l.split("").map((e,t)=>({appliedMatchId:null,char:e,index:t,insertBeforeReplacement:null,isIgnored:!1,isMatchStart:!1,matchReplacement:null}));for(const e of B)for(let t=e[0];t<=e[1];t++)r[t]&&(r[t].isIgnored=!0);let x="";for(const e of o)if(e.original.length===0&&e.start>=0&&e.start<=r.length){const t=e.start;if(r[t]){const n=r[t];n.isIgnored||(n.insertBeforeReplacement=(n.insertBeforeReplacement??"")+e.replacement)}else t===r.length&&(x+=e.replacement)}for(const e of o){if(e.original.length===0)continue;let t=!0;for(let n=e.start;n<=e.end;n++)if(!r[n]||r[n].isIgnored||r[n].appliedMatchId!==null){t=!1;break}if(t&&e.start>=0&&e.start<r.length){for(let n=e.start;n<=e.end;n++)r[n]&&(r[n].appliedMatchId=e.id);r[e.start]&&(r[e.start].isMatchStart=!0,r[e.start].matchReplacement=e.replacement)}}let m="",d=0;for(;d<r.length;){const e=r[d];if(e.insertBeforeReplacement!==null&&(m+=e.insertBeforeReplacement),e.isMatchStart&&e.appliedMatchId!==null){m+=e.matchReplacement??"";let t=d;for(let n=d+1;n<r.length&&r[n]?.appliedMatchId===e.appliedMatchId;n++)t=n;d=t+1}else e.appliedMatchId===null&&(m+=e.char),d++}return x.length>0&&(m+=x),m},"replaceString");module.exports=E;
@@ -1 +0,0 @@
1
- var y=Object.defineProperty;var b=(l,c)=>y(l,"name",{value:c,configurable:!0});var S=Object.defineProperty,$=b((l,c)=>S(l,"name",{value:c,configurable:!0}),"A");const A=$(l=>{if(l.length===0)return[];const c=[];let p=[...l[0]];for(let o=1;o<l.length;o++){const d=l[o];d&&d[0]<=p[1]+1?p[1]=Math.max(p[1],d[1]):(c.push(p),p=[...d])}return c.push(p),c},"mergeIntervals"),O=$((l,c,p)=>{if(!l)return"";const o=[];let d=0;for(const e of c){if(!e||e.length<2)continue;const[t,n]=e;if(n!==void 0)try{if(t instanceof RegExp){const a=new RegExp(t.source,`${t.flags.replace("g","")}g`);let s;for(;(s=a.exec(l))!==null;){const i=s.index,u=s[0];u.length===0&&a.lastIndex===s.index&&a.lastIndex++;const I=i+u.length-1,R=n.replaceAll(/\$([\d&$`'])/g,(M,f)=>{if(f==="&")return u;if(f==="$")return"$";if(f==="`")return l.substring(0,i);if(f==="'")return l.substring(i+u.length);const g=Number.parseInt(f,10);return s&&g>0&&g<s.length?s[g]??"":M});o.push({end:I,id:d++,original:u,replacement:R,start:i}),u.length===0&&a.lastIndex===i&&a.lastIndex++}}else if(typeof t=="string"&&t.length>0)for(let a=0;(a=l.indexOf(t,a))!==-1;a++){const s=a,i=t,u=s+i.length-1,I=Object.assign([i],{index:s,input:l}),R=n.replaceAll(/\$(\d+|&|\$)/g,(M,f)=>{if(f==="&")return i;if(f==="$")return"$";const g=Number.parseInt(f,10);return I&&g>0&&g<I.length?I[g]??"":M});o.push({end:u,id:d++,original:i,replacement:R,start:s})}else continue}catch{continue}}o.sort((e,t)=>e.start!==t.start?e.start-t.start:t.end-e.end);const v=[...p].sort((e,t)=>e[0]-t[0]),B=A(v),r=l.split("").map((e,t)=>({appliedMatchId:null,char:e,index:t,insertBeforeReplacement:null,isIgnored:!1,isMatchStart:!1,matchReplacement:null}));for(const e of B)for(let t=e[0];t<=e[1];t++)r[t]&&(r[t].isIgnored=!0);let x="";for(const e of o)if(e.original.length===0&&e.start>=0&&e.start<=r.length){const t=e.start;if(r[t]){const n=r[t];n.isIgnored||(n.insertBeforeReplacement=(n.insertBeforeReplacement??"")+e.replacement)}else t===r.length&&(x+=e.replacement)}for(const e of o){if(e.original.length===0)continue;let t=!0;for(let n=e.start;n<=e.end;n++)if(!r[n]||r[n].isIgnored||r[n].appliedMatchId!==null){t=!1;break}if(t&&e.start>=0&&e.start<r.length){for(let n=e.start;n<=e.end;n++)r[n]&&(r[n].appliedMatchId=e.id);r[e.start]&&(r[e.start].isMatchStart=!0,r[e.start].matchReplacement=e.replacement)}}let m="",h=0;for(;h<r.length;){const e=r[h];if(e.insertBeforeReplacement!==null&&(m+=e.insertBeforeReplacement),e.isMatchStart&&e.appliedMatchId!==null){m+=e.matchReplacement??"";let t=h;for(let n=h+1;n<r.length&&r[n]?.appliedMatchId===e.appliedMatchId;n++)t=n;h=t+1}else e.appliedMatchId===null&&(m+=e.char),h++}return x.length>0&&(m+=x),m},"replaceString");export{O as default};
@@ -1 +0,0 @@
1
- var c=Object.defineProperty;var t=(a,o)=>c(a,"name",{value:o,configurable:!0});import u from"./transliterate-BXaP38Sh.mjs";import{escapeRegExp as s}from"../utils.mjs";var i=Object.defineProperty,p=t((a,o)=>i(a,"name",{value:o,configurable:!0}),"o");const f=p((a,o,e)=>{const r=s(o).replaceAll("\\-","-"),l=new RegExp(`[^${r}]`,"g");return a.replaceAll(l,e)},"removeDisallowedChars"),C=p((a,o)=>{const e={allowedChars:"a-zA-Z0-9-_.~",fixChineseSpacing:!0,ignore:[],lowercase:!0,replaceAfter:[],replaceBefore:[],separator:"-",transliterate:!0,trim:!1,unknown:"",uppercase:!1,...o};e.lowercase&&e.uppercase&&(console.warn("slugify: Both lowercase and uppercase options are true. Defaulting to lowercase."),e.uppercase=!1);let r=e.transliterate?u(a,e):a.normalize("NFC");e.lowercase?r=r.toLowerCase():e.uppercase&&(r=r.toUpperCase()),r=f(r,e.allowedChars,e.separator);const l=s(e.separator);if(l){const n=new RegExp(`${l}+`,"g");r=r.replace(n,e.separator)}return l?r.replaceAll(new RegExp(`^${l}+|${l}+$`,"g"),""):r},"slugify");export{C as default};
@@ -1 +0,0 @@
1
- "use strict";var n=Object.defineProperty;var l=(a,s)=>n(a,"name",{value:s,configurable:!0});const u=require("./transliterate-CToQ-aeM.cjs"),o=require("../utils.cjs");var i=Object.defineProperty,p=l((a,s)=>i(a,"name",{value:s,configurable:!0}),"o");const g=p((a,s,e)=>{const r=o.escapeRegExp(s).replaceAll("\\-","-"),t=new RegExp(`[^${r}]`,"g");return a.replaceAll(t,e)},"removeDisallowedChars"),w=p((a,s)=>{const e={allowedChars:"a-zA-Z0-9-_.~",fixChineseSpacing:!0,ignore:[],lowercase:!0,replaceAfter:[],replaceBefore:[],separator:"-",transliterate:!0,trim:!1,unknown:"",uppercase:!1,...s};e.lowercase&&e.uppercase&&(console.warn("slugify: Both lowercase and uppercase options are true. Defaulting to lowercase."),e.uppercase=!1);let r=e.transliterate?u(a,e):a.normalize("NFC");e.lowercase?r=r.toLowerCase():e.uppercase&&(r=r.toUpperCase()),r=g(r,e.allowedChars,e.separator);const t=o.escapeRegExp(e.separator);if(t){const c=new RegExp(`${t}+`,"g");r=r.replace(c,e.separator)}return t?r.replaceAll(new RegExp(`^${t}+|${t}+$`,"g"),""):r},"slugify");module.exports=w;
package/dist/utils.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";var o=Object.defineProperty;var c=(u,n)=>o(u,"name",{value:n,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("./packem_shared/LRUCache-TYqfUYE5.cjs");var h=Object.defineProperty,r=c((u,n)=>h(u,"name",{value:n,configurable:!0}),"e");const p=r(u=>u.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp"),g=r((u,n)=>n.some(t=>u>=t[0]&&u<=t[1]),"inRange"),C=r(u=>/[\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u3005\u3007\u3021-\u3029\u3038-\u303B\u3400-\u4DBF\u4E00-\u9FFC\uF900-\uFA6D\uFA70-\uFAD9]|\uD81B[\uDFF0\uDFF1]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]/.test(u),"hasChinese"),E=r(u=>/[\p{P}\p{Z}]/u.test(u),"hasPunctuationOrSpace"),f=r((u,n)=>{const t=[];if(!Array.isArray(n))return t;if(n.forEach(e=>{if(typeof e!="string"||e.length===0)return;let F=0,a;for(;(a=u.indexOf(e,F))>-1;){const i=a+e.length-1;t.push([a,i]),F=a+1}}),t.length===0)return[];t.sort((e,F)=>e[0]-F[0]);const s=[];let D=null;for(const e of t)D===null?D=[...e]:e[0]<=D[1]+1?D[1]=Math.max(D[1],e[1]):(s.push(D),D=[...e]);return D!==null&&s.push(D),s},"findStringOccurrences");exports.LRUCache=l;exports.escapeRegExp=p;exports.findStringOccurrences=f;exports.hasChinese=C;exports.hasPunctuationOrSpace=E;exports.inRange=g;
package/dist/utils.mjs DELETED
@@ -1 +0,0 @@
1
- var i=Object.defineProperty;var c=(u,F)=>i(u,"name",{value:F,configurable:!0});import{default as O}from"./packem_shared/LRUCache-Bjo6gsbC.mjs";var l=Object.defineProperty,t=c((u,F)=>l(u,"name",{value:F,configurable:!0}),"e");const f=t(u=>u.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp"),h=t((u,F)=>F.some(n=>u>=n[0]&&u<=n[1]),"inRange"),C=t(u=>/[\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u3005\u3007\u3021-\u3029\u3038-\u303B\u3400-\u4DBF\u4E00-\u9FFC\uF900-\uFA6D\uFA70-\uFAD9]|\uD81B[\uDFF0\uDFF1]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]/.test(u),"hasChinese"),E=t(u=>/[\p{P}\p{Z}]/u.test(u),"hasPunctuationOrSpace"),g=t((u,F)=>{const n=[];if(!Array.isArray(F))return n;if(F.forEach(D=>{if(typeof D!="string"||D.length===0)return;let r=0,a;for(;(a=u.indexOf(D,r))>-1;){const o=a+D.length-1;n.push([a,o]),r=a+1}}),n.length===0)return[];n.sort((D,r)=>D[0]-r[0]);const s=[];let e=null;for(const D of n)e===null?e=[...D]:D[0]<=e[1]+1?e[1]=Math.max(e[1],D[1]):(s.push(e),e=[...D]);return e!==null&&s.push(e),s},"findStringOccurrences");export{O as LRUCache,f as escapeRegExp,g as findStringOccurrences,C as hasChinese,E as hasPunctuationOrSpace,h as inRange};