@cbortech/cbor 0.27.0 → 0.27.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/README.ja.md +100 -0
- package/README.md +103 -0
- package/dist/ast/CborAppSeqResult.d.ts +37 -4
- package/dist/ast/CborArray.d.ts +2 -2
- package/dist/ast/CborByteString.d.ts +2 -2
- package/dist/ast/CborEmbeddedCBOR.d.ts +1 -1
- package/dist/ast/CborFloat.d.ts +1 -1
- package/dist/ast/CborIndefiniteByteString.d.ts +1 -1
- package/dist/ast/CborIndefiniteTextString.d.ts +1 -1
- package/dist/ast/CborItem.d.ts +314 -9
- package/dist/ast/CborMap.d.ts +2 -2
- package/dist/ast/CborNint.d.ts +1 -1
- package/dist/ast/CborTag.d.ts +26 -4
- package/dist/ast/CborTextString.d.ts +2 -2
- package/dist/ast/CborUint.d.ts +1 -1
- package/dist/ast/CborUnresolvedAppExt.d.ts +9 -0
- package/dist/ast/index.cjs +1 -1
- package/dist/ast/index.js +2 -2
- package/dist/cbor/tagLabels.d.ts +26 -0
- package/dist/cddl/eRefScope.d.ts +241 -0
- package/dist/cddl/eref.d.ts +64 -0
- package/dist/cddl/implicitTags.d.ts +28 -0
- package/dist/cddl/index.cjs +2 -2
- package/dist/cddl/index.cjs.map +1 -1
- package/dist/cddl/index.d.ts +2 -0
- package/dist/cddl/index.js +26 -25
- package/dist/cddl/index.js.map +1 -1
- package/dist/cddl/validator.d.ts +98 -2
- package/dist/cdn/index.cjs +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/serialize-utils.d.ts +50 -15
- package/dist/extensions/cri.d.ts +2 -2
- package/dist/extensions/dt.d.ts +4 -4
- package/dist/extensions/eref.d.ts +135 -0
- package/dist/extensions/ip.d.ts +3 -3
- package/dist/extensions/types.d.ts +40 -1
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +190 -81
- package/dist/index.js.map +1 -1
- package/dist/js/fromJS.d.ts +23 -1
- package/dist/mapEntries-8zshEr-t.js +7085 -0
- package/dist/mapEntries-8zshEr-t.js.map +1 -0
- package/dist/mapEntries-DwHPAzCN.cjs +68 -0
- package/dist/mapEntries-DwHPAzCN.cjs.map +1 -0
- package/dist/schema-7r2xjpMK.js +345 -0
- package/dist/schema-7r2xjpMK.js.map +1 -0
- package/dist/schema-YiigSWjR.cjs +8 -0
- package/dist/schema-YiigSWjR.cjs.map +1 -0
- package/dist/{serialize-utils-BuIZPaUc.js → serialize-utils-BQtutOo6.js} +70 -52
- package/dist/serialize-utils-BQtutOo6.js.map +1 -0
- package/dist/{serialize-utils-CjTqQivB.cjs → serialize-utils-DQ8T3Mzw.cjs} +9 -9
- package/dist/serialize-utils-DQ8T3Mzw.cjs.map +1 -0
- package/dist/types.d.ts +426 -4
- package/dist/utils/hexfloat.d.ts +10 -2
- package/package.json +13 -14
- package/dist/mapEntries-C1f7G0AM.cjs +0 -13
- package/dist/mapEntries-C1f7G0AM.cjs.map +0 -1
- package/dist/mapEntries-CvLdiN0h.js +0 -3946
- package/dist/mapEntries-CvLdiN0h.js.map +0 -1
- package/dist/schema-CNfrVRYp.js +0 -1977
- package/dist/schema-CNfrVRYp.js.map +0 -1
- package/dist/schema-iXpYtKQl.cjs +0 -63
- package/dist/schema-iXpYtKQl.cjs.map +0 -1
- package/dist/serialize-utils-BuIZPaUc.js.map +0 -1
- package/dist/serialize-utils-CjTqQivB.cjs.map +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const e=require("./serialize-utils-DQ8T3Mzw.cjs");var t=class extends SyntaxError{offset;line;column;endOffset;constructor(e,t){let n=t?.line===void 0?``:` at line ${t.line}, column ${t.column}`;super(`CDDL parse error${n}: ${e}`),this.name=`CddlSyntaxError`,this.offset=t?.offset,this.line=t?.line,this.column=t?.column,this.endOffset=t?.endOffset}},n=class extends Error{errors;warnings;constructor(e,t=[]){let n=e[0],r=n?.path?` at ${n.path}`:``,i=e.length>1?` (and ${e.length-1} more)`:``;super(`CDDL validation failed${r}: ${n?.message??`unknown`}${i}`),this.name=`CddlMismatchError`,this.errors=e,this.warnings=t}},r=class extends Error{warnings;constructor(e){let t=e[0],n=e.length>1?` (and ${e.length-1} more)`:``;super(`CDDL semantic error: ${t?.message??`unknown`}${n}`),this.name=`CddlSemanticError`,this.warnings=e}},i=Symbol.for(`cbor.tag`),a=class{valueOf(){return null}toJSON(){return null}},o=class{valueOf(){}toJSON(){}};function s(e){if(!d(e))return;let t=e[i];return typeof t==`bigint`?t:void 0}function c(e,t){let n;switch(typeof e){case`number`:n=new Number(e);break;case`string`:n=new String(e);break;case`boolean`:n=new Boolean(e);break;case`bigint`:n=Object(e);break;case`undefined`:n=new o;break;case`object`:if(e===null){n=new a;break}n=e;break;default:throw TypeError(`setCborTag: cannot tag value of type ${typeof e}`)}return n[i]=t,n}function l(e){if(e instanceof Number||e instanceof String||e instanceof Boolean||Object.prototype.toString.call(e)===`[object BigInt]`)return e.valueOf();if(e instanceof a)return null;if(!(e instanceof o))return typeof e==`object`&&e&&delete e[i],e}function u(e){if(e instanceof Number||e instanceof String||e instanceof Boolean||Object.prototype.toString.call(e)===`[object BigInt]`)return e.valueOf();if(e instanceof a)return null;if(!(e instanceof o))return e}function d(e){return typeof e==`object`&&!!e}var f=class{constructor(){}static symbol=i;static Null=a;static Undefined=o;static get(e){return s(e)}static set(e,t){return c(e,t)}static remove(e){return l(e)}static getValue(e){return u(e)}},p=Symbol(`cbor.omit`),m=class e{value;constructor(e){if(!Number.isInteger(e)||e<0||e>255)throw RangeError(`Simple value must be an integer in 0–255`);this.value=e}valueOf(){return this.value}toJSON(){throw TypeError(`simple(${this.value}) cannot be serialized to JSON`)}static is(t){return t instanceof e}static get(t){return t instanceof e?t.value:void 0}},h=`getFloat16`in DataView.prototype&&`setFloat16`in DataView.prototype,g=new DataView(new ArrayBuffer(8));function _(e){g.setFloat64(0,e,!1);let t=g.getUint32(0,!1),n=g.getUint32(4,!1),r=t>>>31&1,i=t>>>20&2047,a=t&1048575;if(i===2047){if(a===0&&n===0)return r<<15|31744;let e=a>>10|(n===0?0:1)||1;return r<<15|31744|e&1023}let o=i-1023+15;if(o>=31)return r<<15|31744;let s,c,l;if(o<=0){if(o<-10)return r<<15;let e=1<<20|a,t=11-o;t<=20?(s=e>>t&1023,c=e>>t-1&1,l=!!(e&(1<<t-1)-1)||n!==0):(s=0,c=1,l=a!==0||n!==0)}else s=a>>10,c=a>>9&1,l=!!(a&511)||n!==0;if(c!==0&&(l||s&1)&&s++,s>=1024){let e=o<=0?1:o+1;return e>=31?r<<15|31744:r<<15|e<<10}let u=o<=0?0:o;return r<<15|u<<10|s}function v(e){let t=e>>>15&1,n=e>>>10&31,r=e&1023;return n===31?r===0?t?-1/0:1/0:NaN:n===0?r===0?t?-0:0:(t?-1:1)*2**-14*(r/1024):(t?-1:1)*2**(n-15)*(1+r/1024)}var y=h?(e,t,n,r)=>{e.setFloat16(t,n,r)}:(e,t,n,r)=>{e.setUint16(t,_(n),r)},b=new DataView(new ArrayBuffer(8)),x=new Uint8Array(b.buffer),S=new TextEncoder,ee=typeof S.encodeInto==`function`;function te(e){return e<=23?1:e<=255?2:e<=65535?3:e<=4294967295?5:9}function ne(e){return e===`i`?1:[2,3,5,9][e]}var re=class{buf;len=0;constructor(e=256){this.buf=new Uint8Array(e)}_ensure(e){let t=this.len+e;if(t<=this.buf.length)return;let n=this.buf.length*2;for(;n<t;)n*=2;let r=new Uint8Array(n);r.set(this.buf),this.buf=r}writeByte(e){this._ensure(1),this.buf[this.len++]=e}writeBytes(e){this._ensure(e.length),this.buf.set(e,this.len),this.len+=e.length}writeUint16(e){this._ensure(2);let t=this.buf;t[this.len++]=e>>>8&255,t[this.len++]=e&255}writeUint32(e){this._ensure(4);let t=this.buf;t[this.len++]=e>>>24&255,t[this.len++]=e>>>16&255,t[this.len++]=e>>>8&255,t[this.len++]=e&255}writeBigUint64(e){b.setBigUint64(0,e,!1),this._ensure(8),this.buf.set(x,this.len),this.len+=8}writeFloat16(e){y(b,0,e,!1),this._ensure(2);let t=this.buf;t[this.len++]=x[0],t[this.len++]=x[1]}writeFloat32(e){b.setFloat32(0,e,!1),this._ensure(4);let t=this.buf;t[this.len++]=x[0],t[this.len++]=x[1],t[this.len++]=x[2],t[this.len++]=x[3]}writeFloat64(e){b.setFloat64(0,e,!1),this._ensure(8),this.buf.set(x,this.len),this.len+=8}writeTextString(e,t,n){if(!ee){let r=S.encode(t);C(this,e,r.length,n),this.writeBytes(r);return}let r=n===void 0?te(t.length):ne(n);this._ensure(9+3*t.length);let{written:i}=S.encodeInto(t,this.buf.subarray(this.len+r)),a=n===void 0?te(i):r;a!==r&&this.buf.copyWithin(this.len+a,this.len+r,this.len+r+i),C(this,e,i,n),this.len+=i}finish(){return this.buf.slice(0,this.len)}},ie=[255n,65535n,4294967295n,18446744073709551615n];function ae(e){return e===`i`?23n:ie[e]}function C(e,t,n,r){if(r===void 0&&typeof n==`number`&&n<4294967296){n<=23?e.writeByte(t<<5|n):n<=255?(e.writeByte(t<<5|24),e.writeByte(n)):n<=65535?(e.writeByte(t<<5|25),e.writeUint16(n)):(e.writeByte(t<<5|26),e.writeUint32(n));return}let i=typeof n==`number`?BigInt(n):n;if(r!==void 0){if(r===`i`){if(i>23n)throw RangeError(`value ${i} does not fit in immediate encoding _i (max 23)`);e.writeByte(t<<5|Number(i));return}if(i>ie[r])throw RangeError(`value ${i} does not fit in encodingWidth _${r} (max ${ie[r]})`);let n=24+r;e.writeByte(t<<5|n),n===24?e.writeByte(Number(i)):n===25?e.writeUint16(Number(i)):n===26?e.writeUint32(Number(i)):e.writeBigUint64(i);return}i<=23n?e.writeByte(t<<5|Number(i)):i<=255n?(e.writeByte(t<<5|24),e.writeByte(Number(i))):i<=65535n?(e.writeByte(t<<5|25),e.writeUint16(Number(i))):i<=4294967295n?(e.writeByte(t<<5|26),e.writeUint32(Number(i))):(e.writeByte(t<<5|27),e.writeBigUint64(i))}function oe(e,t,n){let r=new re(9);return C(r,e,t,n),r.finish()}var se=new DataView(new ArrayBuffer(4));function ce(e){return Object.is(v(_(e)),e)}function le(e){return se.setFloat32(0,e,!1),Object.is(se.getFloat32(0,!1),e)}function w(e){return ce(e)?`half`:le(e)?`single`:`double`}function ue(e){return{...e,preserveComments:e.comments===void 0?e.preserveComments??!0:e.preserveComments,preserveByteString:e.preserveByteString??!0,preserveRawString:e.preserveRawString??!0,preserveConcatenation:e.preserveConcatenation??!0,preserveNumberFormat:e.preserveNumberFormat??!0,preserveAppPrefix:e.preserveAppPrefix??!0,preserveBlankLines:e.preserveBlankLines??!0}}function de(e){return e.preserveAppSequence===void 0&&e.appStrings===void 0?e:{...e,preserveAppPrefix:e.preserveAppPrefix??e.preserveAppSequence,appPrefix:e.appPrefix??e.appStrings}}function fe(e){if(e.preserveAppSequence===void 0&&e.appStrings===void 0)return e;let t=de(e),n={...e};return t.preserveAppPrefix!==void 0&&(n.preserveAppPrefix=t.preserveAppPrefix),t.appPrefix!==void 0&&(n.appPrefix=t.appPrefix),n}var pe=Object.freeze([]);function me(e){return!!(e?.itemOptions||e?.extensions?.length)}function he(e){return e&&{...e,reviver:void 0}}function ge(e){let{reviver:t,extensions:n,...r}=e;return n?{...r,extensions:[...n]}:r}var _e=Symbol(`cbor.itemOptions.dispatchCache`),ve=Symbol(`cbor.itemOptions.rawPass`),ye=Object.freeze([]);function be(e){return e?.[_e]}function xe(e){let t=new WeakMap;return Object.assign({},e,{[_e]:t})}function Se(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ce(e,t){return e?.find(e=>Se(e.occurrence,t))}function we(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function Te(e){return!!e?.itemOptions}function Ee(e){let{textStringFormat:t,...n}=e;return delete n[De],t?{...n,textStringFormat:[...t]}:n}var De=Symbol(`cdnOverrideTracker`),T=class t{start;end;comments;blankLineBefore;appSeqSource;appSeqComments;appSeqEncodingEdits;appSeqEncodingEditsComplete;appSeqInnerEnd;appSeqSourceFeatures;warnings;_defaults;get _containsCdnContainer(){return!1}_isMultiWordText(e,t=!0,n){return!1}_jsObjectKey(e){}toCBOR(e){let t=this._defaults?{...this._defaults,...e}:e,n=new re;return this._encode(n,t),n.finish()}toCDN(t){let n=this._defaults?{...this._defaults,...t}:t;n&&=de(n),n?.preserveAll&&(n=ue(n));let r=this._resolveCdnOptions(n,pe,{}),i=this._toCDN(r,0,pe);if(!e.D(r)||e.w(r)===null)return i;let a=e.S(r),{ownLines:o,inlinePrefix:s}=e.O(this,``,a),c=this.comments?.trailing??[],l=c.length===0?i:`${i} ${c.map(t=>e.i(t,a).trimEnd()).join(` `)}`;return[...o,`${s}${l}`].join(`
|
|
2
|
+
`)}toEDN(e){return this.toCDN(e)}toJS(e){let t=this._defaults?{...this._defaults,...e}:e,n=me(t)?this._toJSChild(xe(t),pe,ye,{}):this._toJS(t);if(!t?.reviver)return n;let r=t.reviver.call({"":n},``,n);return r===p?void 0:r}toHexDump(e){let t=this._defaults?{...this._defaults,...e}:e;t&&=de(t);let n=t?.indent??3,r=typeof n==`string`?n:` `.repeat(n),i=(t?.commentStyle??`--`)+` `,a=this._toHexDump(0,t),o=0;for(let e of a){let t=e.depth*r.length+e.hex.length;t>o&&(o=t)}let s=o+2;return a.map(e=>(r.repeat(e.depth)+e.hex).padEnd(s)+i+e.comment).join(`
|
|
3
|
+
`)}_encode(e,n){if(this._toCBOR!==t.prototype._toCBOR){e.writeBytes(this._toCBOR(n));return}this._encodeTo(e,n)}_encodeTo(e,n){if(this._toCBOR===t.prototype._toCBOR)throw TypeError(`CborItem subclass must implement _encodeTo() or _toCBOR()`);e.writeBytes(this._toCBOR(n))}_toCBOR(e){let t=new re;return this._encodeTo(t,e),t.finish()}_resolveCdnOptions(e,t,n){if(!Te(e))return e;let r=n.isMapKey||t.length===0?void 0:t[t.length-1],i=e.itemOptions(this,{...n,key:r,path:t,options:Ee(e)});if(!i)return e;let a=e[De];a&&(a.applied=!0);let o={...e,...fe(i)};return o.preserveAll&&(o=ue(o)),o}_toJSChild(e,t,n,r){let i=be(e),a=Ce(i?.get(this),n);if(a){if(a.outcome.kind===`value`)return a.outcome.value;let r=a.outcome.override?{...e,...a.outcome.override}:e;return this._toJS(r,t,n)}let o=r.isMapKey||t.length===0?void 0:t[t.length-1],s=e,c;if(e?.itemOptions&&(c=e.itemOptions(this,{...r,key:o,path:t,options:ge(e)}),c&&(s={...e,...c})),s?.extensions?.length)for(let e of s.extensions){let t=e.toJS?.(this,ge(s));if(t)return i&&we(i,this,{occurrence:n,outcome:{kind:`value`,value:t.value}}),t.value}return i&&we(i,this,{occurrence:n,outcome:{kind:`override`,override:c}}),this._toJS(s,t,n)}_toHexDump(t,n){return[{depth:t,hex:e.P(this._toCBOR()),comment:this._toCDN(n,0)}]}},E=class extends T{value;encodingWidth;ednSource;constructor(e,t){if(super(),this.value=BigInt(e),this.value<0n)throw RangeError(`CborUint value must be non-negative`);if(this.value>18446744073709551615n)throw RangeError(`CborUint value exceeds maximum uint64`);this.encodingWidth=t?.encodingWidth,this.ednSource=t?.ednSource}_encodeTo(e,t){C(e,0,this.value,this.encodingWidth)}_toCDN(t,n,r){let i=e.C(t,this.encodingWidth,()=>e.r(this.value));if(t?.preserveNumberFormat&&this.ednSource!==void 0)return this.ednSource+i;let a=this.value;switch(t?.intFormat){case`hex`:return`0x${a.toString(16)}${i}`;case`octal`:return`0o${a.toString(8)}${i}`;case`binary`:return`0b${a.toString(2)}${i}`;default:return a.toString()+i}}_toJS(e){let t=e?.integerAs??`auto`;return t===`bigint`?this.value:t===`number`||this.value<=BigInt(2**53-1)?Number(this.value):this.value}},D=class extends T{argument;encodingWidth;ednSource;constructor(e,t){super();let n=BigInt(e);if(n>=0n)throw RangeError(`CborNint value must be negative`);if(n<-18446744073709551616n)throw RangeError(`CborNint value exceeds minimum int64`);this.argument=-1n-n,this.encodingWidth=t?.encodingWidth,this.ednSource=t?.ednSource}get value(){return-1n-this.argument}_encodeTo(e,t){C(e,1,this.argument,this.encodingWidth)}_toCDN(t,n,r){let i=e.C(t,this.encodingWidth,()=>e.r(this.argument));if(t?.preserveNumberFormat&&this.ednSource!==void 0)return this.ednSource+i;let a=this.argument+1n;switch(t?.intFormat){case`hex`:return`-0x${a.toString(16)}${i}`;case`octal`:return`-0o${a.toString(8)}${i}`;case`binary`:return`-0b${a.toString(2)}${i}`;default:return this.value.toString()+i}}_toJS(e){let t=this.value,n=e?.integerAs??`auto`;return n===`bigint`?t:n===`number`||t>=BigInt(-(2**53-1))?Number(t):t}},Oe=new DataView(new ArrayBuffer(8));function ke(e){let t=e.startsWith(`-`),n=e.slice(t?3:2),r=n.search(/[pP]/);if(r===-1)throw SyntaxError(`EDN parse error: hex float missing 'p' exponent: ${e}`);let i=n.slice(0,r),a=n.slice(r+1);if(!/^[+-]?\d+$/.test(a))throw SyntaxError(`EDN parse error: hex float has invalid or missing exponent: ${e}`);let o=parseInt(a,10),s=i.indexOf(`.`),c;if(s===-1){if(!/^[0-9a-fA-F]+$/.test(i))throw SyntaxError(`EDN parse error: hex float has no mantissa digits: ${e}`);c=parseInt(i,16)}else{let t=i.slice(0,s),n=i.slice(s+1);if(t===``&&n===``)throw SyntaxError(`EDN parse error: hex float has no mantissa digits: ${e}`);if(t!==``&&!/^[0-9a-fA-F]+$/.test(t)||n!==``&&!/^[0-9a-fA-F]+$/.test(n))throw SyntaxError(`EDN parse error: hex float has invalid mantissa: ${e}`);c=(t===``?0:parseInt(t,16))+(n===``?0:parseInt(n,16)/16**n.length)}let l=c*2**o;return t?-l:l}function Ae(e){if(isNaN(e))return`NaN`;if(!isFinite(e))return e>0?`Infinity`:`-Infinity`;let t=Object.is(e,-0)||e<0,n=Math.abs(e);if(n===0)return t?`-0x0p+0`:`0x0p+0`;Oe.setFloat64(0,n,!1);let r=Oe.getUint32(0,!1),i=Oe.getUint32(4,!1),a=r>>>20&2047,o=r&1048575,s=i,c,l;if(a===0){let e=BigInt(o)<<32n|BigInt(s),t=e.toString(2).length;c=e-(1n<<BigInt(t-1))<<BigInt(52-(t-1)),l=t-1075}else c=BigInt(o)<<32n|BigInt(s),l=a-1023;let u=c.toString(16).padStart(13,`0`).replace(/0+$/,``),d=`0x1${u===``?``:`.${u}`}p${l>=0?`+${l}`:`${l}`}`;return t?`-${d}`:d}var O=class extends T{value;precision;ednSource;literalSource;rawBits;constructor(e,t){super(),this.value=e,this.precision=t?.precision,this.rawBits=t?.rawBits,this.literalSource=t?.literalSource}_encodeTo(e,t){let n=this.precision??w(this.value),r=Number.isNaN(this.value)?this.rawBits:void 0;n===`half`?(e.writeByte(249),r?.length===2?e.writeBytes(r):e.writeFloat16(this.value)):n===`single`?(e.writeByte(250),r?.length===4?e.writeBytes(r):e.writeFloat32(this.value)):(e.writeByte(251),r?.length===8?e.writeBytes(r):e.writeFloat64(this.value))}_toCDN(t,n,r){let i=t?.encodingIndicators??`auto`;if(t?.appPrefix!==!1&&(t?.floatFormat===void 0||t?.floatFormat===`app-extension`)&&this.ednSource!==void 0&&(e.w(t)!==null||!/[\r\n]/.test(this.ednSource))){let e=this.ednSource;if(i===`never`)return e.replace(/_[0-3i]$/,``);if(i===`always`){if(/_[0-3i]$/.test(e))return e;let t=this.precision??w(this.value);return e+(t===`half`?`_1`:t===`single`?`_2`:`_3`)}return e}if(t?.preserveNumberFormat&&this.literalSource!==void 0){let t=this.literalSource;if(i===`never`)return t.replace(/_[0-7i]$/,``);if(i===`always`){if(/_[0-7i]$/.test(t))return t;let n=w(this.value);return t+e.l(this.value,this.precision,n,`always`)}return t}let a=w(this.value);if(t?.floatFormat===`app-extension`&&t?.appPrefix!==!1){let t=this.toCBOR();return`float'${e.N(t.subarray(1))}'`+e.l(this.value,this.precision,a,i)}return(t?.floatFormat===`hex`?Ae(this.value):e.u(this.value))+e.l(this.value,this.precision,a,i)}_toJS(e){return this.value}},je=1668546817n,Me=1668612095n,Ne=16777216n,Pe=4294967295n,Fe=new Map([[55799n,`self-described CBOR`],[55800n,`self-described CBOR Sequence`],[55801n,`CBOR-labeled non-CBOR data`]]);function Ie(e){if(e<je||e>Me)return;let t=Number(e>>8n&255n),n=Number(e&255n);if(t!==0&&n!==0)return(t-1)*255+(n-1)}function Le(e){if(e<Ne||e>Pe)return;let t=``;for(let n=24n;n>=0n;n-=8n){let r=Number(e>>n&255n);if(r<32||r>126)return;t+=String.fromCharCode(r)}return t}function Re(e){let t=Fe.get(e);if(t!==void 0)return t;let n=Ie(e);if(n!==void 0)return`CoAP Content-Format ${n}`;let r=Le(e);if(r!==void 0)return JSON.stringify(r)}var k=class extends T{tag;content;encodingWidth;ednSource;_implicit=!1;constructor(e,t,n){if(super(),this.tag=BigInt(e),this.tag<0n)throw RangeError(`CborTag tag number must be non-negative`);this.content=t,this.encodingWidth=n?.encodingWidth,this.ednSource=n?.ednSource}get _containsCdnContainer(){return this.content._containsCdnContainer}_isMultiWordText(t,n=!0,r){return e.h(this._toCDN(t,0,r),n)}_encodeTo(e,t){C(e,6,this.tag,this.encodingWidth),this.content._encode(e,t)}_toCDN(t,n,r){let i=e.C(t,this.encodingWidth,()=>e.r(this.tag)),a=t?.preserveNumberFormat&&this.ednSource!==void 0?this.ednSource:this.tag.toString(),o=this.content._resolveCdnOptions(t,r??[],{parent:this});return`${a}${i}${e.x(this.content,this,t,o,n,e=>this.content._toCDN(o,e,r),`(`,`)`)}`}hexDumpComment(){let e=Re(this.tag);return e?`Tag ${this.tag} (${e})`:`Tag ${this.tag}`}_toHexDump(t,n){let r=[{depth:t,hex:e.P(oe(6,this.tag,this.encodingWidth)),comment:this.hexDumpComment()}];return e.b(r,this.content._toHexDump(t+1,{...n,appPrefix:!1})),r}_toJS(e,t,n){let r=me(e)?this.content._toJSChild(e,t??[],n??ye,{parent:this}):this.content._toJS(e);return this._tagJS(r,e)}_tagJS(e,t){return t?.stripTags||this._implicit&&t?.implicitTags!==!1?e:f.set(e,this.tag)}};function ze(t,n,r){if(t!==void 0)return e.D(n)||r===void 0?t:e.k(t,r)}var A=class extends T{indefiniteLength=!1;value;ednEncoding;encodingWidth;ednSource;ednCommentSyntax;ednParts;constructor(e,t){super(),this.value=e,this.ednEncoding=t?.ednEncoding??`hex`,this.encodingWidth=t?.encodingWidth,this.ednSource=t?.ednSource,this.ednCommentSyntax=t?.ednCommentSyntax,this.ednParts=t?.ednParts}_isMultiWordText(t,n=!0,r){return e.m(this.value,t?.sqstr)}_encodeTo(e,t){C(e,2,this.value.length,this.encodingWidth),e.writeBytes(this.value)}_toCDN(t,n,r){let i=e.w(t);if(t?.preserveConcatenation&&i!==null&&this.ednParts!==void 0&&this.ednParts.length>1){let r=e.C(t,this.encodingWidth,()=>e.r(BigInt(this.value.length))),a=t?.bstrEncoding??this.ednEncoding;t?.appPrefix===!1&&a!==`hex`&&(a=`hex`);let o=this.ednParts.map(n=>{let r=t?.preserveByteString?ze(n.source,t,n.commentSyntax):void 0;return r===void 0?e.T(n.bytes,a,t?.sqstr):r}),s=e.D(t)?e.a(this.comments?.dangling,this.ednParts,e.S(t)):void 0;return t?.modernConcat&&t?.appPrefix!==!1?e.v(`b1`,o,r,i,n,s):(o[o.length-1]+=r,e.y(o,i,n,s))}let a=t?.preserveByteString?ze(this.ednSource,t,this.ednCommentSyntax):void 0;if(a!==void 0&&(i!==null||!/[\r\n]/.test(a)))return/_[0-3i]$/.test(a)?(t?.encodingIndicators??`auto`)===`never`?a.replace(/_[0-3i]$/,``):a:a+e.C(t,this.encodingWidth,()=>e.r(BigInt(this.value.length)));let o=e.C(t,this.encodingWidth,()=>e.r(BigInt(this.value.length))),s=t?.bstrEncoding??this.ednEncoding;return t?.appPrefix===!1&&s!==`hex`&&(s=`hex`),e.T(this.value,s,t?.sqstr)+o}_toJS(e){return this.value}},j=class extends T{indefiniteLength=!0;chunks;constructor(e){super(),this.chunks=e}_encodeTo(e,t){e.writeByte(95);for(let n of this.chunks)n._encode(e,t);e.writeByte(255)}_isMultiWordText(e,t=!0){return this.chunks.some(t=>t._isMultiWordText(e))}_toCDN(t,n,r){if((t?.encodingIndicators??`auto`)===`never`){let e=this.chunks.reduce((e,t)=>e+t.value.length,0),r=new Uint8Array(e),i=0;for(let e of this.chunks)r.set(e.value,i),i+=e.value.length;return new A(r)._toCDN(t,n)}let i=r??[],a=Te(t),o=e=>a?this.chunks[e]._resolveCdnOptions(t,[...i,e],{parent:this}):t,s=!!t?.modernStreamSyntax&&t?.appPrefix!==!1;return!s&&this.chunks.length===0?`''_`:e.E({node:this,options:t,depth:n,openChar:s?`ilbs<<`:`(`,closeChar:s?`>>`:`)`,count:this.chunks.length,indefiniteLength:!0,indefiniteMarker:!s,encodingWidth:void 0,hasEntryComments:t=>e.f(this.chunks[t]),renderEntry:e=>this.chunks[e]._toCDN(o(e),n+1,a?[...i,e]:void 0),entryIsLeaf:s?void 0:()=>!0,alwaysInlineLeaf:s,entryIsMultiWordText:e=>this.chunks[e]._isMultiWordText(o(e),!s,a?[...i,e]:void 0),entryLeadingNode:e=>this.chunks[e],entryTrailing:(t,n)=>e.d(this.chunks[t],n),entryOptions:a?o:void 0})}_toHexDump(t,n){let r=[{depth:t,hex:e.M(95),comment:`Start indefinite-length byte string`}];for(let i of this.chunks)e.b(r,i._toHexDump(t+1,n));return r.push({depth:t,hex:e.M(255),comment:`"break"`}),r}_toJS(e){let t=this.chunks.reduce((e,t)=>e+t.value.length,0),n=new Uint8Array(t),r=0;for(let e of this.chunks)n.set(e.value,r),r+=e.value.length;return n}},M=class extends T{indefiniteLength=!0;chunks;constructor(e){super(),this.chunks=e}_encodeTo(e,t){e.writeByte(127);for(let n of this.chunks)n._encode(e,t);e.writeByte(255)}_isMultiWordText(e,t=!0){return this.chunks.some(t=>t._isMultiWordText(e))}_toCDN(t,n,r){if((t?.encodingIndicators??`auto`)===`never`)return new z(this.chunks.map(e=>e.value).join(``))._toCDN(t,n);let i=r??[],a=Te(t),o=e=>a?this.chunks[e]._resolveCdnOptions(t,[...i,e],{parent:this}):t,s=!!t?.modernStreamSyntax&&t?.appPrefix!==!1;return!s&&this.chunks.length===0?`""_`:e.E({node:this,options:t,depth:n,openChar:s?`ilts<<`:`(`,closeChar:s?`>>`:`)`,count:this.chunks.length,indefiniteLength:!0,indefiniteMarker:!s,encodingWidth:void 0,hasEntryComments:t=>e.f(this.chunks[t]),renderEntry:e=>this.chunks[e]._toCDN(o(e),n+1,a?[...i,e]:void 0),entryIsLeaf:s?void 0:()=>!0,alwaysInlineLeaf:s,entryIsMultiWordText:e=>this.chunks[e]._isMultiWordText(o(e),!s,a?[...i,e]:void 0),entryLeadingNode:e=>this.chunks[e],entryTrailing:(t,n)=>e.d(this.chunks[t],n),entryOptions:a?o:void 0})}_toHexDump(t,n){let r=[{depth:t,hex:e.M(127),comment:`Start indefinite-length text string`}];for(let i of this.chunks)e.b(r,i._toHexDump(t+1,n));return r.push({depth:t,hex:e.M(255),comment:`"break"`}),r}_toJS(e){return this.chunks.map(e=>e.value).join(``)}},N=class extends T{items;indefiniteLength;encodingWidth;constructor(e,t){super(),this.items=e,this.indefiniteLength=t?.indefiniteLength??!1,this.encodingWidth=t?.encodingWidth}get _containsCdnContainer(){return!0}_encodeTo(e,t){if(this.indefiniteLength){e.writeByte(159);for(let n of this.items)n._encode(e,t);e.writeByte(255);return}C(e,4,this.items.length,this.encodingWidth);for(let n of this.items)n._encode(e,t)}_toCDN(t,n,r){let i=r??[],a=Te(t),o=e=>a?this.items[e]._resolveCdnOptions(t,[...i,e],{parent:this}):t;return e.E({node:this,options:t,depth:n,openChar:`[`,closeChar:`]`,count:this.items.length,indefiniteLength:this.indefiniteLength,encodingWidth:this.encodingWidth,hasEntryComments:t=>e.f(this.items[t]),renderEntry:e=>this.items[e]._toCDN(o(e),n+1,a?[...i,e]:void 0),entryIsLeaf:e=>!this.items[e]._containsCdnContainer,entryIsMultiWordText:e=>this.items[e]._isMultiWordText(o(e),!0,a?[...i,e]:void 0),entryLeadingNode:e=>this.items[e],entryTrailing:(t,n)=>e.d(this.items[t],n),entryOptions:a?o:void 0})}_toHexDump(t,n){if(this.indefiniteLength){let r=[{depth:t,hex:e.M(159),comment:`Start indefinite-length array`}];for(let i of this.items)e.b(r,i._toHexDump(t+1,n));return r.push({depth:t,hex:e.M(255),comment:`"break"`}),r}let r=[{depth:t,hex:e.P(oe(4,BigInt(this.items.length),this.encodingWidth)),comment:`Array of length ${this.items.length}`}];for(let i of this.items)e.b(r,i._toHexDump(t+1,n));return r}_toJS(e,t,n){let r=e?.reviver,i=me(e),a=n??ye,o=(e,n,r,o)=>i?e._toJSChild(r,[...t??[],n],o?[...a,ve,n]:[...a,n],{parent:this}):e._toJS(r);if(!r)return this.items.map((t,n)=>o(t,n,e,!1));let s=he(e),c=this.items.map((e,t)=>o(e,t,s,!0)),l=0;for(let t=0;t<this.items.length;t++){let n=t-l,i=o(this.items[t],t,e,!1),a=r.call(c,String(t),i);a===p||e?.undefinedOmits&&a===void 0?(c.splice(n,1),l++):c[n]=a}return c}},P=class extends T{entries;indefiniteLength;encodingWidth;constructor(e,t){super(),this.entries=e,this.indefiniteLength=t?.indefiniteLength??!1,this.encodingWidth=t?.encodingWidth}get _containsCdnContainer(){return!0}_encodeTo(e,t){if(this.indefiniteLength){e.writeByte(191);for(let[n,r]of this.entries)n._encode(e,t),r._encode(e,t);e.writeByte(255);return}C(e,5,this.entries.length,this.encodingWidth);for(let[n,r]of this.entries)n._encode(e,t),r._encode(e,t)}_toCDN(t,n,r){let i=r??[],a=Te(t),o=[],s=e=>{let n=o[e];if(!n){let[r,s]=this.entries[e];if(!a)n=[void 0,t,t];else{let e=r instanceof z?r.value:r.toCDN();n=[e,r._resolveCdnOptions(t,i,{parent:this,isMapKey:!0,keyNode:r}),s._resolveCdnOptions(t,[...i,e],{parent:this,keyNode:r})]}o[e]=n}return n},c=[],l=e=>{let t=c[e];if(!t){let[r,o]=this.entries[e],[l,u,d]=s(e);t=[r._toCDN(u,n+1,a?i:void 0),o._toCDN(d,n+1,a?[...i,l]:void 0)],c[e]=t}return t};return e.E({node:this,options:t,depth:n,openChar:`{`,closeChar:`}`,count:this.entries.length,indefiniteLength:this.indefiniteLength,encodingWidth:this.encodingWidth,hasEntryComments:t=>{let[n,r]=this.entries[t];return e.f(n)||e.f(r)},renderEntry:(e,t)=>{let[n,r]=l(e);return`${n}${t}${r}`},entryIsLeaf:e=>{let[t,n]=this.entries[e];return!t._containsCdnContainer&&!n._containsCdnContainer},entryIsMultiWordText:t=>{let[n,r]=this.entries[t],[o,c,u]=s(t),d=a?i:void 0,f=a?[...i,o]:void 0;if(n._isMultiWordText(c,!0,d)||r._isMultiWordText(u,!0,f))return!0;let[p,m]=l(t);return e._(p)||e._(m)},entryLeadingNode:e=>this.entries[e][0],entryTrailing:(e,t)=>{let[n,r]=this.entries[e];return Be([...n.comments?.trailing??[],...r.comments?.leading??[],...r.comments?.trailing??[]],t)},entryOptions:a?e=>s(e)[1]:void 0})}_toHexDump(t,n){if(this.indefiniteLength){let r=[{depth:t,hex:e.M(191),comment:`Start indefinite-length map`}];for(let[i,a]of this.entries)e.b(r,i._toHexDump(t+1,n)),e.b(r,a._toHexDump(t+1,n));return r.push({depth:t,hex:e.M(255),comment:`"break"`}),r}let r=[{depth:t,hex:e.P(oe(5,BigInt(this.entries.length),this.encodingWidth)),comment:`Map of length ${this.entries.length}`}];for(let[i,a]of this.entries)e.b(r,i._toHexDump(t+1,n)),e.b(r,a._toHexDump(t+1,n));return r}_toJS(e,t,n){let r=e?.reviver,i=me(e),a=t??[],o=n??ye,s=()=>{let t=(e,t,n,r)=>{if(!i)return[e._toJS(r),t._toJS(r)];let s=e._toJSChild(r,a,[...o,`k${n}`],{parent:this,isMapKey:!0,keyNode:e});return[s,t._toJSChild(r,[...a,s],[...o,`v${n}`],{parent:this,keyNode:e})]},n=Hs.from(this.entries,([n,r],i)=>t(n,r,i,e));if(!r)return n;let s=e?.undefinedOmits;for(let e=0;e<n.length;e++){let[t,i]=n[e],a=r.call(n,t,i);a===p||s&&a===void 0?n.splice(e--,1):n[e]=[t,a]}return n},c=()=>{let t=(e,t,n,r,s,c)=>i?t._toJSChild(s,[...a,n],c?[...o,ve,`v${r}`]:[...o,`v${r}`],{parent:this,keyNode:e}):t._toJS(s),n=he(e),s={};for(let i=0;i<this.entries.length;i++){let[a,o]=this.entries[i],c=a instanceof z?a.value:a._jsObjectKey(e)??a.toCDN(),l=t(a,o,c,i,n,!!r);c===`__proto__`?Object.defineProperty(s,c,{value:l,writable:!0,enumerable:!0,configurable:!0}):s[c]=l}if(!r)return s;let c=new Map;for(let t=0;t<this.entries.length;t++){let[n]=this.entries[t];c.set(n instanceof z?n.value:n._jsObjectKey(e)??n.toCDN(),t)}for(let n=0;n<this.entries.length;n++){let[i,a]=this.entries[n],o=i instanceof z?i.value:i._jsObjectKey(e)??i.toCDN();if(c.get(o)!==n)continue;let l=t(i,a,o,n,e,!1),u=r.call(s,o,l);u===p||e?.undefinedOmits&&u===void 0?delete s[o]:o===`__proto__`?Object.defineProperty(s,o,{value:u,writable:!0,enumerable:!0,configurable:!0}):s[o]=u}return s};if(e?.mapAs===`entries`)return s();if(e?.mapAs===`object`)return c();let l=t=>t instanceof z||e?.eRefKeys!==!1&&t._jsObjectKey(e)!==void 0;return(()=>{let t=new Map;for(let[n]of this.entries){if(!l(n))return!1;let r=n instanceof z,i=r?n.value:n._jsObjectKey(e),a=t.get(i);if(a!==void 0&&!(a&&r))return!1;t.set(i,r)}return!0})()?c():s()}};function Be(t,n){return t.length===0?``:` `+t.map(t=>e.i(t,n).trimEnd()).join(` `)}var F=class e extends T{value;ednSource;constructor(e,t){if(super(),!Number.isInteger(e)||e<0||e>255)throw RangeError(`CborSimple value must be an integer in 0–255`);this.value=e,this.ednSource=t?.ednSource}static FALSE=new e(20);static TRUE=new e(21);static NULL=new e(22);static UNDEFINED=new e(23);_encodeTo(e,t){if(this.value<=23){e.writeByte(224|this.value);return}e.writeByte(248),e.writeByte(this.value)}_toCDN(e,t){if(e?.preserveNumberFormat&&this.ednSource!==void 0)return`simple(${this.ednSource})`;switch(this.value){case 20:return`false`;case 21:return`true`;case 22:return`null`;case 23:return`undefined`;default:return`simple(${this.value})`}}_toJS(e){switch(this.value){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:return new m(this.value)}}},I=class extends T{items;encodingWidth;constructor(e,t){super(),this.items=e,this.encodingWidth=t?.encodingWidth}get _containsCdnContainer(){return this.items.some(e=>e._containsCdnContainer)}_content(e){let t=new re;for(let n of this.items)n._encode(t,e);return t.finish()}_encodeTo(e,t){let n=this._content(t);C(e,2,n.length,this.encodingWidth),e.writeBytes(n)}_toCDN(t,n,r){let i=r??[],a=Te(t),o=e=>a?this.items[e]._resolveCdnOptions(t,[...i,e],{parent:this}):t;return e.E({node:this,options:t,depth:n,openChar:`<<`,closeChar:`>>`,count:this.items.length,indefiniteLength:!1,encodingWidth:this.encodingWidth,eiPosition:`close`,canonicalCount:()=>BigInt(this._content(t).length),hasEntryComments:t=>e.f(this.items[t]),renderEntry:e=>this.items[e]._toCDN(o(e),n+1,a?[...i,e]:void 0),alwaysInlineLeaf:!0,entryIsMultiWordText:e=>this.items[e]._isMultiWordText(o(e),!1,a?[...i,e]:void 0),entryLeadingNode:e=>this.items[e],entryTrailing:(t,n)=>e.d(this.items[t],n),entryOptions:a?o:void 0})}_toHexDump(t,n){let r=this._content().length,i=[{depth:t,hex:e.P(oe(2,BigInt(r),this.encodingWidth)),comment:`Embedded CBOR sequence, ${r} byte${r===1?``:`s`}`}];for(let r of this.items)e.b(i,r._toHexDump(t+1,n));return i}_toJS(e){return this._content()}};function Ve(e){let t=``,n=0;for(;n<e.length;){let r=e[n];if(r===` `||r===`
|
|
4
|
+
`||r===`\r`){n++;continue}if(r===`#`){for(;n<e.length&&e[n]!==`
|
|
5
|
+
`;)n++;continue}if(r===`/`){let t=e[n+1]??``;if(t===`/`){for(;n<e.length&&e[n]!==`
|
|
6
|
+
`;)n++;continue}if(t===`*`){for(n+=2;n<e.length&&(e[n]!==`*`||(e[n+1]??``)!==`/`);)n++;if(n>=e.length)throw SyntaxError(`unterminated block comment`);n+=2;continue}for(n++;n<e.length&&e[n]!==`/`;)n++;if(n>=e.length)throw SyntaxError(`unterminated block comment`);n++;continue}t+=r,n++}return t}var He=`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`,Ue=`0123456789ABCDEFGHIJKLMNOPQRSTUV`;function We(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===61;)t--;return e.slice(0,t)}function Ge(e,t,n){let r=We(e).toUpperCase(),i=r.length%8;if(i===1||i===3||i===6)throw SyntaxError(`invalid base32 length: ${r.length} characters`);let a=new Uint8Array(128).fill(255);for(let e=0;e<t.length;e++)a[t.charCodeAt(e)]=e;let o=new Uint8Array(Math.floor(r.length*5/8)),s=0,c=0,l=0;for(let e of r){let t=e.charCodeAt(0),n=t<128?a[t]:255;if(n===255)throw SyntaxError(`invalid character in byte string: ${JSON.stringify(e)}`);s=s<<5|n,c+=5,c>=8&&(c-=8,o[l++]=s>>c&255)}if(c>0&&s&(1<<c)-1){let e=`non-zero trailing bits in base32 input`;if(n)n(e);else throw SyntaxError(e)}return o}var Ke={appStringPrefixes:[`b32`],parseAppString(e,t,n){return new A(Ge(Ve(t),He,n),{ednEncoding:`base32`})}},qe={appStringPrefixes:[`h32`],parseAppString(e,t,n){return new A(Ge(Ve(t),Ue,n),{ednEncoding:`base32hex`})}},Je=999n,Ye=class extends k{constructor(e,t){let n=t.length===1&&t[0]instanceof z?t[0]:new N(t);super(Je,new N([new z(e),n]))}get _isAppString(){return this.content.items[1]instanceof z}get _containsCdnContainer(){return!this._isAppString&&super._containsCdnContainer}_toCDN(t,n){if(t?.appPrefix===!1)return super._toCDN(t,n);let r=this.content,i=r.items[0].value,a=r.items[1];return a instanceof z?`${i}${e.s(a.value)}`:`${i}<<${a.items.map(e=>e._toCDN(t,n)).join(`, `)}>>`}},Xe=class extends T{inner;ednSource;constructor(e,t){super(),this.inner=e,this.ednSource=t}get _containsCdnContainer(){return this.inner._containsCdnContainer}_isMultiWordText(t,n=!0,r){return e.h(this._toCDN(t,0,r),n)}_encodeTo(e,t){this.inner._encode(e,t)}_toCDN(t,n,r){let i=t?.encodingIndicators??`auto`;if(t?.appPrefix===!1||i!==`auto`||e.w(t)===null&&/[\r\n]/.test(this.ednSource))return this.inner._toCDN(this.inner._resolveCdnOptions(t,r??[],{parent:this}),n,r);if(!Te(t))return this.ednSource;let a=t[De],o={applied:!1},s={...t,[De]:o},c=this.inner._toCDN(this.inner._resolveCdnOptions(s,r??[],{parent:this}),n,r);return o.applied&&a&&(a.applied=!0),o.applied?c:this.ednSource}_toJS(e,t,n){return me(e)?this.inner._toJSChild(e,t??[],n??ye,{parent:this}):this.inner._toJS(e)}},Ze=888n;function Qe(t,n,r,i){return r?[...(t.comments?.trailing??[]).map(t=>e.i(t,i)),...(n.comments?.leading??[]).map(t=>e.i(t,i))]:[]}function $e(t,n,r,i){return r===null||!n.some(e=>e.length>0)?t.join(` + `):e.y(t,r,i,n)}function et(t,n,r,i){if(t===void 0)return;let a=e.D(n)||i===void 0?t:e.k(t,i);return nt(a,r)?a:void 0}function tt(e,t){return e!==void 0&&nt(e,t)}function nt(e,t){return t!==null||!/[\r\n]/.test(e)}var L=class t extends k{realBoundary;fromByteLiteral;literalSource;constructor(e,t){Array.isArray(e)?(super(Ze,new N(e)),this.fromByteLiteral=!1,this.literalSource=void 0,this.realBoundary=t):(super(Ze,F.NULL),this.fromByteLiteral=e??!1,this.literalSource=t,this.realBoundary=void 0)}_toCDN(n,r){if(n?.appPrefix===!1)return super._toCDN(n,r);if(this.content instanceof F)return`...`;if(this.content instanceof N){let i=!!n?.preserveConcatenation;if(i||n?.preserveByteString&&!this._hasRealConcatenation()){let e=this._renderPreservedBytesElision(n,r);if(e!==void 0)return e}if(!i||this.realBoundary===void 0){let e=this._compactHexElided();if(e!==void 0)return e}let a=this.content.items,o=a.map(e=>i?this._renderFragment(e,n,r):e._toCDN(n,r)),s=e.D(n),c=e.S(n),l=a.slice(1).map((e,t)=>Qe(a[t],e,s,c));if(n?.modernConcat){let i=a.every(e=>e instanceof A||e instanceof t&&e.content instanceof F);return e.v(i?`b1`:`t1`,o,``,e.w(n),r,l)}return $e(o,l,e.w(n),r)}return super._toCDN(n,r)}_hasRealConcatenation(){return this.realBoundary?.some((e,t)=>t>0&&e)?!0:this.content.items.some(e=>e instanceof A&&e.ednParts!==void 0&&e.ednParts.length>1)}_renderFragment(t,n,r){let i=e.w(n),a=e.D(n),o=e.S(n),s=!!n?.modernConcat;if(t instanceof A&&t.ednParts!==void 0&&t.ednParts.length>1){let c=n?.appPrefix===!1?`hex`:n?.bstrEncoding??t.ednEncoding,l=t.ednParts.map(t=>{let r=n?.preserveByteString?et(t.source,n,i,t.commentSyntax):void 0;return r===void 0?e.T(t.bytes,c,n?.sqstr):r}),u=a?e.a(t.comments?.dangling,t.ednParts,o)??[]:[];return s?e.v(`b1`,l,``,i,r,u):$e(l,u,i,r)}if(t instanceof z&&t.ednParts!==void 0&&t.ednParts.length>1){let c=n?.preserveRawString?t.ednPartSources:void 0,l=t.ednParts.map((t,n)=>{let r=c?.[n];return tt(r,i)?r:e.c(t)}),u=a?e.a(t.comments?.dangling,t.ednPartSpans,o)??[]:[];return s?e.v(`t1`,l,``,i,r,u):$e(l,u,i,r)}return t._toCDN(n,r)}_compactHexElided(){let n=this.content.items,r=``,i=!1;for(let a of n)if(a instanceof A)r+=e.N(a.value),i=!0;else if(a instanceof t&&a.content instanceof F)r+=`...`;else return;if(i)return`h'${r}'`}_renderPreservedBytesElision(n,r){if(this.realBoundary===void 0)return;let i=this.realBoundary,a=this.content.items,o=[],s=[],c=[],l=e=>{c.length>0&&(o.push(c),s.push(e??[]),c=[])},u=e.D(n),d=e.S(n);for(let n=0;n<a.length;n++){let r=a[n];if(n>0&&i[n]&&l(Qe(a[n-1],r,u,d)),r instanceof t&&r.content instanceof F)c.push({ellipsis:!0,fromByteLiteral:r.fromByteLiteral,literalSource:r.literalSource});else if(r instanceof A){if(r.ednParts!==void 0&&r.ednParts.length>1){let[t,...n]=r.ednParts;c.push({bytes:t.bytes,source:t.source,commentSyntax:t.commentSyntax});let i=u?e.a(r.comments?.dangling,r.ednParts,d):void 0;n.forEach((e,t)=>{l(i?.[t]),c.push({bytes:e.bytes,source:e.source,commentSyntax:e.commentSyntax})})}else c.push({bytes:r.value,source:r.ednSource,commentSyntax:r.ednCommentSyntax})}else return}if(c.length>0&&o.push(c),o.length===0)return;let f=n?.appPrefix===!1?`hex`:n?.bstrEncoding??`hex`,p=e.w(n),m=o.map(t=>{if(n?.preserveByteString)for(let e of t){if(!(`ellipsis`in e))continue;let t=et(e.literalSource,n,p,`full`);if(t!==void 0)return t}let r=t.filter(e=>!(`ellipsis`in e));if(r.length===0)return t.some(e=>`ellipsis`in e&&e.fromByteLiteral)?`h'...'`:`...`;if(t.length===1){let t=r[0],i=n?.preserveByteString?et(t.source,n,p,t.commentSyntax):void 0;return i===void 0?e.T(t.bytes,f,n?.sqstr):i}return`h'${t.map(t=>`ellipsis`in t?`...`:e.N(t.bytes)).join(``)}'`});return n?.preserveConcatenation&&n?.modernConcat&&m.length>1?e.v(`b1`,m,``,p,r,s):$e(m,s,p,r)}},rt=2n,it=3n,at=18446744073709551615n,ot=-18446744073709551616n;function st(e){if(e<0n)throw RangeError(`bigintToBytes requires a non-negative value`);if(e===0n)return new Uint8Array;let t=e.toString(16);t.length%2!=0&&(t=`0`+t);let n=new Uint8Array(t.length/2);for(let e=0;e<n.length;e++)n[e]=parseInt(t.slice(e*2,e*2+2),16);return n}function ct(e){let t=0n;for(let n of e)t=t<<8n|BigInt(n);return t}var lt=class extends k{bigValue;constructor(e){if(e<=at)throw RangeError(`CborBigUint value ${e} fits in CborUint; use CborUint instead`);super(rt,new A(st(e))),this.bigValue=e}_toCDN(e,t){return this.bigValue.toString()}_toJS(e){return this.bigValue}},ut=class extends k{bigValue;constructor(e){if(e>=ot)throw RangeError(`CborBigNint value ${e} fits in CborNint; use CborNint instead`);super(it,new A(st(-1n-e))),this.bigValue=e}_toCDN(e,t){return this.bigValue.toString()}_toJS(e){return this.bigValue}},dt=new TextEncoder,ft=new TextDecoder(`utf-8`,{fatal:!0}),pt=new TextDecoder(`utf-8`,{fatal:!1});function mt(t,n){let r=new e.A(t,{offset:n?.offset,skipRS:n?._skipRS}),i=new Pt(r,n??{}).parse();return(e.D(n)||n?.preserveAll)&&(Et(i,r.comments,t),kt(i)),i}function ht(e){let t=e,n;return/[_][0-7i]$/.test(e)&&(n=e[e.length-1],t=e.slice(0,-2)),{numStr:t,rawSuffix:n}}function gt(e){return e.startsWith(`-`)?-BigInt(e.slice(1)):BigInt(e)}function _t(e){if(e!==void 0)return yt([e.appSeqSourceFeatures,vt(e)])}function vt(e){if(e instanceof A)return{byteString:!0,concatenation:e.ednParts!==void 0&&e.ednParts.length>1};if(e instanceof z){let t=e.ednParts!==void 0,n=e.ednPartSources?.filter(e=>e!==void 0).length??0,r=t?e.ednParts.reduce((t,n,r)=>{let i=e.ednPartSources?.[r]!==void 0,a=e.ednPartIsByteString?.[r]??!1;return i||!a?t:t+1},0):0,i=(t?e.ednParts.length:0)-n-r;return{byteString:r>0,textString:e.quotedEdnSource!==void 0||i>0,rawString:e.ednSource!==void 0||n>0,concatenation:t&&e.ednParts.length>1}}if(e instanceof N)return yt(e.items.map(_t));if(e instanceof P)return yt(e.entries.flatMap(([e,t])=>[_t(e),_t(t)]));if(e instanceof k)return _t(e.content);if(e instanceof j||e instanceof M||e instanceof I)return yt((e instanceof I?e.items:e.chunks).map(_t))}function yt(e){let t=e.filter(e=>e!==void 0);if(t.length!==0)return{byteString:t.some(e=>e.byteString),textString:t.some(e=>e.textString),rawString:t.some(e=>e.rawString),concatenation:t.some(e=>e.concatenation)}}function bt(e,t){if(e.endsWith(`_i`)||e.endsWith(`_0`)){let n=`_0 and _i encoding indicators are not valid for floating-point values`;if(t)t(n),e=e.slice(0,-2);else throw SyntaxError(`EDN parse error: ${n}`)}else if(/[_][4567]$/.test(e)){let n=e[e.length-1],r=n===`7`?`indefinite-length encoding (_7) is not valid for floating-point values`:`encoding indicator _${n} (AI ${Number(n)+24}) is reserved and not valid`;if(t)t(r),e=e.slice(0,-2);else throw SyntaxError(`EDN parse error: ${r}`)}if(e===`NaN`)return{value:NaN,precision:void 0};if(e===`Infinity`)return{value:1/0,precision:void 0};if(e===`-Infinity`)return{value:-1/0,precision:void 0};let n=e,r;return e.endsWith(`_1`)?(r=`half`,n=e.slice(0,-2)):e.endsWith(`_2`)?(r=`single`,n=e.slice(0,-2)):e.endsWith(`_3`)&&(r=`double`,n=e.slice(0,-2)),/^-?0[xX]/.test(n)?{value:ke(n),precision:r}:{value:parseFloat(n),precision:r}}var xt=/\r?\n[ \t]*\r?\n/;function St(e,t,n){return xt.test(e.slice(t,n))}function Ct(e,t,n,r){let i=[];for(let a=t;a<e.length;a++){let t=e[a];if(t.start>=r)break;t.start>=n&&t.end<=r&&i.push({...t,start:t.start-n,end:t.end-n})}return i}function wt(e,t,n,r){if(n.end!==void 0)return{start:(/_[0-7i]$/.test(e.slice(Math.max(0,n.end-2),n.end))?n.end-2:n.end)-t,end:n.end-t,always:r,never:``}}function Tt(t,n,r){if(r instanceof E){let i=wt(t,n,r,`_${r.encodingWidth??e.r(r.value)}`);return i?[i]:[]}if(r instanceof D){let i=wt(t,n,r,`_${r.encodingWidth??e.r(r.argument)}`);return i?[i]:[]}if(r instanceof O){let e=r.precision??w(r.value),i=wt(t,n,r,e===`half`?`_1`:e===`single`?`_2`:`_3`);return i?[i]:[]}if(r instanceof A){let i=wt(t,n,r,`_${r.encodingWidth??e.r(BigInt(r.value.length))}`);return i?[i]:[]}if(r instanceof z){let i=wt(t,n,r,`_${r.encodingWidth??e.r(BigInt(dt.encode(r.value).length))}`);return i?[i]:[]}if(r instanceof N){let i=[];if(r.indefiniteLength)return;if(r.start!==void 0){let a=new e.A(t,{offset:r.start}),o=a.consume(),s=a.peek(),c=s.type===`ENCODING_INDICATOR`,l=`_${r.encodingWidth??e.r(BigInt(r.items.length))}`,u=t[o.endOffset]??``,d=!c&&/[+\-.0-9A-Z_a-z]/.test(u)?` `:``;i.push({start:(c?s.offset:o.endOffset)-n,end:(c?s.endOffset:o.endOffset)-n,always:l+d,never:``})}for(let a of r.items){let r=Tt(t,n,a);if(r===void 0)return;e.b(i,r)}return i}}function Et(e,t,n){if(t.length===0)return;let r=Dt(e),i=At(n),a=[...r].sort((e,t)=>e.start-t.start||t.end-e.end),o=[...r].sort((e,t)=>e.end-t.end||e.start-t.start),s=[...t].sort((e,t)=>e.start-t.start),c=[],l=0;for(let e of s){let t={...e},r=0,s=o.length;for(;r<s;){let t=r+s>>1;o[t].end<=e.start?r=t+1:s=t}let u=r>0?o[r-1]:void 0,d=u?n.slice(u.end,e.start):``;if(u&&i(u.end)===e.line&&!d.includes(`:`)){Ot(u.node,`trailing`,t);continue}for(;l<a.length&&a[l].start<e.start;){let e=a[l++];for(;c.length>0&&c[c.length-1].end<=e.start;)c.pop();c.push(e)}for(;c.length>0&&c[c.length-1].end<=e.start;)c.pop();let f=c.length>0?c[c.length-1]:void 0;for(r=0,s=a.length;r<s;){let t=r+s>>1;a[t].start<e.end?r=t+1:s=t}let p=r<a.length?a[r]:void 0;if((!f||p&&p.end<=f.end)&&p){t.sameLine=i(e.end)===i(p.start),Ot(p.node,`leading`,t);continue}f&&Ot(f.node,`dangling`,t)}}function Dt(e){let t=[],n=e=>{if(e.start!==void 0&&e.end!==void 0&&t.push({node:e,start:e.start,end:e.end}),e instanceof N||e instanceof I){for(let t of e.items)n(t);return}if(e instanceof P){for(let[t,r]of e.entries)n(t),n(r);return}if(e instanceof j||e instanceof M){for(let t of e.chunks)n(t);return}e instanceof k&&n(e.content)};return n(e),t}function Ot(e,t,n){e.comments??={},e.comments[t]??=[],e.comments[t].push(n)}function kt(e){if(e instanceof L){if(e.content instanceof N){let t=e.content.items;for(let e of t)kt(e);let n=t[t.length-1],r=n?.comments?.trailing;r!==void 0&&r.length>0&&!e.comments?.trailing?.length&&(e.comments??={},e.comments.trailing=r,n.comments.trailing=void 0)}return}if(e instanceof N||e instanceof I){for(let t of e.items)kt(t);return}if(e instanceof P){for(let[t,n]of e.entries)kt(t),kt(n);return}if(e instanceof j||e instanceof M){for(let t of e.chunks)kt(t);return}e instanceof k&&kt(e.content)}function At(e){let t=[0];for(let n=0;n<e.length;n++)e[n]===`
|
|
7
|
+
`&&t.push(n+1);return n=>{let r=Math.max(0,Math.min(e.length,n));r>0&&r===e.length&&r--;let i=0,a=t.length-1;for(;i<=a;){let e=i+a>>1;t[e]<=r?i=e+1:a=e-1}return a+1}}var jt=e=>`import { ${e} } from '@cbortech/cbor' and pass it via the 'extensions' option (extensions: [${e}])`,Mt=(e,t)=>`install ${t}, import { ${e} } from '${t}', and pass it via the 'extensions' option (extensions: [${e}])`,R=e=>`'${e}' is a default built-in extension that was excluded via the 'builtinExtensions' option; add it back to that array (or omit 'builtinExtensions' to use the default set)`,Nt=new Map([[`b32`,jt(`b32`)],[`h32`,jt(`h32`)],[`same`,jt(`same`)],[`hash`,Mt(`hash`,`@cbortech/hash-extension`)],[`uuid`,Mt(`uuid`,`@cbortech/uuid-extension`)],[`UUID`,Mt(`uuid`,`@cbortech/uuid-extension`)],[`dt`,R(`dt`)],[`DT`,R(`dt`)],[`ip`,R(`ip`)],[`IP`,R(`ip`)],[`cri`,R(`cri`)],[`CRI`,R(`cri`)],[`t1`,R(`t1`)],[`b1`,R(`b1`)],[`ilbs`,R(`ilbs`)],[`ilts`,R(`ilts`)],[`float`,R(`float`)],[`e`,`pass the 'cddl' option (a compiled CddlSchema or CDDL source text) — e'...' external references are enabled automatically whenever a CDDL schema is supplied`]]),Pt=class{t;_options;extByPrefix;extByTag;unresolvedExtension;_pendingWarnings=[];_hintedPrefixes=new Set;constructor(t,n){this.t=t,this._options=n,this.extByPrefix=new Map,this.extByTag=new Map,this.unresolvedExtension=n.unresolvedExtension??`cpa999`;let r=mi(n.builtinExtensions);for(let e of[...r,...n.extensions??[]]){for(let t of e.appStringPrefixes??[])this.extByPrefix.set(t,e);for(let t of e.tagNumbers??[])this.extByTag.set(t,e)}this.t.onEscapeWarning=(t,n,r,i,a)=>{let o={message:t,offset:n,line:r,column:i,endOffset:a};if(this._pendingWarnings.push(o),this._options.onWarning?this._options.onWarning(o):this._options.silent||console.warn(`CDN strict violation at line ${r}, column ${i}: ${t}`),this._options.strict!==!1)throw new e.I(t,{offset:n,line:r,column:i,endOffset:a})}}parse(){let e=this.parseValue();if(this._options.allowTrailing)return e;let t=this.t.peek();if(t.type!==`EOF`)for(this._warnOrFail(`unexpected token after value: ${JSON.stringify(t.value)}`,t),this._pendingWarnings.length>0&&(e.warnings??=[],e.warnings.push(...this._pendingWarnings),this._pendingWarnings=[]);this.t.peek().type!==`EOF`;)this.t.consume();return e}parseValue(){let e=this.t.peek().offset,t=this._parseValueNode();if(this.t.peek().type===`UNDERSCORE`){let e=this.t.consume();this._warnOrFail(`bare _ is not a valid encoding indicator; use _0, _1, _2, _3, or _i`,e)}if(this._pendingWarnings.length>0){t.warnings??=[];for(let e of this._pendingWarnings)t.warnings.push(e);this._pendingWarnings=[]}return t.start=e,t.end=this.t.lastEndOffset,t}_parseValueNode(){let e=this.t.peek();switch(e.type){case`INTEGER`:return this.parseIntegerOrTag();case`FLOAT`:return this.parseFloat();case`TSTR`:case`RAWSTRING`:return this.parseString();case`BYTES_HEX`:case`SQSTR`:case`BYTES_B64`:return this.t.consume(),this._parseBytesConcat(this._decodeBytesToken(e),e.type,e.raw,e.offset,e.endOffset);case`EMPTY_INDEF_BYTES`:return this.t.consume(),new j([]);case`EMPTY_INDEF_TEXT`:return this.t.consume(),new M([]);case`TRUE`:return this.t.consume(),new F(21);case`FALSE`:return this.t.consume(),new F(20);case`NULL`:return this.t.consume(),new F(22);case`UNDEFINED`:return this.t.consume(),new F(23);case`SIMPLE`:return this.parseSimple();case`LBRACKET`:return this.parseArray();case`LBRACE`:return this.parseMap();case`LPAREN`:return this.parseIndefGroup();case`LT_LT`:return this.parseEmbeddedCBOR();case`APP_STRING`:{this.t.consume();let t,n=``;if(this.t.peek().type===`ENCODING_INDICATOR`){let e=this.t.consume();t=this._resolveEncodingWidth(e.value,e),n=e.raw}let r=this.extByPrefix.get(e.appPrefix);if(!r?.parseAppString){if(r||this._hintMissingExtension(e.appPrefix,e),this.unresolvedExtension===`cpa999`)return new Ye(e.appPrefix,[new z(e.value)]);this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`,e)}{let i=this._pendingWarnings.length;try{let i=r.parseAppString(e.appPrefix,e.value,this._extOnError(e),t===void 0?void 0:{encodingWidth:t});return t!==void 0&&this._applyEiToResult(i,t,e),r.preserveAppSeqSource===`optional`?(i.appSeqSource=e.raw+n,i):i instanceof A&&Object.getPrototypeOf(i)===A.prototype&&i.ednSource===void 0?new A(i.value,{ednEncoding:i.ednEncoding,encodingWidth:i.encodingWidth,ednSource:e.raw+n,ednCommentSyntax:r===Ke||r===qe?`full`:void 0}):(i instanceof O&&i.ednSource===void 0&&(i.ednSource=e.raw+n),i)}catch(t){if(this._options.strict!==!1)throw t;return this._pendingWarnings.length===i&&this._warn(t instanceof Error?t.message:String(t),e),new Ye(e.appPrefix,[new z(e.value)])}}}case`APP_SEQUENCE`:{let t=this.t.comments.length;this.t.consume();let n=[];for(;this.t.peek().type!==`GT_GT`;){if(this.t.peek().type===`EOF`&&this._fail(`unterminated ${e.appPrefix}<<...>>`,e),n.length>0){if(this.t.peek().type===`COMMA`){if(this.t.consume(),this.t.peek().type===`GT_GT`)break}else this.t.peek().offset===this.t.lastEndOffset&&this._warnOrFail(`<<...>> items must be separated by "," or whitespace`,this.t.peek())}n.push(this.parseValue())}this.expect(`GT_GT`);let r,i;this.t.peek().type===`ENCODING_INDICATOR`&&(i=this.t.consume(),r=this._resolveEncodingWidth(i.value,i));let a=this.extByPrefix.get(e.appPrefix);if(!a){if(this._hintMissingExtension(e.appPrefix,e),this.unresolvedExtension===`cpa999`)return new Ye(e.appPrefix,n);this._fail(`unknown app-string extension: ${JSON.stringify(e.appPrefix)}`,e)}a.parseAppSequence||this._fail(`app-string extension ${JSON.stringify(e.appPrefix)} does not support <<...>> form`,e);{let o=this._pendingWarnings.length;try{let o=a.parseAppSequence(e.appPrefix,n,this._extOnError(e));r!==void 0&&this._applyEiToResult(o,r,i??e);let s=this.t.source.slice(e.offset,this.t.lastEndOffset);if(a.preserveAppSeqSource===`optional`)o.appSeqSource=s,o.appSeqComments=Ct(this.t.comments,t,e.offset,this.t.lastEndOffset),n.length===1&&(n[0].end!==void 0&&(o.appSeqInnerEnd=n[0].end-e.offset),o.appSeqSourceFeatures=_t(n[0]));else if(o instanceof O)o.ednSource===void 0&&(o.ednSource=s);else if(a.preserveAppSeqSource)return new Xe(o,s);return o}catch(t){if(this._options.strict!==!1)throw t;return this._pendingWarnings.length===o&&this._warn(t instanceof Error?t.message:String(t),e),new Ye(e.appPrefix,n)}}}case`ELLIPSIS`:{if(this.t.consume(),this.t.peek().type!==`PLUS`)return new L;let e=[new L];for(;this.t.peek().type===`PLUS`;)this.t.consume(),e.push(this.parseValue());return new L(e,e.map(()=>!0))}case`BYTES_HEX_ELIDED`:return this.t.consume(),this._parseHexElidedConcat(e);default:this._fail(`unexpected token: ${JSON.stringify(e.value)}`,e)}}parseIntegerOrTag(){let t=this.t.comments.length,n=this.t.consume(),{numStr:r,rawSuffix:i}=ht(n.value),a=i===void 0?n.endOffset:n.endOffset-2,o=n.endOffset,s=i===void 0?this.consumeEncodingIndicator(void 0,e=>{a=e.offset,o=e.endOffset}):this._resolveEncodingWidth(i,n),c=gt(r),l=i===void 0?n.raw:n.raw.slice(0,-2);if(c>18446744073709551615n)return this.t.peek().type===`LPAREN`&&this._fail(`tag number exceeds maximum uint64`,n),new lt(c);if(c<-18446744073709551616n)return new ut(c);if(s!==void 0){let e=c>=0n?c:-(c+1n);s=this._validateEncodingFit(e,s,n)}let u=c>=0n?new E(c,{encodingWidth:s,ednSource:l}):new D(c,{encodingWidth:s,ednSource:l});if(this.t.peek().type===`LPAREN`){u instanceof E||this._fail(`tag number must be non-negative`,n),this.t.consume();let r=this._pendingWarnings.splice(0),i=this.parseValue();this.expect(`RPAREN`);let c=u.value,d=this.extByTag.get(c);if(d?.parseTag){let u=d.parseTag(c,i);if(u!==void 0){if(u instanceof k&&(s!==void 0&&u.encodingWidth===void 0&&(u.encodingWidth=s),u.ednSource===void 0&&(u.ednSource=l),d.preserveAppSeqSource===`optional`&&u.appSeqSource===void 0)){u.appSeqSource=this.t.source.slice(n.offset,this.t.lastEndOffset),u.appSeqComments=Ct(this.t.comments,t,n.offset,this.t.lastEndOffset);let r=u.encodingWidth??e.r(u.tag),s=Tt(this.t.source,n.offset,u.content);u.appSeqEncodingEdits=[{start:a-n.offset,end:o-n.offset,always:`_${r}`,never:``},...s??[]],s===void 0&&(u.appSeqEncodingEditsComplete=!1),u.appSeqSourceFeatures=_t(i)}return r.length>0&&(u.warnings??=[],u.warnings.push(...r)),u}}let f=new k(c,i,{encodingWidth:s,ednSource:l});return r.length>0&&(f.warnings??=[],f.warnings.push(...r)),f}return u}parseFloat(){let e=this.t.consume(),t=t=>this._warnOrFail(t,e),{value:n,precision:r}=bt(e.value,t);if(r===`half`||r===`single`){let e=r===`half`?v(_(n)):Math.fround(n);Object.is(n,e)||isNaN(n)&&isNaN(e)||t(`${n} cannot be exactly represented as ${r===`half`?`f16 (_1)`:`f32 (_2)`}; use _3 or remove the indicator`)}return new O(n,{precision:r,literalSource:e.raw})}parseString(){let e=this.t.consume();if(this.t.peek().type!==`PLUS`){let t=this.consumeEncodingIndicator(()=>BigInt(dt.encode(e.value).length));return e.type===`RAWSTRING`?new z(e.value,{ednSource:e.raw,...t===void 0?{}:{encodingWidth:t}}):new z(e.value,{quotedEdnSource:e.raw,...t===void 0?{}:{encodingWidth:t}})}let t=!1,n=[e.type===`RAWSTRING`?{text:e.value,source:e.raw,start:e.offset,end:e.endOffset}:{text:e.value,start:e.offset,end:e.endOffset}];for(;this.t.peek().type===`PLUS`;){this.t.consume();let e=this.t.peek();e.type===`ELLIPSIS`?(this.t.consume(),n.push({ellipsis:!0,start:e.offset,end:e.endOffset}),t=!0):e.type===`TSTR`||e.type===`RAWSTRING`?(this.t.consume(),n.push(e.type===`RAWSTRING`?{text:e.value,source:e.raw,start:e.offset,end:e.endOffset}:{text:e.value,start:e.offset,end:e.endOffset})):this._isBytesToken(e.type)?(this.t.consume(),n.push({text:this._decodeUtf8(this._decodeBytesToken(e),e),isByteString:!0,start:e.offset,end:e.endOffset})):this._fail(`expected string or byte string after +, got ${JSON.stringify(e.value)}`,e)}if(!t){let e=n.map(e=>`text`in e?e.text:``),t=n.map(e=>`text`in e?e.source:void 0),r=n.map(e=>`text`in e?e.isByteString??!1:!1),i=n.map(e=>({start:e.start,end:e.end})),a=e.join(``),o=this.consumeEncodingIndicator(()=>BigInt(dt.encode(a).length));return new z(a,{ednParts:e,ednPartSpans:i,...t.some(e=>e!==void 0)?{ednPartSources:t}:{},...r.some(e=>e)?{ednPartIsByteString:r}:{},...o===void 0?{}:{encodingWidth:o}})}let r=[],i=[],a=()=>{let e=i.map(e=>e.text),t=e.join(``);if(t!==``){let n=i.map(e=>e.source),a=i.map(e=>e.isByteString??!1),o=new z(t,{ednParts:e,ednPartSpans:i.map(e=>({start:e.start,end:e.end})),...n.some(e=>e!==void 0)?{ednPartSources:n}:{},...a.some(e=>e)?{ednPartIsByteString:a}:{}});o.start=i[0].start,o.end=i[i.length-1].end,r.push(o)}i.length=0};for(let e of n)if(`ellipsis`in e){a();let t=new L;t.start=e.start,t.end=e.end,r.push(t)}else i.push(e);return a(),new L(r)}_isBytesToken(e){return e===`BYTES_HEX`||e===`SQSTR`||e===`BYTES_B64`}_hexToBytes(t,n){try{return e.F(t)}catch(t){if(t instanceof e.I||!(t instanceof SyntaxError))throw t;this._fail(t.message,n)}}_decodeBytesToken(t){let n=e=>this._warnOrFail(e,t);switch(t.type){case`SQSTR`:{let e=t._sqstrBytes;return e===void 0?this._hexToBytes(t.value,t):e}case`BYTES_HEX`:return this._hexToBytes(t.value,t);case`BYTES_B64`:try{return e.j(t.value,n)}catch(n){if(n instanceof e.I||!(n instanceof SyntaxError))throw n;this._fail(n.message,t)}default:this._fail(`expected byte string token`,t)}}_decodeUtf8(e,t){if(this._options.allowInvalidUtf8)return pt.decode(e);try{return ft.decode(e)}catch{return this._warnOrFail(`byte string in text concatenation is not valid UTF-8`,t),pt.decode(e)}}_tokenTypeToCdnEncoding(e){return e===`BYTES_B64`?`base64`:`hex`}_tokenTypeToCommentSyntax(e){if(e===`BYTES_HEX`)return`full`;if(e===`BYTES_B64`)return`hash-only`}_parseBytesConcat(e,t,n,r,i){if(this.t.peek().type!==`PLUS`){let r=this.consumeEncodingIndicator(()=>BigInt(e.length));return new A(e,{ednEncoding:this._tokenTypeToCdnEncoding(t),ednSource:n,ednCommentSyntax:this._tokenTypeToCommentSyntax(t),...r===void 0?{}:{encodingWidth:r}})}let a=[{bytes:e,source:n,commentSyntax:this._tokenTypeToCommentSyntax(t),real:!1,start:r,end:i}],o=this._consumeByteEllipsisChain(a);return this._buildFromByteAtoms(o,this._tokenTypeToCdnEncoding(t))}_parseHexElidedConcat(e){let t=this._consumeByteEllipsisChain(this._elidedHexAtoms(e.value,e));return this._buildFromByteAtoms(t,`hex`)}_consumeByteEllipsisChain(t){let n=t;for(;this.t.peek().type===`PLUS`;){this.t.consume();let t=this.t.peek();if(t.type===`ELLIPSIS`)this.t.consume(),n.push({ellipsis:!0,real:!0,fromByteLiteral:!1,start:t.offset,end:t.endOffset});else if(t.type===`BYTES_HEX_ELIDED`){this.t.consume();let r=this._elidedHexAtoms(t.value,t);r.length>0&&(r[0].real=!0),e.b(n,r)}else this._isBytesToken(t.type)?(this.t.consume(),n.push({bytes:this._decodeBytesToken(t),source:t.raw,commentSyntax:this._tokenTypeToCommentSyntax(t.type),real:!0,start:t.offset,end:t.endOffset})):t.type===`TSTR`||t.type===`RAWSTRING`?(this.t.consume(),this._warnOrFail(`text string in a byte-string concatenation is not allowed; use a byte string literal (h'...', b64'...', or '...') instead`,t),n.push({bytes:dt.encode(t.value),real:!0,start:t.offset,end:t.endOffset})):this._fail(`expected byte string after +, got ${JSON.stringify(t.value)}`,t)}return n}_elidedHexAtoms(e,t){let n=e.split(`...`),r=[];for(let e=0;e<n.length;e++)e>0&&r.push({ellipsis:!0,real:!1,fromByteLiteral:!0,literalSource:t.raw,start:t.offset,end:t.endOffset}),n[e].length>0&&r.push({bytes:this._hexToBytes(n[e],t),commentSyntax:`full`,real:!1,start:t.offset,end:t.endOffset});return r}_buildFromByteAtoms(e,t){if(!e.some(e=>`ellipsis`in e)){let n=e,r=this._concatBytes(n.map(e=>e.bytes)),i=this.consumeEncodingIndicator(()=>BigInt(r.length));return new A(r,{ednEncoding:t,ednParts:n,...i===void 0?{}:{encodingWidth:i}})}let n=[],r=[],i=[],a=()=>{if(i.length>0){let e=new A(this._concatBytes(i.map(e=>e.bytes)),{...i.length>1?{ednParts:i.map(({bytes:e,source:t,commentSyntax:n,start:r,end:i})=>({bytes:e,source:t,commentSyntax:n,start:r,end:i}))}:{ednSource:i[0].source,ednCommentSyntax:i[0].commentSyntax}});e.start=i[0].start,e.end=i[i.length-1].end,n.push(e),r.push(i[0].real),i.length=0}};for(let t of e)if(`ellipsis`in t){a();let e=new L(t.fromByteLiteral,t.literalSource);e.start=t.start,e.end=t.end,n.push(e),r.push(t.real)}else i.push(t);return a(),new L(n,r)}_concatBytes(e){let t=e.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;return n}parseSimple(){this.t.consume(),this.expect(`LPAREN`);let e=this.t.peek();e.type!==`INTEGER`&&this._fail(`expected integer inside simple(), got ${JSON.stringify(e.value)}`,e),this.t.consume();let{numStr:t}=ht(e.value),n=Number(gt(t));return this.expect(`RPAREN`),new F(n,{ednSource:e.raw})}parseEmbeddedCBOR(){this.t.consume();let e=[];for(;this.t.peek().type!==`GT_GT`;){if(e.length>0){if(this.t.peek().type===`COMMA`){if(this.t.consume(),this.t.peek().type===`GT_GT`)break}else this.t.peek().offset===this.t.lastEndOffset&&this._warnOrFail(`<<...>> items must be separated by "," or whitespace`,this.t.peek())}e.push(this.parseValue())}this.expect(`GT_GT`);let t;if(this.t.peek().type===`ENCODING_INDICATOR`){let e=this.t.consume();t=this._resolveEncodingWidth(e.value,e)}return new I(e,{encodingWidth:t})}parseArray(){this.t.consume();let e=!1,t,n;this.t.peek().type===`UNDERSCORE`?(this.t.consume(),e=!0):this.t.peek().type===`ENCODING_INDICATOR`&&(n=this.t.consume(),n.value===`7`?(e=!0,this._warnOrFail(`encoding indicator _7 is non-standard; use _ to indicate indefinite length`,n),n=void 0):t=this._resolveEncodingWidth(n.value,n));let r=this._pendingWarnings.splice(0),i=[],a=this.t.lastEndOffset;for(;this.t.peek().type!==`RBRACKET`;){if(i.length>0){if(this.t.peek().type===`COMMA`){if(this.t.consume(),this.t.peek().type===`RBRACKET`)break}else this.t.peek().offset===this.t.lastEndOffset&&this._warnOrFail(`array items must be separated by "," or whitespace`,this.t.peek())}let e=this.parseValue();St(this.t.source,a,e.start)&&(e.blankLineBefore=!0),a=e.end,i.push(e)}this.expect(`RBRACKET`),t!==void 0&&n!==void 0&&(t=this._validateEncodingFit(BigInt(i.length),t,n));let o=new N(i,{indefiniteLength:e,encodingWidth:t});return r.length>0&&(o.warnings??=[],o.warnings.push(...r)),o}parseMap(){this.t.consume();let e=!1,t,n;this.t.peek().type===`UNDERSCORE`?(this.t.consume(),e=!0):this.t.peek().type===`ENCODING_INDICATOR`&&(n=this.t.consume(),n.value===`7`?(e=!0,this._warnOrFail(`encoding indicator _7 is non-standard; use _ to indicate indefinite length`,n),n=void 0):t=this._resolveEncodingWidth(n.value,n));let r=this._pendingWarnings.splice(0),i=[],a=this.t.lastEndOffset;for(;this.t.peek().type!==`RBRACE`;){if(i.length>0){if(this.t.peek().type===`COMMA`){if(this.t.consume(),this.t.peek().type===`RBRACE`)break}else this.t.peek().offset===this.t.lastEndOffset&&this._warnOrFail(`map entries must be separated by "," or whitespace`,this.t.peek())}let e=this.parseValue();St(this.t.source,a,e.start)&&(e.blankLineBefore=!0),this.expect(`COLON`);let t=this.parseValue();a=t.end,i.push([e,t])}this.expect(`RBRACE`),t!==void 0&&n!==void 0&&(t=this._validateEncodingFit(BigInt(i.length),t,n));let o=new P(i,{indefiniteLength:e,encodingWidth:t});return r.length>0&&(o.warnings??=[],o.warnings.push(...r)),o}parseIndefGroup(){this.t.consume();let e=this.t.peek();if(e.type===`UNDERSCORE`)this.t.consume();else if(e.type===`ENCODING_INDICATOR`&&e.value===`7`)this.t.consume(),this._warnOrFail(`encoding indicator _7 is non-standard; use _ to indicate indefinite length`,e);else if(e.type===`ENCODING_INDICATOR`){let e=this.t.consume(),t=`encoding indicator _${e.value} is not valid in an indefinite string group; use _`;this._warnOrFail(t,e)}else e.type!==`RPAREN`&&this._warnOrFail(`indefinite string group is missing _ after (; interpreting as (_ ...)`,e);let t=this._pendingWarnings.splice(0),n=[],r=this.t.lastEndOffset;for(;this.t.peek().type!==`RPAREN`;){if(n.length>0){if(this.t.peek().type===`COMMA`){if(this.t.consume(),this.t.peek().type===`RPAREN`)break}else this.t.peek().offset===this.t.lastEndOffset&&this._warnOrFail(`indefinite string chunks must be separated by "," or whitespace`,this.t.peek())}let e=this.parseValue();St(this.t.source,r,e.start)&&(e.blankLineBefore=!0),r=e.end,n.push(e)}this.expect(`RPAREN`),n.length===0&&this._fail(`empty indefinite group (_ ) is ambiguous; use ''_ for bytes or ""_ for text`);let i=n[0];if(i instanceof A){let e=new j(n.map((e,t)=>{if(e instanceof A)return e;this._fail(`indefinite byte string chunk ${t} must be a byte string, not a text string`)}));return t.length>0&&(e.warnings=t),e}if(i instanceof z){let e=new M(n.map((e,t)=>{if(e instanceof z)return e;this._fail(`indefinite text string chunk ${t} must be a text string, not a byte string`)}));return t.length>0&&(e.warnings=t),e}this._fail(`indefinite group chunks must be byte strings or text strings`)}consumeEncodingIndicator(e,t){if(this.t.peek().type===`ENCODING_INDICATOR`){let n=this.t.consume();t?.(n);let r=this._resolveEncodingWidth(n.value,n);return r!==void 0&&e!==void 0&&(r=this._validateEncodingFit(e(),r,n)),r}}expect(e){let t=this.t.consume();return t.type!==e&&this._fail(`expected ${e}, got ${t.type} (${JSON.stringify(t.value)})`,t),t}_applyEiToResult(e,t,n){if(e instanceof O){let r=t===1?`half`:t===2?`single`:t===3?`double`:void 0;if(r===void 0)this._warnOrFail(`encoding indicator _${t} is not valid for a float; use _1, _2, or _3`,n);else if(e.precision!==r){if(r!==`double`){let t=r===`half`?v(_(e.value)):Math.fround(e.value);!Object.is(t,e.value)&&!isNaN(e.value)&&this._warnOrFail(`${e.value} cannot be exactly represented as ${r===`half`?`float16 (_1)`:`float32 (_2)`}`,n)}e.precision=r}}else if(e instanceof E){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(e.value,t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof D){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(e.argument,t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof A){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(BigInt(e.value.length),t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof z){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(BigInt(dt.encode(e.value).length),t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof N){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(BigInt(e.items.length),t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof P){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(BigInt(e.entries.length),t,n);r!==void 0&&(e.encodingWidth=r)}}else if(e instanceof k){if(e.encodingWidth===void 0){let r=this._validateEncodingFit(e.tag,t,n);r!==void 0&&(e.encodingWidth=r)}}else this._warnOrFail(`encoding indicator _${t} is not applicable to this app-string result type`,n)}_validateEncodingFit(e,t,n){let r=ae(t);if(e<=r)return t;let i=`value ${e} does not fit in encoding indicator ${t===`i`?`_i (max 23)`:`_${t} (max ${r})`}`;this._warnOrFail(i,n)}_resolveEncodingWidth(e,t){if(e===`4`||e===`5`||e===`6`){let n=`encoding indicator _${e} (AI ${Number(e)+24}) is reserved and not valid`;this._warnOrFail(n,t);return}if(e===`7`){this._warnOrFail(`indefinite-length encoding (_7) is not valid here; use [_ ...] or {_ ...} for indefinite collections`,t);return}return e===`i`?`i`:Number(e)}_extOnError(e){return t=>this._warnOrFail(t,e)}_warnOrFail(e,t){this._warn(e,t),this._options.strict!==!1&&this._fail(e,t)}_hintMissingExtension(e,t){let n=Nt.get(e);if(n===void 0||this._hintedPrefixes.has(e))return;this._hintedPrefixes.add(e);let r=`app-string prefix '${e}' requires an extension that is not enabled; ${n}`;this._options.onWarning?this._options.onWarning({message:r,...Ft(t),hint:!0}):this._options.silent||console.warn(`CDN: ${r}`)}_warn(e,t){let n={message:e};if(t!==void 0&&Object.assign(n,Ft(t)),this._pendingWarnings.push(n),this._options.onWarning)this._options.onWarning(n);else if(!this._options.silent){let n=t?` at line ${t.line}, column ${t.col}`:``;console.warn(`CDN strict violation${n}: ${e}`)}}_fail(t,n){throw new e.I(t,n?Ft(n):void 0)}};function Ft(e){return{offset:e.offset,line:e.line,column:e.col,endOffset:e.endOffset}}var It=new TextEncoder,Lt=new TextDecoder,Rt=!1,z=class extends T{indefiniteLength=!1;value;encodingWidth;ednParts;ednSource;quotedEdnSource;ednPartSources;ednPartIsByteString;ednPartSpans;constructor(e,t){super(),this.value=e,this.encodingWidth=t?.encodingWidth,this.ednParts=t?.ednParts,this.ednSource=t?.ednSource,this.quotedEdnSource=t?.quotedEdnSource,this.ednPartSources=t?.ednPartSources,this.ednPartIsByteString=t?.ednPartIsByteString,this.ednPartSpans=t?.ednPartSpans}_isMultiWordText(t,n=!0,r){return e.g(this.value)}_encodeTo(e,t){e.writeTextString(3,this.value,this.encodingWidth)}_toCDN(t,n,r){let i=e.C(t,this.encodingWidth,()=>e.r(BigInt(It.encode(this.value).length)));return zt(this.value,i,t,n,this.ednParts,this.ednSource,this.quotedEdnSource,this.ednPartSources,this.ednPartSpans,this.comments?.dangling)}_toJS(e){return this.value}};function zt(t,n,r,i,a,o,s,c,l,u){let d=e.w(r);if(r?.preserveRawString&&o!==void 0&&(d!==null||!/[\r\n]/.test(o)))return o+n;if(r?.preserveTextString&&s!==void 0&&(d!==null||!/[\r\n]/.test(s)))return s+n;if(d===null)return e.c(t)+n;let f=r?.preserveRawString?c:void 0,p=f?.some(e=>e!==void 0)??!1,{cdn:m,newline:h}=Vt(r),g=r?.preserveConcatenation&&a!==void 0&&(a.length>1||p)?a:void 0;if(!m&&!h&&g===void 0)return e.c(t)+n;let _=m?Wt(t,!!r?.inlineLeafContainers,h):null;if(g!==void 0&&(_===null||p)){let t=e.D(r)?e.a(u,l,e.S(r)):void 0,a=[];for(let[n,r]of g.entries()){let i=f?.[n];if(i!==void 0)a.push({text:r,contentDepth:0,source:i});else if(h){let t=new Map;for(let{point:e,contentDepth:n}of Ut(r,0))t.set(e,n);e.b(a,$t(r,t))}else a.push({text:r,contentDepth:0});let o=t?.[n];o&&o.length>0&&(a[a.length-1].commentsAfter=o)}if(r?.modernConcat&&r?.appPrefix!==!1){let t=a.map(({text:t,source:n})=>n??e.c(t)),r=a.map(e=>e.commentsAfter??[]);return e.v(`t1`,t,n,d,i,r)}return Bt(a,n,d,i)}let v=new Map;if(_!==null)for(let{point:e,contentDepth:t}of _)v.set(e,t);if(h){let e=_===null?Ut(t,0):Gt(t);for(let{point:t,contentDepth:n}of e)v.has(t)||v.set(t,n)}let y=$t(t,v);return y.length<=1?e.c(t)+n:Bt(y,n,d,i)}function Bt(t,n,r,i){let a=t.map(({text:r,source:i},a)=>{let o=i??e.c(r);return a===t.length-1?o+n:o}),o=a[0];for(let n=1;n<a.length;n++){let s=e.p(r,i+1+t[n].contentDepth);o+=` +
|
|
8
|
+
`;for(let e of t[n-1].commentsAfter??[])o+=`${s}${e}\n`;o+=`${s}${a[n]}`}return o}function Vt(e){let t=e?.splitCdn===void 0||e?.splitNewline===void 0?Ht(e?.textStringFormat??[]):[];return{cdn:e?.splitCdn??t.includes(`cdn`),newline:e?.splitNewline??t.includes(`newline`)}}function Ht(e){return e.map(e=>e===`cboredn`?(Rt||(Rt=!0,console.warn("`textStringFormat: ['cboredn']` is deprecated; use `textStringFormat: ['cdn']` instead.")),`cdn`):e)}function Ut(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r];i===`\r`?e[r+1]===`
|
|
9
|
+
`?(n.push({point:r+2,contentDepth:t}),r++):n.push({point:r+1,contentDepth:t}):i===`
|
|
10
|
+
`&&n.push({point:r+1,contentDepth:t})}return n}function Wt(t,n,r){try{mt(t)}catch{return null}let i=[],a=new e.A(t),o=0,s=null,c=!1,l=0,u=null,d=[],f=(e,t)=>{let n=d[d.length-1];n?n.ownCandidates.push({point:e,contentDepth:t}):i.push({point:e,contentDepth:t})},p=e=>e.kind===`LT_LT`||e.kind===`APP_SEQUENCE`,m=()=>{for(let e=d.length-1;e>=0;e--){let t=d[e];if(!(t.kind===`LPAREN`&&t.isTagParen))return t}},h=e=>{let t=(p(e)||!e.entryHasContainer)&&!e.entryForcedBreak;e.allOk=e.allOk&&t,e.anyForcedBreak=e.anyForcedBreak||e.entryForcedBreak,e.anyForcedBreakStructural=e.anyForcedBreakStructural||e.entryForcedBreakStructural,e.entryHasContainer=!1,e.entryForcedBreak=!1,e.entryForcedBreakStructural=!1},g=`none`,_=[],v=!1,y=!1,b=!1,x=!1,S=[],ee=!1,te=e=>{S.push({depth:e,kind:g,texts:_,broken:v,hasEllipsis:y,sawPlus:b,awaitingTagCheck:x}),g=`none`,_=[],v=!1,y=!1,b=!1,x=!1,ee=!0},ne=()=>{let e=S[S.length-1];e!==void 0&&o===e.depth&&(S.pop(),g=e.kind,_=e.texts,v=e.broken,y=e.hasEllipsis,b=e.sawPlus,x=e.awaitingTagCheck)},re=()=>{if(y&&b)for(let e of d)e.entryHasContainer=!0;if(g===`text`&&!v&&_.length>0&&e.g(_.join(``))){let e=d[d.length-1];e&&(e.entryForcedBreak=!0)}g=`none`,_=[],v=!1,y=!1,b=!1,x=!1};for(;;){let S=a.consume();if(S.type===`EOF`){re();break}let ie=!1,ae=!1;if(x&&(S.type===`ENCODING_INDICATOR`?ae=!0:S.type===`LPAREN`?(x=!1,te(o),ae=!0):x=!1),!ae){let e=S.type===`PLUS`||S.type===`ENCODING_INDICATOR`||u===`PLUS`&&(Xt.has(S.type)||S.type===`ELLIPSIS`);g!==`none`&&!e&&(u===`PLUS`&&y?Jt.has(S.type)?te(o):S.type===`INTEGER`&&(x=!0):re()),S.type===`PLUS`&&g!==`none`&&(b=!0)}if(c||(c=!0,S.offset>0&&Zt(a.comments,0,S.offset)&&f(S.offset,o)),s!==null){if(s.kind===`opener`&&qt.has(S.type)){s.point=S.endOffset,u=S.type,l=S.endOffset;continue}s.kind===`opener`&&Yt.has(S.type)&&Qt(t,s.point,S.offset)?ie=!0:f(S.offset,s.contentDepth),s=null}if(Jt.has(S.type)){if(S.type===`LBRACKET`||S.type===`LBRACE`)for(let e of d)e.entryHasContainer=!0;o++,s={point:S.endOffset,contentDepth:o,kind:`opener`},d.push({kind:S.type,isTagParen:S.type===`LPAREN`&&u===`INTEGER`,isChainContinuationRoot:ee,openOffset:S.offset,ownCandidates:[],childCandidates:[],entryHasContainer:!1,entryForcedBreak:!1,anyForcedBreak:!1,entryForcedBreakStructural:!1,anyForcedBreakStructural:!1,allOk:!0}),ee=!1}else if(Yt.has(S.type)){o=Math.max(0,o-1),ne(),ie||f(S.offset,o);let e=d.pop();if(e){h(e);let t=e.kind===`LPAREN`&&e.isTagParen,r=(p(e)||n&&(e.kind===`LBRACKET`||e.kind===`LBRACE`||e.kind===`LPAREN`))&&e.ownCandidates.length>0&&(t||e.allOk)&&!Zt(a.comments,e.openOffset,S.endOffset)?e.childCandidates:[...e.ownCandidates,...e.childCandidates],o=d[d.length-1];if(o){for(let e of r)o.childCandidates.push(e);let t=r.length>0||e.anyForcedBreakStructural;(e.isChainContinuationRoot&&e.isTagParen?t:r.length>0||e.anyForcedBreak)&&(o.entryForcedBreak=!0),t&&(o.entryForcedBreakStructural=!0)}else for(let e of r)i.push(e)}}else if(S.type===`COMMA`){let e=d[d.length-1];e&&h(e),s={point:S.endOffset,contentDepth:o,kind:`comma`}}else if(S.type===`TSTR`||S.type===`RAWSTRING`){let e=t.slice(S.offset,S.endOffset);if(r&&(S.type===`TSTR`?Kt(e).length>0:Ut(e,0).length>0)){let e=d[d.length-1];e&&(e.entryForcedBreak=!0,e.entryForcedBreakStructural=!0)}u===`PLUS`&&g===`text`?_.push(S.value):(g=`text`,_=[S.value],v=!1)}else if(S.type===`SQSTR`){if(u!==`PLUS`||g!==`byte`){let e=S._sqstrBytes,t=e?Lt.decode(e):null;u===`PLUS`&&g===`text`?t===null?v=!0:_.push(t):(g=`text`,_=t===null?[]:[t],v=t===null)}}else if(S.type===`BYTES_HEX`||S.type===`BYTES_HEX_ELIDED`||S.type===`BYTES_B64`||S.type===`APP_STRING`){if(u===`PLUS`&&g===`text`){let t=null;try{S.type===`BYTES_HEX`?t=Lt.decode(e.F(S.value)):S.type===`BYTES_B64`&&(t=Lt.decode(e.j(S.value)))}catch{t=null}t===null?v=!0:_.push(t)}else{let t=d[d.length-1],n=m();t&&(!n||!p(n))&&(S.type!==`APP_STRING`||e.g(S.value))&&(t.entryForcedBreak=!0),(u!==`PLUS`||g===`none`)&&(g=`byte`)}}else S.type===`ELLIPSIS`&&(y=!0,u===`PLUS`&&g===`text`?v=!0:(u!==`PLUS`||g===`none`)&&(g=`text`,_=[],v=!0));u=S.type,l=S.endOffset}let ie=a.comments.find(e=>e.start>=l);return ie!==void 0&&i.push({point:ie.start,contentDepth:o}),i}function Gt(t){let n=[],r=new e.A(t),i=0;for(;;){let e=r.consume();if(e.type===`EOF`)break;if(Jt.has(e.type))i++;else if(Yt.has(e.type))i=Math.max(0,i-1);else if(e.type!==`COMMA`){if(e.type===`TSTR`){let r=t.slice(e.offset,e.endOffset);for(let t of Kt(r))n.push({point:e.offset+t,contentDepth:i+1})}else if(e.type===`RAWSTRING`){let r=t.slice(e.offset,e.endOffset);for(let{point:t}of Ut(r,0))n.push({point:e.offset+t,contentDepth:i+1})}}}return n}function Kt(e){let t=[],n=1,r=e.length-1;for(;n<r;){let r=e[n];if(r===`\\`){let r=e[n+1];if(r===`n`||r===`r`)t.push(n+2),n+=2;else if(r===`u`){if(e[n+2]===`{`){let t=e.indexOf(`}`,n+3);n=t>=0?t+1:n+2}else n+=6}else n+=2}else r===`\r`?e[n+1]===`
|
|
11
|
+
`?(t.push(n+2),n+=2):(t.push(n+1),n++):(r===`
|
|
12
|
+
`&&t.push(n+1),n++)}return t}var qt=new Set([`ENCODING_INDICATOR`,`UNDERSCORE`]),Jt=new Set([`LBRACKET`,`LBRACE`,`LPAREN`,`LT_LT`,`APP_SEQUENCE`]),Yt=new Set([`RBRACKET`,`RBRACE`,`RPAREN`,`GT_GT`]),Xt=new Set([`TSTR`,`RAWSTRING`,`SQSTR`,`BYTES_HEX`,`BYTES_HEX_ELIDED`,`BYTES_B64`]);function Zt(e,t,n){return e.some(e=>e.start>=t&&e.end<=n)}function Qt(e,t,n){return/^[\t\n\r ]*$/.test(e.slice(t,n))}function $t(e,t){let n=[...t].filter(([t])=>t>0&&t<e.length).sort(([e],[t])=>e-t);if(n.length===0)return[{text:e,contentDepth:0}];let r=[],i=0,a=0;for(let[t,o]of n)t!==i&&(r.push({text:e.slice(i,t),contentDepth:a}),i=t,a=o);return i<e.length&&r.push({text:e.slice(i),contentDepth:a}),r}function en(e){if(Number.isInteger(e))return new Date(e*1e3).toISOString().replace(/\.000Z$/,`Z`);let t=Math.round(e*1e3);if(t/1e3===e)return new Date(t).toISOString().replace(/\.000Z$/,`Z`);let n=Math.floor(e),r=e-n,i=new Date(n*1e3).toISOString().replace(/\.\d+Z$/,``),a=r.toString(),o=a.indexOf(`.`),s=o>=0?a.slice(o+1):`0`;for(;s.length<3;)s+=`0`;return`${i}.${s}Z`}var tn=new TextDecoder(`utf-8`,{fatal:!0});function nn(e){if(e.length!==1)throw SyntaxError(`dt<<...>>: expected exactly one item`);let t=e[0];if(t instanceof z)return t.value;if(t instanceof A)return tn.decode(t.value);throw SyntaxError(`dt<<...>>: expected a text string or byte string`)}var rn=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/i;function an(e,t){if(!rn.test(e)){let n=`dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`;if(t)t(n);else throw SyntaxError(n)}let n=e.match(/^(.+T\d{2}:\d{2}:\d{2})(\.\d+)(Z|[+-]\d{2}:\d{2})$/i),r,i;n?(r=n[1]+n[3],i=parseFloat(`0`+n[2])):(r=e,i=void 0);let a=Date.parse(r);if(isNaN(a))throw SyntaxError(`dt: invalid RFC 3339 date-time: ${JSON.stringify(e)}`);if(i===void 0){let e=a/1e3;return e>=0?new sn(BigInt(e)):new cn(BigInt(e))}return new ln(a/1e3+i)}var on=1n,sn=class extends E{constructor(e,t){super(e,t)}_toCDN(t,n,r){if(t?.appPrefix===!1)return super._toCDN(t,n,r);let i=e.C(t,this.encodingWidth,()=>e.r(this.value));return e.o(t,this.appSeqSource,void 0,this.appSeqSourceFeatures)===`adjusted`?e.t(this.appSeqSource,i,t,this.appSeqInnerEnd,this.appSeqComments):`dt'${en(Number(this.value))}'${i}`}},cn=class extends D{constructor(e,t){super(e,t)}_toCDN(t,n,r){if(t?.appPrefix===!1)return super._toCDN(t,n,r);let i=e.C(t,this.encodingWidth,()=>e.r(this.argument));return e.o(t,this.appSeqSource,void 0,this.appSeqSourceFeatures)===`adjusted`?e.t(this.appSeqSource,i,t,this.appSeqInnerEnd,this.appSeqComments):`dt'${en(Number(this.value))}'${i}`}},ln=class extends O{constructor(e,t){super(e,t)}_toCDN(t,n,r){if(t?.appPrefix===!1)return super._toCDN(t,n,r);let i=w(this.value),a=e.l(this.value,this.precision,i,t?.encodingIndicators??`auto`);return e.o(t,this.appSeqSource,void 0,this.appSeqSourceFeatures)===`adjusted`?e.t(this.appSeqSource,a,t,this.appSeqInnerEnd,this.appSeqComments):`dt'${en(this.value)}'${a}`}},un=class extends k{constructor(e,t){super(on,typeof e==`string`?an(e):e,t)}_toCDN(t,n,r){if(t?.appPrefix===!1)return super._toCDN(t,n,r);let i=e.o(t,this.appSeqSource,this.ednSource,this.appSeqSourceFeatures,this.appSeqEncodingEditsComplete);if(i===`verbatim`)return this.appSeqSource;if(i===`source`)return e.n(this.appSeqSource,t,this.appSeqComments,this.appSeqEncodingEdits);if(i===`structural`)return super._toCDN({...t,appPrefix:!1},n,r);let a=e.C(t,this.encodingWidth,()=>e.r(on));if(i===`adjusted`)return e.t(this.appSeqSource,a,t,this.appSeqInnerEnd,this.appSeqComments);let o=this.content;return(o instanceof O?o.precision!==void 0&&o.precision!==w(o.value):o.encodingWidth!==void 0)?super._toCDN({...t,appPrefix:!1},n,r):`DT'${en(o instanceof O?o.value:Number(o.value))}'${a}`}},dn=class extends un{constructor(e,t){super(e,t)}_toJS(e){let t=this.content,n=t instanceof O?t.value*1e3:Number(t.value)*1e3;return new Date(n)}};function fn(e){return(t,n)=>{if(!(t instanceof un))return;let r=t.content;if(e){let e=r instanceof O?r.value*1e3:Number(r.value)*1e3;return{value:new Date(e)}}let i=r._toJS(n);return{value:t._tagJS(i,n)}}}function pn(e){let t=e?.jsDate??!1;function n(e){return t?new dn(e):new un(e)}let r={appStringPrefixes:[`dt`,`DT`],tagNumbers:[on],preserveAppSeqSource:`optional`,toJS:fn(t),parseAppString(e,t,r){return e===`DT`?n(t):an(t,r)},parseAppSequence(e,t,r){let i=nn(t);return e===`DT`?n(i):an(i,r)},parseTag(e,n){if(e!==1n)return;let r;if(n instanceof E)r=new sn(n.value,{encodingWidth:n.encodingWidth,ednSource:n.ednSource});else if(n instanceof D)r=new cn(n.value,{encodingWidth:n.encodingWidth,ednSource:n.ednSource});else if(n instanceof O)r=new ln(n.value,{precision:n.precision,literalSource:n.literalSource});else return;return r.start=n.start,r.end=n.end,t?new dn(r):new un(r)}};return t&&(r.fromJS=(e,t)=>{if(e instanceof Date)return new dn(en(e.getTime()/1e3))},r.isJSType=e=>e instanceof Date),r}var mn=pn(),hn=pn({jsDate:!0});function gn(e){let t=e.split(`.`);if(t.length!==4)throw SyntaxError(`ip: invalid IPv4 address: ${JSON.stringify(e)}`);let n=new Uint8Array(4);for(let e=0;e<4;e++){let r=t[e];if(!/^\d+$/.test(r)||r.length>1&&r[0]===`0`)throw SyntaxError(`ip: invalid IPv4 octet: ${JSON.stringify(r)}`);let i=parseInt(r,10);if(i>255)throw SyntaxError(`ip: IPv4 octet out of range: ${i}`);n[e]=i}return n}function _n(e){let t=new Uint8Array(16);if(e===`::`)return t;let n=e,r=null,i=e.match(/^(.*):(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);i&&(n=i[1],n.endsWith(`:`)&&(n+=`:`),r=gn(i[2]));let a=n.split(`::`);if(a.length>2)throw SyntaxError(`ip: invalid IPv6 address: ${JSON.stringify(e)}`);let o=a.length===2,s=a[0]?a[0].split(`:`):[],c=o&&a[1]?a[1].split(`:`):[],l=r?6:8;if(!o&&s.length!==l||o&&s.length+c.length>=l)throw SyntaxError(`ip: invalid IPv6 address: ${JSON.stringify(e)}`);let u=l-s.length-c.length,d=[...s,...Array(u).fill(`0`),...c],f=0;for(let e of d){if(!/^[0-9a-fA-F]{1,4}$/.test(e))throw SyntaxError(`ip: invalid IPv6 group: ${JSON.stringify(e)}`);let n=parseInt(e,16);t[f++]=n>>8&255,t[f++]=n&255}return r&&t.set(r,12),t}function vn(e){return Array.from(e).join(`.`)}function yn(e){let t=e.slice(0,10).every(e=>e===0)&&e[10]===255&&e[11]===255?vn(e.slice(12)):null,n=t?6:8,r=[];for(let t=0;t<n*2;t+=2)r.push(e[t]<<8|e[t+1]);let i=-1,a=0,o=0;for(;o<n;)if(r[o]===0){let e=o+1;for(;e<n&&r[e]===0;)e++;e-o>a&&(i=o,a=e-o),o=e}else o++;a<2&&(i=-1);let s=e=>e.toString(16),c;return c=i===-1?r.map(s).join(`:`):`${r.slice(0,i).map(s).join(`:`)}::${r.slice(i+a).map(s).join(`:`)}`,t?`${c}:${t}`:c}var bn=`ip`,xn=`IP`,Sn=52n,Cn=54n,wn=new TextDecoder(`utf-8`,{fatal:!0});function Tn(e){if(e.length!==1)throw SyntaxError(`ip<<...>>: expected exactly one item`);let t=e[0];if(t instanceof z)return t.value;if(t instanceof A)return wn.decode(t.value);throw SyntaxError(`ip<<...>>: expected a text string or byte string`)}function En(e){return/^\d/.test(e)&&e.includes(`.`)&&!e.includes(`:`)?{bytes:gn(e),isV4:!0}:{bytes:_n(e),isV4:!1}}function Dn(e){if(e.length===4)return vn(e);if(e.length===16)return yn(e);throw SyntaxError(`ip: unexpected byte length: ${e.length}`)}function On(e,t){let n=new Uint8Array(e.length);n.set(e);let r=Math.floor(t/8),i=t%8;i>0&&r<e.length&&(n[r]&=255<<8-i&255);for(let t=r+ +(i>0);t<e.length;t++)n[t]=0;let a=Math.ceil(t/8);for(;a>0&&n[a-1]===0;)a--;return n.slice(0,a)}function kn(e,t){let n=new Uint8Array(t);return n.set(e),n}var An=class extends A{_toCDN(t,n,r){if(t?.appPrefix===!1)return super._toCDN(t,n,r);let i=e.C(t,this.encodingWidth,()=>e.r(BigInt(this.value.length)));return e.o(t,this.appSeqSource,void 0,this.appSeqSourceFeatures)===`adjusted`?e.t(this.appSeqSource,i,t,this.appSeqInnerEnd,this.appSeqComments):`${bn}'${Dn(this.value)}'${i}`}},jn=class extends N{_isV4;constructor(e,t,n){super([new E(BigInt(e)),new A(t)]),this._isV4=n}_toCDN(t,n,r){if(t?.appPrefix===!1)return super._toCDN(t,n,r);if(e.o(t,this.appSeqSource,void 0,this.appSeqSourceFeatures)===`adjusted`)return e.t(this.appSeqSource,``,t,this.appSeqInnerEnd,this.appSeqComments);let i=Number(this.items[0].value),a=this.items[1].value;return`${bn}'${Dn(kn(a,this._isV4?4:16))}/${i}'`}},Mn=class extends k{constructor(e,t){super(e,t)}_toCDN(t,n,r){if(t?.appPrefix===!1)return super._toCDN(t,n,r);let i=e.o(t,this.appSeqSource,this.ednSource,this.appSeqSourceFeatures,this.appSeqEncodingEditsComplete);if(i===`verbatim`)return this.appSeqSource;if(i===`source`)return e.n(this.appSeqSource,t,this.appSeqComments,this.appSeqEncodingEdits);if(i===`structural`)return super._toCDN(t,n,r);if(i===`adjusted`){let n=e.C(t,this.encodingWidth,()=>e.r(this.tag));return e.t(this.appSeqSource,n,t,this.appSeqInnerEnd,this.appSeqComments)}let a=this.tag===Sn?4:16,o=this.content;if(o instanceof A){if(o.encodingWidth!==void 0)return super._toCDN(t,n,r);let i=e.C(t,this.encodingWidth,()=>e.r(this.tag));return`${xn}'${Dn(o.value)}'${i}`}if(o instanceof N&&o.items.length===2&&o.items[0]instanceof E&&o.items[1]instanceof A){if(o.encodingWidth!==void 0||o.items[0].encodingWidth!==void 0||o.items[1].encodingWidth!==void 0)return super._toCDN(t,n,r);let i=Number(o.items[0].value),s=kn(o.items[1].value,a),c=e.C(t,this.encodingWidth,()=>e.r(this.tag));return`${xn}'${Dn(s)}/${i}'${c}`}return super._toCDN(t,n,r)}};function Nn(e,t){let n=t.indexOf(`/`);if(n===-1){let{bytes:n,isV4:r}=En(t);return e===xn?new Mn(r?Sn:Cn,new A(n)):new An(n)}let r=t.slice(0,n),i=t.slice(n+1);if(!/^\d+$/.test(i))throw SyntaxError(`ip: invalid prefix length: ${JSON.stringify(i)}`);let a=parseInt(i,10),{bytes:o,isV4:s}=En(r),c=s?32:128;if(a>c)throw SyntaxError(`ip: prefix length ${a} exceeds maximum ${c} for ${s?`IPv4`:`IPv6`}`);let l=On(o,a);return e===xn?new Mn(s?Sn:Cn,new N([new E(BigInt(a)),new A(l)])):new jn(a,l,s)}var Pn={appStringPrefixes:[bn,xn],tagNumbers:[Sn,Cn],preserveAppSeqSource:`optional`,parseAppString(e,t){return Nn(e,t)},parseAppSequence(e,t){return Nn(e,Tn(t))},parseTag(e,t){if((e===Sn||e===Cn)&&(t instanceof A||t instanceof N))return new Mn(e,t)}},Fn=`cri`,In=`CRI`,Ln=99n,Rn=new Map([[`coap`,-1n],[`coaps`,-2n],[`http`,-3n],[`https`,-4n],[`urn`,-5n],[`did`,-6n],[`coap+tcp`,-7n],[`coaps+tcp`,-8n],[`coap+ws`,-25n],[`coaps+ws`,-26n]]),zn=new Map([...Rn.entries()].map(([e,t])=>[t,e]));function B(e){try{return decodeURIComponent(e)}catch{return e}}var Bn=new TextEncoder,Vn=new TextDecoder(`utf-8`,{fatal:!0});function Hn(e){return Array.from(Bn.encode(e),e=>`%${e.toString(16).toUpperCase().padStart(2,`0`)}`).join(``)}function Un(e,t){let n=``;for(let r of e)n+=t(r)?r:Hn(r);return n}function Wn(e){return/[A-Za-z0-9\-._~]/.test(e)}function Gn(e){return/[!$&'()*+,;=]/.test(e)}function Kn(e){return Wn(e)||Gn(e)||e===`:`||e===`@`}function qn(e){return(Kn(e)||e===`/`||e===`?`)&&e!==`&`}function Jn(e){return Kn(e)||e===`/`||e===`?`}function Yn(e){return Wn(e)||Gn(e)||e===`:`}function Xn(e){return Wn(e)||Gn(e)}function Zn(e){let t=[],n=e,r=n.indexOf(`@`);r>=0&&(t.push(F.FALSE),t.push(new z(B(n.slice(0,r)))),n=n.slice(r+1));let i,a=null;if(n.startsWith(`[`)){let e=n.indexOf(`]`);if(e<0)throw SyntaxError(`cri: unterminated IPv6 bracket in authority`);i=n.slice(1,e);let r=n.slice(e+1);if(r.startsWith(`:`))a=r.slice(1);else if(r.length>0)throw SyntaxError(`cri: unexpected characters after ']' in authority`);t.push(new A(_n(i)))}else{let e=n.lastIndexOf(`:`);if(e>=0?(i=n.slice(0,e),a=n.slice(e+1)):i=n,i!==``){if(/^\d{1,3}(\.\d{1,3}){3}$/.test(i))t.push(new A(gn(i)));else for(let e of i.toLowerCase().split(`.`))t.push(new z(e))}}if(a!==null&&a!==``){if(!/^\d+$/.test(a))throw SyntaxError(`cri: invalid port: ${JSON.stringify(a)}`);let e=parseInt(a,10);if(e>65535)throw SyntaxError(`cri: port ${e} out of range`);t.push(new E(BigInt(e)))}return new N(t)}function Qn(e){let t=e.items,n=0,r=``;if(n<t.length&&t[n]instanceof F&&t[n].value===20){n++;let e=t[n++];r+=Un(e.value,Yn)+`@`}if(n>=t.length)return r;let i=t[n];if(i instanceof A){n++;let{length:e}=i.value;if(e===4)r+=vn(i.value);else if(e===16)r+=`[`+yn(i.value)+`]`;else throw Error(`cri: unexpected host-ip byte length: ${e}`);n<t.length&&t[n]instanceof z&&(r+=`%25${Un(t[n++].value,Xn)}`)}else{let e=[];for(;n<t.length&&t[n]instanceof z;)e.push(Un(t[n++].value,Xn));r+=e.join(`.`)}return n<t.length&&t[n]instanceof E&&(r+=`:`+t[n].value.toString()),r}function $n(e){let t=e.slice(2),n=t.indexOf(`/`),r,i;return n>=0?(r=t.slice(0,n),i=t.slice(n+1).split(`/`).map(e=>new z(B(e)))):(r=t,i=[]),{authority:Zn(r),pathSegments:i}}function er(e){let t=e,n=null,r=t.indexOf(`#`);r>=0&&(n=B(t.slice(r+1)),t=t.slice(0,r));let i=null,a=t.indexOf(`?`);if(a>=0){let e=t.slice(a+1);t=t.slice(0,a),i=e.split(`&`).map(e=>new z(B(e)))}let o=[],s=/^([a-zA-Z][a-zA-Z0-9+.\-]*):([\s\S]*)$/.exec(t);if(s){let e=s[1].toLowerCase(),t=s[2],n=Rn.get(e);if(o.push(n===void 0?new z(e):new D(n)),t.startsWith(`//`)){let{authority:e,pathSegments:n}=$n(t);o.push(e,new N(n))}else if(t.startsWith(`/`)){let e=t.slice(1).split(`/`).map(e=>new z(B(e)));o.push(F.NULL,new N(e))}else{let e=t.split(`/`).map(e=>new z(B(e)));o.push(F.TRUE,new N(e))}}else if(t.startsWith(`//`)){let{authority:e,pathSegments:n}=$n(t);o.push(F.FALSE,e,new N(n))}else if(t.startsWith(`/`)){let e=t.slice(1).split(`/`).map(e=>new z(B(e)));o.push(F.TRUE,new N(e))}else if(t===``)o.push(new E(0n));else{let n=1n,r=t,i=!1;for(r.startsWith(`./`)&&(i=!0,r=r.slice(2));r.startsWith(`../`);)n++,r=r.slice(3);if(r===`..`?(n++,r=``):r===`.`&&(r=``),n===1n&&!i&&r!==``&&r.split(`/`)[0].includes(`:`))throw SyntaxError(`cri: invalid relative-path reference — first segment must not contain ':' without a './' prefix (RFC 3986 §3.3): ${JSON.stringify(e)}`);let a=r===``?[]:r.split(`/`).map(e=>new z(B(e)));o.push(new E(n),new N(a))}if(i!==null&&o.push(new N(i)),n!==null&&(i===null&&o.push(F.NULL),o.push(new z(n))),n!==null&&i===null&&o.splice(o.length-2,1),i===null&&n===null){let e=o[o.length-1];e instanceof N&&e.items.length===0&&o.pop()}return o.length===1&&o[0]instanceof E&&o[0].value===0n?[]:o}function tr(e,t){let n=t,r=``;if(n<e.length){let t=e[n];if(t instanceof N){if(n++,t.items.length>0){let e=t.items.map(e=>{if(!(e instanceof z))throw Error(`cri: query item must be a text string`);return Un(e.value,qn)});r+=`?`+e.join(`&`)}}else t instanceof F&&t.value===22&&n++}return n<e.length&&e[n]instanceof z&&(r+=`#`+Un(e[n].value,Jn)),r}function nr(e){return e.items.map(e=>{if(!(e instanceof z))throw Error(`cri: path segment must be a text string`);return Un(e.value,Kn)})}function rr(e){if(e.length===0)return``;let t=0,n=e[t++];if(n instanceof D||n instanceof z){let r;if(n instanceof D){let e=zn.get(n.value);if(e===void 0)throw Error(`cri: unrecognised scheme-id ${n.value}`);r=e+`:`}else r=n.value+`:`;if(t>=e.length)return r;let i=e[t++],a=``,o=!1;if(i instanceof N)a=`//`+Qn(i),o=!0;else if(i instanceof F){if(i.value===22)o=!0;else if(i.value===21)o=!1;else throw Error(`cri: unexpected no-authority value: simple(${i.value})`)}else throw Error(`cri: unexpected type for authority element`);let s=``;if(t<e.length&&e[t]instanceof N){let n=e[t++];n.items.length>0&&(s=(o?`/`:``)+nr(n).join(`/`))}return r+a+s+tr(e,t)}if(n instanceof F&&n.value===20){if(t>=e.length||!(e[t]instanceof N))throw Error(`cri: network-path reference requires an authority array`);let n=Qn(e[t++]),r=``;if(t<e.length&&e[t]instanceof N){let n=e[t++];n.items.length>0&&(r=`/`+nr(n).join(`/`))}return`//`+n+r+tr(e,t)}if(n instanceof F&&n.value===21){let n=`/`;if(t<e.length&&e[t]instanceof N){let r=e[t++];n=`/`+nr(r).join(`/`)}return n+tr(e,t)}if(n instanceof E){let r=n.value;if(r===0n)return tr(e,t);let i=r===1n?``:`../`.repeat(Number(r)-1),a;if(t<e.length&&e[t]instanceof N){let n=e[t++];if(n.items.length>0){let e=nr(n);a=(r===1n&&e[0].includes(`:`)?`./`:i)+e.join(`/`)}else a=i===``?`./`:i}else a=i===``?`./`:i;return a+tr(e,t)}throw Error(`cri: unrecognised first element type in CRI array`)}var ir=class extends N{_toCDN(t,n,r){if(t?.appPrefix===!1)return super._toCDN(t,n,r);let i=e.C(t,this.encodingWidth,()=>e.r(BigInt(this.items.length)));if(e.o(t,this.appSeqSource,void 0,this.appSeqSourceFeatures)===`adjusted`)return e.t(this.appSeqSource,i,t,this.appSeqInnerEnd,this.appSeqComments);try{return`${Fn}'${rr(this.items)}'${i}`}catch{return super._toCDN(t,n,r)}}},ar=class extends k{constructor(e){super(Ln,e)}_toCDN(t,n,r){if(t?.appPrefix===!1)return super._toCDN(t,n,r);let i=e.o(t,this.appSeqSource,this.ednSource,this.appSeqSourceFeatures,this.appSeqEncodingEditsComplete);if(i===`verbatim`)return this.appSeqSource;if(i===`source`)return e.n(this.appSeqSource,t,this.appSeqComments,this.appSeqEncodingEdits);if(i===`structural`)return super._toCDN({...t,appPrefix:!1},n,r);try{let a=this.content;if(a.encodingWidth!==void 0)return super._toCDN(t,n,r);let o=e.C(t,this.encodingWidth,()=>e.r(Ln));return i===`adjusted`?e.t(this.appSeqSource,o,t,this.appSeqInnerEnd,this.appSeqComments):`${In}'${rr(a.items)}'${o}`}catch{return super._toCDN(t,n,r)}}};function or(e){if(e.length!==1)throw SyntaxError(`cri<<...>>: expected exactly one item`);let t=e[0];if(t instanceof z)return t.value;if(t instanceof A)return Vn.decode(t.value);throw SyntaxError(`cri<<...>>: expected a text string or byte string`)}function sr(e,t){let n=new ir(er(t));return e===In?new ar(n):n}var cr={appStringPrefixes:[Fn,In],tagNumbers:[Ln],preserveAppSeqSource:`optional`,parseAppString(e,t){return sr(e,t)},parseAppSequence(e,t){return sr(e,or(t))},parseTag(e,t){if(e!==99n||!(t instanceof N))return;let n=new ir(t.items,{indefiniteLength:t.indefiniteLength,encodingWidth:t.encodingWidth});return n.start=t.start,n.end=t.end,new ar(n)}},lr=18446744073709551615n,ur=-18446744073709551616n,dr={tagNumbers:[rt,it],parseTag(e,t){if(t instanceof A){if(e===2n){let e=ct(t.value);return e>lr?new lt(e):void 0}if(e===3n){let e=-1n-ct(t.value);return e<ur?new ut(e):void 0}}}};function fr(e,t){if(e===24&&t<=23n)return 0;if(e===25&&t<=255n)return 1;if(e===26&&t<=65535n)return 2;if(e===27&&t<=4294967295n)return 3}function pr(e,t){if(e===24&&t<=23)return 0;if(e===25&&t<=255)return 1;if(e===26&&t<=65535)return 2;if(e===27&&t<=4294967295)return 3}var mr=new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0}),hr=new TextDecoder(`utf-8`,{fatal:!1,ignoreBOM:!0});function V(e){throw Error(`CBOR decode error: ${e}`)}function gr(e,t,n){let r={message:e,offset:t};if(n?.onWarning?n.onWarning(r):n?.silent||console.warn(`CBOR strict violation at offset ${t}: ${e}`),n?.strict!==!1)throw Error(`CBOR decode error: ${e}`);return r}function _r(e,t){e.warnings??=[],e.warnings.push(t)}function vr(t){if(t instanceof E)return[`u`,String(t.value)];if(t instanceof D)return[`n`,String(t.value)];if(t instanceof z)return[`t`,t.value];if(t instanceof M)return[`t`,t.chunks.map(e=>e.value).join(``)];if(t instanceof A)return[`b`,e.N(t.value)];if(t instanceof j){let n=``;for(let r of t.chunks)n+=e.N(r.value);return[`b`,n]}if(t instanceof O)return isNaN(t.value)?[`f`,`NaN`]:Object.is(t.value,-0)?[`f`,`-0`]:[`f`,String(t.value)];if(t instanceof F)return[`s`,t.value];if(t instanceof N)return[`A`,t.items.map(vr)];if(t instanceof P){let e=t.entries.map(([e,t])=>[vr(e),vr(t)]);if(e.length<=1)return[`M`,e];let n=e.map(e=>[JSON.stringify(e[0]),e]);return n.sort((e,t)=>e[0]<t[0]?-1:+(e[0]>t[0])),[`M`,n.map(e=>e[1])]}return t instanceof k?[`G`,String(t.tag),vr(t.content)]:[`c`,e.N(t.toCBOR())]}function yr(t){if(t instanceof E)return`u`+t.value;if(t instanceof D)return`n`+t.value;if(t instanceof z)return`t`+t.value;if(t instanceof M){let e=`t`;for(let n of t.chunks)e+=n.value;return e}if(t instanceof A)return`b`+e.N(t.value);if(t instanceof j){let n=`b`;for(let r of t.chunks)n+=e.N(r.value);return n}return t instanceof O?isNaN(t.value)?`fNaN`:Object.is(t.value,-0)?`f-0`:`f`+t.value:t instanceof F?`s`+t.value:JSON.stringify(vr(t))}var br=Array.from({length:24},(e,t)=>BigInt(t)),xr;function Sr(e){return e===void 0?xr??=mi(void 0).filter(e=>e.parseTag!==void 0):mi(e).filter(e=>e.parseTag!==void 0)}function Cr(e,t){for(let n=0;n<t;n++)if(e[n]>=128)return;return String.fromCharCode.apply(null,e)}function wr(e,t,n){if(n<=23)return{value:br[n],nextOffset:t};switch(n){case 24:return t+1>e.byteLength&&V(`unexpected end of input`),{value:BigInt(e.getUint8(t)),nextOffset:t+1};case 25:return t+2>e.byteLength&&V(`unexpected end of input`),{value:BigInt(e.getUint16(t,!1)),nextOffset:t+2};case 26:return t+4>e.byteLength&&V(`unexpected end of input`),{value:BigInt(e.getUint32(t,!1)),nextOffset:t+4};case 27:return t+8>e.byteLength&&V(`unexpected end of input`),{value:e.getBigUint64(t,!1),nextOffset:t+8};default:V(`reserved additional info value: ${n}`)}}function Tr(e,t,n){if(n<=23)return{value:n,nextOffset:t};switch(n){case 24:return t+1>e.byteLength&&V(`unexpected end of input`),{value:e.getUint8(t),nextOffset:t+1};case 25:return t+2>e.byteLength&&V(`unexpected end of input`),{value:e.getUint16(t,!1),nextOffset:t+2};case 26:return t+4>e.byteLength&&V(`unexpected end of input`),{value:e.getUint32(t,!1),nextOffset:t+4};case 27:{t+8>e.byteLength&&V(`unexpected end of input`);let n=e.getUint32(t,!1),r=e.getUint32(t+4,!1);return{value:n*4294967296+r,nextOffset:t+8}}default:V(`reserved additional info value: ${n}`)}}function Er(e,t,n,r,i,a){let o=[],s=t;for(;;){if(s>=e.byteLength&&V(`unexpected end of indefinite ${i}`),e.getUint8(s)===255){s++;break}let t=H(e,s,n,r);a(t.value)||V(`indefinite-length ${i} chunk must be a definite ${i}`),o.push(t.value),s=t.nextOffset}return{chunks:o,nextOffset:s}}function Dr(e,t,n,r){let i=yr(e);t.has(i)&&n.push(gr(`duplicate map key at offset ${e.start}`,e.start,r)),t.add(i)}function H(e,t,n,r){let i=t,a=kr(e,t,n,r);return a.value.start=i,a.value.end=a.nextOffset,a}function Or(e,t,n){return new Uint8Array(e.buffer,e.byteOffset+t,n).slice()}function kr(e,t,n,r){t>=e.byteLength&&V(`unexpected end of input`);let i=e.getUint8(t++),a=i>>5,o=i&31;switch(a){case 0:{let{value:n,nextOffset:r}=wr(e,t,o);return{value:new E(n,{encodingWidth:fr(o,n)}),nextOffset:r}}case 1:{let{value:n,nextOffset:r}=wr(e,t,o),i=fr(o,n);return{value:new D(-1n-n,{encodingWidth:i}),nextOffset:r}}case 2:{if(o===31){let{chunks:i,nextOffset:a}=Er(e,t,n,r,`byte string`,e=>e instanceof A);return{value:new j(i),nextOffset:a}}let{value:i,nextOffset:a}=Tr(e,t,o),s=pr(o,i);return a+i>e.byteLength&&V(`byte string extends beyond input`),{value:new A(new Uint8Array(e.buffer,e.byteOffset+a,i).slice(),{encodingWidth:s}),nextOffset:a+i}}case 3:{if(o===31){let{chunks:i,nextOffset:a}=Er(e,t,n,r,`text string`,e=>e instanceof z);return{value:new M(i),nextOffset:a}}let{value:i,nextOffset:a}=Tr(e,t,o),s=pr(o,i);a+i>e.byteLength&&V(`text string extends beyond input`);let c=new Uint8Array(e.buffer,e.byteOffset+a,i),l,u,d=i<64?Cr(c,i):void 0;if(d!==void 0)l=d;else try{l=mr.decode(c)}catch{u=gr(`invalid UTF-8 sequence in text string`,a,n),l=hr.decode(c)}let f=new z(l,{encodingWidth:s});return u&&_r(f,u),{value:f,nextOffset:a+i}}case 4:{if(o===31){let i=[],a=t;for(;;){if(a>=e.byteLength&&V(`unexpected end of indefinite array`),e.getUint8(a)===255){a++;break}let t=H(e,a,n,r);i.push(t.value),a=t.nextOffset}return{value:new N(i,{indefiniteLength:!0}),nextOffset:a}}let{value:i,nextOffset:a}=Tr(e,t,o),s=pr(o,i),c=[],l=a;for(let t=0;t<i;t++){let t=H(e,l,n,r);c.push(t.value),l=t.nextOffset}return{value:new N(c,{encodingWidth:s}),nextOffset:l}}case 5:{if(o===31){let i=[],a=new Set,o=[],s=t;for(;;){if(s>=e.byteLength&&V(`unexpected end of indefinite map`),e.getUint8(s)===255){s++;break}let t=H(e,s,n,r);Dr(t.value,a,o,n),s=t.nextOffset;let c=H(e,s,n,r);s=c.nextOffset,i.push([t.value,c.value])}let c=new P(i,{indefiniteLength:!0});for(let e of o)_r(c,e);return{value:c,nextOffset:s}}let{value:i,nextOffset:a}=Tr(e,t,o),s=pr(o,i),c=[],l=new Set,u=[],d=a;for(let t=0;t<i;t++){let t=H(e,d,n,r);Dr(t.value,l,u,n),d=t.nextOffset;let i=H(e,d,n,r);d=i.nextOffset,c.push([t.value,i.value])}let f=new P(c,{encodingWidth:s});for(let e of u)_r(f,e);return{value:f,nextOffset:d}}case 6:{o===31&&V(`tags cannot use indefinite-length encoding`);let{value:i,nextOffset:a}=wr(e,t,o),s=fr(o,i),c=H(e,a,n,r);for(let e of r){let t=e.parseTag(i,c.value,n);if(t!==void 0)return t instanceof k&&s!==void 0&&(t.encodingWidth=s),{value:t,nextOffset:c.nextOffset}}return{value:new k(i,c.value,{encodingWidth:s}),nextOffset:c.nextOffset}}case 7:if(o<=19)return{value:new F(o),nextOffset:t};if(o===20)return{value:new F(20),nextOffset:t};if(o===21)return{value:new F(21),nextOffset:t};if(o===22)return{value:new F(22),nextOffset:t};if(o===23)return{value:new F(23),nextOffset:t};if(o===24){t+1>e.byteLength&&V(`unexpected end of input`);let r=e.getUint8(t);if(r<32){let e=gr(`simple value ${r} must be encoded in initial byte (0–31 reserved for extended encoding)`,t-1,n),i=new F(r);return _r(i,e),{value:i,nextOffset:t+1}}return{value:new F(r),nextOffset:t+1}}if(o===25){t+2>e.byteLength&&V(`unexpected end of input`);let n=v(e.getUint16(t,!1));return{value:new O(n,{precision:`half`,rawBits:Number.isNaN(n)?Or(e,t,2):void 0}),nextOffset:t+2}}if(o===26){t+4>e.byteLength&&V(`unexpected end of input`);let n=e.getFloat32(t,!1);return{value:new O(n,{precision:`single`,rawBits:Number.isNaN(n)?Or(e,t,4):void 0}),nextOffset:t+4}}if(o===27){t+8>e.byteLength&&V(`unexpected end of input`);let n=e.getFloat64(t,!1);return{value:new O(n,{precision:`double`,rawBits:Number.isNaN(n)?Or(e,t,8):void 0}),nextOffset:t+8}}return o<31&&V(`reserved additional info value in major type 7: ${o}`),V(`unexpected break code outside indefinite-length item`)}return V(`unknown major type: ${a}`)}function Ar(e){if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw TypeError(`expected ArrayBufferView or ArrayBufferLike`)}function jr(e,t){let n=Ar(e),r=new DataView(n.buffer,n.byteOffset,n.byteLength),i=t?.offset??0;if(!Number.isInteger(i)||i<0||i>r.byteLength)throw RangeError(`CBOR decode offset must be an integer between 0 and ${r.byteLength}`);let a=Sr(t?.builtinExtensions),o=t?.extensions?.length?[...t.extensions.filter(e=>e.parseTag!==void 0),...a]:a,{value:s,nextOffset:c}=H(r,i,t,o);if(!t?.allowTrailing&&c!==r.byteLength){_r(s,gr(`${r.byteLength-c} trailing byte(s) after end of CBOR item`,c,t));let e={strict:!1,silent:!0},n=c;for(;n<r.byteLength;)({nextOffset:n}=H(r,n,e,o))}return s}var Mr=24n,Nr={tagNumbers:[Mr],parseTag(e,t,n){if(e!==24n||!(t instanceof A))return;let r=(t.end??t.value.length)-t.value.length,i=n?{extensions:n.extensions,builtinExtensions:n.builtinExtensions,strict:n.strict,onWarning:n.onWarning?e=>n.onWarning({...e,offset:e.offset+r}):void 0,silent:n.silent}:void 0;try{return new k(Mr,new I([jr(t.value,i)],{encodingWidth:t.encodingWidth}))}catch(e){if(i?.strict!==!1)throw e;let t=`tag 24 content is not valid CBOR: ${e instanceof Error?e.message:String(e)}`,a={message:t,offset:r};n?.onWarning?n.onWarning(a):n?.silent||console.warn(`CBOR strict violation at offset ${a.offset}: ${t}`);return}}};function Pr(e){return e instanceof L&&!(e.content instanceof N)}function Fr(e){let t=!1,n=!1,r=!1,i;for(let a of e){let e;if(Pr(a))e=!0,r=!0;else if(a instanceof z)e=!1,t=!0;else if(a instanceof A)e=!1,n=!0;else return!1;if(e===i)return!1;i=e}return r&&!(t&&n)}var Ir={tagNumbers:[Ze],parseTag(e,t){if(e===888n){if(t instanceof F&&t.value===22)return new L;if(t instanceof N&&Fr(t.items))return new L(t.items)}}},Lr=new TextEncoder,Rr=new TextDecoder(`utf-8`,{fatal:!0}),zr=new TextDecoder(`utf-8`,{fatal:!1}),Br=Symbol(`ellipsis`);function Vr(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Hr(e,t,n){if(t instanceof Xe){Hr(e,t.inner,n);return}if(t instanceof L){if(t.content instanceof N)for(let r of t.content.items)Hr(e,r,n);else n.push(Br);return}if(t instanceof z){n.push(Lr.encode(t.value));return}if(t instanceof A){n.push(t.value);return}if(t instanceof M){n.push(Lr.encode(t.chunks.map(e=>e.value).join(``)));return}if(t instanceof j){n.push(Vr(t.chunks.map(e=>e.value)));return}throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings or ellipses`)}function Ur(e,t){try{return Rr.decode(e)}catch{let n=`t1 concatenation result is not valid UTF-8`;if(t)t(n);else throw SyntaxError(n);return zr.decode(e)}}function Wr(e,t,n){let r=[];for(let n of t)Hr(e,n,r);let i=e===`t1`,a=[],o=!1,s=[],c=()=>{if(s.length===0)return;let e=Vr(s);s.length=0,e.length!==0&&a.push(i?new z(Ur(e,n)):new A(e))};for(let e of r)e===Br?(c(),a[a.length-1]instanceof L||(a.push(new L),o=!0)):s.push(e);if(!o){let e=Vr(s);return i?new z(Ur(e,n)):new A(e)}return c(),a.length===1?new L:new L(a)}function Gr(e){return{appStringPrefixes:[e],preserveAppSeqSource:!0,parseAppString(t,n,r){return Wr(e,[new z(n)],r)},parseAppSequence(t,n,r){return Wr(e,n,r)}}}var Kr=Gr(`t1`),qr=Gr(`b1`),Jr=new TextEncoder,Yr=new TextDecoder(`utf-8`,{fatal:!0}),Xr=new TextDecoder(`utf-8`,{fatal:!1});function Zr(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Qr(e,t,n){let r=e===`ilts`,i=[],a=[];for(let o of t){if(o instanceof Xe&&(o=o.inner),o instanceof L)throw SyntaxError(`${e}<<...>> cannot contain ellipses; there is no way to include an elision in an indefinite-length string`);let t,s,c;if(o instanceof z)t=o.value,c=o.encodingWidth;else if(o instanceof A)s=o.value,c=o.encodingWidth;else if(o instanceof M)t=o.chunks.map(e=>e.value).join(``);else if(o instanceof j)s=Zr(o.chunks.map(e=>e.value));else throw SyntaxError(`${e}<<...>> arguments must be (text or byte) strings`);if(r){let e;if(t!==void 0)e=t;else try{e=Yr.decode(s)}catch{let t=`ilts chunk is not valid UTF-8`;if(n)n(t);else throw SyntaxError(t);e=Xr.decode(s)}a.push(new z(e,c===void 0?void 0:{encodingWidth:c}))}else{let e=s??Jr.encode(t);i.push(new A(e,c===void 0?void 0:{encodingWidth:c}))}}return r?new M(a):new j(i)}function $r(t){return{appStringPrefixes:[t],preserveAppSeqSource:!0,parseAppString(n,r,i){return new Xe(Qr(t,[new z(r)],i),`${t}${e.s(r)}`)},parseAppSequence(e,n,r){return Qr(t,n,r)}}}var ei=$r(`ilbs`),ti=$r(`ilts`),ni=class extends O{_bits;constructor(e){super(v(e),{precision:`half`}),this._bits=e&65535}_toCBOR(){return new Uint8Array([249,this._bits>>8&255,this._bits&255])}},ri=class extends O{_raw;constructor(e){super(new DataView(e.buffer,e.byteOffset).getFloat32(0,!1),{precision:`single`}),this._raw=e.slice()}_toCBOR(){let e=new Uint8Array(5);return e[0]=250,e.set(this._raw,1),e}},ii=class extends O{_raw;constructor(e){super(new DataView(e.buffer,e.byteOffset).getFloat64(0,!1),{precision:`double`}),this._raw=e.slice()}_toCBOR(){let e=new Uint8Array(9);return e[0]=251,e.set(this._raw,1),e}};function ai(e){if(e.length===2)return new ni(e[0]<<8|e[1]);if(e.length===4)return new ri(e);if(e.length===8)return new ii(e);throw SyntaxError(`float'...' requires 4, 8, or 16 hex digits (2, 4, or 8 bytes); got ${e.length} bytes`)}function oi(e){let t=e>>>15&1,n=e>>>10&31,r=e&1023,i;if(n===31)i=t<<31|2139095040|r<<13;else if(n===0&&r===0)i=t<<31;else if(n===0){let e=r,n=0;for(;!(e&512);)e<<=1,n++;i=t<<31|112-n<<23|(e&511)<<14}else i=t<<31|n+112<<23|r<<13;let a=new Uint8Array(4);return new DataView(a.buffer).setUint32(0,i>>>0,!1),a}function si(e){let t=e>>>15&1,n=e>>>10&31,r=e&1023,i=new Uint8Array(8),a=new DataView(i.buffer);if(n===31)a.setUint32(0,(t<<31|2146435072|r<<10)>>>0,!1),a.setUint32(4,0,!1);else if(n===0&&r===0)a.setUint32(0,t<<31>>>0,!1),a.setUint32(4,0,!1);else if(n===0){let e=r,n=0;for(;!(e&512);)e<<=1,n++;a.setUint32(0,(t<<31|1008-n<<20|(e&511)<<11)>>>0,!1),a.setUint32(4,0,!1)}else a.setUint32(0,(t<<31|n+1008<<20|r<<10)>>>0,!1),a.setUint32(4,0,!1);return i}function ci(e){let t=new DataView(e.buffer,e.byteOffset).getUint32(0,!1),n=t>>>31&1,r=t>>>23&255,i=t&8388607,a=new Uint8Array(8),o=new DataView(a.buffer);if(r===255)o.setUint32(0,(n<<31|2146435072|i>>>3)>>>0,!1),o.setUint32(4,(i&7)<<29,!1);else if(r===0&&i===0)o.setUint32(0,n<<31>>>0,!1),o.setUint32(4,0,!1);else{let t=new DataView(e.buffer,e.byteOffset).getFloat32(0,!1);o.setFloat64(0,t,!1)}return a}function li(e,t,n){let r=e.length===2?1:e.length===4?2:3;if(r===1){let n=e[0]<<8|e[1];if(t===2)return new ri(oi(n));if(t===3)return new ii(si(n))}if(r===2){if(t===3)return new ii(ci(e));if(t===1){let t=new DataView(e.buffer,e.byteOffset).getFloat32(0,!1),r=_(t);return!Object.is(v(r),t)&&!isNaN(t)&&n(`float'...' value cannot be exactly represented as float16 (_1)`),new ni(r)}}if(r===3){let r=new DataView(e.buffer,e.byteOffset).getFloat64(0,!1);if(t===1){let e=_(r);return!Object.is(v(e),r)&&!isNaN(r)&&n(`float'...' value cannot be exactly represented as float16 (_1)`),new ni(e)}if(t===2){let e=Math.fround(r);!Object.is(e,r)&&!isNaN(r)&&n(`float'...' value cannot be exactly represented as float32 (_2)`);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!1),new ri(t)}}return ai(e)}var ui={appStringPrefixes:[`float`],parseAppString(t,n,r,i){let a=Ve(n);if(!/^[0-9a-fA-F]*$/.test(a))throw SyntaxError(`float'...' contains non-hex characters`);if(a.length%2!=0)throw SyntaxError(`float'...' hex content has odd length (${a.length} digits)`);let o=e.F(a),s=i?.encodingWidth;if(s===void 0)return ai(o);if(s!==1&&s!==2&&s!==3){let e=`float'...' encoding indicator _${s} is not valid; use _1, _2, or _3`;if(r)return r(e),ai(o);throw SyntaxError(e)}return s===(o.length===2?1:o.length===4?2:3)?ai(o):li(o,s,r??(e=>{throw SyntaxError(e)}))},parseAppSequence(e,t,n){if(t.length===0)throw SyntaxError(`float<<...>> requires exactly one byte-string item`);if(t.length>1){let e=`float<<...>> expects 1 item; got ${t.length} — using first`;if(n)n(e);else throw SyntaxError(e)}if(!(t[0]instanceof A))throw SyntaxError(`float<<...>> item must be a byte string`);return ai(t[0].value)}},di=[dr,Nr,Ir],fi=[mn,Pn,cr,Kr,qr,ei,ti,ui],pi;function mi(e){return e===void 0?pi??=[...di,...fi]:e===!1?di:[...di,...e]}var hi=new WeakMap;function gi(e){let t=hi.get(e);return t||(t=_i(e),hi.set(e,t)),t}function _i(e){let t=new Map,n=new Map,r=(e,n)=>{let r=t.get(e);r||(r=new Set,t.set(e,r)),r.add(n)},i=(e,t)=>{let r=n.get(e);r||(r=new Set,n.set(e,r)),r.add(t)},a=new Set,o=new Map,s=new Map;for(let t of e.ast){if(t.generics?.length)continue;let e=s.get(t.name);e||(e=[],s.set(t.name,e)),e.push(t)}for(let[e,t]of s){let n=[],i=!1;for(let e of t){let t=vi(e.body);t===void 0?i=!0:n.push(t)}if(n.length!==0){if(i){a.add(e);continue}for(let t of n){r(e,t);let n=o.get(e);n||(n=new Set,o.set(e,n)),n.add(t)}}}for(let t of e.ast)xi(t.body,r,i,o);let c=new Set(a),l=new Map;for(let[e,n]of t)n.size>1||a.has(e)?c.add(e):l.set(e,n.values().next().value);let u=new Map,d=new Map;for(let[e,t]of n){if(t.size!==1)continue;let[n]=t;c.has(n)||(u.set(e,n),d.set(n,e))}let f=new Map;for(let[e,t]of o)t.size===1&&f.set(e,t.values().next().value);return{byName:l,byValue:u,nameToValue:d,ambiguousNames:c,ruleConstantValues:f}}function vi(e){if(e.kind===`entry`)return yi(e.value)}function yi(e){if(e.alternatives.length!==1)return;let t=e.alternatives[0];if(!t.op)return bi(t.target)}function bi(e){if(e.kind===`value`&&e.type===`int`)return typeof e.value==`bigint`?e.value:BigInt(e.value)}function xi(e,t,n,r){if(e.kind===`entry-group`){Si(e.group,t,n,r);return}e.memberKey?.kind===`type1`&&wi(e.memberKey.key,t,n,!0,r),Ci(e.value,t,n,!1,r)}function Si(e,t,n,r){for(let i of e.choices)for(let e of i)xi(e,t,n,r)}function Ci(e,t,n,r,i){for(let a of e.alternatives)wi(a,t,n,r,i)}function wi(e,t,n,r,i){Ti(e.target,t,n,r,i),e.controller&&Ti(e.controller,t,n,r,i)}function Ti(e,t,n,r,i){switch(e.kind){case`value`:case`any`:return;case`ref`:{let a=i.get(e.name);if(r&&a&&!e.genericArgs?.length)for(let t of a)n(t,e.name);for(let a of e.genericArgs??[])wi(a,t,n,r,i);return}case`paren`:Ci(e.type,t,n,r,i);return;case`map`:case`array`:Si(e.group,t,n,i);return;case`unwrap`:for(let a of e.ref.genericArgs??[])wi(a,t,n,r,i);return;case`enum`:if(e.group.kind===`group`)Ei(e.group,t,n,r),Si(e.group,t,n,i);else for(let a of e.group.genericArgs??[])wi(a,t,n,r,i);return;case`tagged`:typeof e.tag==`object`&&Ci(e.tag,t,n,r,i),Ci(e.item,t,n,r,i);return;case`major`:typeof e.ai==`object`&&Ci(e.ai,t,n,r,i);return}}function Ei(e,t,n,r){for(let i of e.choices)for(let e of i){if(e.kind!==`entry`||!e.memberKey)continue;let i=e.memberKey,a=i.kind===`bareword`?i.key:i.kind===`value`&&i.key.type===`text`?i.key.value:void 0;if(a===void 0)continue;let o=yi(e.value);o!==void 0&&(t(a,o),r&&n(o,a))}}var Di=new TextEncoder,U=e=>e>=`0`&&e<=`9`,W=e=>U(e)||e>=`a`&&e<=`f`||e>=`A`&&e<=`F`,Oi=e=>e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e===`@`||e===`_`||e===`$`,ki=e=>e>=160&&e<=55295||e>=57344&&e<=1114109,Ai=class{input;pos=0;line=1;col=1;comments=[];lastEndOffset=0;constructor(e){this.input=e}_eof(){return this.pos>=this.input.length}_ch(){return this.input[this.pos]??``}_advance(){let e=this.input[this.pos]??``;return this.pos++,e===`
|
|
13
|
+
`?(this.line++,this.col=1):this.col++,e}_fail(e,n,r){throw new t(e,{offset:this.pos,line:n??this.line,column:r??this.col})}_skipWs(){for(;;){let e=this._ch();if(e===` `||e===`
|
|
14
|
+
`||e===`\r`){this._advance();continue}if(e===` `&&this._fail(`horizontal tab is not valid whitespace in CDDL (RFC 8610 ABNF allows only space and newline)`),e===`;`){this._scanComment();continue}return}}_scanComment(){let e=this.pos,t=this.line,n=this.col;this._advance();let r=this.pos;for(;r<this.input.length;){let e=this.input[r];if(e===`
|
|
15
|
+
`||e===`\r`)break;r++}let i=this.input.slice(this.pos,r);this.col+=r-this.pos,this.pos=r,this.comments.push({text:i,start:e,end:r,line:t,col:n})}_make(e,t,n,r,i,a){let o={type:e,value:t,raw:this.input.slice(n,this.pos),line:r,col:i,offset:n,endOffset:this.pos,...a};return this.lastEndOffset=this.pos,o}consume(){this._skipWs();let e=this.pos,t=this.line,n=this.col;if(this._eof())return this._make(`EOF`,``,e,t,n);let r=this._ch();if(Oi(r)){let r=this._scanIdText();return(r===`h`||r===`b64`)&&this._ch()===`'`?this._scanBytes(r,e,t,n):this._make(`ID`,r,e,t,n)}if(U(r)||r===`-`)return this._scanNumber(e,t,n);if(r===`"`)return this._scanText(e,t,n);if(r===`'`)return this._scanBytes(``,e,t,n);if(r===`#`)return this._scanHash(e,t,n);switch(r){case`=`:return this._advance(),this._ch()===`>`?(this._advance(),this._make(`ARROW`,`=>`,e,t,n)):this._make(`ASSIGN`,`=`,e,t,n);case`/`:return this._advance(),this._ch()===`/`?(this._advance(),this._ch()===`=`?(this._advance(),this._make(`DSLASH_EQ`,`//=`,e,t,n)):this._make(`DSLASH`,`//`,e,t,n)):this._ch()===`=`?(this._advance(),this._make(`SLASH_EQ`,`/=`,e,t,n)):this._make(`SLASH`,`/`,e,t,n);case`.`:{if(this._advance(),this._ch()===`.`)return this._advance(),this._ch()===`.`?(this._advance(),this._make(`RANGE_EXCL`,`...`,e,t,n)):this._make(`RANGE_INCL`,`..`,e,t,n);Oi(this._ch())||this._fail(`expected a control operator name after '.' (e.g. .size), got ${this._eof()?`end of input`:JSON.stringify(this._ch())}`,t,n);let r=this._scanIdText();return this._make(`CTLOP`,r,e,t,n)}case`,`:return this._advance(),this._make(`COMMA`,`,`,e,t,n);case`(`:return this._advance(),this._make(`LPAREN`,`(`,e,t,n);case`)`:return this._advance(),this._make(`RPAREN`,`)`,e,t,n);case`{`:return this._advance(),this._make(`LBRACE`,`{`,e,t,n);case`}`:return this._advance(),this._make(`RBRACE`,`}`,e,t,n);case`[`:return this._advance(),this._make(`LBRACKET`,`[`,e,t,n);case`]`:return this._advance(),this._make(`RBRACKET`,`]`,e,t,n);case`<`:return this._advance(),this._make(`LT`,`<`,e,t,n);case`>`:return this._advance(),this._make(`GT`,`>`,e,t,n);case`~`:return this._advance(),this._make(`TILDE`,`~`,e,t,n);case`&`:return this._advance(),this._make(`AMP`,`&`,e,t,n);case`*`:return this._advance(),this._make(`STAR`,`*`,e,t,n);case`+`:return this._advance(),this._make(`PLUS`,`+`,e,t,n);case`?`:return this._advance(),this._make(`QUEST`,`?`,e,t,n);case`:`:return this._advance(),this._make(`COLON`,`:`,e,t,n);case`^`:return this._advance(),this._make(`CARET`,`^`,e,t,n);default:this._fail(`unexpected character ${JSON.stringify(r)}`)}}_scanIdText(){let e=this.pos;for(this._advance();;){let e=this._ch();if(Oi(e)||U(e)){this._advance();continue}if(e===`-`||e===`.`){let e=this.pos;for(;this.input[e]===`-`||this.input[e]===`.`;)e++;let t=this.input[e]??``;if(!(Oi(t)||U(t)))break;for(;this.pos<=e;)this._advance();continue}break}return this.input.slice(e,this.pos)}_scanNumber(e,t,n){this._ch()===`-`&&this._advance(),U(this._ch())||this._fail(`expected a digit after '-'`,t,n);let r=!1;if(this._ch()===`0`&&/[xX]/.test(this.input[this.pos+1]??``)){for(this._advance(),this._advance(),W(this._ch())||this._fail(`expected hex digits after 0x`,t,n);W(this._ch());)this._advance();if(this._ch()===`.`&&W(this.input[this.pos+1]??``)&&this.input[this.pos+1]!==void 0){for(this._advance();W(this._ch());)this._advance();/[pP]/.test(this._ch())||this._fail(`hexadecimal fraction requires a 'p' exponent (hexfloat)`,t,n)}if(/[pP]/.test(this._ch())){for(this._advance(),(this._ch()===`+`||this._ch()===`-`)&&this._advance(),U(this._ch())||this._fail(`expected exponent digits after 'p'`,t,n);U(this._ch());)this._advance();r=!0}}else if(this._ch()===`0`&&/[bB]/.test(this.input[this.pos+1]??``))for(this._advance(),this._advance(),/[01]/.test(this._ch())||this._fail(`expected binary digits after 0b`,t,n);/[01]/.test(this._ch());)this._advance();else{for(this._ch()===`0`&&U(this.input[this.pos+1]??``)&&this._fail(`leading zeros are not allowed in CDDL numbers`,t,n);U(this._ch());)this._advance();if(this._ch()===`.`&&U(this.input[this.pos+1]??``)){for(this._advance();U(this._ch());)this._advance();r=!0}if(/[eE]/.test(this._ch())){for(this._advance(),(this._ch()===`+`||this._ch()===`-`)&&this._advance(),U(this._ch())||this._fail(`expected exponent digits after 'e'`,t,n);U(this._ch());)this._advance();r=!0}}let i=this.input.slice(e,this.pos);return this._make(r?`FLOAT`:`INT`,i,e,t,n)}_scanUintRaw(){let e=this.pos;if(U(this._ch())||this._fail(`expected an unsigned integer head-number`),this._ch()===`0`&&/[xX]/.test(this.input[this.pos+1]??``))for(this._advance(),this._advance(),W(this._ch())||this._fail(`expected hex digits after 0x`);W(this._ch());)this._advance();else if(this._ch()===`0`&&/[bB]/.test(this.input[this.pos+1]??``))for(this._advance(),this._advance(),/[01]/.test(this._ch())||this._fail(`expected binary digits after 0b`);/[01]/.test(this._ch());)this._advance();else for(this._ch()===`0`&&U(this.input[this.pos+1]??``)&&this._fail(`leading zeros are not allowed in CDDL numbers`);U(this._ch());)this._advance();return this.input.slice(e,this.pos)}_scanHash(e,t,n){this._advance();let r={};return U(this._ch())&&(r.hashMajor=this._advance().charCodeAt(0)-48,this._ch()===`.`&&(this.input[this.pos+1]===`<`?(this._advance(),r.hashAIExpr=!0):(this._advance(),r.hashAI=BigInt(this._scanUintRaw())))),this._make(`HASH`,this.input.slice(e,this.pos),e,t,n,r)}_scanText(e,t,n){let r=this._readStringBody(`"`);return this._make(`TSTR`,r,e,t,n)}_scanBytes(n,r,i,a){let o=this._readStringBody(`'`),s;if(n===``)s=Di.encode(o);else{let c=ji(o);try{s=n===`h`?e.F(c):e.j(c)}catch(e){throw!(e instanceof SyntaxError)||e instanceof t?e:new t(e.message,{offset:r,line:i,column:a,endOffset:this.pos})}}return this._make(`BYTES`,o,r,i,a,{qualifier:n,bytes:s})}_readStringBody(e){let t=e===`'`;this._advance();let n=``;for(;;){this._eof()&&this._fail(`unterminated ${t?`byte`:`text`} string literal`);let r=this._ch();if(r===e)return this._advance(),n;if(r===`\\`){let e=this.line,r=this.col;this._advance();let i=this._advance();switch(i){case`"`:n+=`"`;break;case`/`:n+=`/`;break;case`\\`:n+=`\\`;break;case`b`:n+=`\b`;break;case`f`:n+=`\f`;break;case`n`:n+=`
|
|
16
|
+
`;break;case`r`:n+=`\r`;break;case`t`:n+=` `;break;case`u`:n+=this._readUnicodeEscape(e,r);break;case`'`:t||this._fail(`\\' is only valid in byte string literals; text strings do not need it`,e,r),n+=`'`;break;default:this._fail(`invalid escape sequence \\${i}`,e,r)}continue}if(r===`
|
|
17
|
+
`||r===`\r`){t||this._fail(`text string literals cannot span lines (escape the newline as \\n)`),r===`\r`?(this._advance(),this._ch()!==`
|
|
18
|
+
`&&this._fail(`bare CR is not allowed in byte string literals`),this._advance(),n+=`\r
|
|
19
|
+
`):(this._advance(),n+=`
|
|
20
|
+
`);continue}let i=this.input.codePointAt(this.pos);(i<32||i>=127&&i<=159)&&this._fail(`unescaped control character U+${i.toString(16).padStart(4,`0`).toUpperCase()} is not allowed in string literals`),i>126&&!ki(i)&&this._fail(`code point U+${i.toString(16).toUpperCase()} is not allowed in CDDL source`),this._advance(),i>65535&&this._advance(),n+=String.fromCodePoint(i)}}_readUnicodeEscape(e,t){if(this._ch()===`{`){this._advance();let n=``;for(;W(this._ch());)n+=this._advance();n.length===0&&this._fail(`\\u{} escape requires at least one hex digit`,e,t),this._ch()!==`}`&&this._fail(`expected '}' to close \\u{...} escape`,e,t),this._advance();let r=parseInt(n,16);return r>1114111&&this._fail(`\\u{${n}} is above the Unicode code point maximum U+10FFFF`,e,t),r>=55296&&r<=57343&&this._fail(`\\u{${n}} is a surrogate code point, not a Unicode scalar value`,e,t),String.fromCodePoint(r)}let n=()=>{let n=``;for(let r=0;r<4;r++)W(this._ch())||this._fail(`\\u escape requires four hex digits`,e,t),n+=this._advance();return parseInt(n,16)},r=n();if(r>=55296&&r<=56319){(this._ch()!==`\\`||this.input[this.pos+1]!==`u`)&&this._fail(`high surrogate \\u escape must be followed by a low surrogate \\u escape`,e,t),this._advance(),this._advance();let i=n();return(i<56320||i>57343)&&this._fail(`high surrogate \\u escape must be followed by a low surrogate \\u escape`,e,t),String.fromCodePoint(65536+(r-55296<<10)+(i-56320))}return r>=56320&&r<=57343&&this._fail(`lone low surrogate \\u escape`,e,t),String.fromCodePoint(r)}};function ji(e){let t=``,n=0;for(;n<e.length;){let r=e[n];if(r===` `||r===`
|
|
21
|
+
`||r===`\r`){n++;continue}if(r===`;`){for(;n<e.length&&e[n]!==`
|
|
22
|
+
`;)n++;continue}t+=r,n++}return t}function Mi(e){let t=new Ai(e);return{rules:new Pi(t).parse(),comments:t.comments}}var Ni=new Set([`SLASH`,`RANGE_INCL`,`RANGE_EXCL`,`CTLOP`,`ARROW`,`CARET`]),Pi=class{t;buf=[];constructor(e){this.t=e}peek(e=0){for(;this.buf.length<=e;)this.buf.push(this.t.consume());return this.buf[e]}consume(){return this.buf.shift()??this.t.consume()}expect(e,t){let n=this.peek();return n.type!==e&&this._fail(`expected ${t}`,n),this.consume()}_fail(e,n){throw new t(`${e}, got ${n.type===`EOF`?`end of input`:`${JSON.stringify(n.raw)}`}`,{offset:n.offset,endOffset:n.endOffset,line:n.line,column:n.col})}parse(){let e=[];for(;this.peek().type!==`EOF`;)e.push(this.parseRule());return e}parseRule(){let e=this.expect(`ID`,`a rule name`),t;if(this.peek().type===`LT`){for(this.consume(),t=[this.expect(`ID`,`a generic parameter name`).value];this.peek().type===`COMMA`;)this.consume(),t.push(this.expect(`ID`,`a generic parameter name`).value);this.expect(`GT`,`'>' after generic parameters`)}let n=this.peek(),r;n.type===`ASSIGN`?r=`=`:n.type===`SLASH_EQ`?r=`/=`:n.type===`DSLASH_EQ`?r=`//=`:this._fail(`expected '=', '/=' or '//=' after rule name`,n),this.consume();let i=r===`/=`?this.parseTypeAsEntry():this.parseGroupEntry();return{kind:`rule`,name:e.value,...t?{generics:t}:{},assign:r,body:i,start:e.offset,end:i.end}}parseTypeAsEntry(){let e=this.parseType();return{kind:`entry`,value:e,start:e.start,end:e.end}}parseGroup(e){let t=this.peek().offset,n=[[]],r=!1;for(;;){let t=this.peek();if(t.type===e)break;if(t.type===`EOF`&&this._fail(`unterminated group; expected ${JSON.stringify(e)}`,t),t.type===`DSLASH`){this.consume(),n.push([]),r=!1;continue}n[n.length-1].push(this.parseGroupEntry()),r=this.peek().type===`COMMA`,r&&this.consume()}let i=this.peek();return{kind:`group`,choices:n,...r?{trailingComma:!0}:{},start:t,end:i.offset}}parseGroupEntry(){let e=this.peek().offset,t=this.tryParseOccur();if(this.peek().type===`LPAREN`){let n=this.consume(),r=this.parseGroup(`RPAREN`),i=this.consume();if(Ni.has(this.peek().type)){let a=this.groupAsParenType(r,n,i),o=this.continueType1(a);return this.finishEntryFromType1(e,t,o)}return{kind:`entry-group`,...t?{occur:t}:{},group:r,start:e,end:i.endOffset}}let n=this.peek(0);if(this.peek(1).type===`COLON`&&(n.type===`ID`||this.isValueToken(n))){let r;if(n.type===`ID`){this.consume();let e=this.consume();r={kind:`bareword`,key:n.value,cut:!0,start:n.offset,end:e.endOffset}}else{let e=this.parseValue(),t=this.consume();r={kind:`value`,key:e,cut:!0,start:e.start,end:t.endOffset}}let i=this.parseType();return{kind:`entry`,...t?{occur:t}:{},memberKey:r,value:i,start:e,end:i.end}}let r=this.parseType1();return this.finishEntryFromType1(e,t,r)}finishEntryFromType1(e,t,n){let r;if(this.peek().type===`CARET`||this.peek().type===`ARROW`){let e=!1;this.peek().type===`CARET`&&(this.consume(),e=!0);let t=this.expect(`ARROW`,`'=>' after member key`);r={kind:`type1`,key:n,cut:e,start:n.start,end:t.endOffset}}let i=r?this.parseType():this.continueTypeAlternatives(n);return{kind:`entry`,...t?{occur:t}:{},...r?{memberKey:r}:{},value:i,start:e,end:i.end}}tryParseOccur(){let e=this.peek(0);if(e.type===`QUEST`)return this.consume(),{kind:`occur`,marker:`?`,start:e.offset,end:e.endOffset};if(e.type===`PLUS`)return this.consume(),{kind:`occur`,marker:`+`,start:e.offset,end:e.endOffset};if(e.type===`STAR`){this.consume();let t,n=e.endOffset,r=this.peek();return r.type===`INT`&&r.offset===e.endOffset&&(t=this.occurBound(this.consume()),n=r.endOffset),{kind:`occur`,marker:`*`,...t===void 0?{}:{max:t},start:e.offset,end:n}}if(e.type===`INT`&&!e.value.startsWith(`-`)&&this.peek(1).type===`STAR`&&this.peek(1).offset===e.endOffset){let t=this.occurBound(this.consume()),n=this.consume(),r,i=n.endOffset,a=this.peek();return a.type===`INT`&&a.offset===n.endOffset&&(r=this.occurBound(this.consume()),i=a.endOffset),{kind:`occur`,marker:`*`,min:t,max:r,start:e.offset,end:i}}}occurBound(e){e.value.startsWith(`-`)&&this._fail(`occurrence bounds must be unsigned integers`,e);let t=Number(e.value);return Number.isSafeInteger(t)||this._fail(`occurrence bound is too large`,e),t}parseType(){return this.continueTypeAlternatives(this.parseType1())}continueTypeAlternatives(e){let t=[e];for(;this.peek().type===`SLASH`;)this.consume(),t.push(this.parseType1());return{kind:`type`,alternatives:t,start:e.start,end:t[t.length-1].end}}parseType1(){return this.continueType1(this.parseType2())}continueType1(e){let t=this.peek(),n;if(t.type===`RANGE_INCL`||t.type===`RANGE_EXCL`?n={kind:`range`,inclusive:t.type===`RANGE_INCL`}:t.type===`CTLOP`&&(n={kind:`ctl`,name:t.value}),!n)return{kind:`type1`,target:e,start:e.start,end:e.end};this.consume();let r=this.parseType2();return{kind:`type1`,target:e,op:n,controller:r,start:e.start,end:r.end}}parseType2(){let e=this.peek();switch(e.type){case`INT`:case`FLOAT`:case`TSTR`:case`BYTES`:return this.parseValue();case`ID`:return this.consume(),this.parseRefTail(e);case`LPAREN`:{let e=this.consume(),t=this.parseType(),n=this.expect(`RPAREN`,`')' to close the parenthesized type`);return{kind:`paren`,type:t,start:e.offset,end:n.endOffset}}case`LBRACE`:{let e=this.consume(),t=this.parseGroup(`RBRACE`),n=this.consume();return{kind:`map`,group:t,start:e.offset,end:n.endOffset}}case`LBRACKET`:{let e=this.consume(),t=this.parseGroup(`RBRACKET`),n=this.consume();return{kind:`array`,group:t,start:e.offset,end:n.endOffset}}case`TILDE`:{let e=this.consume(),t=this.expect(`ID`,`a type name after '~'`),n=this.parseRefTail(t);return{kind:`unwrap`,ref:n,start:e.offset,end:n.end}}case`AMP`:{let e=this.consume();if(this.peek().type===`LPAREN`){this.consume();let t=this.parseGroup(`RPAREN`),n=this.consume();return{kind:`enum`,group:t,start:e.offset,end:n.endOffset}}let t=this.expect(`ID`,`a group name or '(' after '&'`),n=this.parseRefTail(t);return{kind:`enum`,group:n,start:e.offset,end:n.end}}case`HASH`:return this.parseHashType(this.consume());default:this._fail(`expected a type`,e)}}parseRefTail(e){if(this.peek().type!==`LT`)return{kind:`ref`,name:e.value,start:e.offset,end:e.endOffset};this.consume();let t=[this.parseType1()];for(;this.peek().type===`COMMA`;)this.consume(),t.push(this.parseType1());let n=this.expect(`GT`,`'>' after generic arguments`);return{kind:`ref`,name:e.value,genericArgs:t,start:e.offset,end:n.endOffset}}parseHashType(e){if(e.hashMajor===void 0)return(e.hashAIExpr||e.hashAI!==void 0)&&this._fail(`'#' without a major type cannot take a head-number`,e),{kind:`any`,start:e.offset,end:e.endOffset};let t=e.hashMajor,n=e.hashAI,r=e.endOffset;e.hashAIExpr&&(t!==6&&t!==7&&this._fail(`a <type> head-number is only allowed for #6 and #7 (RFC 9682 §3.2)`,e),this.expect(`LT`,`'<' for the head-number expression`),n=this.parseType(),r=this.expect(`GT`,`'>' after the head-number expression`).endOffset);let i=e.hashAIExpr?void 0:e.raw;if(t===6&&this.peek().type===`LPAREN`){this.consume();let t=this.parseType(),r=this.expect(`RPAREN`,`')' to close the tagged type`);return{kind:`tagged`,...n===void 0?{}:{tag:n},item:t,...i===void 0?{}:{raw:i},start:e.offset,end:r.endOffset}}return e.hashAIExpr&&t===6&&this._fail(`#6.<…> must be followed by '(' type ')'`,this.peek()),{kind:`major`,major:t,...n===void 0?{}:{ai:n},...i===void 0?{}:{raw:i},start:e.offset,end:r}}isValueToken(e){return e.type===`INT`||e.type===`FLOAT`||e.type===`TSTR`||e.type===`BYTES`}parseValue(){let e=this.consume(),t={start:e.offset,end:e.endOffset,raw:e.raw};switch(e.type){case`INT`:{let n=e.value.startsWith(`-`)?-BigInt(e.value.slice(1)):BigInt(e.value);return{kind:`value`,type:`int`,value:n>=BigInt(-(2**53-1))&&n<=BigInt(2**53-1)?Number(n):n,...t}}case`FLOAT`:return{kind:`value`,type:`float`,value:/^-?0[xX]/.test(e.value)?ke(e.value):parseFloat(e.value),...t};case`TSTR`:return{kind:`value`,type:`text`,value:e.value,...t};case`BYTES`:return{kind:`value`,type:`bytes`,value:e.bytes,qualifier:e.qualifier,...t};default:this._fail(`expected a literal value`,e)}}groupAsParenType(e,t,n){let r=e.choices.length===1&&e.choices[0].length===1?e.choices[0][0]:void 0;return(!r||r.kind!==`entry`||r.occur||r.memberKey||e.trailingComma)&&this._fail(`this parenthesized group is used as a type (an operator follows), but it contains group syntax`,this.peek()),{kind:`paren`,type:r.value,start:t.offset,end:n.endOffset}}},Fi=`any = #
|
|
23
|
+
|
|
24
|
+
uint = #0
|
|
25
|
+
nint = #1
|
|
26
|
+
int = uint / nint
|
|
27
|
+
|
|
28
|
+
bstr = #2
|
|
29
|
+
bytes = bstr
|
|
30
|
+
tstr = #3
|
|
31
|
+
text = tstr
|
|
32
|
+
|
|
33
|
+
tdate = #6.0(tstr)
|
|
34
|
+
time = #6.1(number)
|
|
35
|
+
number = int / float
|
|
36
|
+
biguint = #6.2(bstr)
|
|
37
|
+
bignint = #6.3(bstr)
|
|
38
|
+
bigint = biguint / bignint
|
|
39
|
+
integer = int / bigint
|
|
40
|
+
unsigned = uint / biguint
|
|
41
|
+
decfrac = #6.4([e10: int, m: integer])
|
|
42
|
+
bigfloat = #6.5([e2: int, m: integer])
|
|
43
|
+
eb64url = #6.21(any)
|
|
44
|
+
eb64legacy = #6.22(any)
|
|
45
|
+
eb16 = #6.23(any)
|
|
46
|
+
encoded-cbor = #6.24(bstr)
|
|
47
|
+
uri = #6.32(tstr)
|
|
48
|
+
b64url = #6.33(tstr)
|
|
49
|
+
b64legacy = #6.34(tstr)
|
|
50
|
+
regexp = #6.35(tstr)
|
|
51
|
+
mime-message = #6.36(tstr)
|
|
52
|
+
cbor-any = #6.55799(any)
|
|
53
|
+
|
|
54
|
+
float16 = #7.25
|
|
55
|
+
float32 = #7.26
|
|
56
|
+
float64 = #7.27
|
|
57
|
+
float16-32 = float16 / float32
|
|
58
|
+
float32-64 = float32 / float64
|
|
59
|
+
float = float16-32 / float64
|
|
60
|
+
|
|
61
|
+
false = #7.20
|
|
62
|
+
true = #7.21
|
|
63
|
+
bool = false / true
|
|
64
|
+
nil = #7.22
|
|
65
|
+
null = nil
|
|
66
|
+
undefined = #7.23
|
|
67
|
+
`,Ii;function Li(){if(!Ii){Ii=new Map;for(let e of Mi(Fi).rules)Ii.set(e.name,e)}return Ii}function Ri(e){if(e instanceof E||e instanceof D)return e.value;if(e instanceof lt||e instanceof ut)return e.bigValue}function zi(e){if(e instanceof z)return e.value;if(e instanceof M)return e.chunks.map(e=>e.value).join(``)}function Bi(e){if(e instanceof A)return e.value;if(e instanceof j){let t=e.chunks.map(e=>e.value),n=t.reduce((e,t)=>e+t.length,0),r=new Uint8Array(n),i=0;for(let e of t)r.set(e,i),i+=e.length;return r}if(e instanceof I){let t=e.items.map(e=>e.toCBOR()),n=t.reduce((e,t)=>e+t.length,0),r=new Uint8Array(n),i=0;for(let e of t)r.set(e,i),i+=e.length;return r}}function Vi(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var Hi=new TextEncoder,Ui=new TextDecoder(`utf-8`,{fatal:!0}),Wi=e=>({kind:`value`,raw:``,start:0,end:0,...e}),Gi=e=>{let t=Ri(e);if(t!==void 0)return t;if(e instanceof O)return e.value},Ki=e=>e.type===`int`||e.type===`float`?e.value:void 0,qi=(e,t)=>{if(typeof e==`bigint`&&typeof t==`bigint`)return e<t?-1:+(e>t);let n=Number(e),r=Number(t);return n<r?-1:n>r?1:n===r?0:NaN},Ji=(e,t,n,r,i,a)=>{if(!e.matchType2(t,n,i))return!1;let o=n=>e.matchType2(e.uint(n),r,i)?!0:e.fail(i,t,a,`size ${n} does not match the .size constraint`),s=zi(t);if(s!==void 0)return o(Hi.encode(s).length);let c=Bi(t);if(c!==void 0)return o(c.length);if(t instanceof E){let n=0;for(let e=t.value;e>0n;e>>=8n)n++;let o=e.existsIntGE(r,BigInt(n));if(o!==void 0)return o?!0:e.fail(i,t,a,`${t.value} does not fit the .size constraint`);e.warnOnce(`.size controller could not be analyzed; searching a bounded window of byte counts`,a);for(let t=n;t<=n+64;t++)if(e.matchType2(e.uint(t),r,i))return!0;return e.fail(i,t,a,`${t.value} does not fit the .size constraint`)}return e.fail(i,t,a,`.size applies to strings and unsigned integers`)},Yi=(e,t,n,r,i,a)=>{if(!e.matchType2(t,n,i))return!1;let o=[],s=Bi(t);if(s!==void 0)for(let e=0;e<s.length;e++)for(let t=0;t<8;t++)s[e]&1<<t&&o.push(e*8+t);else if(t instanceof E){let e=t.value;for(let t=0;e>0n;t++,e>>=1n)e&1n&&o.push(t)}else return e.fail(i,t,a,`.bits applies to byte strings and unsigned integers`);for(let n of o)if(!e.matchType2(e.uint(n),r,i))return e.fail(i,t,a,`bit ${n} is set but not allowed by .bits`);return!0},Xi=new Map,Zi=(e,t,n,r,i,a)=>{if(!e.matchType2(t,n,i))return!1;let o=zi(t);if(o===void 0)return e.fail(i,t,a,`.regexp applies to text strings`);let s=e.resolveValue(r);if(!s||s.type!==`text`)return e.warnOnce(`.regexp controller does not resolve to a text string; not checked`,a),!0;let c=Xi.get(s.value);if(c===void 0){try{c=RegExp(`^(?:${s.value})$`,`u`)}catch{c=null}Xi.set(s.value,c)}return c===null?(e.warnOnce(`.regexp pattern is not a valid regular expression here: ${s.value}`,a),!0):c.test(o)?!0:e.fail(i,t,a,`text does not match .regexp ${JSON.stringify(s.value)}`)},Qi=e=>(t,n,r,i,a,o)=>{if(!t.matchType2(n,r,a))return!1;let s=Bi(n);if(s===void 0)return t.fail(a,n,o,`.cbor${e?`seq`:``} applies to byte strings`);let c;try{if(e){let e=new Uint8Array(s.length+2);e[0]=159,e.set(s,1),e[e.length-1]=255,c=jr(e)}else c=jr(s)}catch(e){return t.fail(a,n,o,`byte string does not contain valid CBOR: ${e instanceof Error?e.message:String(e)}`)}return t.matchEmbedded(c,i,a)?!0:t.fail(a,n,o,`embedded CBOR does not match the .cbor${e?`seq`:``} type`)},$i=(e,t,n,r,i,a)=>e.matchType2(t,n,i)?e.matchType2(t,r,i)?!0:e.fail(i,t,a,`value does not match the .within/.and constraint`):!1,ea=e=>(t,n,r,i,a,o)=>{if(!t.matchType2(n,r,a))return!1;let s=t.resolveValue(i),c=s&&Ki(s);if(c===void 0)return t.warnOnce(`.${e} controller does not resolve to a number; not checked`,o),!0;let l=Gi(n);if(l===void 0)return t.fail(a,n,o,`.${e} applies to numbers`);let u=qi(l,c);return(e===`lt`?u<0:e===`le`?u<=0:e===`gt`?u>0:u>=0)||t.fail(a,n,o,`${l} does not satisfy .${e} ${c}`)},ta=(e,t,n,r,i,a)=>{if(!e.matchType2(t,n,i))return!1;let o=e.resolveValue(r);return o?e.matchesLiteral(t,o)?!0:e.fail(i,t,a,`value does not equal ${o.raw||`.eq controller`}`):(e.warnOnce(`.eq controller does not resolve to a literal value; not checked`,a),!0)},na=(e,t,n,r,i,a)=>{if(!e.matchType2(t,n,i))return!1;let o=e.resolveValue(r);return o?!e.matchesLiteral(t,o)||e.fail(i,t,a,`value must not equal ${o.raw||`.ne controller`}`):(e.warnOnce(`.ne controller does not resolve to a literal value; not checked`,a),!0)},ra=(e,t,n,r,i,a)=>{if(!e.matchType2(t,n,i))return!1;let o=e.resolveValue(r);return o?!e.matchesLiteral(t,o)||e.fail(i,t,a,`value equals the default ${o.raw||`value`} (implied .ne, RFC 8610 §3.8.6)`):(e.warnOnce(`.default controller does not resolve to a literal value; the implied .ne is not checked`,a),!0)},ia=(e,t,n,r,i,a)=>{let o=e.resolveValue(n),s=e.resolveValue(r),c=o&&Ki(o),l=s&&Ki(s);if(o===void 0||c===void 0||l===void 0)return e.warnOnce(`.plus operands do not resolve to numbers; not checked`,a),e.fail(i,t,a,`.plus could not be computed`);if(o.type===`float`){let n=Number(c)+Number(l);return e.matchesLiteral(t,Wi({type:`float`,value:n}))?!0:e.fail(i,t,a,`expected ${n} (.plus)`)}if(typeof l==`number`&&!Number.isFinite(l))return e.fail(i,t,a,`.plus controller is not finite`);let u=(typeof c==`bigint`?c:BigInt(c))+(typeof l==`bigint`?l:BigInt(Math.floor(l)));return e.matchesLiteral(t,Wi({type:`int`,value:u}))?!0:e.fail(i,t,a,`expected ${u} (.plus)`)},aa=(e,t,n,r,i,a)=>{let o=e.resolveValue(n),s=e.resolveValue(r),c=e=>e.type===`text`?Hi.encode(e.value):e.type===`bytes`?e.value:void 0,l=o&&c(o),u=s&&c(s);if(!o||l===void 0||u===void 0)return e.warnOnce(`.cat operands do not resolve to strings; not checked`,a),e.fail(i,t,a,`.cat could not be computed`);let d=new Uint8Array(l.length+u.length);if(d.set(l,0),d.set(u,l.length),o.type===`text`){let n;try{n=Ui.decode(d)}catch{return e.fail(i,t,a,`.cat result is not valid UTF-8`)}return e.matchesLiteral(t,Wi({type:`text`,value:n}))?!0:e.fail(i,t,a,`expected ${JSON.stringify(n)} (.cat)`)}return e.matchesLiteral(t,Wi({type:`bytes`,value:d,qualifier:`h`}))?!0:e.fail(i,t,a,`byte string does not equal the .cat result`)},oa=e=>{for(;e.kind===`paren`&&e.type.alternatives.length===1&&!e.type.alternatives[0].op;)e=e.type.alternatives[0].target;return e},sa=(e,t)=>{let n=oa(t);if(n.kind===`array`){let e=n.group.choices[0]?.[0];if(!e||e.kind!==`entry`||e.value.alternatives.length!==1||e.value.alternatives[0].op)return;n=e.value.alternatives[0].target}let r=e.resolveValue(n);return r?.type===`text`?r.value:void 0},ca={size:Ji,bits:Yi,regexp:Zi,cbor:Qi(!1),cborseq:Qi(!0),within:$i,and:$i,lt:ea(`lt`),le:ea(`le`),gt:ea(`gt`),ge:ea(`ge`),eq:ta,ne:na,default:ra,plus:ia,cat:aa,feature:(e,t,n,r,i,a)=>{let o=sa(e,r);return o===void 0?(e.warnOnce(`.feature controller does not resolve to a feature name`,a),e.fail(i,t,a,`unresolvable .feature`)):e.features.has(o)?e.matchType2(t,n,i):(e.warnOnce(`feature "${o}" is not enabled (pass it in options.features to accept it)`,a),e.fail(i,t,a,`feature "${o}" is not enabled`))}};function la(e){return Object.prototype.hasOwnProperty.call(ca,e)?ca[e]:void 0}var ua=class extends Error{},da=class{schema;maxDepth;maxSteps;features;steps=0;ruleName;embeddedDepth=0;preludeDepth=0;preludeRef;warnings=[];warned=new Set;infer=!1;stripped;trail;inferLayers=new Map;best;constructor(e,t,n,r){this.schema=e,this.maxDepth=t,this.maxSteps=n,this.features=r}strictFirst(e){if(!this.infer)return e();this.infer=!1;try{if(e())return!0}finally{this.infer=!0}return e()}step(){if(++this.steps>this.maxSteps)throw new ua(`validation aborted: step budget of ${this.maxSteps} exceeded (pathological backtracking?)`)}checkDepth(e){if(e>this.maxDepth)throw new ua(`validation aborted: recursion depth ${this.maxDepth} exceeded (cyclic rules without progress?)`)}warnOnce(e,t){let n=`${e}@${t?.start??-1}`;this.warned.has(n)||(this.warned.add(n),this.warnings.push({message:e,...t?{schemaStart:t.start,schemaEnd:t.end}:{}}))}fail(e,t,n,r){let i=this.embeddedDepth>0,a=i?-1:t?.start??-1;if(!this.best||a>this.best.startKey||a===this.best.startKey&&e.length>=this.best.depth){let o=this.preludeDepth>0?this.preludeRef:n;this.best={depth:e.length,startKey:a,message:r,path:e.length===0?`/`:`/`+e.join(`/`),...!i&&t?.start!==void 0?{start:t.start,end:t.end}:{},...this.ruleName===void 0?{}:{ruleName:this.ruleName},...o?{schemaStart:o.start,schemaEnd:o.end}:{}}}return!1}};function fa(e,t,n,r){let i=n?.rule??e.root?.name;if(i===void 0)return{valid:!1,errors:[{message:`schema has no rules (no root to validate against)`,path:`/`}]};let a=new da(e,n?.maxDepth??256,n?.maxSteps??1e6,new Set(n?.features??[]));r&&(a.infer=r.infer??!1,a.stripped=r.stripped,a.trail=r.trail);let o=G(a,i)?.[0]?.generics?.length??0;if(o>0)return{valid:!1,errors:[{message:`rule '${i}' takes ${o} generic argument${o===1?``:`s`} and cannot be used as a validation target directly; reference it with concrete arguments from another rule instead`,path:`/`}]};let s;try{s=Pa(t,i,void 0,[],a,0),!s&&r&&(r.trail.length=0)}catch(e){if(r&&(r.trail.length=0),!(e instanceof ua))throw e;return{valid:!1,errors:[{message:e.message,path:`/`}],...a.warnings.length?{warnings:a.warnings}:{}}}return s?{valid:!0,errors:[],...a.warnings.length?{warnings:a.warnings}:{}}:{valid:!1,errors:a.best?[(({depth:e,startKey:t,...n})=>n)(a.best)]:[{message:`value does not match rule '${i}'`,path:`/`,...t.start===void 0?{}:{start:t.start,end:t.end}}],...a.warnings.length?{warnings:a.warnings}:{}}}function pa(e,t,n){let r=new da(e,t?.maxDepth??256,t?.maxSteps??1e6,new Set(t?.features??[]));try{return n(r)}catch(e){if(e instanceof ua)return;throw e}}function ma(e,t,n,r){return pa(e,r,e=>q(t,n,void 0,[],e,0))}function ha(e,t,n){return pa(e,void 0,e=>{let r=[];return ga(t,n,e,[],r)?r:void 0})}function ga(e,t,n,r,i){for(let a of e.alternatives)if(a.op||!_a(a.target,t,n,r,i))return!1;return!0}function _a(e,t,n,r,i){switch(e.kind){case`map`:return i.push({group:e.group,env:t}),!0;case`paren`:return ga(e.type,t,n,r,i);case`ref`:{let a=t?.get(e.name);if(a&&!e.genericArgs)return!a.type1.op&&_a(a.type1.target,a.env,n,r,i);if(r.length>64)return!1;if(!e.genericArgs&&r.includes(e.name))return!0;let o=G(n,e.name);if(!o)return!1;r.push(e.name);try{for(let a of o){let o=Na(a,e.genericArgs,t);if(K(a.body)){if(!ga(a.body.value,o,n,r,i))return!1;continue}let s=ja(a.body);if(s.every(e=>e.length===1&&K(e[0]))){for(let[e]of s)if(!ga(e.value,o,n,r,i))return!1}}}finally{r.pop()}return!0}case`major`:return e.major!==5;case`value`:case`array`:case`tagged`:return!0;default:return!1}}function va(e){if(e.kind===`bareword`)return e.key;if(e.kind===`value`)return e.key.type===`text`?e.key.value:void 0;let t=e.key.target;return!e.key.op&&t.kind===`value`&&t.type===`text`?t.value:void 0}function ya(e,t){return pa(e,void 0,e=>{let n=new Set,r=new Set,i=new WeakMap,a=0,o=e=>{let t=i.get(e);return t===void 0&&i.set(e,t=a++),t},s=(t,i)=>{e.checkDepth(i);for(let a of t){let t=`${o(a.entries)}|${xa(o,a.env)}`;if(!r.has(t)){r.add(t);for(let t of a.entries){e.step();let r=lo(t,a.env,e);if(r.kind===`group`)s(r.choices,i+1);else if(r.memberKey){let t=Ea(r.memberKey,r.env,e);if(!t)throw ba;for(let e of t.literals)n.add(e)}}}}};try{s(no(t.group,t.env),0)}catch(e){if(e===ba)return;throw e}return n})}var ba=Error(`member key type not resolvable`);function xa(e,t){if(!t)return``;let n=[];for(let[r,i]of t){let t=i;for(let e=0;e<64;e++){let e=t.type1;if(e.op||e.target.kind!==`ref`||e.target.genericArgs)break;let n=t.env?.get(e.target.name);if(!n)break;t=n}n.push(`${r}=${e(t.type1)}(${xa(e,t.env)})`)}return n.sort().join(`,`)}var Sa={literals:new Set,wildcard:!1},Ca={literals:new Set,wildcard:!0},wa=new Set([`size`,`bits`,`regexp`,`pcre`,`and`,`within`,`lt`,`le`,`gt`,`ge`,`eq`,`ne`,`default`,`feature`]);function Ta(e,t){return{literals:new Set([...e.literals,...t.literals]),wildcard:e.wildcard||t.wildcard}}function Ea(e,t,n){return e.kind===`bareword`?{literals:new Set([e.key]),wildcard:!1}:e.kind===`value`?e.key.type===`text`?{literals:new Set([e.key.value]),wildcard:!1}:Sa:Oa(e.key,t,n,[])}function Da(e,t,n,r){let i=Sa;for(let a of e.alternatives){let e=Oa(a,t,n,r);if(!e)return;i=Ta(i,e)}return i}function Oa(e,t,n,r){n.step();let i=ka(e.target,t,n,r);if(!i||!e.op||i.literals.size===0&&!i.wildcard||e.op.kind===`ctl`&&wa.has(e.op.name)&&!i.wildcard)return i}function ka(e,t,n,r){switch(e.kind){case`value`:return e.type===`text`?{literals:new Set([e.value]),wildcard:!1}:Sa;case`paren`:return Da(e.type,t,n,r);case`ref`:{let i=t?.get(e.name);if(i&&!e.genericArgs)return Oa(i.type1,i.env,n,r);if(n.checkDepth(r.length),!e.genericArgs&&r.includes(e.name))return Sa;let a=G(n,e.name);if(!a)return;r.push(e.name);try{let i=Sa;for(let o of a){let a=Na(o,e.genericArgs,t),s=K(o.body)?[o.body.value]:ja(o.body).every(e=>e.length===1&&K(e[0]))?ja(o.body).map(([e])=>e.value):[];for(let e of s){let t=Da(e,a,n,r);if(!t)return;i=Ta(i,t)}}return i}finally{r.pop()}}case`enum`:{if(e.group.kind!==`group`)return;let i=Sa;for(let a of e.group.choices)for(let e of a){if(e.kind!==`entry`||!e.memberKey)return;let a=Da(e.value,t,n,r);if(!a)return;i=Ta(i,a)}return i}case`unwrap`:{let i=co(e.ref,t,n,0);return i?Da(i.type,i.env,n,r):void 0}case`major`:return e.major===3?Ca:Sa;case`any`:return Ca;default:return Sa}}function Aa(e,t,n,r){return pa(e,r,e=>{let r;return ho(t,n.group,n.env,[],e,0,e=>{r=e.slice()})&&r?r:null})}function G(e,t){let n=e.schema.rules.get(t);if(n)return n;let r=Li().get(t);return r?[r]:void 0}function K(e){return e.kind===`entry`&&!e.occur&&!e.memberKey}function ja(e){return e.kind===`entry-group`&&!e.occur?e.group.choices:[[e]]}function Ma(e){return e.some(e=>!K(e.body))}function Na(e,t,n){let r=e.generics;if(!r||!t)return;let i=new Map;for(let e=0;e<r.length&&e<t.length;e++)i.set(r[e],{type1:t[e],env:n});return i}function Pa(e,t,n,r,i,a,o,s){let c=G(i,t);if(!c)return i.fail(r,e,o,t.startsWith(`$`)?`socket '${t}' has no definitions, so nothing matches it`:`'${t}' is not defined`);i.checkDepth(a);let l=i.ruleName;i.ruleName=t;let u=!i.schema.rules.has(t);u&&++i.preludeDepth===1&&(i.preludeRef=o);let d=()=>{for(let o of c){let c=Na(o,s,n);if(K(o.body)){if(q(e,o.body.value,c,r,i,a+1))return!0;continue}let l=ja(o.body),u=!0;for(let e of l)if(!(e.length===1&&K(e[0]))){u=!1;break}if(!u){i.fail(r,e,o.body,`group rule '${t}' cannot be used as a type`);continue}for(let t of l){let n=t[0];if(q(e,n.value,c,r,i,a+1))return!0}}return!1};try{return c.length>1||!K(c[0].body)?i.strictFirst(d):d()}finally{i.ruleName=l,u&&--i.preludeDepth===0&&(i.preludeRef=void 0)}}function Fa(e){for(;e instanceof Xe;)e=e.inner;return e}function Ia(e,t){for(;;){if(e=Fa(e),!(t.stripped&&e instanceof k&&t.stripped.has(e)))return e;e=e.content}}function q(e,t,n,r,i,a){let o=()=>{let o=i.trail?.length??0;for(let s of t.alternatives){if(La(e,s,n,r,i,a))return!0;i.trail&&(i.trail.length=o)}return!1};return t.alternatives.length>1?i.strictFirst(o):o()}function La(e,t,n,r,i,a){if(!i.trail)return Ra(e,t,n,r,i,a);let o=i.trail.length;return Ra(e,t,n,r,i,a)?!0:(i.trail.length=o,!1)}function Ra(e,t,n,r,i,a){if(i.step(),e=Ia(e,i),!t.op||!t.controller)return za(e,t.target,n,r,i,a);if(t.op.kind===`range`)return Xa(e,t,n,r,i,a);let o=la(t.op.name),s=Co(n,i,a);return o?o(s,e,t.target,t.controller,r,t):(i.warnOnce(`control operator .${t.op.name} is not supported; matching the target only`,t),za(e,t.target,n,r,i,a))}function za(e,t,n,r,i,a){if(e=Ia(e,i),e instanceof L)return!0;switch(t.kind){case`any`:return!0;case`value`:return Va(e,t)?!0:i.fail(r,e,t,`expected the value ${t.raw}`);case`ref`:{let o=n?.get(t.name);return o&&!t.genericArgs?La(e,o.type1,o.env,r,i,a+1):Pa(e,t.name,n,r,i,a+1,t,t.genericArgs)}case`paren`:return q(e,t.type,n,r,i,a);case`map`:return e instanceof P?ho(e,t.group,n,r,i,a+1):i.fail(r,e,t,`expected a map`);case`array`:return e instanceof N?uo(e,t.group,n,r,i,a+1):i.fail(r,e,t,`expected an array`);case`tagged`:if(!(e instanceof k)){if(i.infer&&typeof t.tag==`bigint`){let o=i.trail?.length??0,s=i.inferLayers.get(e)??0;i.inferLayers.set(e,s+1);let c;try{c=q(e,t.item,n,r,i,a+1)}finally{s===0?i.inferLayers.delete(e):i.inferLayers.set(e,s)}if(c)return i.trail?.push({item:e,tag:t.tag,inferred:!0,layer:s}),!0;i.trail&&(i.trail.length=o)}return i.fail(r,e,t,`expected a tagged item`)}if(typeof t.tag==`bigint`){if(e.tag!==t.tag)return i.fail(r,e,t,`expected tag ${t.tag}, got ${e.tag}`)}else if(t.tag!==void 0&&!q(new E(e.tag),t.tag,n,r,i,a+1))return i.fail(r,e,t,`tag number ${e.tag} does not match the head type`);return q(e.content,t.item,n,r,i,a+1)?(typeof t.tag==`bigint`&&i.trail?.push({item:e,tag:t.tag,inferred:!1,layer:0}),!0):!1;case`major`:return eo(e,t,n,r,i,a);case`unwrap`:{let o=co(t.ref,n,i,0);return o?q(e,o.type,o.env,r,i,a+1):(i.warnOnce(`~${t.ref.name} is used outside of an array/map group context`,t),i.fail(r,e,t,`~${t.ref.name} cannot match here`))}case`enum`:{let o=t.group.kind===`ref`?ao(t.group,n,i):no(t.group,n);return o?(i.checkDepth(a),Ba(e,o,r,i,a+1)?!0:i.fail(r,e,t,`no enumeration value matches`)):i.fail(r,e,t,`'&' target does not resolve to a group`)}}}function Ba(e,t,n,r,i){for(let{entries:a,env:o}of t)for(let t of a){if(r.step(),t.kind===`entry-group`){if(Ba(e,no(t.group,o),n,r,i+1))return!0;continue}let a=oo(t,o,r);if(a){if(r.checkDepth(i),Ba(e,a,n,r,i+1))return!0;continue}if(q(e,t.value,o,n,r,i+1))return!0}return!1}function Va(e,t){switch(t.type){case`int`:return Ri(e)===BigInt(t.value);case`float`:return e instanceof O&&(e.value===t.value||Number.isNaN(e.value)&&Number.isNaN(t.value));case`text`:return zi(e)===t.value;case`bytes`:{let n=Bi(e);return n!==void 0&&Vi(n,t.value)}}}function J(e,t,n,r=0){if(r>32)return;if(e.kind===`value`)return e;if(e.kind===`paren`){let i=e.type.alternatives.length===1?e.type.alternatives[0]:void 0;return!i||i.op?void 0:J(i.target,t,n,r+1)}if(e.kind!==`ref`)return;let i=t?.get(e.name);if(i&&!e.genericArgs)return i.type1.op?void 0:J(i.type1.target,i.env,n,r+1);let a=G(n,e.name);if(!a||a.length!==1)return;let o=a[0].body;if(!K(o)||o.value.alternatives.length!==1)return;let s=o.value.alternatives[0];if(s.op)return;let c=Na(a[0],e.genericArgs,t);return J(s.target,c,n,r+1)}function Ha(e,t,n,r,i=0){return Ua(e,t,void 0,n,r,i)}function Ua(e,t,n,r,i,a=0){let o=Y(e,t,n,r,i,a);return o===void 0?void 0:o!==null}function Y(e,t,n,r,i,a=0){if(n!==void 0&&t>n)return null;if(!(a>32))switch(e.kind){case`value`:if(e.type===`int`){let r=BigInt(e.value);return r>=t&&(n===void 0||r<=n)?r:null}return null;case`any`:{let e=t>0n?t:0n;return n===void 0||e<=n?e:null}case`major`:if(e.ai!==void 0)return;if(e.major===0){let e=t>0n?t:0n;return e<=18446744073709551615n&&(n===void 0||e<=n)?e:null}if(e.major===1){let e=t>-18446744073709551616n?t:-18446744073709551616n;return e<=-1n&&(n===void 0||e<=n)?e:null}return null;case`paren`:return Wa(e.type,t,n,r,i,a+1);case`ref`:{let o=r?.get(e.name);if(o&&!e.genericArgs)return Ga(o.type1,t,n,o.env,i,a+1);let s=G(i,e.name);if(!s)return;let c=!1,l=null;for(let o of s){if(!K(o.body)){c=!0;continue}let s=Na(o,e.genericArgs,r),u=Wa(o.body.value,t,n,s,i,a+1);typeof u==`bigint`&&(l===null||u<l)&&(l=u),u===void 0&&(c=!0)}return l??(c?void 0:null)}case`enum`:{let o=e.group.kind===`ref`?ao(e.group,r,i):no(e.group,r);if(!o)return;let s=!1,c=null;for(let{entries:e,env:r}of o)for(let o of e){if(o.kind!==`entry`){s=!0;continue}let e=Wa(o.value,t,n,r,i,a+1);typeof e==`bigint`&&(c===null||e<c)&&(c=e),e===void 0&&(s=!0)}return c??(s?void 0:null)}default:return}}function Wa(e,t,n,r,i,a){let o=!1,s=null;for(let c of e.alternatives){let e=Ga(c,t,n,r,i,a);typeof e==`bigint`&&(s===null||e<s)&&(s=e),e===void 0&&(o=!0)}return s??(o?void 0:null)}function Ga(e,t,n,r,i,a){if(!e.op)return Y(e.target,t,n,r,i,a);if(e.op.kind===`ctl`){if(e.op.name===`bits`)return qa(e.target,e.controller,t,n,r,i,a+1);if(e.op.name===`size`){let o=Y(e.target,t>0n?t:0n,n,r,i,a+1);if(o==null)return o;let s=Ha(e.controller,BigInt(Ya(o)),r,i,a+1);return s===void 0?void 0:s?o:null}if(e.op.name===`feature`){let o=sa(Co(r,i,a),e.controller);return o===void 0?void 0:i.features.has(o)?Y(e.target,t,n,r,i,a+1):(i.warnOnce(`feature "${o}" is not enabled (pass it in options.features to accept it)`,e),null)}if(e.op.name===`and`||e.op.name===`within`)return Ka(e.target,e.controller,t,n,r,i,a+1);if(e.op.name===`plus`){let a=J(e.target,r,i),o=J(e.controller,r,i);if(!a||!o||a.type===`text`||a.type===`bytes`||o.type===`text`||o.type===`bytes`)return;if(a.type===`float`)return null;let s=o.type===`int`?BigInt(a.value)+BigInt(o.value):BigInt(Math.floor(Number(a.value)+o.value));return s>=t&&(n===void 0||s<=n)?s:null}let o=J(e.controller,r,i);if(!o||o.type!==`int`)return;let s=BigInt(o.value);switch(e.op.name){case`eq`:return Y(e.target,s>t?s:t,n===void 0||s<n?s:n,r,i,a+1);case`ne`:case`default`:{let o=Y(e.target,t,n===void 0||s-1n<n?s-1n:n,r,i,a+1);if(typeof o==`bigint`)return o;let c=Y(e.target,s+1n>t?s+1n:t,n,r,i,a+1);return typeof c==`bigint`?c:o===void 0||c===void 0?void 0:null}case`lt`:case`le`:{let o=s-(e.op.name===`lt`?1n:0n);return Y(e.target,t,n===void 0||o<n?o:n,r,i,a+1)}case`gt`:case`ge`:{let o=s+(e.op.name===`gt`?1n:0n);return Y(e.target,o>t?o:t,n,r,i,a+1)}default:return}}let o=J(e.target,r,i),s=J(e.controller,r,i);if(!o||!s||o.type!==`int`||s.type!==`int`)return;let c=BigInt(o.value),l=BigInt(s.value)-(e.op.inclusive?0n:1n),u=c>t?c:t;return u<=(n===void 0||l<n?l:n)?u:null}function Ka(e,t,n,r,i,a,o){let s=n;for(let n=0;n<256;n++){let n=Y(e,s,r,i,a,o+1),c=Y(t,s,r,i,a,o+1);if(n===null||c===null)return null;if(n===void 0||c===void 0)return;if(n===c)return n;s=n>c?n:c}}function qa(e,t,n,r,i,a,o){let s=0n;for(let e=0;e<64;e++){let n=Y(t,BigInt(e),BigInt(e),i,a,o+1);if(n===void 0)return;n!==null&&(s|=1n<<BigInt(e))}let c=n>0n?n:0n,l=r===void 0||r>18446744073709551615n?18446744073709551615n:r;for(let t=0;t<256;t++){let t=Y(e,c,l,i,a,o+1),n=Ja(c,l,s);if(t===void 0)return;if(t===null||n===null)return null;if(t===n)return t;c=t>n?t:n}}function Ja(e,t,n){if(e<0n&&(e=0n),e>t)return null;let r=(i,a,o)=>{if(i<0)return o<=t?o:null;let s=Number(e>>BigInt(i)&1n);for(let e=0;e<=1;e++){if(e===1&&(n&1n<<BigInt(i))==0n||!a&&e<s)continue;let t=r(i-1,a||e>s,e===1?o|1n<<BigInt(i):o);if(t!==null)return t}return null};return r(63,!1,0n)}function Ya(e){let t=0;for(let n=e;n>0n;n>>=8n)t++;return t}function Xa(e,t,n,r,i,a){let o=t.op,s=J(t.target,n,i),c=J(t.controller,n,i);if(!s||!c)return i.warnOnce(`range endpoints do not resolve to literal values`,t),i.fail(r,e,t,`unresolvable range`);if(s.type===`int`&&c.type===`int`){let n=Ri(e);if(n===void 0)return i.fail(r,e,t,`expected an integer in ${Za(t)}`);let a=BigInt(s.value),l=BigInt(c.value);return n>=a&&(o.inclusive?n<=l:n<l)||i.fail(r,e,t,`${n} is outside ${Za(t)}`)}if(s.type===`float`&&c.type===`float`){if(!(e instanceof O))return i.fail(r,e,t,`expected a float in ${Za(t)}`);let n=e.value;return n>=s.value&&(o.inclusive?n<=c.value:n<c.value)||i.fail(r,e,t,`${n} is outside ${Za(t)}`)}return i.warnOnce(`range endpoints mix integer and float types`,t),i.fail(r,e,t,`invalid range`)}function Za(e){let t=e.op;return`${Qa(e.target)}${t.inclusive?`..`:`...`}${Qa(e.controller)}`}function Qa(e){return e.kind===`value`?e.raw:e.kind===`ref`?e.name:`…`}var $a={half:25n,single:26n,double:27n};function eo(e,t,n,r,i,a){let o=e=>t.ai===void 0?!0:typeof t.ai==`bigint`?t.ai===e:q(new E(e),t.ai,n,r,i,a+1),s=n=>i.fail(r,e,t,`expected ${n} (#${t.major})`);switch(t.major){case 0:if(!(e instanceof E))return s(`an unsigned integer`);break;case 1:if(!(e instanceof D))return s(`a negative integer`);break;case 2:if(Bi(e)===void 0)return s(`a byte string`);break;case 3:if(zi(e)===void 0)return s(`a text string`);break;case 4:if(!(e instanceof N))return s(`an array`);break;case 5:if(!(e instanceof P))return s(`a map`);break;case 6:return e instanceof k?o(e.tag)?!0:i.fail(r,e,t,`tag ${e.tag} does not match ${to(t)}`):s(`a tagged item`);case 7:return e instanceof F?o(BigInt(e.value))?!0:i.fail(r,e,t,`simple(${e.value}) does not match ${to(t)}`):e instanceof O?t.ai===void 0||o($a[e.precision??w(e.value)])?!0:i.fail(r,e,t,`float does not match ${to(t)}`):s(`a simple value or float`);default:return i.fail(r,e,t,`#${t.major} is not a valid major type`)}return t.ai!==void 0&&t.major<=5&&i.warnOnce(`the additional-information constraint ${to(t)} is not checked (encoding-level)`,t),!0}function to(e){return e.raw??`#${e.major}`}var no=(e,t)=>e.choices.map(e=>({entries:e,env:t})),ro={min:1,max:1};function io(e){let t=e.occur;return t?t.marker===`?`?{min:0,max:1}:t.marker===`+`?{min:1,max:1/0}:{min:t.min??0,max:t.max??1/0}:ro}function ao(e,t,n){let r=G(n,e.name);if(!r||!Ma(r))return;let i=[];for(let n of r){let r=Na(n,e.genericArgs,t);for(let e of ja(n.body))i.push({entries:e,env:r})}return i}function oo(e,t,n){if(e.kind!==`entry`||e.memberKey||e.value.alternatives.length!==1)return;let r=e.value.alternatives[0];if(r.op)return;let i=r.target;if(i.kind===`ref`)return t?.has(i.name)&&!i.genericArgs?void 0:ao(i,t,n)||(i.name.startsWith(`$$`)&&!G(n,i.name)?[]:void 0);if(i.kind===`unwrap`)return so(i.ref,t,n,0)}function so(e,t,n,r){if(r>32)return;let i=G(n,e.name);if(!i||i.length!==1)return;let a=i[0].body,o=Na(i[0],e.genericArgs,t);if(!K(a))return ja(a).map(e=>({entries:e,env:o}));if(a.value.alternatives.length!==1)return;let s=a.value.alternatives[0];if(!s.op){if(s.target.kind===`map`||s.target.kind===`array`)return no(s.target.group,o);if(s.target.kind===`ref`)return so(s.target,o,n,r+1)}}function co(e,t,n,r){if(r>32)return;let i=G(n,e.name);if(!i||i.length!==1)return;let a=i[0].body;if(!K(a)||a.value.alternatives.length!==1)return;let o=a.value.alternatives[0];if(o.op)return;let s=Na(i[0],e.genericArgs,t);if(o.target.kind===`tagged`)return{type:o.target.item,env:s};if(o.target.kind===`ref`)return co(o.target,s,n,r+1)}function lo(e,t,n){let r=io(e);if(e.kind===`entry-group`)return{kind:`group`,occur:r,choices:no(e.group,t),node:e};let i=oo(e,t,n);return i?{kind:`group`,occur:r,choices:i,node:e}:{kind:`type`,occur:r,...e.memberKey?{memberKey:e.memberKey}:{},type:e.value,env:t,node:e}}function uo(e,t,n,r,i,a){i.checkDepth(a);let o=fo(e.items,0,no(t,n),r,i,a).get(e.items.length);return o?(i.trail?.push(...o),!0):i.fail(r,e,t,`array of ${e.items.length} item(s) does not match the group`)}function fo(e,t,n,r,i,a){let o=new Map,s=i.trail?.length??0;for(let c of n)po(e,t,c.entries.map(e=>lo(e,c.env,i)),0,r,i,a,o,s);return o}function po(e,t,n,r,i,a,o,s,c){if(r===n.length){s.has(t)||s.set(t,a.trail?.slice(c)??[]);return}let l=n[r],u=(t,d)=>{if(a.step(),t>=l.occur.min&&po(e,d,n,r+1,i,a,o,s,c),!(t>=l.occur.max||d>=e.length))for(let[n,r]of mo(e,d,l,i,a,o)){if(n===d)continue;let e=a.trail?.length??0;a.trail?.push(...r),u(t+1,n),a.trail&&(a.trail.length=e)}};u(0,t)}function mo(e,t,n,r,i,a){if(n.kind===`type`){let o=i.trail?.length??0;return q(e[t],n.type,n.env,[...r,t],i,a)?[[t+1,i.trail?.splice(o)??[]]]:[]}return i.checkDepth(a),[...fo(e,t,n.choices,r,i,a+1)].sort((e,t)=>t[0]-e[0])}function ho(e,t,n,r,i,a,o){i.checkDepth(a);let s=Array(e.entries.length).fill(!1),c=no(t,n),l=()=>{for(let n of c)if(s.fill(!1),_o(e,n.entries,0,s,n.env,r,i,a,()=>go(e,s,r,i,t)?(o?.(s),!0):!1))return!0;return!1};return c.length>1?i.strictFirst(l):l()}function go(e,t,n,r,i){for(let a=0;a<t.length;a++){if(t[a])continue;let[o,s]=e.entries[a];if(!(o instanceof L))return r.fail([...n,xo(o,a)],s,i,`entry ${So(o)} is not allowed by the group`),!1}return!0}function _o(e,t,n,r,i,a,o,s,c){let l=o.trail?.length??0;return vo(e,t,n,r,i,a,o,s,c)?!0:(o.trail&&(o.trail.length=l),!1)}function vo(e,t,n,r,i,a,o,s,c){if(n===t.length)return c();let l=lo(t[n],i,o);if(l.kind===`type`){if(!l.memberKey)return o.fail(a,e,l.node,`group entry without a member key cannot match a map entry`);let u=0;for(let t=0;t<e.entries.length&&u<l.occur.max;t++){if(r[t])continue;let[n,i]=e.entries[t];if(!yo(l.memberKey,n,l.env,a,o,s))continue;let c=[...a,xo(n,t)];if(q(i,l.type,l.env,c,o,s+1)){r[t]={memberKey:l.memberKey,type:l.type,env:l.env},u++;continue}if(l.memberKey.cut)return o.fail(c,i,l.node,`value for ${bo(l.memberKey)} does not match`)}return u<l.occur.min?o.fail(a,e,l.node,`missing required entry ${bo(l.memberKey)}`):_o(e,t,n+1,r,i,a,o,s,c)}o.checkDepth(s);let u=()=>{let e=0;for(let t of r)t&&e++;return e},d=f=>{if(o.step(),f>=l.occur.min&&_o(e,t,n+1,r,i,a,o,s,c))return!0;if(f>=l.occur.max)return!1;let p=r.slice(),m=u();for(let h of l.choices){if(_o(e,h.entries,0,r,h.env,a,o,s+1,()=>u()===m?_o(e,t,n+1,r,i,a,o,s,c):d(f+1)))return!0;for(let e=0;e<r.length;e++)r[e]=p[e]}return!1};return d(0)}function yo(e,t,n,r,i,a){if(t=Fa(t),t instanceof L)return!0;switch(e.kind){case`bareword`:return zi(t)===e.key;case`value`:return Va(t,e.key);case`type1`:return La(t,e.key,n,r,i,a+1)}}function bo(e){switch(e.kind){case`bareword`:return`'${e.key}'`;case`value`:return e.key.raw;case`type1`:return Qa(e.key.target)}}function xo(e,t){let n=zi(e);if(n!==void 0)return n;if(e instanceof E||e instanceof D){let t=e.value;if(t>=BigInt(-(2**53-1))&&t<=BigInt(2**53-1))return Number(t)}return t}function So(e){let t=zi(e);return t===void 0?e instanceof E||e instanceof D?e.value.toString():e.constructor.name.replace(/^Cbor/,``).toLowerCase():JSON.stringify(t)}function Co(e,t,n){return{matchType2:(r,i,a)=>za(r,i,e,a,t,n+1),matchEmbedded:(r,i,a)=>{t.embeddedDepth++;try{return za(r,i,e,a,t,n+1)}finally{t.embeddedDepth--}},resolveValue:n=>J(n,e,t),existsIntGE:(n,r)=>Ha(n,r,e,t),matchesLiteral:Va,fail:(e,n,r,i)=>t.fail(e,n,r,i),warnOnce:(e,n)=>t.warnOnce(e,n),features:t.features,uint:e=>new E(e)}}function wo(e,t){let n=t??e.root?.name;if(!n)return;let r=Ko(e,n,new Set);return r.kind===`resolved`?{alternatives:r.alternatives}:void 0}var X={};function To(e,t){let n=t??e.root?.name;if(!n)return X;let r=$o(e,n,new Set);return{map:wo(e,t),array:r.kind===`resolved`?{elementTypes:r.alternatives}:void 0}}function Eo(e,t,n,r=!0){let i=zo(e,t,n,r);return i?Mo(e,i):X}function Do(e,t,n,r){let i=t.elementTypes.filter(e=>e.length===r).map(e=>e[n]);return i.length===0?X:Mo(e,Po(i))}function Oo(e,t,n,r){if(t.kind!==`type1`||t.key.op)return;let i=t.key.target;if(i.kind===`enum`&&i.group.kind===`group`){if(!Wo(i.group))return;let e=new Set(Ho(i.group).filter(([,e])=>e===n).map(([e])=>e));return e.size===1?[...e][0]:void 0}if(i.kind===`ref`&&!i.genericArgs?.length&&!r(i.name))return gi(e).ruleConstantValues.get(i.name)===n?i.name:void 0}function ko(e){return{kind:`type`,start:0,end:0,alternatives:[{kind:`type1`,start:0,end:0,target:{kind:`ref`,name:e,start:0,end:0}}]}}function Ao(e,t){let n=es(e,t,new Set);return n.kind===`resolved`?{elementTypes:n.alternatives}:void 0}function jo(e,t,n,r){return{elementTypes:t.elementTypes.filter(t=>t.length===n.length&&t.every((t,i)=>ma(e,n[i],t,r)!==!1))}}function Mo(e,t){let n=qo(e,t,new Set),r=es(e,t,new Set);return{map:n.kind===`resolved`?{alternatives:n.alternatives}:void 0,array:r.kind===`resolved`?{elementTypes:r.alternatives}:void 0}}function No(e,t,n=new Set){let r=[];for(let i of t.alternatives){let t=i.target;if(i.op||t.kind!==`paren`&&t.kind!==`ref`){r.push(i);continue}if(t.kind===`paren`){let i=No(e,t.type,n);if(!i)return;r.push(...i);continue}if(t.genericArgs?.length)return;if(n.has(t.name))continue;let a=Zo(e,t.name);if(!a)return;let o=new Set(n);o.add(t.name);for(let t of a){if(!Qo(t)||t.body.kind!==`entry`)return;let n=No(e,t.body.value,o);if(!n)return;r.push(...n)}}return r}function Po(e){return{kind:`type`,start:e[0].start,end:e[e.length-1].end,alternatives:e.flatMap(e=>e.alternatives)}}function Fo(e,t,n=!0){let r=gi(e).ruleConstantValues,i=new Map,a=new Set,o=(e,t)=>{let n=i.get(e);n||(n=new Set,i.set(e,n)),n.add(t)},s=[],c=Io(e,t);for(let i=0;i<t.alternatives.length;i++){let l=t.alternatives[i],u=n?Lo(e,l):c[i]?0:l.length,d=new Map;u<l.length&&s.push(d);let f=(e,t)=>{o(e,t);let n=d.get(e);n||d.set(e,n=new Set),n.add(t)};for(let e=0;e<l.length;e++){let t=l[e];if(t.kind!==`entry`||!t.memberKey)continue;let n=t.memberKey,i=va(n);if(i!==void 0&&a.add(i),n.kind!==`type1`||e>=u)continue;let o=n.key.target;if(o.kind===`enum`&&o.group.kind===`group`)for(let[e,t]of Ho(o.group))f(e,t);else if(o.kind===`ref`&&!o.genericArgs?.length){let e=r.get(o.name);e!==void 0&&f(o.name,e)}}}let l=new Map;for(let[e,t]of i){if(t.size!==1||a.has(e))continue;let n=t.values().next().value;s.every(t=>t.get(e)?.has(n))&&l.set(e,n)}return l}function Io(e,t){return t.alternatives.map(t=>Lo(e,t)<t.length)}function Lo(e,t){let n=gi(e).ruleConstantValues;for(let e=0;e<t.length;e++){let r=t[e];if(r.kind!==`entry`||!r.memberKey)continue;let i=r.memberKey;if(i.kind===`bareword`||i.kind===`value`)continue;if(i.key.op)return e;let a=i.key.target;if(a.kind===`enum`&&a.group.kind===`group`){if(Wo(a.group))continue;return e}if(a.kind!==`ref`||a.genericArgs?.length||!n.has(a.name))return e}return t.length}function Ro(e,t,n){return gi(e).byName.get(t)===n}function zo(e,t,n,r=!0){let i=typeof n==`string`?n:void 0,a=typeof n==`bigint`?n:Fo(e,t,r).get(n),o=[],s=Io(e,t);for(let n=0;n<t.alternatives.length;n++){let c=t.alternatives[n],l=r?Lo(e,c):s[n]?0:c.length,u=!1;for(let t=0;t<l;t++){let n=c[t];n.kind===`entry`&&n.memberKey&&Vo(e,n.memberKey,i,a)&&(o.push(n.value),u=!0)}if(!u&&l<c.length)return}return o.length===0?void 0:Po(o)}function Bo(e,t,n){let r=os(e,t,new Set);if(r.kind!==`resolved`)return;let i=r.names.get(n);return typeof i==`string`?i:void 0}function Vo(e,t,n,r){if(t.kind===`bareword`)return n!==void 0&&t.key===n;if(t.kind===`value`)return t.key.type===`text`?n!==void 0&&t.key.value===n:t.key.type===`int`&&r!==void 0&&(typeof t.key.value==`bigint`?t.key.value:BigInt(t.key.value))===r;if(r===void 0||t.key.op)return!1;let i=t.key.target;return i.kind===`enum`&&i.group.kind===`group`?Ho(i.group).some(([e,t])=>n!==void 0&&e===n||t===r):i.kind===`ref`&&!i.genericArgs?.length?n!==void 0&&i.name===n||gi(e).ruleConstantValues.get(i.name)===r:!1}function Ho(e){let t=[];for(let n of e.choices)for(let e of n){let n=Uo(e);n&&t.push(n)}return t}function Uo(e){if(e.kind!==`entry`||!e.memberKey)return;let t=e.memberKey,n=t.kind===`bareword`?t.key:t.kind===`value`&&t.key.type===`text`?t.key.value:void 0;if(n===void 0)return;let r=yi(e.value);return r===void 0?void 0:[n,r]}function Wo(e){let t=0;for(let n of e.choices)t+=n.length;return Ho(e).length===t}var Go={kind:`none`},Z={kind:`open`};function Ko(e,t,n){if(n.has(t))return Go;let r=e.ast.filter(e=>e.name===t&&!e.generics?.length);if(r.length===0)return t===`any`||e.ast.some(e=>e.name===t&&e.generics?.length)?Z:Go;let i=new Set(n);i.add(t);let a=[];for(let t of r)if(t.body.kind===`entry`&&!t.body.occur&&!t.body.memberKey){let n=qo(e,t.body.value,i);if(n.kind===`open`)return Z;n.kind===`resolved`&&a.push(...n.alternatives)}else if(t.body.kind===`entry-group`)for(let n of t.body.group.choices){let t=Yo(e,n,i);if(t.kind===`open`)return Z;a.push(...t.alternatives)}else{let n=Yo(e,[t.body],i);if(n.kind===`open`)return Z;a.push(...n.alternatives)}return a.length>0?{kind:`resolved`,alternatives:a}:Go}function qo(e,t,n){let r=[];for(let i of t.alternatives){if(i.op)return Z;let t=Jo(e,i.target,n);if(t.kind===`open`)return Z;t.kind===`resolved`&&r.push(...t.alternatives)}return r.length>0?{kind:`resolved`,alternatives:r}:Go}function Jo(e,t,n){switch(t.kind){case`map`:{let r=[];for(let i of t.group.choices){let t=Yo(e,i,n);if(t.kind===`open`)return Z;r.push(...t.alternatives)}return{kind:`resolved`,alternatives:r}}case`paren`:return qo(e,t.type,n);case`ref`:return t.genericArgs?.length?Z:Ko(e,t.name,n);case`any`:return Z;case`unwrap`:case`tagged`:return Z;case`major`:return t.major===5?Z:Go;case`enum`:return Z;default:return Go}}function Yo(e,t,n){let r=[[]];for(let i of t){if(i.kind===`entry`&&i.memberKey){r=r.map(e=>[...e,i]);continue}let t;if(i.kind===`entry-group`)t=i.group.choices;else{let r=qo(e,i.value,n);if(r.kind!==`resolved`)return{kind:`open`};t=r.alternatives}let a=[];for(let r of t){let t=Yo(e,r,n);if(t.kind===`open`)return{kind:`open`};a.push(...t.alternatives)}let o=[];for(let e of r)for(let t of a)o.push([...e,...t]);r=o}return{kind:`resolved`,alternatives:r}}var Xo={kind:`none`},Q={kind:`open`};function Zo(e,t){let n=e.ast.filter(e=>e.name===t);if(n.length===0){let e=Li().get(t);n=e?[e]:[]}if(!(n.length===0||n.some(e=>e.generics?.length)))return n}function Qo(e){return e.body.kind===`entry`&&!e.body.occur&&!e.body.memberKey}function $o(e,t,n){if(n.has(t))return Xo;let r=Zo(e,t);if(!r)return Q;let i=new Set(n);i.add(t);let a=[];for(let t of r){if(!Qo(t)||t.body.kind!==`entry`)return Q;let n=es(e,t.body.value,i);if(n.kind===`open`)return Q;n.kind===`resolved`&&a.push(...n.alternatives)}return a.length>0?{kind:`resolved`,alternatives:a}:Xo}function es(e,t,n){let r=[];for(let i of t.alternatives){if(i.op)return Q;let t=ts(e,i.target,n);if(t.kind===`open`)return Q;t.kind===`resolved`&&r.push(...t.alternatives)}return r.length>0?{kind:`resolved`,alternatives:r}:Xo}function ts(e,t,n){switch(t.kind){case`array`:{let r=[];for(let i of t.group.choices){let t=ns(e,i,n);if(!t)return Q;r.push(...t)}return{kind:`resolved`,alternatives:r}}case`paren`:return es(e,t.type,n);case`ref`:return t.genericArgs?.length?Q:$o(e,t.name,n);case`major`:return t.major===4?Q:Xo;case`map`:case`value`:return Xo;default:return Q}}function ns(e,t,n){let r=[[]];for(let i of t){if(i.occur)return;let t;if(i.kind===`entry-group`){t=[];for(let r of i.group.choices){let i=ns(e,r,n);if(!i)return;t.push(...i)}}else if(i.memberKey){if(i.memberKey.kind===`type1`)return;t=[[i.value]]}else{let r=rs(e,i.value);if(r===null)return;if(r===void 0)t=[[i.value]];else{if(n.has(r))return;let i=new Set(n);i.add(r),t=[];for(let n of Zo(e,r)){let r=n.body.kind===`entry-group`?n.body.group.choices:[[n.body]];for(let n of r){let r=ns(e,n,i);if(!r)return;t.push(...r)}}}}let a=[];for(let e of r)for(let n of t)a.push([...e,...n]);r=a}return r}function rs(e,t){if(t.alternatives.length!==1)return;let n=t.alternatives[0];if(n.op||n.target.kind!==`ref`)return;let r=n.target.name;if(n.target.genericArgs?.length||e.ast.some(e=>e.name===r&&e.generics?.length))return null;let i=Zo(e,r);if(!i)return;let a=i.filter(e=>!Qo(e)).length;if(a!==0)return a===i.length?r:null}var is={kind:`none`},$={kind:`open`};function as(e,t,n){for(let[r,i]of n){let n=e.get(r);if(n!==void 0&&n!==i){t.add(r);continue}e.set(r,i)}}function os(e,t,n){let r=new Map,i=new Set;for(let a of t.alternatives){if(a.op)return $;let t=ss(e,a.target,n);if(t.kind===`open`)return $;t.kind===`resolved`&&as(r,i,t.names)}for(let e of i)r.delete(e);return r.size>0?{kind:`resolved`,names:r}:is}function ss(e,t,n){switch(t.kind){case`enum`:{if(t.group.kind!==`group`)return $;let r=new Map,i=new Set;for(let a of t.group.choices)for(let t of a){if(t.kind!==`entry`)return $;let a=Uo(t);if(a){let[e,t]=a;as(r,i,new Map([[t,e]]));continue}let o=os(e,t.value,n);if(o.kind===`open`)return $;o.kind===`resolved`&&as(r,i,o.names)}for(let e of i)r.delete(e);return r.size>0?{kind:`resolved`,names:r}:is}case`paren`:return os(e,t.type,n);case`ref`:{if(t.genericArgs?.length)return $;if(n.has(t.name))return is;let r=e.ast.filter(e=>e.name===t.name);if(r.length===0){let e=Li().get(t.name);r=e?[e]:[]}if(r.length===0||r.some(e=>e.generics?.length))return $;let i=new Set(n);i.add(t.name);let a=new Map,o=new Set;for(let t of r){if(t.body.kind!==`entry`||t.body.occur||t.body.memberKey)return $;let n=os(e,t.body.value,i);if(n.kind===`open`)return $;n.kind===`resolved`&&as(a,o,n.names)}for(let e of o)a.delete(e);return a.size>0?{kind:`resolved`,names:a}:is}case`any`:case`unwrap`:case`tagged`:return $;case`major`:return t.major===0||t.major===1?$:is;case`value`:{let e=ls(t);return e===void 0?is:{kind:`resolved`,names:new Map([[e,cs]])}}default:return is}}var cs=Symbol(`unnamed`);function ls(e){if(e.type===`int`)return typeof e.value==`bigint`?e.value:BigInt(e.value)}function us(e,t){return t?.eRefKeys===!1?e.value.toString():e.jsKey?e.refName:t?.mapAs===`object`?e.value.toString():void 0}var ds=class extends E{refName;jsKey;constructor(e,t,n){super(e,n),this.refName=t,this.jsKey=n?.jsKey??!0}_toCDN(t,n,r){if(t?.appPrefix===!1)return super._toCDN(t,n,r);let i=e.C(t,this.encodingWidth,()=>e.r(this.value));return`e${e.s(this.refName)}${i}`}_jsObjectKey(e){return us(this,e)}},fs=class extends D{refName;jsKey;constructor(e,t,n){super(e,n),this.refName=t,this.jsKey=n?.jsKey??!0}_toCDN(t,n,r){if(t?.appPrefix===!1)return super._toCDN(t,n,r);let i=e.C(t,this.encodingWidth,()=>e.r(this.argument));return`e${e.s(this.refName)}${i}`}_jsObjectKey(e){return us(this,e)}};function ps(e){let t=gi(e);return{appStringPrefixes:[`e`],parseAppString(e,n){let r=t.byName.get(n);if(r===void 0){let e=t.ambiguousNames.has(n)?`e'${n}': ambiguous — the CDDL model binds '${n}' to more than one value`:`e'${n}': not defined as an integer constant or named group entry in the CDDL model (only integer-valued names are resolved; a name bound to a float, text, or byte-string constant is not currently supported)`;throw SyntaxError(e)}return r>=0n?new ds(r,n):new fs(r,n)}}}function ms(e,t,n,r){let i=typeof n==`string`?{rule:n}:n,a=i?.rule??t.root?.name,o=a?[{type:ko(a),env:void 0}]:void 0;hs(e,{schema:t,options:i,decodeOptions:{extensions:r?.extensions,builtinExtensions:r?.builtinExtensions},seen:new WeakSet},o,To(t,i?.rule))}function hs(e,t,n,r){if(t.seen.has(e))return;t.seen.add(e);let{schema:i}=t;if(e instanceof P){let a=n?Ss(t,e,n):void 0,o=r.map,s=o?Fo(i,o,!1):void 0;e.entries.forEach((e,n)=>{let[r,c]=e,l=a?.owners.map(e=>e[n]),u=l&&l.every(e=>e!==!1)?l:void 0,d=r instanceof E||r instanceof D?r.value:void 0,f=u&&d!==void 0?Cs(i,u,d,a.plainNames):void 0,p=Es(r,i,f,s);if(p&&(e[0]=p),u&&u.every(e=>e.env===void 0)){let t=Os(c,i,Po(u.map(e=>e.type)));t&&(e[1]=t)}let m=Ts(e[0]),h=o&&m!==void 0?Eo(i,o,m,!1):X;hs(e[0],t,void 0,X);let g=hs(e[1],t,u?.map(e=>({type:e.type,env:e.env})),h);g&&(e[1]=g)});return}if(e instanceof N){let{items:a}=e,o=a.length,s=n?ws(t,n,a):void 0;a.forEach((e,n)=>{let c=hs(e,t,s?.map(e=>({type:e[n],env:void 0})),r.array?Do(i,r.array,n,o):X);c&&(a[n]=c)});return}if(e instanceof k){hs(e.content,t,n?gs(t,e,n):void 0,X);return}if(e instanceof I){n&&ys(e,t,_s(t,e,n));return}if(n&&Object.getPrototypeOf(e)===A.prototype)return vs(e,t,n)}function gs(e,t,n){let r=[];for(let i of n){if(i.env!==void 0)return;let n=No(e.schema,i.type);if(!n)return;for(let i of n)if(ma(e.schema,t,{kind:`type`,start:i.start,end:i.end,alternatives:[i]},e.options)!==!1){if(i.op||i.target.kind!==`tagged`)return;r.push({type:i.target.item,env:void 0})}}return r.length>0?r:void 0}function _s(e,t,n){let r=[];for(let t of n){if(t.env!==void 0)return;let n=No(e.schema,t.type);if(!n)return;r.push(...n)}let i=[],a=new Set,o=!0;for(let n of r){let r=ma(e.schema,t,{kind:`type`,start:n.start,end:n.end,alternatives:[n]},e.options);if(r===!1)continue;let s=n.op?.kind===`ctl`?n.op.name:void 0;if(r&&(s===`cbor`||s===`cborseq`)&&n.controller){a.add(s===`cborseq`);let e=n.controller;i.push({type:{kind:`type`,start:e.start,end:e.end,alternatives:[{kind:`type1`,start:e.start,end:e.end,target:e}]},env:void 0})}else o=!1}if(i.length!==0&&a.size===1)return{controllers:i,seq:a.has(!0),exclusive:o}}function vs(e,t,n){let r=_s(t,e,n);if(!r)return;let i;try{i=r.seq?bs(e.value,t.decodeOptions):[jr(e.value,t.decodeOptions)]}catch{return}let a=new I(i,{encodingWidth:e.encodingWidth});if(xs(a.toCBOR(),e.toCBOR()))return a.start=e.start,a.end=e.end,a.comments=e.comments,a.blankLineBefore=e.blankLineBefore,ys(a,t,r),a}function ys(e,t,n){if(!n?.exclusive)return;let{items:r}=e;if(!n.seq){if(r.length!==1)return;let e=hs(r[0],t,n.controllers,X);e&&(r[0]=e);return}let i=ws(t,n.controllers,r);i&&r.forEach((e,n)=>{let a=hs(e,t,i.map(e=>({type:e[n],env:void 0})),X);a&&(r[n]=a)})}function bs(e,t){let n=[],r=0;for(;r<e.length;){let i=jr(e,{...t,offset:r,allowTrailing:!0});n.push(i),r=i.end}return n}function xs(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Ss(e,t,n){let r=[];for(let t of n){let n=ha(e.schema,t.type,t.env);if(!n)return;r.push(...n)}let i=[];for(let n of r){let r=Aa(e.schema,t,n,e.options);if(r===void 0)return;r&&i.push(r)}if(i.length===0)return;let a=new Set;for(let t of r){let n=ya(e.schema,t);if(!n)return;for(let e of n)a.add(e)}return{owners:i,plainNames:a}}function Cs(e,t,n,r){let i=new Set(t.map(t=>Oo(e,t.memberKey,n,e=>!!t.env?.has(e)))),[a]=i;return i.size===1&&a!==void 0&&!r.has(a)?a:void 0}function ws(e,t,n){let r=[];for(let n of t){if(n.env!==void 0)return;let t=Ao(e.schema,n.type);if(!t)return;r.push(...t.elementTypes)}return jo(e.schema,{elementTypes:r},n,e.options).elementTypes}function Ts(e){if((e instanceof ds||e instanceof fs)&&e.jsKey)return e.refName;if(e instanceof z||e instanceof E||e instanceof D)return e.value}function Es(e,t,n,r){let i;if(e instanceof ds||e instanceof fs){if(n===e.refName){let t=r?.get(e.refName)===e.value;if(e.jsKey===t)return;i=Ds(e.value,e.refName,e,t)}else i=e instanceof ds?new E(e.value,{encodingWidth:e.encodingWidth,ednSource:e.ednSource}):new D(e.value,{encodingWidth:e.encodingWidth,ednSource:e.ednSource})}else{let a;if(e instanceof E)a=e.value;else if(e instanceof D)a=e.value;else return;if(n===void 0||!Ro(t,n,a))return;i=Ds(a,n,e,r?.get(n)===a)}return i.start=e.start,i.end=e.end,i.comments=e.comments,i.blankLineBefore=e.blankLineBefore,i}function Ds(e,t,n,r){let i={encodingWidth:n.encodingWidth,ednSource:n.ednSource,jsKey:r};return e>=0n?new ds(e,t,i):new fs(e,t,i)}function Os(e,t,n){if(e instanceof ds||e instanceof fs)return;let r;if(e instanceof E)r=e.value;else if(e instanceof D)r=e.value;else return;let i=Bo(t,n,r);if(i===void 0||!Ro(t,i,r))return;let a=Ds(r,i,e);return a.start=e.start,a.end=e.end,a.comments=e.comments,a.blankLineBefore=e.blankLineBefore,a}function ks(e,t){return t.map||t.array?{schema:e,pos:t}:void 0}var As;function js(e){if(e===void 0){if(As)return As;let e=mi(void 0);return As={fromJS:e.filter(e=>e.fromJS!==void 0),parseTag:e.filter(e=>e.parseTag!==void 0)}}let t=mi(e);return{fromJS:t.filter(e=>e.fromJS!==void 0),parseTag:t.filter(e=>e.parseTag!==void 0)}}function Ms(e){let t=e?.extensions,n=js(e?.builtinExtensions);return t?.length?{fromJS:[...t.filter(e=>e.fromJS!==void 0),...n.fromJS],parseTag:[...t.filter(e=>e.parseTag!==void 0),...n.parseTag]}:n}function Ns(e,t,n){if(t?.replacer){let{replacer:r,...i}=t,a=Vs(e,r,i.extensions,i.undefinedOmits,i.builtinExtensions);return a===p?F.UNDEFINED:Ns(a,Object.keys(i).length>0?i:void 0,n)}let r=t?.eRefKeys!==!1&&n?Fs(n,t?.cddlValidationOptions?.rule):void 0;return Rs(e,t,!0,Ms(t),r)}function Ps(e,t,n){for(let r of Ms(n).parseTag){let n=r.parseTag(e,t);if(n!==void 0)return n}return new k(e,t)}function Fs(e,t){return ks(e,To(e,t))}function Is(e,t,n){if(e.pos.map)return ks(e.schema,Eo(e.schema,e.pos.map,t,n))}function Ls(e,t,n){if(e?.pos.array)return ks(e.schema,Do(e.schema,e.pos.array,t,n))}function Rs(e,t,n,r,i){for(let n of r.fromJS){let r=n.fromJS(e,t??{});if(r!==void 0)return r}if(n&&typeof e==`object`&&e&&f.symbol in e){let n=e[f.symbol],a=Rs(e,t,!1,r,i);for(let e of r.parseTag){let t=e.parseTag(n,a);if(t!==void 0)return t}return new k(n,a)}if(e instanceof f.Null)return F.NULL;if(e instanceof f.Undefined)return F.UNDEFINED;if(e instanceof m)return new F(e.value);if(e===null)return F.NULL;if(e===void 0)return F.UNDEFINED;if(e===!0)return F.TRUE;if(e===!1)return F.FALSE;if(typeof e==`bigint`)return e>18446744073709551615n?new lt(e):e<-18446744073709551616n?new ut(e):e>=0n?new E(e):new D(e);if(typeof e==`number`)return(t?.encodeIntegerAs??`int`)===`int`&&Number.isInteger(e)&&!Object.is(e,-0)?e>=0?new E(BigInt(e)):new D(BigInt(e)):new O(e);if(typeof e==`string`)return new z(e);if(e instanceof Number||e instanceof Boolean||e instanceof String||Object.prototype.toString.call(e)===`[object BigInt]`)return Rs(e.valueOf(),t,!1,r,i);if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return new A(new Uint8Array(e));if(ArrayBuffer.isView(e))return e instanceof Uint8Array&&t?.uint8ArrayAs===`array`?new N(Array.from(e,e=>new E(BigInt(e)))):new A(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));if(e instanceof Hs)return new P([...e].map(([e,n])=>{let a=typeof e==`string`,o=a||typeof e==`bigint`?e:typeof e==`number`&&Number.isInteger(e)?BigInt(e):void 0,s=i&&o!==void 0&&typeof n==`object`&&n?Is(i,o,!a):void 0;return[Rs(e,t,!0,r,void 0),Rs(n,t,!0,r,s)]}));if(Array.isArray(e))return new N(e.map((n,a)=>Rs(n,t,!0,r,Ls(i,a,e.length))));if(typeof e==`object`){let n=[],a=i?.pos.map?Fo(i.schema,i.pos.map,!1):void 0;for(let[o,s]of Object.entries(e)){let e=zs(o,a,i?.schema)??new z(o),c=i&&typeof s==`object`&&s?Is(i,o,!1):void 0;n.push([e,Rs(s,t,!0,r,c)])}return new P(n)}throw TypeError(`fromJS: unsupported value type: ${typeof e}`)}function zs(e,t,n){let r=t?.get(e);if(r!==void 0)return n&&Ro(n,e,r)?r>=0n?new ds(r,e):new fs(r,e):r>=0n?new E(r):new D(r)}function Bs(e){return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||e instanceof Number||e instanceof Boolean||e instanceof String||Object.prototype.toString.call(e)===`[object BigInt]`||e instanceof f.Null||e instanceof f.Undefined||e instanceof m}function Vs(e,t,n,r,i){let a=[...n??[],...mi(i)].filter(e=>e.isJSType!==void 0);function o(e){return e===p||r===!0&&e===void 0}if(Array.isArray(t)){let n=t.map(String);function s(e){if(typeof e!=`object`||!e)return e;if(e instanceof Hs)return Hs.from(e,([e,t])=>[e,s(t)]);if(Array.isArray(e))return e.map(s);if(f.symbol in e||Bs(e)||a.some(t=>t.isJSType(e)))return e;let t=Object.getPrototypeOf(e);if(t===Object.prototype||t===null){let t=e.toJSON;if(typeof t==`function`)return s(t.call(e))}let r={};for(let t of n)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=s(e[t]));return r}return s(e)}let c=t;function l(e,t,n){if(typeof e==`object`&&e&&!(e instanceof Hs)){let n=Object.getPrototypeOf(e);if(n===Object.prototype||n===null){let n=e.toJSON;typeof n==`function`&&(e=n.call(e,t))}}if(e=c.call(n,t,e),typeof e==`object`&&e){if(f.symbol in e)return e;if(e instanceof Hs){let t=new Hs;for(let[n,r]of e){let i=l(r,n,e);o(i)||t.push([n,i])}return t}if(Array.isArray(e))return e.map((t,n)=>{let r=l(t,String(n),e);return o(r)?null:r});if(Bs(e)||a.some(t=>t.isJSType(e)))return e;let t={};for(let n of Object.keys(e)){let r=l(e[n],n,e);o(r)||(t[n]=r)}return t}return e}return l(e,``,{"":e})}var Hs=class extends Array{toJSON(){let e={};for(let[t,n]of this){let r=typeof t==`string`?t:Ns(t).toCDN();r===`__proto__`?Object.defineProperty(e,r,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[r]=n}return e}};Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return Pn}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return cr}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return hn}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return ei}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return fs}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return Kr}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return ps}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Li}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return Mi}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return ui}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return fi}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Ps}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return fa}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return gi}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Vs}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return ds}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return Ai}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Ns}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return ms}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Hs}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Fi}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return ti}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return jr}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return qr}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return A}});
|
|
68
|
+
//# sourceMappingURL=mapEntries-DwHPAzCN.cjs.map
|