@speclynx/apidom-json-pointer 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apidomJsonPointer=t():e.apidomJsonPointer=t()}(self,()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ASTTranslator:()=>E,ApiDOMEvaluationRealm:()=>Se,CSTTranslator:()=>w,Grammar:()=>l,JSONPointerCompileError:()=>z,JSONPointerError:()=>g,JSONPointerEvaluateError:()=>J,JSONPointerIndexError:()=>q,JSONPointerKeyError:()=>X,JSONPointerParseError:()=>T,JSONPointerTypeError:()=>K,JSONString:()=>r,URIFragmentIdentifier:()=>n,XMLTranslator:()=>M,compile:()=>B,escape:()=>U,evaluate:()=>$e,parse:()=>O,testArrayDash:()=>H,testArrayIndex:()=>I,testArrayLocation:()=>_,testJSONPointer:()=>S,testReferenceToken:()=>N,unescape:()=>k});var r={};e.r(r),e.d(r,{from:()=>a,to:()=>s});var n={};e.r(n),e.d(n,{from:()=>i,fromURIReference:()=>c,to:()=>o});const s=e=>JSON.stringify(e),a=e=>{try{return String(JSON.parse(e))}catch{return e}},o=e=>`#${[...e].map(e=>/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/.test(e)?e:encodeURIComponent(e)).join("")}`,i=e=>{try{const t=e.startsWith("#")?e.slice(1):e;return decodeURIComponent(t)}catch{return e}},c=e=>{const t=e.indexOf("#"),r=-1===t?"#":e.substring(t);return i(r)};function l(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"json-pointer",lower:"json-pointer",index:0,isBkr:!1},this.rules[1]={name:"reference-token",lower:"reference-token",index:1,isBkr:!1},this.rules[2]={name:"unescaped",lower:"unescaped",index:2,isBkr:!1},this.rules[3]={name:"escaped",lower:"escaped",index:3,isBkr:!1},this.rules[4]={name:"array-location",lower:"array-location",index:4,isBkr:!1},this.rules[5]={name:"array-index",lower:"array-index",index:5,isBkr:!1},this.rules[6]={name:"array-dash",lower:"array-dash",index:6,isBkr:!1},this.rules[7]={name:"slash",lower:"slash",index:7,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:3,min:0,max:1/0},this.rules[0].opcodes[1]={type:2,children:[2,3]},this.rules[0].opcodes[2]={type:4,index:7},this.rules[0].opcodes[3]={type:4,index:1},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:3,min:0,max:1/0},this.rules[1].opcodes[1]={type:1,children:[2,3]},this.rules[1].opcodes[2]={type:4,index:2},this.rules[1].opcodes[3]={type:4,index:3},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:1,children:[1,2,3]},this.rules[2].opcodes[1]={type:5,min:0,max:46},this.rules[2].opcodes[2]={type:5,min:48,max:125},this.rules[2].opcodes[3]={type:5,min:127,max:1114111},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:2,children:[1,2]},this.rules[3].opcodes[1]={type:7,string:[126]},this.rules[3].opcodes[2]={type:1,children:[3,4]},this.rules[3].opcodes[3]={type:7,string:[48]},this.rules[3].opcodes[4]={type:7,string:[49]},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:4,index:5},this.rules[4].opcodes[2]={type:4,index:6},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:1,children:[1,2]},this.rules[5].opcodes[1]={type:6,string:[48]},this.rules[5].opcodes[2]={type:2,children:[3,4]},this.rules[5].opcodes[3]={type:5,min:49,max:57},this.rules[5].opcodes[4]={type:3,min:0,max:1/0},this.rules[5].opcodes[5]={type:5,min:48,max:57},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:7,string:[45]},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:7,string:[47]},this.toString=function(){let e="";return e+="; JavaScript Object Notation (JSON) Pointer ABNF syntax\n",e+="; https://datatracker.ietf.org/doc/html/rfc6901\n",e+="json-pointer = *( slash reference-token ) ; MODIFICATION: surrogate text rule used\n",e+="reference-token = *( unescaped / escaped )\n",e+="unescaped = %x00-2E / %x30-7D / %x7F-10FFFF\n",e+=" ; %x2F ('/') and %x7E ('~') are excluded from 'unescaped'\n",e+='escaped = "~" ( "0" / "1" )\n',e+=" ; representing '~' and '/', respectively\n",e+="\n",e+="; https://datatracker.ietf.org/doc/html/rfc6901#section-4\n",e+="array-location = array-index / array-dash\n",e+="array-index = %x30 / ( %x31-39 *(%x30-39) )\n",e+=' ; "0", or digits without a leading "0"\n',e+='array-dash = "-"\n',e+="\n",e+="; Surrogate named rules\n",e+='slash = "/"\n','; JavaScript Object Notation (JSON) Pointer ABNF syntax\n; https://datatracker.ietf.org/doc/html/rfc6901\njson-pointer = *( slash reference-token ) ; MODIFICATION: surrogate text rule used\nreference-token = *( unescaped / escaped )\nunescaped = %x00-2E / %x30-7D / %x7F-10FFFF\n ; %x2F (\'/\') and %x7E (\'~\') are excluded from \'unescaped\'\nescaped = "~" ( "0" / "1" )\n ; representing \'~\' and \'/\', respectively\n\n; https://datatracker.ietf.org/doc/html/rfc6901#section-4\narray-location = array-index / array-dash\narray-index = %x30 / ( %x31-39 *(%x30-39) )\n ; "0", or digits without a leading "0"\narray-dash = "-"\n\n; Surrogate named rules\nslash = "/"\n'}}const h=function(){const e=m,t=d,r=this,n="parser.js: Parser(): ";r.ast=void 0,r.stats=void 0,r.trace=void 0,r.callbacks=[];let s,a,o,i,c,l,h,u=0,p=0,f=0,y=0,g=0,T=new function(){this.state=e.ACTIVE,this.phraseLength=0,this.refresh=()=>{this.state=e.ACTIVE,this.phraseLength=0}};r.parse=(d,m,b,w)=>{const E=`${n}parse(): `;u=0,p=0,f=0,y=0,g=0,s=void 0,a=void 0,o=void 0,i=void 0,T.refresh(),c=void 0,l=void 0,h=void 0,i=t.stringToChars(b),s=d.rules,a=d.udts;const A=m.toLowerCase();let v;for(const e in s)if(s.hasOwnProperty(e)&&A===s[e].lower){v=s[e].index;break}if(void 0===v)throw new Error(`${E}start rule name '${startRule}' not recognized`);(()=>{const e=`${n}initializeCallbacks(): `;let t,o;for(c=[],l=[],t=0;t<s.length;t+=1)c[t]=void 0;for(t=0;t<a.length;t+=1)l[t]=void 0;const i=[];for(t=0;t<s.length;t+=1)i.push(s[t].lower);for(t=0;t<a.length;t+=1)i.push(a[t].lower);for(const n in r.callbacks)if(r.callbacks.hasOwnProperty(n)){if(t=i.indexOf(n.toLowerCase()),t<0)throw new Error(`${e}syntax callback '${n}' not a rule or udt name`);if(o=r.callbacks[n]?r.callbacks[n]:void 0,"function"!=typeof o&&void 0!==o)throw new Error(`${e}syntax callback[${n}] must be function reference or falsy)`);t<s.length?c[t]=o:l[t-s.length]=o}})(),r.trace&&r.trace.init(s,a,i),r.stats&&r.stats.init(s,a),r.ast&&r.ast.init(s,a,i),h=w,o=[{type:e.RNM,index:v}],k(0,0),o=void 0;let x=!1;switch(T.state){case e.ACTIVE:throw new Error(`${E}final state should never be 'ACTIVE'`);case e.NOMATCH:x=!1;break;case e.EMPTY:case e.MATCH:x=T.phraseLength===i.length;break;default:throw new Error("unrecognized state")}return{success:x,state:T.state,stateName:e.idName(T.state),length:i.length,matched:T.phraseLength,maxMatched:g,maxTreeDepth:f,nodeHits:y}};const b=(t,r,s,a)=>{if(r.phraseLength>s){let e=`${n}opRNM(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${r.phraseLength}`,e+=` must be <= remaining chars: ${s}`,new Error(e)}switch(r.state){case e.ACTIVE:if(!a)throw new Error(`${n}opRNM(${t.name}): callback function return error. ACTIVE state not allowed.`);break;case e.EMPTY:r.phraseLength=0;break;case e.MATCH:0===r.phraseLength&&(r.state=e.EMPTY);break;case e.NOMATCH:r.phraseLength=0;break;default:throw new Error(`${n}opRNM(${t.name}): callback function return error. Unrecognized return state: ${r.state}`)}},w=(t,c)=>{let p,f,d;const m=o[t],y=a[m.index];T.UdtIndex=y.index,u||(d=r.ast&&r.ast.udtDefined(m.index),d&&(f=s.length+m.index,p=r.ast.getLength(),r.ast.down(f,y.name)));const g=i.length-c;l[m.index](T,i,c,h),((t,r,s)=>{if(r.phraseLength>s){let e=`${n}opUDT(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${r.phraseLength}`,e+=` must be <= remaining chars: ${s}`,new Error(e)}switch(r.state){case e.ACTIVE:throw new Error(`${n}opUDT(${t.name}) ACTIVE state return not allowed.`);case e.EMPTY:if(!t.empty)throw new Error(`${n}opUDT(${t.name}) may not return EMPTY.`);r.phraseLength=0;break;case e.MATCH:if(0===r.phraseLength){if(!t.empty)throw new Error(`${n}opUDT(${t.name}) may not return EMPTY.`);r.state=e.EMPTY}break;case e.NOMATCH:r.phraseLength=0;break;default:throw new Error(`${n}opUDT(${t.name}): callback function return error. Unrecognized return state: ${r.state}`)}})(y,T,g),u||d&&(T.state===e.NOMATCH?r.ast.setLength(p):r.ast.up(f,y.name,c,T.phraseLength))},k=(t,a)=>{const l=`${n}opExecute(): `,d=o[t];switch(y+=1,p>f&&(f=p),p+=1,T.refresh(),r.trace&&r.trace.down(d,a),d.type){case e.ALT:((t,r)=>{const n=o[t];for(let t=0;t<n.children.length&&(k(n.children[t],r),T.state===e.NOMATCH);t+=1);})(t,a);break;case e.CAT:((t,n)=>{let s,a,i,c;const l=o[t];r.ast&&(a=r.ast.getLength()),s=!0,i=n,c=0;for(let t=0;t<l.children.length;t+=1){if(k(l.children[t],i),T.state===e.NOMATCH){s=!1;break}i+=T.phraseLength,c+=T.phraseLength}s?(T.state=0===c?e.EMPTY:e.MATCH,T.phraseLength=c):(T.state=e.NOMATCH,T.phraseLength=0,r.ast&&r.ast.setLength(a))})(t,a);break;case e.REP:((t,n)=>{let s,a,c,l;const h=o[t];if(0===h.max)return T.state=e.EMPTY,void(T.phraseLength=0);for(a=n,c=0,l=0,r.ast&&(s=r.ast.getLength());!(a>=i.length)&&(k(t+1,a),T.state!==e.NOMATCH)&&T.state!==e.EMPTY&&(l+=1,c+=T.phraseLength,a+=T.phraseLength,l!==h.max););T.state===e.EMPTY||l>=h.min?(T.state=0===c?e.EMPTY:e.MATCH,T.phraseLength=c):(T.state=e.NOMATCH,T.phraseLength=0,r.ast&&r.ast.setLength(s))})(t,a);break;case e.RNM:((t,n)=>{let a,l,p;const f=o[t],d=s[f.index],m=c[d.index];if(u||(l=r.ast&&r.ast.ruleDefined(f.index),l&&(a=r.ast.getLength(),r.ast.down(f.index,s[f.index].name))),m){const t=i.length-n;m(T,i,n,h),b(d,T,t,!0),T.state===e.ACTIVE&&(p=o,o=d.opcodes,k(0,n),o=p,m(T,i,n,h),b(d,T,t,!1))}else p=o,o=d.opcodes,k(0,n,T),o=p;u||l&&(T.state===e.NOMATCH?r.ast.setLength(a):r.ast.up(f.index,d.name,n,T.phraseLength))})(t,a);break;case e.TRG:((t,r)=>{const n=o[t];T.state=e.NOMATCH,r<i.length&&n.min<=i[r]&&i[r]<=n.max&&(T.state=e.MATCH,T.phraseLength=1)})(t,a);break;case e.TBS:((t,r)=>{const n=o[t],s=n.string.length;if(T.state=e.NOMATCH,r+s<=i.length){for(let e=0;e<s;e+=1)if(i[r+e]!==n.string[e])return;T.state=e.MATCH,T.phraseLength=s}})(t,a);break;case e.TLS:((t,r)=>{let n;const s=o[t];T.state=e.NOMATCH;const a=s.string.length;if(0!==a){if(r+a<=i.length){for(let e=0;e<a;e+=1)if(n=i[r+e],n>=65&&n<=90&&(n+=32),n!==s.string[e])return;T.state=e.MATCH,T.phraseLength=a}}else T.state=e.EMPTY})(t,a);break;case e.UDT:w(t,a);break;case e.AND:((t,r)=>{switch(u+=1,k(t+1,r),u-=1,T.phraseLength=0,T.state){case e.EMPTY:case e.MATCH:T.state=e.EMPTY;break;case e.NOMATCH:T.state=e.NOMATCH;break;default:throw new Error(`opAND: invalid state ${T.state}`)}})(t,a);break;case e.NOT:((t,r)=>{switch(u+=1,k(t+1,r),u-=1,T.phraseLength=0,T.state){case e.EMPTY:case e.MATCH:T.state=e.NOMATCH;break;case e.NOMATCH:T.state=e.EMPTY;break;default:throw new Error(`opNOT: invalid state ${T.state}`)}})(t,a);break;default:throw new Error(`${l}unrecognized operator`)}u||a+T.phraseLength>g&&(g=a+T.phraseLength),r.stats&&r.stats.collect(d,T),r.trace&&r.trace.up(d,T.state,a,T.phraseLength),p-=1}},u=function(){const e=m,t=d,r=this;let n,s,a,o=0;const i=[],c=[],l=[];function h(e){let t="";for(;e-- >0;)t+=" ";return t}r.callbacks=[],r.init=(e,t,h)=>{let u;c.length=0,l.length=0,o=0,n=e,s=t,a=h;const p=[];for(u=0;u<n.length;u+=1)p.push(n[u].lower);for(u=0;u<s.length;u+=1)p.push(s[u].lower);for(o=n.length+s.length,u=0;u<o;u+=1)i[u]=void 0;for(const e in r.callbacks)if(r.callbacks.hasOwnProperty(e)){const t=e.toLowerCase();if(u=p.indexOf(t),u<0)throw new Error(`parser.js: Ast()): init: node '${e}' not a rule or udt name`);i[u]=r.callbacks[e]}},r.ruleDefined=e=>!!i[e],r.udtDefined=e=>!!i[n.length+e],r.down=(t,r)=>{const n=l.length;return c.push(n),l.push({name:r,thisIndex:n,thatIndex:void 0,state:e.SEM_PRE,callbackIndex:t,phraseIndex:void 0,phraseLength:void 0,stack:c.length}),n},r.up=(t,r,n,s)=>{const a=l.length,o=c.pop();return l.push({name:r,thisIndex:a,thatIndex:o,state:e.SEM_POST,callbackIndex:t,phraseIndex:n,phraseLength:s,stack:c.length}),l[o].thatIndex=a,l[o].phraseIndex=n,l[o].phraseLength=s,a},r.translate=t=>{let r,n;for(let s=0;s<l.length;s+=1)n=l[s],r=i[n.callbackIndex],r&&(n.state===e.SEM_PRE?r(e.SEM_PRE,a,n.phraseIndex,n.phraseLength,t):r&&r(e.SEM_POST,a,n.phraseIndex,n.phraseLength,t))},r.setLength=e=>{l.length=e,c.length=e>0?l[e-1].stack:0},r.getLength=()=>l.length,r.toXml=()=>{let r="",n=0;return r+='<?xml version="1.0" encoding="utf-8"?>\n',r+=`<root nodes="${l.length/2}" characters="${a.length}">\n`,r+="\x3c!-- input string --\x3e\n",r+=h(n+2),r+=t.charsToString(a),r+="\n",l.forEach(s=>{s.state===e.SEM_PRE?(n+=1,r+=h(n),r+=`<node name="${s.name}" index="${s.phraseIndex}" length="${s.phraseLength}">\n`,r+=h(n+2),r+=t.charsToString(a,s.phraseIndex,s.phraseLength),r+="\n"):(r+=h(n),r+=`</node>\x3c!-- name="${s.name}" --\x3e\n`,n-=1)}),r+="</root>\n",r}},p=function(){const e=m,t=d,r="parser.js: Trace(): ";let n,s,a,o="",i=0;const c=this,l=e=>{let t="",r=0;if(e>=0)for(;e--;)r+=1,5===r?(t+="|",r=0):t+=".";return t};c.init=(e,t,r)=>{s=e,a=t,n=r};const h=n=>{let o;switch(n.type){case e.ALT:o="ALT";break;case e.CAT:o="CAT";break;case e.REP:o=n.max===1/0?`REP(${n.min},inf)`:`REP(${n.min},${n.max})`;break;case e.RNM:o=`RNM(${s[n.index].name})`;break;case e.TRG:o=`TRG(${n.min},${n.max})`;break;case e.TBS:o=n.string.length>6?`TBS(${t.charsToString(n.string,0,3)}...)`:`TBS(${t.charsToString(n.string,0,6)})`;break;case e.TLS:o=n.string.length>6?`TLS(${t.charsToString(n.string,0,3)}...)`:`TLS(${t.charsToString(n.string,0,6)})`;break;case e.UDT:o=`UDT(${a[n.index].name})`;break;case e.AND:o="AND";break;case e.NOT:o="NOT";break;default:throw new Error(`${r}Trace: opName: unrecognized opcode`)}return o};c.down=(e,r)=>{const s=l(i),a=Math.min(100,n.length-r);let c=t.charsToString(n,r,a);a<n.length-r&&(c+="..."),c=`${s}|-|[${h(e)}]${c}\n`,o+=c,i+=1},c.up=(s,a,c,u)=>{const p=`${r}trace.up: `;i-=1;const f=l(i);let d,m,y;switch(a){case e.EMPTY:y="|E|",m="''";break;case e.MATCH:y="|M|",d=Math.min(100,u),m=d<u?`'${t.charsToString(n,c,d)}...'`:`'${t.charsToString(n,c,d)}'`;break;case e.NOMATCH:y="|N|",m="";break;default:throw new Error(`${p} unrecognized state`)}m=`${f}${y}[${h(s)}]${m}\n`,o+=m},c.displayTrace=()=>o},f=function(){const e=m;let t,r,n;const s=[],a=[],o=[];this.init=(e,n)=>{t=e,r=n,p()},this.collect=(t,r)=>{f(n,r.state,r.phraseLength),f(s[t.type],r.state,r.phraseLength),t.type===e.RNM&&f(a[t.index],r.state,r.phraseLength),t.type===e.UDT&&f(o[t.index],r.state,r.phraseLength)},this.displayStats=()=>{let t="";const r={match:0,empty:0,nomatch:0,total:0},n=(e,t,n,s,a)=>{r.match+=t,r.empty+=n,r.nomatch+=s,r.total+=a;return`${e} | ${i(t)} | ${i(n)} | ${i(s)} | ${i(a)} |\n`};return t+=" OPERATOR STATS\n",t+=" | MATCH | EMPTY | NOMATCH | TOTAL |\n",t+=n(" ALT",s[e.ALT].match,s[e.ALT].empty,s[e.ALT].nomatch,s[e.ALT].total),t+=n(" CAT",s[e.CAT].match,s[e.CAT].empty,s[e.CAT].nomatch,s[e.CAT].total),t+=n(" REP",s[e.REP].match,s[e.REP].empty,s[e.REP].nomatch,s[e.REP].total),t+=n(" RNM",s[e.RNM].match,s[e.RNM].empty,s[e.RNM].nomatch,s[e.RNM].total),t+=n(" TRG",s[e.TRG].match,s[e.TRG].empty,s[e.TRG].nomatch,s[e.TRG].total),t+=n(" TBS",s[e.TBS].match,s[e.TBS].empty,s[e.TBS].nomatch,s[e.TBS].total),t+=n(" TLS",s[e.TLS].match,s[e.TLS].empty,s[e.TLS].nomatch,s[e.TLS].total),t+=n(" UDT",s[e.UDT].match,s[e.UDT].empty,s[e.UDT].nomatch,s[e.UDT].total),t+=n(" AND",s[e.AND].match,s[e.AND].empty,s[e.AND].nomatch,s[e.AND].total),t+=n(" NOT",s[e.NOT].match,s[e.NOT].empty,s[e.NOT].nomatch,s[e.NOT].total),t+=n("TOTAL",r.match,r.empty,r.nomatch,r.total),t},this.displayHits=e=>{let t="";const r=(e,t,r,s,a)=>{n.match+=e,n.empty+=t,n.nomatch+=r,n.total+=s;return`| ${i(e)} | ${i(t)} | ${i(r)} | ${i(s)} | ${a}\n`};"string"==typeof e&&"a"===e.toLowerCase()[0]?(a.sort(c),o.sort(c),t+=" RULES/UDTS ALPHABETICALLY\n"):"string"==typeof e&&"i"===e.toLowerCase()[0]?(a.sort(h),o.sort(h),t+=" RULES/UDTS BY INDEX\n"):(a.sort(l),o.sort(l),t+=" RULES/UDTS BY HIT COUNT\n"),t+="| MATCH | EMPTY | NOMATCH | TOTAL | NAME\n";for(let e=0;e<a.length;e+=1){let n=a[e];n.total&&(t+=r(n.match,n.empty,n.nomatch,n.total,n.name))}for(let e=0;e<o.length;e+=1){let n=o[e];n.total&&(t+=r(n.match,n.empty,n.nomatch,n.total,n.name))}return t};const i=e=>e<10?` ${e}`:e<100?` ${e}`:e<1e3?` ${e}`:e<1e4?` ${e}`:e<1e5?` ${e}`:e<1e6?` ${e}`:`${e}`,c=(e,t)=>e.lower<t.lower?-1:e.lower>t.lower?1:0,l=(e,t)=>e.total<t.total?1:e.total>t.total?-1:c(e,t),h=(e,t)=>e.index<t.index?-1:e.index>t.index?1:0,u=function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},p=()=>{s.length=0,n=new u,s[e.ALT]=new u,s[e.CAT]=new u,s[e.REP]=new u,s[e.RNM]=new u,s[e.TRG]=new u,s[e.TBS]=new u,s[e.TLS]=new u,s[e.UDT]=new u,s[e.AND]=new u,s[e.NOT]=new u,a.length=0;for(let e=0;e<t.length;e+=1)a.push({empty:0,match:0,nomatch:0,total:0,name:t[e].name,lower:t[e].lower,index:t[e].index});if(r.length>0){o.length=0;for(let e=0;e<r.length;e+=1)o.push({empty:0,match:0,nomatch:0,total:0,name:r[e].name,lower:r[e].lower,index:r[e].index})}},f=(t,r)=>{switch(t.total+=1,r){case e.EMPTY:t.empty+=1;break;case e.MATCH:t.match+=1;break;case e.NOMATCH:t.nomatch+=1;break;default:throw new Error(`parser.js: Stats(): collect(): incStat(): unrecognized state: ${r}`)}}},d={stringToChars:e=>[...e].map(e=>e.codePointAt(0)),charsToString:(e,t,r)=>{let n=e;for(;!(void 0===t||t<0);){if(void 0===r){n=e.slice(t);break}if(r<=0)return"";n=e.slice(t,t+r);break}return String.fromCodePoint(...n)}},m={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,idName:e=>{switch(e){case m.ALT:return"ALT";case m.CAT:return"CAT";case m.REP:return"REP";case m.RNM:return"RNM";case m.TRG:return"TRG";case m.TBS:return"TBS";case m.TLS:return"TLS";case m.UDT:return"UDT";case m.AND:return"AND";case m.NOT:return"NOT";case m.ACTIVE:return"ACTIVE";case m.EMPTY:return"EMPTY";case m.MATCH:return"MATCH";case m.NOMATCH:return"NOMATCH";case m.SEM_PRE:return"SEM_PRE";case m.SEM_POST:return"SEM_POST";case m.SEM_OK:return"SEM_OK";default:return"UNRECOGNIZED STATE"}}};class y extends Error{constructor(e,t=void 0){if(super(e,t),this.name=this.constructor.name,"string"==typeof e&&(this.message=e),"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack,null!=t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"cause")&&!("cause"in this)){const{cause:e}=t;this.cause=e,e instanceof Error&&"stack"in e&&(this.stack=`${this.stack}\nCAUSE: ${e.stack}`)}if(null!=t&&"object"==typeof t){const{cause:e,...r}=t;Object.assign(this,r)}}}const g=y;const T=class extends g{},b=e=>(t,r,n,s,a)=>{if("object"!=typeof a||null===a||Array.isArray(a))throw new T("parser's user data must be an object");if(t===m.SEM_PRE){const t={type:e,text:d.charsToString(r,n,s),start:n,length:s,children:[]};if(a.stack.length>0){a.stack[a.stack.length-1].children.push(t)}else a.root=t;a.stack.push(t)}t===m.SEM_POST&&a.stack.pop()};const w=class extends u{constructor(){super(),this.callbacks["json-pointer"]=b("json-pointer"),this.callbacks["reference-token"]=b("reference-token"),this.callbacks.slash=b("text")}getTree(){const e={stack:[],root:null};return this.translate(e),delete e.stack,e}},k=e=>{if("string"!=typeof e)throw new TypeError("Reference token must be a string");return e.replace(/~1/g,"/").replace(/~0/g,"~")};const E=class extends w{getTree(){const{root:e}=super.getTree();return e.children.filter(({type:e})=>"reference-token"===e).map(({text:e})=>k(e))}};const A=class extends Array{toString(){return this.map(e=>`"${String(e)}"`).join(", ")}};const v=class extends p{inferExpectations(){const e=this.displayTrace().split("\n"),t=new Set;let r=-1;for(let n=0;n<e.length;n++){const s=e[n];if(s.includes("M|")){const e=s.match(/]'(.*)'$/);e&&e[1]&&(r=n)}if(n>r){const e=s.match(/N\|\[TLS\(([^)]+)\)]/);e&&t.add(e[1])}}return new A(...t)}},x=new l,O=(e,{translator:t=new E,stats:r=!1,trace:n=!1}={})=>{if("string"!=typeof e)throw new TypeError("JSON Pointer must be a string");try{const s=new h;t&&(s.ast=t),r&&(s.stats=new f),n&&(s.trace=new v);const a=s.parse(x,"json-pointer",e);return{result:a,tree:a.success&&t?s.ast.getTree():void 0,stats:s.stats,trace:s.trace}}catch(t){throw new T("Unexpected error during JSON Pointer parsing",{cause:t,jsonPointer:e})}};const M=class extends w{getTree(){return this.toXml()}},S=e=>{try{return O(e,{translator:null}).result.success}catch{return!1}},P=new l,$=new h,N=e=>{if("string"!=typeof e)return!1;try{return $.parse(P,"reference-token",e).success}catch{return!1}},L=new l,j=new h,_=e=>{if("string"!=typeof e)return!1;try{return j.parse(L,"array-location",e).success}catch{return!1}},C=new l,R=new h,I=e=>{if("string"!=typeof e)return!1;try{return R.parse(C,"array-index",e).success}catch{return!1}},D=new l,V=new h,H=e=>{if("string"!=typeof e)return!1;try{return V.parse(D,"array-dash",e).success}catch{return!1}},U=e=>{if("string"!=typeof e&&"number"!=typeof e)throw new TypeError("Reference token must be a string or number");return String(e).replace(/~/g,"~0").replace(/\//g,"~1")};const z=class extends g{},B=e=>{if(!Array.isArray(e))throw new TypeError("Reference tokens must be a list of strings or numbers");try{return 0===e.length?"":`/${e.map(e=>{if("string"!=typeof e&&"number"!=typeof e)throw new TypeError("Reference token must be a string or number");return U(String(e))}).join("/")}`}catch(t){throw new z("Unexpected error during JSON Pointer compilation",{cause:t,referenceTokens:e})}};const Y=class{#e;#t;#r;constructor(e,t={}){this.#e=e,this.#e.steps=[],this.#e.failed=!1,this.#e.failedAt=-1,this.#e.message=`JSON Pointer "${t.jsonPointer}" was successfully evaluated against the provided value`,this.#e.context={...t,realm:t.realm.name},this.#t=[],this.#r=t.realm}step({referenceToken:e,input:t,output:r,success:n=!0,reason:s}){const a=this.#t.length;this.#t.push(e);const o={referenceToken:e,referenceTokenPosition:a,input:t,inputType:this.#r.isObject(t)?"object":this.#r.isArray(t)?"array":"unrecognized",output:r,success:n};s&&(o.reason=s),this.#e.steps.push(o),n||(this.#e.failed=!0,this.#e.failedAt=a,this.#e.message=s)}};const F=class{name="";isArray(e){throw new g("Realm.isArray(node) must be implemented in a subclass")}isObject(e){throw new g("Realm.isObject(node) must be implemented in a subclass")}sizeOf(e){throw new g("Realm.sizeOf(node) must be implemented in a subclass")}has(e,t){throw new g("Realm.has(node) must be implemented in a subclass")}evaluate(e,t){throw new g("Realm.evaluate(node) must be implemented in a subclass")}};const J=class extends g{};const q=class extends J{};const G=class extends F{name="json";isArray(e){return Array.isArray(e)}isObject(e){return"object"==typeof e&&null!==e&&!this.isArray(e)}sizeOf(e){return this.isArray(e)?e.length:this.isObject(e)?Object.keys(e).length:0}has(e,t){if(this.isArray(e)){const r=Number(t),n=r>>>0;if(r!==n)throw new q(`Invalid array index "${t}": index must be an unsinged 32-bit integer`,{referenceToken:t,currentValue:e,realm:this.name});return n<this.sizeOf(e)&&Object.prototype.hasOwnProperty.call(e,r)}return!!this.isObject(e)&&Object.prototype.hasOwnProperty.call(e,t)}evaluate(e,t){return this.isArray(e)?e[Number(t)]:e[t]}};const K=class extends J{};const X=class extends J{},Z=(e,t,{strictArrays:r=!0,strictObjects:n=!0,realm:s=new G,trace:a=!0}={})=>{const{result:o,tree:i,trace:c}=O(t,{trace:!!a});if(!o.success){let e=`Invalid JSON Pointer: "${t}". Syntax error at position ${o.maxMatched}`;throw e+=c?`, expected ${c.inferExpectations()}`:"",new T(e,{jsonPointer:t})}const l="object"==typeof a&&null!==a?new Y(a,{jsonPointer:t,referenceTokens:i,strictArrays:r,strictObjects:n,realm:s,value:e}):null;try{let a;return i.reduce((e,o,c)=>{if(s.isArray(e)){if(H(o)){if(r)throw new q(`Invalid array index "-" at position ${c} in "${t}". The "-" token always refers to a nonexistent element during evaluation`,{jsonPointer:t,referenceTokens:i,referenceToken:o,referenceTokenPosition:c,currentValue:e,realm:s.name});return a=s.evaluate(e,String(s.sizeOf(e))),null==l||l.step({referenceToken:o,input:e,output:a}),a}if(!I(o))throw new q(`Invalid array index "${o}" at position ${c} in "${t}": index MUST be "0", or digits without a leading "0"`,{jsonPointer:t,referenceTokens:i,referenceToken:o,referenceTokenPosition:c,currentValue:e,realm:s.name});const n=Number(o);if(!Number.isSafeInteger(n))throw new q(`Invalid array index "${o}" at position ${c} in "${t}": index must be a safe integer`,{jsonPointer:t,referenceTokens:i,referenceToken:o,referenceTokenPosition:c,currentValue:e,realm:s.name});if(!s.has(e,o)&&r)throw new q(`Invalid array index "${o}" at position ${c} in "${t}": index not found in array`,{jsonPointer:t,referenceTokens:i,referenceToken:o,referenceTokenPosition:c,currentValue:e,realm:s.name});return a=s.evaluate(e,o),null==l||l.step({referenceToken:o,input:e,output:a}),a}if(s.isObject(e)){if(!s.has(e,o)&&n)throw new X(`Invalid object key "${o}" at position ${c} in "${t}": key not found in object`,{jsonPointer:t,referenceTokens:i,referenceToken:o,referenceTokenPosition:c,currentValue:e,realm:s.name});return a=s.evaluate(e,o),null==l||l.step({referenceToken:o,input:e,output:a}),a}throw new K(`Invalid reference token "${o}" at position ${c} in "${t}": cannot be applied to a non-object/non-array value`,{jsonPointer:t,referenceTokens:i,referenceToken:o,referenceTokenPosition:c,currentValue:e,realm:s.name})},e)}catch(e){if(null==l||l.step({referenceToken:e.referenceToken,input:e.currentValue,success:!1,reason:e.message}),e instanceof J)throw e;throw new J("Unexpected error during JSON Pointer evaluation",{cause:e,jsonPointer:t,referenceTokens:i})}};function W(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function Q(e){return function t(r){return 0===arguments.length||W(r)?t:e.apply(this,arguments)}}function ee(e){return function t(r,n){switch(arguments.length){case 0:return t;case 1:return W(r)?t:Q(function(t){return e(r,t)});default:return W(r)&&W(n)?t:W(r)?Q(function(t){return e(t,n)}):W(n)?Q(function(t){return e(r,t)}):e(r,n)}}}function te(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}function re(e,t,r){for(var n=0,s=r.length;n<s;){if(e(t,r[n]))return!0;n+=1}return!1}function ne(e,t){return Object.prototype.hasOwnProperty.call(t,e)}const se="function"==typeof Object.is?Object.is:function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};var ae=Object.prototype.toString;const oe=function(){return"[object Arguments]"===ae.call(arguments)?function(e){return"[object Arguments]"===ae.call(e)}:function(e){return ne("callee",e)}}();var ie=!{toString:null}.propertyIsEnumerable("toString"),ce=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],le=function(){return arguments.propertyIsEnumerable("length")}(),he=function(e,t){for(var r=0;r<e.length;){if(e[r]===t)return!0;r+=1}return!1};const ue="function"!=typeof Object.keys||le?Q(function(e){if(Object(e)!==e)return[];var t,r,n=[],s=le&&oe(e);for(t in e)!ne(t,e)||s&&"length"===t||(n[n.length]=t);if(ie)for(r=ce.length-1;r>=0;)ne(t=ce[r],e)&&!he(n,t)&&(n[n.length]=t),r-=1;return n}):Q(function(e){return Object(e)!==e?[]:Object.keys(e)});const pe=Q(function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});function fe(e,t,r,n){var s=te(e);function a(e,t){return de(e,t,r.slice(),n.slice())}return!re(function(e,t){return!re(a,t,e)},te(t),s)}function de(e,t,r,n){if(se(e,t))return!0;var s,a,o=pe(e);if(o!==pe(t))return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(o){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===(s=e.constructor,null==(a=String(s).match(/^function (\w*)/))?"":a[1]))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!se(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!se(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}for(var i=r.length-1;i>=0;){if(r[i]===e)return n[i]===t;i-=1}switch(o){case"Map":return e.size===t.size&&fe(e.entries(),t.entries(),r.concat([e]),n.concat([t]));case"Set":return e.size===t.size&&fe(e.values(),t.values(),r.concat([e]),n.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var c=ue(e);if(c.length!==ue(t).length)return!1;var l=r.concat([e]),h=n.concat([t]);for(i=c.length-1;i>=0;){var u=c[i];if(!ne(u,t)||!de(t[u],e[u],l,h))return!1;i-=1}return!0}const me=ee(function(e,t){return de(e,t,[],[])});const ye=class{key;value;constructor(e,t){this.key=e,this.value=t}toValue(){return{key:this.key?.toValue(),value:this.value?.toValue()}}};class ge{elements;constructor(e){this.elements=e??[]}toValue(){return this.elements.map(e=>({key:e.key?.toValue(),value:e.value?.toValue()}))}map(e,t){return this.elements.map(r=>{const n=r.value,s=r.key;if(void 0===n||void 0===s)throw new Error("MemberElement must have both key and value");return void 0!==t?e.call(t,n,s,r):e(n,s,r)})}filter(e,t){const r=this.elements.filter(r=>{const n=r.value,s=r.key;return void 0!==n&&void 0!==s&&(void 0!==t?e.call(t,n,s,r):e(n,s,r))});return new ge(r)}reject(e,t){const r=[];for(const n of this.elements){const s=n.value,a=n.key;void 0!==s&&void 0!==a&&(e.call(t,s,a,n)||r.push(n))}return new ge(r)}forEach(e,t){this.elements.forEach((r,n)=>{const s=r.value,a=r.key;void 0!==s&&void 0!==a&&(void 0!==t?e.call(t,s,a,r,n):e(s,a,r,n))})}find(e,t){return this.elements.find(r=>{const n=r.value,s=r.key;return void 0!==n&&void 0!==s&&(void 0!==t?e.call(t,n,s,r):e(n,s,r))})}keys(){return this.elements.map(e=>e.key?.toValue()).filter(e=>void 0!==e)}values(){return this.elements.map(e=>e.value?.toValue()).filter(e=>void 0!==e)}get length(){return this.elements.length}get isEmpty(){return 0===this.length}get first(){return this.elements[0]}get(e){return this.elements[e]}push(e){return this.elements.push(e),this}includesKey(e){return this.elements.some(t=>t.key?.equals(e))}[Symbol.iterator](){return this.elements[Symbol.iterator]()}}const Te=ge;class be{parent;startLine;startCharacter;startOffset;endLine;endCharacter;endOffset;_storedElement="element";_content;_meta;_attributes;constructor(e,t,r){void 0!==t&&(this.meta=t),void 0!==r&&(this.attributes=r),void 0!==e&&(this.content=e)}get element(){return this._storedElement}set element(e){this._storedElement=e}get content(){return this._content}set content(e){if(e instanceof be)this._content=e;else if(null!=e&&"string"!=typeof e&&"number"!=typeof e&&"boolean"!=typeof e&&"bigint"!=typeof e&&"symbol"!=typeof e)if(e instanceof ye)this._content=e;else if(e instanceof Te)this._content=e.elements;else if(Array.isArray(e))this._content=e.map(e=>this.refract(e));else{if("object"!=typeof e)throw new Error("Cannot set content to value of type "+typeof e);this._content=Object.entries(e).map(([e,t])=>new this.MemberElement(e,t))}else this._content=e}get meta(){if(!this._meta){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._meta=new this.ObjectElement}return this._meta}set meta(e){e instanceof be?this._meta=e:this.meta.set(e??{})}get attributes(){if(!this._attributes){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._attributes=new this.ObjectElement}return this._attributes}set attributes(e){e instanceof be?this._attributes=e:this.attributes.set(e??{})}get id(){return this.getMetaProperty("id","")}set id(e){this.setMetaProperty("id",e)}get classes(){return this.getMetaProperty("classes",[])}set classes(e){this.setMetaProperty("classes",e)}get links(){return this.getMetaProperty("links",[])}set links(e){this.setMetaProperty("links",e)}get children(){const{_content:e}=this;if(Array.isArray(e))return e;if(e instanceof ye){const t=[];return e.key&&t.push(e.key),e.value&&t.push(e.value),t}return e instanceof be?[e]:[]}get isFrozen(){return Object.isFrozen(this)}freeze(){if(!this.isFrozen){this._meta&&(this._meta.parent=this,this._meta.freeze()),this._attributes&&(this._attributes.parent=this,this._attributes.freeze());for(const e of this.children)e.parent=this,e.freeze();Array.isArray(this._content)&&Object.freeze(this._content),Object.freeze(this)}}toValue(){const{_content:e}=this;return e instanceof be||e instanceof ye?e.toValue():Array.isArray(e)?e.map(e=>e.toValue()):e}equals(e){const t=e instanceof be?e.toValue():e;return me(this.toValue(),t)}primitive(){}set(e){return this.content=e,this}toRef(e){const t=this.id.toValue();if(""===t)throw new Error("Cannot create reference to an element without an ID");const r=new this.RefElement(t);return"string"==typeof e&&(r.path=this.refract(e)),r}getMetaProperty(e,t){if(!this.meta.hasKey(e)){if(this.isFrozen){const e=this.refract(t);return e.freeze(),e}this.meta.set(e,t)}return this.meta.get(e)}setMetaProperty(e,t){this.meta.set(e,t)}hasMetaProperty(e){return!this.isMetaEmpty&&this.meta.hasKey(e)}get isMetaEmpty(){return void 0===this._meta||this.meta.isEmpty}getAttributesProperty(e,t){if(!this.hasAttributesProperty(e)){if(this.isFrozen){const e=this.refract(t);return e.freeze(),e}this.attributes.set(e,t)}return this.attributes.get(e)}setAttributesProperty(e,t){this.attributes.set(e,t)}hasAttributesProperty(e){return!this.isAttributesEmpty&&this.attributes.hasKey(e)}get isAttributesEmpty(){return void 0===this._attributes||this.attributes.isEmpty}}const we=be;class ke extends we{constructor(e,t,r){super(e||[],t,r)}get length(){return this._content.length}get isEmpty(){return 0===this.length}get first(){return this._content[0]}get second(){return this._content[1]}get last(){return this._content.at(-1)}push(...e){for(const t of e)this._content.push(this.refract(t));return this}shift(){return this._content.shift()}unshift(e){this._content.unshift(this.refract(e))}includes(e){return this._content.some(t=>t.equals(e))}findElements(e,t){const r=t||{},n=!!r.recursive,s=void 0===r.results?[]:r.results;for(let t=0;t<this._content.length;t+=1){const r=this._content[t],a=r;n&&"function"==typeof a.findElements&&a.findElements(e,{results:s,recursive:n}),e(r,t,void 0)&&s.push(r)}return s}find(e){const t=this.findElements(e,{recursive:!0});return new this.ArrayElement(t)}findByElement(e){return this.find(t=>t.element===e)}findByClass(e){return this.find(t=>{const r=t.classes;return"function"==typeof r.includes&&r.includes(e)})}getById(e){return this.find(t=>t.id.toValue()===e).first}concat(e){return new(0,this.constructor)(this._content.concat(e._content))}[Symbol.iterator](){return this._content[Symbol.iterator]()}}const Ee=ke;const Ae=class extends Ee{constructor(e,t,r){super(e||[],t,r),this.element="array"}primitive(){return"array"}get(e){return this._content[e]}getValue(e){const t=this.get(e);if(t)return t.toValue()}set(e,t){return"number"==typeof e&&void 0!==t?this._content[e]=this.refract(t):this.content=e,this}remove(e){return this._content.splice(e,1)[0]??null}map(e,t){return this._content.map(e,t)}flatMap(e,t){return this._content.flatMap(e,t)}compactMap(e,t){const r=[];for(const n of this._content){const s=e.call(t,n);s&&r.push(s)}return r}filter(e,t){const r=this._content.filter(e,t);return new this.constructor(r)}reject(e,t){const r=[];for(const n of this._content)e.call(t,n)||r.push(n);return new this.constructor(r)}reduce(e,t){let r,n;void 0!==t?(r=0,n=this.refract(t)):(r=1,n=this.first);for(let t=r;t<this.length;t+=1){const r=e(n,this._content[t],t,this);n=void 0===r?r:this.refract(r)}return n}forEach(e,t){this._content.forEach((r,n)=>{e.call(t,r,n)})}empty(){return new this.constructor([])}};const ve=class extends we{constructor(e,t,r,n){super(new ye,r,n),this.element="member",void 0!==e&&(this.key=e),arguments.length>=2&&(this.value=t)}primitive(){return"member"}get key(){return this._content.key}set key(e){this._content.key=this.refract(e)}get value(){return this._content.value}set value(e){this._content.value=void 0===e?void 0:this.refract(e)}};const xe=class extends Ee{constructor(e,t,r){super(e||[],t,r),this.element="object"}primitive(){return"object"}toValue(){return this._content.reduce((e,t)=>(e[t.key.toValue()]=t.value?t.value.toValue():void 0,e),{})}get(e){const t=this.getMember(e);if(t)return t.value}getValue(e){const t=this.get(e);if(t)return t.toValue()}getMember(e){if(void 0!==e)return this._content.find(t=>t.key.toValue()===e)}remove(e){let t=null;return this.content=this._content.filter(r=>r.key.toValue()!==e||(t=r,!1)),t}getKey(e){const t=this.getMember(e);if(t)return t.key}set(e,t){if("string"==typeof e){const r=this.getMember(e);r?r.value=t:this._content.push(new ve(e,t))}else if("object"==typeof e&&!Array.isArray(e))for(const t of Object.keys(e))this.set(t,e[t]);return this}keys(){return this._content.map(e=>e.key.toValue())}values(){return this._content.map(e=>e.value.toValue())}hasKey(e){return this._content.some(t=>t.key.equals(e))}items(){return this._content.map(e=>[e.key.toValue(),e.value.toValue()])}map(e,t){return this._content.map(r=>e.call(t,r.value,r.key,r))}compactMap(e,t){const r=[];return this.forEach((n,s,a)=>{const o=e.call(t,n,s,a);o&&r.push(o)}),r}filter(e,t){return new Te(this._content).filter(e,t)}reject(e,t){const r=[];for(const n of this._content)e.call(t,n.value,n.key,n)||r.push(n);return new Te(r)}forEach(e,t){this._content.forEach(r=>e.call(t,r.value,r.key,r))}reduce(e,t){let r,n;void 0!==t?(r=0,n=this.refract(t)):(r=1,n=this._content[0]?.value);for(let t=r;t<this._content.length;t+=1){const r=this._content[t],s=e(n,r.value,r.key,r,this);n=void 0===s?s:this.refract(s)}return n}empty(){return new this.constructor([])}},Oe=e=>e instanceof Ae,Me=e=>e instanceof xe;const Se=class extends F{name="apidom";isArray(e){return Oe(e)}isObject(e){return Me(e)}sizeOf(e){return this.isArray(e)||this.isObject(e)?e.length:0}has(e,t){if(this.isArray(e)){const r=Number(t),n=r>>>0;if(r!==n)throw new q(`Invalid array index "${t}": index must be an unsinged 32-bit integer`,{referenceToken:t,currentValue:e,realm:this.name});return n<this.sizeOf(e)}if(this.isObject(e)){const r=e.keys(),n=new Set(r);if(r.length!==n.size)throw new X(`Object key "${t}" is not unique — JSON Pointer requires unique member names`,{referenceToken:t,currentValue:e,realm:this.name});return e.hasKey(t)}return!1}evaluate(e,t){return this.isArray(e)?e.get(Number(t)):e.get(t)}},Pe=new Se,$e=(e,t,r={})=>Z(e,t,{...r,realm:Pe});return t})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apidomJsonPointer=t():e.apidomJsonPointer=t()}(self,()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ASTTranslator:()=>E,ApiDOMEvaluationRealm:()=>Se,CSTTranslator:()=>w,Grammar:()=>l,JSONPointerCompileError:()=>z,JSONPointerError:()=>g,JSONPointerEvaluateError:()=>J,JSONPointerIndexError:()=>q,JSONPointerKeyError:()=>X,JSONPointerParseError:()=>T,JSONPointerTypeError:()=>K,JSONString:()=>r,URIFragmentIdentifier:()=>n,XMLTranslator:()=>M,compile:()=>B,escape:()=>U,evaluate:()=>$e,parse:()=>O,testArrayDash:()=>H,testArrayIndex:()=>I,testArrayLocation:()=>_,testJSONPointer:()=>S,testReferenceToken:()=>N,unescape:()=>k});var r={};e.r(r),e.d(r,{from:()=>a,to:()=>s});var n={};e.r(n),e.d(n,{from:()=>i,fromURIReference:()=>c,to:()=>o});const s=e=>JSON.stringify(e),a=e=>{try{return String(JSON.parse(e))}catch{return e}},o=e=>`#${[...e].map(e=>/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/.test(e)?e:encodeURIComponent(e)).join("")}`,i=e=>{try{const t=e.startsWith("#")?e.slice(1):e;return decodeURIComponent(t)}catch{return e}},c=e=>{const t=e.indexOf("#"),r=-1===t?"#":e.substring(t);return i(r)};function l(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"json-pointer",lower:"json-pointer",index:0,isBkr:!1},this.rules[1]={name:"reference-token",lower:"reference-token",index:1,isBkr:!1},this.rules[2]={name:"unescaped",lower:"unescaped",index:2,isBkr:!1},this.rules[3]={name:"escaped",lower:"escaped",index:3,isBkr:!1},this.rules[4]={name:"array-location",lower:"array-location",index:4,isBkr:!1},this.rules[5]={name:"array-index",lower:"array-index",index:5,isBkr:!1},this.rules[6]={name:"array-dash",lower:"array-dash",index:6,isBkr:!1},this.rules[7]={name:"slash",lower:"slash",index:7,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:3,min:0,max:1/0},this.rules[0].opcodes[1]={type:2,children:[2,3]},this.rules[0].opcodes[2]={type:4,index:7},this.rules[0].opcodes[3]={type:4,index:1},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:3,min:0,max:1/0},this.rules[1].opcodes[1]={type:1,children:[2,3]},this.rules[1].opcodes[2]={type:4,index:2},this.rules[1].opcodes[3]={type:4,index:3},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:1,children:[1,2,3]},this.rules[2].opcodes[1]={type:5,min:0,max:46},this.rules[2].opcodes[2]={type:5,min:48,max:125},this.rules[2].opcodes[3]={type:5,min:127,max:1114111},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:2,children:[1,2]},this.rules[3].opcodes[1]={type:7,string:[126]},this.rules[3].opcodes[2]={type:1,children:[3,4]},this.rules[3].opcodes[3]={type:7,string:[48]},this.rules[3].opcodes[4]={type:7,string:[49]},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:4,index:5},this.rules[4].opcodes[2]={type:4,index:6},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:1,children:[1,2]},this.rules[5].opcodes[1]={type:6,string:[48]},this.rules[5].opcodes[2]={type:2,children:[3,4]},this.rules[5].opcodes[3]={type:5,min:49,max:57},this.rules[5].opcodes[4]={type:3,min:0,max:1/0},this.rules[5].opcodes[5]={type:5,min:48,max:57},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:7,string:[45]},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:7,string:[47]},this.toString=function(){let e="";return e+="; JavaScript Object Notation (JSON) Pointer ABNF syntax\n",e+="; https://datatracker.ietf.org/doc/html/rfc6901\n",e+="json-pointer = *( slash reference-token ) ; MODIFICATION: surrogate text rule used\n",e+="reference-token = *( unescaped / escaped )\n",e+="unescaped = %x00-2E / %x30-7D / %x7F-10FFFF\n",e+=" ; %x2F ('/') and %x7E ('~') are excluded from 'unescaped'\n",e+='escaped = "~" ( "0" / "1" )\n',e+=" ; representing '~' and '/', respectively\n",e+="\n",e+="; https://datatracker.ietf.org/doc/html/rfc6901#section-4\n",e+="array-location = array-index / array-dash\n",e+="array-index = %x30 / ( %x31-39 *(%x30-39) )\n",e+=' ; "0", or digits without a leading "0"\n',e+='array-dash = "-"\n',e+="\n",e+="; Surrogate named rules\n",e+='slash = "/"\n','; JavaScript Object Notation (JSON) Pointer ABNF syntax\n; https://datatracker.ietf.org/doc/html/rfc6901\njson-pointer = *( slash reference-token ) ; MODIFICATION: surrogate text rule used\nreference-token = *( unescaped / escaped )\nunescaped = %x00-2E / %x30-7D / %x7F-10FFFF\n ; %x2F (\'/\') and %x7E (\'~\') are excluded from \'unescaped\'\nescaped = "~" ( "0" / "1" )\n ; representing \'~\' and \'/\', respectively\n\n; https://datatracker.ietf.org/doc/html/rfc6901#section-4\narray-location = array-index / array-dash\narray-index = %x30 / ( %x31-39 *(%x30-39) )\n ; "0", or digits without a leading "0"\narray-dash = "-"\n\n; Surrogate named rules\nslash = "/"\n'}}const h=function(){const e=m,t=d,r=this,n="parser.js: Parser(): ";r.ast=void 0,r.stats=void 0,r.trace=void 0,r.callbacks=[];let s,a,o,i,c,l,h,u=0,p=0,f=0,y=0,g=0,T=new function(){this.state=e.ACTIVE,this.phraseLength=0,this.refresh=()=>{this.state=e.ACTIVE,this.phraseLength=0}};r.parse=(d,m,b,w)=>{const E=`${n}parse(): `;u=0,p=0,f=0,y=0,g=0,s=void 0,a=void 0,o=void 0,i=void 0,T.refresh(),c=void 0,l=void 0,h=void 0,i=t.stringToChars(b),s=d.rules,a=d.udts;const A=m.toLowerCase();let v;for(const e in s)if(s.hasOwnProperty(e)&&A===s[e].lower){v=s[e].index;break}if(void 0===v)throw new Error(`${E}start rule name '${startRule}' not recognized`);(()=>{const e=`${n}initializeCallbacks(): `;let t,o;for(c=[],l=[],t=0;t<s.length;t+=1)c[t]=void 0;for(t=0;t<a.length;t+=1)l[t]=void 0;const i=[];for(t=0;t<s.length;t+=1)i.push(s[t].lower);for(t=0;t<a.length;t+=1)i.push(a[t].lower);for(const n in r.callbacks)if(r.callbacks.hasOwnProperty(n)){if(t=i.indexOf(n.toLowerCase()),t<0)throw new Error(`${e}syntax callback '${n}' not a rule or udt name`);if(o=r.callbacks[n]?r.callbacks[n]:void 0,"function"!=typeof o&&void 0!==o)throw new Error(`${e}syntax callback[${n}] must be function reference or falsy)`);t<s.length?c[t]=o:l[t-s.length]=o}})(),r.trace&&r.trace.init(s,a,i),r.stats&&r.stats.init(s,a),r.ast&&r.ast.init(s,a,i),h=w,o=[{type:e.RNM,index:v}],k(0,0),o=void 0;let x=!1;switch(T.state){case e.ACTIVE:throw new Error(`${E}final state should never be 'ACTIVE'`);case e.NOMATCH:x=!1;break;case e.EMPTY:case e.MATCH:x=T.phraseLength===i.length;break;default:throw new Error("unrecognized state")}return{success:x,state:T.state,stateName:e.idName(T.state),length:i.length,matched:T.phraseLength,maxMatched:g,maxTreeDepth:f,nodeHits:y}};const b=(t,r,s,a)=>{if(r.phraseLength>s){let e=`${n}opRNM(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${r.phraseLength}`,e+=` must be <= remaining chars: ${s}`,new Error(e)}switch(r.state){case e.ACTIVE:if(!a)throw new Error(`${n}opRNM(${t.name}): callback function return error. ACTIVE state not allowed.`);break;case e.EMPTY:r.phraseLength=0;break;case e.MATCH:0===r.phraseLength&&(r.state=e.EMPTY);break;case e.NOMATCH:r.phraseLength=0;break;default:throw new Error(`${n}opRNM(${t.name}): callback function return error. Unrecognized return state: ${r.state}`)}},w=(t,c)=>{let p,f,d;const m=o[t],y=a[m.index];T.UdtIndex=y.index,u||(d=r.ast&&r.ast.udtDefined(m.index),d&&(f=s.length+m.index,p=r.ast.getLength(),r.ast.down(f,y.name)));const g=i.length-c;l[m.index](T,i,c,h),((t,r,s)=>{if(r.phraseLength>s){let e=`${n}opUDT(${t.name}): callback function error: `;throw e+=`sysData.phraseLength: ${r.phraseLength}`,e+=` must be <= remaining chars: ${s}`,new Error(e)}switch(r.state){case e.ACTIVE:throw new Error(`${n}opUDT(${t.name}) ACTIVE state return not allowed.`);case e.EMPTY:if(!t.empty)throw new Error(`${n}opUDT(${t.name}) may not return EMPTY.`);r.phraseLength=0;break;case e.MATCH:if(0===r.phraseLength){if(!t.empty)throw new Error(`${n}opUDT(${t.name}) may not return EMPTY.`);r.state=e.EMPTY}break;case e.NOMATCH:r.phraseLength=0;break;default:throw new Error(`${n}opUDT(${t.name}): callback function return error. Unrecognized return state: ${r.state}`)}})(y,T,g),u||d&&(T.state===e.NOMATCH?r.ast.setLength(p):r.ast.up(f,y.name,c,T.phraseLength))},k=(t,a)=>{const l=`${n}opExecute(): `,d=o[t];switch(y+=1,p>f&&(f=p),p+=1,T.refresh(),r.trace&&r.trace.down(d,a),d.type){case e.ALT:((t,r)=>{const n=o[t];for(let t=0;t<n.children.length&&(k(n.children[t],r),T.state===e.NOMATCH);t+=1);})(t,a);break;case e.CAT:((t,n)=>{let s,a,i,c;const l=o[t];r.ast&&(a=r.ast.getLength()),s=!0,i=n,c=0;for(let t=0;t<l.children.length;t+=1){if(k(l.children[t],i),T.state===e.NOMATCH){s=!1;break}i+=T.phraseLength,c+=T.phraseLength}s?(T.state=0===c?e.EMPTY:e.MATCH,T.phraseLength=c):(T.state=e.NOMATCH,T.phraseLength=0,r.ast&&r.ast.setLength(a))})(t,a);break;case e.REP:((t,n)=>{let s,a,c,l;const h=o[t];if(0===h.max)return T.state=e.EMPTY,void(T.phraseLength=0);for(a=n,c=0,l=0,r.ast&&(s=r.ast.getLength());!(a>=i.length)&&(k(t+1,a),T.state!==e.NOMATCH)&&T.state!==e.EMPTY&&(l+=1,c+=T.phraseLength,a+=T.phraseLength,l!==h.max););T.state===e.EMPTY||l>=h.min?(T.state=0===c?e.EMPTY:e.MATCH,T.phraseLength=c):(T.state=e.NOMATCH,T.phraseLength=0,r.ast&&r.ast.setLength(s))})(t,a);break;case e.RNM:((t,n)=>{let a,l,p;const f=o[t],d=s[f.index],m=c[d.index];if(u||(l=r.ast&&r.ast.ruleDefined(f.index),l&&(a=r.ast.getLength(),r.ast.down(f.index,s[f.index].name))),m){const t=i.length-n;m(T,i,n,h),b(d,T,t,!0),T.state===e.ACTIVE&&(p=o,o=d.opcodes,k(0,n),o=p,m(T,i,n,h),b(d,T,t,!1))}else p=o,o=d.opcodes,k(0,n,T),o=p;u||l&&(T.state===e.NOMATCH?r.ast.setLength(a):r.ast.up(f.index,d.name,n,T.phraseLength))})(t,a);break;case e.TRG:((t,r)=>{const n=o[t];T.state=e.NOMATCH,r<i.length&&n.min<=i[r]&&i[r]<=n.max&&(T.state=e.MATCH,T.phraseLength=1)})(t,a);break;case e.TBS:((t,r)=>{const n=o[t],s=n.string.length;if(T.state=e.NOMATCH,r+s<=i.length){for(let e=0;e<s;e+=1)if(i[r+e]!==n.string[e])return;T.state=e.MATCH,T.phraseLength=s}})(t,a);break;case e.TLS:((t,r)=>{let n;const s=o[t];T.state=e.NOMATCH;const a=s.string.length;if(0!==a){if(r+a<=i.length){for(let e=0;e<a;e+=1)if(n=i[r+e],n>=65&&n<=90&&(n+=32),n!==s.string[e])return;T.state=e.MATCH,T.phraseLength=a}}else T.state=e.EMPTY})(t,a);break;case e.UDT:w(t,a);break;case e.AND:((t,r)=>{switch(u+=1,k(t+1,r),u-=1,T.phraseLength=0,T.state){case e.EMPTY:case e.MATCH:T.state=e.EMPTY;break;case e.NOMATCH:T.state=e.NOMATCH;break;default:throw new Error(`opAND: invalid state ${T.state}`)}})(t,a);break;case e.NOT:((t,r)=>{switch(u+=1,k(t+1,r),u-=1,T.phraseLength=0,T.state){case e.EMPTY:case e.MATCH:T.state=e.NOMATCH;break;case e.NOMATCH:T.state=e.EMPTY;break;default:throw new Error(`opNOT: invalid state ${T.state}`)}})(t,a);break;default:throw new Error(`${l}unrecognized operator`)}u||a+T.phraseLength>g&&(g=a+T.phraseLength),r.stats&&r.stats.collect(d,T),r.trace&&r.trace.up(d,T.state,a,T.phraseLength),p-=1}},u=function(){const e=m,t=d,r=this;let n,s,a,o=0;const i=[],c=[],l=[];function h(e){let t="";for(;e-- >0;)t+=" ";return t}r.callbacks=[],r.init=(e,t,h)=>{let u;c.length=0,l.length=0,o=0,n=e,s=t,a=h;const p=[];for(u=0;u<n.length;u+=1)p.push(n[u].lower);for(u=0;u<s.length;u+=1)p.push(s[u].lower);for(o=n.length+s.length,u=0;u<o;u+=1)i[u]=void 0;for(const e in r.callbacks)if(r.callbacks.hasOwnProperty(e)){const t=e.toLowerCase();if(u=p.indexOf(t),u<0)throw new Error(`parser.js: Ast()): init: node '${e}' not a rule or udt name`);i[u]=r.callbacks[e]}},r.ruleDefined=e=>!!i[e],r.udtDefined=e=>!!i[n.length+e],r.down=(t,r)=>{const n=l.length;return c.push(n),l.push({name:r,thisIndex:n,thatIndex:void 0,state:e.SEM_PRE,callbackIndex:t,phraseIndex:void 0,phraseLength:void 0,stack:c.length}),n},r.up=(t,r,n,s)=>{const a=l.length,o=c.pop();return l.push({name:r,thisIndex:a,thatIndex:o,state:e.SEM_POST,callbackIndex:t,phraseIndex:n,phraseLength:s,stack:c.length}),l[o].thatIndex=a,l[o].phraseIndex=n,l[o].phraseLength=s,a},r.translate=t=>{let r,n;for(let s=0;s<l.length;s+=1)n=l[s],r=i[n.callbackIndex],r&&(n.state===e.SEM_PRE?r(e.SEM_PRE,a,n.phraseIndex,n.phraseLength,t):r&&r(e.SEM_POST,a,n.phraseIndex,n.phraseLength,t))},r.setLength=e=>{l.length=e,c.length=e>0?l[e-1].stack:0},r.getLength=()=>l.length,r.toXml=()=>{let r="",n=0;return r+='<?xml version="1.0" encoding="utf-8"?>\n',r+=`<root nodes="${l.length/2}" characters="${a.length}">\n`,r+="\x3c!-- input string --\x3e\n",r+=h(n+2),r+=t.charsToString(a),r+="\n",l.forEach(s=>{s.state===e.SEM_PRE?(n+=1,r+=h(n),r+=`<node name="${s.name}" index="${s.phraseIndex}" length="${s.phraseLength}">\n`,r+=h(n+2),r+=t.charsToString(a,s.phraseIndex,s.phraseLength),r+="\n"):(r+=h(n),r+=`</node>\x3c!-- name="${s.name}" --\x3e\n`,n-=1)}),r+="</root>\n",r}},p=function(){const e=m,t=d,r="parser.js: Trace(): ";let n,s,a,o="",i=0;const c=this,l=e=>{let t="",r=0;if(e>=0)for(;e--;)r+=1,5===r?(t+="|",r=0):t+=".";return t};c.init=(e,t,r)=>{s=e,a=t,n=r};const h=n=>{let o;switch(n.type){case e.ALT:o="ALT";break;case e.CAT:o="CAT";break;case e.REP:o=n.max===1/0?`REP(${n.min},inf)`:`REP(${n.min},${n.max})`;break;case e.RNM:o=`RNM(${s[n.index].name})`;break;case e.TRG:o=`TRG(${n.min},${n.max})`;break;case e.TBS:o=n.string.length>6?`TBS(${t.charsToString(n.string,0,3)}...)`:`TBS(${t.charsToString(n.string,0,6)})`;break;case e.TLS:o=n.string.length>6?`TLS(${t.charsToString(n.string,0,3)}...)`:`TLS(${t.charsToString(n.string,0,6)})`;break;case e.UDT:o=`UDT(${a[n.index].name})`;break;case e.AND:o="AND";break;case e.NOT:o="NOT";break;default:throw new Error(`${r}Trace: opName: unrecognized opcode`)}return o};c.down=(e,r)=>{const s=l(i),a=Math.min(100,n.length-r);let c=t.charsToString(n,r,a);a<n.length-r&&(c+="..."),c=`${s}|-|[${h(e)}]${c}\n`,o+=c,i+=1},c.up=(s,a,c,u)=>{const p=`${r}trace.up: `;i-=1;const f=l(i);let d,m,y;switch(a){case e.EMPTY:y="|E|",m="''";break;case e.MATCH:y="|M|",d=Math.min(100,u),m=d<u?`'${t.charsToString(n,c,d)}...'`:`'${t.charsToString(n,c,d)}'`;break;case e.NOMATCH:y="|N|",m="";break;default:throw new Error(`${p} unrecognized state`)}m=`${f}${y}[${h(s)}]${m}\n`,o+=m},c.displayTrace=()=>o},f=function(){const e=m;let t,r,n;const s=[],a=[],o=[];this.init=(e,n)=>{t=e,r=n,p()},this.collect=(t,r)=>{f(n,r.state,r.phraseLength),f(s[t.type],r.state,r.phraseLength),t.type===e.RNM&&f(a[t.index],r.state,r.phraseLength),t.type===e.UDT&&f(o[t.index],r.state,r.phraseLength)},this.displayStats=()=>{let t="";const r={match:0,empty:0,nomatch:0,total:0},n=(e,t,n,s,a)=>{r.match+=t,r.empty+=n,r.nomatch+=s,r.total+=a;return`${e} | ${i(t)} | ${i(n)} | ${i(s)} | ${i(a)} |\n`};return t+=" OPERATOR STATS\n",t+=" | MATCH | EMPTY | NOMATCH | TOTAL |\n",t+=n(" ALT",s[e.ALT].match,s[e.ALT].empty,s[e.ALT].nomatch,s[e.ALT].total),t+=n(" CAT",s[e.CAT].match,s[e.CAT].empty,s[e.CAT].nomatch,s[e.CAT].total),t+=n(" REP",s[e.REP].match,s[e.REP].empty,s[e.REP].nomatch,s[e.REP].total),t+=n(" RNM",s[e.RNM].match,s[e.RNM].empty,s[e.RNM].nomatch,s[e.RNM].total),t+=n(" TRG",s[e.TRG].match,s[e.TRG].empty,s[e.TRG].nomatch,s[e.TRG].total),t+=n(" TBS",s[e.TBS].match,s[e.TBS].empty,s[e.TBS].nomatch,s[e.TBS].total),t+=n(" TLS",s[e.TLS].match,s[e.TLS].empty,s[e.TLS].nomatch,s[e.TLS].total),t+=n(" UDT",s[e.UDT].match,s[e.UDT].empty,s[e.UDT].nomatch,s[e.UDT].total),t+=n(" AND",s[e.AND].match,s[e.AND].empty,s[e.AND].nomatch,s[e.AND].total),t+=n(" NOT",s[e.NOT].match,s[e.NOT].empty,s[e.NOT].nomatch,s[e.NOT].total),t+=n("TOTAL",r.match,r.empty,r.nomatch,r.total),t},this.displayHits=e=>{let t="";const r=(e,t,r,s,a)=>{n.match+=e,n.empty+=t,n.nomatch+=r,n.total+=s;return`| ${i(e)} | ${i(t)} | ${i(r)} | ${i(s)} | ${a}\n`};"string"==typeof e&&"a"===e.toLowerCase()[0]?(a.sort(c),o.sort(c),t+=" RULES/UDTS ALPHABETICALLY\n"):"string"==typeof e&&"i"===e.toLowerCase()[0]?(a.sort(h),o.sort(h),t+=" RULES/UDTS BY INDEX\n"):(a.sort(l),o.sort(l),t+=" RULES/UDTS BY HIT COUNT\n"),t+="| MATCH | EMPTY | NOMATCH | TOTAL | NAME\n";for(let e=0;e<a.length;e+=1){let n=a[e];n.total&&(t+=r(n.match,n.empty,n.nomatch,n.total,n.name))}for(let e=0;e<o.length;e+=1){let n=o[e];n.total&&(t+=r(n.match,n.empty,n.nomatch,n.total,n.name))}return t};const i=e=>e<10?` ${e}`:e<100?` ${e}`:e<1e3?` ${e}`:e<1e4?` ${e}`:e<1e5?` ${e}`:e<1e6?` ${e}`:`${e}`,c=(e,t)=>e.lower<t.lower?-1:e.lower>t.lower?1:0,l=(e,t)=>e.total<t.total?1:e.total>t.total?-1:c(e,t),h=(e,t)=>e.index<t.index?-1:e.index>t.index?1:0,u=function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},p=()=>{s.length=0,n=new u,s[e.ALT]=new u,s[e.CAT]=new u,s[e.REP]=new u,s[e.RNM]=new u,s[e.TRG]=new u,s[e.TBS]=new u,s[e.TLS]=new u,s[e.UDT]=new u,s[e.AND]=new u,s[e.NOT]=new u,a.length=0;for(let e=0;e<t.length;e+=1)a.push({empty:0,match:0,nomatch:0,total:0,name:t[e].name,lower:t[e].lower,index:t[e].index});if(r.length>0){o.length=0;for(let e=0;e<r.length;e+=1)o.push({empty:0,match:0,nomatch:0,total:0,name:r[e].name,lower:r[e].lower,index:r[e].index})}},f=(t,r)=>{switch(t.total+=1,r){case e.EMPTY:t.empty+=1;break;case e.MATCH:t.match+=1;break;case e.NOMATCH:t.nomatch+=1;break;default:throw new Error(`parser.js: Stats(): collect(): incStat(): unrecognized state: ${r}`)}}},d={stringToChars:e=>[...e].map(e=>e.codePointAt(0)),charsToString:(e,t,r)=>{let n=e;for(;!(void 0===t||t<0);){if(void 0===r){n=e.slice(t);break}if(r<=0)return"";n=e.slice(t,t+r);break}return String.fromCodePoint(...n)}},m={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,idName:e=>{switch(e){case m.ALT:return"ALT";case m.CAT:return"CAT";case m.REP:return"REP";case m.RNM:return"RNM";case m.TRG:return"TRG";case m.TBS:return"TBS";case m.TLS:return"TLS";case m.UDT:return"UDT";case m.AND:return"AND";case m.NOT:return"NOT";case m.ACTIVE:return"ACTIVE";case m.EMPTY:return"EMPTY";case m.MATCH:return"MATCH";case m.NOMATCH:return"NOMATCH";case m.SEM_PRE:return"SEM_PRE";case m.SEM_POST:return"SEM_POST";case m.SEM_OK:return"SEM_OK";default:return"UNRECOGNIZED STATE"}}};class y extends Error{constructor(e,t=void 0){if(super(e,t),this.name=this.constructor.name,"string"==typeof e&&(this.message=e),"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack,null!=t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"cause")&&!("cause"in this)){const{cause:e}=t;this.cause=e,e instanceof Error&&"stack"in e&&(this.stack=`${this.stack}\nCAUSE: ${e.stack}`)}if(null!=t&&"object"==typeof t){const{cause:e,...r}=t;Object.assign(this,r)}}}const g=y;const T=class extends g{},b=e=>(t,r,n,s,a)=>{if("object"!=typeof a||null===a||Array.isArray(a))throw new T("parser's user data must be an object");if(t===m.SEM_PRE){const t={type:e,text:d.charsToString(r,n,s),start:n,length:s,children:[]};if(a.stack.length>0){a.stack[a.stack.length-1].children.push(t)}else a.root=t;a.stack.push(t)}t===m.SEM_POST&&a.stack.pop()};const w=class extends u{constructor(){super(),this.callbacks["json-pointer"]=b("json-pointer"),this.callbacks["reference-token"]=b("reference-token"),this.callbacks.slash=b("text")}getTree(){const e={stack:[],root:null};return this.translate(e),delete e.stack,e}},k=e=>{if("string"!=typeof e)throw new TypeError("Reference token must be a string");return e.replace(/~1/g,"/").replace(/~0/g,"~")};const E=class extends w{getTree(){const{root:e}=super.getTree();return e.children.filter(({type:e})=>"reference-token"===e).map(({text:e})=>k(e))}};const A=class extends Array{toString(){return this.map(e=>`"${String(e)}"`).join(", ")}};const v=class extends p{inferExpectations(){const e=this.displayTrace().split("\n"),t=new Set;let r=-1;for(let n=0;n<e.length;n++){const s=e[n];if(s.includes("M|")){const e=s.match(/]'(.*)'$/);e&&e[1]&&(r=n)}if(n>r){const e=s.match(/N\|\[TLS\(([^)]+)\)]/);e&&t.add(e[1])}}return new A(...t)}},x=new l,O=(e,{translator:t=new E,stats:r=!1,trace:n=!1}={})=>{if("string"!=typeof e)throw new TypeError("JSON Pointer must be a string");try{const s=new h;t&&(s.ast=t),r&&(s.stats=new f),n&&(s.trace=new v);const a=s.parse(x,"json-pointer",e);return{result:a,tree:a.success&&t?s.ast.getTree():void 0,stats:s.stats,trace:s.trace}}catch(t){throw new T("Unexpected error during JSON Pointer parsing",{cause:t,jsonPointer:e})}};const M=class extends w{getTree(){return this.toXml()}},S=e=>{try{return O(e,{translator:null}).result.success}catch{return!1}},P=new l,$=new h,N=e=>{if("string"!=typeof e)return!1;try{return $.parse(P,"reference-token",e).success}catch{return!1}},L=new l,j=new h,_=e=>{if("string"!=typeof e)return!1;try{return j.parse(L,"array-location",e).success}catch{return!1}},C=new l,R=new h,I=e=>{if("string"!=typeof e)return!1;try{return R.parse(C,"array-index",e).success}catch{return!1}},D=new l,V=new h,H=e=>{if("string"!=typeof e)return!1;try{return V.parse(D,"array-dash",e).success}catch{return!1}},U=e=>{if("string"!=typeof e&&"number"!=typeof e)throw new TypeError("Reference token must be a string or number");return String(e).replace(/~/g,"~0").replace(/\//g,"~1")};const z=class extends g{},B=e=>{if(!Array.isArray(e))throw new TypeError("Reference tokens must be a list of strings or numbers");try{return 0===e.length?"":`/${e.map(e=>{if("string"!=typeof e&&"number"!=typeof e)throw new TypeError("Reference token must be a string or number");return U(String(e))}).join("/")}`}catch(t){throw new z("Unexpected error during JSON Pointer compilation",{cause:t,referenceTokens:e})}};const Y=class{#e;#t;#r;constructor(e,t={}){this.#e=e,this.#e.steps=[],this.#e.failed=!1,this.#e.failedAt=-1,this.#e.message=`JSON Pointer "${t.jsonPointer}" was successfully evaluated against the provided value`,this.#e.context={...t,realm:t.realm.name},this.#t=[],this.#r=t.realm}step({referenceToken:e,input:t,output:r,success:n=!0,reason:s}){const a=this.#t.length;this.#t.push(e);const o={referenceToken:e,referenceTokenPosition:a,input:t,inputType:this.#r.isObject(t)?"object":this.#r.isArray(t)?"array":"unrecognized",output:r,success:n};s&&(o.reason=s),this.#e.steps.push(o),n||(this.#e.failed=!0,this.#e.failedAt=a,this.#e.message=s)}};const F=class{name="";isArray(e){throw new g("Realm.isArray(node) must be implemented in a subclass")}isObject(e){throw new g("Realm.isObject(node) must be implemented in a subclass")}sizeOf(e){throw new g("Realm.sizeOf(node) must be implemented in a subclass")}has(e,t){throw new g("Realm.has(node) must be implemented in a subclass")}evaluate(e,t){throw new g("Realm.evaluate(node) must be implemented in a subclass")}};const J=class extends g{};const q=class extends J{};const G=class extends F{name="json";isArray(e){return Array.isArray(e)}isObject(e){return"object"==typeof e&&null!==e&&!this.isArray(e)}sizeOf(e){return this.isArray(e)?e.length:this.isObject(e)?Object.keys(e).length:0}has(e,t){if(this.isArray(e)){const r=Number(t),n=r>>>0;if(r!==n)throw new q(`Invalid array index "${t}": index must be an unsinged 32-bit integer`,{referenceToken:t,currentValue:e,realm:this.name});return n<this.sizeOf(e)&&Object.prototype.hasOwnProperty.call(e,r)}return!!this.isObject(e)&&Object.prototype.hasOwnProperty.call(e,t)}evaluate(e,t){return this.isArray(e)?e[Number(t)]:e[t]}};const K=class extends J{};const X=class extends J{},Z=(e,t,{strictArrays:r=!0,strictObjects:n=!0,realm:s=new G,trace:a=!0}={})=>{const{result:o,tree:i,trace:c}=O(t,{trace:!!a});if(!o.success){let e=`Invalid JSON Pointer: "${t}". Syntax error at position ${o.maxMatched}`;throw e+=c?`, expected ${c.inferExpectations()}`:"",new T(e,{jsonPointer:t})}const l="object"==typeof a&&null!==a?new Y(a,{jsonPointer:t,referenceTokens:i,strictArrays:r,strictObjects:n,realm:s,value:e}):null;try{let a;return i.reduce((e,o,c)=>{if(s.isArray(e)){if(H(o)){if(r)throw new q(`Invalid array index "-" at position ${c} in "${t}". The "-" token always refers to a nonexistent element during evaluation`,{jsonPointer:t,referenceTokens:i,referenceToken:o,referenceTokenPosition:c,currentValue:e,realm:s.name});return a=s.evaluate(e,String(s.sizeOf(e))),null==l||l.step({referenceToken:o,input:e,output:a}),a}if(!I(o))throw new q(`Invalid array index "${o}" at position ${c} in "${t}": index MUST be "0", or digits without a leading "0"`,{jsonPointer:t,referenceTokens:i,referenceToken:o,referenceTokenPosition:c,currentValue:e,realm:s.name});const n=Number(o);if(!Number.isSafeInteger(n))throw new q(`Invalid array index "${o}" at position ${c} in "${t}": index must be a safe integer`,{jsonPointer:t,referenceTokens:i,referenceToken:o,referenceTokenPosition:c,currentValue:e,realm:s.name});if(!s.has(e,o)&&r)throw new q(`Invalid array index "${o}" at position ${c} in "${t}": index not found in array`,{jsonPointer:t,referenceTokens:i,referenceToken:o,referenceTokenPosition:c,currentValue:e,realm:s.name});return a=s.evaluate(e,o),null==l||l.step({referenceToken:o,input:e,output:a}),a}if(s.isObject(e)){if(!s.has(e,o)&&n)throw new X(`Invalid object key "${o}" at position ${c} in "${t}": key not found in object`,{jsonPointer:t,referenceTokens:i,referenceToken:o,referenceTokenPosition:c,currentValue:e,realm:s.name});return a=s.evaluate(e,o),null==l||l.step({referenceToken:o,input:e,output:a}),a}throw new K(`Invalid reference token "${o}" at position ${c} in "${t}": cannot be applied to a non-object/non-array value`,{jsonPointer:t,referenceTokens:i,referenceToken:o,referenceTokenPosition:c,currentValue:e,realm:s.name})},e)}catch(e){if(null==l||l.step({referenceToken:e.referenceToken,input:e.currentValue,success:!1,reason:e.message}),e instanceof J)throw e;throw new J("Unexpected error during JSON Pointer evaluation",{cause:e,jsonPointer:t,referenceTokens:i})}};function W(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function Q(e){return function t(r){return 0===arguments.length||W(r)?t:e.apply(this,arguments)}}function ee(e){return function t(r,n){switch(arguments.length){case 0:return t;case 1:return W(r)?t:Q(function(t){return e(r,t)});default:return W(r)&&W(n)?t:W(r)?Q(function(t){return e(t,n)}):W(n)?Q(function(t){return e(r,t)}):e(r,n)}}}function te(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}function re(e,t,r){for(var n=0,s=r.length;n<s;){if(e(t,r[n]))return!0;n+=1}return!1}function ne(e,t){return Object.prototype.hasOwnProperty.call(t,e)}const se="function"==typeof Object.is?Object.is:function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};var ae=Object.prototype.toString;const oe=function(){return"[object Arguments]"===ae.call(arguments)?function(e){return"[object Arguments]"===ae.call(e)}:function(e){return ne("callee",e)}}();var ie=!{toString:null}.propertyIsEnumerable("toString"),ce=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],le=function(){return arguments.propertyIsEnumerable("length")}(),he=function(e,t){for(var r=0;r<e.length;){if(e[r]===t)return!0;r+=1}return!1};const ue="function"!=typeof Object.keys||le?Q(function(e){if(Object(e)!==e)return[];var t,r,n=[],s=le&&oe(e);for(t in e)!ne(t,e)||s&&"length"===t||(n[n.length]=t);if(ie)for(r=ce.length-1;r>=0;)ne(t=ce[r],e)&&!he(n,t)&&(n[n.length]=t),r-=1;return n}):Q(function(e){return Object(e)!==e?[]:Object.keys(e)});const pe=Q(function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});function fe(e,t,r,n){var s=te(e);function a(e,t){return de(e,t,r.slice(),n.slice())}return!re(function(e,t){return!re(a,t,e)},te(t),s)}function de(e,t,r,n){if(se(e,t))return!0;var s,a,o=pe(e);if(o!==pe(t))return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(o){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===(s=e.constructor,null==(a=String(s).match(/^function (\w*)/))?"":a[1]))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!se(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!se(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}for(var i=r.length-1;i>=0;){if(r[i]===e)return n[i]===t;i-=1}switch(o){case"Map":return e.size===t.size&&fe(e.entries(),t.entries(),r.concat([e]),n.concat([t]));case"Set":return e.size===t.size&&fe(e.values(),t.values(),r.concat([e]),n.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var c=ue(e);if(c.length!==ue(t).length)return!1;var l=r.concat([e]),h=n.concat([t]);for(i=c.length-1;i>=0;){var u=c[i];if(!ne(u,t)||!de(t[u],e[u],l,h))return!1;i-=1}return!0}const me=ee(function(e,t){return de(e,t,[],[])});const ye=class{key;value;constructor(e,t){this.key=e,this.value=t}toValue(){return{key:this.key?.toValue(),value:this.value?.toValue()}}};class ge{elements;constructor(e){this.elements=e??[]}toValue(){return this.elements.map(e=>({key:e.key?.toValue(),value:e.value?.toValue()}))}map(e,t){return this.elements.map(r=>{const n=r.value,s=r.key;if(void 0===n||void 0===s)throw new Error("MemberElement must have both key and value");return void 0!==t?e.call(t,n,s,r):e(n,s,r)})}filter(e,t){const r=this.elements.filter(r=>{const n=r.value,s=r.key;return void 0!==n&&void 0!==s&&(void 0!==t?e.call(t,n,s,r):e(n,s,r))});return new ge(r)}reject(e,t){const r=[];for(const n of this.elements){const s=n.value,a=n.key;void 0!==s&&void 0!==a&&(e.call(t,s,a,n)||r.push(n))}return new ge(r)}forEach(e,t){this.elements.forEach((r,n)=>{const s=r.value,a=r.key;void 0!==s&&void 0!==a&&(void 0!==t?e.call(t,s,a,r,n):e(s,a,r,n))})}find(e,t){return this.elements.find(r=>{const n=r.value,s=r.key;return void 0!==n&&void 0!==s&&(void 0!==t?e.call(t,n,s,r):e(n,s,r))})}keys(){return this.elements.map(e=>e.key?.toValue()).filter(e=>void 0!==e)}values(){return this.elements.map(e=>e.value?.toValue()).filter(e=>void 0!==e)}get length(){return this.elements.length}get isEmpty(){return 0===this.length}get first(){return this.elements[0]}get(e){return this.elements[e]}push(e){return this.elements.push(e),this}includesKey(e){return this.elements.some(t=>t.key?.equals(e))}[Symbol.iterator](){return this.elements[Symbol.iterator]()}}const Te=ge;class be{parent;startLine;startCharacter;startOffset;endLine;endCharacter;endOffset;_storedElement="element";_content;_meta;_attributes;constructor(e,t,r){void 0!==t&&(this.meta=t),void 0!==r&&(this.attributes=r),void 0!==e&&(this.content=e)}get element(){return this._storedElement}set element(e){this._storedElement=e}get content(){return this._content}set content(e){if(e instanceof be)this._content=e;else if(null!=e&&"string"!=typeof e&&"number"!=typeof e&&"boolean"!=typeof e&&"bigint"!=typeof e&&"symbol"!=typeof e)if(e instanceof ye)this._content=e;else if(e instanceof Te)this._content=e.elements;else if(Array.isArray(e))this._content=e.map(e=>this.refract(e));else{if("object"!=typeof e)throw new Error("Cannot set content to value of type "+typeof e);this._content=Object.entries(e).map(([e,t])=>new this.MemberElement(e,t))}else this._content=e}get meta(){if(!this._meta){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._meta=new this.ObjectElement}return this._meta}set meta(e){e instanceof be?this._meta=e:this.meta.set(e??{})}get attributes(){if(!this._attributes){if(this.isFrozen){const e=new this.ObjectElement;return e.freeze(),e}this._attributes=new this.ObjectElement}return this._attributes}set attributes(e){e instanceof be?this._attributes=e:this.attributes.set(e??{})}get id(){return this.getMetaProperty("id","")}set id(e){this.setMetaProperty("id",e)}get classes(){return this.getMetaProperty("classes",[])}set classes(e){this.setMetaProperty("classes",e)}get links(){return this.getMetaProperty("links",[])}set links(e){this.setMetaProperty("links",e)}get children(){const{_content:e}=this;if(Array.isArray(e))return e;if(e instanceof ye){const t=[];return e.key&&t.push(e.key),e.value&&t.push(e.value),t}return e instanceof be?[e]:[]}get isFrozen(){return Object.isFrozen(this)}freeze(){if(!this.isFrozen){this._meta&&(this._meta.parent=this,this._meta.freeze()),this._attributes&&(this._attributes.parent=this,this._attributes.freeze());for(const e of this.children)e.parent=this,e.freeze();Array.isArray(this._content)&&Object.freeze(this._content),Object.freeze(this)}}toValue(){const{_content:e}=this;return e instanceof be||e instanceof ye?e.toValue():Array.isArray(e)?e.map(e=>e.toValue()):e}equals(e){const t=e instanceof be?e.toValue():e;return me(this.toValue(),t)}primitive(){}set(e){return this.content=e,this}toRef(e){const t=this.id.toValue();if(""===t)throw new Error("Cannot create reference to an element without an ID");const r=new this.RefElement(t);return"string"==typeof e&&(r.path=this.refract(e)),r}getMetaProperty(e,t){if(!this.meta.hasKey(e)){if(this.isFrozen){const e=this.refract(t);return e.freeze(),e}this.meta.set(e,t)}return this.meta.get(e)}setMetaProperty(e,t){this.meta.set(e,t)}hasMetaProperty(e){return!this.isMetaEmpty&&this.meta.hasKey(e)}get isMetaEmpty(){return void 0===this._meta||this.meta.isEmpty}getAttributesProperty(e,t){if(!this.hasAttributesProperty(e)){if(this.isFrozen){const e=this.refract(t);return e.freeze(),e}this.attributes.set(e,t)}return this.attributes.get(e)}setAttributesProperty(e,t){this.attributes.set(e,t)}hasAttributesProperty(e){return!this.isAttributesEmpty&&this.attributes.hasKey(e)}get isAttributesEmpty(){return void 0===this._attributes||this.attributes.isEmpty}}const we=be;class ke extends we{constructor(e,t,r){super(e||[],t,r)}get length(){return this._content.length}get isEmpty(){return 0===this.length}get first(){return this._content[0]}get second(){return this._content[1]}get last(){return this._content.at(-1)}push(...e){for(const t of e)this._content.push(this.refract(t));return this}shift(){return this._content.shift()}unshift(e){this._content.unshift(this.refract(e))}includes(e){return this._content.some(t=>t.equals(e))}findElements(e,t){const r=t||{},n=!!r.recursive,s=void 0===r.results?[]:r.results;for(let t=0;t<this._content.length;t+=1){const r=this._content[t],a=r;n&&"function"==typeof a.findElements&&a.findElements(e,{results:s,recursive:n}),e(r,t,void 0)&&s.push(r)}return s}find(e){const t=this.findElements(e,{recursive:!0});return new this.ArrayElement(t)}findByElement(e){return this.find(t=>t.element===e)}findByClass(e){return this.find(t=>{const r=t.classes;return"function"==typeof r.includes&&r.includes(e)})}getById(e){return this.find(t=>t.id.toValue()===e).first}concat(e){return new(0,this.constructor)(this._content.concat(e._content))}[Symbol.iterator](){return this._content[Symbol.iterator]()}}const Ee=ke;const Ae=class extends Ee{constructor(e,t,r){super(e||[],t,r),this.element="array"}primitive(){return"array"}get(e){return this._content[e]}getValue(e){const t=this.get(e);if(t)return t.toValue()}set(e,t){return"number"==typeof e&&void 0!==t?this._content[e]=this.refract(t):this.content=e,this}remove(e){return this._content.splice(e,1)[0]??null}map(e,t){return this._content.map(e,t)}flatMap(e,t){return this._content.flatMap(e,t)}compactMap(e,t){const r=[];for(const n of this._content){const s=e.call(t,n);s&&r.push(s)}return r}filter(e,t){const r=this._content.filter(e,t);return new this.constructor(r)}reject(e,t){const r=[];for(const n of this._content)e.call(t,n)||r.push(n);return new this.constructor(r)}reduce(e,t){let r,n;void 0!==t?(r=0,n=this.refract(t)):(r=1,n=this.first);for(let t=r;t<this.length;t+=1){const r=e(n,this._content[t],t,this);n=void 0===r?r:this.refract(r)}return n}forEach(e,t){this._content.forEach((r,n)=>{e.call(t,r,n)})}empty(){return new this.constructor([])}};const ve=class extends we{constructor(e,t,r,n){super(new ye,r,n),this.element="member",void 0!==e&&(this.key=e),arguments.length>=2&&(this.value=t)}primitive(){return"member"}get key(){return this._content.key}set key(e){this._content.key=this.refract(e)}get value(){return this._content.value}set value(e){this._content.value=void 0===e?void 0:this.refract(e)}};const xe=class extends Ee{constructor(e,t,r){super(e||[],t,r),this.element="object"}primitive(){return"object"}toValue(){return this._content.reduce((e,t)=>(e[t.key.toValue()]=t.value?t.value.toValue():void 0,e),{})}get(e){const t=this.getMember(e);if(t)return t.value}getValue(e){const t=this.get(e);if(t)return t.toValue()}getMember(e){if(void 0!==e)return this._content.find(t=>t.key.toValue()===e)}remove(e){let t=null;return this.content=this._content.filter(r=>r.key.toValue()!==e||(t=r,!1)),t}getKey(e){const t=this.getMember(e);if(t)return t.key}set(e,t){if("string"==typeof e){const r=this.getMember(e);r?r.value=t:this._content.push(new ve(e,t))}else if("object"==typeof e&&!Array.isArray(e))for(const t of Object.keys(e))this.set(t,e[t]);return this}keys(){return this._content.map(e=>e.key.toValue())}values(){return this._content.map(e=>e.value.toValue())}hasKey(e){return this._content.some(t=>t.key.equals(e))}items(){return this._content.map(e=>[e.key.toValue(),e.value.toValue()])}map(e,t){return this._content.map(r=>e.call(t,r.value,r.key,r))}compactMap(e,t){const r=[];return this.forEach((n,s,a)=>{const o=e.call(t,n,s,a);o&&r.push(o)}),r}filter(e,t){return new Te(this._content).filter(e,t)}reject(e,t){const r=[];for(const n of this._content)e.call(t,n.value,n.key,n)||r.push(n);return new Te(r)}forEach(e,t){this._content.forEach(r=>e.call(t,r.value,r.key,r))}reduce(e,t){let r,n;void 0!==t?(r=0,n=this.refract(t)):(r=1,n=this._content[0]?.value);for(let t=r;t<this._content.length;t+=1){const r=this._content[t],s=e(n,r.value,r.key,r,this);n=void 0===s?s:this.refract(s)}return n}empty(){return new this.constructor([])}};const Oe=e=>e instanceof Ae,Me=e=>e instanceof xe;const Se=class extends F{name="apidom";isArray(e){return Oe(e)}isObject(e){return Me(e)}sizeOf(e){return this.isArray(e)||this.isObject(e)?e.length:0}has(e,t){if(this.isArray(e)){const r=Number(t),n=r>>>0;if(r!==n)throw new q(`Invalid array index "${t}": index must be an unsinged 32-bit integer`,{referenceToken:t,currentValue:e,realm:this.name});return n<this.sizeOf(e)}if(this.isObject(e)){const r=e.keys(),n=new Set(r);if(r.length!==n.size)throw new X(`Object key "${t}" is not unique — JSON Pointer requires unique member names`,{referenceToken:t,currentValue:e,realm:this.name});return e.hasKey(t)}return!1}evaluate(e,t){return this.isArray(e)?e.get(Number(t)):e.get(t)}},Pe=new Se,$e=(e,t,r={})=>Z(e,t,{...r,realm:Pe});return t})());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@speclynx/apidom-json-pointer",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "Evaluate JSON Pointer expressions against ApiDOM.",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -41,8 +41,8 @@
41
41
  "license": "Apache-2.0",
42
42
  "dependencies": {
43
43
  "@babel/runtime-corejs3": "^7.28.4",
44
- "@speclynx/apidom-datamodel": "^2.6.0",
45
- "@speclynx/apidom-error": "^2.6.0",
44
+ "@speclynx/apidom-datamodel": "^2.7.0",
45
+ "@speclynx/apidom-error": "^2.7.0",
46
46
  "@swaggerexpert/json-pointer": "^3.0.1"
47
47
  },
48
48
  "files": [
@@ -55,5 +55,5 @@
55
55
  "README.md",
56
56
  "CHANGELOG.md"
57
57
  ],
58
- "gitHead": "d96eb344cc26a57935aa3a425ea2447d6e8e77b2"
58
+ "gitHead": "82ac9430aa882d0a5c63a17f7da8f5c0dcbca737"
59
59
  }