string-convert-indexes 6.2.1 → 6.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,12 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 6.2.2 (2026-08-22)
7
+
8
+ ### Performance Improvements
9
+
10
+ - optimise package hot paths and JSON editing ([f3112bd](https://github.com/codsen/codsen/commit/f3112bd7fc0d7c9bc09312d3744c950691d72ca5))
11
+
6
12
  ## 6.2.0 (2026-08-19)
7
13
 
8
14
  ### Bug Fixes
9
15
 
10
16
  - make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
11
- - resolve review findings REV-004 through REV-007 ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
17
+ - resolve various review findings ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
12
18
  - retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
13
19
  - standardise index conversion errs ([182dee5](https://github.com/codsen/codsen/commit/182dee517593c0705bd43e97fbdbd473be7aa7db))
14
20
 
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @name string-convert-indexes
3
3
  * @fileoverview Convert between native JS string character indexes and grapheme-count-based indexes
4
- * @version 6.2.1
4
+ * @version 6.2.2
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-convert-indexes/}
8
8
  */
9
9
 
10
- import{formatDiagnosticValue as m}from"codsen-utils";import{collectGraphemes as $}from"unicode-segmenter/grapheme";import{traverse as h}from"ast-monkey-traverse";var f="6.2.1";var k=f,v=typeof Intl.Segmenter=="function"?new Intl.Segmenter(void 0,{granularity:"grapheme"}):void 0;function g(i){let r=typeof i;return r==="string"||r==="number"}function y(i,r,n){let c=i==="n"?"nativeToUnicode":"unicodeToNative";function d(e){return!(!g(e)||typeof e=="string"&&!/^\d*$/.test(e)||typeof e=="number"&&(!Number.isInteger(e)||e<0))}function a(e,o){let u=0,t=0;for(let p=0,b=e.length;p<b;p++){if(t+=e[p].length,o>=u&&o<t)return p;u+=e[p].length}throw new Error(`string-convert-indexes/${c}(): [THROW_ID_01] the "indexes" value, ${n}, is not covered by graphemes length!`)}function l(e,o){if(o>=e.length)throw new Error(`string-convert-indexes/${c}(): [THROW_ID_02] the index to convert, ${o}, is not covered by graphemes length!`);return e.slice(0,o).join("").length}if(typeof r!="string"||!r)throw new TypeError(`string-convert-indexes/${c}(): [THROW_ID_03] the first input argument, input string, must be a non-zero-length string! Currently it's: ${typeof r}, equal to:
10
+ import{formatDiagnosticValue as m}from"codsen-utils";import{collectGraphemes as $}from"unicode-segmenter/grapheme";import{traverse as h}from"ast-monkey-traverse";var f="6.2.2";var k=f,v=typeof Intl.Segmenter=="function"?new Intl.Segmenter(void 0,{granularity:"grapheme"}):void 0;function g(i){let r=typeof i;return r==="string"||r==="number"}function y(i,r,n){let c=i==="n"?"nativeToUnicode":"unicodeToNative";function d(e){return!(!g(e)||typeof e=="string"&&!/^\d*$/.test(e)||typeof e=="number"&&(!Number.isInteger(e)||e<0))}function a(e,o){let u=0,t=0;for(let p=0,b=e.length;p<b;p++){if(t+=e[p].length,o>=u&&o<t)return p;u+=e[p].length}throw new Error(`string-convert-indexes/${c}(): [THROW_ID_01] the "indexes" value, ${n}, is not covered by graphemes length!`)}function l(e,o){if(o>=e.length)throw new Error(`string-convert-indexes/${c}(): [THROW_ID_02] the index to convert, ${o}, is not covered by graphemes length!`);return e.slice(0,o).join("").length}if(typeof r!="string"||!r)throw new TypeError(`string-convert-indexes/${c}(): [THROW_ID_03] the first input argument, input string, must be a non-zero-length string! Currently it's: ${typeof r}, equal to:
11
11
  ${r}`);if(n===0)return 0;if(n==="0")return"0";let s=v?Array.from(v.segment(r),({segment:e})=>e):$(r);if(g(n)){if(d(n))return i==="u"?typeof n=="string"?String(l(s,+n)):l(s,+n):typeof n=="string"?String(a(s,+n)):a(s,+n);throw new Error(`string-convert-indexes/${c}(): [THROW_ID_04] the second input argument, "indexes" is not suitable to describe string index - it was given as ${m(n,4)} (${typeof n})`)}else{if(n&&typeof n=="object")return i==="u"?h(n,(e,o,u)=>{let t=o!==void 0?o:e;if(g(t)){if(d(t))return typeof t=="string"?String(l(s,+t)):l(s,+t);throw new Error(`string-convert-indexes/${c}(): [THROW_ID_05] bad value was encountered, ${m(t,4)}, its path is ${u.path}`)}return t}):h(n,(e,o,u)=>{let t=o!==void 0?o:e;if(g(t)){if(d(t))return typeof t=="string"?String(a(s,+t)):a(s,+t);throw new Error(`string-convert-indexes/${c}(): [THROW_ID_06] bad value was encountered, ${m(t,4)}, its path is ${u.path}`)}return t});throw new Error(`string-convert-indexes/${c}(): [THROW_ID_07] the first input argument, a source string should be a string but it was given as ${r}, type ${typeof r}`)}}function D(i,r){return y("n",i,r)}function E(i,r){return y("u",i,r)}export{D as nativeToUnicode,E as unicodeToNative,k as version};
12
12
  /*!
13
13
  * unicode-segmenter
@@ -1,17 +1,17 @@
1
1
  /**
2
2
  * @name string-convert-indexes
3
3
  * @fileoverview Convert between native JS string character indexes and grapheme-count-based indexes
4
- * @version 6.2.1
4
+ * @version 6.2.2
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-convert-indexes/}
8
8
  */
9
9
 
10
- "use strict";var stringConvertIndexes=(()=>{var j=Object.defineProperty,te=Object.defineProperties,re=Object.getOwnPropertyDescriptor,ne=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertyNames,T=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;var O=(e,t,r)=>t in e?j(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,A=(e,t)=>{for(var r in t||(t={}))B.call(t,r)&&O(e,r,t[r]);if(T)for(var r of T(t))oe.call(t,r)&&O(e,r,t[r]);return e},C=(e,t)=>te(e,ne(t));var le=(e,t)=>{for(var r in t)j(e,r,{get:t[r],enumerable:!0})},se=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of ie(t))!B.call(e,l)&&l!==r&&j(e,l,{get:()=>t[l],enumerable:!(i=re(t,l))||i.enumerable});return e};var ue=e=>se(j({},"__esModule",{value:!0}),e);var F=(e,t,r)=>O(e,typeof t!="symbol"?t+"":t,r);var we={};le(we,{nativeToUnicode:()=>ve,unicodeToNative:()=>Ae,version:()=>xe});function ae(){let e=[],t=0,r=!1;return{append(i){return r?!1:t+i.length>1999?(e.push("\u2026"),t+=1,r=!0,!1):(e.push(i),t+=i.length,!0)},result(){return e.join("")},stopped(){return r}}}function fe(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function D(e,t){if(e.append('"')){for(let r=0;r<t.length&&!e.stopped();r+=1){let i=t.charCodeAt(r);i===34?e.append('\\"'):i===92?e.append("\\\\"):i===8?e.append("\\b"):i===9?e.append("\\t"):i===10?e.append("\\n"):i===12?e.append("\\f"):i===13?e.append("\\r"):i<32||i===8232||i===8233||i>=55296&&i<=57343?e.append(fe(i)):e.append(t[r])}e.append('"')}}function ce(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function W(e,t){e.append("Symbol(");let r=String(t);r.length>8&&D(e,r.slice(7,-1)),e.append(")")}function R(e,t){typeof t=="symbol"?W(e,t):D(e,String(t))}function S(e,t=0){let r=ae(),i=t===4?4:0,l=new WeakSet,n=0;function f(s){i&&r.append(" ".repeat(s*i))}function p(s,h){s&&r.append(","),i&&(r.append("\n"),f(h+1))}function o(s,h,g){i&&h&&(r.append("\n"),f(g)),r.append(s)}function c(s,h){Object.prototype.hasOwnProperty.call(s,"value")?m(s.value,h):r.append(ce(s))}function u(s,h){let g;try{g=Reflect.getOwnPropertyDescriptor(s,"length")}catch(y){r.append("[Uninspectable]");return}let b=g==null?void 0:g.value;if(!Number.isSafeInteger(b)||b<0){r.append("[Uninspectable]");return}r.append("[");let x=!1;for(let y=0;y<b&&!r.stopped();y+=1){if(p(x,h),x=!0,n>=50){r.append("[MaxEntries]");break}n+=1;let v;try{v=Reflect.getOwnPropertyDescriptor(s,String(y))}catch(ke){r.append("[Uninspectable]");continue}v!=null&&v.enumerable?c(v,h+1):r.append("[Empty]")}o("]",x,h)}function a(s,h){let g;try{g=Reflect.ownKeys(s)}catch(x){r.append("[Uninspectable]");return}r.append("{");let b=!1;for(let x of g){if(r.stopped())break;if(n>=50){p(b,h),b=!0,D(r,"\u2026"),r.append(i?": ":":"),r.append("[MaxEntries]");break}n+=1;let y;try{y=Reflect.getOwnPropertyDescriptor(s,x)}catch(v){p(b,h),b=!0,R(r,x),r.append(i?": ":":"),r.append("[Uninspectable]");continue}y!=null&&y.enumerable&&(p(b,h),b=!0,R(r,x),r.append(i?": ":":"),c(y,h+1))}o("}",b,h)}function d(s,h){if(l.has(s)){r.append("[Circular]");return}if(h>=5){r.append("[MaxDepth]");return}let g;try{g=Array.isArray(s)}catch(b){r.append("[Uninspectable]");return}l.add(s);try{g?u(s,h):a(s,h)}finally{l.delete(s)}}function m(s,h){s===null?r.append("null"):typeof s=="string"?D(r,s):typeof s=="number"?r.append(Object.is(s,-0)?"-0":String(s)):typeof s=="boolean"?r.append(s?"true":"false"):typeof s>"u"?r.append("undefined"):typeof s=="bigint"?r.append("".concat(s,"n")):typeof s=="symbol"?W(r,s):typeof s=="function"?r.append("[Function]"):d(s,h)}try{return m(e,0),r.result()}catch(s){return"[Uninspectable]"}}var Fe=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);var pe=class{constructor(){F(this,"hasRepeatedReferences",!1);F(this,"clones",[]);F(this,"index");F(this,"sources",[])}get(e){if(this.index){let r=this.index.get(e);return r!==void 0&&(this.hasRepeatedReferences=!0),r}let t=this.sources.indexOf(e);if(t!==-1)return this.hasRepeatedReferences=!0,this.clones[t]}set(e,t){if(this.index){this.index.set(e,t);return}if(this.sources.push(e),this.clones.push(t),this.sources.length===32){this.index=new WeakMap;for(let r=0;r<this.sources.length;r++)this.index.set(this.sources[r],this.clones[r]);this.sources=[],this.clones=[]}}};function _(e,t){let r=t.get(e);if(r!==void 0)return r;let i=e.slice(0);return t.set(e,i),i}function he(e,t){if(typeof Buffer<"u"&&Buffer.isBuffer(e)){let n=Buffer.from(e);return t.set(e,n),n}let r=_(e.buffer,t);if(e instanceof DataView){let n=new DataView(r,e.byteOffset,e.byteLength);return t.set(e,n),n}let i=e.constructor,l=new i(r,e.byteOffset,e.length);return t.set(e,l),l}function I(e,t,r,i){for(let l of r){let n=t[l];e[l]=typeof n!="object"||n===null?n:w(n,i)}}function w(e,t){if(typeof e!="object"||e===null)return e;let r=t.get(e);if(r!==void 0)return r;if(Array.isArray(e)){let n=e.length,f=new Array(n);t.set(e,f);let p=e,o=Object.keys(e);if(o.length===n&&(n===0||o[n-1]==="".concat(n-1)))for(let c=0;c<n;c++){let u=p[c];f[c]=typeof u!="object"||u===null?u:w(u,t)}else I(f,p,o,t);return f}let i=Object.getPrototypeOf(e);if(i===Object.prototype||i===null){let n={};return t.set(e,n),I(n,e,Object.keys(e),t),n}if(e instanceof Date){let n=new Date(e.getTime());return t.set(e,n),n}if(ArrayBuffer.isView(e))return he(e,t);if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return _(e,t);if(e instanceof Map){let n=new Map;t.set(e,n);for(let[f,p]of e)n.set(w(f,t),w(p,t));return n}if(e instanceof Set){let n=new Set;t.set(e,n);for(let f of e)n.add(w(f,t));return n}let l={};return t.set(e,l),I(l,e,Object.keys(e),t),l}function k(e){return w(e,new pe)}function U(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function L(e,t,r){let i=e.length,l=0,n=0,f=-1,p=()=>{let o=0,c=0,u;do u=parseInt(e[l++],36),o+=(u&15)<<c,c+=4;while(u&16);return o};for(;l<i;){let o=f+1+p();r(o,f=o+p(),t?parseInt(t[n++],36):0)}}function P(e,t,r){let i=0,l=t.length-1;for(;i<=l;){let n=i+l>>>1,f=r[n];if(e<t[n])l=n-1;else if(e>f>>>5)i=n+1;else return f&31}return 0}var M="090001000h1v5g2903000hl2v6jh16ng1s210111110o35aa10u2k1g10l6600152113h2010u1q1r5aq3890o13181214r22k3158q2n1000v100h1k20000001207030001160721k171001h1j11610332010010321210090411021c1c02100o301201412230u1130b100h1j116111420120411001100k11l10051001h1j11611142011000321210072411021d0g10r3000000132120090o200200g1j11f2012031213711271t1001o301001000001121371b1f0c101h1l2011001031212000080a1t1001m40400102101600i11t301006c7i601008b6p41r10101041h3d0004115a1j290p3q223000511010100g1501010302003172030c0010016000e0i6v50n40n5tl12ir33s12t11u11cj30100060700010a90t220000l71i20m7203010241000502rd101004k300000006101027050920g3t22bk1300616g209030207u18c1000t10003010501b2o20000102000004g37070101o921c000640602001mcv3rg20000001o16d0c0m1fg6g2h30m10q55f1vm11c0ma0p1a42nc0ne1a090q3314902021204020112030318250105bb1201110i1021i15101131502141b15120511011k1155132040202510201010603060a1f02040104210b1g3290e0e0kn11vs12j11j3040pp12t80g6v1qi2500c0r51ktl7319g21g51gh103040n11010040j51i3f01q1h1d0m27p1a0000cs13200523j200010301010100v140018a4q2501010101c08000i1f12601011g3012215110u1a0001015000pcq181000100011000iji5fvc0u91g5bhg20ie0l94lo6002115303121s12240la1tj23h44tj11t45m4ah33q700000l3ep2021a200t220301012040a0i320j2040007f00100r20c100g3208000011531000s520201036020t900207l1101n311000000321210090a12634b910201l22001051020120011020000e1i520701020000n10h5001050000010000010001re0010323010001r11i520701000001q6000000107l600000230004gg12080001lc62027111n1000411230000000000t820321030030r10090n205001380800501020n2050c0001mc00002000000nc006150000i5l1100600010001q753011160000i441111000000rl11019100000c1h201043102n10ltk1f006eoss2b0202gs94r36si2033ku101m373h50b1rqs4113sli1t22m1uh2435070726u13k92rr7m34h380e0m141egl561g1261114k60ga6nn10t33sv13uf1jf0207150qt16t66pr60n23k6bf1f0e1l29g71c1e029j1n30p11ea0k1028139m16rb2v621122i52213040tf1u3b51n17127c0232041d120819052c28220104060306l5g3l4572g130152cqdl2c3o37a5o27u11c32d9m2cu2191obo57eh9gg1tv3",N="262122424333333393233393339333333333393393bf3b3b3b3b3f3f3bffff33b3bb33ff3f33b3b3333333bffff3b33bb33f33bffff33b3bb33ff3f33b3bbb333b3ff33b333f33b3b3b3b3333b3bf33b3bb39333b33b33b3b3b333b333333b3b33333f3b33b3ffb3f3fff3f3b33f35dc33333f3b3b3b33323333b3bb3b33b3fb3b3333b33333bff3b3f33bfb3b3ff3b3b3b3b3b333b333b3323e224423444444444444444444444444444444444444444444444444444444444444444444444444444444433334433333333b3b3bb33333b353bff3b3b3b3f3ff3b3b333bfff3f33333fb3bb3fb3b3bb33232333f333fff333333333b3b3333bb3b39393f3b3fbf33bb3b393b3b3b3333b33b33b3bbb33b33ffff3b3333bb3933b3b3b333b3b3b3b3b33b3b3b33b3b3b33b3b33b33b3b3b3fffff3bb39b9b3b33b3bf3f3b33f3b3f93b33b3b3bb33b33b3b3b3333393b3b3b33b39bffb3b332333b333dd3b3333233332333333333333333333333333333444444444444a4444444444444344444444444444444444444444444444444444444444",q="0001000000010010000000100000000000000000000000000001000000010018000100000001001000010101100101100000000000000000000100000001111000010000000110101001110111111111000100000021001000010000000100100001000000011010000100000001111000014000000100180001000000010010";var G=new Uint8Array(12448),K=new Uint8Array(1440),Q=new Uint8Array(2816),z,Z;{let e=(l,n,f,p,o)=>{let c=p-n+1,u=l.length;c>0&&f-n<u&&l.fill(o,f>n?f-n:0,c>u?u:c)},t=new Uint32Array(320),r=new Uint32Array(320),i=0;L(M,N,(l,n,f)=>{e(G,0,l,n,f),e(K,42592,l,n,f),e(Q,126976,l,n,f),n>=65040&&!(l>=126976&&n<=129791)&&(t[i]=l,r[i++]=n<<5|f)}),z=t.slice(0,i),Z=r.slice(0,i)}function V(e){return e<12448?G[e]:e<42592?e===12951||e===12953?4:0:e<44032?K[e-42592]:e<55204?(e-44032)%28?8:7:e>=126976&&e<129792?Q[e-126976]:e>>>4===4064?3:de(e)}function de(e){return e<57344?e<=55238?e>=55216?13:0:e>=55243&&e<=55291?12:0:e<65024?e===64286?3:0:e>=917504?e>921599?0:e>=917536&&e<917632||e>=917760&&e<918e3?3:2:P(e,z,Z)}var ge=Uint8Array.from(q);function be(e){return e===2381||e===2509||e===2765||e===2893||e===3149||e===3405||e===4153||e===6098||e===6752||e===6980||e===7083||e===43456||e===43766||e===68159||e===69939||e===70608||e===71998||e===72263||e===72345||e===73538}function me(e,t){return t===8204?e&21:e&8||be(t)?e&21|40:e&21|32}function H(e,t,r){return t===3?e&32?me(e,r):e&21:t===4?17:t===10?e&2^3:t===14?(e&16)>>2|e&41:t===15?33:1}function J(e){let t=[],r=e.length;if(r===0)return t;let i=e.codePointAt(0),l=i>65535?2:1,n=V(i),f=H(1,n,i),p=0;for(;l<r;){i=e.codePointAt(l);let o=V(i),c=!(f&ge[n<<4|o]);f=H(f,o,i),c&&(t.push(e.slice(p,l)),p=l),l+=i>65535?2:1,n=o}return t.push(e.slice(p)),t}function E(e,t){if(typeof t!="function")throw new TypeError("ast-monkey-traverse/traverse(): [THROW_ID_01] The second argument must be a callback function. It was ".concat(typeof t,"."));let r={now:!1};function i(l,n,f,p){let o=l,c,u=A({depth:-1,path:""},f);if(u.depth+=1,Array.isArray(o))for(let a=0,d=o.length;a<d&&!p.now;a++){let m=u.path?"".concat(u.path,".").concat(a):"".concat(a);if(o[a]!==void 0){u.parent=k(o),u.parentType="array",u.parentKey=u.path?u.path.slice(u.path.lastIndexOf(".")+1):null;let s=o[a],h=n(s,void 0,C(A({},u),{path:m}),p);c=i(h===s?h:k(h),n,C(A({},u),{path:m}),p),Number.isNaN(c)&&a<o.length?(o.splice(a,1),a-=1):o[a]=c}else o.splice(a,1)}else if(U(o))for(let a in o){if(p.now&&a!=null)break;let d=u.path?"".concat(u.path,".").concat(a):a;u.depth===0&&a!=null&&(u.topmostKey=a),u.parent=k(o),u.parentType="object",u.parentKey=u.path?u.path.slice(u.path.lastIndexOf(".")+1):null;let m=o[a],s=n(a,m,C(A({},u),{path:d}),p);c=i(s===m?s:k(s),n,C(A({},u),{path:d}),p),Number.isNaN(c)?delete o[a]:o[a]=c}return o}return i(k(e),t,{},r)}var Y="6.2.1";var xe=Y,X=typeof Intl.Segmenter=="function"?new Intl.Segmenter(void 0,{granularity:"grapheme"}):void 0;function $(e){let t=typeof e;return t==="string"||t==="number"}function ee(e,t,r){let i=e==="n"?"nativeToUnicode":"unicodeToNative";function l(o){return!(!$(o)||typeof o=="string"&&!/^\d*$/.test(o)||typeof o=="number"&&(!Number.isInteger(o)||o<0))}function n(o,c){let u=0,a=0;for(let d=0,m=o.length;d<m;d++){if(a+=o[d].length,c>=u&&c<a)return d;u+=o[d].length}throw new Error("string-convert-indexes/".concat(i,'(): [THROW_ID_01] the "indexes" value, ').concat(r,", is not covered by graphemes length!"))}function f(o,c){if(c>=o.length)throw new Error("string-convert-indexes/".concat(i,"(): [THROW_ID_02] the index to convert, ").concat(c,", is not covered by graphemes length!"));return o.slice(0,c).join("").length}if(typeof t!="string"||!t)throw new TypeError("string-convert-indexes/".concat(i,"(): [THROW_ID_03] the first input argument, input string, must be a non-zero-length string! Currently it's: ").concat(typeof t,", equal to:\n").concat(t));if(r===0)return 0;if(r==="0")return"0";let p=X?Array.from(X.segment(t),({segment:o})=>o):J(t);if($(r)){if(l(r))return e==="u"?typeof r=="string"?String(f(p,+r)):f(p,+r):typeof r=="string"?String(n(p,+r)):n(p,+r);throw new Error("string-convert-indexes/".concat(i,'(): [THROW_ID_04] the second input argument, "indexes" is not suitable to describe string index - it was given as ').concat(S(r,4)," (").concat(typeof r,")"))}else{if(r&&typeof r=="object")return e==="u"?E(r,(o,c,u)=>{let a=c!==void 0?c:o;if($(a)){if(l(a))return typeof a=="string"?String(f(p,+a)):f(p,+a);throw new Error("string-convert-indexes/".concat(i,"(): [THROW_ID_05] bad value was encountered, ").concat(S(a,4),", its path is ").concat(u.path))}return a}):E(r,(o,c,u)=>{let a=c!==void 0?c:o;if($(a)){if(l(a))return typeof a=="string"?String(n(p,+a)):n(p,+a);throw new Error("string-convert-indexes/".concat(i,"(): [THROW_ID_06] bad value was encountered, ").concat(S(a,4),", its path is ").concat(u.path))}return a});throw new Error("string-convert-indexes/".concat(i,"(): [THROW_ID_07] the first input argument, a source string should be a string but it was given as ").concat(t,", type ").concat(typeof t))}}function ve(e,t){return ee("n",e,t)}function Ae(e,t){return ee("u",e,t)}return ue(we);})();
10
+ "use strict";var stringConvertIndexes=(()=>{var F=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames,T=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable;var $=(e,t,r)=>t in e?F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,B=(e,t)=>{for(var r in t||(t={}))R.call(t,r)&&$(e,r,t[r]);if(T)for(var r of T(t))le.call(t,r)&&$(e,r,t[r]);return e};var se=(e,t)=>{for(var r in t)F(e,r,{get:t[r],enumerable:!0})},ue=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of oe(t))!R.call(e,o)&&o!==r&&F(e,o,{get:()=>t[o],enumerable:!(n=ie(t,o))||n.enumerable});return e};var ae=e=>ue(F({},"__esModule",{value:!0}),e);var j=(e,t,r)=>$(e,typeof t!="symbol"?t+"":t,r);var Ce={};se(Ce,{nativeToUnicode:()=>Ae,unicodeToNative:()=>we,version:()=>xe});function fe(){let e=[],t=0,r=!1;return{append(n){return r?!1:t+n.length>1999?(e.push("\u2026"),t+=1,r=!0,!1):(e.push(n),t+=n.length,!0)},result(){return e.join("")},stopped(){return r}}}function ce(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function D(e,t){if(e.append('"')){for(let r=0;r<t.length&&!e.stopped();r+=1){let n=t.charCodeAt(r);n===34?e.append('\\"'):n===92?e.append("\\\\"):n===8?e.append("\\b"):n===9?e.append("\\t"):n===10?e.append("\\n"):n===12?e.append("\\f"):n===13?e.append("\\r"):n<32||n===8232||n===8233||n>=55296&&n<=57343?e.append(ce(n)):e.append(t[r])}e.append('"')}}function pe(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function U(e,t){e.append("Symbol(");let r=String(t);r.length>8&&D(e,r.slice(7,-1)),e.append(")")}function W(e,t){typeof t=="symbol"?U(e,t):D(e,String(t))}function S(e,t=0){let r=fe(),n=t===4?4:0,o=new WeakSet,i=0;function u(s){n&&r.append(" ".repeat(s*n))}function p(s,c){s&&r.append(","),n&&(r.append("\n"),u(c+1))}function l(s,c,m){n&&c&&(r.append("\n"),u(m)),r.append(s)}function f(s,c){Object.prototype.hasOwnProperty.call(s,"value")?b(s.value,c):r.append(pe(s))}function h(s,c){let m;try{m=Reflect.getOwnPropertyDescriptor(s,"length")}catch(y){r.append("[Uninspectable]");return}let d=m==null?void 0:m.value;if(!Number.isSafeInteger(d)||d<0){r.append("[Uninspectable]");return}r.append("[");let v=!1;for(let y=0;y<d&&!r.stopped();y+=1){if(p(v,c),v=!0,i>=50){r.append("[MaxEntries]");break}i+=1;let x;try{x=Reflect.getOwnPropertyDescriptor(s,String(y))}catch(g){r.append("[Uninspectable]");continue}x!=null&&x.enumerable?f(x,c+1):r.append("[Empty]")}l("]",v,c)}function a(s,c){let m;try{m=Reflect.ownKeys(s)}catch(v){r.append("[Uninspectable]");return}r.append("{");let d=!1;for(let v of m){if(r.stopped())break;if(i>=50){p(d,c),d=!0,D(r,"\u2026"),r.append(n?": ":":"),r.append("[MaxEntries]");break}i+=1;let y;try{y=Reflect.getOwnPropertyDescriptor(s,v)}catch(x){p(d,c),d=!0,W(r,v),r.append(n?": ":":"),r.append("[Uninspectable]");continue}y!=null&&y.enumerable&&(p(d,c),d=!0,W(r,v),r.append(n?": ":":"),f(y,c+1))}l("}",d,c)}function A(s,c){if(o.has(s)){r.append("[Circular]");return}if(c>=5){r.append("[MaxDepth]");return}let m;try{m=Array.isArray(s)}catch(d){r.append("[Uninspectable]");return}o.add(s);try{m?h(s,c):a(s,c)}finally{o.delete(s)}}function b(s,c){s===null?r.append("null"):typeof s=="string"?D(r,s):typeof s=="number"?r.append(Object.is(s,-0)?"-0":String(s)):typeof s=="boolean"?r.append(s?"true":"false"):typeof s>"u"?r.append("undefined"):typeof s=="bigint"?r.append("".concat(s,"n")):typeof s=="symbol"?U(r,s):typeof s=="function"?r.append("[Function]"):A(s,c)}try{return b(e,0),r.result()}catch(s){return"[Uninspectable]"}}var je=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);var de=class{constructor(){j(this,"hasRepeatedReferences",!1);j(this,"clones",[]);j(this,"index");j(this,"sources",[])}get(e){if(this.index){let r=this.index.get(e);return r!==void 0&&(this.hasRepeatedReferences=!0),r}let t=this.sources.indexOf(e);if(t!==-1)return this.hasRepeatedReferences=!0,this.clones[t]}set(e,t){if(this.index){this.index.set(e,t);return}if(this.sources.push(e),this.clones.push(t),this.sources.length===32){this.index=new WeakMap;for(let r=0;r<this.sources.length;r++)this.index.set(this.sources[r],this.clones[r]);this.sources=[],this.clones=[]}}};function P(e,t){let r=t.get(e);if(r!==void 0)return r;let n=e.slice(0);return t.set(e,n),n}function he(e,t){if(typeof Buffer<"u"&&Buffer.isBuffer(e)){let i=Buffer.from(e);return t.set(e,i),i}let r=P(e.buffer,t);if(e instanceof DataView){let i=new DataView(r,e.byteOffset,e.byteLength);return t.set(e,i),i}let n=e.constructor,o=new n(r,e.byteOffset,e.length);return t.set(e,o),o}function E(e,t,r,n){for(let o of r){let i=t[o];e[o]=typeof i!="object"||i===null?i:k(i,n)}}function k(e,t){if(typeof e!="object"||e===null)return e;let r=t.get(e);if(r!==void 0)return r;if(Array.isArray(e)){let i=e.length,u=new Array(i);t.set(e,u);let p=e,l=Object.keys(e);if(l.length===i&&(i===0||l[i-1]==="".concat(i-1)))for(let f=0;f<i;f++){let h=p[f];u[f]=typeof h!="object"||h===null?h:k(h,t)}else E(u,p,l,t);return u}let n=Object.getPrototypeOf(e);if(n===Object.prototype||n===null){let i={};return t.set(e,i),E(i,e,Object.keys(e),t),i}if(e instanceof Date){let i=new Date(e.getTime());return t.set(e,i),i}if(ArrayBuffer.isView(e))return he(e,t);if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return P(e,t);if(e instanceof Map){let i=new Map;t.set(e,i);for(let[u,p]of e)i.set(k(u,t),k(p,t));return i}if(e instanceof Set){let i=new Set;t.set(e,i);for(let u of e)i.add(k(u,t));return i}let o={};return t.set(e,o),E(o,e,Object.keys(e),t),o}function w(e){return k(e,new de)}function L(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}var _,Fe=(_=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:_.get;var De=Date.prototype.getTime;function M(e,t,r){let n=e.length,o=0,i=0,u=-1,p=()=>{let l=0,f=0,h;do h=parseInt(e[o++],36),l+=(h&15)<<f,f+=4;while(h&16);return l};for(;o<n;){let l=u+1+p();r(l,u=l+p(),t?parseInt(t[i++],36):0)}}function N(e,t,r){let n=0,o=t.length-1;for(;n<=o;){let i=n+o>>>1,u=r[i];if(e<t[i])o=i-1;else if(e>u>>>5)n=i+1;else return u&31}return 0}var q="090001000h1v5g2903000hl2v6jh16ng1s210111110o35aa10u2k1g10l6600152113h2010u1q1r5aq3890o13181214r22k3158q2n1000v100h1k20000001207030001160721k171001h1j11610332010010321210090411021c1c02100o301201412230u1130b100h1j116111420120411001100k11l10051001h1j11611142011000321210072411021d0g10r3000000132120090o200200g1j11f2012031213711271t1001o301001000001121371b1f0c101h1l2011001031212000080a1t1001m40400102101600i11t301006c7i601008b6p41r10101041h3d0004115a1j290p3q223000511010100g1501010302003172030c0010016000e0i6v50n40n5tl12ir33s12t11u11cj30100060700010a90t220000l71i20m7203010241000502rd101004k300000006101027050920g3t22bk1300616g209030207u18c1000t10003010501b2o20000102000004g37070101o921c000640602001mcv3rg20000001o16d0c0m1fg6g2h30m10q55f1vm11c0ma0p1a42nc0ne1a090q3314902021204020112030318250105bb1201110i1021i15101131502141b15120511011k1155132040202510201010603060a1f02040104210b1g3290e0e0kn11vs12j11j3040pp12t80g6v1qi2500c0r51ktl7319g21g51gh103040n11010040j51i3f01q1h1d0m27p1a0000cs13200523j200010301010100v140018a4q2501010101c08000i1f12601011g3012215110u1a0001015000pcq181000100011000iji5fvc0u91g5bhg20ie0l94lo6002115303121s12240la1tj23h44tj11t45m4ah33q700000l3ep2021a200t220301012040a0i320j2040007f00100r20c100g3208000011531000s520201036020t900207l1101n311000000321210090a12634b910201l22001051020120011020000e1i520701020000n10h5001050000010000010001re0010323010001r11i520701000001q6000000107l600000230004gg12080001lc62027111n1000411230000000000t820321030030r10090n205001380800501020n2050c0001mc00002000000nc006150000i5l1100600010001q753011160000i441111000000rl11019100000c1h201043102n10ltk1f006eoss2b0202gs94r36si2033ku101m373h50b1rqs4113sli1t22m1uh2435070726u13k92rr7m34h380e0m141egl561g1261114k60ga6nn10t33sv13uf1jf0207150qt16t66pr60n23k6bf1f0e1l29g71c1e029j1n30p11ea0k1028139m16rb2v621122i52213040tf1u3b51n17127c0232041d120819052c28220104060306l5g3l4572g130152cqdl2c3o37a5o27u11c32d9m2cu2191obo57eh9gg1tv3",V="262122424333333393233393339333333333393393bf3b3b3b3b3f3f3bffff33b3bb33ff3f33b3b3333333bffff3b33bb33f33bffff33b3bb33ff3f33b3bbb333b3ff33b333f33b3b3b3b3333b3bf33b3bb39333b33b33b3b3b333b333333b3b33333f3b33b3ffb3f3fff3f3b33f35dc33333f3b3b3b33323333b3bb3b33b3fb3b3333b33333bff3b3f33bfb3b3ff3b3b3b3b3b333b333b3323e224423444444444444444444444444444444444444444444444444444444444444444444444444444444433334433333333b3b3bb33333b353bff3b3b3b3f3ff3b3b333bfff3f33333fb3bb3fb3b3bb33232333f333fff333333333b3b3333bb3b39393f3b3fbf33bb3b393b3b3b3333b33b33b3bbb33b33ffff3b3333bb3933b3b3b333b3b3b3b3b33b3b3b33b3b3b33b3b33b33b3b3b3fffff3bb39b9b3b33b3bf3f3b33f3b3f93b33b3b3bb33b33b3b3b3333393b3b3b33b39bffb3b332333b333dd3b3333233332333333333333333333333333333444444444444a4444444444444344444444444444444444444444444444444444444444",H="0001000000010010000000100000000000000000000000000001000000010018000100000001001000010101100101100000000000000000000100000001111000010000000110101001110111111111000100000021001000010000000100100001000000011010000100000001111000014000000100180001000000010010";var Q=new Uint8Array(12448),z=new Uint8Array(1440),Z=new Uint8Array(2816),J,Y;{let e=(o,i,u,p,l)=>{let f=p-i+1,h=o.length;f>0&&u-i<h&&o.fill(l,u>i?u-i:0,f>h?h:f)},t=new Uint32Array(320),r=new Uint32Array(320),n=0;M(q,V,(o,i,u)=>{e(Q,0,o,i,u),e(z,42592,o,i,u),e(Z,126976,o,i,u),i>=65040&&!(o>=126976&&i<=129791)&&(t[n]=o,r[n++]=i<<5|u)}),J=t.slice(0,n),Y=r.slice(0,n)}function G(e){return e<12448?Q[e]:e<42592?e===12951||e===12953?4:0:e<44032?z[e-42592]:e<55204?(e-44032)%28?8:7:e>=126976&&e<129792?Z[e-126976]:e>>>4===4064?3:ge(e)}function ge(e){return e<57344?e<=55238?e>=55216?13:0:e>=55243&&e<=55291?12:0:e<65024?e===64286?3:0:e>=917504?e>921599?0:e>=917536&&e<917632||e>=917760&&e<918e3?3:2:N(e,J,Y)}var be=Uint8Array.from(H);function me(e){return e===2381||e===2509||e===2765||e===2893||e===3149||e===3405||e===4153||e===6098||e===6752||e===6980||e===7083||e===43456||e===43766||e===68159||e===69939||e===70608||e===71998||e===72263||e===72345||e===73538}function ye(e,t){return t===8204?e&21:e&8||me(t)?e&21|40:e&21|32}function K(e,t,r){return t===3?e&32?ye(e,r):e&21:t===4?17:t===10?e&2^3:t===14?(e&16)>>2|e&41:t===15?33:1}function X(e){let t=[],r=e.length;if(r===0)return t;let n=e.codePointAt(0),o=n>65535?2:1,i=G(n),u=K(1,i,n),p=0;for(;o<r;){n=e.codePointAt(o);let l=G(n),f=!(u&be[i<<4|l]);u=K(u,l,n),f&&(t.push(e.slice(p,o)),p=o),o+=n>65535?2:1,i=l}return t.push(e.slice(p)),t}function ee(e){return typeof e=="object"&&e!==null?w(e):e}function I(e,t){if(typeof t!="function")throw new TypeError("ast-monkey-traverse/traverse(): [THROW_ID_01] The second argument must be a callback function. It was ".concat(typeof t,"."));let r={now:!1},n=0;function o(i,u,p,l,f,h){let a=i,A=l?l.slice(l.lastIndexOf(".")+1):null,b,s=-1,c,m=!1;if(Array.isArray(a))for(let d=0;d<a.length&&!h.now;d++){let v=a[d];if(v===void 0){a.splice(d,1),n+=1,c=void 0;continue}let y=l?"".concat(l,".").concat(d):"".concat(d);s!==n&&(c===void 0?b=w(a):(b=b.slice(),m?b.splice(c,1):b[c]=ee(a[c])),s=n),c=void 0;let x={depth:p,path:y,parent:b,parentType:"array",parentKey:A};f!==void 0&&(x.topmostKey=f);let g=u(v,void 0,x,h);typeof g=="object"&&g!==null&&(g!==v&&(g=w(g)),g=o(g,u,p+1,y,f,h));let C=!1;Number.isNaN(g)&&d<a.length?(a.splice(d,1),n+=1,C=!0):g!==v&&(a[d]=g,n+=1),s!==n&&(c=d,m=C),C&&(d-=1)}else if(L(a))for(let d in a){if(h.now)break;let v=l?"".concat(l,".").concat(d):d;p===0&&(f=d),s!==n&&(c===void 0?b=w(a):(b=B({},b),m?delete b[c]:b[c]=ee(a[c])),s=n),c=void 0;let y=a[d],x={depth:p,path:v,parent:b,parentType:"object",parentKey:A};f!==void 0&&(x.topmostKey=f);let g=u(d,y,x,h);typeof g=="object"&&g!==null&&(g!==y&&(g=w(g)),g=o(g,u,p+1,v,f,h));let C=!1;Number.isNaN(g)?(delete a[d],n+=1,C=!0):g!==y&&(a[d]=g,n+=1),s!==n&&(c=d,m=C)}return a}return o(w(e),t,0,"",void 0,r)}var te="6.2.2";var xe=te,re=typeof Intl.Segmenter=="function"?new Intl.Segmenter(void 0,{granularity:"grapheme"}):void 0;function O(e){let t=typeof e;return t==="string"||t==="number"}function ne(e,t,r){let n=e==="n"?"nativeToUnicode":"unicodeToNative";function o(l){return!(!O(l)||typeof l=="string"&&!/^\d*$/.test(l)||typeof l=="number"&&(!Number.isInteger(l)||l<0))}function i(l,f){let h=0,a=0;for(let A=0,b=l.length;A<b;A++){if(a+=l[A].length,f>=h&&f<a)return A;h+=l[A].length}throw new Error("string-convert-indexes/".concat(n,'(): [THROW_ID_01] the "indexes" value, ').concat(r,", is not covered by graphemes length!"))}function u(l,f){if(f>=l.length)throw new Error("string-convert-indexes/".concat(n,"(): [THROW_ID_02] the index to convert, ").concat(f,", is not covered by graphemes length!"));return l.slice(0,f).join("").length}if(typeof t!="string"||!t)throw new TypeError("string-convert-indexes/".concat(n,"(): [THROW_ID_03] the first input argument, input string, must be a non-zero-length string! Currently it's: ").concat(typeof t,", equal to:\n").concat(t));if(r===0)return 0;if(r==="0")return"0";let p=re?Array.from(re.segment(t),({segment:l})=>l):X(t);if(O(r)){if(o(r))return e==="u"?typeof r=="string"?String(u(p,+r)):u(p,+r):typeof r=="string"?String(i(p,+r)):i(p,+r);throw new Error("string-convert-indexes/".concat(n,'(): [THROW_ID_04] the second input argument, "indexes" is not suitable to describe string index - it was given as ').concat(S(r,4)," (").concat(typeof r,")"))}else{if(r&&typeof r=="object")return e==="u"?I(r,(l,f,h)=>{let a=f!==void 0?f:l;if(O(a)){if(o(a))return typeof a=="string"?String(u(p,+a)):u(p,+a);throw new Error("string-convert-indexes/".concat(n,"(): [THROW_ID_05] bad value was encountered, ").concat(S(a,4),", its path is ").concat(h.path))}return a}):I(r,(l,f,h)=>{let a=f!==void 0?f:l;if(O(a)){if(o(a))return typeof a=="string"?String(i(p,+a)):i(p,+a);throw new Error("string-convert-indexes/".concat(n,"(): [THROW_ID_06] bad value was encountered, ").concat(S(a,4),", its path is ").concat(h.path))}return a});throw new Error("string-convert-indexes/".concat(n,"(): [THROW_ID_07] the first input argument, a source string should be a string but it was given as ").concat(t,", type ").concat(typeof t))}}function Ae(e,t){return ne("n",e,t)}function we(e,t){return ne("u",e,t)}return ae(Ce);})();
11
11
  /**
12
12
  * @name codsen-utils
13
13
  * @fileoverview Various utility functions
14
- * @version 1.8.0
14
+ * @version 1.9.0
15
15
  * @author Roy Revelt
16
16
  * @license MIT
17
17
  * {@link https://codsen.com/os/codsen-utils/}
@@ -19,7 +19,7 @@
19
19
  /**
20
20
  * @name ast-monkey-traverse
21
21
  * @fileoverview Utility library to traverse AST
22
- * @version 4.2.1
22
+ * @version 4.2.2
23
23
  * @author Roy Revelt
24
24
  * @license MIT
25
25
  * {@link https://codsen.com/os/ast-monkey-traverse/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-convert-indexes",
3
- "version": "6.2.1",
3
+ "version": "6.2.2",
4
4
  "description": "Convert between native JS string character indexes and grapheme-count-based indexes",
5
5
  "keywords": [
6
6
  "astral",
@@ -66,8 +66,8 @@
66
66
  "various": {}
67
67
  },
68
68
  "dependencies": {
69
- "ast-monkey-traverse": "^4.2.1",
70
- "codsen-utils": "^1.8.0",
69
+ "ast-monkey-traverse": "^4.2.2",
70
+ "codsen-utils": "^1.9.0",
71
71
  "unicode-segmenter": "^0.17.3"
72
72
  },
73
73
  "engines": {