@learncard/openid4vc-plugin 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +592 -0
  3. package/dist/dcql/adapt.d.ts +80 -0
  4. package/dist/dcql/adapt.d.ts.map +1 -0
  5. package/dist/dcql/build.d.ts +122 -0
  6. package/dist/dcql/build.d.ts.map +1 -0
  7. package/dist/dcql/compose.d.ts +78 -0
  8. package/dist/dcql/compose.d.ts.map +1 -0
  9. package/dist/dcql/index.d.ts +18 -0
  10. package/dist/dcql/index.d.ts.map +1 -0
  11. package/dist/dcql/parse.d.ts +16 -0
  12. package/dist/dcql/parse.d.ts.map +1 -0
  13. package/dist/dcql/respond.d.ts +115 -0
  14. package/dist/dcql/respond.d.ts.map +1 -0
  15. package/dist/dcql/select.d.ts +63 -0
  16. package/dist/dcql/select.d.ts.map +1 -0
  17. package/dist/dcql/types.d.ts +93 -0
  18. package/dist/dcql/types.d.ts.map +1 -0
  19. package/dist/index.d.ts +8 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +7 -0
  22. package/dist/offer/index.d.ts +4 -0
  23. package/dist/offer/index.d.ts.map +1 -0
  24. package/dist/offer/normalize.d.ts +15 -0
  25. package/dist/offer/normalize.d.ts.map +1 -0
  26. package/dist/offer/parse.d.ts +24 -0
  27. package/dist/offer/parse.d.ts.map +1 -0
  28. package/dist/offer/types.d.ts +92 -0
  29. package/dist/offer/types.d.ts.map +1 -0
  30. package/dist/openid4vc-plugin.cjs.development.js +27402 -0
  31. package/dist/openid4vc-plugin.cjs.development.js.map +7 -0
  32. package/dist/openid4vc-plugin.cjs.production.min.js +146 -0
  33. package/dist/openid4vc-plugin.cjs.production.min.js.map +7 -0
  34. package/dist/openid4vc-plugin.esm.js +27396 -0
  35. package/dist/openid4vc-plugin.esm.js.map +7 -0
  36. package/dist/plugin.d.ts +12 -0
  37. package/dist/plugin.d.ts.map +1 -0
  38. package/dist/siop/index.d.ts +11 -0
  39. package/dist/siop/index.d.ts.map +1 -0
  40. package/dist/siop/sign.d.ts +92 -0
  41. package/dist/siop/sign.d.ts.map +1 -0
  42. package/dist/types.d.ts +359 -0
  43. package/dist/types.d.ts.map +1 -0
  44. package/dist/vci/accept.d.ts +24 -0
  45. package/dist/vci/accept.d.ts.map +1 -0
  46. package/dist/vci/auth-code.d.ts +148 -0
  47. package/dist/vci/auth-code.d.ts.map +1 -0
  48. package/dist/vci/decode.d.ts +65 -0
  49. package/dist/vci/decode.d.ts.map +1 -0
  50. package/dist/vci/errors.d.ts +22 -0
  51. package/dist/vci/errors.d.ts.map +1 -0
  52. package/dist/vci/index.d.ts +12 -0
  53. package/dist/vci/index.d.ts.map +1 -0
  54. package/dist/vci/metadata.d.ts +25 -0
  55. package/dist/vci/metadata.d.ts.map +1 -0
  56. package/dist/vci/pkce.d.ts +85 -0
  57. package/dist/vci/pkce.d.ts.map +1 -0
  58. package/dist/vci/proof.d.ts +43 -0
  59. package/dist/vci/proof.d.ts.map +1 -0
  60. package/dist/vci/request.d.ts +48 -0
  61. package/dist/vci/request.d.ts.map +1 -0
  62. package/dist/vci/store.d.ts +89 -0
  63. package/dist/vci/store.d.ts.map +1 -0
  64. package/dist/vci/token.d.ts +16 -0
  65. package/dist/vci/token.d.ts.map +1 -0
  66. package/dist/vci/types.d.ts +156 -0
  67. package/dist/vci/types.d.ts.map +1 -0
  68. package/dist/vp/client-id-prefix.d.ts +115 -0
  69. package/dist/vp/client-id-prefix.d.ts.map +1 -0
  70. package/dist/vp/encrypt.d.ts +221 -0
  71. package/dist/vp/encrypt.d.ts.map +1 -0
  72. package/dist/vp/index.d.ts +27 -0
  73. package/dist/vp/index.d.ts.map +1 -0
  74. package/dist/vp/parse.d.ts +60 -0
  75. package/dist/vp/parse.d.ts.map +1 -0
  76. package/dist/vp/pex.d.ts +83 -0
  77. package/dist/vp/pex.d.ts.map +1 -0
  78. package/dist/vp/present.d.ts +126 -0
  79. package/dist/vp/present.d.ts.map +1 -0
  80. package/dist/vp/request-object.d.ts +99 -0
  81. package/dist/vp/request-object.d.ts.map +1 -0
  82. package/dist/vp/select.d.ts +137 -0
  83. package/dist/vp/select.d.ts.map +1 -0
  84. package/dist/vp/sign.d.ts +125 -0
  85. package/dist/vp/sign.d.ts.map +1 -0
  86. package/dist/vp/submit.d.ts +175 -0
  87. package/dist/vp/submit.d.ts.map +1 -0
  88. package/dist/vp/types.d.ts +255 -0
  89. package/dist/vp/types.d.ts.map +1 -0
  90. package/package.json +52 -0
@@ -0,0 +1,146 @@
1
+ "use strict";var B4=Object.create;var qa=Object.defineProperty;var D4=Object.getOwnPropertyDescriptor;var q4=Object.getOwnPropertyNames;var M4=Object.getPrototypeOf,U4=Object.prototype.hasOwnProperty;var o=(t,e)=>qa(t,"name",{value:e,configurable:!0});var K=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),E1=(t,e)=>{for(var r in e)qa(t,r,{get:e[r],enumerable:!0})},P1=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of q4(e))!U4.call(t,i)&&i!==r&&qa(t,i,{get:()=>e[i],enumerable:!(n=D4(e,i))||n.enumerable});return t};var kr=(t,e,r)=>(r=t!=null?B4(M4(t)):{},P1(e||!t||!t.__esModule?qa(r,"default",{value:t,enumerable:!0}):r,t)),$4=t=>P1(qa({},"__esModule",{value:!0}),t);var Cw=K(()=>{"use strict";var kw;(function(t){(function(e){var r=typeof globalThis=="object"?globalThis:typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:a(),n=i(t);typeof r.Reflect<"u"&&(n=i(r.Reflect,n)),e(n,r),typeof r.Reflect>"u"&&(r.Reflect=t);function i(c,d){return function(p,y){Object.defineProperty(c,p,{configurable:!0,writable:!0,value:y}),d&&d(p,y)}}o(i,"makeExporter");function s(){try{return Function("return this;")()}catch{}}o(s,"functionThis");function u(){try{return(0,eval)("(function() { return this; })()")}catch{}}o(u,"indirectEvalThis");function a(){return s()||u()}o(a,"sloppyModeThis")})(function(e,r){var n=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",s=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",u=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",a=typeof Object.create=="function",c={__proto__:[]}instanceof Array,d=!a&&!c,p={create:a?function(){return Wp(Object.create(null))}:c?function(){return Wp({__proto__:null})}:function(){return Wp({})},has:d?function(m,w){return n.call(m,w)}:function(m,w){return w in m},get:d?function(m,w){return n.call(m,w)?m[w]:void 0}:function(m,w){return m[w]}},y=Object.getPrototypeOf(Function),v=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:I4(),x=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:O4(),A=typeof WeakMap=="function"?WeakMap:R4(),B=i?Symbol.for("@reflect-metadata:registry"):void 0,I=rd(),J=Da(I);function de(m,w,_,E){if($(_)){if(!Ra(m))throw new TypeError;if(!vo(w))throw new TypeError;return _r(m,w)}else{if(!Ra(m))throw new TypeError;if(!le(w))throw new TypeError;if(!le(E)&&!$(E)&&!ft(E))throw new TypeError;return ft(E)&&(E=void 0),_=dt(_),Fr(m,w,_,E)}}o(de,"decorate"),e("decorate",de);function fe(m,w){function _(E,L){if(!le(E))throw new TypeError;if(!$(L)&&!td(L))throw new TypeError;Ar(m,w,E,L)}return o(_,"decorator"),_}o(fe,"metadata"),e("metadata",fe);function ve(m,w,_,E){if(!le(_))throw new TypeError;return $(E)||(E=dt(E)),Ar(m,w,_,E)}o(ve,"defineMetadata"),e("defineMetadata",ve);function Y(m,w,_){if(!le(w))throw new TypeError;return $(_)||(_=dt(_)),ct(m,w,_)}o(Y,"hasMetadata"),e("hasMetadata",Y);function ye(m,w,_){if(!le(w))throw new TypeError;return $(_)||(_=dt(_)),xr(m,w,_)}o(ye,"hasOwnMetadata"),e("hasOwnMetadata",ye);function ae(m,w,_){if(!le(w))throw new TypeError;return $(_)||(_=dt(_)),kn(m,w,_)}o(ae,"getMetadata"),e("getMetadata",ae);function Ne(m,w,_){if(!le(w))throw new TypeError;return $(_)||(_=dt(_)),li(m,w,_)}o(Ne,"getOwnMetadata"),e("getOwnMetadata",Ne);function xt(m,w){if(!le(m))throw new TypeError;return $(w)||(w=dt(w)),Cn(m,w)}o(xt,"getMetadataKeys"),e("getMetadataKeys",xt);function at(m,w){if(!le(m))throw new TypeError;return $(w)||(w=dt(w)),nr(m,w)}o(at,"getOwnMetadataKeys"),e("getOwnMetadataKeys",at);function Bt(m,w,_){if(!le(w))throw new TypeError;if($(_)||(_=dt(_)),!le(w))throw new TypeError;$(_)||(_=dt(_));var E=Dt(w,_,!1);return $(E)?!1:E.OrdinaryDeleteMetadata(m,w,_)}o(Bt,"deleteMetadata"),e("deleteMetadata",Bt);function _r(m,w){for(var _=m.length-1;_>=0;--_){var E=m[_],L=E(w);if(!$(L)&&!ft(L)){if(!vo(L))throw new TypeError;w=L}}return w}o(_r,"DecorateConstructor");function Fr(m,w,_,E){for(var L=m.length-1;L>=0;--L){var Be=m[L],We=Be(w,_,E);if(!$(We)&&!ft(We)){if(!le(We))throw new TypeError;E=We}}return E}o(Fr,"DecorateProperty");function ct(m,w,_){var E=xr(m,w,_);if(E)return!0;var L=xo(w);return ft(L)?!1:ct(m,L,_)}o(ct,"OrdinaryHasMetadata");function xr(m,w,_){var E=Dt(w,_,!1);return $(E)?!1:Kr(E.OrdinaryHasOwnMetadata(m,w,_))}o(xr,"OrdinaryHasOwnMetadata");function kn(m,w,_){var E=xr(m,w,_);if(E)return li(m,w,_);var L=xo(w);if(!ft(L))return kn(m,L,_)}o(kn,"OrdinaryGetMetadata");function li(m,w,_){var E=Dt(w,_,!1);if(!$(E))return E.OrdinaryGetOwnMetadata(m,w,_)}o(li,"OrdinaryGetOwnMetadata");function Ar(m,w,_,E){var L=Dt(_,E,!0);L.OrdinaryDefineOwnMetadata(m,w,_,E)}o(Ar,"OrdinaryDefineOwnMetadata");function Cn(m,w){var _=nr(m,w),E=xo(m);if(E===null)return _;var L=Cn(E,w);if(L.length<=0)return _;if(_.length<=0)return L;for(var Be=new x,We=[],oe=0,O=_;oe<O.length;oe++){var j=O[oe],D=Be.has(j);D||(Be.add(j),We.push(j))}for(var M=0,ue=L;M<ue.length;M++){var j=ue[M],D=Be.has(j);D||(Be.add(j),We.push(j))}return We}o(Cn,"OrdinaryMetadataKeys");function nr(m,w){var _=Dt(m,w,!1);return _?_.OrdinaryOwnMetadataKeys(m,w):[]}o(nr,"OrdinaryOwnMetadataKeys");function Se(m){if(m===null)return 1;switch(typeof m){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return m===null?1:6;default:return 6}}o(Se,"Type");function $(m){return m===void 0}o($,"IsUndefined");function ft(m){return m===null}o(ft,"IsNull");function ir(m){return typeof m=="symbol"}o(ir,"IsSymbol");function le(m){return typeof m=="object"?m!==null:typeof m=="function"}o(le,"IsObject");function or(m,w){switch(Se(m)){case 0:return m;case 1:return m;case 2:return m;case 3:return m;case 4:return m;case 5:return m}var _=w===3?"string":w===5?"number":"default",E=wo(m,s);if(E!==void 0){var L=E.call(m,_);if(le(L))throw new TypeError;return L}return Sr(m,_==="default"?"number":_)}o(or,"ToPrimitive");function Sr(m,w){if(w==="string"){var _=m.toString;if(En(_)){var E=_.call(m);if(!le(E))return E}var L=m.valueOf;if(En(L)){var E=L.call(m);if(!le(E))return E}}else{var L=m.valueOf;if(En(L)){var E=L.call(m);if(!le(E))return E}var Be=m.toString;if(En(Be)){var E=Be.call(m);if(!le(E))return E}}throw new TypeError}o(Sr,"OrdinaryToPrimitive");function Kr(m){return!!m}o(Kr,"ToBoolean");function sr(m){return""+m}o(sr,"ToString");function dt(m){var w=or(m,3);return ir(w)?w:sr(w)}o(dt,"ToPropertyKey");function Ra(m){return Array.isArray?Array.isArray(m):m instanceof Object?m instanceof Array:Object.prototype.toString.call(m)==="[object Array]"}o(Ra,"IsArray");function En(m){return typeof m=="function"}o(En,"IsCallable");function vo(m){return typeof m=="function"}o(vo,"IsConstructor");function td(m){switch(Se(m)){case 3:return!0;case 4:return!0;default:return!1}}o(td,"IsPropertyKey");function bo(m,w){return m===w||m!==m&&w!==w}o(bo,"SameValueZero");function wo(m,w){var _=m[w];if(_!=null){if(!En(_))throw new TypeError;return _}}o(wo,"GetMethod");function ja(m){var w=wo(m,u);if(!En(w))throw new TypeError;var _=w.call(m);if(!le(_))throw new TypeError;return _}o(ja,"GetIterator");function Pn(m){return m.value}o(Pn,"IteratorValue");function _o(m){var w=m.next();return w.done?!1:w}o(_o,"IteratorStep");function Na(m){var w=m.return;w&&w.call(m)}o(Na,"IteratorClose");function xo(m){var w=Object.getPrototypeOf(m);if(typeof m!="function"||m===y||w!==y)return w;var _=m.prototype,E=_&&Object.getPrototypeOf(_);if(E==null||E===Object.prototype)return w;var L=E.constructor;return typeof L!="function"||L===m?w:L}o(xo,"OrdinaryGetPrototypeOf");function Ba(){var m;!$(B)&&typeof r.Reflect<"u"&&!(B in r.Reflect)&&typeof r.Reflect.defineMetadata=="function"&&(m=Lp(r.Reflect));var w,_,E,L=new A,Be={registerProvider:We,getProvider:O,setProvider:D};return Be;function We(M){if(!Object.isExtensible(Be))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case m===M:break;case $(w):w=M;break;case w===M:break;case $(_):_=M;break;case _===M:break;default:E===void 0&&(E=new x),E.add(M);break}}function oe(M,ue){if(!$(w)){if(w.isProviderFor(M,ue))return w;if(!$(_)){if(_.isProviderFor(M,ue))return w;if(!$(E))for(var we=ja(E);;){var De=_o(we);if(!De)return;var ur=Pn(De);if(ur.isProviderFor(M,ue))return Na(we),ur}}}if(!$(m)&&m.isProviderFor(M,ue))return m}function O(M,ue){var we=L.get(M),De;return $(we)||(De=we.get(ue)),$(De)&&(De=oe(M,ue),$(De)||($(we)&&(we=new v,L.set(M,we)),we.set(ue,De))),De}function j(M){if($(M))throw new TypeError;return w===M||_===M||!$(E)&&E.has(M)}function D(M,ue,we){if(!j(we))throw new Error("Metadata provider not registered.");var De=O(M,ue);if(De!==we){if(!$(De))return!1;var ur=L.get(M);$(ur)&&(ur=new v,L.set(M,ur)),ur.set(ue,we)}return!0}}o(Ba,"CreateMetadataRegistry");function rd(){var m;return!$(B)&&le(r.Reflect)&&Object.isExtensible(r.Reflect)&&(m=r.Reflect[B]),$(m)&&(m=Ba()),!$(B)&&le(r.Reflect)&&Object.isExtensible(r.Reflect)&&Object.defineProperty(r.Reflect,B,{enumerable:!1,configurable:!1,writable:!1,value:m}),m}o(rd,"GetOrCreateMetadataRegistry");function Da(m){var w=new A,_={isProviderFor:o(function(j,D){var M=w.get(j);return $(M)?!1:M.has(D)},"isProviderFor"),OrdinaryDefineOwnMetadata:We,OrdinaryHasOwnMetadata:L,OrdinaryGetOwnMetadata:Be,OrdinaryOwnMetadataKeys:oe,OrdinaryDeleteMetadata:O};return I.registerProvider(_),_;function E(j,D,M){var ue=w.get(j),we=!1;if($(ue)){if(!M)return;ue=new v,w.set(j,ue),we=!0}var De=ue.get(D);if($(De)){if(!M)return;if(De=new v,ue.set(D,De),!m.setProvider(j,D,_))throw ue.delete(D),we&&w.delete(j),new Error("Wrong provider for target.")}return De}o(E,"GetOrCreateMetadataMap");function L(j,D,M){var ue=E(D,M,!1);return $(ue)?!1:Kr(ue.has(j))}o(L,"OrdinaryHasOwnMetadata");function Be(j,D,M){var ue=E(D,M,!1);if(!$(ue))return ue.get(j)}o(Be,"OrdinaryGetOwnMetadata");function We(j,D,M,ue){var we=E(M,ue,!0);we.set(j,D)}o(We,"OrdinaryDefineOwnMetadata");function oe(j,D){var M=[],ue=E(j,D,!1);if($(ue))return M;for(var we=ue.keys(),De=ja(we),ur=0;;){var C1=_o(De);if(!C1)return M.length=ur,M;var j4=Pn(C1);try{M[ur]=j4}catch(N4){try{Na(De)}finally{throw N4}}ur++}}o(oe,"OrdinaryOwnMetadataKeys");function O(j,D,M){var ue=E(D,M,!1);if($(ue)||!ue.delete(j))return!1;if(ue.size===0){var we=w.get(D);$(we)||(we.delete(M),we.size===0&&w.delete(we))}return!0}o(O,"OrdinaryDeleteMetadata")}o(Da,"CreateMetadataProvider");function Lp(m){var w=m.defineMetadata,_=m.hasOwnMetadata,E=m.getOwnMetadata,L=m.getOwnMetadataKeys,Be=m.deleteMetadata,We=new A,oe={isProviderFor:o(function(O,j){var D=We.get(O);return!$(D)&&D.has(j)?!0:L(O,j).length?($(D)&&(D=new x,We.set(O,D)),D.add(j),!0):!1},"isProviderFor"),OrdinaryDefineOwnMetadata:w,OrdinaryHasOwnMetadata:_,OrdinaryGetOwnMetadata:E,OrdinaryOwnMetadataKeys:L,OrdinaryDeleteMetadata:Be};return oe}o(Lp,"CreateFallbackProvider");function Dt(m,w,_){var E=I.getProvider(m,w);if(!$(E))return E;if(_){if(I.setProvider(m,w,J))return J;throw new Error("Illegal state.")}}o(Dt,"GetMetadataProvider");function I4(){var m={},w=[],_=(function(){function oe(O,j,D){this._index=0,this._keys=O,this._values=j,this._selector=D}return o(oe,"MapIterator"),oe.prototype["@@iterator"]=function(){return this},oe.prototype[u]=function(){return this},oe.prototype.next=function(){var O=this._index;if(O>=0&&O<this._keys.length){var j=this._selector(this._keys[O],this._values[O]);return O+1>=this._keys.length?(this._index=-1,this._keys=w,this._values=w):this._index++,{value:j,done:!1}}return{value:void 0,done:!0}},oe.prototype.throw=function(O){throw this._index>=0&&(this._index=-1,this._keys=w,this._values=w),O},oe.prototype.return=function(O){return this._index>=0&&(this._index=-1,this._keys=w,this._values=w),{value:O,done:!0}},oe})(),E=(function(){function oe(){this._keys=[],this._values=[],this._cacheKey=m,this._cacheIndex=-2}return o(oe,"Map"),Object.defineProperty(oe.prototype,"size",{get:o(function(){return this._keys.length},"get"),enumerable:!0,configurable:!0}),oe.prototype.has=function(O){return this._find(O,!1)>=0},oe.prototype.get=function(O){var j=this._find(O,!1);return j>=0?this._values[j]:void 0},oe.prototype.set=function(O,j){var D=this._find(O,!0);return this._values[D]=j,this},oe.prototype.delete=function(O){var j=this._find(O,!1);if(j>=0){for(var D=this._keys.length,M=j+1;M<D;M++)this._keys[M-1]=this._keys[M],this._values[M-1]=this._values[M];return this._keys.length--,this._values.length--,bo(O,this._cacheKey)&&(this._cacheKey=m,this._cacheIndex=-2),!0}return!1},oe.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=m,this._cacheIndex=-2},oe.prototype.keys=function(){return new _(this._keys,this._values,L)},oe.prototype.values=function(){return new _(this._keys,this._values,Be)},oe.prototype.entries=function(){return new _(this._keys,this._values,We)},oe.prototype["@@iterator"]=function(){return this.entries()},oe.prototype[u]=function(){return this.entries()},oe.prototype._find=function(O,j){if(!bo(this._cacheKey,O)){this._cacheIndex=-1;for(var D=0;D<this._keys.length;D++)if(bo(this._keys[D],O)){this._cacheIndex=D;break}}return this._cacheIndex<0&&j&&(this._cacheIndex=this._keys.length,this._keys.push(O),this._values.push(void 0)),this._cacheIndex},oe})();return E;function L(oe,O){return oe}function Be(oe,O){return O}function We(oe,O){return[oe,O]}}o(I4,"CreateMapPolyfill");function O4(){var m=(function(){function w(){this._map=new v}return o(w,"Set"),Object.defineProperty(w.prototype,"size",{get:o(function(){return this._map.size},"get"),enumerable:!0,configurable:!0}),w.prototype.has=function(_){return this._map.has(_)},w.prototype.add=function(_){return this._map.set(_,_),this},w.prototype.delete=function(_){return this._map.delete(_)},w.prototype.clear=function(){this._map.clear()},w.prototype.keys=function(){return this._map.keys()},w.prototype.values=function(){return this._map.keys()},w.prototype.entries=function(){return this._map.entries()},w.prototype["@@iterator"]=function(){return this.keys()},w.prototype[u]=function(){return this.keys()},w})();return m}o(O4,"CreateSetPolyfill");function R4(){var m=16,w=p.create(),_=E();return(function(){function O(){this._key=E()}return o(O,"WeakMap"),O.prototype.has=function(j){var D=L(j,!1);return D!==void 0?p.has(D,this._key):!1},O.prototype.get=function(j){var D=L(j,!1);return D!==void 0?p.get(D,this._key):void 0},O.prototype.set=function(j,D){var M=L(j,!0);return M[this._key]=D,this},O.prototype.delete=function(j){var D=L(j,!1);return D!==void 0?delete D[this._key]:!1},O.prototype.clear=function(){this._key=E()},O})();function E(){var O;do O="@@WeakMap@@"+oe();while(p.has(w,O));return w[O]=!0,O}function L(O,j){if(!n.call(O,_)){if(!j)return;Object.defineProperty(O,_,{value:p.create()})}return O[_]}function Be(O,j){for(var D=0;D<j;++D)O[D]=Math.random()*255|0;return O}function We(O){if(typeof Uint8Array=="function"){var j=new Uint8Array(O);return typeof crypto<"u"?crypto.getRandomValues(j):typeof msCrypto<"u"?msCrypto.getRandomValues(j):Be(j,O),j}return Be(new Array(O),O)}function oe(){var O=We(m);O[6]=O[6]&79|64,O[8]=O[8]&191|128;for(var j="",D=0;D<m;++D){var M=O[D];(D===4||D===6||D===8)&&(j+="-"),M<16&&(j+="0"),j+=M.toString(16).toLowerCase()}return j}}o(R4,"CreateWeakMapPolyfill");function Wp(m){return m.__=void 0,delete m.__,m}o(Wp,"MakeDictionary")})})(kw||(kw={}))});var Qr=K(Ro=>{"use strict";var u5="[object ArrayBuffer]",Ya=class Ya{static isArrayBuffer(e){return Object.prototype.toString.call(e)===u5}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,r){if(e.constructor===r)return e;if(this.isArrayBuffer(e))return new r(e);if(this.isArrayBufferView(e))return new r(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,r){let n=Ya.toUint8Array(e),i=Ya.toUint8Array(r);if(n.length!==i.byteLength)return!1;for(let s=0;s<n.length;s++)if(n[s]!==i[s])return!1;return!0}static concat(...e){let r;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?r=e[0]:e[e.length-1]instanceof Function?r=e.slice(0,e.length-1):r=e;let n=0;for(let u of r)n+=u.byteLength;let i=new Uint8Array(n),s=0;for(let u of r){let a=this.toUint8Array(u);i.set(a,s),s+=a.length}return e[e.length-1]instanceof Function?this.toView(i,e[e.length-1]):i.buffer}};o(Ya,"BufferSourceConverter");var Zr=Ya,Wh="string",a5=/^[0-9a-f\s]+$/i,c5=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,f5=/^[a-zA-Z0-9-_]+$/,Fh=class Fh{static fromString(e){let r=unescape(encodeURIComponent(e)),n=new Uint8Array(r.length);for(let i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return n.buffer}static toString(e){let r=Zr.toUint8Array(e),n="";for(let s=0;s<r.length;s++)n+=String.fromCharCode(r[s]);return decodeURIComponent(escape(n))}};o(Fh,"Utf8Converter");var Sd=Fh,Kh=class Kh{static toString(e,r=!1){let n=Zr.toArrayBuffer(e),i=new DataView(n),s="";for(let u=0;u<n.byteLength;u+=2){let a=i.getUint16(u,r);s+=String.fromCharCode(a)}return s}static fromString(e,r=!1){let n=new ArrayBuffer(e.length*2),i=new DataView(n);for(let s=0;s<e.length;s++)i.setUint16(s*2,e.charCodeAt(s),r);return n}};o(Kh,"Utf16Converter");var Jt=Kh,Rn=class Rn{static isHex(e){return typeof e===Wh&&a5.test(e)}static isBase64(e){return typeof e===Wh&&c5.test(e)}static isBase64Url(e){return typeof e===Wh&&f5.test(e)}static ToString(e,r="utf8"){let n=Zr.toUint8Array(e);switch(r.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return Jt.toString(n,!0);case"utf16":case"utf16be":return Jt.toString(n);default:throw new Error(`Unknown type of encoding '${r}'`)}}static FromString(e,r="utf8"){if(!e)return new ArrayBuffer(0);switch(r.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return Jt.fromString(e,!0);case"utf16":case"utf16be":return Jt.fromString(e);default:throw new Error(`Unknown type of encoding '${r}'`)}}static ToBase64(e){let r=Zr.toUint8Array(e);if(typeof btoa<"u"){let n=this.ToString(r,"binary");return btoa(n)}else return Buffer.from(r).toString("base64")}static FromBase64(e){let r=this.formatString(e);if(!r)return new ArrayBuffer(0);if(!Rn.isBase64(r))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(r)):new Uint8Array(Buffer.from(r,"base64")).buffer}static FromBase64Url(e){let r=this.formatString(e);if(!r)return new ArrayBuffer(0);if(!Rn.isBase64Url(r))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(r.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,r=Rn.DEFAULT_UTF8_ENCODING){switch(r){case"ascii":return this.FromBinary(e);case"utf8":return Sd.fromString(e);case"utf16":case"utf16be":return Jt.fromString(e);case"utf16le":case"usc2":return Jt.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${r}'`)}}static ToUtf8String(e,r=Rn.DEFAULT_UTF8_ENCODING){switch(r){case"ascii":return this.ToBinary(e);case"utf8":return Sd.toString(e);case"utf16":case"utf16be":return Jt.toString(e);case"utf16le":case"usc2":return Jt.toString(e,!0);default:throw new Error(`Unknown type of encoding '${r}'`)}}static FromBinary(e){let r=e.length,n=new Uint8Array(r);for(let i=0;i<r;i++)n[i]=e.charCodeAt(i);return n.buffer}static ToBinary(e){let r=Zr.toUint8Array(e),n="";for(let i=0;i<r.length;i++)n+=String.fromCharCode(r[i]);return n}static ToHex(e){let r=Zr.toUint8Array(e),n="",i=r.length;for(let s=0;s<i;s++){let u=r[s];u<16&&(n+="0"),n+=u.toString(16)}return n}static FromHex(e){let r=this.formatString(e);if(!r)return new ArrayBuffer(0);if(!Rn.isHex(r))throw new TypeError("Argument 'hexString' is not HEX encoded");r.length%2&&(r=`0${r}`);let n=new Uint8Array(r.length/2);for(let i=0;i<r.length;i=i+2){let s=r.slice(i,i+2);n[i/2]=parseInt(s,16)}return n.buffer}static ToUtf16String(e,r=!1){return Jt.toString(e,r)}static FromUtf16String(e,r=!1){return Jt.fromString(e,r)}static Base64Padding(e){let r=4-e.length%4;if(r<4)for(let n=0;n<r;n++)e+="=";return e}static formatString(e){return e?.replace(/[\n\r\t ]/g,"")||""}};o(Rn,"Convert");var kd=Rn;kd.DEFAULT_UTF8_ENCODING="utf8";function d5(t,...e){let r=arguments[0];for(let n=1;n<arguments.length;n++){let i=arguments[n];for(let s in i)r[s]=i[s]}return r}o(d5,"assign");function l5(...t){let e=t.map(i=>i.byteLength).reduce((i,s)=>i+s),r=new Uint8Array(e),n=0;return t.map(i=>new Uint8Array(i)).forEach(i=>{for(let s of i)r[n++]=s}),r.buffer}o(l5,"combine");function p5(t,e){if(!(t&&e)||t.byteLength!==e.byteLength)return!1;let r=new Uint8Array(t),n=new Uint8Array(e);for(let i=0;i<t.byteLength;i++)if(r[i]!==n[i])return!1;return!0}o(p5,"isEqual");Ro.BufferSourceConverter=Zr;Ro.Convert=kd;Ro.assign=d5;Ro.combine=l5;Ro.isEqual=p5});var Nb=K((JZ,Ob)=>{"use strict";var Rb=class Rb{constructor(e){this.heuristic_replimit=e}};o(Rb,"AnalyzerOptions");var Tb=Rb,jb=class jb{constructor(e){this.options=e}isVulnerable(e){return!1}genAttackString(e){return null}};o(jb,"Analyzer");var Ib=jb;Ob.exports=function(t,e){let r=null,n=null;try{t instanceof RegExp?r=t:typeof t=="string"?r=new RegExp(t):r=new RegExp(String(t)),n=regexpTree.parse(r)}catch{return!1}let i=0,s=0,u=0;return regexpTree.traverse(n,{Repetition:{pre({node:a}){u++,i++,s<i&&(s=i)},post({node:a}){i--}}}),s<=1&&u<=e};Ob.exports={AnalyzerOptions:Tb,Analyzer:Ib}});var Gx=K((GZ,zx)=>{"use strict";zx.exports={_hasUFlag:!1,shouldRun:o(function(e){var r=e.flags.includes("s");return r?(e.flags=e.flags.replace("s",""),this._hasUFlag=e.flags.includes("u"),!0):!1},"shouldRun"),Char:o(function(e){var r=e.node;if(!(r.kind!=="meta"||r.value!==".")){var n="\\uFFFF",i="\uFFFF";this._hasUFlag&&(n="\\u{10FFFF}",i="\u{10FFFF}"),e.replace({type:"CharacterClass",expressions:[{type:"ClassRange",from:{type:"Char",value:"\\0",kind:"decimal",symbol:"\0"},to:{type:"Char",value:n,kind:"unicode",symbol:i}}]})}},"Char")}});var Zx=K((ZZ,Xx)=>{"use strict";Xx.exports={_groupNames:{},init:o(function(){this._groupNames={}},"init"),getExtra:o(function(){return this._groupNames},"getExtra"),Group:o(function(e){var r=e.node;r.name&&(this._groupNames[r.name]=r.number,delete r.name,delete r.nameRaw)},"Group"),Backreference:o(function(e){var r=e.node;r.kind==="name"&&(r.kind="number",r.reference=r.number,delete r.referenceRaw)},"Backreference")}});var Yx=K((YZ,Qx)=>{"use strict";Qx.exports={RegExp:o(function(e){var r=e.node;r.flags.includes("x")&&(r.flags=r.flags.replace("x",""))},"RegExp")}});var tA=K((tQ,eA)=>{"use strict";eA.exports={dotAll:Gx(),namedCapturingGroups:Zx(),xFlag:Yx()}});var Bb=K((rQ,rA)=>{"use strict";function Vt(t){return t?VC[t.type](t):""}o(Vt,"gen");var VC={RegExp:o(function(e){return"/"+Vt(e.body)+"/"+e.flags},"RegExp"),Alternative:o(function(e){return(e.expressions||[]).map(Vt).join("")},"Alternative"),Disjunction:o(function(e){return Vt(e.left)+"|"+Vt(e.right)},"Disjunction"),Group:o(function(e){var r=Vt(e.expression);return e.capturing?e.name?"(?<"+(e.nameRaw||e.name)+">"+r+")":"("+r+")":"(?:"+r+")"},"Group"),Backreference:o(function(e){switch(e.kind){case"number":return"\\"+e.reference;case"name":return"\\k<"+(e.referenceRaw||e.reference)+">";default:throw new TypeError("Unknown Backreference kind: "+e.kind)}},"Backreference"),Assertion:o(function(e){switch(e.kind){case"^":case"$":case"\\b":case"\\B":return e.kind;case"Lookahead":{var r=Vt(e.assertion);return e.negative?"(?!"+r+")":"(?="+r+")"}case"Lookbehind":{var n=Vt(e.assertion);return e.negative?"(?<!"+n+")":"(?<="+n+")"}default:throw new TypeError("Unknown Assertion kind: "+e.kind)}},"Assertion"),CharacterClass:o(function(e){var r=e.expressions.map(Vt).join("");return e.negative?"[^"+r+"]":"["+r+"]"},"CharacterClass"),ClassRange:o(function(e){return Vt(e.from)+"-"+Vt(e.to)},"ClassRange"),Repetition:o(function(e){return""+Vt(e.expression)+Vt(e.quantifier)},"Repetition"),Quantifier:o(function(e){var r=void 0,n=e.greedy?"":"?";switch(e.kind){case"+":case"?":case"*":r=e.kind;break;case"Range":e.from===e.to?r="{"+e.from+"}":e.to?r="{"+e.from+","+e.to+"}":r="{"+e.from+",}";break;default:throw new TypeError("Unknown Quantifier kind: "+e.kind)}return""+r+n},"Quantifier"),Char:o(function(e){var r=e.value;switch(e.kind){case"simple":return e.escaped?"\\"+r:r;case"hex":case"unicode":case"oct":case"decimal":case"control":case"meta":return r;default:throw new TypeError("Unknown Char kind: "+e.kind)}},"Char"),UnicodeProperty:o(function(e){var r=e.negative?"P":"p",n=void 0;return!e.shorthand&&!e.binary?n=e.name+"=":n="","\\"+r+"{"+n+e.value+"}"},"UnicodeProperty")};rA.exports={generate:Vt}});var sA=K((iQ,oA)=>{"use strict";var Db={General_Category:"gc",Script:"sc",Script_Extensions:"scx"},Ff=mp(Db),yp={ASCII:"ASCII",ASCII_Hex_Digit:"AHex",Alphabetic:"Alpha",Any:"Any",Assigned:"Assigned",Bidi_Control:"Bidi_C",Bidi_Mirrored:"Bidi_M",Case_Ignorable:"CI",Cased:"Cased",Changes_When_Casefolded:"CWCF",Changes_When_Casemapped:"CWCM",Changes_When_Lowercased:"CWL",Changes_When_NFKC_Casefolded:"CWKCF",Changes_When_Titlecased:"CWT",Changes_When_Uppercased:"CWU",Dash:"Dash",Default_Ignorable_Code_Point:"DI",Deprecated:"Dep",Diacritic:"Dia",Emoji:"Emoji",Emoji_Component:"Emoji_Component",Emoji_Modifier:"Emoji_Modifier",Emoji_Modifier_Base:"Emoji_Modifier_Base",Emoji_Presentation:"Emoji_Presentation",Extended_Pictographic:"Extended_Pictographic",Extender:"Ext",Grapheme_Base:"Gr_Base",Grapheme_Extend:"Gr_Ext",Hex_Digit:"Hex",IDS_Binary_Operator:"IDSB",IDS_Trinary_Operator:"IDST",ID_Continue:"IDC",ID_Start:"IDS",Ideographic:"Ideo",Join_Control:"Join_C",Logical_Order_Exception:"LOE",Lowercase:"Lower",Math:"Math",Noncharacter_Code_Point:"NChar",Pattern_Syntax:"Pat_Syn",Pattern_White_Space:"Pat_WS",Quotation_Mark:"QMark",Radical:"Radical",Regional_Indicator:"RI",Sentence_Terminal:"STerm",Soft_Dotted:"SD",Terminal_Punctuation:"Term",Unified_Ideograph:"UIdeo",Uppercase:"Upper",Variation_Selector:"VS",White_Space:"space",XID_Continue:"XIDC",XID_Start:"XIDS"},ci=mp(yp),qb={Cased_Letter:"LC",Close_Punctuation:"Pe",Connector_Punctuation:"Pc",Control:["Cc","cntrl"],Currency_Symbol:"Sc",Dash_Punctuation:"Pd",Decimal_Number:["Nd","digit"],Enclosing_Mark:"Me",Final_Punctuation:"Pf",Format:"Cf",Initial_Punctuation:"Pi",Letter:"L",Letter_Number:"Nl",Line_Separator:"Zl",Lowercase_Letter:"Ll",Mark:["M","Combining_Mark"],Math_Symbol:"Sm",Modifier_Letter:"Lm",Modifier_Symbol:"Sk",Nonspacing_Mark:"Mn",Number:"N",Open_Punctuation:"Ps",Other:"C",Other_Letter:"Lo",Other_Number:"No",Other_Punctuation:"Po",Other_Symbol:"So",Paragraph_Separator:"Zp",Private_Use:"Co",Punctuation:["P","punct"],Separator:"Z",Space_Separator:"Zs",Spacing_Mark:"Mc",Surrogate:"Cs",Symbol:"S",Titlecase_Letter:"Lt",Unassigned:"Cn",Uppercase_Letter:"Lu"},pp=mp(qb),Mb={Adlam:"Adlm",Ahom:"Ahom",Anatolian_Hieroglyphs:"Hluw",Arabic:"Arab",Armenian:"Armn",Avestan:"Avst",Balinese:"Bali",Bamum:"Bamu",Bassa_Vah:"Bass",Batak:"Batk",Bengali:"Beng",Bhaiksuki:"Bhks",Bopomofo:"Bopo",Brahmi:"Brah",Braille:"Brai",Buginese:"Bugi",Buhid:"Buhd",Canadian_Aboriginal:"Cans",Carian:"Cari",Caucasian_Albanian:"Aghb",Chakma:"Cakm",Cham:"Cham",Cherokee:"Cher",Common:"Zyyy",Coptic:["Copt","Qaac"],Cuneiform:"Xsux",Cypriot:"Cprt",Cyrillic:"Cyrl",Deseret:"Dsrt",Devanagari:"Deva",Dogra:"Dogr",Duployan:"Dupl",Egyptian_Hieroglyphs:"Egyp",Elbasan:"Elba",Ethiopic:"Ethi",Georgian:"Geor",Glagolitic:"Glag",Gothic:"Goth",Grantha:"Gran",Greek:"Grek",Gujarati:"Gujr",Gunjala_Gondi:"Gong",Gurmukhi:"Guru",Han:"Hani",Hangul:"Hang",Hanifi_Rohingya:"Rohg",Hanunoo:"Hano",Hatran:"Hatr",Hebrew:"Hebr",Hiragana:"Hira",Imperial_Aramaic:"Armi",Inherited:["Zinh","Qaai"],Inscriptional_Pahlavi:"Phli",Inscriptional_Parthian:"Prti",Javanese:"Java",Kaithi:"Kthi",Kannada:"Knda",Katakana:"Kana",Kayah_Li:"Kali",Kharoshthi:"Khar",Khmer:"Khmr",Khojki:"Khoj",Khudawadi:"Sind",Lao:"Laoo",Latin:"Latn",Lepcha:"Lepc",Limbu:"Limb",Linear_A:"Lina",Linear_B:"Linb",Lisu:"Lisu",Lycian:"Lyci",Lydian:"Lydi",Mahajani:"Mahj",Makasar:"Maka",Malayalam:"Mlym",Mandaic:"Mand",Manichaean:"Mani",Marchen:"Marc",Medefaidrin:"Medf",Masaram_Gondi:"Gonm",Meetei_Mayek:"Mtei",Mende_Kikakui:"Mend",Meroitic_Cursive:"Merc",Meroitic_Hieroglyphs:"Mero",Miao:"Plrd",Modi:"Modi",Mongolian:"Mong",Mro:"Mroo",Multani:"Mult",Myanmar:"Mymr",Nabataean:"Nbat",New_Tai_Lue:"Talu",Newa:"Newa",Nko:"Nkoo",Nushu:"Nshu",Ogham:"Ogam",Ol_Chiki:"Olck",Old_Hungarian:"Hung",Old_Italic:"Ital",Old_North_Arabian:"Narb",Old_Permic:"Perm",Old_Persian:"Xpeo",Old_Sogdian:"Sogo",Old_South_Arabian:"Sarb",Old_Turkic:"Orkh",Oriya:"Orya",Osage:"Osge",Osmanya:"Osma",Pahawh_Hmong:"Hmng",Palmyrene:"Palm",Pau_Cin_Hau:"Pauc",Phags_Pa:"Phag",Phoenician:"Phnx",Psalter_Pahlavi:"Phlp",Rejang:"Rjng",Runic:"Runr",Samaritan:"Samr",Saurashtra:"Saur",Sharada:"Shrd",Shavian:"Shaw",Siddham:"Sidd",SignWriting:"Sgnw",Sinhala:"Sinh",Sogdian:"Sogd",Sora_Sompeng:"Sora",Soyombo:"Soyo",Sundanese:"Sund",Syloti_Nagri:"Sylo",Syriac:"Syrc",Tagalog:"Tglg",Tagbanwa:"Tagb",Tai_Le:"Tale",Tai_Tham:"Lana",Tai_Viet:"Tavt",Takri:"Takr",Tamil:"Taml",Tangut:"Tang",Telugu:"Telu",Thaana:"Thaa",Thai:"Thai",Tibetan:"Tibt",Tifinagh:"Tfng",Tirhuta:"Tirh",Ugaritic:"Ugar",Vai:"Vaii",Warang_Citi:"Wara",Yi:"Yiii",Zanabazar_Square:"Zanb"},hp=mp(Mb);function mp(t){var e={};for(var r in t)if(t.hasOwnProperty(r)){var n=t[r];if(Array.isArray(n))for(var i=0;i<n.length;i++)e[n[i]]=r;else e[n]=r}return e}o(mp,"inverseMap");function HC(t){return Db.hasOwnProperty(t)||Ff.hasOwnProperty(t)||yp.hasOwnProperty(t)||ci.hasOwnProperty(t)}o(HC,"isValidName");function LC(t,e){return FC(t)?nA(e):KC(t)?iA(e):!1}o(LC,"isValidValue");function WC(t){return Ff.hasOwnProperty(t)||ci.hasOwnProperty(t)}o(WC,"isAlias");function FC(t){return t==="General_Category"||t=="gc"}o(FC,"isGeneralCategoryName");function KC(t){return t==="Script"||t==="Script_Extensions"||t==="sc"||t==="scx"}o(KC,"isScriptCategoryName");function nA(t){return qb.hasOwnProperty(t)||pp.hasOwnProperty(t)}o(nA,"isGeneralCategoryValue");function iA(t){return Mb.hasOwnProperty(t)||hp.hasOwnProperty(t)}o(iA,"isScriptCategoryValue");function JC(t){return yp.hasOwnProperty(t)||ci.hasOwnProperty(t)}o(JC,"isBinaryPropertyName");function zC(t){return Ff.hasOwnProperty(t)?Ff[t]:ci.hasOwnProperty(t)?ci[t]:null}o(zC,"getCanonicalName");function GC(t){return pp.hasOwnProperty(t)?pp[t]:hp.hasOwnProperty(t)?hp[t]:ci.hasOwnProperty(t)?ci[t]:null}o(GC,"getCanonicalValue");oA.exports={isAlias:WC,isValidName:HC,isValidValue:LC,isGeneralCategoryValue:nA,isScriptCategoryValue:iA,isBinaryPropertyName:JC,getCanonicalName:zC,getCanonicalValue:GC,NON_BINARY_PROP_NAMES_TO_ALIASES:Db,NON_BINARY_ALIASES_TO_PROP_NAMES:Ff,BINARY_PROP_NAMES_TO_ALIASES:yp,BINARY_ALIASES_TO_PROP_NAMES:ci,GENERAL_CATEGORY_VALUE_TO_ALIASES:qb,GENERAL_CATEGORY_VALUE_ALIASES_TO_VALUES:pp,SCRIPT_VALUE_TO_ALIASES:Mb,SCRIPT_VALUE_ALIASES_TO_VALUE:hp}});var bA=K((sQ,vA)=>{"use strict";var XC=(function(){function t(e,r){var n=[],i=!0,s=!1,u=void 0;try{for(var a=e[Symbol.iterator](),c;!(i=(c=a.next()).done)&&(n.push(c.value),!(r&&n.length===r));i=!0);}catch(d){s=!0,u=d}finally{try{!i&&a.return&&a.return()}finally{if(s)throw u}}return n}return o(t,"sliceIterator"),function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})();function lA(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}else return Array.from(t)}o(lA,"_toConsumableArray");var Wr=void 0,pA=void 0,Le={},T=void 0,S=void 0;function q(t,e){return Le.options.captureLocations?!t||!e?t||e:{startOffset:t.startOffset,endOffset:e.endOffset,startLine:t.startLine,endLine:e.endLine,startColumn:t.startColumn,endColumn:e.endColumn}:null}o(q,"yyloc");var hA="$",ZC=[[-1,1,function(t,e){S=q(e,e),T=t}],[0,4,function(t,e,r,n,i,s,u,a){S=q(i,a),T=Pe({type:"RegExp",body:e,flags:r8(n)},gp(i,a||u))}],[1,1,function(t,e){S=q(e,e),T=t}],[1,0,function(){S=null,T=""}],[2,1,function(t,e){S=q(e,e),T=t}],[2,2,function(t,e,r,n){S=q(r,n),T=t+e}],[3,1,function(t,e){S=q(e,e),T=t}],[4,1,function(t,e){S=q(e,e),T=t}],[4,3,function(t,e,r,n,i,s){S=q(n,s);var u=null;i&&(u=gp(n||i,s||i)),T=Pe({type:"Disjunction",left:t,right:r},u)}],[5,1,function(t,e){if(S=q(e,e),t.length===0){T=null;return}t.length===1?T=Pe(t[0],S):T=Pe({type:"Alternative",expressions:t},S)}],[6,0,function(){S=null,T=[]}],[6,2,function(t,e,r,n){S=q(r,n),T=t.concat(e)}],[7,1,function(t,e){S=q(e,e),T=Pe(Object.assign({type:"Assertion"},t),S)}],[7,2,function(t,e,r,n){S=q(r,n),T=t,e&&(T=Pe({type:"Repetition",expression:t,quantifier:e},S))}],[8,1,function(t,e){S=q(e,e),T={kind:"^"}}],[8,1,function(t,e){S=q(e,e),T={kind:"$"}}],[8,1,function(t,e){S=q(e,e),T={kind:"\\b"}}],[8,1,function(t,e){S=q(e,e),T={kind:"\\B"}}],[8,3,function(t,e,r,n,i,s){S=q(n,s),T={kind:"Lookahead",assertion:e}}],[8,3,function(t,e,r,n,i,s){S=q(n,s),T={kind:"Lookahead",negative:!0,assertion:e}}],[8,3,function(t,e,r,n,i,s){S=q(n,s),T={kind:"Lookbehind",assertion:e}}],[8,3,function(t,e,r,n,i,s){S=q(n,s),T={kind:"Lookbehind",negative:!0,assertion:e}}],[9,1,function(t,e){S=q(e,e),T=t}],[9,1,function(t,e){S=q(e,e),T=t}],[9,1,function(t,e){S=q(e,e),T=t}],[10,1,function(t,e){S=q(e,e),T=_t(t,"simple",S)}],[10,1,function(t,e){S=q(e,e),T=_t(t.slice(1),"simple",S),T.escaped=!0}],[10,1,function(t,e){S=q(e,e),T=_t(t,"unicode",S),T.isSurrogatePair=!0}],[10,1,function(t,e){S=q(e,e),T=_t(t,"unicode",S)}],[10,1,function(t,e){S=q(e,e),T=e8(t,S)}],[10,1,function(t,e){S=q(e,e),T=_t(t,"control",S)}],[10,1,function(t,e){S=q(e,e),T=_t(t,"hex",S)}],[10,1,function(t,e){S=q(e,e),T=_t(t,"oct",S)}],[10,1,function(t,e){S=q(e,e),T=n8(t,S)}],[10,1,function(t,e){S=q(e,e),T=_t(t,"meta",S)}],[10,1,function(t,e){S=q(e,e),T=_t(t,"meta",S)}],[10,1,function(t,e){S=q(e,e),T=a8(t,e)}],[11,1,function(t,e){S=q(e,e),T=t}],[11,0],[12,1,function(t,e){S=q(e,e),T=t}],[12,2,function(t,e,r,n){S=q(r,n),t.greedy=!1,T=t}],[13,1,function(t,e){S=q(e,e),T=Pe({type:"Quantifier",kind:t,greedy:!0},S)}],[13,1,function(t,e){S=q(e,e),T=Pe({type:"Quantifier",kind:t,greedy:!0},S)}],[13,1,function(t,e){S=q(e,e),T=Pe({type:"Quantifier",kind:t,greedy:!0},S)}],[13,1,function(t,e){S=q(e,e);var r=$b(t);T=Pe({type:"Quantifier",kind:"Range",from:r[0],to:r[0],greedy:!0},S)}],[13,1,function(t,e){S=q(e,e),T=Pe({type:"Quantifier",kind:"Range",from:$b(t)[0],greedy:!0},S)}],[13,1,function(t,e){S=q(e,e);var r=$b(t);T=Pe({type:"Quantifier",kind:"Range",from:r[0],to:r[1],greedy:!0},S)}],[14,1,function(t,e){S=q(e,e),T=t}],[14,1,function(t,e){S=q(e,e),T=t}],[15,3,function(t,e,r,n,i,s){S=q(n,s);var u=String(t),a=mA(u);if(!Le.options.allowGroupNameDuplicates&&Kf.hasOwnProperty(a))throw new SyntaxError('Duplicate of the named group "'+a+'".');Kf[a]=t.groupNumber,T=Pe({type:"Group",capturing:!0,name:a,nameRaw:u,number:t.groupNumber,expression:e},S)}],[15,3,function(t,e,r,n,i,s){S=q(n,s),T=Pe({type:"Group",capturing:!0,number:t.groupNumber,expression:e},S)}],[16,3,function(t,e,r,n,i,s){S=q(n,s),T=Pe({type:"Group",capturing:!1,expression:e},S)}],[17,3,function(t,e,r,n,i,s){S=q(n,s),T=Pe({type:"CharacterClass",negative:!0,expressions:e},S)}],[17,3,function(t,e,r,n,i,s){S=q(n,s),T=Pe({type:"CharacterClass",expressions:e},S)}],[18,0,function(){S=null,T=[]}],[18,1,function(t,e){S=q(e,e),T=t}],[19,1,function(t,e){S=q(e,e),T=[t]}],[19,2,function(t,e,r,n){S=q(r,n),T=[t].concat(e)}],[19,4,function(t,e,r,n,i,s,u,a){S=q(i,a),cA(t,r),T=[Pe({type:"ClassRange",from:t,to:r},gp(i,u))],n&&(T=T.concat(n))}],[20,1,function(t,e){S=q(e,e),T=t}],[20,2,function(t,e,r,n){S=q(r,n),T=[t].concat(e)}],[20,4,function(t,e,r,n,i,s,u,a){S=q(i,a),cA(t,r),T=[Pe({type:"ClassRange",from:t,to:r},gp(i,u))],n&&(T=T.concat(n))}],[21,1,function(t,e){S=q(e,e),T=_t(t,"simple",S)}],[21,1,function(t,e){S=q(e,e),T=t}],[22,1,function(t,e){S=q(e,e),T=t}],[22,1,function(t,e){S=q(e,e),T=_t(t,"meta",S)}]],uA={SLASH:"23",CHAR:"24",BAR:"25",BOS:"26",EOS:"27",ESC_b:"28",ESC_B:"29",POS_LA_ASSERT:"30",R_PAREN:"31",NEG_LA_ASSERT:"32",POS_LB_ASSERT:"33",NEG_LB_ASSERT:"34",ESC_CHAR:"35",U_CODE_SURROGATE:"36",U_CODE:"37",U_PROP_VALUE_EXP:"38",CTRL_CH:"39",HEX_CODE:"40",OCT_CODE:"41",DEC_CODE:"42",META_CHAR:"43",ANY:"44",NAMED_GROUP_REF:"45",Q_MARK:"46",STAR:"47",PLUS:"48",RANGE_EXACT:"49",RANGE_OPEN:"50",RANGE_CLOSED:"51",NAMED_CAPTURE_GROUP:"52",L_PAREN:"53",NON_CAPTURE_GROUP:"54",NEG_CLASS:"55",R_BRACKET:"56",L_BRACKET:"57",DASH:"58",$:"59"},Ub=[{0:1,23:"s2"},{59:"acc"},{3:3,4:4,5:5,6:6,23:"r10",24:"r10",25:"r10",26:"r10",27:"r10",28:"r10",29:"r10",30:"r10",32:"r10",33:"r10",34:"r10",35:"r10",36:"r10",37:"r10",38:"r10",39:"r10",40:"r10",41:"r10",42:"r10",43:"r10",44:"r10",45:"r10",52:"r10",53:"r10",54:"r10",55:"r10",57:"r10"},{23:"s7"},{23:"r6",25:"s12"},{23:"r7",25:"r7",31:"r7"},{7:14,8:15,9:16,10:25,14:27,15:42,16:43,17:26,23:"r9",24:"s28",25:"r9",26:"s17",27:"s18",28:"s19",29:"s20",30:"s21",31:"r9",32:"s22",33:"s23",34:"s24",35:"s29",36:"s30",37:"s31",38:"s32",39:"s33",40:"s34",41:"s35",42:"s36",43:"s37",44:"s38",45:"s39",52:"s44",53:"s45",54:"s46",55:"s40",57:"s41"},{1:8,2:9,24:"s10",59:"r3"},{59:"r1"},{24:"s11",59:"r2"},{24:"r4",59:"r4"},{24:"r5",59:"r5"},{5:13,6:6,23:"r10",24:"r10",25:"r10",26:"r10",27:"r10",28:"r10",29:"r10",30:"r10",31:"r10",32:"r10",33:"r10",34:"r10",35:"r10",36:"r10",37:"r10",38:"r10",39:"r10",40:"r10",41:"r10",42:"r10",43:"r10",44:"r10",45:"r10",52:"r10",53:"r10",54:"r10",55:"r10",57:"r10"},{23:"r8",25:"r8",31:"r8"},{23:"r11",24:"r11",25:"r11",26:"r11",27:"r11",28:"r11",29:"r11",30:"r11",31:"r11",32:"r11",33:"r11",34:"r11",35:"r11",36:"r11",37:"r11",38:"r11",39:"r11",40:"r11",41:"r11",42:"r11",43:"r11",44:"r11",45:"r11",52:"r11",53:"r11",54:"r11",55:"r11",57:"r11"},{23:"r12",24:"r12",25:"r12",26:"r12",27:"r12",28:"r12",29:"r12",30:"r12",31:"r12",32:"r12",33:"r12",34:"r12",35:"r12",36:"r12",37:"r12",38:"r12",39:"r12",40:"r12",41:"r12",42:"r12",43:"r12",44:"r12",45:"r12",52:"r12",53:"r12",54:"r12",55:"r12",57:"r12"},{11:47,12:48,13:49,23:"r38",24:"r38",25:"r38",26:"r38",27:"r38",28:"r38",29:"r38",30:"r38",31:"r38",32:"r38",33:"r38",34:"r38",35:"r38",36:"r38",37:"r38",38:"r38",39:"r38",40:"r38",41:"r38",42:"r38",43:"r38",44:"r38",45:"r38",46:"s52",47:"s50",48:"s51",49:"s53",50:"s54",51:"s55",52:"r38",53:"r38",54:"r38",55:"r38",57:"r38"},{23:"r14",24:"r14",25:"r14",26:"r14",27:"r14",28:"r14",29:"r14",30:"r14",31:"r14",32:"r14",33:"r14",34:"r14",35:"r14",36:"r14",37:"r14",38:"r14",39:"r14",40:"r14",41:"r14",42:"r14",43:"r14",44:"r14",45:"r14",52:"r14",53:"r14",54:"r14",55:"r14",57:"r14"},{23:"r15",24:"r15",25:"r15",26:"r15",27:"r15",28:"r15",29:"r15",30:"r15",31:"r15",32:"r15",33:"r15",34:"r15",35:"r15",36:"r15",37:"r15",38:"r15",39:"r15",40:"r15",41:"r15",42:"r15",43:"r15",44:"r15",45:"r15",52:"r15",53:"r15",54:"r15",55:"r15",57:"r15"},{23:"r16",24:"r16",25:"r16",26:"r16",27:"r16",28:"r16",29:"r16",30:"r16",31:"r16",32:"r16",33:"r16",34:"r16",35:"r16",36:"r16",37:"r16",38:"r16",39:"r16",40:"r16",41:"r16",42:"r16",43:"r16",44:"r16",45:"r16",52:"r16",53:"r16",54:"r16",55:"r16",57:"r16"},{23:"r17",24:"r17",25:"r17",26:"r17",27:"r17",28:"r17",29:"r17",30:"r17",31:"r17",32:"r17",33:"r17",34:"r17",35:"r17",36:"r17",37:"r17",38:"r17",39:"r17",40:"r17",41:"r17",42:"r17",43:"r17",44:"r17",45:"r17",52:"r17",53:"r17",54:"r17",55:"r17",57:"r17"},{4:57,5:5,6:6,24:"r10",25:"r10",26:"r10",27:"r10",28:"r10",29:"r10",30:"r10",31:"r10",32:"r10",33:"r10",34:"r10",35:"r10",36:"r10",37:"r10",38:"r10",39:"r10",40:"r10",41:"r10",42:"r10",43:"r10",44:"r10",45:"r10",52:"r10",53:"r10",54:"r10",55:"r10",57:"r10"},{4:59,5:5,6:6,24:"r10",25:"r10",26:"r10",27:"r10",28:"r10",29:"r10",30:"r10",31:"r10",32:"r10",33:"r10",34:"r10",35:"r10",36:"r10",37:"r10",38:"r10",39:"r10",40:"r10",41:"r10",42:"r10",43:"r10",44:"r10",45:"r10",52:"r10",53:"r10",54:"r10",55:"r10",57:"r10"},{4:61,5:5,6:6,24:"r10",25:"r10",26:"r10",27:"r10",28:"r10",29:"r10",30:"r10",31:"r10",32:"r10",33:"r10",34:"r10",35:"r10",36:"r10",37:"r10",38:"r10",39:"r10",40:"r10",41:"r10",42:"r10",43:"r10",44:"r10",45:"r10",52:"r10",53:"r10",54:"r10",55:"r10",57:"r10"},{4:63,5:5,6:6,24:"r10",25:"r10",26:"r10",27:"r10",28:"r10",29:"r10",30:"r10",31:"r10",32:"r10",33:"r10",34:"r10",35:"r10",36:"r10",37:"r10",38:"r10",39:"r10",40:"r10",41:"r10",42:"r10",43:"r10",44:"r10",45:"r10",52:"r10",53:"r10",54:"r10",55:"r10",57:"r10"},{23:"r22",24:"r22",25:"r22",26:"r22",27:"r22",28:"r22",29:"r22",30:"r22",31:"r22",32:"r22",33:"r22",34:"r22",35:"r22",36:"r22",37:"r22",38:"r22",39:"r22",40:"r22",41:"r22",42:"r22",43:"r22",44:"r22",45:"r22",46:"r22",47:"r22",48:"r22",49:"r22",50:"r22",51:"r22",52:"r22",53:"r22",54:"r22",55:"r22",57:"r22"},{23:"r23",24:"r23",25:"r23",26:"r23",27:"r23",28:"r23",29:"r23",30:"r23",31:"r23",32:"r23",33:"r23",34:"r23",35:"r23",36:"r23",37:"r23",38:"r23",39:"r23",40:"r23",41:"r23",42:"r23",43:"r23",44:"r23",45:"r23",46:"r23",47:"r23",48:"r23",49:"r23",50:"r23",51:"r23",52:"r23",53:"r23",54:"r23",55:"r23",57:"r23"},{23:"r24",24:"r24",25:"r24",26:"r24",27:"r24",28:"r24",29:"r24",30:"r24",31:"r24",32:"r24",33:"r24",34:"r24",35:"r24",36:"r24",37:"r24",38:"r24",39:"r24",40:"r24",41:"r24",42:"r24",43:"r24",44:"r24",45:"r24",46:"r24",47:"r24",48:"r24",49:"r24",50:"r24",51:"r24",52:"r24",53:"r24",54:"r24",55:"r24",57:"r24"},{23:"r25",24:"r25",25:"r25",26:"r25",27:"r25",28:"r25",29:"r25",30:"r25",31:"r25",32:"r25",33:"r25",34:"r25",35:"r25",36:"r25",37:"r25",38:"r25",39:"r25",40:"r25",41:"r25",42:"r25",43:"r25",44:"r25",45:"r25",46:"r25",47:"r25",48:"r25",49:"r25",50:"r25",51:"r25",52:"r25",53:"r25",54:"r25",55:"r25",56:"r25",57:"r25",58:"r25"},{23:"r26",24:"r26",25:"r26",26:"r26",27:"r26",28:"r26",29:"r26",30:"r26",31:"r26",32:"r26",33:"r26",34:"r26",35:"r26",36:"r26",37:"r26",38:"r26",39:"r26",40:"r26",41:"r26",42:"r26",43:"r26",44:"r26",45:"r26",46:"r26",47:"r26",48:"r26",49:"r26",50:"r26",51:"r26",52:"r26",53:"r26",54:"r26",55:"r26",56:"r26",57:"r26",58:"r26"},{23:"r27",24:"r27",25:"r27",26:"r27",27:"r27",28:"r27",29:"r27",30:"r27",31:"r27",32:"r27",33:"r27",34:"r27",35:"r27",36:"r27",37:"r27",38:"r27",39:"r27",40:"r27",41:"r27",42:"r27",43:"r27",44:"r27",45:"r27",46:"r27",47:"r27",48:"r27",49:"r27",50:"r27",51:"r27",52:"r27",53:"r27",54:"r27",55:"r27",56:"r27",57:"r27",58:"r27"},{23:"r28",24:"r28",25:"r28",26:"r28",27:"r28",28:"r28",29:"r28",30:"r28",31:"r28",32:"r28",33:"r28",34:"r28",35:"r28",36:"r28",37:"r28",38:"r28",39:"r28",40:"r28",41:"r28",42:"r28",43:"r28",44:"r28",45:"r28",46:"r28",47:"r28",48:"r28",49:"r28",50:"r28",51:"r28",52:"r28",53:"r28",54:"r28",55:"r28",56:"r28",57:"r28",58:"r28"},{23:"r29",24:"r29",25:"r29",26:"r29",27:"r29",28:"r29",29:"r29",30:"r29",31:"r29",32:"r29",33:"r29",34:"r29",35:"r29",36:"r29",37:"r29",38:"r29",39:"r29",40:"r29",41:"r29",42:"r29",43:"r29",44:"r29",45:"r29",46:"r29",47:"r29",48:"r29",49:"r29",50:"r29",51:"r29",52:"r29",53:"r29",54:"r29",55:"r29",56:"r29",57:"r29",58:"r29"},{23:"r30",24:"r30",25:"r30",26:"r30",27:"r30",28:"r30",29:"r30",30:"r30",31:"r30",32:"r30",33:"r30",34:"r30",35:"r30",36:"r30",37:"r30",38:"r30",39:"r30",40:"r30",41:"r30",42:"r30",43:"r30",44:"r30",45:"r30",46:"r30",47:"r30",48:"r30",49:"r30",50:"r30",51:"r30",52:"r30",53:"r30",54:"r30",55:"r30",56:"r30",57:"r30",58:"r30"},{23:"r31",24:"r31",25:"r31",26:"r31",27:"r31",28:"r31",29:"r31",30:"r31",31:"r31",32:"r31",33:"r31",34:"r31",35:"r31",36:"r31",37:"r31",38:"r31",39:"r31",40:"r31",41:"r31",42:"r31",43:"r31",44:"r31",45:"r31",46:"r31",47:"r31",48:"r31",49:"r31",50:"r31",51:"r31",52:"r31",53:"r31",54:"r31",55:"r31",56:"r31",57:"r31",58:"r31"},{23:"r32",24:"r32",25:"r32",26:"r32",27:"r32",28:"r32",29:"r32",30:"r32",31:"r32",32:"r32",33:"r32",34:"r32",35:"r32",36:"r32",37:"r32",38:"r32",39:"r32",40:"r32",41:"r32",42:"r32",43:"r32",44:"r32",45:"r32",46:"r32",47:"r32",48:"r32",49:"r32",50:"r32",51:"r32",52:"r32",53:"r32",54:"r32",55:"r32",56:"r32",57:"r32",58:"r32"},{23:"r33",24:"r33",25:"r33",26:"r33",27:"r33",28:"r33",29:"r33",30:"r33",31:"r33",32:"r33",33:"r33",34:"r33",35:"r33",36:"r33",37:"r33",38:"r33",39:"r33",40:"r33",41:"r33",42:"r33",43:"r33",44:"r33",45:"r33",46:"r33",47:"r33",48:"r33",49:"r33",50:"r33",51:"r33",52:"r33",53:"r33",54:"r33",55:"r33",56:"r33",57:"r33",58:"r33"},{23:"r34",24:"r34",25:"r34",26:"r34",27:"r34",28:"r34",29:"r34",30:"r34",31:"r34",32:"r34",33:"r34",34:"r34",35:"r34",36:"r34",37:"r34",38:"r34",39:"r34",40:"r34",41:"r34",42:"r34",43:"r34",44:"r34",45:"r34",46:"r34",47:"r34",48:"r34",49:"r34",50:"r34",51:"r34",52:"r34",53:"r34",54:"r34",55:"r34",56:"r34",57:"r34",58:"r34"},{23:"r35",24:"r35",25:"r35",26:"r35",27:"r35",28:"r35",29:"r35",30:"r35",31:"r35",32:"r35",33:"r35",34:"r35",35:"r35",36:"r35",37:"r35",38:"r35",39:"r35",40:"r35",41:"r35",42:"r35",43:"r35",44:"r35",45:"r35",46:"r35",47:"r35",48:"r35",49:"r35",50:"r35",51:"r35",52:"r35",53:"r35",54:"r35",55:"r35",56:"r35",57:"r35",58:"r35"},{23:"r36",24:"r36",25:"r36",26:"r36",27:"r36",28:"r36",29:"r36",30:"r36",31:"r36",32:"r36",33:"r36",34:"r36",35:"r36",36:"r36",37:"r36",38:"r36",39:"r36",40:"r36",41:"r36",42:"r36",43:"r36",44:"r36",45:"r36",46:"r36",47:"r36",48:"r36",49:"r36",50:"r36",51:"r36",52:"r36",53:"r36",54:"r36",55:"r36",56:"r36",57:"r36",58:"r36"},{10:70,18:65,19:66,21:67,22:69,24:"s28",28:"s71",35:"s29",36:"s30",37:"s31",38:"s32",39:"s33",40:"s34",41:"s35",42:"s36",43:"s37",44:"s38",45:"s39",56:"r54",58:"s68"},{10:70,18:83,19:66,21:67,22:69,24:"s28",28:"s71",35:"s29",36:"s30",37:"s31",38:"s32",39:"s33",40:"s34",41:"s35",42:"s36",43:"s37",44:"s38",45:"s39",56:"r54",58:"s68"},{23:"r47",24:"r47",25:"r47",26:"r47",27:"r47",28:"r47",29:"r47",30:"r47",31:"r47",32:"r47",33:"r47",34:"r47",35:"r47",36:"r47",37:"r47",38:"r47",39:"r47",40:"r47",41:"r47",42:"r47",43:"r47",44:"r47",45:"r47",46:"r47",47:"r47",48:"r47",49:"r47",50:"r47",51:"r47",52:"r47",53:"r47",54:"r47",55:"r47",57:"r47"},{23:"r48",24:"r48",25:"r48",26:"r48",27:"r48",28:"r48",29:"r48",30:"r48",31:"r48",32:"r48",33:"r48",34:"r48",35:"r48",36:"r48",37:"r48",38:"r48",39:"r48",40:"r48",41:"r48",42:"r48",43:"r48",44:"r48",45:"r48",46:"r48",47:"r48",48:"r48",49:"r48",50:"r48",51:"r48",52:"r48",53:"r48",54:"r48",55:"r48",57:"r48"},{4:85,5:5,6:6,24:"r10",25:"r10",26:"r10",27:"r10",28:"r10",29:"r10",30:"r10",31:"r10",32:"r10",33:"r10",34:"r10",35:"r10",36:"r10",37:"r10",38:"r10",39:"r10",40:"r10",41:"r10",42:"r10",43:"r10",44:"r10",45:"r10",52:"r10",53:"r10",54:"r10",55:"r10",57:"r10"},{4:87,5:5,6:6,24:"r10",25:"r10",26:"r10",27:"r10",28:"r10",29:"r10",30:"r10",31:"r10",32:"r10",33:"r10",34:"r10",35:"r10",36:"r10",37:"r10",38:"r10",39:"r10",40:"r10",41:"r10",42:"r10",43:"r10",44:"r10",45:"r10",52:"r10",53:"r10",54:"r10",55:"r10",57:"r10"},{4:89,5:5,6:6,24:"r10",25:"r10",26:"r10",27:"r10",28:"r10",29:"r10",30:"r10",31:"r10",32:"r10",33:"r10",34:"r10",35:"r10",36:"r10",37:"r10",38:"r10",39:"r10",40:"r10",41:"r10",42:"r10",43:"r10",44:"r10",45:"r10",52:"r10",53:"r10",54:"r10",55:"r10",57:"r10"},{23:"r13",24:"r13",25:"r13",26:"r13",27:"r13",28:"r13",29:"r13",30:"r13",31:"r13",32:"r13",33:"r13",34:"r13",35:"r13",36:"r13",37:"r13",38:"r13",39:"r13",40:"r13",41:"r13",42:"r13",43:"r13",44:"r13",45:"r13",52:"r13",53:"r13",54:"r13",55:"r13",57:"r13"},{23:"r37",24:"r37",25:"r37",26:"r37",27:"r37",28:"r37",29:"r37",30:"r37",31:"r37",32:"r37",33:"r37",34:"r37",35:"r37",36:"r37",37:"r37",38:"r37",39:"r37",40:"r37",41:"r37",42:"r37",43:"r37",44:"r37",45:"r37",52:"r37",53:"r37",54:"r37",55:"r37",57:"r37"},{23:"r39",24:"r39",25:"r39",26:"r39",27:"r39",28:"r39",29:"r39",30:"r39",31:"r39",32:"r39",33:"r39",34:"r39",35:"r39",36:"r39",37:"r39",38:"r39",39:"r39",40:"r39",41:"r39",42:"r39",43:"r39",44:"r39",45:"r39",46:"s56",52:"r39",53:"r39",54:"r39",55:"r39",57:"r39"},{23:"r41",24:"r41",25:"r41",26:"r41",27:"r41",28:"r41",29:"r41",30:"r41",31:"r41",32:"r41",33:"r41",34:"r41",35:"r41",36:"r41",37:"r41",38:"r41",39:"r41",40:"r41",41:"r41",42:"r41",43:"r41",44:"r41",45:"r41",46:"r41",52:"r41",53:"r41",54:"r41",55:"r41",57:"r41"},{23:"r42",24:"r42",25:"r42",26:"r42",27:"r42",28:"r42",29:"r42",30:"r42",31:"r42",32:"r42",33:"r42",34:"r42",35:"r42",36:"r42",37:"r42",38:"r42",39:"r42",40:"r42",41:"r42",42:"r42",43:"r42",44:"r42",45:"r42",46:"r42",52:"r42",53:"r42",54:"r42",55:"r42",57:"r42"},{23:"r43",24:"r43",25:"r43",26:"r43",27:"r43",28:"r43",29:"r43",30:"r43",31:"r43",32:"r43",33:"r43",34:"r43",35:"r43",36:"r43",37:"r43",38:"r43",39:"r43",40:"r43",41:"r43",42:"r43",43:"r43",44:"r43",45:"r43",46:"r43",52:"r43",53:"r43",54:"r43",55:"r43",57:"r43"},{23:"r44",24:"r44",25:"r44",26:"r44",27:"r44",28:"r44",29:"r44",30:"r44",31:"r44",32:"r44",33:"r44",34:"r44",35:"r44",36:"r44",37:"r44",38:"r44",39:"r44",40:"r44",41:"r44",42:"r44",43:"r44",44:"r44",45:"r44",46:"r44",52:"r44",53:"r44",54:"r44",55:"r44",57:"r44"},{23:"r45",24:"r45",25:"r45",26:"r45",27:"r45",28:"r45",29:"r45",30:"r45",31:"r45",32:"r45",33:"r45",34:"r45",35:"r45",36:"r45",37:"r45",38:"r45",39:"r45",40:"r45",41:"r45",42:"r45",43:"r45",44:"r45",45:"r45",46:"r45",52:"r45",53:"r45",54:"r45",55:"r45",57:"r45"},{23:"r46",24:"r46",25:"r46",26:"r46",27:"r46",28:"r46",29:"r46",30:"r46",31:"r46",32:"r46",33:"r46",34:"r46",35:"r46",36:"r46",37:"r46",38:"r46",39:"r46",40:"r46",41:"r46",42:"r46",43:"r46",44:"r46",45:"r46",46:"r46",52:"r46",53:"r46",54:"r46",55:"r46",57:"r46"},{23:"r40",24:"r40",25:"r40",26:"r40",27:"r40",28:"r40",29:"r40",30:"r40",31:"r40",32:"r40",33:"r40",34:"r40",35:"r40",36:"r40",37:"r40",38:"r40",39:"r40",40:"r40",41:"r40",42:"r40",43:"r40",44:"r40",45:"r40",52:"r40",53:"r40",54:"r40",55:"r40",57:"r40"},{25:"s12",31:"s58"},{23:"r18",24:"r18",25:"r18",26:"r18",27:"r18",28:"r18",29:"r18",30:"r18",31:"r18",32:"r18",33:"r18",34:"r18",35:"r18",36:"r18",37:"r18",38:"r18",39:"r18",40:"r18",41:"r18",42:"r18",43:"r18",44:"r18",45:"r18",52:"r18",53:"r18",54:"r18",55:"r18",57:"r18"},{25:"s12",31:"s60"},{23:"r19",24:"r19",25:"r19",26:"r19",27:"r19",28:"r19",29:"r19",30:"r19",31:"r19",32:"r19",33:"r19",34:"r19",35:"r19",36:"r19",37:"r19",38:"r19",39:"r19",40:"r19",41:"r19",42:"r19",43:"r19",44:"r19",45:"r19",52:"r19",53:"r19",54:"r19",55:"r19",57:"r19"},{25:"s12",31:"s62"},{23:"r20",24:"r20",25:"r20",26:"r20",27:"r20",28:"r20",29:"r20",30:"r20",31:"r20",32:"r20",33:"r20",34:"r20",35:"r20",36:"r20",37:"r20",38:"r20",39:"r20",40:"r20",41:"r20",42:"r20",43:"r20",44:"r20",45:"r20",52:"r20",53:"r20",54:"r20",55:"r20",57:"r20"},{25:"s12",31:"s64"},{23:"r21",24:"r21",25:"r21",26:"r21",27:"r21",28:"r21",29:"r21",30:"r21",31:"r21",32:"r21",33:"r21",34:"r21",35:"r21",36:"r21",37:"r21",38:"r21",39:"r21",40:"r21",41:"r21",42:"r21",43:"r21",44:"r21",45:"r21",52:"r21",53:"r21",54:"r21",55:"r21",57:"r21"},{56:"s72"},{56:"r55"},{10:70,20:73,21:75,22:76,24:"s28",28:"s71",35:"s29",36:"s30",37:"s31",38:"s32",39:"s33",40:"s34",41:"s35",42:"s36",43:"s37",44:"s38",45:"s39",56:"r56",58:"s74"},{24:"r62",28:"r62",35:"r62",36:"r62",37:"r62",38:"r62",39:"r62",40:"r62",41:"r62",42:"r62",43:"r62",44:"r62",45:"r62",56:"r62",58:"r62"},{24:"r63",28:"r63",35:"r63",36:"r63",37:"r63",38:"r63",39:"r63",40:"r63",41:"r63",42:"r63",43:"r63",44:"r63",45:"r63",56:"r63",58:"r63"},{24:"r64",28:"r64",35:"r64",36:"r64",37:"r64",38:"r64",39:"r64",40:"r64",41:"r64",42:"r64",43:"r64",44:"r64",45:"r64",56:"r64",58:"r64"},{24:"r65",28:"r65",35:"r65",36:"r65",37:"r65",38:"r65",39:"r65",40:"r65",41:"r65",42:"r65",43:"r65",44:"r65",45:"r65",56:"r65",58:"r65"},{23:"r52",24:"r52",25:"r52",26:"r52",27:"r52",28:"r52",29:"r52",30:"r52",31:"r52",32:"r52",33:"r52",34:"r52",35:"r52",36:"r52",37:"r52",38:"r52",39:"r52",40:"r52",41:"r52",42:"r52",43:"r52",44:"r52",45:"r52",46:"r52",47:"r52",48:"r52",49:"r52",50:"r52",51:"r52",52:"r52",53:"r52",54:"r52",55:"r52",57:"r52"},{56:"r57"},{10:70,21:77,22:69,24:"s28",28:"s71",35:"s29",36:"s30",37:"s31",38:"s32",39:"s33",40:"s34",41:"s35",42:"s36",43:"s37",44:"s38",45:"s39",56:"r62",58:"s68"},{56:"r59"},{10:70,20:79,21:75,22:76,24:"s28",28:"s71",35:"s29",36:"s30",37:"s31",38:"s32",39:"s33",40:"s34",41:"s35",42:"s36",43:"s37",44:"s38",45:"s39",56:"r63",58:"s80"},{10:70,18:78,19:66,21:67,22:69,24:"s28",28:"s71",35:"s29",36:"s30",37:"s31",38:"s32",39:"s33",40:"s34",41:"s35",42:"s36",43:"s37",44:"s38",45:"s39",56:"r54",58:"s68"},{56:"r58"},{56:"r60"},{10:70,21:81,22:69,24:"s28",28:"s71",35:"s29",36:"s30",37:"s31",38:"s32",39:"s33",40:"s34",41:"s35",42:"s36",43:"s37",44:"s38",45:"s39",56:"r62",58:"s68"},{10:70,18:82,19:66,21:67,22:69,24:"s28",28:"s71",35:"s29",36:"s30",37:"s31",38:"s32",39:"s33",40:"s34",41:"s35",42:"s36",43:"s37",44:"s38",45:"s39",56:"r54",58:"s68"},{56:"r61"},{56:"s84"},{23:"r53",24:"r53",25:"r53",26:"r53",27:"r53",28:"r53",29:"r53",30:"r53",31:"r53",32:"r53",33:"r53",34:"r53",35:"r53",36:"r53",37:"r53",38:"r53",39:"r53",40:"r53",41:"r53",42:"r53",43:"r53",44:"r53",45:"r53",46:"r53",47:"r53",48:"r53",49:"r53",50:"r53",51:"r53",52:"r53",53:"r53",54:"r53",55:"r53",57:"r53"},{25:"s12",31:"s86"},{23:"r49",24:"r49",25:"r49",26:"r49",27:"r49",28:"r49",29:"r49",30:"r49",31:"r49",32:"r49",33:"r49",34:"r49",35:"r49",36:"r49",37:"r49",38:"r49",39:"r49",40:"r49",41:"r49",42:"r49",43:"r49",44:"r49",45:"r49",46:"r49",47:"r49",48:"r49",49:"r49",50:"r49",51:"r49",52:"r49",53:"r49",54:"r49",55:"r49",57:"r49"},{25:"s12",31:"s88"},{23:"r50",24:"r50",25:"r50",26:"r50",27:"r50",28:"r50",29:"r50",30:"r50",31:"r50",32:"r50",33:"r50",34:"r50",35:"r50",36:"r50",37:"r50",38:"r50",39:"r50",40:"r50",41:"r50",42:"r50",43:"r50",44:"r50",45:"r50",46:"r50",47:"r50",48:"r50",49:"r50",50:"r50",51:"r50",52:"r50",53:"r50",54:"r50",55:"r50",57:"r50"},{25:"s12",31:"s90"},{23:"r51",24:"r51",25:"r51",26:"r51",27:"r51",28:"r51",29:"r51",30:"r51",31:"r51",32:"r51",33:"r51",34:"r51",35:"r51",36:"r51",37:"r51",38:"r51",39:"r51",40:"r51",41:"r51",42:"r51",43:"r51",44:"r51",45:"r51",46:"r51",47:"r51",48:"r51",49:"r51",50:"r51",51:"r51",52:"r51",53:"r51",54:"r51",55:"r51",57:"r51"}],wt=[],Ht=void 0,QC=[[/^#[^\n]+/,function(){}],[/^\s+/,function(){}],[/^-/,function(){return"DASH"}],[/^\//,function(){return"CHAR"}],[/^#/,function(){return"CHAR"}],[/^\|/,function(){return"CHAR"}],[/^\./,function(){return"CHAR"}],[/^\{/,function(){return"CHAR"}],[/^\{\d+\}/,function(){return"RANGE_EXACT"}],[/^\{\d+,\}/,function(){return"RANGE_OPEN"}],[/^\{\d+,\d+\}/,function(){return"RANGE_CLOSED"}],[/^\\k<(([\u0041-\u005a\u0061-\u007a\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376-\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e-\u066f\u0671-\u06d3\u06d5\u06e5-\u06e6\u06ee-\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4-\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08bd\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f-\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc-\u09dd\u09df-\u09e1\u09f0-\u09f1\u09fc\u0a05-\u0a0a\u0a0f-\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32-\u0a33\u0a35-\u0a36\u0a38-\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2-\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0-\u0ae1\u0af9\u0b05-\u0b0c\u0b0f-\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32-\u0b33\u0b35-\u0b39\u0b3d\u0b5c-\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99-\u0b9a\u0b9c\u0b9e-\u0b9f\u0ba3-\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60-\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0-\u0ce1\u0cf1-\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32-\u0e33\u0e40-\u0e46\u0e81-\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2-\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065-\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae-\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5-\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a-\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7c6\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd-\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5-\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab67\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]|\ud800[\udc00-\udc0b\udc0d-\udc26\udc28-\udc3a\udc3c-\udc3d\udc3f-\udc4d\udc50-\udc5d\udc80-\udcfa\udd40-\udd74\ude80-\ude9c\udea0-\uded0\udf00-\udf1f\udf2d-\udf4a\udf50-\udf75\udf80-\udf9d\udfa0-\udfc3\udfc8-\udfcf\udfd1-\udfd5]|\ud801[\udc00-\udc9d\udcb0-\udcd3\udcd8-\udcfb\udd00-\udd27\udd30-\udd63\ude00-\udf36\udf40-\udf55\udf60-\udf67]|\ud802[\udc00-\udc05\udc08\udc0a-\udc35\udc37-\udc38\udc3c\udc3f-\udc55\udc60-\udc76\udc80-\udc9e\udce0-\udcf2\udcf4-\udcf5\udd00-\udd15\udd20-\udd39\udd80-\uddb7\uddbe-\uddbf\ude00\ude10-\ude13\ude15-\ude17\ude19-\ude35\ude60-\ude7c\ude80-\ude9c\udec0-\udec7\udec9-\udee4\udf00-\udf35\udf40-\udf55\udf60-\udf72\udf80-\udf91]|\ud803[\udc00-\udc48\udc80-\udcb2\udcc0-\udcf2\udd00-\udd23\udf00-\udf1c\udf27\udf30-\udf45\udfe0-\udff6]|\ud804[\udc03-\udc37\udc83-\udcaf\udcd0-\udce8\udd03-\udd26\udd44\udd50-\udd72\udd76\udd83-\uddb2\uddc1-\uddc4\uddda\udddc\ude00-\ude11\ude13-\ude2b\ude80-\ude86\ude88\ude8a-\ude8d\ude8f-\ude9d\ude9f-\udea8\udeb0-\udede\udf05-\udf0c\udf0f-\udf10\udf13-\udf28\udf2a-\udf30\udf32-\udf33\udf35-\udf39\udf3d\udf50\udf5d-\udf61]|\ud805[\udc00-\udc34\udc47-\udc4a\udc5f\udc80-\udcaf\udcc4-\udcc5\udcc7\udd80-\uddae\uddd8-\udddb\ude00-\ude2f\ude44\ude80-\udeaa\udeb8\udf00-\udf1a]|\ud806[\udc00-\udc2b\udca0-\udcdf\udcff\udda0-\udda7\uddaa-\uddd0\udde1\udde3\ude00\ude0b-\ude32\ude3a\ude50\ude5c-\ude89\ude9d\udec0-\udef8]|\ud807[\udc00-\udc08\udc0a-\udc2e\udc40\udc72-\udc8f\udd00-\udd06\udd08-\udd09\udd0b-\udd30\udd46\udd60-\udd65\udd67-\udd68\udd6a-\udd89\udd98\udee0-\udef2]|\ud808[\udc00-\udf99]|\ud809[\udc00-\udc6e\udc80-\udd43]|\ud80c[\udc00-\udfff]|\ud80d[\udc00-\udc2e]|\ud811[\udc00-\ude46]|\ud81a[\udc00-\ude38\ude40-\ude5e\uded0-\udeed\udf00-\udf2f\udf40-\udf43\udf63-\udf77\udf7d-\udf8f]|\ud81b[\ude40-\ude7f\udf00-\udf4a\udf50\udf93-\udf9f\udfe0-\udfe1\udfe3]|\ud81c[\udc00-\udfff]|\ud81d[\udc00-\udfff]|\ud81e[\udc00-\udfff]|\ud81f[\udc00-\udfff]|\ud820[\udc00-\udfff]|\ud821[\udc00-\udff7]|\ud822[\udc00-\udef2]|\ud82c[\udc00-\udd1e\udd50-\udd52\udd64-\udd67\udd70-\udefb]|\ud82f[\udc00-\udc6a\udc70-\udc7c\udc80-\udc88\udc90-\udc99]|\ud835[\udc00-\udc54\udc56-\udc9c\udc9e-\udc9f\udca2\udca5-\udca6\udca9-\udcac\udcae-\udcb9\udcbb\udcbd-\udcc3\udcc5-\udd05\udd07-\udd0a\udd0d-\udd14\udd16-\udd1c\udd1e-\udd39\udd3b-\udd3e\udd40-\udd44\udd46\udd4a-\udd50\udd52-\udea5\udea8-\udec0\udec2-\udeda\udedc-\udefa\udefc-\udf14\udf16-\udf34\udf36-\udf4e\udf50-\udf6e\udf70-\udf88\udf8a-\udfa8\udfaa-\udfc2\udfc4-\udfcb]|\ud838[\udd00-\udd2c\udd37-\udd3d\udd4e\udec0-\udeeb]|\ud83a[\udc00-\udcc4\udd00-\udd43\udd4b]|\ud83b[\ude00-\ude03\ude05-\ude1f\ude21-\ude22\ude24\ude27\ude29-\ude32\ude34-\ude37\ude39\ude3b\ude42\ude47\ude49\ude4b\ude4d-\ude4f\ude51-\ude52\ude54\ude57\ude59\ude5b\ude5d\ude5f\ude61-\ude62\ude64\ude67-\ude6a\ude6c-\ude72\ude74-\ude77\ude79-\ude7c\ude7e\ude80-\ude89\ude8b-\ude9b\udea1-\udea3\udea5-\udea9\udeab-\udebb]|\ud840[\udc00-\udfff]|\ud841[\udc00-\udfff]|\ud842[\udc00-\udfff]|\ud843[\udc00-\udfff]|\ud844[\udc00-\udfff]|\ud845[\udc00-\udfff]|\ud846[\udc00-\udfff]|\ud847[\udc00-\udfff]|\ud848[\udc00-\udfff]|\ud849[\udc00-\udfff]|\ud84a[\udc00-\udfff]|\ud84b[\udc00-\udfff]|\ud84c[\udc00-\udfff]|\ud84d[\udc00-\udfff]|\ud84e[\udc00-\udfff]|\ud84f[\udc00-\udfff]|\ud850[\udc00-\udfff]|\ud851[\udc00-\udfff]|\ud852[\udc00-\udfff]|\ud853[\udc00-\udfff]|\ud854[\udc00-\udfff]|\ud855[\udc00-\udfff]|\ud856[\udc00-\udfff]|\ud857[\udc00-\udfff]|\ud858[\udc00-\udfff]|\ud859[\udc00-\udfff]|\ud85a[\udc00-\udfff]|\ud85b[\udc00-\udfff]|\ud85c[\udc00-\udfff]|\ud85d[\udc00-\udfff]|\ud85e[\udc00-\udfff]|\ud85f[\udc00-\udfff]|\ud860[\udc00-\udfff]|\ud861[\udc00-\udfff]|\ud862[\udc00-\udfff]|\ud863[\udc00-\udfff]|\ud864[\udc00-\udfff]|\ud865[\udc00-\udfff]|\ud866[\udc00-\udfff]|\ud867[\udc00-\udfff]|\ud868[\udc00-\udfff]|\ud869[\udc00-\uded6\udf00-\udfff]|\ud86a[\udc00-\udfff]|\ud86b[\udc00-\udfff]|\ud86c[\udc00-\udfff]|\ud86d[\udc00-\udf34\udf40-\udfff]|\ud86e[\udc00-\udc1d\udc20-\udfff]|\ud86f[\udc00-\udfff]|\ud870[\udc00-\udfff]|\ud871[\udc00-\udfff]|\ud872[\udc00-\udfff]|\ud873[\udc00-\udea1\udeb0-\udfff]|\ud874[\udc00-\udfff]|\ud875[\udc00-\udfff]|\ud876[\udc00-\udfff]|\ud877[\udc00-\udfff]|\ud878[\udc00-\udfff]|\ud879[\udc00-\udfff]|\ud87a[\udc00-\udfe0]|\ud87e[\udc00-\ude1d])|[$_]|(\\u[0-9a-fA-F]{4}|\\u\{[0-9a-fA-F]{1,}\}))(([\u0030-\u0039\u0041-\u005a\u005f\u0061-\u007a\u00aa\u00b5\u00b7\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376-\u0377\u037a-\u037d\u037f\u0386-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u05d0-\u05ea\u05ef-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u07fd\u0800-\u082d\u0840-\u085b\u0860-\u086a\u08a0-\u08b4\u08b6-\u08bd\u08d3-\u08e1\u08e3-\u0963\u0966-\u096f\u0971-\u0983\u0985-\u098c\u098f-\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7-\u09c8\u09cb-\u09ce\u09d7\u09dc-\u09dd\u09df-\u09e3\u09e6-\u09f1\u09fc\u09fe\u0a01-\u0a03\u0a05-\u0a0a\u0a0f-\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32-\u0a33\u0a35-\u0a36\u0a38-\u0a39\u0a3c\u0a3e-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2-\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0af9-\u0aff\u0b01-\u0b03\u0b05-\u0b0c\u0b0f-\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32-\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47-\u0b48\u0b4b-\u0b4d\u0b56-\u0b57\u0b5c-\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82-\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99-\u0b9a\u0b9c\u0b9e-\u0b9f\u0ba3-\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c00-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c58-\u0c5a\u0c60-\u0c63\u0c66-\u0c6f\u0c80-\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5-\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1-\u0cf2\u0d00-\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d54-\u0d57\u0d5f-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82-\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2-\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81-\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18-\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1369-\u1371\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772-\u1773\u1780-\u17d3\u17d7\u17dc-\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1878\u1880-\u18aa\u18b0-\u18f5\u1900-\u191e\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19da\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1ab0-\u1abd\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1cd0-\u1cd2\u1cd4-\u1cfa\u1d00-\u1df9\u1dfb-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u203f-\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7c6\ua7f7-\ua827\ua840-\ua873\ua880-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua8fd-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\ua9e0-\ua9fe\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab67\uab70-\uabea\uabec-\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe00-\ufe0f\ufe20-\ufe2f\ufe33-\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]|\ud800[\udc00-\udc0b\udc0d-\udc26\udc28-\udc3a\udc3c-\udc3d\udc3f-\udc4d\udc50-\udc5d\udc80-\udcfa\udd40-\udd74\uddfd\ude80-\ude9c\udea0-\uded0\udee0\udf00-\udf1f\udf2d-\udf4a\udf50-\udf7a\udf80-\udf9d\udfa0-\udfc3\udfc8-\udfcf\udfd1-\udfd5]|\ud801[\udc00-\udc9d\udca0-\udca9\udcb0-\udcd3\udcd8-\udcfb\udd00-\udd27\udd30-\udd63\ude00-\udf36\udf40-\udf55\udf60-\udf67]|\ud802[\udc00-\udc05\udc08\udc0a-\udc35\udc37-\udc38\udc3c\udc3f-\udc55\udc60-\udc76\udc80-\udc9e\udce0-\udcf2\udcf4-\udcf5\udd00-\udd15\udd20-\udd39\udd80-\uddb7\uddbe-\uddbf\ude00-\ude03\ude05-\ude06\ude0c-\ude13\ude15-\ude17\ude19-\ude35\ude38-\ude3a\ude3f\ude60-\ude7c\ude80-\ude9c\udec0-\udec7\udec9-\udee6\udf00-\udf35\udf40-\udf55\udf60-\udf72\udf80-\udf91]|\ud803[\udc00-\udc48\udc80-\udcb2\udcc0-\udcf2\udd00-\udd27\udd30-\udd39\udf00-\udf1c\udf27\udf30-\udf50\udfe0-\udff6]|\ud804[\udc00-\udc46\udc66-\udc6f\udc7f-\udcba\udcd0-\udce8\udcf0-\udcf9\udd00-\udd34\udd36-\udd3f\udd44-\udd46\udd50-\udd73\udd76\udd80-\uddc4\uddc9-\uddcc\uddd0-\uddda\udddc\ude00-\ude11\ude13-\ude37\ude3e\ude80-\ude86\ude88\ude8a-\ude8d\ude8f-\ude9d\ude9f-\udea8\udeb0-\udeea\udef0-\udef9\udf00-\udf03\udf05-\udf0c\udf0f-\udf10\udf13-\udf28\udf2a-\udf30\udf32-\udf33\udf35-\udf39\udf3b-\udf44\udf47-\udf48\udf4b-\udf4d\udf50\udf57\udf5d-\udf63\udf66-\udf6c\udf70-\udf74]|\ud805[\udc00-\udc4a\udc50-\udc59\udc5e-\udc5f\udc80-\udcc5\udcc7\udcd0-\udcd9\udd80-\uddb5\uddb8-\uddc0\uddd8-\udddd\ude00-\ude40\ude44\ude50-\ude59\ude80-\udeb8\udec0-\udec9\udf00-\udf1a\udf1d-\udf2b\udf30-\udf39]|\ud806[\udc00-\udc3a\udca0-\udce9\udcff\udda0-\udda7\uddaa-\uddd7\uddda-\udde1\udde3-\udde4\ude00-\ude3e\ude47\ude50-\ude99\ude9d\udec0-\udef8]|\ud807[\udc00-\udc08\udc0a-\udc36\udc38-\udc40\udc50-\udc59\udc72-\udc8f\udc92-\udca7\udca9-\udcb6\udd00-\udd06\udd08-\udd09\udd0b-\udd36\udd3a\udd3c-\udd3d\udd3f-\udd47\udd50-\udd59\udd60-\udd65\udd67-\udd68\udd6a-\udd8e\udd90-\udd91\udd93-\udd98\udda0-\udda9\udee0-\udef6]|\ud808[\udc00-\udf99]|\ud809[\udc00-\udc6e\udc80-\udd43]|\ud80c[\udc00-\udfff]|\ud80d[\udc00-\udc2e]|\ud811[\udc00-\ude46]|\ud81a[\udc00-\ude38\ude40-\ude5e\ude60-\ude69\uded0-\udeed\udef0-\udef4\udf00-\udf36\udf40-\udf43\udf50-\udf59\udf63-\udf77\udf7d-\udf8f]|\ud81b[\ude40-\ude7f\udf00-\udf4a\udf4f-\udf87\udf8f-\udf9f\udfe0-\udfe1\udfe3]|\ud81c[\udc00-\udfff]|\ud81d[\udc00-\udfff]|\ud81e[\udc00-\udfff]|\ud81f[\udc00-\udfff]|\ud820[\udc00-\udfff]|\ud821[\udc00-\udff7]|\ud822[\udc00-\udef2]|\ud82c[\udc00-\udd1e\udd50-\udd52\udd64-\udd67\udd70-\udefb]|\ud82f[\udc00-\udc6a\udc70-\udc7c\udc80-\udc88\udc90-\udc99\udc9d-\udc9e]|\ud834[\udd65-\udd69\udd6d-\udd72\udd7b-\udd82\udd85-\udd8b\uddaa-\uddad\ude42-\ude44]|\ud835[\udc00-\udc54\udc56-\udc9c\udc9e-\udc9f\udca2\udca5-\udca6\udca9-\udcac\udcae-\udcb9\udcbb\udcbd-\udcc3\udcc5-\udd05\udd07-\udd0a\udd0d-\udd14\udd16-\udd1c\udd1e-\udd39\udd3b-\udd3e\udd40-\udd44\udd46\udd4a-\udd50\udd52-\udea5\udea8-\udec0\udec2-\udeda\udedc-\udefa\udefc-\udf14\udf16-\udf34\udf36-\udf4e\udf50-\udf6e\udf70-\udf88\udf8a-\udfa8\udfaa-\udfc2\udfc4-\udfcb\udfce-\udfff]|\ud836[\ude00-\ude36\ude3b-\ude6c\ude75\ude84\ude9b-\ude9f\udea1-\udeaf]|\ud838[\udc00-\udc06\udc08-\udc18\udc1b-\udc21\udc23-\udc24\udc26-\udc2a\udd00-\udd2c\udd30-\udd3d\udd40-\udd49\udd4e\udec0-\udef9]|\ud83a[\udc00-\udcc4\udcd0-\udcd6\udd00-\udd4b\udd50-\udd59]|\ud83b[\ude00-\ude03\ude05-\ude1f\ude21-\ude22\ude24\ude27\ude29-\ude32\ude34-\ude37\ude39\ude3b\ude42\ude47\ude49\ude4b\ude4d-\ude4f\ude51-\ude52\ude54\ude57\ude59\ude5b\ude5d\ude5f\ude61-\ude62\ude64\ude67-\ude6a\ude6c-\ude72\ude74-\ude77\ude79-\ude7c\ude7e\ude80-\ude89\ude8b-\ude9b\udea1-\udea3\udea5-\udea9\udeab-\udebb]|\ud840[\udc00-\udfff]|\ud841[\udc00-\udfff]|\ud842[\udc00-\udfff]|\ud843[\udc00-\udfff]|\ud844[\udc00-\udfff]|\ud845[\udc00-\udfff]|\ud846[\udc00-\udfff]|\ud847[\udc00-\udfff]|\ud848[\udc00-\udfff]|\ud849[\udc00-\udfff]|\ud84a[\udc00-\udfff]|\ud84b[\udc00-\udfff]|\ud84c[\udc00-\udfff]|\ud84d[\udc00-\udfff]|\ud84e[\udc00-\udfff]|\ud84f[\udc00-\udfff]|\ud850[\udc00-\udfff]|\ud851[\udc00-\udfff]|\ud852[\udc00-\udfff]|\ud853[\udc00-\udfff]|\ud854[\udc00-\udfff]|\ud855[\udc00-\udfff]|\ud856[\udc00-\udfff]|\ud857[\udc00-\udfff]|\ud858[\udc00-\udfff]|\ud859[\udc00-\udfff]|\ud85a[\udc00-\udfff]|\ud85b[\udc00-\udfff]|\ud85c[\udc00-\udfff]|\ud85d[\udc00-\udfff]|\ud85e[\udc00-\udfff]|\ud85f[\udc00-\udfff]|\ud860[\udc00-\udfff]|\ud861[\udc00-\udfff]|\ud862[\udc00-\udfff]|\ud863[\udc00-\udfff]|\ud864[\udc00-\udfff]|\ud865[\udc00-\udfff]|\ud866[\udc00-\udfff]|\ud867[\udc00-\udfff]|\ud868[\udc00-\udfff]|\ud869[\udc00-\uded6\udf00-\udfff]|\ud86a[\udc00-\udfff]|\ud86b[\udc00-\udfff]|\ud86c[\udc00-\udfff]|\ud86d[\udc00-\udf34\udf40-\udfff]|\ud86e[\udc00-\udc1d\udc20-\udfff]|\ud86f[\udc00-\udfff]|\ud870[\udc00-\udfff]|\ud871[\udc00-\udfff]|\ud872[\udc00-\udfff]|\ud873[\udc00-\udea1\udeb0-\udfff]|\ud874[\udc00-\udfff]|\ud875[\udc00-\udfff]|\ud876[\udc00-\udfff]|\ud877[\udc00-\udfff]|\ud878[\udc00-\udfff]|\ud879[\udc00-\udfff]|\ud87a[\udc00-\udfe0]|\ud87e[\udc00-\ude1d]|\udb40[\udd00-\uddef])|[$_]|(\\u[0-9a-fA-F]{4}|\\u\{[0-9a-fA-F]{1,}\})|[\u200c\u200d])*>/,function(){var t=Wr.slice(3,-1);return fA(t,this.getCurrentState()),"NAMED_GROUP_REF"}],[/^\\b/,function(){return"ESC_b"}],[/^\\B/,function(){return"ESC_B"}],[/^\\c[a-zA-Z]/,function(){return"CTRL_CH"}],[/^\\0\d{1,2}/,function(){return"OCT_CODE"}],[/^\\0/,function(){return"DEC_CODE"}],[/^\\\d{1,3}/,function(){return"DEC_CODE"}],[/^\\u[dD][89abAB][0-9a-fA-F]{2}\\u[dD][c-fC-F][0-9a-fA-F]{2}/,function(){return"U_CODE_SURROGATE"}],[/^\\u\{[0-9a-fA-F]{1,}\}/,function(){return"U_CODE"}],[/^\\u[0-9a-fA-F]{4}/,function(){return"U_CODE"}],[/^\\[pP]\{\w+(?:=\w+)?\}/,function(){return"U_PROP_VALUE_EXP"}],[/^\\x[0-9a-fA-F]{2}/,function(){return"HEX_CODE"}],[/^\\[tnrdDsSwWvf]/,function(){return"META_CHAR"}],[/^\\\//,function(){return"ESC_CHAR"}],[/^\\[ #]/,function(){return"ESC_CHAR"}],[/^\\[\^\$\.\*\+\?\(\)\\\[\]\{\}\|\/]/,function(){return"ESC_CHAR"}],[/^\\[^*?+\[()\\|]/,function(){var t=this.getCurrentState();if(t==="u_class"&&Wr==="\\-")return"ESC_CHAR";if(t==="u"||t==="xu"||t==="u_class")throw new SyntaxError("invalid Unicode escape "+Wr);return"ESC_CHAR"}],[/^\(/,function(){return"CHAR"}],[/^\)/,function(){return"CHAR"}],[/^\(\?=/,function(){return"POS_LA_ASSERT"}],[/^\(\?!/,function(){return"NEG_LA_ASSERT"}],[/^\(\?<=/,function(){return"POS_LB_ASSERT"}],[/^\(\?<!/,function(){return"NEG_LB_ASSERT"}],[/^\(\?:/,function(){return"NON_CAPTURE_GROUP"}],[/^\(\?<(([\u0041-\u005a\u0061-\u007a\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376-\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e-\u066f\u0671-\u06d3\u06d5\u06e5-\u06e6\u06ee-\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4-\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08bd\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f-\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc-\u09dd\u09df-\u09e1\u09f0-\u09f1\u09fc\u0a05-\u0a0a\u0a0f-\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32-\u0a33\u0a35-\u0a36\u0a38-\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2-\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0-\u0ae1\u0af9\u0b05-\u0b0c\u0b0f-\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32-\u0b33\u0b35-\u0b39\u0b3d\u0b5c-\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99-\u0b9a\u0b9c\u0b9e-\u0b9f\u0ba3-\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60-\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0-\u0ce1\u0cf1-\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32-\u0e33\u0e40-\u0e46\u0e81-\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2-\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065-\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae-\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5-\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a-\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7c6\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd-\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5-\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab67\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]|\ud800[\udc00-\udc0b\udc0d-\udc26\udc28-\udc3a\udc3c-\udc3d\udc3f-\udc4d\udc50-\udc5d\udc80-\udcfa\udd40-\udd74\ude80-\ude9c\udea0-\uded0\udf00-\udf1f\udf2d-\udf4a\udf50-\udf75\udf80-\udf9d\udfa0-\udfc3\udfc8-\udfcf\udfd1-\udfd5]|\ud801[\udc00-\udc9d\udcb0-\udcd3\udcd8-\udcfb\udd00-\udd27\udd30-\udd63\ude00-\udf36\udf40-\udf55\udf60-\udf67]|\ud802[\udc00-\udc05\udc08\udc0a-\udc35\udc37-\udc38\udc3c\udc3f-\udc55\udc60-\udc76\udc80-\udc9e\udce0-\udcf2\udcf4-\udcf5\udd00-\udd15\udd20-\udd39\udd80-\uddb7\uddbe-\uddbf\ude00\ude10-\ude13\ude15-\ude17\ude19-\ude35\ude60-\ude7c\ude80-\ude9c\udec0-\udec7\udec9-\udee4\udf00-\udf35\udf40-\udf55\udf60-\udf72\udf80-\udf91]|\ud803[\udc00-\udc48\udc80-\udcb2\udcc0-\udcf2\udd00-\udd23\udf00-\udf1c\udf27\udf30-\udf45\udfe0-\udff6]|\ud804[\udc03-\udc37\udc83-\udcaf\udcd0-\udce8\udd03-\udd26\udd44\udd50-\udd72\udd76\udd83-\uddb2\uddc1-\uddc4\uddda\udddc\ude00-\ude11\ude13-\ude2b\ude80-\ude86\ude88\ude8a-\ude8d\ude8f-\ude9d\ude9f-\udea8\udeb0-\udede\udf05-\udf0c\udf0f-\udf10\udf13-\udf28\udf2a-\udf30\udf32-\udf33\udf35-\udf39\udf3d\udf50\udf5d-\udf61]|\ud805[\udc00-\udc34\udc47-\udc4a\udc5f\udc80-\udcaf\udcc4-\udcc5\udcc7\udd80-\uddae\uddd8-\udddb\ude00-\ude2f\ude44\ude80-\udeaa\udeb8\udf00-\udf1a]|\ud806[\udc00-\udc2b\udca0-\udcdf\udcff\udda0-\udda7\uddaa-\uddd0\udde1\udde3\ude00\ude0b-\ude32\ude3a\ude50\ude5c-\ude89\ude9d\udec0-\udef8]|\ud807[\udc00-\udc08\udc0a-\udc2e\udc40\udc72-\udc8f\udd00-\udd06\udd08-\udd09\udd0b-\udd30\udd46\udd60-\udd65\udd67-\udd68\udd6a-\udd89\udd98\udee0-\udef2]|\ud808[\udc00-\udf99]|\ud809[\udc00-\udc6e\udc80-\udd43]|\ud80c[\udc00-\udfff]|\ud80d[\udc00-\udc2e]|\ud811[\udc00-\ude46]|\ud81a[\udc00-\ude38\ude40-\ude5e\uded0-\udeed\udf00-\udf2f\udf40-\udf43\udf63-\udf77\udf7d-\udf8f]|\ud81b[\ude40-\ude7f\udf00-\udf4a\udf50\udf93-\udf9f\udfe0-\udfe1\udfe3]|\ud81c[\udc00-\udfff]|\ud81d[\udc00-\udfff]|\ud81e[\udc00-\udfff]|\ud81f[\udc00-\udfff]|\ud820[\udc00-\udfff]|\ud821[\udc00-\udff7]|\ud822[\udc00-\udef2]|\ud82c[\udc00-\udd1e\udd50-\udd52\udd64-\udd67\udd70-\udefb]|\ud82f[\udc00-\udc6a\udc70-\udc7c\udc80-\udc88\udc90-\udc99]|\ud835[\udc00-\udc54\udc56-\udc9c\udc9e-\udc9f\udca2\udca5-\udca6\udca9-\udcac\udcae-\udcb9\udcbb\udcbd-\udcc3\udcc5-\udd05\udd07-\udd0a\udd0d-\udd14\udd16-\udd1c\udd1e-\udd39\udd3b-\udd3e\udd40-\udd44\udd46\udd4a-\udd50\udd52-\udea5\udea8-\udec0\udec2-\udeda\udedc-\udefa\udefc-\udf14\udf16-\udf34\udf36-\udf4e\udf50-\udf6e\udf70-\udf88\udf8a-\udfa8\udfaa-\udfc2\udfc4-\udfcb]|\ud838[\udd00-\udd2c\udd37-\udd3d\udd4e\udec0-\udeeb]|\ud83a[\udc00-\udcc4\udd00-\udd43\udd4b]|\ud83b[\ude00-\ude03\ude05-\ude1f\ude21-\ude22\ude24\ude27\ude29-\ude32\ude34-\ude37\ude39\ude3b\ude42\ude47\ude49\ude4b\ude4d-\ude4f\ude51-\ude52\ude54\ude57\ude59\ude5b\ude5d\ude5f\ude61-\ude62\ude64\ude67-\ude6a\ude6c-\ude72\ude74-\ude77\ude79-\ude7c\ude7e\ude80-\ude89\ude8b-\ude9b\udea1-\udea3\udea5-\udea9\udeab-\udebb]|\ud840[\udc00-\udfff]|\ud841[\udc00-\udfff]|\ud842[\udc00-\udfff]|\ud843[\udc00-\udfff]|\ud844[\udc00-\udfff]|\ud845[\udc00-\udfff]|\ud846[\udc00-\udfff]|\ud847[\udc00-\udfff]|\ud848[\udc00-\udfff]|\ud849[\udc00-\udfff]|\ud84a[\udc00-\udfff]|\ud84b[\udc00-\udfff]|\ud84c[\udc00-\udfff]|\ud84d[\udc00-\udfff]|\ud84e[\udc00-\udfff]|\ud84f[\udc00-\udfff]|\ud850[\udc00-\udfff]|\ud851[\udc00-\udfff]|\ud852[\udc00-\udfff]|\ud853[\udc00-\udfff]|\ud854[\udc00-\udfff]|\ud855[\udc00-\udfff]|\ud856[\udc00-\udfff]|\ud857[\udc00-\udfff]|\ud858[\udc00-\udfff]|\ud859[\udc00-\udfff]|\ud85a[\udc00-\udfff]|\ud85b[\udc00-\udfff]|\ud85c[\udc00-\udfff]|\ud85d[\udc00-\udfff]|\ud85e[\udc00-\udfff]|\ud85f[\udc00-\udfff]|\ud860[\udc00-\udfff]|\ud861[\udc00-\udfff]|\ud862[\udc00-\udfff]|\ud863[\udc00-\udfff]|\ud864[\udc00-\udfff]|\ud865[\udc00-\udfff]|\ud866[\udc00-\udfff]|\ud867[\udc00-\udfff]|\ud868[\udc00-\udfff]|\ud869[\udc00-\uded6\udf00-\udfff]|\ud86a[\udc00-\udfff]|\ud86b[\udc00-\udfff]|\ud86c[\udc00-\udfff]|\ud86d[\udc00-\udf34\udf40-\udfff]|\ud86e[\udc00-\udc1d\udc20-\udfff]|\ud86f[\udc00-\udfff]|\ud870[\udc00-\udfff]|\ud871[\udc00-\udfff]|\ud872[\udc00-\udfff]|\ud873[\udc00-\udea1\udeb0-\udfff]|\ud874[\udc00-\udfff]|\ud875[\udc00-\udfff]|\ud876[\udc00-\udfff]|\ud877[\udc00-\udfff]|\ud878[\udc00-\udfff]|\ud879[\udc00-\udfff]|\ud87a[\udc00-\udfe0]|\ud87e[\udc00-\ude1d])|[$_]|(\\u[0-9a-fA-F]{4}|\\u\{[0-9a-fA-F]{1,}\}))(([\u0030-\u0039\u0041-\u005a\u005f\u0061-\u007a\u00aa\u00b5\u00b7\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376-\u0377\u037a-\u037d\u037f\u0386-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u05d0-\u05ea\u05ef-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u07fd\u0800-\u082d\u0840-\u085b\u0860-\u086a\u08a0-\u08b4\u08b6-\u08bd\u08d3-\u08e1\u08e3-\u0963\u0966-\u096f\u0971-\u0983\u0985-\u098c\u098f-\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7-\u09c8\u09cb-\u09ce\u09d7\u09dc-\u09dd\u09df-\u09e3\u09e6-\u09f1\u09fc\u09fe\u0a01-\u0a03\u0a05-\u0a0a\u0a0f-\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32-\u0a33\u0a35-\u0a36\u0a38-\u0a39\u0a3c\u0a3e-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2-\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0af9-\u0aff\u0b01-\u0b03\u0b05-\u0b0c\u0b0f-\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32-\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47-\u0b48\u0b4b-\u0b4d\u0b56-\u0b57\u0b5c-\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82-\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99-\u0b9a\u0b9c\u0b9e-\u0b9f\u0ba3-\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c00-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c58-\u0c5a\u0c60-\u0c63\u0c66-\u0c6f\u0c80-\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5-\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1-\u0cf2\u0d00-\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d54-\u0d57\u0d5f-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82-\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2-\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81-\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18-\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1369-\u1371\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772-\u1773\u1780-\u17d3\u17d7\u17dc-\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1878\u1880-\u18aa\u18b0-\u18f5\u1900-\u191e\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19da\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1ab0-\u1abd\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1cd0-\u1cd2\u1cd4-\u1cfa\u1d00-\u1df9\u1dfb-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u203f-\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fef\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7c6\ua7f7-\ua827\ua840-\ua873\ua880-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua8fd-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\ua9e0-\ua9fe\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab67\uab70-\uabea\uabec-\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe00-\ufe0f\ufe20-\ufe2f\ufe33-\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]|\ud800[\udc00-\udc0b\udc0d-\udc26\udc28-\udc3a\udc3c-\udc3d\udc3f-\udc4d\udc50-\udc5d\udc80-\udcfa\udd40-\udd74\uddfd\ude80-\ude9c\udea0-\uded0\udee0\udf00-\udf1f\udf2d-\udf4a\udf50-\udf7a\udf80-\udf9d\udfa0-\udfc3\udfc8-\udfcf\udfd1-\udfd5]|\ud801[\udc00-\udc9d\udca0-\udca9\udcb0-\udcd3\udcd8-\udcfb\udd00-\udd27\udd30-\udd63\ude00-\udf36\udf40-\udf55\udf60-\udf67]|\ud802[\udc00-\udc05\udc08\udc0a-\udc35\udc37-\udc38\udc3c\udc3f-\udc55\udc60-\udc76\udc80-\udc9e\udce0-\udcf2\udcf4-\udcf5\udd00-\udd15\udd20-\udd39\udd80-\uddb7\uddbe-\uddbf\ude00-\ude03\ude05-\ude06\ude0c-\ude13\ude15-\ude17\ude19-\ude35\ude38-\ude3a\ude3f\ude60-\ude7c\ude80-\ude9c\udec0-\udec7\udec9-\udee6\udf00-\udf35\udf40-\udf55\udf60-\udf72\udf80-\udf91]|\ud803[\udc00-\udc48\udc80-\udcb2\udcc0-\udcf2\udd00-\udd27\udd30-\udd39\udf00-\udf1c\udf27\udf30-\udf50\udfe0-\udff6]|\ud804[\udc00-\udc46\udc66-\udc6f\udc7f-\udcba\udcd0-\udce8\udcf0-\udcf9\udd00-\udd34\udd36-\udd3f\udd44-\udd46\udd50-\udd73\udd76\udd80-\uddc4\uddc9-\uddcc\uddd0-\uddda\udddc\ude00-\ude11\ude13-\ude37\ude3e\ude80-\ude86\ude88\ude8a-\ude8d\ude8f-\ude9d\ude9f-\udea8\udeb0-\udeea\udef0-\udef9\udf00-\udf03\udf05-\udf0c\udf0f-\udf10\udf13-\udf28\udf2a-\udf30\udf32-\udf33\udf35-\udf39\udf3b-\udf44\udf47-\udf48\udf4b-\udf4d\udf50\udf57\udf5d-\udf63\udf66-\udf6c\udf70-\udf74]|\ud805[\udc00-\udc4a\udc50-\udc59\udc5e-\udc5f\udc80-\udcc5\udcc7\udcd0-\udcd9\udd80-\uddb5\uddb8-\uddc0\uddd8-\udddd\ude00-\ude40\ude44\ude50-\ude59\ude80-\udeb8\udec0-\udec9\udf00-\udf1a\udf1d-\udf2b\udf30-\udf39]|\ud806[\udc00-\udc3a\udca0-\udce9\udcff\udda0-\udda7\uddaa-\uddd7\uddda-\udde1\udde3-\udde4\ude00-\ude3e\ude47\ude50-\ude99\ude9d\udec0-\udef8]|\ud807[\udc00-\udc08\udc0a-\udc36\udc38-\udc40\udc50-\udc59\udc72-\udc8f\udc92-\udca7\udca9-\udcb6\udd00-\udd06\udd08-\udd09\udd0b-\udd36\udd3a\udd3c-\udd3d\udd3f-\udd47\udd50-\udd59\udd60-\udd65\udd67-\udd68\udd6a-\udd8e\udd90-\udd91\udd93-\udd98\udda0-\udda9\udee0-\udef6]|\ud808[\udc00-\udf99]|\ud809[\udc00-\udc6e\udc80-\udd43]|\ud80c[\udc00-\udfff]|\ud80d[\udc00-\udc2e]|\ud811[\udc00-\ude46]|\ud81a[\udc00-\ude38\ude40-\ude5e\ude60-\ude69\uded0-\udeed\udef0-\udef4\udf00-\udf36\udf40-\udf43\udf50-\udf59\udf63-\udf77\udf7d-\udf8f]|\ud81b[\ude40-\ude7f\udf00-\udf4a\udf4f-\udf87\udf8f-\udf9f\udfe0-\udfe1\udfe3]|\ud81c[\udc00-\udfff]|\ud81d[\udc00-\udfff]|\ud81e[\udc00-\udfff]|\ud81f[\udc00-\udfff]|\ud820[\udc00-\udfff]|\ud821[\udc00-\udff7]|\ud822[\udc00-\udef2]|\ud82c[\udc00-\udd1e\udd50-\udd52\udd64-\udd67\udd70-\udefb]|\ud82f[\udc00-\udc6a\udc70-\udc7c\udc80-\udc88\udc90-\udc99\udc9d-\udc9e]|\ud834[\udd65-\udd69\udd6d-\udd72\udd7b-\udd82\udd85-\udd8b\uddaa-\uddad\ude42-\ude44]|\ud835[\udc00-\udc54\udc56-\udc9c\udc9e-\udc9f\udca2\udca5-\udca6\udca9-\udcac\udcae-\udcb9\udcbb\udcbd-\udcc3\udcc5-\udd05\udd07-\udd0a\udd0d-\udd14\udd16-\udd1c\udd1e-\udd39\udd3b-\udd3e\udd40-\udd44\udd46\udd4a-\udd50\udd52-\udea5\udea8-\udec0\udec2-\udeda\udedc-\udefa\udefc-\udf14\udf16-\udf34\udf36-\udf4e\udf50-\udf6e\udf70-\udf88\udf8a-\udfa8\udfaa-\udfc2\udfc4-\udfcb\udfce-\udfff]|\ud836[\ude00-\ude36\ude3b-\ude6c\ude75\ude84\ude9b-\ude9f\udea1-\udeaf]|\ud838[\udc00-\udc06\udc08-\udc18\udc1b-\udc21\udc23-\udc24\udc26-\udc2a\udd00-\udd2c\udd30-\udd3d\udd40-\udd49\udd4e\udec0-\udef9]|\ud83a[\udc00-\udcc4\udcd0-\udcd6\udd00-\udd4b\udd50-\udd59]|\ud83b[\ude00-\ude03\ude05-\ude1f\ude21-\ude22\ude24\ude27\ude29-\ude32\ude34-\ude37\ude39\ude3b\ude42\ude47\ude49\ude4b\ude4d-\ude4f\ude51-\ude52\ude54\ude57\ude59\ude5b\ude5d\ude5f\ude61-\ude62\ude64\ude67-\ude6a\ude6c-\ude72\ude74-\ude77\ude79-\ude7c\ude7e\ude80-\ude89\ude8b-\ude9b\udea1-\udea3\udea5-\udea9\udeab-\udebb]|\ud840[\udc00-\udfff]|\ud841[\udc00-\udfff]|\ud842[\udc00-\udfff]|\ud843[\udc00-\udfff]|\ud844[\udc00-\udfff]|\ud845[\udc00-\udfff]|\ud846[\udc00-\udfff]|\ud847[\udc00-\udfff]|\ud848[\udc00-\udfff]|\ud849[\udc00-\udfff]|\ud84a[\udc00-\udfff]|\ud84b[\udc00-\udfff]|\ud84c[\udc00-\udfff]|\ud84d[\udc00-\udfff]|\ud84e[\udc00-\udfff]|\ud84f[\udc00-\udfff]|\ud850[\udc00-\udfff]|\ud851[\udc00-\udfff]|\ud852[\udc00-\udfff]|\ud853[\udc00-\udfff]|\ud854[\udc00-\udfff]|\ud855[\udc00-\udfff]|\ud856[\udc00-\udfff]|\ud857[\udc00-\udfff]|\ud858[\udc00-\udfff]|\ud859[\udc00-\udfff]|\ud85a[\udc00-\udfff]|\ud85b[\udc00-\udfff]|\ud85c[\udc00-\udfff]|\ud85d[\udc00-\udfff]|\ud85e[\udc00-\udfff]|\ud85f[\udc00-\udfff]|\ud860[\udc00-\udfff]|\ud861[\udc00-\udfff]|\ud862[\udc00-\udfff]|\ud863[\udc00-\udfff]|\ud864[\udc00-\udfff]|\ud865[\udc00-\udfff]|\ud866[\udc00-\udfff]|\ud867[\udc00-\udfff]|\ud868[\udc00-\udfff]|\ud869[\udc00-\uded6\udf00-\udfff]|\ud86a[\udc00-\udfff]|\ud86b[\udc00-\udfff]|\ud86c[\udc00-\udfff]|\ud86d[\udc00-\udf34\udf40-\udfff]|\ud86e[\udc00-\udc1d\udc20-\udfff]|\ud86f[\udc00-\udfff]|\ud870[\udc00-\udfff]|\ud871[\udc00-\udfff]|\ud872[\udc00-\udfff]|\ud873[\udc00-\udea1\udeb0-\udfff]|\ud874[\udc00-\udfff]|\ud875[\udc00-\udfff]|\ud876[\udc00-\udfff]|\ud877[\udc00-\udfff]|\ud878[\udc00-\udfff]|\ud879[\udc00-\udfff]|\ud87a[\udc00-\udfe0]|\ud87e[\udc00-\ude1d]|\udb40[\udd00-\uddef])|[$_]|(\\u[0-9a-fA-F]{4}|\\u\{[0-9a-fA-F]{1,}\})|[\u200c\u200d])*>/,function(){return Wr=Wr.slice(3,-1),fA(Wr,this.getCurrentState()),"NAMED_CAPTURE_GROUP"}],[/^\(/,function(){return"L_PAREN"}],[/^\)/,function(){return"R_PAREN"}],[/^[*?+[^$]/,function(){return"CHAR"}],[/^\\\]/,function(){return"ESC_CHAR"}],[/^\]/,function(){return this.popState(),"R_BRACKET"}],[/^\^/,function(){return"BOS"}],[/^\$/,function(){return"EOS"}],[/^\*/,function(){return"STAR"}],[/^\?/,function(){return"Q_MARK"}],[/^\+/,function(){return"PLUS"}],[/^\|/,function(){return"BAR"}],[/^\./,function(){return"ANY"}],[/^\//,function(){return"SLASH"}],[/^[^*?+\[()\\|]/,function(){return"CHAR"}],[/^\[\^/,function(){var t=this.getCurrentState();return this.pushState(t==="u"||t==="xu"?"u_class":"class"),"NEG_CLASS"}],[/^\[/,function(){var t=this.getCurrentState();return this.pushState(t==="u"||t==="xu"?"u_class":"class"),"L_BRACKET"}]],YC={INITIAL:[8,9,10,11,12,13,14,15,16,17,20,22,23,24,26,27,30,31,32,33,34,35,36,37,41,42,43,44,45,46,47,48,49,50,51],u:[8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,30,31,32,33,34,35,36,37,41,42,43,44,45,46,47,48,49,50,51],xu:[0,1,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,30,31,32,33,34,35,36,37,41,42,43,44,45,46,47,48,49,50,51],x:[0,1,8,9,10,11,12,13,14,15,16,17,20,22,23,24,26,27,30,31,32,33,34,35,36,37,41,42,43,44,45,46,47,48,49,50,51],u_class:[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],class:[2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,20,22,23,24,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51]},aA={type:hA,value:""};Ht={initString:o(function(e){return this._string=e,this._cursor=0,this._states=["INITIAL"],this._tokensQueue=[],this._currentLine=1,this._currentColumn=0,this._currentLineBeginOffset=0,this._tokenStartOffset=0,this._tokenEndOffset=0,this._tokenStartLine=1,this._tokenEndLine=1,this._tokenStartColumn=0,this._tokenEndColumn=0,this},"initString"),getStates:o(function(){return this._states},"getStates"),getCurrentState:o(function(){return this._states[this._states.length-1]},"getCurrentState"),pushState:o(function(e){this._states.push(e)},"pushState"),begin:o(function(e){this.pushState(e)},"begin"),popState:o(function(){return this._states.length>1?this._states.pop():this._states[0]},"popState"),getNextToken:o(function(){if(this._tokensQueue.length>0)return this.onToken(this._toToken(this._tokensQueue.shift()));if(!this.hasMoreTokens())return this.onToken(aA);for(var e=this._string.slice(this._cursor),r=YC[this.getCurrentState()],n=0;n<r.length;n++){var i=r[n],s=QC[i],u=this._match(e,s[0]);if(e===""&&u===""&&this._cursor++,u!==null){Wr=u,pA=Wr.length;var a=s[1].call(this);if(!a)return this.getNextToken();if(Array.isArray(a)){var c=a.slice(1);if(a=a[0],c.length>0){var d;(d=this._tokensQueue).unshift.apply(d,lA(c))}}return this.onToken(this._toToken(a,Wr))}}if(this.isEOF())return this._cursor++,aA;this.throwUnexpectedToken(e[0],this._currentLine,this._currentColumn)},"getNextToken"),throwUnexpectedToken:o(function(e,r,n){var i=this._string.split(`
2
+ `)[r-1],s="";if(i){var u=" ".repeat(n);s=`
3
+
4
+ `+i+`
5
+ `+u+`^
6
+ `}throw new SyntaxError(s+'Unexpected token: "'+e+'" '+("at "+r+":"+n+"."))},"throwUnexpectedToken"),getCursor:o(function(){return this._cursor},"getCursor"),getCurrentLine:o(function(){return this._currentLine},"getCurrentLine"),getCurrentColumn:o(function(){return this._currentColumn},"getCurrentColumn"),_captureLocation:o(function(e){var r=/\n/g;this._tokenStartOffset=this._cursor,this._tokenStartLine=this._currentLine,this._tokenStartColumn=this._tokenStartOffset-this._currentLineBeginOffset;for(var n=void 0;(n=r.exec(e))!==null;)this._currentLine++,this._currentLineBeginOffset=this._tokenStartOffset+n.index+1;this._tokenEndOffset=this._cursor+e.length,this._tokenEndLine=this._currentLine,this._tokenEndColumn=this._currentColumn=this._tokenEndOffset-this._currentLineBeginOffset},"_captureLocation"),_toToken:o(function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return{type:e,value:r,startOffset:this._tokenStartOffset,endOffset:this._tokenEndOffset,startLine:this._tokenStartLine,endLine:this._tokenEndLine,startColumn:this._tokenStartColumn,endColumn:this._tokenEndColumn}},"_toToken"),isEOF:o(function(){return this._cursor===this._string.length},"isEOF"),hasMoreTokens:o(function(){return this._cursor<=this._string.length},"hasMoreTokens"),_match:o(function(e,r){var n=e.match(r);return n?(this._captureLocation(n[0]),this._cursor+=n[0].length,n[0]):null},"_match"),onToken:o(function(e){return e},"onToken")};Le.lexer=Ht;Le.tokenizer=Ht;Le.options={captureLocations:!0};var go={setOptions:o(function(e){return Le.options=e,this},"setOptions"),getOptions:o(function(){return Le.options},"getOptions"),parse:o(function(e,r){if(!Ht)throw new Error("Tokenizer instance wasn't specified.");Ht.initString(e);var n=Le.options;r&&(Le.options=Object.assign({},Le.options,r)),go.onParseBegin(e,Ht,Le.options),wt.length=0,wt.push(0);var i=Ht.getNextToken(),s=null;do{i||(Le.options=n,gA());var u=wt[wt.length-1],a=uA[i.type];Ub[u].hasOwnProperty(a)||(Le.options=n,dA(i));var c=Ub[u][a];if(c[0]==="s"){var d=null;Le.options.captureLocations&&(d={startOffset:i.startOffset,endOffset:i.endOffset,startLine:i.startLine,endLine:i.endLine,startColumn:i.startColumn,endColumn:i.endColumn}),s=this.onShift(i),wt.push({symbol:uA[s.type],semanticValue:s.value,loc:d},Number(c.slice(1))),i=Ht.getNextToken()}else if(c[0]==="r"){var p=c.slice(1),y=ZC[p],v=typeof y[2]=="function",x=v?[]:null,A=v&&Le.options.captureLocations?[]:null;if(y[1]!==0)for(var B=y[1];B-- >0;){wt.pop();var I=wt.pop();v&&(x.unshift(I.semanticValue),A&&A.unshift(I.loc))}var J={symbol:y[0]};if(v){Wr=s?s.value:null,pA=s?s.value.length:null;var de=A!==null?x.concat(A):x;y[2].apply(y,lA(de)),J.semanticValue=T,A&&(J.loc=S)}var fe=wt[wt.length-1],ve=y[0];wt.push(J,Ub[fe][ve])}else if(c==="acc"){wt.pop();var Y=wt.pop();return(wt.length!==1||wt[0]!==0||Ht.hasMoreTokens())&&(Le.options=n,dA(i)),Y.hasOwnProperty("semanticValue")?(Le.options=n,go.onParseEnd(Y.semanticValue),Y.semanticValue):(go.onParseEnd(),Le.options=n,!0)}}while(Ht.hasMoreTokens()||wt.length>1)},"parse"),setTokenizer:o(function(e){return Ht=e,go},"setTokenizer"),getTokenizer:o(function(){return Ht},"getTokenizer"),onParseBegin:o(function(e,r,n){},"onParseBegin"),onParseEnd:o(function(e){},"onParseEnd"),onShift:o(function(e){return e},"onShift")},Vb=0,Kf={},yA="";go.onParseBegin=function(t,e){yA=t,Vb=0,Kf={};var r=t.lastIndexOf("/"),n=t.slice(r);n.includes("x")&&n.includes("u")?e.pushState("xu"):(n.includes("x")&&e.pushState("x"),n.includes("u")&&e.pushState("u"))};go.onShift=function(t){return(t.type==="L_PAREN"||t.type==="NAMED_CAPTURE_GROUP")&&(t.value=new String(t.value),t.value.groupNumber=++Vb),t};function $b(t){var e=t.match(/\d+/g).map(Number);if(Number.isFinite(e[1])&&e[1]<e[0])throw new SyntaxError("Numbers out of order in "+t+" quantifier");return e}o($b,"getRange");function cA(t,e){if(t.kind==="control"||e.kind==="control"||!isNaN(t.codePoint)&&!isNaN(e.codePoint)&&t.codePoint>e.codePoint)throw new SyntaxError("Range "+t.value+"-"+e.value+" out of order in character class")}o(cA,"checkClassRange");var Sa=sA();function e8(t,e){var r=t[1]==="P",n=t.indexOf("="),i=t.slice(3,n!==-1?n:-1),s=void 0,u=n===-1&&Sa.isGeneralCategoryValue(i),a=n===-1&&Sa.isBinaryPropertyName(i);if(u)s=i,i="General_Category";else if(a)s=i;else{if(!Sa.isValidName(i))throw new SyntaxError("Invalid unicode property name: "+i+".");if(s=t.slice(n+1,-1),!Sa.isValidValue(i,s))throw new SyntaxError("Invalid "+i+" unicode property value: "+s+".")}return Pe({type:"UnicodeProperty",name:i,value:s,negative:r,shorthand:u,binary:a,canonicalName:Sa.getCanonicalName(i)||i,canonicalValue:Sa.getCanonicalValue(s)||s},e)}o(e8,"UnicodeProperty");function _t(t,e,r){var n=void 0,i=void 0;switch(e){case"decimal":{i=Number(t.slice(1)),n=String.fromCodePoint(i);break}case"oct":{i=parseInt(t.slice(1),8),n=String.fromCodePoint(i);break}case"hex":case"unicode":{if(t.lastIndexOf("\\u")>0){var s=t.split("\\u").slice(1),u=XC(s,2),a=u[0],c=u[1];a=parseInt(a,16),c=parseInt(c,16),i=(a-55296)*1024+(c-56320)+65536,n=String.fromCodePoint(i)}else{var d=t.slice(2).replace("{","");if(i=parseInt(d,16),i>1114111)throw new SyntaxError("Bad character escape sequence: "+t);n=String.fromCodePoint(i)}break}case"meta":{switch(t){case"\\t":n=" ",i=n.codePointAt(0);break;case"\\n":n=`
7
+ `,i=n.codePointAt(0);break;case"\\r":n="\r",i=n.codePointAt(0);break;case"\\v":n="\v",i=n.codePointAt(0);break;case"\\f":n="\f",i=n.codePointAt(0);break;case"\\b":n="\b",i=n.codePointAt(0);case"\\0":n="\0",i=0;case".":n=".",i=NaN;break;default:i=NaN}break}case"simple":{n=t,i=n.codePointAt(0);break}}return Pe({type:"Char",value:t,kind:e,symbol:n,codePoint:i},r)}o(_t,"Char");var t8="gimsuxy";function r8(t){var e=new Set,r=!0,n=!1,i=void 0;try{for(var s=t[Symbol.iterator](),u;!(r=(u=s.next()).done);r=!0){var a=u.value;if(e.has(a)||!t8.includes(a))throw new SyntaxError("Invalid flags: "+t);e.add(a)}}catch(c){n=!0,i=c}finally{try{!r&&s.return&&s.return()}finally{if(n)throw i}}return t.split("").sort().join("")}o(r8,"checkFlags");function n8(t,e){var r=Number(t.slice(1));return r>0&&r<=Vb?Pe({type:"Backreference",kind:"number",number:r,reference:r},e):_t(t,"decimal",e)}o(n8,"GroupRefOrDecChar");var i8=/^\\u[0-9a-fA-F]{4}/,o8=/^\\u\{[0-9a-fA-F]{1,}\}/,s8=/\\u\{[0-9a-fA-F]{1,}\}/;function fA(t,e){var r=s8.test(t),n=e==="u"||e==="xu"||e==="u_class";if(r&&!n)throw new SyntaxError('invalid group Unicode name "'+t+'", use `u` flag.');return t}o(fA,"validateUnicodeGroupName");var u8=/\\u(?:([dD][89aAbB][0-9a-fA-F]{2})\\u([dD][c-fC-F][0-9a-fA-F]{2})|([dD][89aAbB][0-9a-fA-F]{2})|([dD][c-fC-F][0-9a-fA-F]{2})|([0-9a-ce-fA-CE-F][0-9a-fA-F]{3}|[dD][0-7][0-9a-fA-F]{2})|\{(0*(?:[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4}))\})/;function mA(t){return t.replace(new RegExp(u8,"g"),function(e,r,n,i,s,u,a){return r?String.fromCodePoint(parseInt(r,16),parseInt(n,16)):i?String.fromCodePoint(parseInt(i,16)):s?String.fromCodePoint(parseInt(s,16)):u?String.fromCodePoint(parseInt(u,16)):a?String.fromCodePoint(parseInt(a,16)):e})}o(mA,"decodeUnicodeGroupName");function a8(t,e){var r=t.slice(3,-1),n=mA(r);if(Kf.hasOwnProperty(n))return Pe({type:"Backreference",kind:"name",number:Kf[n],reference:n,referenceRaw:r},e);var i=null,s=null,u=null,a=null;e&&(i=e.startOffset,s=e.startLine,u=e.endLine,a=e.startColumn);var c=/^[\w$<>]/,d=void 0,p=[_t(t.slice(1,2),"simple",i?{startLine:s,endLine:u,startColumn:a,startOffset:i,endOffset:i+=2,endColumn:a+=2}:null)];for(p[0].escaped=!0,t=t.slice(2);t.length>0;){var y=null;(y=t.match(i8))||(y=t.match(o8))?(i&&(d={startLine:s,endLine:u,startColumn:a,startOffset:i,endOffset:i+=y[0].length,endColumn:a+=y[0].length}),p.push(_t(y[0],"unicode",d)),t=t.slice(y[0].length)):(y=t.match(c))&&(i&&(d={startLine:s,endLine:u,startColumn:a,startOffset:i,endOffset:++i,endColumn:++a}),p.push(_t(y[0],"simple",d)),t=t.slice(1))}return p}o(a8,"NamedGroupRefOrChars");function Pe(t,e){return Le.options.captureLocations&&(t.loc={source:yA.slice(e.startOffset,e.endOffset),start:{line:e.startLine,column:e.startColumn,offset:e.startOffset},end:{line:e.endLine,column:e.endColumn,offset:e.endOffset}}),t}o(Pe,"Node");function gp(t,e){return Le.options.captureLocations?{startOffset:t.startOffset,endOffset:e.endOffset,startLine:t.startLine,endLine:e.endLine,startColumn:t.startColumn,endColumn:e.endColumn}:null}o(gp,"loc");function dA(t){t.type===hA&&gA(),Ht.throwUnexpectedToken(t.value,t.startLine,t.startColumn)}o(dA,"unexpectedToken");function gA(){c8("Unexpected end of input.")}o(gA,"unexpectedEndOfInput");function c8(t){throw new SyntaxError(t)}o(c8,"parseError");vA.exports=go});var zf=K((aQ,wA)=>{"use strict";var Jf=bA(),f8=Jf.parse.bind(Jf);Jf.parse=function(t,e){return f8(""+t,e)};Jf.setOptions({captureLocations:!1});wA.exports=Jf});var bp=K((cQ,xA)=>{"use strict";var d8=(function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return o(t,"defineProperties"),function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}})();function l8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}o(l8,"_classCallCheck");var vp="expressions",_A="expression",Lb=(function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;l8(this,t),this.node=e,this.parentPath=r,this.parent=r?r.node:null,this.property=n,this.index=i}return o(t,"NodePath"),d8(t,[{key:"_enforceProp",value:o(function(r){if(!this.node.hasOwnProperty(r))throw new Error("Node of type "+this.node.type+` doesn't have "`+r+'" collection.')},"_enforceProp")},{key:"setChild",value:o(function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,s=void 0;return n!=null?(i||(i=vp),this._enforceProp(i),this.node[i][n]=r,s=t.getForNode(r,this,i,n)):(i||(i=_A),this._enforceProp(i),this.node[i]=r,s=t.getForNode(r,this,i,null)),s},"setChild")},{key:"appendChild",value:o(function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;n||(n=vp),this._enforceProp(n);var i=this.node[n].length;return this.setChild(r,i,n)},"appendChild")},{key:"insertChildAt",value:o(function(r,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:vp;this._enforceProp(i),this.node[i].splice(n,0,r),n<=t.getTraversingIndex()&&t.updateTraversingIndex(1),this._rebuildIndex(this.node,i)},"insertChildAt")},{key:"remove",value:o(function(){if(!this.isRemoved()&&(t.registry.delete(this.node),this.node=null,!!this.parent)){if(this.index!==null){this.parent[this.property].splice(this.index,1),this.index<=t.getTraversingIndex()&&t.updateTraversingIndex(-1),this._rebuildIndex(this.parent,this.property),this.index=null,this.property=null;return}delete this.parent[this.property],this.property=null}},"remove")},{key:"_rebuildIndex",value:o(function(r,n){for(var i=t.getForNode(r),s=0;s<r[n].length;s++){var u=t.getForNode(r[n][s],i,n,s);u.index=s}},"_rebuildIndex")},{key:"isRemoved",value:o(function(){return this.node===null},"isRemoved")},{key:"replace",value:o(function(r){return t.registry.delete(this.node),this.node=r,this.parent?(this.index!==null?this.parent[this.property][this.index]=r:this.parent[this.property]=r,t.getForNode(r,this.parentPath,this.property,this.index)):null},"replace")},{key:"update",value:o(function(r){Object.assign(this.node,r)},"update")},{key:"getParent",value:o(function(){return this.parentPath},"getParent")},{key:"getChild",value:o(function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return this.node.expressions?t.getForNode(this.node.expressions[r],this,vp,r):this.node.expression&&r==0?t.getForNode(this.node.expression,this,_A):null},"getChild")},{key:"hasEqualSource",value:o(function(r){return JSON.stringify(this.node,Hb)===JSON.stringify(r.node,Hb)},"hasEqualSource")},{key:"jsonEncode",value:o(function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=r.format,i=r.useLoc;return JSON.stringify(this.node,i?null:Hb,n)},"jsonEncode")},{key:"getPreviousSibling",value:o(function(){return!this.parent||this.index==null?null:t.getForNode(this.parent[this.property][this.index-1],t.getForNode(this.parent),this.property,this.index-1)},"getPreviousSibling")},{key:"getNextSibling",value:o(function(){return!this.parent||this.index==null?null:t.getForNode(this.parent[this.property][this.index+1],t.getForNode(this.parent),this.property,this.index+1)},"getNextSibling")}],[{key:"getForNode",value:o(function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1;if(!r)return null;t.registry.has(r)||t.registry.set(r,new t(r,n,i,s==-1?null:s));var u=t.registry.get(r);return n!==null&&(u.parentPath=n,u.parent=u.parentPath.node),i!==null&&(u.property=i),s>=0&&(u.index=s),u},"getForNode")},{key:"initRegistry",value:o(function(){t.registry||(t.registry=new Map),t.registry.clear()},"initRegistry")},{key:"updateTraversingIndex",value:o(function(r){return t.traversingIndexStack[t.traversingIndexStack.length-1]+=r},"updateTraversingIndex")},{key:"getTraversingIndex",value:o(function(){return t.traversingIndexStack[t.traversingIndexStack.length-1]},"getTraversingIndex")}]),t})();Lb.initRegistry();Lb.traversingIndexStack=[];function Hb(t,e){if(t!=="loc")return e}o(Hb,"jsonSkipLoc");xA.exports=Lb});var Wb=K((dQ,AA)=>{"use strict";var ka=bp();function p8(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e.pre,n=e.post,i=e.skipProperty;function s(u,a,c,d){if(!(!u||typeof u.type!="string")){var p=void 0;if(r&&(p=r(u,a,c,d)),p!==!1){a&&a[c]&&(isNaN(d)?u=a[c]:u=a[c][d]);for(var y in u)if(u.hasOwnProperty(y)){if(i?i(y,u):y[0]==="$")continue;var v=u[y];if(Array.isArray(v)){var x=0;for(ka.traversingIndexStack.push(x);x<v.length;)s(v[x],u,y,x),x=ka.updateTraversingIndex(1);ka.traversingIndexStack.pop()}else s(v,u,y)}}n&&n(u,a,c,d)}}o(s,"visit"),s(t,null)}o(p8,"astTraverse");AA.exports={traverse:o(function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{asNodes:!1};Array.isArray(r)||(r=[r]),r=r.filter(function(s){return typeof s.shouldRun!="function"?!0:s.shouldRun(e)}),ka.initRegistry(),r.forEach(function(s){typeof s.init=="function"&&s.init(e)});function i(s,u,a,c){var d=ka.getForNode(u),p=ka.getForNode(s,d,a,c);return p}o(i,"getPathFor"),p8(e,{pre:o(function(u,a,c,d){var p=void 0;n.asNodes||(p=i(u,a,c,d));var y=!0,v=!1,x=void 0;try{for(var A=r[Symbol.iterator](),B;!(y=(B=A.next()).done);y=!0){var I=B.value;if(typeof I["*"]=="function")if(p){if(!p.isRemoved()){var J=I["*"](p);if(J===!1)return!1}}else I["*"](u,a,c,d);var de=void 0;if(typeof I[u.type]=="function"?de=I[u.type]:typeof I[u.type]=="object"&&typeof I[u.type].pre=="function"&&(de=I[u.type].pre),de)if(p){if(!p.isRemoved()){var fe=de.call(I,p);if(fe===!1)return!1}}else de.call(I,u,a,c,d)}}catch(ve){v=!0,x=ve}finally{try{!y&&A.return&&A.return()}finally{if(v)throw x}}},"pre"),post:o(function(u,a,c,d){if(u){var p=void 0;n.asNodes||(p=i(u,a,c,d));var y=!0,v=!1,x=void 0;try{for(var A=r[Symbol.iterator](),B;!(y=(B=A.next()).done);y=!0){var I=B.value,J=void 0;if(typeof I[u.type]=="object"&&typeof I[u.type].post=="function"&&(J=I[u.type].post),J)if(p){if(!p.isRemoved()){var de=J.call(I,p);if(de===!1)return!1}}else J.call(I,u,a,c,d)}}catch(fe){v=!0,x=fe}finally{try{!y&&A.return&&A.return()}finally{if(v)throw x}}}},"post"),skipProperty:o(function(u){return u==="loc"},"skipProperty")})},"traverse")}});var wp=K((pQ,CA)=>{"use strict";var h8=(function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return o(t,"defineProperties"),function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}})();function y8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}o(y8,"_classCallCheck");var SA=Bb(),m8=zf(),g8=Wb(),kA=(function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;y8(this,t),this._ast=e,this._source=null,this._string=null,this._regexp=null,this._extra=r}return o(t,"TransformResult"),h8(t,[{key:"getAST",value:o(function(){return this._ast},"getAST")},{key:"setExtra",value:o(function(r){this._extra=r},"setExtra")},{key:"getExtra",value:o(function(){return this._extra},"getExtra")},{key:"toRegExp",value:o(function(){return this._regexp||(this._regexp=new RegExp(this.getSource(),this._ast.flags)),this._regexp},"toRegExp")},{key:"getSource",value:o(function(){return this._source||(this._source=SA.generate(this._ast.body)),this._source},"getSource")},{key:"getFlags",value:o(function(){return this._ast.flags},"getFlags")},{key:"toString",value:o(function(){return this._string||(this._string=SA.generate(this._ast)),this._string},"toString")}]),t})();CA.exports={TransformResult:kA,transform:o(function(e,r){var n=e;return e instanceof RegExp&&(e=""+e),typeof e=="string"&&(n=m8.parse(e,{captureLocations:!0})),g8.traverse(n,r),new kA(n)},"transform")}});var PA=K((yQ,EA)=>{"use strict";var _p=tA(),v8=wp();EA.exports={transform:o(function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=r.length>0?r:Object.keys(_p),i=void 0,s={};return n.forEach(function(u){if(!_p.hasOwnProperty(u))throw new Error("Unknown compat-transform: "+u+". Available transforms are: "+Object.keys(_p).join(", "));var a=_p[u];i=v8.transform(e,a),e=i.getAST(),typeof a.getExtra=="function"&&(s[u]=a.getExtra())}),i.setExtra(s),i},"transform")}});var IA=K((gQ,TA)=>{"use strict";TA.exports=o(function t(e){if(e===null||typeof e!="object")return e;var r=void 0;Array.isArray(e)?r=[]:r={};for(var n in e)r[n]=t(e[n]);return r},"clone")});var RA=K((bQ,OA)=>{"use strict";OA.exports={shouldRun:o(function(e){return e.flags.includes("u")},"shouldRun"),Char:o(function(e){var r=e.node;r.kind!=="unicode"||!r.isSurrogatePair||isNaN(r.codePoint)||(r.value="\\u{"+r.codePoint.toString(16)+"}",delete r.isSurrogatePair)},"Char")}});var $A=K((_Q,UA)=>{"use strict";var jA="A".codePointAt(0),NA="Z".codePointAt(0),BA="a".codePointAt(0),DA="z".codePointAt(0),qA="0".codePointAt(0),MA="9".codePointAt(0);UA.exports={Char:o(function(e){var r=e.node,n=e.parent;if(!(isNaN(r.codePoint)||r.kind==="simple")&&!(n.type==="ClassRange"&&!b8(n))&&w8(r.codePoint)){var i=String.fromCodePoint(r.codePoint),s={type:"Char",kind:"simple",value:i,symbol:i,codePoint:r.codePoint};_8(i,n.type)&&(s.escaped=!0),e.replace(s)}},"Char")};function b8(t){var e=t.from,r=t.to;return e.codePoint>=qA&&e.codePoint<=MA&&r.codePoint>=qA&&r.codePoint<=MA||e.codePoint>=jA&&e.codePoint<=NA&&r.codePoint>=jA&&r.codePoint<=NA||e.codePoint>=BA&&e.codePoint<=DA&&r.codePoint>=BA&&r.codePoint<=DA}o(b8,"isSimpleRange");function w8(t){return t>=32&&t<=126}o(w8,"isPrintableASCIIChar");function _8(t,e){return e==="ClassRange"||e==="CharacterClass"?/[\]\\^-]/.test(t):/[*[()+?^$./\\|{}]/.test(t)}o(_8,"needsEscape")});var WA=K((AQ,LA)=>{"use strict";var VA="A".codePointAt(0),HA="Z".codePointAt(0);LA.exports={_AZClassRanges:null,_hasUFlag:!1,init:o(function(e){this._AZClassRanges=new Set,this._hasUFlag=e.flags.includes("u")},"init"),shouldRun:o(function(e){return e.flags.includes("i")},"shouldRun"),Char:o(function(e){var r=e.node,n=e.parent;if(!isNaN(r.codePoint)&&!(!this._hasUFlag&&r.codePoint>=4096)){if(n.type==="ClassRange"){if(!this._AZClassRanges.has(n)&&!x8(n))return;this._AZClassRanges.add(n)}var i=r.symbol.toLowerCase();i!==r.symbol&&(r.value=A8(i,r),r.symbol=i,r.codePoint=i.codePointAt(0))}},"Char")};function x8(t){var e=t.from,r=t.to;return e.codePoint>=VA&&e.codePoint<=HA&&r.codePoint>=VA&&r.codePoint<=HA}o(x8,"isAZClassRange");function A8(t,e){var r=t.codePointAt(0);if(e.kind==="decimal")return"\\"+r;if(e.kind==="oct")return"\\0"+r.toString(8);if(e.kind==="hex")return"\\x"+r.toString(16);if(e.kind==="unicode")if(e.isSurrogatePair){var n=S8(r),i=n.lead,s=n.trail;return"\\u"+"0".repeat(4-i.length)+i+"\\u"+"0".repeat(4-s.length)+s}else{if(e.value.includes("{"))return"\\u{"+r.toString(16)+"}";var u=r.toString(16);return"\\u"+"0".repeat(4-u.length)+u}return t}o(A8,"displaySymbolAsValue");function S8(t){var e=Math.floor((t-65536)/1024)+55296,r=(t-65536)%1024+56320;return{lead:e.toString(16),trail:r.toString(16)}}o(S8,"getSurrogatePairFromCodePoint")});var KA=K((kQ,FA)=>{"use strict";FA.exports={CharacterClass:o(function(e){for(var r=e.node,n={},i=0;i<r.expressions.length;i++){var s=e.getChild(i),u=s.jsonEncode();n.hasOwnProperty(u)&&(s.remove(),i--),n[u]=!0}},"CharacterClass")}});var xp=K((EQ,zA)=>{"use strict";function k8(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}else return Array.from(t)}o(k8,"_toConsumableArray");function JA(t){if(t.type!=="Disjunction")throw new TypeError('Expected "Disjunction" node, got "'+t.type+'"');var e=[];return t.left&&t.left.type==="Disjunction"?e.push.apply(e,k8(JA(t.left)).concat([t.right])):e.push(t.left,t.right),e}o(JA,"disjunctionToList");function C8(t){return t.reduce(function(e,r){return{type:"Disjunction",left:e,right:r}})}o(C8,"listToDisjunction");function E8(t){t.kind==="*"?t.kind="+":t.kind==="+"?(t.kind="Range",t.from=2,delete t.to):t.kind==="?"?(t.kind="Range",t.from=1,t.to=2):t.kind==="Range"&&(t.from+=1,t.to&&(t.to+=1))}o(E8,"increaseQuantifierByOne");zA.exports={disjunctionToList:JA,listToDisjunction:C8,increaseQuantifierByOne:E8}});var ZA=K((TQ,XA)=>{"use strict";var P8=xp(),T8=P8.increaseQuantifierByOne;XA.exports={Repetition:o(function(e){var r=e.node,n=e.parent;if(!(n.type!=="Alternative"||!e.index)){var i=e.getPreviousSibling();if(i)if(i.node.type==="Repetition"){if(!i.getChild().hasEqualSource(e.getChild()))return;var s=GA(i.node.quantifier),u=s.from,a=s.to,c=GA(r.quantifier),d=c.from,p=c.to;if(i.node.quantifier.greedy!==r.quantifier.greedy&&!Ap(i.node.quantifier)&&!Ap(r.quantifier))return;r.quantifier.kind="Range",r.quantifier.from=u+d,a&&p?r.quantifier.to=a+p:delete r.quantifier.to,(Ap(i.node.quantifier)||Ap(r.quantifier))&&(r.quantifier.greedy=!0),i.remove()}else{if(!i.hasEqualSource(e.getChild()))return;T8(r.quantifier),i.remove()}}},"Repetition")};function Ap(t){return t.greedy&&(t.kind==="+"||t.kind==="*"||t.kind==="Range"&&!t.to)}o(Ap,"isGreedyOpenRange");function GA(t){var e=void 0,r=void 0;return t.kind==="*"?e=0:t.kind==="+"?e=1:t.kind==="?"?(e=0,r=1):(e=t.from,t.to&&(r=t.to)),{from:e,to:r}}o(GA,"extractFromTo")});var YA=K((OQ,QA)=>{"use strict";QA.exports={Quantifier:o(function(e){var r=e.node;r.kind==="Range"&&(I8(e),O8(e),R8(e))},"Quantifier")};function I8(t){var e=t.node;e.from!==0||e.to||(e.kind="*",delete e.from)}o(I8,"rewriteOpenZero");function O8(t){var e=t.node;e.from!==1||e.to||(e.kind="+",delete e.from)}o(O8,"rewriteOpenOne");function R8(t){var e=t.node;e.from!==1||e.to!==1||t.parentPath.replace(t.parentPath.node.expression)}o(R8,"rewriteExactOne")});var t3=K((jQ,e3)=>{"use strict";e3.exports={ClassRange:o(function(e){var r=e.node;r.from.codePoint===r.to.codePoint?e.replace(r.from):r.from.codePoint===r.to.codePoint-1&&(e.getParent().insertChildAt(r.to,e.index+1),e.replace(r.from))},"ClassRange")}});var o3=K((BQ,i3)=>{"use strict";function r3(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}else return Array.from(t)}o(r3,"_toConsumableArray");i3.exports={_hasIFlag:!1,_hasUFlag:!1,init:o(function(e){this._hasIFlag=e.flags.includes("i"),this._hasUFlag=e.flags.includes("u")},"init"),CharacterClass:o(function(e){j8(e),N8(e,this._hasIFlag,this._hasUFlag),B8(e)},"CharacterClass")};function j8(t){var e=t.node;e.expressions.forEach(function(r,n){D8(r)&&t.getChild(n).replace({type:"Char",value:"\\d",kind:"meta"})})}o(j8,"rewriteNumberRanges");function N8(t,e,r){var n=t.node,i=null,s=null,u=null,a=null,c=null,d=null;n.expressions.forEach(function(p,y){Kb(p,"\\d")?i=t.getChild(y):q8(p)?s=t.getChild(y):M8(p)?u=t.getChild(y):U8(p)?a=t.getChild(y):e&&r&&Gf(p,383)?c=t.getChild(y):e&&r&&Gf(p,8490)&&(d=t.getChild(y))}),i&&(s&&u||e&&(s||u))&&a&&(!r||!e||c&&d)&&(i.replace({type:"Char",value:"\\w",kind:"meta"}),s&&s.remove(),u&&u.remove(),a.remove(),c&&c.remove(),d&&d.remove())}o(N8,"rewriteWordRanges");var Fb=[function(t){return n3(t," ")}].concat(r3(["\\f","\\n","\\r","\\t","\\v"].map(function(t){return function(e){return Kb(e,t)}})),r3([160,5760,8232,8233,8239,8287,12288,65279].map(function(t){return function(e){return Gf(e,t)}})),[function(t){return t.type==="ClassRange"&&Gf(t.from,8192)&&Gf(t.to,8202)}]);function B8(t){var e=t.node;if(!(e.expressions.length<Fb.length||!Fb.every(function(n){return e.expressions.some(function(i){return n(i)})}))){var r=e.expressions.find(function(n){return Kb(n,"\\n")});r.value="\\s",r.symbol=void 0,r.codePoint=NaN,e.expressions.map(function(n,i){return Fb.some(function(s){return s(n)})?t.getChild(i):void 0}).filter(Boolean).forEach(function(n){return n.remove()})}}o(B8,"rewriteWhitespaceRanges");function D8(t){return t.type==="ClassRange"&&t.from.value==="0"&&t.to.value==="9"}o(D8,"isFullNumberRange");function n3(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"simple";return t.type==="Char"&&t.value===e&&t.kind===r}o(n3,"isChar");function Kb(t,e){return n3(t,e,"meta")}o(Kb,"isMetaChar");function q8(t){return t.type==="ClassRange"&&t.from.value==="a"&&t.to.value==="z"}o(q8,"isLowerCaseRange");function M8(t){return t.type==="ClassRange"&&t.from.value==="A"&&t.to.value==="Z"}o(M8,"isUpperCaseRange");function U8(t){return t.type==="Char"&&t.value==="_"&&t.kind==="simple"}o(U8,"isUnderscore");function Gf(t,e){return t.type==="Char"&&t.kind==="unicode"&&t.codePoint===e}o(Gf,"isCodePoint")});var u3=K((qQ,s3)=>{"use strict";s3.exports={CharacterClass:o(function(e){var r=e.node;if(!(r.expressions.length!==1||!L8(e)||!$8(r.expressions[0]))){var n=r.expressions[0],i=n.value,s=n.kind,u=n.escaped;if(r.negative){if(!V8(i))return;i=H8(i)}e.replace({type:"Char",value:i,kind:s,escaped:u||W8(i)})}},"CharacterClass")};function $8(t){return t.type==="Char"&&t.value!=="\\b"}o($8,"isAppropriateChar");function V8(t){return/^\\[dwsDWS]$/.test(t)}o(V8,"isMeta");function H8(t){return/[dws]/.test(t)?t.toUpperCase():t.toLowerCase()}o(H8,"getInverseMeta");function L8(t){var e=t.parent,r=t.index;if(e.type!=="Alternative")return!0;var n=e.expressions[r-1];return n==null?!0:!(n.type==="Backreference"&&n.kind==="number"||n.type==="Char"&&n.kind==="decimal")}o(L8,"hasAppropriateSiblings");function W8(t){return/[*[()+?$./{}|]/.test(t)}o(W8,"shouldEscape")});var c3=K((UQ,a3)=>{"use strict";a3.exports={_hasXFlag:!1,init:o(function(e){this._hasXFlag=e.flags.includes("x")},"init"),Char:o(function(e){var r=e.node;r.escaped&&F8(e,this._hasXFlag)&&delete r.escaped},"Char")};function F8(t,e){var r=t.node.value,n=t.index,i=t.parent;return i.type!=="CharacterClass"&&i.type!=="ClassRange"?!J8(r,n,i,e):!K8(r,n,i)}o(F8,"shouldUnescape");function K8(t,e,r){return t==="^"?e===0&&!r.negative:t==="-"?!0:/[\]\\]/.test(t)}o(K8,"preservesInCharClass");function J8(t,e,r,n){return t==="{"?z8(e,r):t==="}"?G8(e,r):n&&/[ #]/.test(t)?!0:/[*[()+?^$./\\|]/.test(t)}o(J8,"preservesEscape");function Sp(t,e,r){for(var n=t,i=(r?n>=0:n<e.expressions.length)&&e.expressions[n];i&&i.type==="Char"&&i.kind==="simple"&&!i.escaped&&/\d/.test(i.value);)r?n--:n++,i=(r?n>=0:n<e.expressions.length)&&e.expressions[n];return Math.abs(t-n)}o(Sp,"consumeNumbers");function Ca(t,e){return t&&t.type==="Char"&&t.kind==="simple"&&!t.escaped&&t.value===e}o(Ca,"isSimpleChar");function z8(t,e){if(t==null)return!1;var r=Sp(t+1,e),n=t+r+1,i=n<e.expressions.length&&e.expressions[n];if(r){if(Ca(i,"}"))return!0;if(Ca(i,","))return r=Sp(n+1,e),n=n+r+1,i=n<e.expressions.length&&e.expressions[n],Ca(i,"}")}return!1}o(z8,"preservesOpeningCurlyBraceEscape");function G8(t,e){if(t==null)return!1;var r=Sp(t-1,e,!0),n=t-r-1,i=n>=0&&e.expressions[n];return r&&Ca(i,"{")?!0:Ca(i,",")?(r=Sp(n-1,e,!0),n=n-r-1,i=n<e.expressions.length&&e.expressions[n],r&&Ca(i,"{")):!1}o(G8,"preservesClosingCurlyBraceEscape")});var p3=K((VQ,l3)=>{"use strict";l3.exports={_hasIUFlags:!1,init:o(function(e){this._hasIUFlags=e.flags.includes("i")&&e.flags.includes("u")},"init"),CharacterClass:o(function(e){var r=e.node,n=r.expressions,i=[];n.forEach(function(c){wn(c)&&i.push(c.value)}),n.sort(X8);for(var s=0;s<n.length;s++){var u=n[s];if(Z8(u,i,this._hasIUFlags)||Q8(u,n[s-1])||Y8(u,n[s+1]))n.splice(s,1),s--;else{var a=eE(u,s,n);n.splice(s-a+1,a),s-=a}}},"CharacterClass")};function X8(t,e){var r=kp(t),n=kp(e);if(r===n){if(t.type==="ClassRange"&&e.type!=="ClassRange")return-1;if(e.type==="ClassRange"&&t.type!=="ClassRange")return 1;if(t.type==="ClassRange"&&e.type==="ClassRange")return kp(t.to)-kp(e.to);if(wn(t)&&wn(e)||f3(t)&&f3(e))return t.value<e.value?-1:1}return r-n}o(X8,"sortCharClass");function kp(t){return t.type==="Char"?t.value==="-"||t.kind==="control"?1/0:t.kind==="meta"&&isNaN(t.codePoint)?-1:t.codePoint:t.from.codePoint}o(kp,"getSortValue");function wn(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return t.type==="Char"&&t.kind==="meta"&&(e?t.value===e:/^\\[dws]$/i.test(t.value))}o(wn,"isMeta");function f3(t){return t.type==="Char"&&t.kind==="control"}o(f3,"isControl");function Z8(t,e,r){for(var n=0;n<e.length;n++)if(Jb(t,e[n],r))return!0;return!1}o(Z8,"fitsInMetas");function Jb(t,e,r){return t.type==="ClassRange"?Jb(t.from,e,r)&&Jb(t.to,e,r):e==="\\S"&&(wn(t,"\\w")||wn(t,"\\d"))||e==="\\D"&&(wn(t,"\\W")||wn(t,"\\s"))||e==="\\w"&&wn(t,"\\d")||e==="\\W"&&wn(t,"\\s")?!0:t.type!=="Char"||isNaN(t.codePoint)?!1:e==="\\s"?d3(t):e==="\\S"?!d3(t):e==="\\d"?zb(t):e==="\\D"?!zb(t):e==="\\w"?Gb(t,r):e==="\\W"?!Gb(t,r):!1}o(Jb,"fitsInMeta");function d3(t){return t.codePoint===9||t.codePoint===10||t.codePoint===11||t.codePoint===12||t.codePoint===13||t.codePoint===32||t.codePoint===160||t.codePoint===5760||t.codePoint>=8192&&t.codePoint<=8202||t.codePoint===8232||t.codePoint===8233||t.codePoint===8239||t.codePoint===8287||t.codePoint===12288||t.codePoint===65279}o(d3,"fitsInMetaS");function zb(t){return t.codePoint>=48&&t.codePoint<=57}o(zb,"fitsInMetaD");function Gb(t,e){return zb(t)||t.codePoint>=65&&t.codePoint<=90||t.codePoint>=97&&t.codePoint<=122||t.value==="_"||e&&(t.codePoint===383||t.codePoint===8490)}o(Gb,"fitsInMetaW");function Q8(t,e){if(e&&e.type==="ClassRange"){if(Xb(t,e))return!0;if(Cp(t)&&e.to.codePoint===t.codePoint-1)return e.to=t,!0;if(t.type==="ClassRange"&&t.from.codePoint<=e.to.codePoint+1&&t.to.codePoint>=e.from.codePoint-1)return t.from.codePoint<e.from.codePoint&&(e.from=t.from),t.to.codePoint>e.to.codePoint&&(e.to=t.to),!0}return!1}o(Q8,"combinesWithPrecedingClassRange");function Y8(t,e){return e&&e.type==="ClassRange"&&Cp(t)&&e.from.codePoint===t.codePoint+1?(e.from=t,!0):!1}o(Y8,"combinesWithFollowingClassRange");function Xb(t,e){return t.type==="Char"&&isNaN(t.codePoint)?!1:t.type==="ClassRange"?Xb(t.from,e)&&Xb(t.to,e):t.codePoint>=e.from.codePoint&&t.codePoint<=e.to.codePoint}o(Xb,"fitsInClassRange");function eE(t,e,r){if(!Cp(t))return 0;for(var n=0;e>0;){var i=r[e],s=r[e-1];if(Cp(s)&&s.codePoint===i.codePoint-1)n++,e--;else break}return n>1?(r[e]={type:"ClassRange",from:r[e],to:t},n):0}o(eE,"charCombinesWithPrecedingChars");function Cp(t){return t&&t.type==="Char"&&!isNaN(t.codePoint)&&(Gb(t,!1)||t.kind==="unicode"||t.kind==="hex"||t.kind==="oct"||t.kind==="decimal")}o(Cp,"isMetaWCharOrCode")});var m3=K((LQ,y3)=>{"use strict";var tE=bp(),h3=xp(),rE=h3.disjunctionToList,nE=h3.listToDisjunction;y3.exports={Disjunction:o(function(e){var r=e.node,n={},i=rE(r).filter(function(s){var u=s?tE.getForNode(s).jsonEncode():"null";return n.hasOwnProperty(u)?!1:(n[u]=s,!0)});e.replace(nE(i))},"Disjunction")}});var b3=K((FQ,v3)=>{"use strict";v3.exports={Disjunction:o(function(e){var r=e.node,n=e.parent;if(g3[n.type]){var i=new Map;if(!(!Ep(r,i)||!i.size)){var s={type:"CharacterClass",expressions:Array.from(i.keys()).sort().map(function(u){return i.get(u)})};g3[n.type](e.getParent(),s)}}},"Disjunction")};var g3={RegExp:o(function(e,r){var n=e.node;n.body=r},"RegExp"),Group:o(function(e,r){var n=e.node;n.capturing?n.expression=r:e.replace(r)},"Group")};function Ep(t,e){if(!t)return!1;var r=t.type;if(r==="Disjunction"){var n=t.left,i=t.right;return Ep(n,e)&&Ep(i,e)}else if(r==="Char"){if(t.kind==="meta"&&t.symbol===".")return!1;var s=t.value;return e.set(s,t),!0}else if(r==="CharacterClass"&&!t.negative)return t.expressions.every(function(u){return Ep(u,e)});return!1}o(Ep,"shouldProcess")});var _3=K((JQ,w3)=>{"use strict";w3.exports={Group:o(function(e){var r=e.node,n=e.parent,i=e.getChild();r.capturing||i||(n.type==="Repetition"?e.getParent().replace(r):n.type!=="RegExp"&&e.remove())},"Group")}});var A3=K((GQ,x3)=>{"use strict";function Zb(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}else return Array.from(t)}o(Zb,"_toConsumableArray");x3.exports={Group:o(function(e){var r=e.node,n=e.parent,i=e.getChild();if(!(r.capturing||!i)&&iE(e)&&!(i.node.type==="Disjunction"&&n.type!=="RegExp")&&!(n.type==="Repetition"&&i.node.type!=="Char"&&i.node.type!=="CharacterClass"))if(i.node.type==="Alternative"){var s=e.getParent();s.node.type==="Alternative"&&s.replace({type:"Alternative",expressions:[].concat(Zb(n.expressions.slice(0,e.index)),Zb(i.node.expressions),Zb(n.expressions.slice(e.index+1)))})}else e.replace(i.node)},"Group")};function iE(t){var e=t.parent,r=t.index;if(e.type!=="Alternative")return!0;var n=e.expressions[r-1];return n==null?!0:!(n.type==="Backreference"&&n.kind==="number"||n.type==="Char"&&n.kind==="decimal")}o(iE,"hasAppropriateSiblings")});var C3=K((ZQ,k3)=>{"use strict";function Pp(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}else return Array.from(t)}o(Pp,"_toConsumableArray");var Tp=bp(),oE=xp(),S3=oE.increaseQuantifierByOne;k3.exports={Alternative:o(function(e){for(var r=e.node,n=1;n<r.expressions.length;){var i=e.getChild(n);if(n=Math.max(1,sE(e,i,n)),n>=r.expressions.length||(i=e.getChild(n),n=Math.max(1,uE(e,i,n)),n>=r.expressions.length))break;i=e.getChild(n),n=Math.max(1,aE(e,i,n)),n++}},"Alternative")};function sE(t,e,r){for(var n=t.node,i=Math.ceil(r/2),s=0;s<i;){var u=r-2*s-1,a=void 0,c=void 0;if(s===0?(a=e,c=t.getChild(u)):(a=Tp.getForNode({type:"Alternative",expressions:[].concat(Pp(n.expressions.slice(r-s,r)),[e.node])}),c=Tp.getForNode({type:"Alternative",expressions:[].concat(Pp(n.expressions.slice(u,r-s)))})),a.hasEqualSource(c)){for(var d=0;d<2*s+1;d++)t.getChild(u).remove();return e.replace({type:"Repetition",expression:s===0&&a.node.type!=="Repetition"?a.node:{type:"Group",capturing:!1,expression:a.node},quantifier:{type:"Quantifier",kind:"Range",from:2,to:2,greedy:!0}}),u}s++}return r}o(sE,"combineRepeatingPatternLeft");function uE(t,e,r){for(var n=t.node,i=0;i<r;){var s=t.getChild(i);if(s.node.type==="Repetition"&&s.node.quantifier.greedy){var u=s.getChild(),a=void 0;if(u.node.type==="Group"&&!u.node.capturing&&(u=u.getChild()),i+1===r?(a=e,a.node.type==="Group"&&!a.node.capturing&&(a=a.getChild())):a=Tp.getForNode({type:"Alternative",expressions:[].concat(Pp(n.expressions.slice(i+1,r+1)))}),u.hasEqualSource(a)){for(var c=i;c<r;c++)t.getChild(i+1).remove();return S3(s.node.quantifier),i}}i++}return r}o(uE,"combineWithPreviousRepetition");function aE(t,e,r){var n=t.node;if(e.node.type==="Repetition"&&e.node.quantifier.greedy){var i=e.getChild(),s=void 0;i.node.type==="Group"&&!i.node.capturing&&(i=i.getChild());var u=void 0;if(i.node.type==="Alternative"?(u=i.node.expressions.length,s=Tp.getForNode({type:"Alternative",expressions:[].concat(Pp(n.expressions.slice(r-u,r)))})):(u=1,s=t.getChild(r-1),s.node.type==="Group"&&!s.node.capturing&&(s=s.getChild())),s.hasEqualSource(i)){for(var a=r-u;a<r;a++)t.getChild(r-u).remove();return S3(e.node.quantifier),r-u}}return r}o(aE,"combineRepetitionWithPrevious")});var P3=K((YQ,E3)=>{"use strict";E3.exports=new Map([["charSurrogatePairToSingleUnicode",RA()],["charCodeToSimpleChar",$A()],["charCaseInsensitiveLowerCaseTransform",WA()],["charClassRemoveDuplicates",KA()],["quantifiersMerge",ZA()],["quantifierRangeToSymbol",YA()],["charClassClassrangesToChars",t3()],["charClassToMeta",o3()],["charClassToSingleChar",u3()],["charEscapeUnescape",c3()],["charClassClassrangesMerge",p3()],["disjunctionRemoveDuplicates",m3()],["groupSingleCharsToCharClass",b3()],["removeEmptyGroup",_3()],["ungroup",A3()],["combineRepeatingPatterns",C3()]])});var R3=K((eY,O3)=>{"use strict";var T3=IA(),cE=zf(),I3=wp(),Ip=P3();O3.exports={optimize:o(function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=r.whitelist,i=n===void 0?[]:n,s=r.blacklist,u=s===void 0?[]:s,a=i.length>0?i:Array.from(Ip.keys()),c=a.filter(function(v){return!u.includes(v)}),d=e;e instanceof RegExp&&(e=""+e),typeof e=="string"&&(d=cE.parse(e));var p=new I3.TransformResult(d),y=void 0;do y=p.toString(),d=T3(p.getAST()),c.forEach(function(v){if(!Ip.has(v))throw new Error("Unknown optimization-transform: "+v+". Available transforms are: "+Array.from(Ip.keys()).join(", "));var x=Ip.get(v),A=I3.transform(d,x);A.toString()!==p.toString()&&(A.toString().length<=p.toString().length?p=A:d=T3(p.getAST()))});while(p.toString()!==y);return p},"optimize")}});var Xf=K((rY,N3)=>{"use strict";var j3="\u03B5",fE=j3+"*";N3.exports={EPSILON:j3,EPSILON_CLOSURE:fE}});var Qb=K((nY,q3)=>{"use strict";var dE=(function(){function t(e,r){var n=[],i=!0,s=!1,u=void 0;try{for(var a=e[Symbol.iterator](),c;!(i=(c=a.next()).done)&&(n.push(c.value),!(r&&n.length===r));i=!0);}catch(d){s=!0,u=d}finally{try{!i&&a.return&&a.return()}finally{if(s)throw u}}return n}return o(t,"sliceIterator"),function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),lE=(function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return o(t,"defineProperties"),function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}})();function pE(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}else return Array.from(t)}o(pE,"_toConsumableArray");function hE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}o(hE,"_classCallCheck");var D3=Xf(),yE=D3.EPSILON,B3=D3.EPSILON_CLOSURE,mE=(function(){function t(e,r){hE(this,t),this.in=e,this.out=r}return o(t,"NFA"),lE(t,[{key:"matches",value:o(function(r){return this.in.matches(r)},"matches")},{key:"getAlphabet",value:o(function(){if(!this._alphabet){this._alphabet=new Set;var r=this.getTransitionTable();for(var n in r){var i=r[n];for(var s in i)s!==B3&&this._alphabet.add(s)}}return this._alphabet},"getAlphabet")},{key:"getAcceptingStates",value:o(function(){return this._acceptingStates||this.getTransitionTable(),this._acceptingStates},"getAcceptingStates")},{key:"getAcceptingStateNumbers",value:o(function(){if(!this._acceptingStateNumbers){this._acceptingStateNumbers=new Set;var r=!0,n=!1,i=void 0;try{for(var s=this.getAcceptingStates()[Symbol.iterator](),u;!(r=(u=s.next()).done);r=!0){var a=u.value;this._acceptingStateNumbers.add(a.number)}}catch(c){n=!0,i=c}finally{try{!r&&s.return&&s.return()}finally{if(n)throw i}}}return this._acceptingStateNumbers},"getAcceptingStateNumbers")},{key:"getTransitionTable",value:o(function(){var r=this;if(!this._transitionTable){this._transitionTable={},this._acceptingStates=new Set;var n=new Set,i=new Set,s=o(function u(a){if(!n.has(a)){n.add(a),a.number=n.size,r._transitionTable[a.number]={},a.accepting&&r._acceptingStates.add(a);var c=a.getTransitions(),d=!0,p=!1,y=void 0;try{for(var v=c[Symbol.iterator](),x;!(d=(x=v.next()).done);d=!0){var A=x.value,B=dE(A,2),I=B[0],J=B[1],de=[];i.add(I);var fe=!0,ve=!1,Y=void 0;try{for(var ye=J[Symbol.iterator](),ae;!(fe=(ae=ye.next()).done);fe=!0){var Ne=ae.value;u(Ne),de.push(Ne.number)}}catch(xt){ve=!0,Y=xt}finally{try{!fe&&ye.return&&ye.return()}finally{if(ve)throw Y}}r._transitionTable[a.number][I]=de}}catch(xt){p=!0,y=xt}finally{try{!d&&v.return&&v.return()}finally{if(p)throw y}}}},"visitState");s(this.in),n.forEach(function(u){delete r._transitionTable[u.number][yE],r._transitionTable[u.number][B3]=[].concat(pE(u.getEpsilonClosure())).map(function(a){return a.number})})}return this._transitionTable},"getTransitionTable")}]),t})();q3.exports=mE});var U3=K((oY,M3)=>{"use strict";var gE=(function(){function t(e,r){var n=[],i=!0,s=!1,u=void 0;try{for(var a=e[Symbol.iterator](),c;!(i=(c=a.next()).done)&&(n.push(c.value),!(r&&n.length===r));i=!0);}catch(d){s=!0,u=d}finally{try{!i&&a.return&&a.return()}finally{if(s)throw u}}return n}return o(t,"sliceIterator"),function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})();function vE(t){return Array.isArray(t)?t:Array.from(t)}o(vE,"_toArray");function Yb(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}else return Array.from(t)}o(Yb,"_toConsumableArray");var _n=null;function bE(t){var e=t.getTransitionTable(),r=Object.keys(e),n=t.getAlphabet(),i=t.getAcceptingStateNumbers();_n={};var s=new Set;r.forEach(function(Se){Se=Number(Se);var $=i.has(Se);$?_n[Se]=i:(s.add(Se),_n[Se]=s)});var u=[[s,i].filter(function(Se){return Se.size>0})],a=void 0,c=void 0;a=u[u.length-1],c=u[u.length-2];for(var d=o(function(){var $={},ft=!0,ir=!1,le=void 0;try{for(var or=a[Symbol.iterator](),Sr;!(ft=(Sr=or.next()).done);ft=!0){var Kr=Sr.value,sr={},dt=vE(Kr),Ra=dt[0],En=dt.slice(1);sr[Ra]=new Set([Ra]);var vo=!0,td=!1,bo=void 0;try{e:for(var wo=En[Symbol.iterator](),ja;!(vo=(ja=wo.next()).done);vo=!0){var Pn=ja.value,_o=!0,Na=!1,xo=void 0;try{for(var Ba=Object.keys(sr)[Symbol.iterator](),rd;!(_o=(rd=Ba.next()).done);_o=!0){var Da=rd.value;if(_E(Pn,Da,e,n)){sr[Da].add(Pn),sr[Pn]=sr[Da];continue e}}}catch(Dt){Na=!0,xo=Dt}finally{try{!_o&&Ba.return&&Ba.return()}finally{if(Na)throw xo}}sr[Pn]=new Set([Pn])}}catch(Dt){td=!0,bo=Dt}finally{try{!vo&&wo.return&&wo.return()}finally{if(td)throw bo}}Object.assign($,sr)}}catch(Dt){ir=!0,le=Dt}finally{try{!ft&&or.return&&or.return()}finally{if(ir)throw le}}_n=$;var Lp=new Set(Object.keys($).map(function(Dt){return $[Dt]}));u.push([].concat(Yb(Lp))),a=u[u.length-1],c=u[u.length-2]},"_loop");!wE(a,c);)d();var p=new Map,y=1;a.forEach(function(Se){return p.set(Se,y++)});var v={},x=new Set,A=o(function($,ft){var ir=!0,le=!1,or=void 0;try{for(var Sr=$[Symbol.iterator](),Kr;!(ir=(Kr=Sr.next()).done);ir=!0){var sr=Kr.value;i.has(sr)&&x.add(ft)}}catch(dt){le=!0,or=dt}finally{try{!ir&&Sr.return&&Sr.return()}finally{if(le)throw or}}},"updateAcceptingStates"),B=!0,I=!1,J=void 0;try{for(var de=p.entries()[Symbol.iterator](),fe;!(B=(fe=de.next()).done);B=!0){var ve=fe.value,Y=gE(ve,2),ye=Y[0],ae=Y[1];v[ae]={};var Ne=!0,xt=!1,at=void 0;try{for(var Bt=n[Symbol.iterator](),_r;!(Ne=(_r=Bt.next()).done);Ne=!0){var Fr=_r.value;A(ye,ae);var ct=void 0,xr=!0,kn=!1,li=void 0;try{for(var Ar=ye[Symbol.iterator](),Cn;!(xr=(Cn=Ar.next()).done);xr=!0){var nr=Cn.value;if(ct=e[nr][Fr],ct)break}}catch(Se){kn=!0,li=Se}finally{try{!xr&&Ar.return&&Ar.return()}finally{if(kn)throw li}}ct&&(v[ae][Fr]=p.get(_n[ct]))}}catch(Se){xt=!0,at=Se}finally{try{!Ne&&Bt.return&&Bt.return()}finally{if(xt)throw at}}}}catch(Se){I=!0,J=Se}finally{try{!B&&de.return&&de.return()}finally{if(I)throw J}}return t.setTransitionTable(v),t.setAcceptingStateNumbers(x),t}o(bE,"minimize");function wE(t,e){if(!e||t.length!==e.length)return!1;for(var r=0;r<t.length;r++){var n=t[r],i=e[r];if(n.size!==i.size||[].concat(Yb(n)).sort().join(",")!==[].concat(Yb(i)).sort().join(","))return!1}return!0}o(wE,"sameRow");function _E(t,e,r,n){var i=!0,s=!1,u=void 0;try{for(var a=n[Symbol.iterator](),c;!(i=(c=a.next()).done);i=!0){var d=c.value;if(!xE(t,e,r,d))return!1}}catch(p){s=!0,u=p}finally{try{!i&&a.return&&a.return()}finally{if(s)throw u}}return!0}o(_E,"areEquivalent");function xE(t,e,r,n){if(!_n[t]||!_n[e])return!1;var i=r[t][n],s=r[e][n];return!i&&!s?!0:_n[t].has(i)&&_n[e].has(s)}o(xE,"goToSameSet");M3.exports={minimize:bE}});var L3=K((uY,H3)=>{"use strict";var AE=(function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return o(t,"defineProperties"),function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}})();function $3(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}else return Array.from(t)}o($3,"_toConsumableArray");function SE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}o(SE,"_classCallCheck");var kE=U3(),CE=Xf(),V3=CE.EPSILON_CLOSURE,EE=(function(){function t(e){SE(this,t),this._nfa=e}return o(t,"DFA"),AE(t,[{key:"minimize",value:o(function(){this.getTransitionTable(),this._originalAcceptingStateNumbers=this._acceptingStateNumbers,this._originalTransitionTable=this._transitionTable,kE.minimize(this)},"minimize")},{key:"getAlphabet",value:o(function(){return this._nfa.getAlphabet()},"getAlphabet")},{key:"getAcceptingStateNumbers",value:o(function(){return this._acceptingStateNumbers||this.getTransitionTable(),this._acceptingStateNumbers},"getAcceptingStateNumbers")},{key:"getOriginaAcceptingStateNumbers",value:o(function(){return this._originalAcceptingStateNumbers||this.getTransitionTable(),this._originalAcceptingStateNumbers},"getOriginaAcceptingStateNumbers")},{key:"setTransitionTable",value:o(function(r){this._transitionTable=r},"setTransitionTable")},{key:"setAcceptingStateNumbers",value:o(function(r){this._acceptingStateNumbers=r},"setAcceptingStateNumbers")},{key:"getTransitionTable",value:o(function(){var r=this;if(this._transitionTable)return this._transitionTable;var n=this._nfa.getTransitionTable(),i=Object.keys(n);this._acceptingStateNumbers=new Set;for(var s=n[i[0]][V3],u=[s],a=this.getAlphabet(),c=this._nfa.getAcceptingStateNumbers(),d={},p=o(function(Se){var $=!0,ft=!1,ir=void 0;try{for(var le=c[Symbol.iterator](),or;!($=(or=le.next()).done);$=!0){var Sr=or.value;if(Se.indexOf(Sr)!==-1){r._acceptingStateNumbers.add(Se.join(","));break}}}catch(Kr){ft=!0,ir=Kr}finally{try{!$&&le.return&&le.return()}finally{if(ft)throw ir}}},"updateAcceptingStates");u.length>0;){var y=u.shift(),v=y.join(",");d[v]={};var x=!0,A=!1,B=void 0;try{for(var I=a[Symbol.iterator](),J;!(x=(J=I.next()).done);x=!0){var de=J.value,fe=[];p(y);var ve=!0,Y=!1,ye=void 0;try{for(var ae=y[Symbol.iterator](),Ne;!(ve=(Ne=ae.next()).done);ve=!0){var xt=Ne.value,at=n[xt][de];if(at){var Bt=!0,_r=!1,Fr=void 0;try{for(var ct=at[Symbol.iterator](),xr;!(Bt=(xr=ct.next()).done);Bt=!0){var kn=xr.value;n[kn]&&fe.push.apply(fe,$3(n[kn][V3]))}}catch(nr){_r=!0,Fr=nr}finally{try{!Bt&&ct.return&&ct.return()}finally{if(_r)throw Fr}}}}}catch(nr){Y=!0,ye=nr}finally{try{!ve&&ae.return&&ae.return()}finally{if(Y)throw ye}}var li=new Set(fe),Ar=[].concat($3(li));if(Ar.length>0){var Cn=Ar.join(",");d[v][de]=Cn,d.hasOwnProperty(Cn)||u.unshift(Ar)}}}catch(nr){A=!0,B=nr}finally{try{!x&&I.return&&I.return()}finally{if(A)throw B}}}return this._transitionTable=this._remapStateNumbers(d)},"getTransitionTable")},{key:"_remapStateNumbers",value:o(function(r){var n={};this._originalTransitionTable=r;var i={};Object.keys(r).forEach(function(B,I){n[B]=I+1});for(var s in r){var u=r[s],a={};for(var c in u)a[c]=n[u[c]];i[n[s]]=a}this._originalAcceptingStateNumbers=this._acceptingStateNumbers,this._acceptingStateNumbers=new Set;var d=!0,p=!1,y=void 0;try{for(var v=this._originalAcceptingStateNumbers[Symbol.iterator](),x;!(d=(x=v.next()).done);d=!0){var A=x.value;this._acceptingStateNumbers.add(n[A])}}catch(B){p=!0,y=B}finally{try{!d&&v.return&&v.return()}finally{if(p)throw y}}return i},"_remapStateNumbers")},{key:"getOriginalTransitionTable",value:o(function(){return this._originalTransitionTable||this.getTransitionTable(),this._originalTransitionTable},"getOriginalTransitionTable")},{key:"matches",value:o(function(r){for(var n=1,i=0,s=this.getTransitionTable();r[i];)if(n=s[n][r[i++]],!n)return!1;return!!this.getAcceptingStateNumbers().has(n)},"matches")}]),t})();H3.exports=EE});var F3=K((cY,W3)=>{"use strict";var PE=(function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return o(t,"defineProperties"),function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}})();function TE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}o(TE,"_classCallCheck");var IE=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.accepting,n=r===void 0?!1:r;TE(this,t),this._transitions=new Map,this.accepting=n}return o(t,"State"),PE(t,[{key:"getTransitions",value:o(function(){return this._transitions},"getTransitions")},{key:"addTransition",value:o(function(r,n){return this.getTransitionsOnSymbol(r).add(n),this},"addTransition")},{key:"getTransitionsOnSymbol",value:o(function(r){var n=this._transitions.get(r);return n||(n=new Set,this._transitions.set(r,n)),n},"getTransitionsOnSymbol")}]),t})();W3.exports=IE});var J3=K((dY,K3)=>{"use strict";var OE=(function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return o(t,"defineProperties"),function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}})();function RE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}o(RE,"_classCallCheck");function jE(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&(typeof e=="object"||typeof e=="function")?e:t}o(jE,"_possibleConstructorReturn");function NE(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}o(NE,"_inherits");var BE=F3(),DE=Xf(),e1=DE.EPSILON,qE=(function(t){NE(e,t);function e(){return RE(this,e),jE(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return o(e,"NFAState"),OE(e,[{key:"matches",value:o(function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:new Set;if(i.has(this))return!1;if(i.add(this),n.length===0){if(this.accepting)return!0;var s=!0,u=!1,a=void 0;try{for(var c=this.getTransitionsOnSymbol(e1)[Symbol.iterator](),d;!(s=(d=c.next()).done);s=!0){var p=d.value;if(p.matches("",i))return!0}}catch(at){u=!0,a=at}finally{try{!s&&c.return&&c.return()}finally{if(u)throw a}}return!1}var y=n[0],v=n.slice(1),x=this.getTransitionsOnSymbol(y),A=!0,B=!1,I=void 0;try{for(var J=x[Symbol.iterator](),de;!(A=(de=J.next()).done);A=!0){var fe=de.value;if(fe.matches(v))return!0}}catch(at){B=!0,I=at}finally{try{!A&&J.return&&J.return()}finally{if(B)throw I}}var ve=!0,Y=!1,ye=void 0;try{for(var ae=this.getTransitionsOnSymbol(e1)[Symbol.iterator](),Ne;!(ve=(Ne=ae.next()).done);ve=!0){var xt=Ne.value;if(xt.matches(n,i))return!0}}catch(at){Y=!0,ye=at}finally{try{!ve&&ae.return&&ae.return()}finally{if(Y)throw ye}}return!1},"matches")},{key:"getEpsilonClosure",value:o(function(){var n=this;return this._epsilonClosure||(function(){var i=n.getTransitionsOnSymbol(e1),s=n._epsilonClosure=new Set;s.add(n);var u=!0,a=!1,c=void 0;try{for(var d=i[Symbol.iterator](),p;!(u=(p=d.next()).done);u=!0){var y=p.value;if(!s.has(y)){s.add(y);var v=y.getEpsilonClosure();v.forEach(function(x){return s.add(x)})}}}catch(x){a=!0,c=x}finally{try{!u&&d.return&&d.return()}finally{if(a)throw c}}})(),this._epsilonClosure},"getEpsilonClosure")}]),e})(BE);K3.exports=qE});var t1=K((pY,G3)=>{"use strict";var Op=Qb(),Ea=J3(),ME=Xf(),Nt=ME.EPSILON;function z3(t){var e=new Ea,r=new Ea({accepting:!0});return new Op(e.addTransition(t,r),r)}o(z3,"char");function UE(){return z3(Nt)}o(UE,"e");function $E(t,e){return t.out.accepting=!1,e.out.accepting=!0,t.out.addTransition(Nt,e.in),new Op(t.in,e.out)}o($E,"altPair");function VE(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var i=!0,s=!1,u=void 0;try{for(var a=r[Symbol.iterator](),c;!(i=(c=a.next()).done);i=!0){var d=c.value;t=$E(t,d)}}catch(p){s=!0,u=p}finally{try{!i&&a.return&&a.return()}finally{if(s)throw u}}return t}o(VE,"alt");function HE(t,e){var r=new Ea,n=new Ea;return r.addTransition(Nt,t.in),r.addTransition(Nt,e.in),n.accepting=!0,t.out.accepting=!1,e.out.accepting=!1,t.out.addTransition(Nt,n),e.out.addTransition(Nt,n),new Op(r,n)}o(HE,"orPair");function LE(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var i=!0,s=!1,u=void 0;try{for(var a=r[Symbol.iterator](),c;!(i=(c=a.next()).done);i=!0){var d=c.value;t=HE(t,d)}}catch(p){s=!0,u=p}finally{try{!i&&a.return&&a.return()}finally{if(s)throw u}}return t}o(LE,"or");function WE(t){var e=new Ea,r=new Ea({accepting:!0});return e.addTransition(Nt,t.in),e.addTransition(Nt,r),t.out.accepting=!1,t.out.addTransition(Nt,r),r.addTransition(Nt,t.in),new Op(e,r)}o(WE,"repExplicit");function FE(t){return t.in.addTransition(Nt,t.out),t.out.addTransition(Nt,t.in),t}o(FE,"rep");function KE(t){return t.out.addTransition(Nt,t.in),t}o(KE,"plusRep");function JE(t){return t.in.addTransition(Nt,t.out),t}o(JE,"questionRep");G3.exports={alt:VE,char:z3,e:UE,or:LE,rep:FE,repExplicit:WE,plusRep:KE,questionRep:JE}});var Q3=K((yY,Z3)=>{"use strict";function zE(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}else return Array.from(t)}o(zE,"_toConsumableArray");var GE=zf(),Pa=t1(),XE=Pa.alt,ZE=Pa.char,QE=Pa.or,YE=Pa.rep,e6=Pa.plusRep,t6=Pa.questionRep;function xn(t){if(t&&!X3[t.type])throw new Error(t.type+" is not supported in NFA/DFA interpreter.");return t?X3[t.type](t):""}o(xn,"gen");var X3={RegExp:o(function(e){if(e.flags!=="")throw new Error("NFA/DFA: Flags are not supported yet.");return xn(e.body)},"RegExp"),Alternative:o(function(e){var r=(e.expressions||[]).map(xn);return XE.apply(void 0,zE(r))},"Alternative"),Disjunction:o(function(e){return QE(xn(e.left),xn(e.right))},"Disjunction"),Repetition:o(function(e){switch(e.quantifier.kind){case"*":return YE(xn(e.expression));case"+":return e6(xn(e.expression));case"?":return t6(xn(e.expression));default:throw new Error("Unknown repeatition: "+e.quantifier.kind+".")}},"Repetition"),Char:o(function(e){if(e.kind!=="simple")throw new Error("NFA/DFA: Only simple chars are supported yet.");return ZE(e.value)},"Char"),Group:o(function(e){return xn(e.expression)},"Group")};Z3.exports={build:o(function(e){var r=e;return e instanceof RegExp&&(e=""+e),typeof e=="string"&&(r=GE.parse(e,{captureLocations:!0})),xn(r)},"build")}});var t4=K((gY,e4)=>{"use strict";var r6=Qb(),Y3=L3(),n6=Q3(),i6=t1();e4.exports={NFA:r6,DFA:Y3,builders:i6,toNFA:o(function(e){return n6.build(e)},"toNFA"),toDFA:o(function(e){return new Y3(this.toNFA(e))},"toDFA"),test:o(function(e,r){return this.toDFA(e).matches(r)},"test")}});var n4=K((bY,r4)=>{"use strict";var o6=(function(){function t(e,r){for(var n=0;n<r.length;n++){var i=r[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return o(t,"defineProperties"),function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}})();function s6(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}o(s6,"_classCallCheck");var u6=(function(){function t(e,r){var n=r.flags,i=r.groups,s=r.source;s6(this,t),this._re=e,this._groups=i,this.flags=n,this.source=s||e.source,this.dotAll=n.includes("s"),this.global=e.global,this.ignoreCase=e.ignoreCase,this.multiline=e.multiline,this.sticky=e.sticky,this.unicode=e.unicode}return o(t,"RegExpTree"),o6(t,[{key:"test",value:o(function(r){return this._re.test(r)},"test")},{key:"compile",value:o(function(r){return this._re.compile(r)},"compile")},{key:"toString",value:o(function(){return this._toStringResult||(this._toStringResult="/"+this.source+"/"+this.flags),this._toStringResult},"toString")},{key:"exec",value:o(function(r){var n=this._re.exec(r);if(!this._groups||!n)return n;n.groups={};for(var i in this._groups){var s=this._groups[i];n.groups[i]=n[s]}return n},"exec")}]),t})();r4.exports={RegExpTree:u6}});var u4=K((_Y,s4)=>{"use strict";var a6=PA(),c6=Bb(),f6=R3(),i4=zf(),o4=wp(),d6=Wb(),l6=t4(),p6=n4(),h6=p6.RegExpTree,y6={parser:i4,fa:l6,TransformResult:o4.TransformResult,parse:o(function(e,r){return i4.parse(""+e,r)},"parse"),traverse:o(function(e,r,n){return d6.traverse(e,r,n)},"traverse"),transform:o(function(e,r){return o4.transform(e,r)},"transform"),generate:o(function(e){return c6.generate(e)},"generate"),toRegExp:o(function(e){var r=this.compatTranspile(e);return new RegExp(r.getSource(),r.getFlags())},"toRegExp"),optimize:o(function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=n.blacklist;return f6.optimize(e,{whitelist:r,blacklist:i})},"optimize"),compatTranspile:o(function(e,r){return a6.transform(e,r)},"compatTranspile"),exec:o(function(e,r){if(typeof e=="string"){var n=this.compatTranspile(e),i=n.getExtra();i.namedCapturingGroups?e=new h6(n.toRegExp(),{flags:n.getFlags(),source:n.getSource(),groups:i.namedCapturingGroups}):e=n.toRegExp()}return e.exec(r)},"exec")};s4.exports=y6});var c4=K((AY,a4)=>{"use strict";a4.exports=u4()});var d4=K((SY,f4)=>{"use strict";var Rp=c4(),m6=Nb(),n1=class n1 extends m6.Analyzer{constructor(e){super(e)}isVulnerable(e){return this._measureStarHeight(e)>1||this._measureRepetitions(e)>this.options.heuristic_replimit}genAttackString(e){return null}_measureStarHeight(e){let r=0,n=0,i=Rp.parse(e);return Rp.traverse(i,{Repetition:{pre({node:s}){r++,n<r&&(n=r)},post({node:s}){r--}}}),n}_measureRepetitions(e){let r=0,n=Rp.parse(e);return Rp.traverse(n,{Repetition:{pre({node:i}){r++}}}),r}};o(n1,"HeuristicAnalyzer");var r1=n1;f4.exports=r1});var p4=K((CY,l4)=>{"use strict";var g6=d4();l4.exports=[g6]});var y4=K((EY,h4)=>{"use strict";var v6=Nb(),b6=p4(),w6=25,_6=!0,x6=!1,o1=class o1{constructor(e,r){this.regExp=e,this.analyzerOptions=r}};o(o1,"Args");var i1=o1;function A6(t,e){try{let r=S6(t,e);return k6(r).find(i=>i)?x6:_6}catch{return!1}}o(A6,"safeRegex");function S6(t,e){e||(e={});let r=e.limit===void 0?w6:e.limit,n=new v6.AnalyzerOptions(r),i=null;return t instanceof RegExp?i=t:typeof t=="string"?i=new RegExp(t):i=new RegExp(String(t)),new i1(i,n)}o(S6,"buildArgs");function k6(t){let e=[],r;for(r of b6)try{let n=new r(t.analyzerOptions);e.push(n.isVulnerable(t.regExp))}catch{e.push(!1)}return e}o(k6,"askAnalyzersIfVulnerable");h4.exports=A6});var gP={};E1(gP,{AUTHORIZATION_CODE_GRANT:()=>Mh,BuildDcqlPresentationError:()=>Sn,BuildPresentationError:()=>fi,CREDENTIAL_OFFER_SCHEMES:()=>V4,CredentialOfferParseError:()=>ge,DEFAULT_JWE_ALG:()=>d1,DEFAULT_JWE_ENC:()=>l1,DEFAULT_STORE_PLUGIN:()=>Sw,JarmEncryptError:()=>ze,OID4VCI_PROOF_TYP:()=>vw,PRE_AUTHORIZED_CODE_GRANT:()=>Tn,PkceError:()=>On,RequestObjectError:()=>Z,SiopSignError:()=>An,VciError:()=>N,VpError:()=>te,VpSignError:()=>Lt,VpSubmitError:()=>Wt,acceptCredentialOffer:()=>_d,adaptCredentialForDcql:()=>g1,adaptCredentialsForDcql:()=>Mp,assembleDcqlVpToken:()=>w1,beginAuthCodeFlow:()=>Uh,buildAuthorizationUrl:()=>_w,buildDcqlPresentations:()=>$p,buildDcqlQuery:()=>k1,buildDcqlResponse:()=>Vp,buildPresentation:()=>Qf,buildPresentationSubmission:()=>x4,buildProofJwt:()=>Za,builtInDidResolver:()=>Cb,completeAuthCodeFlow:()=>$h,computeS256Challenge:()=>Dh,createJoseEd25519Signer:()=>wd,encryptResponseObject:()=>Dp,evaluateField:()=>u1,exchangeAuthorizationCode:()=>xw,exchangePreAuthorizedCode:()=>Gp,fetchAuthorizationServerMetadata:()=>Ua,fetchCredentialIssuerMetadata:()=>Ma,generatePkcePair:()=>Bh,getOpenID4VCPlugin:()=>E4,inferCredentialFormat:()=>Zf,matchInputDescriptor:()=>Np,normalizeCredentialOffer:()=>nd,normalizeIssuedCredential:()=>Vh,parseAuthorizationRequestUri:()=>Lf,parseCredentialOfferUri:()=>id,parseDcqlQuery:()=>ai,queryJsonPath:()=>a1,requestCredential:()=>Qa,requestW3cVc:()=>T4,requiresIdToken:()=>qp,resolveAuthorizationRequest:()=>Wf,resolveAuthorizationServer:()=>$a,resolveCredentialOfferByReference:()=>Kp,resolvePresentationDefinitionByReference:()=>Pb,responseTypeSet:()=>y1,satisfiesFilter:()=>Ta,selectCredentials:()=>Bp,selectCredentialsForDcql:()=>Up,signDcqlPresentations:()=>b1,signIdToken:()=>ed,signPresentation:()=>di,storeAcceptedCredentials:()=>Hh,submitPresentation:()=>Ia,verifyAndDecodeRequestObject:()=>lp,verifyPkce:()=>DS});module.exports=$4(gP);var Tn="urn:ietf:params:oauth:grant-type:pre-authorized_code",V4=["openid-credential-offer","haip"],Fp=class Fp extends Error{constructor(e,r){super(r),this.name="CredentialOfferParseError",this.code=e}};o(Fp,"CredentialOfferParseError");var ge=Fp;var Jr=o(t=>typeof t=="string"&&t.length>0,"isNonEmptyString"),nd=o(t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new ge("invalid_json","Credential offer must be a JSON object");let e=t;if(!Jr(e.credential_issuer))throw new ge("missing_issuer","Credential offer is missing `credential_issuer`");let r=e.credential_issuer;if(Array.isArray(e.credential_configuration_ids)){let n=e.credential_configuration_ids.filter(Jr);if(n.length===0)throw new ge("missing_credentials","Credential offer `credential_configuration_ids` is empty");return{credential_issuer:r,credential_configuration_ids:n,grants:T1(e.grants)}}if(Array.isArray(e.credentials)){let i=e.credentials.map(s=>{if(typeof s=="string")return s;if(typeof s=="object"&&s!==null){let u=s;if(Jr(u.id))return u.id;if(Array.isArray(u.types)&&u.types.length>0&&Jr(u.types[0]))return u.types[0]}return null}).filter(Jr);if(i.length===0)throw new ge("missing_credentials","Credential offer `credentials` array did not contain any resolvable identifiers");return{credential_issuer:r,credential_configuration_ids:i,grants:T1(e.grants,{legacy:!0})}}throw new ge("missing_credentials","Credential offer must include `credential_configuration_ids` (Draft 13) or `credentials` (Draft 11)")},"normalizeCredentialOffer"),T1=o((t,e={})=>{if(t==null)return;if(typeof t!="object"||Array.isArray(t))throw new ge("invalid_grants","`grants` must be a JSON object");let r=t,n={},i=r[Tn];if(i&&typeof i=="object"&&!Array.isArray(i)){let u=i,a=u["pre-authorized_code"];if(!Jr(a))throw new ge("invalid_grants","Pre-authorized code grant is missing `pre-authorized_code`");let c={"pre-authorized_code":a,interval:typeof u.interval=="number"?u.interval:void 0,authorization_server:Jr(u.authorization_server)?u.authorization_server:void 0};u.tx_code&&typeof u.tx_code=="object"&&!Array.isArray(u.tx_code)?c.tx_code=u.tx_code:e.legacy&&u.user_pin_required===!0&&(c.tx_code={}),n[Tn]=c}let s=r.authorization_code;if(s&&typeof s=="object"&&!Array.isArray(s)){let u=s;n.authorization_code={issuer_state:Jr(u.issuer_state)?u.issuer_state:void 0,authorization_server:Jr(u.authorization_server)?u.authorization_server:void 0}}if(Object.keys(n).length!==0)return n},"normalizeGrants");var id=o(t=>{if(typeof t!="string"||t.trim().length===0)throw new ge("invalid_uri","Offer URI must be a non-empty string");let e=H4(t.trim()),r=e.get("credential_offer"),n=e.get("credential_offer_uri");if(r&&n)throw new ge("both_offer_and_uri","Credential offer URI must contain exactly one of `credential_offer` or `credential_offer_uri`, not both");if(n){if(!I1(n))throw new ge("invalid_uri","`credential_offer_uri` must be an absolute https:// URL");return{kind:"by_reference",uri:n}}if(r){let i;try{i=JSON.parse(r)}catch{throw new ge("invalid_json","`credential_offer` value is not valid JSON")}return{kind:"by_value",offer:nd(i)}}throw new ge("missing_offer","Credential offer URI must contain `credential_offer` or `credential_offer_uri`")},"parseCredentialOfferUri"),Kp=o(async(t,e=globalThis.fetch)=>{if(typeof e!="function")throw new ge("invalid_uri","No fetch implementation available to resolve credential_offer_uri");if(!I1(t))throw new ge("invalid_uri","credential_offer_uri must be an absolute https:// URL");let r;try{r=await e(t,{method:"GET"})}catch(i){throw new ge("invalid_uri",`Failed to fetch credential_offer_uri: ${i instanceof Error?i.message:String(i)}`)}if(!r.ok)throw new ge("invalid_uri",`credential_offer_uri returned ${r.status} ${r.statusText}`);let n;try{n=await r.json()}catch{throw new ge("invalid_json","credential_offer_uri response was not valid JSON")}return{kind:"by_value",offer:nd(n)}},"resolveCredentialOfferByReference"),H4=o(t=>{let e=t.indexOf("?");if(e!==-1)return new URLSearchParams(t.slice(e+1));if(t.includes("://")||/^[a-z][a-z0-9+.-]*:/i.test(t))throw new ge("invalid_uri","Offer URI has no query string");if(t.includes("="))return new URLSearchParams(t);throw new ge("invalid_uri","Offer URI has no query string")},"extractSearchParams"),I1=o(t=>{try{return new URL(t).protocol==="https:"}catch{return!1}},"isHttpsUrl");var Jp=class Jp extends Error{constructor(e,r,n={}){super(r),this.name="VciError",this.code=e,this.status=n.status,this.body=n.body,n.cause!==void 0&&(this.cause=n.cause)}};o(Jp,"VciError");var N=Jp;var L4="/.well-known/openid-credential-issuer",W4="/.well-known/oauth-authorization-server",F4="/.well-known/openid-configuration",Ma=o(async(t,e=globalThis.fetch)=>{if(typeof e!="function")throw new N("metadata_fetch_failed","No fetch implementation available for issuer metadata");let r=zp(t,L4),n=await z4(r,e,"metadata_fetch_failed");if(!R1(n))throw new N("metadata_invalid","Issuer metadata response was not a JSON object",{body:n});if(typeof n.credential_issuer!="string"||n.credential_issuer.length===0)throw new N("metadata_invalid","Issuer metadata is missing `credential_issuer`",{body:n});if(typeof n.credential_endpoint!="string"||n.credential_endpoint.length===0)throw new N("metadata_invalid","Issuer metadata is missing `credential_endpoint`",{body:n});if(!K4(n.credential_issuer,t))throw new N("metadata_issuer_mismatch",`Issuer metadata advertises \`credential_issuer\` as ${n.credential_issuer} but was fetched for ${t}`,{body:n});return n},"fetchCredentialIssuerMetadata"),Ua=o(async(t,e=globalThis.fetch)=>{if(typeof e!="function")throw new N("metadata_fetch_failed","No fetch implementation available for authorization-server metadata");let r=zp(t,W4),n=o(async s=>{let u;try{u=await e(s,{method:"GET"})}catch{return null}if(!u.ok)return null;try{return await u.json()}catch{return null}},"tryUrl"),i=await n(r);if(i==null){let s=zp(t,F4);i=await n(s)}if(i==null)throw new N("metadata_fetch_failed",`Authorization server metadata not reachable at ${r} or the OIDC fallback`);if(!R1(i))throw new N("metadata_invalid","Authorization server metadata was not a JSON object",{body:i});if(typeof i.token_endpoint!="string"||i.token_endpoint.length===0)throw new N("metadata_invalid","Authorization server metadata is missing `token_endpoint`",{body:i});return i},"fetchAuthorizationServerMetadata"),$a=o((t,e)=>e&&e.length>0?e:Array.isArray(t.authorization_servers)&&t.authorization_servers.length>0&&typeof t.authorization_servers[0]=="string"?t.authorization_servers[0]:t.credential_issuer,"resolveAuthorizationServer"),zp=o((t,e)=>{let r=t.length;for(;r>0&&t.charCodeAt(r-1)===47;)r--;return`${t.slice(0,r)}${e}`},"joinWellKnown"),K4=o((t,e)=>O1(t)===O1(e),"originsMatch"),O1=o(t=>{let e=t.length;for(;e>0&&t.charCodeAt(e-1)===47;)e--;let r=t.slice(0,e),n=r.indexOf("://");if(n<=0)return r;let i=r.slice(0,n);return J4(i)?`${i.toLowerCase()}${r.slice(n)}`:r},"normalizeIssuerId"),J4=o(t=>{if(t.length===0)return!1;for(let e=0;e<t.length;e++){let r=t.charCodeAt(e),n=r>=65&&r<=90,i=r>=97&&r<=122;if(!n&&!i)return!1}return!0},"isAsciiAlpha"),R1=o(t=>typeof t=="object"&&t!==null&&!Array.isArray(t),"isObject"),z4=o(async(t,e,r)=>{let n;try{n=await e(t,{method:"GET"})}catch(i){throw new N(r,`Failed to fetch ${t}: ${i instanceof Error?i.message:String(i)}`,{cause:i})}if(!n.ok)throw new N(r,`Fetch of ${t} returned ${n.status} ${n.statusText}`,{status:n.status});try{return await n.json()}catch(i){throw new N(r,`Response from ${t} was not valid JSON`,{cause:i})}},"getJson");var Gp=o(async t=>{let{tokenEndpoint:e,preAuthorizedCode:r,txCode:n,clientId:i}=t,s=t.fetchImpl??globalThis.fetch;if(typeof s!="function")throw new N("token_request_failed","No fetch implementation available for token exchange");let u=new URLSearchParams;u.set("grant_type",Tn),u.set("pre-authorized_code",r),typeof n=="string"&&n.length>0&&u.set("tx_code",n),typeof i=="string"&&i.length>0&&u.set("client_id",i);let a;try{a=await s(e,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:u.toString()})}catch(d){throw new N("token_request_failed",`Token endpoint ${e} unreachable: ${d instanceof Error?d.message:String(d)}`,{cause:d})}let c;try{c=await a.json()}catch(d){throw new N("token_response_invalid",`Token endpoint ${e} returned non-JSON body`,{status:a.status,cause:d})}if(!a.ok){let d=c,p=typeof d?.error=="string"?d.error:"unknown",y=typeof d?.error_description=="string"?`: ${d.error_description}`:"";throw new N("token_request_failed",`Token endpoint returned ${a.status} (${p})${y}`,{status:a.status,body:c})}if(!G4(c))throw new N("token_response_invalid","Token endpoint response is missing required `access_token` / `token_type`",{status:a.status,body:c});return c},"exchangePreAuthorizedCode"),G4=o(t=>{if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.access_token=="string"&&e.access_token.length>0&&typeof e.token_type=="string"&&e.token_type.length>0},"isTokenResponse");var ee=crypto,Me=o(t=>t instanceof CryptoKey,"isCryptoKey");var X4=o(async(t,e)=>{let r=`SHA-${t.slice(-3)}`;return new Uint8Array(await ee.subtle.digest(r,e))},"digest"),j1=X4;var Te=new TextEncoder,Ge=new TextDecoder,od=2**32;function Ft(...t){let e=t.reduce((i,{length:s})=>i+s,0),r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}o(Ft,"concat");function N1(t,e){return Ft(Te.encode(t),new Uint8Array([0]),e)}o(N1,"p2s");function Xp(t,e,r){if(e<0||e>=od)throw new RangeError(`value must be >= 0 and <= ${od-1}. Received ${e}`);t.set([e>>>24,e>>>16,e>>>8,e&255],r)}o(Xp,"writeUInt32BE");function B1(t){let e=Math.floor(t/od),r=t%od,n=new Uint8Array(8);return Xp(n,e,0),Xp(n,r,4),n}o(B1,"uint64be");function sd(t){let e=new Uint8Array(4);return Xp(e,t),e}o(sd,"uint32be");function ud(t){return Ft(sd(t.length),t)}o(ud,"lengthAndInput");async function D1(t,e,r){let n=Math.ceil((e>>3)/32),i=new Uint8Array(n*32);for(let s=0;s<n;s++){let u=new Uint8Array(4+t.length+r.length);u.set(sd(s+1)),u.set(t,4),u.set(r,4+t.length),i.set(await j1("sha256",u),s*32)}return i.slice(0,e>>3)}o(D1,"concatKdf");var Zp=o(t=>{let e=t;typeof e=="string"&&(e=Te.encode(e));let r=32768,n=[];for(let i=0;i<e.length;i+=r)n.push(String.fromCharCode.apply(null,e.subarray(i,i+r)));return btoa(n.join(""))},"encodeBase64"),Ie=o(t=>Zp(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),"encode"),Qp=o(t=>{let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r},"decodeBase64"),Kt=o(t=>{let e=t;e instanceof Uint8Array&&(e=Ge.decode(e)),e=e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return Qp(e)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}},"decode");var oh=class oh extends Error{constructor(e,r){super(e,r),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};o(oh,"JOSEError");var Xe=oh;Xe.code="ERR_JOSE_GENERIC";var sh=class sh extends Xe{constructor(e,r,n="unspecified",i="unspecified"){super(e,{cause:{claim:n,reason:i,payload:r}}),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=n,this.reason=i,this.payload=r}};o(sh,"JWTClaimValidationFailed");var At=sh;At.code="ERR_JWT_CLAIM_VALIDATION_FAILED";var uh=class uh extends Xe{constructor(e,r,n="unspecified",i="unspecified"){super(e,{cause:{claim:n,reason:i,payload:r}}),this.code="ERR_JWT_EXPIRED",this.claim=n,this.reason=i,this.payload=r}};o(uh,"JWTExpired");var Ao=uh;Ao.code="ERR_JWT_EXPIRED";var ah=class ah extends Xe{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}};o(ah,"JOSEAlgNotAllowed");var Va=ah;Va.code="ERR_JOSE_ALG_NOT_ALLOWED";var ch=class ch extends Xe{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}};o(ch,"JOSENotSupported");var pe=ch;pe.code="ERR_JOSE_NOT_SUPPORTED";var fh=class fh extends Xe{constructor(e="decryption operation failed",r){super(e,r),this.code="ERR_JWE_DECRYPTION_FAILED"}};o(fh,"JWEDecryptionFailed");var Yp=fh;Yp.code="ERR_JWE_DECRYPTION_FAILED";var dh=class dh extends Xe{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}};o(dh,"JWEInvalid");var lt=dh;lt.code="ERR_JWE_INVALID";var lh=class lh extends Xe{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}};o(lh,"JWSInvalid");var me=lh;me.code="ERR_JWS_INVALID";var ph=class ph extends Xe{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}};o(ph,"JWTInvalid");var Ze=ph;Ze.code="ERR_JWT_INVALID";var hh=class hh extends Xe{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}};o(hh,"JWKInvalid");var eh=hh;eh.code="ERR_JWK_INVALID";var yh=class yh extends Xe{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}};o(yh,"JWKSInvalid");var th=yh;th.code="ERR_JWKS_INVALID";var mh=class mh extends Xe{constructor(e="no applicable key found in the JSON Web Key Set",r){super(e,r),this.code="ERR_JWKS_NO_MATCHING_KEY"}};o(mh,"JWKSNoMatchingKey");var rh=mh;rh.code="ERR_JWKS_NO_MATCHING_KEY";var gh=class gh extends Xe{constructor(e="multiple matching keys found in the JSON Web Key Set",r){super(e,r),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}};o(gh,"JWKSMultipleMatchingKeys");var nh=gh;nh.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";var vh=class vh extends Xe{constructor(e="request timed out",r){super(e,r),this.code="ERR_JWKS_TIMEOUT"}};o(vh,"JWKSTimeout");var ih=vh;ih.code="ERR_JWKS_TIMEOUT";var bh=class bh extends Xe{constructor(e="signature verification failed",r){super(e,r),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}};o(bh,"JWSSignatureVerificationFailed");var Ha=bh;Ha.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";var So=ee.getRandomValues.bind(ee);function wh(t){switch(t){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new pe(`Unsupported JWE Algorithm: ${t}`)}}o(wh,"bitLength");var q1=o(t=>So(new Uint8Array(wh(t)>>3)),"default");var Y4=o((t,e)=>{if(e.length<<3!==wh(t))throw new lt("Invalid Initialization Vector length")},"checkIvLength"),M1=Y4;var eS=o((t,e)=>{let r=t.byteLength<<3;if(r!==e)throw new lt(`Invalid Content Encryption Key length. Expected ${e} bits, got ${r} bits`)},"checkCekLength"),_h=eS;function Je(t,e="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${e} must be ${t}`)}o(Je,"unusable");function zr(t,e){return t.name===e}o(zr,"isAlgorithm");function ad(t){return parseInt(t.name.slice(4),10)}o(ad,"getHashLength");function tS(t){switch(t){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}o(tS,"getNamedCurve");function U1(t,e){if(e.length&&!e.some(r=>t.usages.includes(r))){let r="CryptoKey does not support this operation, its usages must include ";if(e.length>2){let n=e.pop();r+=`one of ${e.join(", ")}, or ${n}.`}else e.length===2?r+=`one of ${e[0]} or ${e[1]}.`:r+=`${e[0]}.`;throw new TypeError(r)}}o(U1,"checkUsage");function $1(t,e,...r){switch(e){case"HS256":case"HS384":case"HS512":{if(!zr(t.algorithm,"HMAC"))throw Je("HMAC");let n=parseInt(e.slice(2),10);if(ad(t.algorithm.hash)!==n)throw Je(`SHA-${n}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!zr(t.algorithm,"RSASSA-PKCS1-v1_5"))throw Je("RSASSA-PKCS1-v1_5");let n=parseInt(e.slice(2),10);if(ad(t.algorithm.hash)!==n)throw Je(`SHA-${n}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!zr(t.algorithm,"RSA-PSS"))throw Je("RSA-PSS");let n=parseInt(e.slice(2),10);if(ad(t.algorithm.hash)!==n)throw Je(`SHA-${n}`,"algorithm.hash");break}case"EdDSA":{if(t.algorithm.name!=="Ed25519"&&t.algorithm.name!=="Ed448")throw Je("Ed25519 or Ed448");break}case"Ed25519":{if(!zr(t.algorithm,"Ed25519"))throw Je("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!zr(t.algorithm,"ECDSA"))throw Je("ECDSA");let n=tS(e);if(t.algorithm.namedCurve!==n)throw Je(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}U1(t,r)}o($1,"checkSigCryptoKey");function ar(t,e,...r){switch(e){case"A128GCM":case"A192GCM":case"A256GCM":{if(!zr(t.algorithm,"AES-GCM"))throw Je("AES-GCM");let n=parseInt(e.slice(1,4),10);if(t.algorithm.length!==n)throw Je(n,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!zr(t.algorithm,"AES-KW"))throw Je("AES-KW");let n=parseInt(e.slice(1,4),10);if(t.algorithm.length!==n)throw Je(n,"algorithm.length");break}case"ECDH":{switch(t.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw Je("ECDH, X25519, or X448")}break}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!zr(t.algorithm,"PBKDF2"))throw Je("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!zr(t.algorithm,"RSA-OAEP"))throw Je("RSA-OAEP");let n=parseInt(e.slice(9),10)||1;if(ad(t.algorithm.hash)!==n)throw Je(`SHA-${n}`,"algorithm.hash");break}default:throw new TypeError("CryptoKey does not support this operation")}U1(t,r)}o(ar,"checkEncCryptoKey");function V1(t,e,...r){if(r=r.filter(Boolean),r.length>2){let n=r.pop();t+=`one of type ${r.join(", ")}, or ${n}.`}else r.length===2?t+=`one of type ${r[0]} or ${r[1]}.`:t+=`of type ${r[0]}.`;return e==null?t+=` Received ${e}`:typeof e=="function"&&e.name?t+=` Received function ${e.name}`:typeof e=="object"&&e!=null&&e.constructor?.name&&(t+=` Received an instance of ${e.constructor.name}`),t}o(V1,"message");var Fe=o((t,...e)=>V1("Key must be ",t,...e),"default");function xh(t,e,...r){return V1(`Key for the ${t} algorithm must be `,e,...r)}o(xh,"withAlg");var Ah=o(t=>Me(t)?!0:t?.[Symbol.toStringTag]==="KeyObject","default"),qe=["CryptoKey"];var rS=o((...t)=>{let e=t.filter(Boolean);if(e.length===0||e.length===1)return!0;let r;for(let n of e){let i=Object.keys(n);if(!r||r.size===0){r=new Set(i);continue}for(let s of i){if(r.has(s))return!1;r.add(s)}}return!0},"isDisjoint"),ko=rS;function nS(t){return typeof t=="object"&&t!==null}o(nS,"isObjectLike");function nt(t){if(!nS(t)||Object.prototype.toString.call(t)!=="[object Object]")return!1;if(Object.getPrototypeOf(t)===null)return!0;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}o(nt,"isObject");var iS=[{hash:"SHA-256",name:"HMAC"},!0,["sign"]],cd=iS;function oS(t,e){if(t.algorithm.length!==parseInt(e.slice(1,4),10))throw new TypeError(`Invalid key size for alg: ${e}`)}o(oS,"checkKeySize");function sS(t,e,r){if(Me(t))return ar(t,e,r),t;if(t instanceof Uint8Array)return ee.subtle.importKey("raw",t,"AES-KW",!0,[r]);throw new TypeError(Fe(t,...qe,"Uint8Array"))}o(sS,"getCryptoKey");var La=o(async(t,e,r)=>{let n=await sS(e,t,"wrapKey");oS(n,t);let i=await ee.subtle.importKey("raw",r,...cd);return new Uint8Array(await ee.subtle.wrapKey("raw",i,n,"AES-KW"))},"wrap");async function H1(t,e,r,n,i=new Uint8Array(0),s=new Uint8Array(0)){if(!Me(t))throw new TypeError(Fe(t,...qe));if(ar(t,"ECDH"),!Me(e))throw new TypeError(Fe(e,...qe));ar(e,"ECDH","deriveBits");let u=Ft(ud(Te.encode(r)),ud(i),ud(s),sd(n)),a;t.algorithm.name==="X25519"?a=256:t.algorithm.name==="X448"?a=448:a=Math.ceil(parseInt(t.algorithm.namedCurve.substr(-3),10)/8)<<3;let c=new Uint8Array(await ee.subtle.deriveBits({name:t.algorithm.name,public:t},e,a));return D1(c,n,u)}o(H1,"deriveKey");async function L1(t){if(!Me(t))throw new TypeError(Fe(t,...qe));return ee.subtle.generateKey(t.algorithm,!0,["deriveBits"])}o(L1,"generateEpk");function W1(t){if(!Me(t))throw new TypeError(Fe(t,...qe));return["P-256","P-384","P-521"].includes(t.algorithm.namedCurve)||t.algorithm.name==="X25519"||t.algorithm.name==="X448"}o(W1,"ecdhAllowed");function Sh(t){if(!(t instanceof Uint8Array)||t.length<8)throw new lt("PBES2 Salt Input must be 8 or more octets")}o(Sh,"checkP2s");function aS(t,e){if(t instanceof Uint8Array)return ee.subtle.importKey("raw",t,"PBKDF2",!1,["deriveBits"]);if(Me(t))return ar(t,e,"deriveBits","deriveKey"),t;throw new TypeError(Fe(t,...qe,"Uint8Array"))}o(aS,"getCryptoKey");async function cS(t,e,r,n){Sh(t);let i=N1(e,t),s=parseInt(e.slice(13,16),10),u={hash:`SHA-${e.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:i},a={length:s,name:"AES-KW"},c=await aS(n,e);if(c.usages.includes("deriveBits"))return new Uint8Array(await ee.subtle.deriveBits(u,c,s));if(c.usages.includes("deriveKey"))return ee.subtle.deriveKey(u,c,a,!1,["wrapKey","unwrapKey"]);throw new TypeError('PBKDF2 key "usages" must include "deriveBits" or "deriveKey"')}o(cS,"deriveKey");var F1=o(async(t,e,r,n=2048,i=So(new Uint8Array(16)))=>{let s=await cS(i,t,n,e);return{encryptedKey:await La(t.slice(-6),s,r),p2c:n,p2s:Ie(i)}},"encrypt");function fd(t){switch(t){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new pe(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}o(fd,"subtleRsaEs");var Co=o((t,e)=>{if(t.startsWith("RS")||t.startsWith("PS")){let{modulusLength:r}=e.algorithm;if(typeof r!="number"||r<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}},"default");var K1=o(async(t,e,r)=>{if(!Me(e))throw new TypeError(Fe(e,...qe));if(ar(e,t,"encrypt","wrapKey"),Co(t,e),e.usages.includes("encrypt"))return new Uint8Array(await ee.subtle.encrypt(fd(t),e,r));if(e.usages.includes("wrapKey")){let n=await ee.subtle.importKey("raw",r,...cd);return new Uint8Array(await ee.subtle.wrapKey("raw",n,e,fd(t)))}throw new TypeError('RSA-OAEP key "usages" must include "encrypt" or "wrapKey" for this operation')},"encrypt");function Gr(t){return nt(t)&&typeof t.kty=="string"}o(Gr,"isJWK");function J1(t){return t.kty!=="oct"&&typeof t.d=="string"}o(J1,"isPrivateJWK");function z1(t){return t.kty!=="oct"&&typeof t.d>"u"}o(z1,"isPublicJWK");function G1(t){return Gr(t)&&t.kty==="oct"&&typeof t.k=="string"}o(G1,"isSecretJWK");function dS(t){let e,r;switch(t.kty){case"RSA":{switch(t.alg){case"PS256":case"PS384":case"PS512":e={name:"RSA-PSS",hash:`SHA-${t.alg.slice(-3)}`},r=t.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":e={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${t.alg.slice(-3)}`},r=t.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":e={name:"RSA-OAEP",hash:`SHA-${parseInt(t.alg.slice(-3),10)||1}`},r=t.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new pe('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(t.alg){case"ES256":e={name:"ECDSA",namedCurve:"P-256"},r=t.d?["sign"]:["verify"];break;case"ES384":e={name:"ECDSA",namedCurve:"P-384"},r=t.d?["sign"]:["verify"];break;case"ES512":e={name:"ECDSA",namedCurve:"P-521"},r=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:"ECDH",namedCurve:t.crv},r=t.d?["deriveBits"]:[];break;default:throw new pe('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(t.alg){case"Ed25519":e={name:"Ed25519"},r=t.d?["sign"]:["verify"];break;case"EdDSA":e={name:t.crv},r=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:t.crv},r=t.d?["deriveBits"]:[];break;default:throw new pe('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new pe('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:e,keyUsages:r}}o(dS,"subtleMapping");var lS=o(async t=>{if(!t.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:e,keyUsages:r}=dS(t),n=[e,t.ext??!1,t.key_ops??r],i={...t};return delete i.alg,delete i.use,ee.subtle.importKey("jwk",i,...n)},"parse"),dd=lS;var X1=o(t=>Kt(t),"exportKeyValue"),Eo,Po,Z1=o(t=>t?.[Symbol.toStringTag]==="KeyObject","isKeyObject"),ld=o(async(t,e,r,n,i=!1)=>{let s=t.get(e);if(s?.[n])return s[n];let u=await dd({...r,alg:n});return i&&Object.freeze(e),s?s[n]=u:t.set(e,{[n]:u}),u},"importAndCache"),pS=o((t,e)=>{if(Z1(t)){let r=t.export({format:"jwk"});return delete r.d,delete r.dp,delete r.dq,delete r.p,delete r.q,delete r.qi,r.k?X1(r.k):(Po||(Po=new WeakMap),ld(Po,t,r,e))}return Gr(t)?t.k?Kt(t.k):(Po||(Po=new WeakMap),ld(Po,t,t,e,!0)):t},"normalizePublicKey"),hS=o((t,e)=>{if(Z1(t)){let r=t.export({format:"jwk"});return r.k?X1(r.k):(Eo||(Eo=new WeakMap),ld(Eo,t,r,e))}return Gr(t)?t.k?Kt(t.k):(Eo||(Eo=new WeakMap),ld(Eo,t,t,e,!0)):t},"normalizePrivateKey"),Wa={normalizePublicKey:pS,normalizePrivateKey:hS};function kh(t){switch(t){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new pe(`Unsupported JWE Algorithm: ${t}`)}}o(kh,"bitLength");var To=o(t=>So(new Uint8Array(kh(t)>>3)),"default");var Q1=o((t,e)=>{let r=(t.match(/.{1,64}/g)||[]).join(`
8
+ `);return`-----BEGIN ${e}-----
9
+ ${r}
10
+ -----END ${e}-----`},"default");var In=o((t,e,r=0)=>{r===0&&(e.unshift(e.length),e.unshift(6));let n=t.indexOf(e[0],r);if(n===-1)return!1;let i=t.subarray(n,n+e.length);return i.length!==e.length?!1:i.every((s,u)=>s===e[u])||In(t,e,n+1)},"findOid"),Y1=o(t=>{switch(!0){case In(t,[42,134,72,206,61,3,1,7]):return"P-256";case In(t,[43,129,4,0,34]):return"P-384";case In(t,[43,129,4,0,35]):return"P-521";case In(t,[43,101,110]):return"X25519";case In(t,[43,101,111]):return"X448";case In(t,[43,101,112]):return"Ed25519";case In(t,[43,101,113]):return"Ed448";default:throw new pe("Invalid or unsupported EC Key Curve or OKP Key Sub Type")}},"getNamedCurve"),yS=o(async(t,e,r,n,i)=>{let s,u,a=new Uint8Array(atob(r.replace(t,"")).split("").map(d=>d.charCodeAt(0))),c=e==="spki";switch(n){case"PS256":case"PS384":case"PS512":s={name:"RSA-PSS",hash:`SHA-${n.slice(-3)}`},u=c?["verify"]:["sign"];break;case"RS256":case"RS384":case"RS512":s={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${n.slice(-3)}`},u=c?["verify"]:["sign"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":s={name:"RSA-OAEP",hash:`SHA-${parseInt(n.slice(-3),10)||1}`},u=c?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":s={name:"ECDSA",namedCurve:"P-256"},u=c?["verify"]:["sign"];break;case"ES384":s={name:"ECDSA",namedCurve:"P-384"},u=c?["verify"]:["sign"];break;case"ES512":s={name:"ECDSA",namedCurve:"P-521"},u=c?["verify"]:["sign"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{let d=Y1(a);s=d.startsWith("P-")?{name:"ECDH",namedCurve:d}:{name:d},u=c?[]:["deriveBits"];break}case"Ed25519":s={name:"Ed25519"},u=c?["verify"]:["sign"];break;case"EdDSA":s={name:Y1(a)},u=c?["verify"]:["sign"];break;default:throw new pe('Invalid or unsupported "alg" (Algorithm) value')}return ee.subtle.importKey(e,a,s,i?.extractable??!1,u)},"genericImport");var tw=o((t,e,r)=>yS(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,"spki",t,e,r),"fromSPKI");function ew(t){let e=[],r=0;for(;r<t.length;){let n=rw(t.subarray(r));e.push(n),r+=n.byteLength}return e}o(ew,"getElement");function rw(t){let e=0,r=t[0]&31;if(e++,r===31){for(r=0;t[e]>=128;)r=r*128+t[e]-128,e++;r=r*128+t[e]-128,e++}let n=0;if(t[e]<128)n=t[e],e++;else if(n===128){for(n=0;t[e+n]!==0||t[e+n+1]!==0;){if(n>t.byteLength)throw new TypeError("invalid indefinite form length");n++}let s=e+n+2;return{byteLength:s,contents:t.subarray(e,e+n),raw:t.subarray(0,s)}}else{let s=t[e]&127;e++,n=0;for(let u=0;u<s;u++)n=n*256+t[e],e++}let i=e+n;return{byteLength:i,contents:t.subarray(e,i),raw:t.subarray(0,i)}}o(rw,"parseElement");function mS(t){let e=ew(ew(rw(t).contents)[0].contents);return Zp(e[e[0].raw[0]===160?6:5].raw)}o(mS,"spkiFromX509");function gS(t){let e=t.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g,""),r=Qp(e);return Q1(mS(r),"PUBLIC KEY")}o(gS,"getSPKI");var nw=o((t,e,r)=>{let n;try{n=gS(t)}catch(i){throw new TypeError("Failed to parse the X.509 certificate",{cause:i})}return tw(n,e,r)},"fromX509");async function pd(t,e,r){if(typeof t!="string"||t.indexOf("-----BEGIN CERTIFICATE-----")!==0)throw new TypeError('"x509" must be X.509 formatted string');return nw(t,e,r)}o(pd,"importX509");async function Xr(t,e){if(!nt(t))throw new TypeError("JWK must be an object");switch(e||(e=t.alg),t.kty){case"oct":if(typeof t.k!="string"||!t.k)throw new TypeError('missing "k" (Key Value) Parameter value');return Kt(t.k);case"RSA":if("oth"in t&&t.oth!==void 0)throw new pe('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return dd({...t,alg:e});default:throw new pe('Unsupported "kty" (Key Type) Parameter value')}}o(Xr,"importJWK");var Io=o(t=>t?.[Symbol.toStringTag],"tag"),Ch=o((t,e,r)=>{if(e.use!==void 0&&e.use!=="sig")throw new TypeError("Invalid key for this operation, when present its use must be sig");if(e.key_ops!==void 0&&e.key_ops.includes?.(r)!==!0)throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${r}`);if(e.alg!==void 0&&e.alg!==t)throw new TypeError(`Invalid key for this operation, when present its alg must be ${t}`);return!0},"jwkMatchesOp"),vS=o((t,e,r,n)=>{if(!(e instanceof Uint8Array)){if(n&&Gr(e)){if(G1(e)&&Ch(t,e,r))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!Ah(e))throw new TypeError(xh(t,e,...qe,"Uint8Array",n?"JSON Web Key":null));if(e.type!=="secret")throw new TypeError(`${Io(e)} instances for symmetric algorithms must be of type "secret"`)}},"symmetricTypeCheck"),bS=o((t,e,r,n)=>{if(n&&Gr(e))switch(r){case"sign":if(J1(e)&&Ch(t,e,r))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(z1(e)&&Ch(t,e,r))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!Ah(e))throw new TypeError(xh(t,e,...qe,n?"JSON Web Key":null));if(e.type==="secret")throw new TypeError(`${Io(e)} instances for asymmetric algorithms must not be of type "secret"`);if(r==="sign"&&e.type==="public")throw new TypeError(`${Io(e)} instances for asymmetric algorithm signing must be of type "private"`);if(r==="decrypt"&&e.type==="public")throw new TypeError(`${Io(e)} instances for asymmetric algorithm decryption must be of type "private"`);if(e.algorithm&&r==="verify"&&e.type==="private")throw new TypeError(`${Io(e)} instances for asymmetric algorithm verifying must be of type "public"`);if(e.algorithm&&r==="encrypt"&&e.type==="private")throw new TypeError(`${Io(e)} instances for asymmetric algorithm encryption must be of type "public"`)},"asymmetricTypeCheck");function iw(t,e,r,n){e.startsWith("HS")||e==="dir"||e.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(e)?vS(e,r,n,t):bS(e,r,n,t)}o(iw,"checkKeyType");var ow=iw.bind(void 0,!1),Fa=iw.bind(void 0,!0);async function wS(t,e,r,n,i){if(!(r instanceof Uint8Array))throw new TypeError(Fe(r,"Uint8Array"));let s=parseInt(t.slice(1,4),10),u=await ee.subtle.importKey("raw",r.subarray(s>>3),"AES-CBC",!1,["encrypt"]),a=await ee.subtle.importKey("raw",r.subarray(0,s>>3),{hash:`SHA-${s<<1}`,name:"HMAC"},!1,["sign"]),c=new Uint8Array(await ee.subtle.encrypt({iv:n,name:"AES-CBC"},u,e)),d=Ft(i,n,c,B1(i.length<<3)),p=new Uint8Array((await ee.subtle.sign("HMAC",a,d)).slice(0,s>>3));return{ciphertext:c,tag:p,iv:n}}o(wS,"cbcEncrypt");async function _S(t,e,r,n,i){let s;r instanceof Uint8Array?s=await ee.subtle.importKey("raw",r,"AES-GCM",!1,["encrypt"]):(ar(r,t,"encrypt"),s=r);let u=new Uint8Array(await ee.subtle.encrypt({additionalData:i,iv:n,name:"AES-GCM",tagLength:128},s,e)),a=u.slice(-16);return{ciphertext:u.slice(0,-16),tag:a,iv:n}}o(_S,"gcmEncrypt");var xS=o(async(t,e,r,n,i)=>{if(!Me(r)&&!(r instanceof Uint8Array))throw new TypeError(Fe(r,...qe,"Uint8Array"));switch(n?M1(t,n):n=q1(t),t){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return r instanceof Uint8Array&&_h(r,parseInt(t.slice(-3),10)),wS(t,e,r,n,i);case"A128GCM":case"A192GCM":case"A256GCM":return r instanceof Uint8Array&&_h(r,parseInt(t.slice(1,4),10)),_S(t,e,r,n,i);default:throw new pe("Unsupported JWE Content Encryption Algorithm")}},"encrypt"),hd=xS;async function sw(t,e,r,n){let i=t.slice(0,7),s=await hd(i,r,e,n,new Uint8Array(0));return{encryptedKey:s.ciphertext,iv:Ie(s.iv),tag:Ie(s.tag)}}o(sw,"wrap");function AS(t,e,r,n,i){if(i.crit!==void 0&&n?.crit===void 0)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||n.crit===void 0)return new Set;if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some(u=>typeof u!="string"||u.length===0))throw new t('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let s;r!==void 0?s=new Map([...Object.entries(r),...e.entries()]):s=e;for(let u of n.crit){if(!s.has(u))throw new pe(`Extension Header Parameter "${u}" is not recognized`);if(i[u]===void 0)throw new t(`Extension Header Parameter "${u}" is missing`);if(s.get(u)&&n[u]===void 0)throw new t(`Extension Header Parameter "${u}" MUST be integrity protected`)}return new Set(n.crit)}o(AS,"validateCrit");var Oo=AS;var SS=o((t,e)=>{if(e!==void 0&&(!Array.isArray(e)||e.some(r=>typeof r!="string")))throw new TypeError(`"${t}" option must be an array of strings`);if(e)return new Set(e)},"validateAlgorithms"),uw=SS;var aw=Symbol();var kS=o(async t=>{if(t instanceof Uint8Array)return{kty:"oct",k:Ie(t)};if(!Me(t))throw new TypeError(Fe(t,...qe,"Uint8Array"));if(!t.extractable)throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");let{ext:e,key_ops:r,alg:n,use:i,...s}=await ee.subtle.exportKey("jwk",t);return s},"keyToJWK"),cw=kS;async function fw(t){return cw(t)}o(fw,"exportJWK");async function CS(t,e,r,n,i={}){let s,u,a;switch(ow(t,r,"encrypt"),r=await Wa.normalizePublicKey?.(r,t)||r,t){case"dir":{a=r;break}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!W1(r))throw new pe("ECDH with the provided key is not allowed or not supported by your javascript runtime");let{apu:c,apv:d}=i,{epk:p}=i;p||(p=(await L1(r)).privateKey);let{x:y,y:v,crv:x,kty:A}=await fw(p),B=await H1(r,p,t==="ECDH-ES"?e:t,t==="ECDH-ES"?kh(e):parseInt(t.slice(-5,-2),10),c,d);if(u={epk:{x:y,crv:x,kty:A}},A==="EC"&&(u.epk.y=v),c&&(u.apu=Ie(c)),d&&(u.apv=Ie(d)),t==="ECDH-ES"){a=B;break}a=n||To(e);let I=t.slice(-6);s=await La(I,B,a);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{a=n||To(e),s=await K1(t,r,a);break}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{a=n||To(e);let{p2c:c,p2s:d}=i;({encryptedKey:s,...u}=await F1(t,r,a,c,d));break}case"A128KW":case"A192KW":case"A256KW":{a=n||To(e),s=await La(t,r,a);break}case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{a=n||To(e);let{iv:c}=i;({encryptedKey:s,...u}=await sw(t,r,a,c));break}default:throw new pe('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek:a,encryptedKey:s,parameters:u}}o(CS,"encryptKeyManagement");var dw=CS;var Eh=class Eh{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("plaintext must be an instance of Uint8Array");this._plaintext=e}setKeyManagementParameters(e){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._sharedUnprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}setContentEncryptionKey(e){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=e,this}async encrypt(e,r){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new lt("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!ko(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new lt("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");let n={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if(Oo(lt,new Map,r?.crit,this._protectedHeader,n),n.zip!==void 0)throw new pe('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');let{alg:i,enc:s}=n;if(typeof i!="string"||!i)throw new lt('JWE "alg" (Algorithm) Header Parameter missing or invalid');if(typeof s!="string"||!s)throw new lt('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let u;if(this._cek&&(i==="dir"||i==="ECDH-ES"))throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${i}`);let a;{let B;({cek:a,encryptedKey:u,parameters:B}=await dw(i,s,e,this._cek,this._keyManagementParameters)),B&&(r&&aw in r?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...B}:this.setUnprotectedHeader(B):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...B}:this.setProtectedHeader(B))}let c,d,p;this._protectedHeader?d=Te.encode(Ie(JSON.stringify(this._protectedHeader))):d=Te.encode(""),this._aad?(p=Ie(this._aad),c=Ft(d,Te.encode("."),Te.encode(p))):c=d;let{ciphertext:y,tag:v,iv:x}=await hd(s,this._plaintext,a,this._iv,c),A={ciphertext:Ie(y)};return x&&(A.iv=Ie(x)),v&&(A.tag=Ie(v)),u&&(A.encrypted_key=Ie(u)),p&&(A.aad=p),this._protectedHeader&&(A.protected=Ge.decode(d)),this._sharedUnprotectedHeader&&(A.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(A.header=this._unprotectedHeader),A}};o(Eh,"FlattenedEncrypt");var yd=Eh;function Ka(t,e){let r=`SHA-${t.slice(-3)}`;switch(t){case"HS256":case"HS384":case"HS512":return{hash:r,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:r,name:"RSA-PSS",saltLength:t.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:r,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:r,name:"ECDSA",namedCurve:e.namedCurve};case"Ed25519":return{name:"Ed25519"};case"EdDSA":return{name:e.name};default:throw new pe(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}o(Ka,"subtleDsa");async function Ja(t,e,r){if(r==="sign"&&(e=await Wa.normalizePrivateKey(e,t)),r==="verify"&&(e=await Wa.normalizePublicKey(e,t)),Me(e))return $1(e,t,r),e;if(e instanceof Uint8Array){if(!t.startsWith("HS"))throw new TypeError(Fe(e,...qe));return ee.subtle.importKey("raw",e,{hash:`SHA-${t.slice(-3)}`,name:"HMAC"},!1,[r])}throw new TypeError(Fe(e,...qe,"Uint8Array","JSON Web Key"))}o(Ja,"getCryptoKey");var ES=o(async(t,e,r,n)=>{let i=await Ja(t,e,"verify");Co(t,i);let s=Ka(t,i.algorithm);try{return await ee.subtle.verify(s,i,r,n)}catch{return!1}},"verify"),lw=ES;async function pw(t,e,r){if(!nt(t))throw new me("Flattened JWS must be an object");if(t.protected===void 0&&t.header===void 0)throw new me('Flattened JWS must have either of the "protected" or "header" members');if(t.protected!==void 0&&typeof t.protected!="string")throw new me("JWS Protected Header incorrect type");if(t.payload===void 0)throw new me("JWS Payload missing");if(typeof t.signature!="string")throw new me("JWS Signature missing or incorrect type");if(t.header!==void 0&&!nt(t.header))throw new me("JWS Unprotected Header incorrect type");let n={};if(t.protected)try{let B=Kt(t.protected);n=JSON.parse(Ge.decode(B))}catch{throw new me("JWS Protected Header is invalid")}if(!ko(n,t.header))throw new me("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let i={...n,...t.header},s=Oo(me,new Map([["b64",!0]]),r?.crit,n,i),u=!0;if(s.has("b64")&&(u=n.b64,typeof u!="boolean"))throw new me('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:a}=i;if(typeof a!="string"||!a)throw new me('JWS "alg" (Algorithm) Header Parameter missing or invalid');let c=r&&uw("algorithms",r.algorithms);if(c&&!c.has(a))throw new Va('"alg" (Algorithm) Header Parameter value not allowed');if(u){if(typeof t.payload!="string")throw new me("JWS Payload must be a string")}else if(typeof t.payload!="string"&&!(t.payload instanceof Uint8Array))throw new me("JWS Payload must be a string or an Uint8Array instance");let d=!1;typeof e=="function"?(e=await e(n,t),d=!0,Fa(a,e,"verify"),Gr(e)&&(e=await Xr(e,a))):Fa(a,e,"verify");let p=Ft(Te.encode(t.protected??""),Te.encode("."),typeof t.payload=="string"?Te.encode(t.payload):t.payload),y;try{y=Kt(t.signature)}catch{throw new me("Failed to base64url decode the signature")}if(!await lw(a,e,y,p))throw new Ha;let x;if(u)try{x=Kt(t.payload)}catch{throw new me("Failed to base64url decode the payload")}else typeof t.payload=="string"?x=Te.encode(t.payload):x=t.payload;let A={payload:x};return t.protected!==void 0&&(A.protectedHeader=n),t.header!==void 0&&(A.unprotectedHeader=t.header),d?{...A,key:e}:A}o(pw,"flattenedVerify");async function hw(t,e,r){if(t instanceof Uint8Array&&(t=Ge.decode(t)),typeof t!="string")throw new me("Compact JWS must be a string or Uint8Array");let{0:n,1:i,2:s,length:u}=t.split(".");if(u!==3)throw new me("Invalid Compact JWS");let a=await pw({payload:i,protected:n,signature:s},e,r),c={payload:a.payload,protectedHeader:a.protectedHeader};return typeof e=="function"?{...c,key:a.key}:c}o(hw,"compactVerify");var Cr=o(t=>Math.floor(t.getTime()/1e3),"default");var PS=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,pi=o(t=>{let e=PS.exec(t);if(!e||e[4]&&e[1])throw new TypeError("Invalid time period format");let r=parseFloat(e[2]),n=e[3].toLowerCase(),i;switch(n){case"sec":case"secs":case"second":case"seconds":case"s":i=Math.round(r);break;case"minute":case"minutes":case"min":case"mins":case"m":i=Math.round(r*60);break;case"hour":case"hours":case"hr":case"hrs":case"h":i=Math.round(r*3600);break;case"day":case"days":case"d":i=Math.round(r*86400);break;case"week":case"weeks":case"w":i=Math.round(r*604800);break;default:i=Math.round(r*31557600);break}return e[1]==="-"||e[4]==="ago"?-i:i},"default");var yw=o(t=>t.toLowerCase().replace(/^application\//,""),"normalizeTyp"),TS=o((t,e)=>typeof t=="string"?e.includes(t):Array.isArray(t)?e.some(Set.prototype.has.bind(new Set(t))):!1,"checkAudiencePresence"),mw=o((t,e,r={})=>{let n;try{n=JSON.parse(Ge.decode(e))}catch{}if(!nt(n))throw new Ze("JWT Claims Set must be a top-level JSON object");let{typ:i}=r;if(i&&(typeof t.typ!="string"||yw(t.typ)!==yw(i)))throw new At('unexpected "typ" JWT header value',n,"typ","check_failed");let{requiredClaims:s=[],issuer:u,subject:a,audience:c,maxTokenAge:d}=r,p=[...s];d!==void 0&&p.push("iat"),c!==void 0&&p.push("aud"),a!==void 0&&p.push("sub"),u!==void 0&&p.push("iss");for(let A of new Set(p.reverse()))if(!(A in n))throw new At(`missing required "${A}" claim`,n,A,"missing");if(u&&!(Array.isArray(u)?u:[u]).includes(n.iss))throw new At('unexpected "iss" claim value',n,"iss","check_failed");if(a&&n.sub!==a)throw new At('unexpected "sub" claim value',n,"sub","check_failed");if(c&&!TS(n.aud,typeof c=="string"?[c]:c))throw new At('unexpected "aud" claim value',n,"aud","check_failed");let y;switch(typeof r.clockTolerance){case"string":y=pi(r.clockTolerance);break;case"number":y=r.clockTolerance;break;case"undefined":y=0;break;default:throw new TypeError("Invalid clockTolerance option type")}let{currentDate:v}=r,x=Cr(v||new Date);if((n.iat!==void 0||d)&&typeof n.iat!="number")throw new At('"iat" claim must be a number',n,"iat","invalid");if(n.nbf!==void 0){if(typeof n.nbf!="number")throw new At('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>x+y)throw new At('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(n.exp!==void 0){if(typeof n.exp!="number")throw new At('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=x-y)throw new Ao('"exp" claim timestamp check failed',n,"exp","check_failed")}if(d){let A=x-n.iat,B=typeof d=="number"?d:pi(d);if(A-y>B)throw new Ao('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(A<0-y)throw new At('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n},"default");async function za(t,e,r){let n=await hw(t,e,r);if(n.protectedHeader.crit?.includes("b64")&&n.protectedHeader.b64===!1)throw new Ze("JWTs MUST NOT use unencoded payload");let s={payload:mw(n.protectedHeader,n.payload,r),protectedHeader:n.protectedHeader};return typeof e=="function"?{...s,key:n.key}:s}o(za,"jwtVerify");var Ph=class Ph{constructor(e){this._flattened=new yd(e)}setContentEncryptionKey(e){return this._flattened.setContentEncryptionKey(e),this}setInitializationVector(e){return this._flattened.setInitializationVector(e),this}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}setKeyManagementParameters(e){return this._flattened.setKeyManagementParameters(e),this}async encrypt(e,r){let n=await this._flattened.encrypt(e,r);return[n.protected,n.encrypted_key,n.iv,n.ciphertext,n.tag].join(".")}};o(Ph,"CompactEncrypt");var Ga=Ph;var IS=o(async(t,e,r)=>{let n=await Ja(t,e,"sign");Co(t,n);let i=await ee.subtle.sign(Ka(t,n.algorithm),n,r);return new Uint8Array(i)},"sign"),gw=IS;var Th=class Th{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}async sign(e,r){if(!this._protectedHeader&&!this._unprotectedHeader)throw new me("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!ko(this._protectedHeader,this._unprotectedHeader))throw new me("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let n={...this._protectedHeader,...this._unprotectedHeader},i=Oo(me,new Map([["b64",!0]]),r?.crit,this._protectedHeader,n),s=!0;if(i.has("b64")&&(s=this._protectedHeader.b64,typeof s!="boolean"))throw new me('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:u}=n;if(typeof u!="string"||!u)throw new me('JWS "alg" (Algorithm) Header Parameter missing or invalid');Fa(u,e,"sign");let a=this._payload;s&&(a=Te.encode(Ie(a)));let c;this._protectedHeader?c=Te.encode(Ie(JSON.stringify(this._protectedHeader))):c=Te.encode("");let d=Ft(c,Te.encode("."),a),p=await gw(u,e,d),y={signature:Ie(p),payload:""};return s&&(y.payload=Ge.decode(a)),this._unprotectedHeader&&(y.header=this._unprotectedHeader),this._protectedHeader&&(y.protected=Ge.decode(c)),y}};o(Th,"FlattenedSign");var md=Th;var Ih=class Ih{constructor(e){this._flattened=new md(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,r){let n=await this._flattened.sign(e,r);if(n.payload===void 0)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${n.protected}.${n.payload}.${n.signature}`}};o(Ih,"CompactSign");var gd=Ih;function hi(t,e){if(!Number.isFinite(e))throw new TypeError(`Invalid ${t} input`);return e}o(hi,"validateInput");var Oh=class Oh{constructor(e={}){if(!nt(e))throw new TypeError("JWT Claims Set MUST be an object");this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return typeof e=="number"?this._payload={...this._payload,nbf:hi("setNotBefore",e)}:e instanceof Date?this._payload={...this._payload,nbf:hi("setNotBefore",Cr(e))}:this._payload={...this._payload,nbf:Cr(new Date)+pi(e)},this}setExpirationTime(e){return typeof e=="number"?this._payload={...this._payload,exp:hi("setExpirationTime",e)}:e instanceof Date?this._payload={...this._payload,exp:hi("setExpirationTime",Cr(e))}:this._payload={...this._payload,exp:Cr(new Date)+pi(e)},this}setIssuedAt(e){return typeof e>"u"?this._payload={...this._payload,iat:Cr(new Date)}:e instanceof Date?this._payload={...this._payload,iat:hi("setIssuedAt",Cr(e))}:typeof e=="string"?this._payload={...this._payload,iat:hi("setIssuedAt",Cr(new Date)+pi(e))}:this._payload={...this._payload,iat:hi("setIssuedAt",e)},this}};o(Oh,"ProduceJWT");var vd=Oh;var Rh=class Rh extends vd{setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,r){let n=new gd(Te.encode(JSON.stringify(this._payload)));if(n.setProtectedHeader(this._protectedHeader),Array.isArray(this._protectedHeader?.crit)&&this._protectedHeader.crit.includes("b64")&&this._protectedHeader.b64===!1)throw new Ze("JWTs MUST NOT use unencoded payload");return n.sign(e,r)}};o(Rh,"SignJWT");var Xa=Rh;var bd=Kt;function jh(t){let e;if(typeof t=="string"){let r=t.split(".");(r.length===3||r.length===5)&&([e]=r)}else if(typeof t=="object"&&t)if("protected"in t)e=t.protected;else throw new TypeError("Token does not contain a Protected Header");try{if(typeof e!="string"||!e)throw new Error;let r=JSON.parse(Ge.decode(bd(e)));if(!nt(r))throw new Error;return r}catch{throw new TypeError("Invalid Token or Protected Header formatting")}}o(jh,"decodeProtectedHeader");function Nh(t){if(typeof t!="string")throw new Ze("JWTs must use Compact JWS serialization, JWT must be a string");let{1:e,length:r}=t.split(".");if(r===5)throw new Ze("Only JWTs using Compact JWS serialization can be decoded");if(r!==3)throw new Ze("Invalid JWT");if(!e)throw new Ze("JWTs must contain a payload");let n;try{n=bd(e)}catch{throw new Ze("Failed to base64url decode the payload")}let i;try{i=JSON.parse(Ge.decode(n))}catch{throw new Ze("Failed to parse the decoded payload as JSON")}if(!nt(i))throw new Ze("Invalid JWT Claims Set");return i}o(Nh,"decodeJwt");var vw="openid4vci-proof+jwt",Za=o(async t=>{let{signer:e,audience:r,nonce:n,clientId:i}=t,s=t.now??(()=>Math.floor(Date.now()/1e3));if(typeof r!="string"||r.length===0)throw new N("proof_signing_failed","Proof JWT `audience` must be a non-empty string");let u={alg:e.alg,kid:e.kid,typ:vw},a={aud:r,iat:s()};typeof n=="string"&&n.length>0&&(a.nonce=n),typeof i=="string"&&i.length>0&&(a.iss=i);try{return await e.sign(u,a)}catch(c){throw new N("proof_signing_failed",`Failed to sign proof JWT: ${c instanceof Error?c.message:String(c)}`,{cause:c})}},"buildProofJwt"),wd=o(async t=>{let{keypair:e,kid:r}=t;if(e.kty!=="OKP"||e.crv!=="Ed25519")throw new N("proof_signing_failed",`createJoseEd25519Signer only supports Ed25519 OKP keys (got kty=${e.kty}, crv=${e.crv})`);let n=await Xr({kty:e.kty,crv:e.crv,x:e.x,d:e.d},"EdDSA");return{alg:"EdDSA",kid:r,sign:o(async(i,s)=>new Xa(s).setProtectedHeader({...i,alg:"EdDSA"}).sign(n),"sign")}},"createJoseEd25519Signer");var Qa=o(async t=>{let{credentialEndpoint:e,accessToken:r,tokenType:n="Bearer",credentialIdentifier:i,format:s,proofJwt:u,extra:a}=t,c=t.fetchImpl??globalThis.fetch;if(typeof c!="function")throw new N("credential_request_failed","No fetch implementation available for credential request");let d=typeof i=="string"&&i.length>0,p=typeof s=="string"&&s.length>0;if(!d&&!p)throw new N("credential_request_failed","requestCredential requires either `credentialIdentifier` (from authorization_details) or `format`");let y={proof:{proof_type:"jwt",jwt:u}};d?y.credential_identifier=i:(y.format=s,a&&Object.assign(y,a));let v;try{v=await c(e,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:`${n} ${r}`},body:JSON.stringify(y)})}catch(A){throw new N("credential_request_failed",`Credential endpoint ${e} unreachable: ${A instanceof Error?A.message:String(A)}`,{cause:A})}let x;try{x=await v.json()}catch(A){throw new N("credential_response_invalid",`Credential endpoint ${e} returned non-JSON body`,{status:v.status,cause:A})}if(!v.ok){let A=x,B=typeof A?.error=="string"?A.error:"unknown",I=typeof A?.error_description=="string"?`: ${A.error_description}`:"";throw new N("credential_request_failed",`Credential endpoint returned ${v.status} (${B})${I}`,{status:v.status,body:x})}if(typeof x!="object"||x===null)throw new N("credential_response_invalid","Credential endpoint response was not a JSON object",{status:v.status,body:x});return x},"requestCredential");var _d=o(async t=>{let{offer:e,signer:r}=t,n=t.options??{},i=t.fetchImpl??globalThis.fetch,s=e.grants?.[Tn];if(!s)throw new N("unsupported_grant","acceptCredentialOffer currently only handles the pre-authorized_code grant. For authorization_code flows, use slice-4 APIs (not yet shipped).");if(s.tx_code&&!n.txCode)throw new N("tx_code_required","Offer requires a transaction code but none was supplied in options.txCode");let u=n.configurationIds&&n.configurationIds.length>0?n.configurationIds.filter(J=>e.credential_configuration_ids.includes(J)):e.credential_configuration_ids;if(u.length===0)throw new N("unsupported_format","No credential configuration ids in the offer matched the caller-supplied filter");let a=await Ma(e.credential_issuer,i),c=$a(a,s.authorization_server),d=await Ua(c,i),p=await Gp({tokenEndpoint:d.token_endpoint,preAuthorizedCode:s["pre-authorized_code"],txCode:n.txCode,clientId:n.clientId,fetchImpl:i}),y=await Za({signer:r,audience:e.credential_issuer,nonce:p.c_nonce,clientId:n.clientId}),v=[],x,A=p.c_nonce,B=p.c_nonce_expires_in,I=BS(p.authorization_details);for(let J of u){let de=RS(a,J),fe=jS(de),ve=I.get(J)??[],Y=ve.length>0?ve.map(ye=>({credentialIdentifier:ye})):[{credentialIdentifier:void 0}];for(let ye of Y){let ae=await Qa({credentialEndpoint:a.credential_endpoint,accessToken:p.access_token,tokenType:p.token_type,credentialIdentifier:ye.credentialIdentifier,format:ye.credentialIdentifier?void 0:fe,extra:ye.credentialIdentifier?void 0:NS(de,fe),proofJwt:y,fetchImpl:i});if(!ae.credential&&!Array.isArray(ae.credentials))throw new N("unsupported_format","Credential endpoint returned neither `credential` nor `credentials`; deferred issuance not supported yet",{body:ae});if(ae.credential!==void 0&&v.push({format:fe,credential:ae.credential,configuration_id:J}),Array.isArray(ae.credentials))for(let Ne of ae.credentials)Ne&&typeof Ne=="object"&&"credential"in Ne&&v.push({format:fe,credential:Ne.credential,configuration_id:J});typeof ae.notification_id=="string"&&(x=ae.notification_id),typeof ae.c_nonce=="string"&&(A=ae.c_nonce,B=typeof ae.c_nonce_expires_in=="number"?ae.c_nonce_expires_in:void 0)}}return{credentials:v,notification_id:x,c_nonce:A,c_nonce_expires_in:B}},"acceptCredentialOffer"),RS=o((t,e)=>{let r=t.credential_configurations_supported;if(!r||typeof r!="object"||!(e in r))return;let n=r[e];if(!(!n||typeof n!="object"))return n},"getConfigurationDefinition"),jS=o(t=>t&&typeof t.format=="string"&&t.format.length>0?t.format:"jwt_vc_json","inferFormatFromDefinition"),NS=o((t,e)=>{if(t&&(e==="jwt_vc_json"||e==="jwt_vc_json-ld"||e==="ldp_vc")){let r=t.credential_definition;if(r&&typeof r=="object")return{credential_definition:r}}},"buildFormatSpecificBody"),BS=o(t=>{let e=new Map;if(!Array.isArray(t))return e;for(let r of t){if(!r||typeof r!="object")continue;let n=r,i=n.credential_configuration_id,s=n.credential_identifiers;if(typeof i!="string"||!Array.isArray(s))continue;let u=s.filter(a=>typeof a=="string");u.length>0&&e.set(i,u)}return e},"indexAuthorizationDetails");var qh=class qh extends Error{constructor(e,r){super(r),this.name="PkceError",this.code=e}};o(qh,"PkceError");var On=qh,Bh=o(async(t={})=>{let e=t.byteLength??32;if(e<24||e>96)throw new On("invalid_verifier",`PKCE byteLength must be between 24 and 96 (got ${e})`);let r=bw(qS(e)),n=await Dh(r);return{verifier:r,challenge:n,method:"S256"}},"generatePkcePair"),Dh=o(async t=>{if(typeof t!="string"||t.length<24)throw new On("invalid_verifier","PKCE verifier must be a base64url string with \u226524 chars");let e=new TextEncoder().encode(t),r=await MS().digest("SHA-256",e);return bw(new Uint8Array(r))},"computeS256Challenge"),DS=o(async t=>{let e=t.method??"S256";if(e!=="S256")throw new On("unsupported_method",`PKCE method ${e} not supported`);return await Dh(t.verifier)===t.challenge},"verifyPkce"),bw=o(t=>{if(typeof Buffer<"u")return Buffer.from(t).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},"toB64url"),qS=o(t=>{let e=new Uint8Array(t);return ww().getRandomValues(e),e},"getRandomBytes"),ww=o(()=>{let t=globalThis.crypto;if(!t)throw new On("invalid_verifier","Web Crypto API not available in this runtime");return t},"getCrypto"),MS=o(()=>{let t=ww().subtle;if(!t)throw new On("invalid_verifier","crypto.subtle not available in this runtime");return t},"getSubtle");var Mh="authorization_code",Uh=o(async t=>{let e=t.fetchImpl??globalThis.fetch;if(!t.clientId||t.clientId.length===0)throw new N("token_request_failed","beginAuthCodeFlow requires a non-empty `clientId` \u2014 the AS cannot track the request otherwise");if(!t.redirectUri||t.redirectUri.length===0)throw new N("token_request_failed","beginAuthCodeFlow requires a non-empty `redirectUri`");let r=t.offer.grants?.[Mh];if(!r)throw new N("unsupported_grant","Offer does not advertise the authorization_code grant. Use acceptCredentialOffer for pre-auth offers.");let n=$S(t.offer,t.configurationIds),i=await Ma(t.offer.credential_issuer,e),s=$a(i,r.authorization_server),u=await Ua(s,e);if(typeof u.authorization_endpoint!="string")throw new N("metadata_invalid","Authorization server metadata is missing `authorization_endpoint` \u2014 cannot run auth_code flow");let a=await Bh(),c=FS(),d=_w({authorizationEndpoint:u.authorization_endpoint,clientId:t.clientId,redirectUri:t.redirectUri,configurationIds:n,scope:t.scope,pkce:a,state:c,issuerState:typeof r.issuer_state=="string"?r.issuer_state:void 0}),p={version:1,issuer:t.offer.credential_issuer,tokenEndpoint:u.token_endpoint,credentialEndpoint:i.credential_endpoint,configurationIds:n,redirectUri:t.redirectUri,clientId:t.clientId,state:c,pkceVerifier:a.verifier,pkceMethod:a.method,credentialConfigurations:i.credential_configurations_supported??{}};return{authorizationUrl:d,flowHandle:p}},"beginAuthCodeFlow"),$h=o(async t=>{let{flowHandle:e,code:r,signer:n}=t,i=t.fetchImpl??globalThis.fetch;if(t.state&&t.state!==e.state)throw new N("token_request_failed",`State parameter mismatch (callback state=${t.state}, expected ${e.state})`);let s=await xw({tokenEndpoint:e.tokenEndpoint,code:r,codeVerifier:e.pkceVerifier,clientId:e.clientId,redirectUri:e.redirectUri,fetchImpl:i}),u=await Za({signer:n,audience:e.issuer,nonce:s.c_nonce,clientId:e.clientId});return US({flowHandle:e,tokenResponse:s,proofJwt:u,fetchImpl:i})},"completeAuthCodeFlow"),_w=o(t=>{let e=new URL(t.authorizationEndpoint);e.searchParams.set("response_type","code"),e.searchParams.set("client_id",t.clientId),e.searchParams.set("redirect_uri",t.redirectUri),e.searchParams.set("code_challenge",t.pkce.challenge),e.searchParams.set("code_challenge_method",t.pkce.method),e.searchParams.set("state",t.state);let r=t.configurationIds.map(n=>({type:"openid_credential",credential_configuration_id:n}));return e.searchParams.set("authorization_details",JSON.stringify(r)),t.scope&&e.searchParams.set("scope",t.scope),t.issuerState&&e.searchParams.set("issuer_state",t.issuerState),e.toString()},"buildAuthorizationUrl"),xw=o(async t=>{let{tokenEndpoint:e,code:r,codeVerifier:n,clientId:i,redirectUri:s}=t,u=t.fetchImpl??globalThis.fetch;if(typeof u!="function")throw new N("token_request_failed","No fetch implementation available for authorization_code token exchange");let a=new URLSearchParams;a.set("grant_type",Mh),a.set("code",r),a.set("code_verifier",n),a.set("client_id",i),a.set("redirect_uri",s);let c;try{c=await u(e,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:a.toString()})}catch(p){throw new N("token_request_failed",`Token endpoint ${e} unreachable: ${p instanceof Error?p.message:String(p)}`,{cause:p})}let d;try{d=await c.json()}catch(p){throw new N("token_response_invalid",`Token endpoint ${e} returned non-JSON body`,{status:c.status,cause:p})}if(!c.ok){let p=d,y=typeof p?.error=="string"?p.error:"unknown",v=typeof p?.error_description=="string"?`: ${p.error_description}`:"";throw new N("token_request_failed",`Token endpoint returned ${c.status} (${y})${v}`,{status:c.status,body:d})}if(!WS(d))throw new N("token_response_invalid","Token endpoint response is missing required `access_token` / `token_type`",{status:c.status,body:d});return d},"exchangeAuthorizationCode"),US=o(async t=>{let e=[],r,n=t.tokenResponse.c_nonce,i=t.tokenResponse.c_nonce_expires_in,s=LS(t.tokenResponse.authorization_details);for(let u of t.flowHandle.configurationIds){let a=t.flowHandle.credentialConfigurations[u],c=VS(a),d=s.get(u)??[],p=d.length>0?d.map(y=>({credentialIdentifier:y})):[{credentialIdentifier:void 0}];for(let y of p){let v=await Qa({credentialEndpoint:t.flowHandle.credentialEndpoint,accessToken:t.tokenResponse.access_token,tokenType:t.tokenResponse.token_type,credentialIdentifier:y.credentialIdentifier,format:y.credentialIdentifier?void 0:c,extra:y.credentialIdentifier?void 0:HS(a,c),proofJwt:t.proofJwt,fetchImpl:t.fetchImpl});if(!v.credential&&!Array.isArray(v.credentials))throw new N("unsupported_format","Credential endpoint returned neither `credential` nor `credentials`; deferred issuance not supported yet",{body:v});if(v.credential!==void 0&&e.push({format:c,credential:v.credential,configuration_id:u}),Array.isArray(v.credentials))for(let x of v.credentials)x&&typeof x=="object"&&"credential"in x&&e.push({format:c,credential:x.credential,configuration_id:u});typeof v.notification_id=="string"&&(r=v.notification_id),typeof v.c_nonce=="string"&&(n=v.c_nonce,i=typeof v.c_nonce_expires_in=="number"?v.c_nonce_expires_in:void 0)}}return{credentials:e,notification_id:r,c_nonce:n,c_nonce_expires_in:i}},"fetchCredentialsForToken"),$S=o((t,e)=>{let r=e&&e.length>0?e.filter(n=>t.credential_configuration_ids.includes(n)):t.credential_configuration_ids;if(r.length===0)throw new N("unsupported_format","No credential configuration ids matched the caller-supplied filter");return r},"filterConfigurationIds"),VS=o(t=>t&&typeof t=="object"&&typeof t.format=="string"?t.format:"jwt_vc_json","inferFormat"),HS=o((t,e)=>{if(!(!t||typeof t!="object")&&(e==="jwt_vc_json"||e==="jwt_vc_json-ld"||e==="ldp_vc")){let r=t.credential_definition;if(r&&typeof r=="object")return{credential_definition:r}}},"formatSpecificBody"),LS=o(t=>{let e=new Map;if(!Array.isArray(t))return e;for(let r of t){if(!r||typeof r!="object")continue;let n=r,i=n.credential_configuration_id,s=n.credential_identifiers;if(typeof i!="string"||!Array.isArray(s))continue;let u=s.filter(a=>typeof a=="string");u.length>0&&e.set(i,u)}return e},"indexAuthorizationDetails"),WS=o(t=>{if(typeof t!="object"||t===null)return!1;let e=t;return typeof e.access_token=="string"&&e.access_token.length>0&&typeof e.token_type=="string"&&e.token_type.length>0},"isTokenResponse"),FS=o(()=>{let t=globalThis.crypto;if(!t)throw new Error("Web Crypto API not available in this runtime");let e=new Uint8Array(16);t.getRandomValues(e);let r="";for(let n=0;n<e.length;n++)r+=e[n].toString(16).padStart(2,"0");return r},"randomId");var Vh=o((t,e)=>{switch(e){case"jwt_vc_json":case"jwt_vc":case"jwt_vc_json-ld":return KS(t,e);case"ldp_vc":if(!Aw(t))throw new N("unsupported_format",`ldp_vc credential was not a JSON-LD object (received ${typeof t})`);return{vc:t,rawFormat:e};default:throw new N("unsupported_format",`Credential format "${e}" is not yet supported by the openid4vc plugin`)}},"normalizeIssuedCredential"),KS=o((t,e)=>{if(typeof t!="string")throw new N("unsupported_format",`${e} credential must be a compact JWS string (received ${typeof t})`);let r;try{r=Nh(t)}catch(p){throw new N("unsupported_format",`Failed to decode ${e} credential as a JWT: ${p instanceof Error?p.message:String(p)}`,{cause:p})}let n=r.vc;if(!Aw(n))throw new N("unsupported_format",`${e} credential JWT is missing the required \`vc\` claim`);let i={...n};if(typeof r.jti=="string"&&!i.id&&(i.id=r.jti),typeof r.iss=="string"&&!zS(i)&&(i.issuer=r.iss),typeof r.sub=="string")if(i.credentialSubject&&!Array.isArray(i.credentialSubject)){let p=i.credentialSubject;p.id||(p.id=r.sub)}else i.credentialSubject||(i.credentialSubject={id:r.sub});let s=typeof r.nbf=="number"?r.nbf:typeof r.iat=="number"?r.iat:void 0;s!==void 0&&!i.issuanceDate&&!i.validFrom&&(i.issuanceDate=new Date(s*1e3).toISOString()),typeof r.exp=="number"&&!i.expirationDate&&!i.validUntil&&(i.expirationDate=new Date(r.exp*1e3).toISOString());let u=i.issuanceDate??(typeof i.validFrom=="string"?i.validFrom:void 0)??new Date().toISOString(),a=JS(i.issuer)??(typeof r.iss=="string"?r.iss:void 0),c;try{let p=jh(t);typeof p?.kid=="string"&&p.kid.length>0&&(c=p.kid)}catch{}let d=c?c.startsWith("#")&&a?`${a}${c}`:c:a?`${a}#0`:"urn:openid4vci:unknown-verification-method";return i.proof={type:"JwtProof2020",created:u,proofPurpose:"assertionMethod",verificationMethod:d,jwt:t},{vc:i,rawFormat:e,jwt:t}},"decodeJwtVc"),JS=o(t=>{if(typeof t=="string")return t;if(t&&typeof t=="object"){let e=t.id;if(typeof e=="string"&&e.length>0)return e}},"pickIssuerId"),Aw=o(t=>{if(typeof t!="object"||t===null||Array.isArray(t))return!1;let e=t;return"@context"in e||"type"in e||"credentialSubject"in e},"isVcObject"),zS=o(t=>t.issuer?typeof t.issuer=="string"?t.issuer.length>0:typeof t.issuer=="object"&&t.issuer!==null?typeof t.issuer.id=="string"&&t.issuer.id.length>0:!1:!1,"hasIssuer");var Sw="LearnCloud",Hh=o(async(t,e,r={})=>{let n=r.storage??Sw,i=r.encrypt??!0,s=r.makeId??s5,u=r.upload??r5(t,n,i),a=r.addToIndex??n5(t,n),c=[],d=[];for(let p=0;p<e.credentials.length;p++){let y=e.credentials[p];try{let v=Vh(y.credential,y.format),x=await i5(u,v.vc),A=s(),B={id:A,uri:x,category:GS(r.category,v.vc,p),...xd(r.title,v.vc,p)&&{title:xd(r.title,v.vc,p)},...xd(r.imgUrl,v.vc,p)&&{imgUrl:xd(r.imgUrl,v.vc,p)},__v:1};await o5(a,B),c.push({uri:x,recordId:A,vc:v.vc,configurationId:y.configuration_id,format:v.rawFormat})}catch(v){d.push({configurationId:y.configuration_id,format:y.format,error:v instanceof N?v:new N("store_failed",`Unexpected error while storing credential: ${v instanceof Error?v.message:String(v)}`,{cause:v})})}}return{stored:c,failures:d}},"storeAcceptedCredentials"),GS=o((t,e,r)=>typeof t=="string"?t:typeof t=="function"?t(e,r):XS(e),"resolveCategory"),xd=o((t,e,r)=>{if(typeof t=="string")return t;if(typeof t=="function")return t(e,r)},"resolveOptional"),XS=o(t=>{let e=t5(t.type);return e.some(Ad(ZS))?"ID":e.some(Ad(QS))?"Achievement":e.some(Ad(YS))?"Work":e.some(Ad(e5))?"Learning History":"Achievement"},"defaultCategoryFor"),ZS=["IdentityCredential","VerifiableId","MobileDriversLicense"],QS=["OpenBadgeCredential","AchievementCredential","UniversityDegreeCredential","MicroCredential"],YS=["EmploymentCredential","WorkExperienceCredential"],e5=["CourseCompletionCredential","LearningHistoryCredential"],Ad=o(t=>e=>t.includes(e),"matchesAny"),t5=o(t=>Array.isArray(t)?t.filter(e=>typeof e=="string"):typeof t=="string"?[t]:[],"toTypeArray"),r5=o((t,e,r)=>{let i=t.store?.[e];if(!i)throw new N("store_plane_missing",`LearnCard has no store plugin named "${e}" \u2014 did you forget to add @learncard/learn-cloud-plugin?`);if(r&&typeof i.uploadEncrypted=="function")return s=>i.uploadEncrypted(s);if(typeof i.upload=="function")return s=>i.upload(s);throw new N("store_plane_missing",`Store plugin "${e}" implements neither \`upload\` nor \`uploadEncrypted\``)},"resolveUpload"),n5=o((t,e)=>{let n=t.index?.[e];if(!n||typeof n.add!="function")throw new N("index_plane_missing",`LearnCard has no index plugin named "${e}" exposing an \`add\` method`);return i=>n.add(i)},"resolveAddToIndex"),i5=o(async(t,e)=>{let r;try{r=await t(e)}catch(n){throw new N("store_failed",`Store plane rejected the credential upload: ${n instanceof Error?n.message:String(n)}`,{cause:n})}if(typeof r!="string"||r.length===0)throw new N("store_failed","Store plane upload returned an empty URI \u2014 refusing to index an unresolvable credential");return r},"safeUpload"),o5=o(async(t,e)=>{try{await t(e)}catch(r){throw new N("index_failed",`Index plane rejected the credential record: ${r instanceof Error?r.message:String(r)}`,{cause:r})}},"safeAddToIndex"),s5=o(()=>{let t=globalThis.crypto;if(t&&typeof t.randomUUID=="function")return t.randomUUID();let e=new Uint8Array(16),r=globalThis.crypto;if(r&&typeof r.getRandomValues=="function")r.getRandomValues(e);else for(let n=0;n<e.length;n++)e[n]=Math.floor(Math.random()*256);return Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")},"defaultMakeId");var Lh=class Lh extends Error{constructor(e,r,n){super(r),this.name="VpError",this.code=e,n?.cause!==void 0&&(this.cause=n.cause)}};o(Lh,"VpError");var te=Lh;var fZ=kr(Cw());var Ir={};E1(Ir,{Any:()=>Pr,BaseBlock:()=>Ue,BaseStringBlock:()=>nc,BitString:()=>dr,BmpString:()=>bi,Boolean:()=>mi,CharacterString:()=>Pi,Choice:()=>No,Constructed:()=>$e,DATE:()=>cc,DateTime:()=>dc,Duration:()=>lc,EndOfContent:()=>ic,Enumerated:()=>gi,GeneralString:()=>Ei,GeneralizedTime:()=>Ti,GraphicString:()=>Ci,HexBlock:()=>Tr,IA5String:()=>ki,Integer:()=>rn,Null:()=>cr,NumericString:()=>_i,ObjectIdentifier:()=>vi,OctetString:()=>fr,Primitive:()=>tn,PrintableString:()=>xi,RawData:()=>Gh,RelativeObjectIdentifier:()=>ac,Repeated:()=>Ii,Sequence:()=>it,Set:()=>pt,TIME:()=>pc,TeletexString:()=>Ai,TimeOfDay:()=>fc,UTCTime:()=>Bn,UniversalString:()=>wi,Utf8String:()=>zt,ValueBlock:()=>Qe,VideotexString:()=>Si,ViewWriter:()=>jo,VisibleString:()=>Nn,compareSchema:()=>Yr,fromBER:()=>on,verifySchema:()=>E5});var re=kr(Qr());function yi(t,e){let r=0;if(t.length===1)return t[0];for(let n=t.length-1;n>=0;n--)r+=t[t.length-1-n]*Math.pow(2,e*n);return r}o(yi,"utilFromBase");function jn(t,e,r=-1){let n=r,i=t,s=0,u=Math.pow(2,e);for(let a=1;a<8;a++){if(t<u){let c;if(n<0)c=new ArrayBuffer(a),s=a;else{if(n<a)return new ArrayBuffer(0);c=new ArrayBuffer(n),s=n}let d=new Uint8Array(c);for(let p=a-1;p>=0;p--){let y=Math.pow(2,p*e);d[s-p-1]=Math.floor(i/y),i-=d[s-p-1]*y}return c}u*=Math.pow(2,e)}return new ArrayBuffer(0)}o(jn,"utilToBase");function Cd(...t){let e=0,r=0;for(let s of t)e+=s.length;let n=new ArrayBuffer(e),i=new Uint8Array(n);for(let s of t)i.set(s,r),r+=s.length;return i}o(Cd,"utilConcatView");function Jh(){let t=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let a=t[0]===255&&t[1]&128,c=t[0]===0&&(t[1]&128)===0;(a||c)&&this.warnings.push("Needlessly long format")}let e=new ArrayBuffer(this.valueHex.byteLength),r=new Uint8Array(e);for(let a=0;a<this.valueHex.byteLength;a++)r[a]=0;r[0]=t[0]&128;let n=yi(r,8),i=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(i);for(let a=0;a<this.valueHex.byteLength;a++)s[a]=t[a];return s[0]&=127,yi(s,8)-n}o(Jh,"utilDecodeTC");function Ew(t){let e=t<0?t*-1:t,r=128;for(let n=1;n<8;n++){if(e<=r){if(t<0){let u=r-e,a=jn(u,8,n),c=new Uint8Array(a);return c[0]|=128,a}let i=jn(e,8,n),s=new Uint8Array(i);if(s[0]&128){let u=i.slice(0),a=new Uint8Array(u);i=new ArrayBuffer(i.byteLength+1),s=new Uint8Array(i);for(let c=0;c<u.byteLength;c++)s[c+1]=a[c];s[0]=0}return i}r*=Math.pow(2,8)}return new ArrayBuffer(0)}o(Ew,"utilEncodeTC");function Pw(t,e){if(t.byteLength!==e.byteLength)return!1;let r=new Uint8Array(t),n=new Uint8Array(e);for(let i=0;i<r.length;i++)if(r[i]!==n[i])return!1;return!0}o(Pw,"isEqualBuffer");function St(t,e){let r=t.toString(10);if(e<r.length)return"";let n=e-r.length,i=new Array(n);for(let u=0;u<n;u++)i[u]="0";return i.join("").concat(r)}o(St,"padNumber");var Ij=Math.log(2);function Ed(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}o(Ed,"assertBigInt");function Xh(t){let e=0,r=0;for(let i=0;i<t.length;i++){let s=t[i];e+=s.byteLength}let n=new Uint8Array(e);for(let i=0;i<t.length;i++){let s=t[i];n.set(new Uint8Array(s),r),r+=s.byteLength}return n.buffer}o(Xh,"concat");function nn(t,e,r,n){return e instanceof Uint8Array?e.byteLength?r<0?(t.error="Wrong parameter: inputOffset less than zero",!1):n<0?(t.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-r-n<0?(t.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(t.error="Wrong parameter: inputBuffer has zero length",!1):(t.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}o(nn,"checkBufferParams");var Qh=class Qh{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Xh(this.items)}};o(Qh,"ViewWriter");var jo=Qh,ec=[new Uint8Array([1])],Tw="0123456789",zh="name",Iw="valueHexView",y5="isHexOnly",m5="idBlock",g5="tagClass",v5="tagNumber",b5="isConstructed",w5="fromBER",_5="toBER",x5="local",kt="",lr=new ArrayBuffer(0),Hd=new Uint8Array(0),rc="EndOfContent",Rw="OCTET STRING",jw="BIT STRING";function Tr(t){var r;var e;return e=(r=class extends t{get valueHex(){return this.valueHexView.slice().buffer}set valueHex(i){this.valueHexView=new Uint8Array(i)}constructor(...i){var s;super(...i);let u=i[0]||{};this.isHexOnly=(s=u.isHexOnly)!==null&&s!==void 0?s:!1,this.valueHexView=u.valueHex?re.BufferSourceConverter.toUint8Array(u.valueHex):Hd}fromBER(i,s,u){let a=i instanceof ArrayBuffer?new Uint8Array(i):i;if(!nn(this,a,s,u))return-1;let c=s+u;return this.valueHexView=a.subarray(s,c),this.valueHexView.length?(this.blockLength=u,c):(this.warnings.push("Zero buffer length"),s)}toBER(i=!1){return this.isHexOnly?i?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",lr)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:re.Convert.ToHex(this.valueHexView)}}},o(r,"Some"),r),e.NAME="hexBlock",e}o(Tr,"HexBlock");var Yh=class Yh{static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}constructor({blockLength:e=0,error:r=kt,warnings:n=[],valueBeforeDecode:i=Hd}={}){this.blockLength=e,this.error=r,this.warnings=n,this.valueBeforeDecodeView=re.BufferSourceConverter.toUint8Array(i)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:re.Convert.ToHex(this.valueBeforeDecodeView)}}};o(Yh,"LocalBaseBlock");var en=Yh;en.NAME="baseBlock";var ey=class ey extends en{fromBER(e,r,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,r){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};o(ey,"ValueBlock");var Qe=ey;Qe.NAME="valueBlock";var ty=class ty extends Tr(en){constructor({idBlock:e={}}={}){var r,n,i,s;super(),e?(this.isHexOnly=(r=e.isHexOnly)!==null&&r!==void 0?r:!1,this.valueHexView=e.valueHex?re.BufferSourceConverter.toUint8Array(e.valueHex):Hd,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(i=e.tagNumber)!==null&&i!==void 0?i:-1,this.isConstructed=(s=e.isConstructed)!==null&&s!==void 0?s:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let r=0;switch(this.tagClass){case 1:r|=0;break;case 2:r|=64;break;case 3:r|=128;break;case 4:r|=192;break;default:return this.error="Unknown tag class",lr}if(this.isConstructed&&(r|=32),this.tagNumber<31&&!this.isHexOnly){let i=new Uint8Array(1);if(!e){let s=this.tagNumber;s&=31,r|=s,i[0]=r}return i.buffer}if(!this.isHexOnly){let i=jn(this.tagNumber,7),s=new Uint8Array(i),u=i.byteLength,a=new Uint8Array(u+1);if(a[0]=r|31,!e){for(let c=0;c<u-1;c++)a[c+1]=s[c]|128;a[u]=s[u-1]}return a.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=r|31,!e){let i=this.valueHexView;for(let s=0;s<i.length-1;s++)n[s+1]=i[s]|128;n[this.valueHexView.byteLength]=i[i.length-1]}return n.buffer}fromBER(e,r,n){let i=re.BufferSourceConverter.toUint8Array(e);if(!nn(this,i,r,n))return-1;let s=i.subarray(r,r+n);if(s.length===0)return this.error="Zero buffer length",-1;switch(s[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(s[0]&32)===32,this.isHexOnly=!1;let a=s[0]&31;if(a!==31)this.tagNumber=a,this.blockLength=1;else{let c=1,d=this.valueHexView=new Uint8Array(255),p=255;for(;s[c]&128;){if(d[c-1]=s[c]&127,c++,c>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(c===p){p+=255;let v=new Uint8Array(p);for(let x=0;x<d.length;x++)v[x]=d[x];d=this.valueHexView=new Uint8Array(p)}}this.blockLength=c+1,d[c-1]=s[c]&127;let y=new Uint8Array(c);for(let v=0;v<c;v++)y[v]=d[v];d=this.valueHexView=new Uint8Array(c),d.set(y),this.blockLength<=9?this.tagNumber=yi(d,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return r+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};o(ty,"LocalIdentificationBlock");var Pd=ty;Pd.NAME="identificationBlock";var ry=class ry extends en{constructor({lenBlock:e={}}={}){var r,n,i;super(),this.isIndefiniteForm=(r=e.isIndefiniteForm)!==null&&r!==void 0?r:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(i=e.length)!==null&&i!==void 0?i:0}fromBER(e,r,n){let i=re.BufferSourceConverter.toUint8Array(e);if(!nn(this,i,r,n))return-1;let s=i.subarray(r,r+n);if(s.length===0)return this.error="Zero buffer length",-1;if(s[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=s[0]===128,this.isIndefiniteForm)return this.blockLength=1,r+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,r+this.blockLength;let u=s[0]&127;if(u>8)return this.error="Too big integer",-1;if(u+1>s.length)return this.error="End of input reached before message was fully decoded",-1;let a=r+1,c=i.subarray(a,a+u);return c[u-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=yi(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=u+1,r+this.blockLength}toBER(e=!1){let r,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return r=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(r),n[0]=128),r;if(this.longFormUsed){let i=jn(this.length,8);if(i.byteLength>127)return this.error="Too big length",lr;if(r=new ArrayBuffer(i.byteLength+1),e)return r;let s=new Uint8Array(i);n=new Uint8Array(r),n[0]=i.byteLength|128;for(let u=0;u<i.byteLength;u++)n[u+1]=s[u];return r}return r=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(r),n[0]=this.length),r}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};o(ry,"LocalLengthBlock");var Td=ry;Td.NAME="lengthBlock";var R={},ny=class ny extends en{constructor({name:e=kt,optional:r=!1,primitiveSchema:n,...i}={},s){super(i),this.name=e,this.optional=r,n&&(this.primitiveSchema=n),this.idBlock=new Pd(i),this.lenBlock=new Td(i),this.valueBlock=s?new s(i):new Qe(i)}fromBER(e,r,n){let i=this.valueBlock.fromBER(e,r,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}toBER(e,r){let n=r||new jo;r||Nw(this);let i=this.idBlock.toBER(e);if(n.write(i),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{let s=this.valueBlock.toBER(e);this.lenBlock.length=s.byteLength;let u=this.lenBlock.toBER(e);n.write(u),n.write(s)}return r?lr:n.final()}toJSON(){let e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():re.Convert.ToHex(this.toBER())}onAsciiEncoding(){let e=this.constructor.NAME,r=re.Convert.ToHex(this.valueBlock.valueBeforeDecodeView);return`${e} : ${r}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;let r=this.toBER(),n=e.toBER();return Pw(r,n)}};o(ny,"BaseBlock");var Ue=ny;Ue.NAME="BaseBlock";function Nw(t){var e;if(t instanceof R.Constructed)for(let r of t.valueBlock.value)Nw(r)&&(t.lenBlock.isIndefiniteForm=!0);return!!(!((e=t.lenBlock)===null||e===void 0)&&e.isIndefiniteForm)}o(Nw,"prepareIndefiniteForm");var iy=class iy extends Ue{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor({value:e=kt,...r}={},n){super(r,n),e&&this.fromString(e)}fromBER(e,r,n){let i=this.valueBlock.fromBER(e,r,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};o(iy,"BaseStringBlock");var nc=iy;nc.NAME="BaseStringBlock";var oy=class oy extends Tr(Qe){constructor({isHexOnly:e=!0,...r}={}){super(r),this.isHexOnly=e}};o(oy,"LocalPrimitiveValueBlock");var Id=oy;Id.NAME="PrimitiveValueBlock";var Bw,sy=class sy extends Ue{constructor(e={}){super(e,Id),this.idBlock.isConstructed=!1}};o(sy,"Primitive");var tn=sy;Bw=tn;R.Primitive=Bw;tn.NAME="PRIMITIVE";function A5(t,e){if(t instanceof e)return t;let r=new e;return r.idBlock=t.idBlock,r.lenBlock=t.lenBlock,r.warnings=t.warnings,r.valueBeforeDecodeView=t.valueBeforeDecodeView,r}o(A5,"localChangeType");function Bo(t,e=0,r=t.length){let n=e,i=new Ue({},Qe),s=new en;if(!nn(s,t,e,r))return i.error=s.error,{offset:-1,result:i};if(!t.subarray(e,e+r).length)return i.error="Zero buffer length",{offset:-1,result:i};let a=i.idBlock.fromBER(t,e,r);if(i.idBlock.warnings.length&&i.warnings.concat(i.idBlock.warnings),a===-1)return i.error=i.idBlock.error,{offset:-1,result:i};if(e=a,r-=i.idBlock.blockLength,a=i.lenBlock.fromBER(t,e,r),i.lenBlock.warnings.length&&i.warnings.concat(i.lenBlock.warnings),a===-1)return i.error=i.lenBlock.error,{offset:-1,result:i};if(e=a,r-=i.lenBlock.blockLength,!i.idBlock.isConstructed&&i.lenBlock.isIndefiniteForm)return i.error="Indefinite length form used for primitive encoding form",{offset:-1,result:i};let c=Ue;switch(i.idBlock.tagClass){case 1:if(i.idBlock.tagNumber>=37&&i.idBlock.isHexOnly===!1)return i.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:i};switch(i.idBlock.tagNumber){case 0:if(i.idBlock.isConstructed&&i.lenBlock.length>0)return i.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:i};c=R.EndOfContent;break;case 1:c=R.Boolean;break;case 2:c=R.Integer;break;case 3:c=R.BitString;break;case 4:c=R.OctetString;break;case 5:c=R.Null;break;case 6:c=R.ObjectIdentifier;break;case 10:c=R.Enumerated;break;case 12:c=R.Utf8String;break;case 13:c=R.RelativeObjectIdentifier;break;case 14:c=R.TIME;break;case 15:return i.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:i};case 16:c=R.Sequence;break;case 17:c=R.Set;break;case 18:c=R.NumericString;break;case 19:c=R.PrintableString;break;case 20:c=R.TeletexString;break;case 21:c=R.VideotexString;break;case 22:c=R.IA5String;break;case 23:c=R.UTCTime;break;case 24:c=R.GeneralizedTime;break;case 25:c=R.GraphicString;break;case 26:c=R.VisibleString;break;case 27:c=R.GeneralString;break;case 28:c=R.UniversalString;break;case 29:c=R.CharacterString;break;case 30:c=R.BmpString;break;case 31:c=R.DATE;break;case 32:c=R.TimeOfDay;break;case 33:c=R.DateTime;break;case 34:c=R.Duration;break;default:{let d=i.idBlock.isConstructed?new R.Constructed:new R.Primitive;d.idBlock=i.idBlock,d.lenBlock=i.lenBlock,d.warnings=i.warnings,i=d}}break;default:c=i.idBlock.isConstructed?R.Constructed:R.Primitive}return i=A5(i,c),a=i.fromBER(t,e,i.lenBlock.isIndefiniteForm?r:i.lenBlock.length),i.valueBeforeDecodeView=t.subarray(n,n+i.blockLength),{offset:a,result:i}}o(Bo,"localFromBER");function on(t){if(!t.byteLength){let e=new Ue({},Qe);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Bo(re.BufferSourceConverter.toUint8Array(t).slice(),0,t.byteLength)}o(on,"fromBER");function S5(t,e){return t?1:e}o(S5,"checkLen");var uy=class uy extends Qe{constructor({value:e=[],isIndefiniteForm:r=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=r}fromBER(e,r,n){let i=re.BufferSourceConverter.toUint8Array(e);if(!nn(this,i,r,n))return-1;if(this.valueBeforeDecodeView=i.subarray(r,r+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),r;let s=r;for(;S5(this.isIndefiniteForm,n)>0;){let u=Bo(i,s,n);if(u.offset===-1)return this.error=u.result.error,this.warnings.concat(u.result.warnings),-1;if(s=u.offset,this.blockLength+=u.result.blockLength,n-=u.result.blockLength,this.value.push(u.result),this.isIndefiniteForm&&u.result.constructor.NAME===rc)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===rc?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(e,r){let n=r||new jo;for(let i=0;i<this.value.length;i++)this.value[i].toBER(e,n);return r?lr:n.final()}toJSON(){let e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let r of this.value)e.value.push(r.toJSON());return e}};o(uy,"LocalConstructedValueBlock");var Er=uy;Er.NAME="ConstructedValueBlock";var Dw,ay=class ay extends Ue{constructor(e={}){super(e,Er),this.idBlock.isConstructed=!0}fromBER(e,r,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let i=this.valueBlock.fromBER(e,r,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}onAsciiEncoding(){let e=[];for(let n of this.valueBlock.value)e.push(n.toString("ascii").split(`
11
+ `).map(i=>` ${i}`).join(`
12
+ `));let r=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${r} :
13
+ ${e.join(`
14
+ `)}`:`${r} :`}};o(ay,"Constructed");var $e=ay;Dw=$e;R.Constructed=Dw;$e.NAME="CONSTRUCTED";var cy=class cy extends Qe{fromBER(e,r,n){return r}toBER(e){return lr}};o(cy,"LocalEndOfContentValueBlock");var Od=cy;Od.override="EndOfContentValueBlock";var qw,fy=class fy extends Ue{constructor(e={}){super(e,Od),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}};o(fy,"EndOfContent");var ic=fy;qw=ic;R.EndOfContent=qw;ic.NAME=rc;var Mw,dy=class dy extends Ue{constructor(e={}){super(e,Qe),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,r,n){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=n,r+n>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):r+n}toBER(e,r){let n=new ArrayBuffer(2);if(!e){let i=new Uint8Array(n);i[0]=5,i[1]=0}return r&&r.write(n),n}onAsciiEncoding(){return`${this.constructor.NAME}`}};o(dy,"Null");var cr=dy;Mw=cr;R.Null=Mw;cr.NAME="NULL";var ly=class ly extends Tr(Qe){get value(){for(let e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}constructor({value:e,...r}={}){super(r),r.valueHex?this.valueHexView=re.BufferSourceConverter.toUint8Array(r.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}fromBER(e,r,n){let i=re.BufferSourceConverter.toUint8Array(e);return nn(this,i,r,n)?(this.valueHexView=i.subarray(r,r+n),n>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,Jh.call(this),this.blockLength=n,r+n):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}};o(ly,"LocalBooleanValueBlock");var Rd=ly;Rd.NAME="BooleanValueBlock";var Uw,py=class py extends Ue{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(e={}){super(e,Rd),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};o(py,"Boolean");var mi=py;Uw=mi;R.Boolean=Uw;mi.NAME="BOOLEAN";var hy=class hy extends Tr(Er){constructor({isConstructed:e=!1,...r}={}){super(r),this.isConstructed=e}fromBER(e,r,n){let i=0;if(this.isConstructed){if(this.isHexOnly=!1,i=Er.prototype.fromBER.call(this,e,r,n),i===-1)return i;for(let s=0;s<this.value.length;s++){let u=this.value[s].constructor.NAME;if(u===rc){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(u!==Rw)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,i=super.fromBER(e,r,n),this.blockLength=n;return i}toBER(e,r){return this.isConstructed?Er.prototype.toBER.call(this,e,r):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}};o(hy,"LocalOctetStringValueBlock");var jd=hy;jd.NAME="OctetStringValueBlock";var Zh,yy=class yy extends Ue{constructor({idBlock:e={},lenBlock:r={},...n}={}){var i,s;(i=n.isConstructed)!==null&&i!==void 0||(n.isConstructed=!!(!((s=n.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...r,isIndefiniteForm:!!n.isIndefiniteForm},...n},jd),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,r,n){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,n===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),r;if(!this.valueBlock.isConstructed){let s=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(r,r+n);try{if(s.byteLength){let u=Bo(s,0,s.byteLength);u.offset!==-1&&u.offset===n&&(this.valueBlock.value=[u.result])}}catch{}}return super.fromBER(e,r,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return $e.prototype.onAsciiEncoding.call(this);let e=this.constructor.NAME,r=re.Convert.ToHex(this.valueBlock.valueHexView);return`${e} : ${r}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;let e=[];for(let r of this.valueBlock.value)r instanceof Zh&&e.push(r.valueBlock.valueHexView);return re.BufferSourceConverter.concat(e)}};o(yy,"OctetString");var fr=yy;Zh=fr;R.OctetString=Zh;fr.NAME=Rw;var my=class my extends Tr(Er){constructor({unusedBits:e=0,isConstructed:r=!1,...n}={}){super(n),this.unusedBits=e,this.isConstructed=r,this.blockLength=this.valueHexView.byteLength}fromBER(e,r,n){if(!n)return r;let i=-1;if(this.isConstructed){if(i=Er.prototype.fromBER.call(this,e,r,n),i===-1)return i;for(let a of this.value){let c=a.constructor.NAME;if(c===rc){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(c!==jw)return this.error="BIT STRING may consists of BIT STRINGs only",-1;let d=a.valueBlock;if(this.unusedBits>0&&d.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=d.unusedBits}return i}let s=re.BufferSourceConverter.toUint8Array(e);if(!nn(this,s,r,n))return-1;let u=s.subarray(r,r+n);if(this.unusedBits=u[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){let a=u.subarray(1);try{if(a.byteLength){let c=Bo(a,0,a.byteLength);c.offset!==-1&&c.offset===n-1&&(this.value=[c.result])}}catch{}}return this.valueHexView=u.subarray(1),this.blockLength=u.length,r+n}toBER(e,r){if(this.isConstructed)return Er.prototype.toBER.call(this,e,r);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return lr;let n=new Uint8Array(this.valueHexView.length+1);return n[0]=this.unusedBits,n.set(this.valueHexView,1),n.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}};o(my,"LocalBitStringValueBlock");var Nd=my;Nd.NAME="BitStringValueBlock";var $w,gy=class gy extends Ue{constructor({idBlock:e={},lenBlock:r={},...n}={}){var i,s;(i=n.isConstructed)!==null&&i!==void 0||(n.isConstructed=!!(!((s=n.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...r,isIndefiniteForm:!!n.isIndefiniteForm},...n},Nd),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,r,n){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,r,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return $e.prototype.onAsciiEncoding.call(this);{let e=[],r=this.valueBlock.valueHexView;for(let u of r)e.push(u.toString(2).padStart(8,"0"));let n=e.join(""),i=this.constructor.NAME,s=n.substring(0,n.length-this.valueBlock.unusedBits);return`${i} : ${s}`}}};o(gy,"BitString");var dr=gy;$w=dr;R.BitString=$w;dr.NAME=jw;var Vw;function k5(t,e){let r=new Uint8Array([0]),n=new Uint8Array(t),i=new Uint8Array(e),s=n.slice(0),u=s.length-1,a=i.slice(0),c=a.length-1,d=0,p=c<u?u:c,y=0;for(let v=p;v>=0;v--,y++)!0===y<a.length?d=s[u-y]+a[c-y]+r[0]:d=s[u-y]+r[0],r[0]=d/10,!0===y>=s.length?s=Cd(new Uint8Array([d%10]),s):s[u-y]=d%10;return r[0]>0&&(s=Cd(r,s)),s}o(k5,"viewAdd");function Ow(t){if(t>=ec.length)for(let e=ec.length;e<=t;e++){let r=new Uint8Array([0]),n=ec[e-1].slice(0);for(let i=n.length-1;i>=0;i--){let s=new Uint8Array([(n[i]<<1)+r[0]]);r[0]=s[0]/10,n[i]=s[0]%10}r[0]>0&&(n=Cd(r,n)),ec.push(n)}return ec[t]}o(Ow,"power2");function C5(t,e){let r=0,n=new Uint8Array(t),i=new Uint8Array(e),s=n.slice(0),u=s.length-1,a=i.slice(0),c=a.length-1,d,p=0;for(let y=c;y>=0;y--,p++)d=s[u-p]-a[c-p]-r,!0===d<0?(r=1,s[u-p]=d+10):(r=0,s[u-p]=d);if(r>0)for(let y=u-c+1;y>=0;y--,p++)if(d=s[u-p]-r,d<0)r=1,s[u-p]=d+10;else{r=0,s[u-p]=d;break}return s.slice()}o(C5,"viewSub");var vy=class vy extends Tr(Qe){setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=Jh.call(this)))}constructor({value:e,...r}={}){super(r),this._valueDec=0,r.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(Ew(e))}get valueDec(){return this._valueDec}fromDER(e,r,n,i=0){let s=this.fromBER(e,r,n);if(s===-1)return s;let u=this.valueHexView;return u[0]===0&&(u[1]&128)!==0?this.valueHexView=u.subarray(1):i!==0&&u.length<i&&(i-u.length>1&&(i=u.length+1),this.valueHexView=u.subarray(i-u.length)),s}toDER(e=!1){let r=this.valueHexView;switch(!0){case(r[0]&128)!==0:{let n=new Uint8Array(this.valueHexView.length+1);n[0]=0,n.set(r,1),this.valueHexView=n}break;case(r[0]===0&&(r[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,r,n){let i=super.fromBER(e,r,n);return i===-1||this.setValueHex(),i}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){let e=this.valueHexView.length*8-1,r=new Uint8Array(this.valueHexView.length*8/3),n=0,i,s=this.valueHexView,u="",a=!1;for(let c=s.byteLength-1;c>=0;c--){i=s[c];for(let d=0;d<8;d++)(i&1)===1&&(n===e?(r=C5(Ow(n),r),u="-"):r=k5(r,Ow(n))),n++,i>>=1}for(let c=0;c<r.length;c++)r[c]&&(a=!0),a&&(u+=Tw.charAt(r[c]));return a===!1&&(u+=Tw.charAt(0)),u}};o(vy,"LocalIntegerValueBlock");var oc=vy;Vw=oc;oc.NAME="IntegerValueBlock";Object.defineProperty(Vw.prototype,"valueHex",{set:o(function(t){this.valueHexView=new Uint8Array(t),this.setValueHex()},"set"),get:o(function(){return this.valueHexView.slice().buffer},"get")});var tc,by=class by extends Ue{constructor(e={}){super(e,oc),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Ed(),BigInt(this.valueBlock.toString())}static fromBigInt(e){Ed();let r=BigInt(e),n=new jo,i=r.toString(16).replace(/^-/,""),s=new Uint8Array(re.Convert.FromHex(i));if(r<0){let a=new Uint8Array(s.length+(s[0]&128?1:0));a[0]|=128;let d=BigInt(`0x${re.Convert.ToHex(a)}`)+r,p=re.BufferSourceConverter.toUint8Array(re.Convert.FromHex(d.toString(16)));p[0]|=128,n.write(p)}else s[0]&128&&n.write(new Uint8Array([0])),n.write(s);return new tc({valueHex:n.final()})}convertToDER(){let e=new tc({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new tc({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}};o(by,"Integer");var rn=by;tc=rn;R.Integer=tc;rn.NAME="INTEGER";var Hw,wy=class wy extends rn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}};o(wy,"Enumerated");var gi=wy;Hw=gi;R.Enumerated=Hw;gi.NAME="ENUMERATED";var _y=class _y extends Tr(Qe){constructor({valueDec:e=-1,isFirstSid:r=!1,...n}={}){super(n),this.valueDec=e,this.isFirstSid=r}fromBER(e,r,n){if(!n)return r;let i=re.BufferSourceConverter.toUint8Array(e);if(!nn(this,i,r,n))return-1;let s=i.subarray(r,r+n);this.valueHexView=new Uint8Array(n);for(let a=0;a<n&&(this.valueHexView[a]=s[a]&127,this.blockLength++,(s[a]&128)!==0);a++);let u=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength;a++)u[a]=this.valueHexView[a];return this.valueHexView=u,(s[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=yi(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),r+this.blockLength)}set valueBigInt(e){Ed();let r=BigInt(e).toString(2);for(;r.length%7;)r="0"+r;let n=new Uint8Array(r.length/7);for(let i=0;i<n.length;i++)n[i]=parseInt(r.slice(i*7,i*7+7),2)+(i+1<n.length?128:0);this.fromBER(n.buffer,0,n.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);let i=this.valueHexView,s=new Uint8Array(this.blockLength);for(let u=0;u<this.blockLength-1;u++)s[u]=i[u]|128;return s[this.blockLength-1]=i[this.blockLength-1],s.buffer}let r=jn(this.valueDec,7);if(r.byteLength===0)return this.error="Error during encoding SID value",lr;let n=new Uint8Array(r.byteLength);if(!e){let i=new Uint8Array(r),s=r.byteLength-1;for(let u=0;u<s;u++)n[u]=i[u]|128;n[s]=i[s]}return n}toString(){let e="";if(this.isHexOnly)e=re.Convert.ToHex(this.valueHexView);else if(this.isFirstSid){let r=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",r-=40):(e="2.",r-=80),e+=r.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}};o(_y,"LocalSidValueBlock");var sc=_y;sc.NAME="sidBlock";var xy=class xy extends Qe{constructor({value:e=kt,...r}={}){super(r),this.value=[],e&&this.fromString(e)}fromBER(e,r,n){let i=r;for(;n>0;){let s=new sc;if(i=s.fromBER(e,i,n),i===-1)return this.blockLength=0,this.error=s.error,i;this.value.length===0&&(s.isFirstSid=!0),this.blockLength+=s.blockLength,n-=s.blockLength,this.value.push(s)}return i}toBER(e){let r=[];for(let n=0;n<this.value.length;n++){let i=this.value[n].toBER(e);if(i.byteLength===0)return this.error=this.value[n].error,lr;r.push(i)}return Xh(r)}fromString(e){this.value=[];let r=0,n=0,i="",s=!1;do if(n=e.indexOf(".",r),n===-1?i=e.substring(r):i=e.substring(r,n),r=n+1,s){let u=this.value[0],a=0;switch(u.valueDec){case 0:break;case 1:a=40;break;case 2:a=80;break;default:this.value=[];return}let c=parseInt(i,10);if(isNaN(c))return;u.valueDec=c+a,s=!1}else{let u=new sc;if(i>Number.MAX_SAFE_INTEGER){Ed();let a=BigInt(i);u.valueBigInt=a}else if(u.valueDec=parseInt(i,10),isNaN(u.valueDec))return;this.value.length||(u.isFirstSid=!0,s=!0),this.value.push(u)}while(n!==-1)}toString(){let e="",r=!1;for(let n=0;n<this.value.length;n++){r=this.value[n].isHexOnly;let i=this.value[n].toString();n!==0&&(e=`${e}.`),r?(i=`{${i}}`,this.value[n].isFirstSid?e=`2.{${i} - 80}`:e+=i):e+=i}return e}toJSON(){let e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let r=0;r<this.value.length;r++)e.sidArray.push(this.value[r].toJSON());return e}};o(xy,"LocalObjectIdentifierValueBlock");var Bd=xy;Bd.NAME="ObjectIdentifierValueBlock";var Lw,Ay=class Ay extends Ue{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,Bd),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}};o(Ay,"ObjectIdentifier");var vi=Ay;Lw=vi;R.ObjectIdentifier=Lw;vi.NAME="OBJECT IDENTIFIER";var Sy=class Sy extends Tr(en){constructor({valueDec:e=0,...r}={}){super(r),this.valueDec=e}fromBER(e,r,n){if(n===0)return r;let i=re.BufferSourceConverter.toUint8Array(e);if(!nn(this,i,r,n))return-1;let s=i.subarray(r,r+n);this.valueHexView=new Uint8Array(n);for(let a=0;a<n&&(this.valueHexView[a]=s[a]&127,this.blockLength++,(s[a]&128)!==0);a++);let u=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength;a++)u[a]=this.valueHexView[a];return this.valueHexView=u,(s[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=yi(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),r+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);let i=this.valueHexView,s=new Uint8Array(this.blockLength);for(let u=0;u<this.blockLength-1;u++)s[u]=i[u]|128;return s[this.blockLength-1]=i[this.blockLength-1],s.buffer}let r=jn(this.valueDec,7);if(r.byteLength===0)return this.error="Error during encoding SID value",lr;let n=new Uint8Array(r.byteLength);if(!e){let i=new Uint8Array(r),s=r.byteLength-1;for(let u=0;u<s;u++)n[u]=i[u]|128;n[s]=i[s]}return n.buffer}toString(){let e="";return this.isHexOnly?e=re.Convert.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}};o(Sy,"LocalRelativeSidValueBlock");var uc=Sy;uc.NAME="relativeSidBlock";var ky=class ky extends Qe{constructor({value:e=kt,...r}={}){super(r),this.value=[],e&&this.fromString(e)}fromBER(e,r,n){let i=r;for(;n>0;){let s=new uc;if(i=s.fromBER(e,i,n),i===-1)return this.blockLength=0,this.error=s.error,i;this.blockLength+=s.blockLength,n-=s.blockLength,this.value.push(s)}return i}toBER(e,r){let n=[];for(let i=0;i<this.value.length;i++){let s=this.value[i].toBER(e);if(s.byteLength===0)return this.error=this.value[i].error,lr;n.push(s)}return Xh(n)}fromString(e){this.value=[];let r=0,n=0,i="";do{n=e.indexOf(".",r),n===-1?i=e.substring(r):i=e.substring(r,n),r=n+1;let s=new uc;if(s.valueDec=parseInt(i,10),isNaN(s.valueDec))return!0;this.value.push(s)}while(n!==-1);return!0}toString(){let e="",r=!1;for(let n=0;n<this.value.length;n++){r=this.value[n].isHexOnly;let i=this.value[n].toString();n!==0&&(e=`${e}.`),r&&(i=`{${i}}`),e+=i}return e}toJSON(){let e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let r=0;r<this.value.length;r++)e.sidArray.push(this.value[r].toJSON());return e}};o(ky,"LocalRelativeObjectIdentifierValueBlock");var Dd=ky;Dd.NAME="RelativeObjectIdentifierValueBlock";var Ww,Cy=class Cy extends Ue{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,Dd),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}};o(Cy,"RelativeObjectIdentifier");var ac=Cy;Ww=ac;R.RelativeObjectIdentifier=Ww;ac.NAME="RelativeObjectIdentifier";var Fw,Ey=class Ey extends $e{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}};o(Ey,"Sequence");var it=Ey;Fw=it;R.Sequence=Fw;it.NAME="SEQUENCE";var Kw,Py=class Py extends $e{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};o(Py,"Set");var pt=Py;Kw=pt;R.Set=Kw;pt.NAME="SET";var Ty=class Ty extends Tr(Qe){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=kt}toJSON(){return{...super.toJSON(),value:this.value}}};o(Ty,"LocalStringValueBlock");var qd=Ty;qd.NAME="StringValueBlock";var Iy=class Iy extends qd{};o(Iy,"LocalSimpleStringValueBlock");var Md=Iy;Md.NAME="SimpleStringValueBlock";var Oy=class Oy extends nc{constructor({...e}={}){super(e,Md)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,re.BufferSourceConverter.toUint8Array(e))}fromString(e){let r=e.length,n=this.valueBlock.valueHexView=new Uint8Array(r);for(let i=0;i<r;i++)n[i]=e.charCodeAt(i);this.valueBlock.value=e}};o(Oy,"LocalSimpleStringBlock");var ht=Oy;ht.NAME="SIMPLE STRING";var Ry=class Ry extends ht{fromBuffer(e){this.valueBlock.valueHexView=re.BufferSourceConverter.toUint8Array(e);try{this.valueBlock.value=re.Convert.ToUtf8String(e)}catch(r){this.warnings.push(`Error during "decodeURIComponent": ${r}, using raw string`),this.valueBlock.value=re.Convert.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(re.Convert.FromUtf8String(e)),this.valueBlock.value=e}};o(Ry,"LocalUtf8StringValueBlock");var Ud=Ry;Ud.NAME="Utf8StringValueBlock";var Jw,jy=class jy extends Ud{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}};o(jy,"Utf8String");var zt=jy;Jw=zt;R.Utf8String=Jw;zt.NAME="UTF8String";var Ny=class Ny extends ht{fromBuffer(e){this.valueBlock.value=re.Convert.ToUtf16String(e),this.valueBlock.valueHexView=re.BufferSourceConverter.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(re.Convert.FromUtf16String(e))}};o(Ny,"LocalBmpStringValueBlock");var $d=Ny;$d.NAME="BmpStringValueBlock";var zw,By=class By extends $d{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}};o(By,"BmpString");var bi=By;zw=bi;R.BmpString=zw;bi.NAME="BMPString";var Dy=class Dy extends ht{fromBuffer(e){let r=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),n=new Uint8Array(r);for(let i=0;i<n.length;i+=4)n[i]=n[i+3],n[i+1]=n[i+2],n[i+2]=0,n[i+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(r))}fromString(e){let r=e.length,n=this.valueBlock.valueHexView=new Uint8Array(r*4);for(let i=0;i<r;i++){let s=jn(e.charCodeAt(i),8),u=new Uint8Array(s);if(u.length>4)continue;let a=4-u.length;for(let c=u.length-1;c>=0;c--)n[i*4+c+a]=u[c]}this.valueBlock.value=e}};o(Dy,"LocalUniversalStringValueBlock");var Vd=Dy;Vd.NAME="UniversalStringValueBlock";var Gw,qy=class qy extends Vd{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}};o(qy,"UniversalString");var wi=qy;Gw=wi;R.UniversalString=Gw;wi.NAME="UniversalString";var Xw,My=class My extends ht{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}};o(My,"NumericString");var _i=My;Xw=_i;R.NumericString=Xw;_i.NAME="NumericString";var Zw,Uy=class Uy extends ht{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}};o(Uy,"PrintableString");var xi=Uy;Zw=xi;R.PrintableString=Zw;xi.NAME="PrintableString";var Qw,$y=class $y extends ht{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}};o($y,"TeletexString");var Ai=$y;Qw=Ai;R.TeletexString=Qw;Ai.NAME="TeletexString";var Yw,Vy=class Vy extends ht{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}};o(Vy,"VideotexString");var Si=Vy;Yw=Si;R.VideotexString=Yw;Si.NAME="VideotexString";var e_,Hy=class Hy extends ht{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}};o(Hy,"IA5String");var ki=Hy;e_=ki;R.IA5String=e_;ki.NAME="IA5String";var t_,Ly=class Ly extends ht{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}};o(Ly,"GraphicString");var Ci=Ly;t_=Ci;R.GraphicString=t_;Ci.NAME="GraphicString";var r_,Wy=class Wy extends ht{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}};o(Wy,"VisibleString");var Nn=Wy;r_=Nn;R.VisibleString=r_;Nn.NAME="VisibleString";var n_,Fy=class Fy extends ht{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}};o(Fy,"GeneralString");var Ei=Fy;n_=Ei;R.GeneralString=n_;Ei.NAME="GeneralString";var i_,Ky=class Ky extends ht{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}};o(Ky,"CharacterString");var Pi=Ky;i_=Pi;R.CharacterString=i_;Pi.NAME="CharacterString";var o_,Jy=class Jy extends Nn{constructor({value:e,valueDate:r,...n}={}){if(super(n),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let i=0;i<e.length;i++)this.valueBlock.valueHexView[i]=e.charCodeAt(i)}r&&(this.fromDate(r),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,re.BufferSourceConverter.toUint8Array(e)))}toBuffer(){let e=this.toString(),r=new ArrayBuffer(e.length),n=new Uint8Array(r);for(let i=0;i<e.length;i++)n[i]=e.charCodeAt(i);return r}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){let n=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(n===null){this.error="Wrong input string for conversion";return}let i=parseInt(n[1],10);i>=50?this.year=1900+i:this.year=2e3+i,this.month=parseInt(n[2],10),this.day=parseInt(n[3],10),this.hour=parseInt(n[4],10),this.minute=parseInt(n[5],10),this.second=parseInt(n[6],10)}toString(e="iso"){if(e==="iso"){let r=new Array(7);return r[0]=St(this.year<2e3?this.year-1900:this.year-2e3,2),r[1]=St(this.month,2),r[2]=St(this.day,2),r[3]=St(this.hour,2),r[4]=St(this.minute,2),r[5]=St(this.second,2),r[6]="Z",r.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}};o(Jy,"UTCTime");var Bn=Jy;o_=Bn;R.UTCTime=o_;Bn.NAME="UTCTime";var s_,zy=class zy extends Bn{constructor(e={}){var r;super(e),(r=this.millisecond)!==null&&r!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){let e=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond);return new Date(e)}fromString(e){let r=!1,n="",i="",s=0,u,a=0,c=0;if(e[e.length-1]==="Z")n=e.substring(0,e.length-1),r=!0;else{let y=new Number(e[e.length-1]);if(isNaN(y.valueOf()))throw new Error("Wrong input string for conversion");n=e}if(r){if(n.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(n.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let y=1,v=n.indexOf("+"),x="";if(v===-1&&(v=n.indexOf("-"),y=-1),v!==-1){if(x=n.substring(v+1),n=n.substring(0,v),x.length!==2&&x.length!==4)throw new Error("Wrong input string for conversion");let A=parseInt(x.substring(0,2),10);if(isNaN(A.valueOf()))throw new Error("Wrong input string for conversion");if(a=y*A,x.length===4){if(A=parseInt(x.substring(2,4),10),isNaN(A.valueOf()))throw new Error("Wrong input string for conversion");c=y*A}}}let d=n.indexOf(".");if(d===-1&&(d=n.indexOf(",")),d!==-1){let y=new Number(`0${n.substring(d)}`);if(isNaN(y.valueOf()))throw new Error("Wrong input string for conversion");s=y.valueOf(),i=n.substring(0,d)}else i=n;switch(!0){case i.length===8:if(u=/(\d{4})(\d{2})(\d{2})/ig,d!==-1)throw new Error("Wrong input string for conversion");break;case i.length===10:if(u=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let y=60*s;this.minute=Math.floor(y),y=60*(y-this.minute),this.second=Math.floor(y),y=1e3*(y-this.second),this.millisecond=Math.floor(y)}break;case i.length===12:if(u=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let y=60*s;this.second=Math.floor(y),y=1e3*(y-this.second),this.millisecond=Math.floor(y)}break;case i.length===14:if(u=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let y=1e3*s;this.millisecond=Math.floor(y)}break;default:throw new Error("Wrong input string for conversion")}let p=u.exec(i);if(p===null)throw new Error("Wrong input string for conversion");for(let y=1;y<p.length;y++)switch(y){case 1:this.year=parseInt(p[y],10);break;case 2:this.month=parseInt(p[y],10);break;case 3:this.day=parseInt(p[y],10);break;case 4:this.hour=parseInt(p[y],10)+a;break;case 5:this.minute=parseInt(p[y],10)+c;break;case 6:this.second=parseInt(p[y],10);break;default:throw new Error("Wrong input string for conversion")}if(r===!1){let y=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=y.getUTCFullYear(),this.month=y.getUTCMonth(),this.day=y.getUTCDay(),this.hour=y.getUTCHours(),this.minute=y.getUTCMinutes(),this.second=y.getUTCSeconds(),this.millisecond=y.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){let r=[];return r.push(St(this.year,4)),r.push(St(this.month,2)),r.push(St(this.day,2)),r.push(St(this.hour,2)),r.push(St(this.minute,2)),r.push(St(this.second,2)),this.millisecond!==0&&(r.push("."),r.push(St(this.millisecond,3))),r.push("Z"),r.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}};o(zy,"GeneralizedTime");var Ti=zy;s_=Ti;R.GeneralizedTime=s_;Ti.NAME="GeneralizedTime";var u_,Gy=class Gy extends zt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}};o(Gy,"DATE");var cc=Gy;u_=cc;R.DATE=u_;cc.NAME="DATE";var a_,Xy=class Xy extends zt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}};o(Xy,"TimeOfDay");var fc=Xy;a_=fc;R.TimeOfDay=a_;fc.NAME="TimeOfDay";var c_,Zy=class Zy extends zt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}};o(Zy,"DateTime");var dc=Zy;c_=dc;R.DateTime=c_;dc.NAME="DateTime";var f_,Qy=class Qy extends zt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}};o(Qy,"Duration");var lc=Qy;f_=lc;R.Duration=f_;lc.NAME="Duration";var d_,Yy=class Yy extends zt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}};o(Yy,"TIME");var pc=Yy;d_=pc;R.TIME=d_;pc.NAME="TIME";var e0=class e0{constructor({name:e=kt,optional:r=!1}={}){this.name=e,this.optional=r}};o(e0,"Any");var Pr=e0,t0=class t0 extends Pr{constructor({value:e=[],...r}={}){super(r),this.value=e}};o(t0,"Choice");var No=t0,r0=class r0 extends Pr{constructor({value:e=new Pr,local:r=!1,...n}={}){super(n),this.value=e,this.local=r}};o(r0,"Repeated");var Ii=r0,n0=class n0{get data(){return this.dataView.slice().buffer}set data(e){this.dataView=re.BufferSourceConverter.toUint8Array(e)}constructor({data:e=Hd}={}){this.dataView=re.BufferSourceConverter.toUint8Array(e)}fromBER(e,r,n){let i=r+n;return this.dataView=re.BufferSourceConverter.toUint8Array(e).subarray(r,i),i}toBER(e){return this.dataView.slice().buffer}};o(n0,"RawData");var Gh=n0;function Yr(t,e,r){if(r instanceof No){for(let s of r.value)if(Yr(t,e,s).verified)return{verified:!0,result:t};{let s={verified:!1,result:{error:"Wrong values for Choice type"}};return r.hasOwnProperty(zh)&&(s.name=r.name),s}}if(r instanceof Pr)return r.hasOwnProperty(zh)&&(t[r.name]=e),{verified:!0,result:t};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(r instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(m5 in r))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(w5 in r.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(_5 in r.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};let n=r.idBlock.toBER(!1);if(n.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(r.idBlock.fromBER(n,0,n.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(r.idBlock.hasOwnProperty(g5)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:t};if(r.idBlock.hasOwnProperty(v5)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:t};if(r.idBlock.hasOwnProperty(b5)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:t};if(!(y5 in r.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:t};if(r.idBlock.isHexOnly){if(!(Iw in r.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};let s=r.idBlock.valueHexView,u=e.idBlock.valueHexView;if(s.length!==u.length)return{verified:!1,result:t};for(let a=0;a<s.length;a++)if(s[a]!==u[1])return{verified:!1,result:t}}if(r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,kt),r.name&&(t[r.name]=e)),r instanceof R.Constructed){let s=0,u={verified:!1,result:{error:"Unknown error"}},a=r.valueBlock.value.length;if(a>0&&r.valueBlock.value[0]instanceof Ii&&(a=e.valueBlock.value.length),a===0)return{verified:!0,result:t};if(e.valueBlock.value.length===0&&r.valueBlock.value.length!==0){let c=!0;for(let d=0;d<r.valueBlock.value.length;d++)c=c&&(r.valueBlock.value[d].optional||!1);return c?{verified:!0,result:t}:(r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,kt),r.name&&delete t[r.name]),t.error="Inconsistent object length",{verified:!1,result:t})}for(let c=0;c<a;c++)if(c-s>=e.valueBlock.value.length){if(r.valueBlock.value[c].optional===!1){let d={verified:!1,result:t};return t.error="Inconsistent length between ASN.1 data and schema",r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,kt),r.name&&(delete t[r.name],d.name=r.name)),d}}else if(r.valueBlock.value[0]instanceof Ii){if(u=Yr(t,e.valueBlock.value[c],r.valueBlock.value[0].value),u.verified===!1)if(r.valueBlock.value[0].optional)s++;else return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,kt),r.name&&delete t[r.name]),u;if(zh in r.valueBlock.value[0]&&r.valueBlock.value[0].name.length>0){let d={};x5 in r.valueBlock.value[0]&&r.valueBlock.value[0].local?d=e:d=t,typeof d[r.valueBlock.value[0].name]>"u"&&(d[r.valueBlock.value[0].name]=[]),d[r.valueBlock.value[0].name].push(e.valueBlock.value[c])}}else if(u=Yr(t,e.valueBlock.value[c-s],r.valueBlock.value[c]),u.verified===!1)if(r.valueBlock.value[c].optional)s++;else return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,kt),r.name&&delete t[r.name]),u;if(u.verified===!1){let c={verified:!1,result:t};return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,kt),r.name&&(delete t[r.name],c.name=r.name)),c}return{verified:!0,result:t}}if(r.primitiveSchema&&Iw in e.valueBlock){let s=Bo(e.valueBlock.valueHexView);if(s.offset===-1){let u={verified:!1,result:s.result};return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,kt),r.name&&(delete t[r.name],u.name=r.name)),u}return Yr(t,s.result,r.primitiveSchema)}return{verified:!0,result:t}}o(Yr,"compareSchema");function E5(t,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};let r=Bo(re.BufferSourceConverter.toUint8Array(t));return r.offset===-1?{verified:!1,result:r.result}:Yr(r.result,r.result,e)}o(E5,"verifySchema");var g;(function(t){t[t.Sequence=0]="Sequence",t[t.Set=1]="Set",t[t.Choice=2]="Choice"})(g||(g={}));var h;(function(t){t[t.Any=1]="Any",t[t.Boolean=2]="Boolean",t[t.OctetString=3]="OctetString",t[t.BitString=4]="BitString",t[t.Integer=5]="Integer",t[t.Enumerated=6]="Enumerated",t[t.ObjectIdentifier=7]="ObjectIdentifier",t[t.Utf8String=8]="Utf8String",t[t.BmpString=9]="BmpString",t[t.UniversalString=10]="UniversalString",t[t.NumericString=11]="NumericString",t[t.PrintableString=12]="PrintableString",t[t.TeletexString=13]="TeletexString",t[t.VideotexString=14]="VideotexString",t[t.IA5String=15]="IA5String",t[t.GraphicString=16]="GraphicString",t[t.VisibleString=17]="VisibleString",t[t.GeneralString=18]="GeneralString",t[t.CharacterString=19]="CharacterString",t[t.UTCTime=20]="UTCTime",t[t.GeneralizedTime=21]="GeneralizedTime",t[t.DATE=22]="DATE",t[t.TimeOfDay=23]="TimeOfDay",t[t.DateTime=24]="DateTime",t[t.Duration=25]="Duration",t[t.TIME=26]="TIME",t[t.Null=27]="Null"})(h||(h={}));var i0=kr(Qr());var o0=class o0{constructor(e,r=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(i0.BufferSourceConverter.isBufferSource(e))this.unusedBits=r,this.value=i0.BufferSourceConverter.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof dr))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=e.valueBlock.unusedBits,this.value=e.valueBlock.valueHex,this}toASN(){return new dr({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new dr({name:e})}toNumber(){let e="",r=new Uint8Array(this.value);for(let n of r)e+=n.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let r=e.toString(2),n=r.length+7>>3;this.unusedBits=(n<<3)-r.length;let i=new Uint8Array(n);r=r.padStart(n<<3,"0").split("").reverse().join("");let s=0;for(;s<n;)i[s]=parseInt(r.slice(s<<3,(s<<3)+8),2),s++;this.value=i.buffer}};o(o0,"BitString");var Or=o0;var s0=kr(Qr());var u0=class u0{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):s0.BufferSourceConverter.isBufferSource(e)?this.buffer=s0.BufferSourceConverter.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof fr))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new fr({valueHex:this.buffer})}toSchema(e){return new fr({name:e})}};o(u0,"OctetString");var V=u0;var P5={fromASN:o(t=>t instanceof cr?null:t.valueBeforeDecodeView,"fromASN"),toASN:o(t=>{if(t===null)return new cr;let e=on(t);if(e.result.error)throw new Error(e.result.error);return e.result},"toASN")},T5={fromASN:o(t=>t.valueBlock.valueHexView.byteLength>=4?t.valueBlock.toString():t.valueBlock.valueDec,"fromASN"),toASN:o(t=>new rn({value:+t}),"toASN")},I5={fromASN:o(t=>t.valueBlock.valueDec,"fromASN"),toASN:o(t=>new gi({value:t}),"toASN")},ne={fromASN:o(t=>t.valueBlock.valueHexView,"fromASN"),toASN:o(t=>new rn({valueHex:t}),"toASN")};var O5={fromASN:o(t=>t.valueBlock.valueHexView,"fromASN"),toASN:o(t=>new dr({valueHex:t}),"toASN")},R5={fromASN:o(t=>t.valueBlock.toString(),"fromASN"),toASN:o(t=>new vi({value:t}),"toASN")},j5={fromASN:o(t=>t.valueBlock.value,"fromASN"),toASN:o(t=>new mi({value:t}),"toASN")},Do={fromASN:o(t=>t.valueBlock.valueHexView,"fromASN"),toASN:o(t=>new fr({valueHex:t}),"toASN")},l_={fromASN:o(t=>new V(t.getValue()),"fromASN"),toASN:o(t=>t.toASN(),"toASN")};function Gt(t){return{fromASN:o(e=>e.valueBlock.value,"fromASN"),toASN:o(e=>new t({value:e}),"toASN")}}o(Gt,"createStringConverter");var a0=Gt(zt),N5=Gt(bi),B5=Gt(wi),D5=Gt(_i),q5=Gt(xi),M5=Gt(Ai),U5=Gt(Si),$5=Gt(ki),V5=Gt(Ci),H5=Gt(Nn),L5=Gt(Ei),W5=Gt(Pi),F5={fromASN:o(t=>t.toDate(),"fromASN"),toASN:o(t=>new Bn({valueDate:t}),"toASN")},K5={fromASN:o(t=>t.toDate(),"fromASN"),toASN:o(t=>new Ti({valueDate:t}),"toASN")},J5={fromASN:o(()=>null,"fromASN"),toASN:o(()=>new cr,"toASN")};function Dn(t){switch(t){case h.Any:return P5;case h.BitString:return O5;case h.BmpString:return N5;case h.Boolean:return j5;case h.CharacterString:return W5;case h.Enumerated:return I5;case h.GeneralString:return L5;case h.GeneralizedTime:return K5;case h.GraphicString:return V5;case h.IA5String:return $5;case h.Integer:return T5;case h.Null:return J5;case h.NumericString:return D5;case h.ObjectIdentifier:return R5;case h.OctetString:return Do;case h.PrintableString:return q5;case h.TeletexString:return M5;case h.UTCTime:return F5;case h.UniversalString:return B5;case h.Utf8String:return a0;case h.VideotexString:return U5;case h.VisibleString:return H5;default:return null}}o(Dn,"defaultConverter");function Xt(t){return typeof t=="function"&&t.prototype?t.prototype.toASN&&t.prototype.fromASN?!0:Xt(t.prototype):!!(t&&typeof t=="object"&&"toASN"in t&&"fromASN"in t)}o(Xt,"isConvertible");function f0(t){var e;if(t){let r=Object.getPrototypeOf(t);return((e=r?.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:f0(r)}return!1}o(f0,"isTypeOfArray");function p_(t,e){if(!(t&&e)||t.byteLength!==e.byteLength)return!1;let r=new Uint8Array(t),n=new Uint8Array(e);for(let i=0;i<t.byteLength;i++)if(r[i]!==n[i])return!1;return!0}o(p_,"isArrayEqual");var d0=class d0{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,r=!1){let n=this.items.get(e);if(!n)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(r&&!n.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return n}cache(e){let r=this.get(e);r.schema||(r.schema=this.create(e,!0))}createDefault(e){let r={type:g.Sequence,items:{}},n=this.findParentSchema(e);return n&&(Object.assign(r,n),r.items=Object.assign({},r.items,n.items)),r}create(e,r){let n=this.items.get(e)||this.createDefault(e),i=[];for(let s in n.items){let u=n.items[s],a=r?s:"",c;if(typeof u.type=="number"){let p=h[u.type],y=Ir[p];if(!y)throw new Error(`Cannot get ASN1 class by name '${p}'`);c=new y({name:a})}else Xt(u.type)?c=new u.type().toSchema(a):u.optional?this.get(u.type).type===g.Choice?c=new Pr({name:a}):(c=this.create(u.type,!1),c.name=a):c=new Pr({name:a});let d=!!u.optional||u.defaultValue!==void 0;if(u.repeated){c.name="";let p=u.repeated==="set"?pt:it;c=new p({name:"",value:[new Ii({name:a,value:c})]})}if(u.context!==null&&u.context!==void 0)if(u.implicit)if(typeof u.type=="number"||Xt(u.type)){let p=u.repeated?$e:tn;i.push(new p({name:a,optional:d,idBlock:{tagClass:3,tagNumber:u.context}}))}else{this.cache(u.type);let p=!!u.repeated,y=p?c:this.get(u.type,!0).schema;y="valueBlock"in y?y.valueBlock.value:y.value,i.push(new $e({name:p?"":a,optional:d,idBlock:{tagClass:3,tagNumber:u.context},value:y}))}else i.push(new $e({optional:d,idBlock:{tagClass:3,tagNumber:u.context},value:[c]}));else c.optional=d,i.push(c)}switch(n.type){case g.Sequence:return new it({value:i,name:""});case g.Set:return new pt({value:i,name:""});case g.Choice:return new No({value:i,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,r){return this.items.set(e,r),this}findParentSchema(e){let r=Object.getPrototypeOf(e);return r?this.items.get(r)||this.findParentSchema(r):null}};o(d0,"AsnSchemaStorage");var Ld=d0;var Ve=new Ld;var b=o(t=>e=>{let r;Ve.has(e)?r=Ve.get(e):(r=Ve.createDefault(e),Ve.set(e,r)),Object.assign(r,t)},"AsnType");var l=o(t=>(e,r)=>{let n;Ve.has(e.constructor)?n=Ve.get(e.constructor):(n=Ve.createDefault(e.constructor),Ve.set(e.constructor,n));let i=Object.assign({},t);if(typeof i.type=="number"&&!i.converter){let s=Dn(t.type);if(!s)throw new Error(`Cannot get default converter for property '${r}' of ${e.constructor.name}`);i.converter=s}i.raw=t.raw,n.items[r]=i},"AsnProp");var l0=class l0 extends Error{constructor(){super(...arguments),this.schemas=[]}};o(l0,"AsnSchemaValidationError");var qn=l0;var p0=class p0{static parse(e,r){let n=on(e);if(n.result.error)throw new Error(n.result.error);return this.fromASN(n.result,r)}static fromASN(e,r){try{if(Xt(r))return new r().fromASN(e);let n=Ve.get(r);Ve.cache(r);let i=n.schema,s=this.handleChoiceTypes(e,n,r,i);if(s?.result)return s.result;s?.targetSchema&&(i=s.targetSchema);let u=this.handleSequenceTypes(e,n,r,i),a=new r;return f0(r)?this.handleArrayTypes(e,n,r):(this.processSchemaItems(n,u,a),a)}catch(n){throw n instanceof qn&&n.schemas.push(r.name),n}}static handleChoiceTypes(e,r,n,i){if(e.constructor===$e&&r.type===g.Choice&&e.idBlock.tagClass===3)for(let s in r.items){let u=r.items[s];if(u.context===e.idBlock.tagNumber&&u.implicit&&typeof u.type=="function"&&Ve.has(u.type)){let a=Ve.get(u.type);if(a&&a.type===g.Sequence){let c=new it;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in c.valueBlock){c.valueBlock.value=e.valueBlock.value;let d=this.fromASN(c,u.type),p=new n;return p[s]=d,{result:p}}}}}else if(e.constructor===$e&&r.type!==g.Choice){let s=new $e({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:r.schema.valueBlock.value});for(let u in r.items)delete e[u];return{targetSchema:s}}return null}static handleSequenceTypes(e,r,n,i){if(r.type===g.Sequence){let s=Yr({},e,i);if(!s.verified)throw new qn(`Data does not match to ${n.name} ASN1 schema.${s.result.error?` ${s.result.error}`:""}`);return s}else{let s=Yr({},e,i);if(!s.verified)throw new qn(`Data does not match to ${n.name} ASN1 schema.${s.result.error?` ${s.result.error}`:""}`);return s}}static processRepeatedField(e,r,n){let i=e.slice(r);if(i.length===1&&i[0].constructor.name==="Sequence"){let s=i[0];s.valueBlock&&s.valueBlock.value&&Array.isArray(s.valueBlock.value)&&(i=s.valueBlock.value)}if(typeof n.type=="number"){let s=Dn(n.type);if(!s)throw new Error(`No converter for ASN.1 type ${n.type}`);return i.filter(u=>u&&u.valueBlock).map(u=>{try{return s.fromASN(u)}catch{return}}).filter(u=>u!==void 0)}else return i.filter(s=>s&&s.valueBlock).map(s=>{try{return this.fromASN(s,n.type)}catch{return}}).filter(s=>s!==void 0)}static processPrimitiveField(e,r){let n=Dn(r.type);if(!n)throw new Error(`No converter for ASN.1 type ${r.type}`);return n.fromASN(e)}static isOptionalChoiceField(e){return e.optional&&typeof e.type=="function"&&Ve.has(e.type)&&Ve.get(e.type).type===g.Choice}static processOptionalChoiceField(e,r){try{return{processed:!0,value:this.fromASN(e,r.type)}}catch(n){if(n instanceof qn&&/Wrong values for Choice type/.test(n.message))return{processed:!1};throw n}}static handleArrayTypes(e,r,n){if(!("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");let i=r.itemType;if(typeof i=="number"){let s=Dn(i);if(!s)throw new Error(`Cannot get default converter for array item of ${n.name} ASN1 schema`);return n.from(e.valueBlock.value,u=>s.fromASN(u))}else return n.from(e.valueBlock.value,s=>this.fromASN(s,i))}static processSchemaItems(e,r,n){for(let i in e.items){let s=r.result[i];if(!s)continue;let u=e.items[i],a=u.type,c;typeof a=="number"||Xt(a)?c=this.processPrimitiveSchemaItem(s,u,a):c=this.processComplexSchemaItem(s,u,a),c&&typeof c=="object"&&"value"in c&&"raw"in c?(n[i]=c.value,n[`${i}Raw`]=c.raw):n[i]=c}}static processPrimitiveSchemaItem(e,r,n){var i;let s=(i=r.converter)!==null&&i!==void 0?i:Xt(n)?new n:null;if(!s)throw new Error("Converter is empty");return r.repeated?this.processRepeatedPrimitiveItem(e,r,s):this.processSinglePrimitiveItem(e,r,n,s)}static processRepeatedPrimitiveItem(e,r,n){if(r.implicit){let i=r.repeated==="sequence"?it:pt,s=new i;s.valueBlock=e.valueBlock;let u=on(s.toBER(!1));if(u.offset===-1)throw new Error(`Cannot parse the child item. ${u.result.error}`);if(!("value"in u.result.valueBlock&&Array.isArray(u.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");let a=u.result.valueBlock.value;return Array.from(a,c=>n.fromASN(c))}else return Array.from(e,i=>n.fromASN(i))}static processSinglePrimitiveItem(e,r,n,i){let s=e;if(r.implicit){let u;if(Xt(n))u=new n().toSchema("");else{let a=h[n],c=Ir[a];if(!c)throw new Error(`Cannot get '${a}' class from asn1js module`);u=new c}u.valueBlock=s.valueBlock,s=on(u.toBER(!1)).result}return i.fromASN(s)}static processComplexSchemaItem(e,r,n){if(r.repeated){if(!Array.isArray(e))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");return Array.from(e,i=>this.fromASN(i,n))}else{let i=this.handleImplicitTagging(e,r,n);if(this.isOptionalChoiceField(r))try{return this.fromASN(i,n)}catch(s){if(s instanceof qn&&/Wrong values for Choice type/.test(s.message))return;throw s}else{let s=this.fromASN(i,n);return r.raw?{value:s,raw:e.valueBeforeDecodeView}:s}}}static handleImplicitTagging(e,r,n){if(r.implicit&&typeof r.context=="number"){let i=Ve.get(n);if(i.type===g.Sequence){let s=new it;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in s.valueBlock)return s.valueBlock.value=e.valueBlock.value,s}else if(i.type===g.Set){let s=new pt;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in s.valueBlock)return s.valueBlock.value=e.valueBlock.value,s}}return e}};o(p0,"AsnParser");var hc=p0;var Wd=class Wd{static serialize(e){return e instanceof Ue?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&Xt(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");let r=e.constructor,n=Ve.get(r);Ve.cache(r);let i=[];if(n.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof n.itemType=="number"){let u=Dn(n.itemType);if(!u)throw new Error(`Cannot get default converter for array item of ${r.name} ASN1 schema`);i=e.map(a=>u.toASN(a))}else i=e.map(u=>this.toAsnItem({type:n.itemType},"[]",r,u))}else for(let u in n.items){let a=n.items[u],c=e[u];if(c===void 0||a.defaultValue===c||typeof a.defaultValue=="object"&&typeof c=="object"&&p_(this.serialize(a.defaultValue),this.serialize(c)))continue;let d=Wd.toAsnItem(a,u,r,c);if(typeof a.context=="number")if(a.implicit)if(!a.repeated&&(typeof a.type=="number"||Xt(a.type))){let p={};p.valueHex=d instanceof cr?d.valueBeforeDecodeView:d.valueBlock.toBER(),i.push(new tn({optional:a.optional,idBlock:{tagClass:3,tagNumber:a.context},...p}))}else i.push(new $e({optional:a.optional,idBlock:{tagClass:3,tagNumber:a.context},value:d.valueBlock.value}));else i.push(new $e({optional:a.optional,idBlock:{tagClass:3,tagNumber:a.context},value:[d]}));else a.repeated?i=i.concat(d):i.push(d)}let s;switch(n.type){case g.Sequence:s=new it({value:i});break;case g.Set:s=new pt({value:i});break;case g.Choice:if(!i[0])throw new Error(`Schema '${r.name}' has wrong data. Choice cannot be empty.`);s=i[0];break}return s}static toAsnItem(e,r,n,i){let s;if(typeof e.type=="number"){let u=e.converter;if(!u)throw new Error(`Property '${r}' doesn't have converter for type ${h[e.type]} in schema '${n.name}'`);if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");let a=Array.from(i,d=>u.toASN(d)),c=e.repeated==="sequence"?it:pt;s=new c({value:a})}else s=u.toASN(i)}else if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");let u=Array.from(i,c=>this.toASN(c)),a=e.repeated==="sequence"?it:pt;s=new a({value:u})}else s=this.toASN(i);return s}};o(Wd,"AsnSerializer");var yc=Wd;var h0=class h0 extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(let r of e)this.push(r)}}};o(h0,"AsnArray");var U=h0;var y0=kr(Qr());var Fd=class Fd{static serialize(e){return yc.serialize(e)}static parse(e,r){return hc.parse(e,r)}static toString(e){let r=y0.BufferSourceConverter.isBufferSource(e)?y0.BufferSourceConverter.toArrayBuffer(e):Fd.serialize(e),n=on(r);if(n.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${n.result.error}`);return n.result.toString()}};o(Fd,"AsnConvert");var P=Fd;function f(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(u=t[a])&&(s=(i<3?u(s):i>3?u(e,r,s):u(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}o(f,"__decorate");function X(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}o(X,"__classPrivateFieldGet");function _e(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}o(_e,"__classPrivateFieldSet");var h_=kr(Qr());var m0=class m0{static isIPv4(e){return/^(\d{1,3}\.){3}\d{1,3}$/.test(e)}static parseIPv4(e){let r=e.split(".");if(r.length!==4)throw new Error("Invalid IPv4 address");return r.map(n=>{let i=parseInt(n,10);if(isNaN(i)||i<0||i>255)throw new Error("Invalid IPv4 address part");return i})}static parseIPv6(e){let n=this.expandIPv6(e).split(":");if(n.length!==8)throw new Error("Invalid IPv6 address");return n.reduce((i,s)=>{let u=parseInt(s,16);if(isNaN(u)||u<0||u>65535)throw new Error("Invalid IPv6 address part");return i.push(u>>8&255),i.push(u&255),i},[])}static expandIPv6(e){if(!e.includes("::"))return e;let r=e.split("::");if(r.length>2)throw new Error("Invalid IPv6 address");let n=r[0]?r[0].split(":"):[],i=r[1]?r[1].split(":"):[],s=8-(n.length+i.length);if(s<0)throw new Error("Invalid IPv6 address");return[...n,...Array(s).fill("0"),...i].join(":")}static formatIPv6(e){let r=[];for(let n=0;n<16;n+=2)r.push((e[n]<<8|e[n+1]).toString(16));return this.compressIPv6(r.join(":"))}static compressIPv6(e){let r=e.split(":"),n=-1,i=0,s=-1,u=0;for(let a=0;a<r.length;a++)r[a]==="0"?(s===-1&&(s=a),u++):(u>i&&(n=s,i=u),s=-1,u=0);if(u>i&&(n=s,i=u),i>1){let a=r.slice(0,n).join(":"),c=r.slice(n+i).join(":");return`${a}::${c}`}return e}static parseCIDR(e){let[r,n]=e.split("/"),i=parseInt(n,10);if(this.isIPv4(r)){if(i<0||i>32)throw new Error("Invalid IPv4 prefix length");return[this.parseIPv4(r),i]}else{if(i<0||i>128)throw new Error("Invalid IPv6 prefix length");return[this.parseIPv6(r),i]}}static decodeIP(e){if(e.length===64&&parseInt(e,16)===0)return"::/0";if(e.length!==16)return e;let r=parseInt(e.slice(8),16).toString(2).split("").reduce((i,s)=>i+ +s,0),n=e.slice(0,8).replace(/(.{2})/g,i=>`${parseInt(i,16)}.`);return n=n.slice(0,-1),`${n}/${r}`}static toString(e){let r=new Uint8Array(e);if(r.length===4)return Array.from(r).join(".");if(r.length===16)return this.formatIPv6(r);if(r.length===8||r.length===32){let n=r.length/2,i=r.slice(0,n),s=r.slice(n);if(r.every(c=>c===0))return r.length===8?"0.0.0.0/0":"::/0";let a=s.reduce((c,d)=>c+(d.toString(2).match(/1/g)||[]).length,0);return r.length===8?`${Array.from(i).join(".")}/${a}`:`${this.formatIPv6(i)}/${a}`}return this.decodeIP(h_.Convert.ToHex(e))}static fromString(e){if(e.includes("/")){let[n,i]=this.parseCIDR(e),s=new Uint8Array(n.length),u=i;for(let c=0;c<s.length;c++)u>=8?(s[c]=255,u-=8):u>0&&(s[c]=255<<8-u,u=0);let a=new Uint8Array(n.length*2);return a.set(n,0),a.set(s,n.length),a.buffer}let r=this.isIPv4(e)?this.parseIPv4(e):this.parseIPv6(e);return new Uint8Array(r).buffer}};o(m0,"IpConverter");var mc=m0;var y_=kr(Qr());var g0,v0,b0,qo,He=(qo=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}},o(qo,"DirectoryString"),qo);f([l({type:h.TeletexString})],He.prototype,"teletexString",void 0);f([l({type:h.PrintableString})],He.prototype,"printableString",void 0);f([l({type:h.UniversalString})],He.prototype,"universalString",void 0);f([l({type:h.Utf8String})],He.prototype,"utf8String",void 0);f([l({type:h.BmpString})],He.prototype,"bmpString",void 0);He=f([b({type:g.Choice})],He);var Mo,Ho=(Mo=class extends He{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?y_.Convert.ToHex(this.anyValue):super.toString())}},o(Mo,"AttributeValue"),Mo);f([l({type:h.IA5String})],Ho.prototype,"ia5String",void 0);f([l({type:h.Any})],Ho.prototype,"anyValue",void 0);Ho=f([b({type:g.Choice})],Ho);var _0=class _0{constructor(e={}){this.type="",this.value=new Ho,Object.assign(this,e)}};o(_0,"AttributeTypeAndValue");var Oi=_0;f([l({type:h.ObjectIdentifier})],Oi.prototype,"type",void 0);f([l({type:Ho})],Oi.prototype,"value",void 0);var Uo,Mn=g0=(Uo=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,g0.prototype)}},o(Uo,"RelativeDistinguishedName"),Uo);Mn=g0=f([b({type:g.Set,itemType:Oi})],Mn);var $o,w0=v0=($o=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,v0.prototype)}},o($o,"RDNSequence"),$o);w0=v0=f([b({type:g.Sequence,itemType:Mn})],w0);var Vo,be=b0=(Vo=class extends w0{constructor(e){super(e),Object.setPrototypeOf(this,b0.prototype)}},o(Vo,"Name"),Vo);be=b0=f([b({type:g.Sequence})],be);var z5={fromASN:o(t=>mc.toString(Do.fromASN(t)),"fromASN"),toASN:o(t=>Do.toASN(mc.fromString(t)),"toASN")},x0=class x0{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}};o(x0,"OtherName");var Un=x0;f([l({type:h.ObjectIdentifier})],Un.prototype,"typeId",void 0);f([l({type:h.Any,context:0})],Un.prototype,"value",void 0);var A0=class A0{constructor(e={}){this.partyName=new He,Object.assign(this,e)}};o(A0,"EDIPartyName");var gc=A0;f([l({type:He,optional:!0,context:0,implicit:!0})],gc.prototype,"nameAssigner",void 0);f([l({type:He,context:1,implicit:!0})],gc.prototype,"partyName",void 0);var Lo,W=(Lo=class{constructor(e={}){Object.assign(this,e)}},o(Lo,"GeneralName"),Lo);f([l({type:Un,context:0,implicit:!0})],W.prototype,"otherName",void 0);f([l({type:h.IA5String,context:1,implicit:!0})],W.prototype,"rfc822Name",void 0);f([l({type:h.IA5String,context:2,implicit:!0})],W.prototype,"dNSName",void 0);f([l({type:h.Any,context:3,implicit:!0})],W.prototype,"x400Address",void 0);f([l({type:be,context:4,implicit:!1})],W.prototype,"directoryName",void 0);f([l({type:gc,context:5})],W.prototype,"ediPartyName",void 0);f([l({type:h.IA5String,context:6,implicit:!0})],W.prototype,"uniformResourceIdentifier",void 0);f([l({type:h.OctetString,context:7,implicit:!0,converter:z5})],W.prototype,"iPAddress",void 0);f([l({type:h.ObjectIdentifier,context:8,implicit:!0})],W.prototype,"registeredID",void 0);W=f([b({type:g.Choice})],W);var $n="1.3.6.1.5.5.7",Vn=`${$n}.1`,m_=`${$n}.2`,Ri=`${$n}.3`,Kd=`${$n}.48`,XN=`${m_}.1`,ZN=`${m_}.2`,S0=`${Kd}.1`,k0=`${Kd}.2`,C0=`${Kd}.3`,E0=`${Kd}.5`,z="2.5.29";var P0,Jd=`${Vn}.1`,T0=class T0{constructor(e={}){this.accessMethod="",this.accessLocation=new W,Object.assign(this,e)}};o(T0,"AccessDescription");var sn=T0;f([l({type:h.ObjectIdentifier})],sn.prototype,"accessMethod",void 0);f([l({type:W})],sn.prototype,"accessLocation",void 0);var Wo,ji=P0=(Wo=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,P0.prototype)}},o(Wo,"AuthorityInfoAccessSyntax"),Wo);ji=P0=f([b({type:g.Sequence,itemType:sn})],ji);var zd=`${z}.35`,I0=class I0 extends V{};o(I0,"KeyIdentifier");var Ni=I0,O0=class O0{constructor(e={}){e&&Object.assign(this,e)}};o(O0,"AuthorityKeyIdentifier");var Rr=O0;f([l({type:Ni,context:0,optional:!0,implicit:!0})],Rr.prototype,"keyIdentifier",void 0);f([l({type:W,context:1,optional:!0,implicit:!0,repeated:"sequence"})],Rr.prototype,"authorityCertIssuer",void 0);f([l({type:h.Integer,context:2,optional:!0,implicit:!0,converter:ne})],Rr.prototype,"authorityCertSerialNumber",void 0);var Gd=`${z}.19`,R0=class R0{constructor(e={}){this.cA=!1,Object.assign(this,e)}};o(R0,"BasicConstraints");var Bi=R0;f([l({type:h.Boolean,defaultValue:!1})],Bi.prototype,"cA",void 0);f([l({type:h.Integer,optional:!0})],Bi.prototype,"pathLenConstraint",void 0);var j0,Fo,xe=j0=(Fo=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,j0.prototype)}},o(Fo,"GeneralNames"),Fo);xe=j0=f([b({type:g.Sequence,itemType:W})],xe);var N0,G5=`${z}.29`,Ko,g_=N0=(Ko=class extends xe{constructor(e){super(e),Object.setPrototypeOf(this,N0.prototype)}},o(Ko,"CertificateIssuer"),Ko);g_=N0=f([b({type:g.Sequence})],g_);var B0,Zd=`${z}.32`,O7=`${Zd}.0`,Jo,un=(Jo=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}},o(Jo,"DisplayText"),Jo);f([l({type:h.IA5String})],un.prototype,"ia5String",void 0);f([l({type:h.VisibleString})],un.prototype,"visibleString",void 0);f([l({type:h.BmpString})],un.prototype,"bmpString",void 0);f([l({type:h.Utf8String})],un.prototype,"utf8String",void 0);un=f([b({type:g.Choice})],un);var D0=class D0{constructor(e={}){this.organization=new un,this.noticeNumbers=[],Object.assign(this,e)}};o(D0,"NoticeReference");var vc=D0;f([l({type:un})],vc.prototype,"organization",void 0);f([l({type:h.Integer,repeated:"sequence"})],vc.prototype,"noticeNumbers",void 0);var q0=class q0{constructor(e={}){Object.assign(this,e)}};o(q0,"UserNotice");var bc=q0;f([l({type:vc,optional:!0})],bc.prototype,"noticeRef",void 0);f([l({type:un,optional:!0})],bc.prototype,"explicitText",void 0);var zo,Xd=(zo=class{constructor(e={}){Object.assign(this,e)}},o(zo,"Qualifier"),zo);f([l({type:h.IA5String})],Xd.prototype,"cPSuri",void 0);f([l({type:bc})],Xd.prototype,"userNotice",void 0);Xd=f([b({type:g.Choice})],Xd);var M0=class M0{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}};o(M0,"PolicyQualifierInfo");var wc=M0;f([l({type:h.ObjectIdentifier})],wc.prototype,"policyQualifierId",void 0);f([l({type:h.Any})],wc.prototype,"qualifier",void 0);var U0=class U0{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}};o(U0,"PolicyInformation");var Di=U0;f([l({type:h.ObjectIdentifier})],Di.prototype,"policyIdentifier",void 0);f([l({type:wc,repeated:"sequence",optional:!0})],Di.prototype,"policyQualifiers",void 0);var Go,_c=B0=(Go=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,B0.prototype)}},o(Go,"CertificatePolicies"),Go);_c=B0=f([b({type:g.Sequence,itemType:Di})],_c);var q7=`${z}.20`,Xo,xc=(Xo=class{constructor(e=0){this.value=e}},o(Xo,"CRLNumber"),Xo);f([l({type:h.Integer})],xc.prototype,"value",void 0);xc=f([b({type:g.Choice})],xc);var W7=`${z}.27`,Zo,v_=(Zo=class extends xc{},o(Zo,"BaseCRLNumber"),Zo);v_=f([b({type:g.Choice})],v_);var $0,Qd=`${z}.31`,pr;(function(t){t[t.unused=1]="unused",t[t.keyCompromise=2]="keyCompromise",t[t.cACompromise=4]="cACompromise",t[t.affiliationChanged=8]="affiliationChanged",t[t.superseded=16]="superseded",t[t.cessationOfOperation=32]="cessationOfOperation",t[t.certificateHold=64]="certificateHold",t[t.privilegeWithdrawn=128]="privilegeWithdrawn",t[t.aACompromise=256]="aACompromise"})(pr||(pr={}));var V0=class V0 extends Or{toJSON(){let e=[],r=this.toNumber();return r&pr.aACompromise&&e.push("aACompromise"),r&pr.affiliationChanged&&e.push("affiliationChanged"),r&pr.cACompromise&&e.push("cACompromise"),r&pr.certificateHold&&e.push("certificateHold"),r&pr.cessationOfOperation&&e.push("cessationOfOperation"),r&pr.keyCompromise&&e.push("keyCompromise"),r&pr.privilegeWithdrawn&&e.push("privilegeWithdrawn"),r&pr.superseded&&e.push("superseded"),r&pr.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}};o(V0,"Reason");var Ac=V0,Qo,an=(Qo=class{constructor(e={}){Object.assign(this,e)}},o(Qo,"DistributionPointName"),Qo);f([l({type:W,context:0,repeated:"sequence",implicit:!0})],an.prototype,"fullName",void 0);f([l({type:Mn,context:1,implicit:!0})],an.prototype,"nameRelativeToCRLIssuer",void 0);an=f([b({type:g.Choice})],an);var H0=class H0{constructor(e={}){Object.assign(this,e)}};o(H0,"DistributionPoint");var jr=H0;f([l({type:an,context:0,optional:!0})],jr.prototype,"distributionPoint",void 0);f([l({type:Ac,context:1,optional:!0,implicit:!0})],jr.prototype,"reasons",void 0);f([l({type:W,context:2,optional:!0,repeated:"sequence",implicit:!0})],jr.prototype,"cRLIssuer",void 0);var Yo,Hn=$0=(Yo=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,$0.prototype)}},o(Yo,"CRLDistributionPoints"),Yo);Hn=$0=f([b({type:g.Sequence,itemType:jr})],Hn);var L0,iB=`${z}.46`,es,b_=L0=(es=class extends Hn{constructor(e){super(e),Object.setPrototypeOf(this,L0.prototype)}},o(es,"FreshestCRL"),es);b_=L0=f([b({type:g.Sequence,itemType:jr})],b_);var lB=`${z}.28`,qi=class qi{constructor(e={}){this.onlyContainsUserCerts=qi.ONLY,this.onlyContainsCACerts=qi.ONLY,this.indirectCRL=qi.ONLY,this.onlyContainsAttributeCerts=qi.ONLY,Object.assign(this,e)}};o(qi,"IssuingDistributionPoint");var qt=qi;qt.ONLY=!1;f([l({type:an,context:0,optional:!0})],qt.prototype,"distributionPoint",void 0);f([l({type:h.Boolean,context:1,defaultValue:qt.ONLY,implicit:!0})],qt.prototype,"onlyContainsUserCerts",void 0);f([l({type:h.Boolean,context:2,defaultValue:qt.ONLY,implicit:!0})],qt.prototype,"onlyContainsCACerts",void 0);f([l({type:Ac,context:3,optional:!0,implicit:!0})],qt.prototype,"onlySomeReasons",void 0);f([l({type:h.Boolean,context:4,defaultValue:qt.ONLY,implicit:!0})],qt.prototype,"indirectCRL",void 0);f([l({type:h.Boolean,context:5,defaultValue:qt.ONLY,implicit:!0})],qt.prototype,"onlyContainsAttributeCerts",void 0);var w_=`${z}.21`,Sc;(function(t){t[t.unspecified=0]="unspecified",t[t.keyCompromise=1]="keyCompromise",t[t.cACompromise=2]="cACompromise",t[t.affiliationChanged=3]="affiliationChanged",t[t.superseded=4]="superseded",t[t.cessationOfOperation=5]="cessationOfOperation",t[t.certificateHold=6]="certificateHold",t[t.removeFromCRL=8]="removeFromCRL",t[t.privilegeWithdrawn=9]="privilegeWithdrawn",t[t.aACompromise=10]="aACompromise"})(Sc||(Sc={}));var ts,kc=(ts=class{constructor(e=Sc.unspecified){this.reason=Sc.unspecified,this.reason=e}toJSON(){return Sc[this.reason]}toString(){return this.toJSON()}},o(ts,"CRLReason"),ts);f([l({type:h.Enumerated})],kc.prototype,"reason",void 0);kc=f([b({type:g.Choice})],kc);var W0,Yd=`${z}.37`,rs,Cc=W0=(rs=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,W0.prototype)}},o(rs,"ExtendedKeyUsage"),rs);Cc=W0=f([b({type:g.Sequence,itemType:h.ObjectIdentifier})],Cc);var AB=`${Yd}.0`,__=`${Ri}.1`,x_=`${Ri}.2`,A_=`${Ri}.3`,S_=`${Ri}.4`,k_=`${Ri}.8`,C_=`${Ri}.9`;var TB=`${z}.54`,ns,F0=(ns=class{constructor(e=new ArrayBuffer(0)){this.value=e}},o(ns,"InhibitAnyPolicy"),ns);f([l({type:h.Integer,converter:ne})],F0.prototype,"value",void 0);F0=f([b({type:g.Choice})],F0);var E_=`${z}.24`,is,Ec=(is=class{constructor(e){this.value=new Date,e&&(this.value=e)}},o(is,"InvalidityDate"),is);f([l({type:h.GeneralizedTime})],Ec.prototype,"value",void 0);Ec=f([b({type:g.Choice})],Ec);var K0,J0=`${z}.18`,os,P_=K0=(os=class extends xe{constructor(e){super(e),Object.setPrototypeOf(this,K0.prototype)}},o(os,"IssueAlternativeName"),os);P_=K0=f([b({type:g.Sequence})],P_);var el=`${z}.15`,hr;(function(t){t[t.digitalSignature=1]="digitalSignature",t[t.nonRepudiation=2]="nonRepudiation",t[t.keyEncipherment=4]="keyEncipherment",t[t.dataEncipherment=8]="dataEncipherment",t[t.keyAgreement=16]="keyAgreement",t[t.keyCertSign=32]="keyCertSign",t[t.cRLSign=64]="cRLSign",t[t.encipherOnly=128]="encipherOnly",t[t.decipherOnly=256]="decipherOnly"})(hr||(hr={}));var z0=class z0 extends Or{toJSON(){let e=this.toNumber(),r=[];return e&hr.cRLSign&&r.push("crlSign"),e&hr.dataEncipherment&&r.push("dataEncipherment"),e&hr.decipherOnly&&r.push("decipherOnly"),e&hr.digitalSignature&&r.push("digitalSignature"),e&hr.encipherOnly&&r.push("encipherOnly"),e&hr.keyAgreement&&r.push("keyAgreement"),e&hr.keyCertSign&&r.push("keyCertSign"),e&hr.keyEncipherment&&r.push("keyEncipherment"),e&hr.nonRepudiation&&r.push("nonRepudiation"),r}toString(){return`[${this.toJSON().join(", ")}]`}};o(z0,"KeyUsage");var ss=z0;var G0,ZB=`${z}.30`,X0=class X0{constructor(e={}){this.base=new W,this.minimum=0,Object.assign(this,e)}};o(X0,"GeneralSubtree");var as=X0;f([l({type:W})],as.prototype,"base",void 0);f([l({type:h.Integer,context:0,defaultValue:0,implicit:!0})],as.prototype,"minimum",void 0);f([l({type:h.Integer,context:1,optional:!0,implicit:!0})],as.prototype,"maximum",void 0);var us,tl=G0=(us=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,G0.prototype)}},o(us,"GeneralSubtrees"),us);tl=G0=f([b({type:g.Sequence,itemType:as})],tl);var Z0=class Z0{constructor(e={}){Object.assign(this,e)}};o(Z0,"NameConstraints");var rl=Z0;f([l({type:tl,context:0,optional:!0,implicit:!0})],rl.prototype,"permittedSubtrees",void 0);f([l({type:tl,context:1,optional:!0,implicit:!0})],rl.prototype,"excludedSubtrees",void 0);var nD=`${z}.36`,Q0=class Q0{constructor(e={}){Object.assign(this,e)}};o(Q0,"PolicyConstraints");var nl=Q0;f([l({type:h.Integer,context:0,implicit:!0,optional:!0,converter:ne})],nl.prototype,"requireExplicitPolicy",void 0);f([l({type:h.Integer,context:1,implicit:!0,optional:!0,converter:ne})],nl.prototype,"inhibitPolicyMapping",void 0);var Y0,cD=`${z}.33`,em=class em{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}};o(em,"PolicyMapping");var Pc=em;f([l({type:h.ObjectIdentifier})],Pc.prototype,"issuerDomainPolicy",void 0);f([l({type:h.ObjectIdentifier})],Pc.prototype,"subjectDomainPolicy",void 0);var cs,T_=Y0=(cs=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,Y0.prototype)}},o(cs,"PolicyMappings"),cs);T_=Y0=f([b({type:g.Sequence,itemType:Pc})],T_);var tm,rm=`${z}.17`,fs,il=tm=(fs=class extends xe{constructor(e){super(e),Object.setPrototypeOf(this,tm.prototype)}},o(fs,"SubjectAlternativeName"),fs);il=tm=f([b({type:g.Sequence})],il);var nm=class nm{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};o(nm,"Attribute");var Ye=nm;f([l({type:h.ObjectIdentifier})],Ye.prototype,"type",void 0);f([l({type:h.Any,repeated:"set"})],Ye.prototype,"values",void 0);var im,CD=`${z}.9`,ds,I_=im=(ds=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,im.prototype)}},o(ds,"SubjectDirectoryAttributes"),ds);I_=im=f([b({type:g.Sequence,itemType:Ye})],I_);var om=`${z}.14`,sm=class sm extends Ni{};o(sm,"SubjectKeyIdentifier");var Ct=sm;var DD=`${z}.16`,um=class um{constructor(e={}){Object.assign(this,e)}};o(um,"PrivateKeyUsagePeriod");var ol=um;f([l({type:h.GeneralizedTime,context:0,implicit:!0,optional:!0})],ol.prototype,"notBefore",void 0);f([l({type:h.GeneralizedTime,context:1,implicit:!0,optional:!0})],ol.prototype,"notAfter",void 0);var Tc;(function(t){t[t.keyUpdateAllowed=1]="keyUpdateAllowed",t[t.newExtensions=2]="newExtensions",t[t.pKIXCertificate=4]="pKIXCertificate"})(Tc||(Tc={}));var am=class am extends Or{toJSON(){let e=[],r=this.toNumber();return r&Tc.pKIXCertificate&&e.push("pKIXCertificate"),r&Tc.newExtensions&&e.push("newExtensions"),r&Tc.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}};o(am,"EntrustInfo");var sl=am,cm=class cm{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new sl,Object.assign(this,e)}};o(cm,"EntrustVersionInfo");var ul=cm;f([l({type:h.GeneralString})],ul.prototype,"entrustVers",void 0);f([l({type:sl})],ul.prototype,"entrustInfoFlags",void 0);var fm,JD=`${Vn}.11`,ls,O_=fm=(ls=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,fm.prototype)}},o(ls,"SubjectInfoAccessSyntax"),ls);O_=fm=f([b({type:g.Sequence,itemType:sn})],O_);var R_=kr(Qr());var al=class al{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof al&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&R_.isEqual(e.parameters,this.parameters)||e.parameters===this.parameters)}};o(al,"AlgorithmIdentifier");var k=al;f([l({type:h.ObjectIdentifier})],k.prototype,"algorithm",void 0);f([l({type:h.Any,optional:!0})],k.prototype,"parameters",void 0);var dm=class dm{constructor(e={}){this.algorithm=new k,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}};o(dm,"SubjectPublicKeyInfo");var ot=dm;f([l({type:k})],ot.prototype,"algorithm",void 0);f([l({type:h.BitString})],ot.prototype,"subjectPublicKey",void 0);var ps,Oe=(ps=class{constructor(e){if(e)if(typeof e=="string"||typeof e=="number"||e instanceof Date){let r=new Date(e);r.setMilliseconds(0),r.getUTCFullYear()>2049?this.generalTime=r:this.utcTime=r}else Object.assign(this,e)}getTime(){let e=this.utcTime||this.generalTime;if(!e)throw new Error("Cannot get time from CHOICE object");return e}},o(ps,"Time"),ps);f([l({type:h.UTCTime})],Oe.prototype,"utcTime",void 0);f([l({type:h.GeneralizedTime})],Oe.prototype,"generalTime",void 0);Oe=f([b({type:g.Choice})],Oe);var lm=class lm{constructor(e){this.notBefore=new Oe(new Date),this.notAfter=new Oe(new Date),e&&(this.notBefore=new Oe(e.notBefore),this.notAfter=new Oe(e.notAfter))}};o(lm,"Validity");var Ln=lm;f([l({type:Oe})],Ln.prototype,"notBefore",void 0);f([l({type:Oe})],Ln.prototype,"notAfter",void 0);var pm,cl=class cl{constructor(e={}){this.extnID="",this.critical=cl.CRITICAL,this.extnValue=new V,Object.assign(this,e)}};o(cl,"Extension");var st=cl;st.CRITICAL=!1;f([l({type:h.ObjectIdentifier})],st.prototype,"extnID",void 0);f([l({type:h.Boolean,defaultValue:st.CRITICAL})],st.prototype,"critical",void 0);f([l({type:V})],st.prototype,"extnValue",void 0);var hs,Zt=pm=(hs=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,pm.prototype)}},o(hs,"Extensions"),hs);Zt=pm=f([b({type:g.Sequence,itemType:st})],Zt);var cn;(function(t){t[t.v1=0]="v1",t[t.v2=1]="v2",t[t.v3=2]="v3"})(cn||(cn={}));var hm=class hm{constructor(e={}){this.version=cn.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new k,this.issuer=new be,this.validity=new Ln,this.subject=new be,this.subjectPublicKeyInfo=new ot,Object.assign(this,e)}};o(hm,"TBSCertificate");var ut=hm;f([l({type:h.Integer,context:0,defaultValue:cn.v1})],ut.prototype,"version",void 0);f([l({type:h.Integer,converter:ne})],ut.prototype,"serialNumber",void 0);f([l({type:k})],ut.prototype,"signature",void 0);f([l({type:be})],ut.prototype,"issuer",void 0);f([l({type:Ln})],ut.prototype,"validity",void 0);f([l({type:be})],ut.prototype,"subject",void 0);f([l({type:ot})],ut.prototype,"subjectPublicKeyInfo",void 0);f([l({type:h.BitString,context:1,implicit:!0,optional:!0})],ut.prototype,"issuerUniqueID",void 0);f([l({type:h.BitString,context:2,implicit:!0,optional:!0})],ut.prototype,"subjectUniqueID",void 0);f([l({type:Zt,context:3,optional:!0})],ut.prototype,"extensions",void 0);var ym=class ym{constructor(e={}){this.tbsCertificate=new ut,this.signatureAlgorithm=new k,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}};o(ym,"Certificate");var yr=ym;f([l({type:ut,raw:!0})],yr.prototype,"tbsCertificate",void 0);f([l({type:k})],yr.prototype,"signatureAlgorithm",void 0);f([l({type:h.BitString})],yr.prototype,"signatureValue",void 0);var mm=class mm{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new Oe,Object.assign(this,e)}};o(mm,"RevokedCertificate");var Mi=mm;f([l({type:h.Integer,converter:ne})],Mi.prototype,"userCertificate",void 0);f([l({type:Oe})],Mi.prototype,"revocationDate",void 0);f([l({type:st,optional:!0,repeated:"sequence"})],Mi.prototype,"crlEntryExtensions",void 0);var gm=class gm{constructor(e={}){this.signature=new k,this.issuer=new be,this.thisUpdate=new Oe,Object.assign(this,e)}};o(gm,"TBSCertList");var Mt=gm;f([l({type:h.Integer,optional:!0})],Mt.prototype,"version",void 0);f([l({type:k})],Mt.prototype,"signature",void 0);f([l({type:be})],Mt.prototype,"issuer",void 0);f([l({type:Oe})],Mt.prototype,"thisUpdate",void 0);f([l({type:Oe,optional:!0})],Mt.prototype,"nextUpdate",void 0);f([l({type:Mi,repeated:"sequence",optional:!0})],Mt.prototype,"revokedCertificates",void 0);f([l({type:st,optional:!0,context:0,repeated:"sequence"})],Mt.prototype,"crlExtensions",void 0);var vm=class vm{constructor(e={}){this.tbsCertList=new Mt,this.signatureAlgorithm=new k,this.signature=new ArrayBuffer(0),Object.assign(this,e)}};o(vm,"CertificateList");var Ui=vm;f([l({type:Mt,raw:!0})],Ui.prototype,"tbsCertList",void 0);f([l({type:k})],Ui.prototype,"signatureAlgorithm",void 0);f([l({type:h.BitString})],Ui.prototype,"signature",void 0);var C=kr(Qr());var bm=class bm{constructor(e={}){this.issuer=new be,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}};o(bm,"IssuerAndSerialNumber");var mr=bm;f([l({type:be})],mr.prototype,"issuer",void 0);f([l({type:h.Integer,converter:ne})],mr.prototype,"serialNumber",void 0);var ys,$i=(ys=class{constructor(e={}){Object.assign(this,e)}},o(ys,"SignerIdentifier"),ys);f([l({type:Ct,context:0,implicit:!0})],$i.prototype,"subjectKeyIdentifier",void 0);f([l({type:mr})],$i.prototype,"issuerAndSerialNumber",void 0);$i=f([b({type:g.Choice})],$i);var et;(function(t){t[t.v0=0]="v0",t[t.v1=1]="v1",t[t.v2=2]="v2",t[t.v3=3]="v3",t[t.v4=4]="v4",t[t.v5=5]="v5"})(et||(et={}));var ms,Vi=(ms=class extends k{},o(ms,"DigestAlgorithmIdentifier"),ms);Vi=f([b({type:g.Sequence})],Vi);var gs,Ic=(gs=class extends k{},o(gs,"SignatureAlgorithmIdentifier"),gs);Ic=f([b({type:g.Sequence})],Ic);var vs,Et=(vs=class extends k{},o(vs,"KeyEncryptionAlgorithmIdentifier"),vs);Et=f([b({type:g.Sequence})],Et);var bs,Oc=(bs=class extends k{},o(bs,"ContentEncryptionAlgorithmIdentifier"),bs);Oc=f([b({type:g.Sequence})],Oc);var ws,N_=(ws=class extends k{},o(ws,"MessageAuthenticationCodeAlgorithm"),ws);N_=f([b({type:g.Sequence})],N_);var _s,fl=(_s=class extends k{},o(_s,"KeyDerivationAlgorithmIdentifier"),_s);fl=f([b({type:g.Sequence})],fl);var wm=class wm{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};o(wm,"Attribute");var gr=wm;f([l({type:h.ObjectIdentifier})],gr.prototype,"attrType",void 0);f([l({type:h.Any,repeated:"set"})],gr.prototype,"attrValues",void 0);var _m,xm=class xm{constructor(e={}){this.version=et.v0,this.sid=new $i,this.digestAlgorithm=new Vi,this.signatureAlgorithm=new Ic,this.signature=new V,Object.assign(this,e)}};o(xm,"SignerInfo");var Pt=xm;f([l({type:h.Integer})],Pt.prototype,"version",void 0);f([l({type:$i})],Pt.prototype,"sid",void 0);f([l({type:Vi})],Pt.prototype,"digestAlgorithm",void 0);f([l({type:gr,repeated:"set",context:0,implicit:!0,optional:!0,raw:!0})],Pt.prototype,"signedAttrs",void 0);f([l({type:Ic})],Pt.prototype,"signatureAlgorithm",void 0);f([l({type:V})],Pt.prototype,"signature",void 0);f([l({type:gr,repeated:"set",context:1,implicit:!0,optional:!0})],Pt.prototype,"unsignedAttrs",void 0);var xs,Rc=_m=(xs=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,_m.prototype)}},o(xs,"SignerInfos"),xs);Rc=_m=f([b({type:g.Set,itemType:Pt})],Rc);var As,B_=(As=class extends Pt{},o(As,"CounterSignature"),As);B_=f([b({type:g.Sequence})],B_);var Ss,D_=(Ss=class extends Oe{},o(Ss,"SigningTime"),Ss);D_=f([b({type:g.Choice})],D_);var Am=class Am{constructor(e={}){this.acIssuer=new W,this.acSerial=0,this.attrs=[],Object.assign(this,e)}};o(Am,"ACClearAttrs");var jc=Am;f([l({type:W})],jc.prototype,"acIssuer",void 0);f([l({type:h.Integer})],jc.prototype,"acSerial",void 0);f([l({type:Ye,repeated:"sequence"})],jc.prototype,"attrs",void 0);var Sm,ks,Nc=Sm=(ks=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,Sm.prototype)}},o(ks,"AttrSpec"),ks);Nc=Sm=f([b({type:g.Sequence,itemType:h.ObjectIdentifier})],Nc);var km=class km{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}};o(km,"AAControls");var Cs=km;f([l({type:h.Integer,optional:!0})],Cs.prototype,"pathLenConstraint",void 0);f([l({type:Nc,implicit:!0,context:0,optional:!0})],Cs.prototype,"permittedAttrs",void 0);f([l({type:Nc,implicit:!0,context:1,optional:!0})],Cs.prototype,"excludedAttrs",void 0);f([l({type:h.Boolean,defaultValue:!0})],Cs.prototype,"permitUnSpecified",void 0);var Cm=class Cm{constructor(e={}){this.issuer=new xe,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}};o(Cm,"IssuerSerial");var Qt=Cm;f([l({type:xe})],Qt.prototype,"issuer",void 0);f([l({type:h.Integer,converter:ne})],Qt.prototype,"serial",void 0);f([l({type:h.BitString,optional:!0})],Qt.prototype,"issuerUID",void 0);var Em;(function(t){t[t.publicKey=0]="publicKey",t[t.publicKeyCert=1]="publicKeyCert",t[t.otherObjectTypes=2]="otherObjectTypes"})(Em||(Em={}));var Pm=class Pm{constructor(e={}){this.digestedObjectType=Em.publicKey,this.digestAlgorithm=new k,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}};o(Pm,"ObjectDigestInfo");var Yt=Pm;f([l({type:h.Enumerated})],Yt.prototype,"digestedObjectType",void 0);f([l({type:h.ObjectIdentifier,optional:!0})],Yt.prototype,"otherObjectTypeID",void 0);f([l({type:k})],Yt.prototype,"digestAlgorithm",void 0);f([l({type:h.BitString})],Yt.prototype,"objectDigest",void 0);var Tm=class Tm{constructor(e={}){Object.assign(this,e)}};o(Tm,"V2Form");var Hi=Tm;f([l({type:xe,optional:!0})],Hi.prototype,"issuerName",void 0);f([l({type:Qt,context:0,implicit:!0,optional:!0})],Hi.prototype,"baseCertificateID",void 0);f([l({type:Yt,context:1,implicit:!0,optional:!0})],Hi.prototype,"objectDigestInfo",void 0);var Es,Li=(Es=class{constructor(e={}){Object.assign(this,e)}},o(Es,"AttCertIssuer"),Es);f([l({type:W,repeated:"sequence"})],Li.prototype,"v1Form",void 0);f([l({type:Hi,context:0,implicit:!0})],Li.prototype,"v2Form",void 0);Li=f([b({type:g.Choice})],Li);var Im=class Im{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}};o(Im,"AttCertValidityPeriod");var Wi=Im;f([l({type:h.GeneralizedTime})],Wi.prototype,"notBeforeTime",void 0);f([l({type:h.GeneralizedTime})],Wi.prototype,"notAfterTime",void 0);var Om=class Om{constructor(e={}){Object.assign(this,e)}};o(Om,"Holder");var Wn=Om;f([l({type:Qt,implicit:!0,context:0,optional:!0})],Wn.prototype,"baseCertificateID",void 0);f([l({type:xe,implicit:!0,context:1,optional:!0})],Wn.prototype,"entityName",void 0);f([l({type:Yt,implicit:!0,context:2,optional:!0})],Wn.prototype,"objectDigestInfo",void 0);var Rm;(function(t){t[t.v2=1]="v2"})(Rm||(Rm={}));var jm=class jm{constructor(e={}){this.version=Rm.v2,this.holder=new Wn,this.issuer=new Li,this.signature=new k,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new Wi,this.attributes=[],Object.assign(this,e)}};o(jm,"AttributeCertificateInfo");var Tt=jm;f([l({type:h.Integer})],Tt.prototype,"version",void 0);f([l({type:Wn})],Tt.prototype,"holder",void 0);f([l({type:Li})],Tt.prototype,"issuer",void 0);f([l({type:k})],Tt.prototype,"signature",void 0);f([l({type:h.Integer,converter:ne})],Tt.prototype,"serialNumber",void 0);f([l({type:Wi})],Tt.prototype,"attrCertValidityPeriod",void 0);f([l({type:Ye,repeated:"sequence"})],Tt.prototype,"attributes",void 0);f([l({type:h.BitString,optional:!0})],Tt.prototype,"issuerUniqueID",void 0);f([l({type:Zt,optional:!0})],Tt.prototype,"extensions",void 0);var Nm=class Nm{constructor(e={}){this.acinfo=new Tt,this.signatureAlgorithm=new k,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}};o(Nm,"AttributeCertificate");var Fi=Nm;f([l({type:Tt})],Fi.prototype,"acinfo",void 0);f([l({type:k})],Fi.prototype,"signatureAlgorithm",void 0);f([l({type:h.BitString})],Fi.prototype,"signatureValue",void 0);var Bc;(function(t){t[t.unmarked=1]="unmarked",t[t.unclassified=2]="unclassified",t[t.restricted=4]="restricted",t[t.confidential=8]="confidential",t[t.secret=16]="secret",t[t.topSecret=32]="topSecret"})(Bc||(Bc={}));var Bm=class Bm extends Or{};o(Bm,"ClassList");var Ps=Bm;var Dm=class Dm{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}};o(Dm,"SecurityCategory");var Ts=Dm;f([l({type:h.ObjectIdentifier,implicit:!0,context:0})],Ts.prototype,"type",void 0);f([l({type:h.Any,implicit:!0,context:1})],Ts.prototype,"value",void 0);var qm=class qm{constructor(e={}){this.policyId="",this.classList=new Ps(Bc.unclassified),Object.assign(this,e)}};o(qm,"Clearance");var Dc=qm;f([l({type:h.ObjectIdentifier})],Dc.prototype,"policyId",void 0);f([l({type:Ps,defaultValue:new Ps(Bc.unclassified)})],Dc.prototype,"classList",void 0);f([l({type:Ts,repeated:"set"})],Dc.prototype,"securityCategories",void 0);var Mm=class Mm{constructor(e={}){Object.assign(this,e)}};o(Mm,"IetfAttrSyntaxValueChoices");var Is=Mm;f([l({type:V})],Is.prototype,"cotets",void 0);f([l({type:h.ObjectIdentifier})],Is.prototype,"oid",void 0);f([l({type:h.Utf8String})],Is.prototype,"string",void 0);var Um=class Um{constructor(e={}){this.values=[],Object.assign(this,e)}};o(Um,"IetfAttrSyntax");var dl=Um;f([l({type:xe,implicit:!0,context:0,optional:!0})],dl.prototype,"policyAuthority",void 0);f([l({type:Is,repeated:"sequence"})],dl.prototype,"values",void 0);var eV=`${Vn}.4`,tV=`${Vn}.6`,rV=`${Vn}.10`,nV=`${z}.55`,qc=`${$n}.10`,iV=`${qc}.1`,oV=`${qc}.2`,sV=`${qc}.3`,uV=`${qc}.4`,aV=`${qc}.6`,$m="2.5.4",cV=`${$m}.72`;var Vm,Hm=class Hm{constructor(e={}){this.targetCertificate=new Qt,Object.assign(this,e)}};o(Hm,"TargetCert");var js=Hm;f([l({type:Qt})],js.prototype,"targetCertificate",void 0);f([l({type:W,optional:!0})],js.prototype,"targetName",void 0);f([l({type:Yt,optional:!0})],js.prototype,"certDigestInfo",void 0);var Os,Ns=(Os=class{constructor(e={}){Object.assign(this,e)}},o(Os,"Target"),Os);f([l({type:W,context:0,implicit:!0})],Ns.prototype,"targetName",void 0);f([l({type:W,context:1,implicit:!0})],Ns.prototype,"targetGroup",void 0);f([l({type:js,context:2,implicit:!0})],Ns.prototype,"targetCert",void 0);Ns=f([b({type:g.Choice})],Ns);var Rs,ll=Vm=(Rs=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,Vm.prototype)}},o(Rs,"Targets"),Rs);ll=Vm=f([b({type:g.Sequence,itemType:Ns})],ll);var Lm,Bs,q_=Lm=(Bs=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,Lm.prototype)}},o(Bs,"ProxyInfo"),Bs);q_=Lm=f([b({type:g.Sequence,itemType:ll})],q_);var Wm=class Wm{constructor(e={}){Object.assign(this,e)}};o(Wm,"RoleSyntax");var pl=Wm;f([l({type:xe,implicit:!0,context:0,optional:!0})],pl.prototype,"roleAuthority",void 0);f([l({type:W,implicit:!0,context:1})],pl.prototype,"roleName",void 0);var Fm=class Fm{constructor(e={}){this.service=new W,this.ident=new W,Object.assign(this,e)}};o(Fm,"SvceAuthInfo");var Mc=Fm;f([l({type:W})],Mc.prototype,"service",void 0);f([l({type:W})],Mc.prototype,"ident",void 0);f([l({type:V,optional:!0})],Mc.prototype,"authInfo",void 0);var Km,Jm=class Jm{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}};o(Jm,"OtherCertificateFormat");var Uc=Jm;f([l({type:h.ObjectIdentifier})],Uc.prototype,"otherCertFormat",void 0);f([l({type:h.Any})],Uc.prototype,"otherCert",void 0);var Ds,Ki=(Ds=class{constructor(e={}){Object.assign(this,e)}},o(Ds,"CertificateChoices"),Ds);f([l({type:yr})],Ki.prototype,"certificate",void 0);f([l({type:Fi,context:2,implicit:!0})],Ki.prototype,"v2AttrCert",void 0);f([l({type:Uc,context:3,implicit:!0})],Ki.prototype,"other",void 0);Ki=f([b({type:g.Choice})],Ki);var qs,Ji=Km=(qs=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,Km.prototype)}},o(qs,"CertificateSet"),qs);Ji=Km=f([b({type:g.Set,itemType:Ki})],Ji);var zm=class zm{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}};o(zm,"ContentInfo");var er=zm;f([l({type:h.ObjectIdentifier})],er.prototype,"contentType",void 0);f([l({type:h.Any,context:0})],er.prototype,"content",void 0);var Ms,Us=(Ms=class{constructor(e={}){Object.assign(this,e)}},o(Ms,"EncapsulatedContent"),Ms);f([l({type:V})],Us.prototype,"single",void 0);f([l({type:h.Any})],Us.prototype,"any",void 0);Us=f([b({type:g.Choice})],Us);var Gm=class Gm{constructor(e={}){this.eContentType="",Object.assign(this,e)}};o(Gm,"EncapsulatedContentInfo");var zi=Gm;f([l({type:h.ObjectIdentifier})],zi.prototype,"eContentType",void 0);f([l({type:Us,context:0,optional:!0})],zi.prototype,"eContent",void 0);var $s,$c=($s=class{constructor(e={}){Object.assign(this,e)}},o($s,"EncryptedContent"),$s);f([l({type:V,context:0,implicit:!0,optional:!0})],$c.prototype,"value",void 0);f([l({type:V,converter:l_,context:0,implicit:!0,optional:!0,repeated:"sequence"})],$c.prototype,"constructedValue",void 0);$c=f([b({type:g.Choice})],$c);var Xm=class Xm{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new Oc,Object.assign(this,e)}};o(Xm,"EncryptedContentInfo");var Fn=Xm;f([l({type:h.ObjectIdentifier})],Fn.prototype,"contentType",void 0);f([l({type:Oc})],Fn.prototype,"contentEncryptionAlgorithm",void 0);f([l({type:$c,optional:!0})],Fn.prototype,"encryptedContent",void 0);var Zm=class Zm{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}};o(Zm,"OtherKeyAttribute");var Kn=Zm;f([l({type:h.ObjectIdentifier})],Kn.prototype,"keyAttrId",void 0);f([l({type:h.Any,optional:!0})],Kn.prototype,"keyAttr",void 0);var Qm,Ym=class Ym{constructor(e={}){this.subjectKeyIdentifier=new Ct,Object.assign(this,e)}};o(Ym,"RecipientKeyIdentifier");var Ws=Ym;f([l({type:Ct})],Ws.prototype,"subjectKeyIdentifier",void 0);f([l({type:h.GeneralizedTime,optional:!0})],Ws.prototype,"date",void 0);f([l({type:Kn,optional:!0})],Ws.prototype,"other",void 0);var Vs,Fs=(Vs=class{constructor(e={}){Object.assign(this,e)}},o(Vs,"KeyAgreeRecipientIdentifier"),Vs);f([l({type:Ws,context:0,implicit:!0,optional:!0})],Fs.prototype,"rKeyId",void 0);f([l({type:mr,optional:!0})],Fs.prototype,"issuerAndSerialNumber",void 0);Fs=f([b({type:g.Choice})],Fs);var eg=class eg{constructor(e={}){this.rid=new Fs,this.encryptedKey=new V,Object.assign(this,e)}};o(eg,"RecipientEncryptedKey");var Vc=eg;f([l({type:Fs})],Vc.prototype,"rid",void 0);f([l({type:V})],Vc.prototype,"encryptedKey",void 0);var Hs,hl=Qm=(Hs=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,Qm.prototype)}},o(Hs,"RecipientEncryptedKeys"),Hs);hl=Qm=f([b({type:g.Sequence,itemType:Vc})],hl);var tg=class tg{constructor(e={}){this.algorithm=new k,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}};o(tg,"OriginatorPublicKey");var Hc=tg;f([l({type:k})],Hc.prototype,"algorithm",void 0);f([l({type:h.BitString})],Hc.prototype,"publicKey",void 0);var Ls,Gi=(Ls=class{constructor(e={}){Object.assign(this,e)}},o(Ls,"OriginatorIdentifierOrKey"),Ls);f([l({type:Ct,context:0,implicit:!0,optional:!0})],Gi.prototype,"subjectKeyIdentifier",void 0);f([l({type:Hc,context:1,implicit:!0,optional:!0})],Gi.prototype,"originatorKey",void 0);f([l({type:mr,optional:!0})],Gi.prototype,"issuerAndSerialNumber",void 0);Gi=f([b({type:g.Choice})],Gi);var rg=class rg{constructor(e={}){this.version=et.v3,this.originator=new Gi,this.keyEncryptionAlgorithm=new Et,this.recipientEncryptedKeys=new hl,Object.assign(this,e)}};o(rg,"KeyAgreeRecipientInfo");var fn=rg;f([l({type:h.Integer})],fn.prototype,"version",void 0);f([l({type:Gi,context:0})],fn.prototype,"originator",void 0);f([l({type:V,context:1,optional:!0})],fn.prototype,"ukm",void 0);f([l({type:Et})],fn.prototype,"keyEncryptionAlgorithm",void 0);f([l({type:hl})],fn.prototype,"recipientEncryptedKeys",void 0);var Ks,Js=(Ks=class{constructor(e={}){Object.assign(this,e)}},o(Ks,"RecipientIdentifier"),Ks);f([l({type:Ct,context:0,implicit:!0})],Js.prototype,"subjectKeyIdentifier",void 0);f([l({type:mr})],Js.prototype,"issuerAndSerialNumber",void 0);Js=f([b({type:g.Choice})],Js);var ng=class ng{constructor(e={}){this.version=et.v0,this.rid=new Js,this.keyEncryptionAlgorithm=new Et,this.encryptedKey=new V,Object.assign(this,e)}};o(ng,"KeyTransRecipientInfo");var Jn=ng;f([l({type:h.Integer})],Jn.prototype,"version",void 0);f([l({type:Js})],Jn.prototype,"rid",void 0);f([l({type:Et})],Jn.prototype,"keyEncryptionAlgorithm",void 0);f([l({type:V})],Jn.prototype,"encryptedKey",void 0);var ig=class ig{constructor(e={}){this.keyIdentifier=new V,Object.assign(this,e)}};o(ig,"KEKIdentifier");var Xi=ig;f([l({type:V})],Xi.prototype,"keyIdentifier",void 0);f([l({type:h.GeneralizedTime,optional:!0})],Xi.prototype,"date",void 0);f([l({type:Kn,optional:!0})],Xi.prototype,"other",void 0);var og=class og{constructor(e={}){this.version=et.v4,this.kekid=new Xi,this.keyEncryptionAlgorithm=new Et,this.encryptedKey=new V,Object.assign(this,e)}};o(og,"KEKRecipientInfo");var zn=og;f([l({type:h.Integer})],zn.prototype,"version",void 0);f([l({type:Xi})],zn.prototype,"kekid",void 0);f([l({type:Et})],zn.prototype,"keyEncryptionAlgorithm",void 0);f([l({type:V})],zn.prototype,"encryptedKey",void 0);var sg=class sg{constructor(e={}){this.version=et.v0,this.keyEncryptionAlgorithm=new Et,this.encryptedKey=new V,Object.assign(this,e)}};o(sg,"PasswordRecipientInfo");var Gn=sg;f([l({type:h.Integer})],Gn.prototype,"version",void 0);f([l({type:fl,context:0,optional:!0})],Gn.prototype,"keyDerivationAlgorithm",void 0);f([l({type:Et})],Gn.prototype,"keyEncryptionAlgorithm",void 0);f([l({type:V})],Gn.prototype,"encryptedKey",void 0);var ug=class ug{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}};o(ug,"OtherRecipientInfo");var Lc=ug;f([l({type:h.ObjectIdentifier})],Lc.prototype,"oriType",void 0);f([l({type:h.Any})],Lc.prototype,"oriValue",void 0);var zs,dn=(zs=class{constructor(e={}){Object.assign(this,e)}},o(zs,"RecipientInfo"),zs);f([l({type:Jn,optional:!0})],dn.prototype,"ktri",void 0);f([l({type:fn,context:1,implicit:!0,optional:!0})],dn.prototype,"kari",void 0);f([l({type:zn,context:2,implicit:!0,optional:!0})],dn.prototype,"kekri",void 0);f([l({type:Gn,context:3,implicit:!0,optional:!0})],dn.prototype,"pwri",void 0);f([l({type:Lc,context:4,implicit:!0,optional:!0})],dn.prototype,"ori",void 0);dn=f([b({type:g.Choice})],dn);var ag,Gs,Wc=ag=(Gs=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,ag.prototype)}},o(Gs,"RecipientInfos"),Gs);Wc=ag=f([b({type:g.Set,itemType:dn})],Wc);var cg,M_=`${$n}.16`,fL=`${M_}.2`,dL=`${M_}.4`,fg=class fg{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}};o(fg,"OtherRevocationInfoFormat");var Qs=fg;f([l({type:h.ObjectIdentifier})],Qs.prototype,"otherRevInfoFormat",void 0);f([l({type:h.Any})],Qs.prototype,"otherRevInfo",void 0);var Xs,yl=(Xs=class{constructor(e={}){this.other=new Qs,Object.assign(this,e)}},o(Xs,"RevocationInfoChoice"),Xs);f([l({type:Qs,context:1,implicit:!0})],yl.prototype,"other",void 0);yl=f([b({type:g.Choice})],yl);var Zs,Ys=cg=(Zs=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,cg.prototype)}},o(Zs,"RevocationInfoChoices"),Zs);Ys=cg=f([b({type:g.Set,itemType:yl})],Ys);var dg=class dg{constructor(e={}){Object.assign(this,e)}};o(dg,"OriginatorInfo");var eu=dg;f([l({type:Ji,context:0,implicit:!0,optional:!0})],eu.prototype,"certs",void 0);f([l({type:Ys,context:1,implicit:!0,optional:!0})],eu.prototype,"crls",void 0);var lg,tu,pg=lg=(tu=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,lg.prototype)}},o(tu,"UnprotectedAttributes"),tu);pg=lg=f([b({type:g.Set,itemType:gr})],pg);var hg=class hg{constructor(e={}){this.version=et.v0,this.recipientInfos=new Wc,this.encryptedContentInfo=new Fn,Object.assign(this,e)}};o(hg,"EnvelopedData");var Zi=hg;f([l({type:h.Integer})],Zi.prototype,"version",void 0);f([l({type:eu,context:0,implicit:!0,optional:!0})],Zi.prototype,"originatorInfo",void 0);f([l({type:Wc})],Zi.prototype,"recipientInfos",void 0);f([l({type:Fn})],Zi.prototype,"encryptedContentInfo",void 0);f([l({type:pg,context:1,implicit:!0,optional:!0})],Zi.prototype,"unprotectedAttrs",void 0);var U_="1.2.840.113549.1.7.2";var yg,ru,ml=yg=(ru=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,yg.prototype)}},o(ru,"DigestAlgorithmIdentifiers"),ru);ml=yg=f([b({type:g.Set,itemType:Vi})],ml);var mg=class mg{constructor(e={}){this.version=et.v0,this.digestAlgorithms=new ml,this.encapContentInfo=new zi,this.signerInfos=new Rc,Object.assign(this,e)}};o(mg,"SignedData");var ln=mg;f([l({type:h.Integer})],ln.prototype,"version",void 0);f([l({type:ml})],ln.prototype,"digestAlgorithms",void 0);f([l({type:zi})],ln.prototype,"encapContentInfo",void 0);f([l({type:Ji,context:0,implicit:!0,optional:!0})],ln.prototype,"certificates",void 0);f([l({type:Ys,context:1,implicit:!0,optional:!0})],ln.prototype,"crls",void 0);f([l({type:Rc})],ln.prototype,"signerInfos",void 0);var Qi="1.2.840.10045.2.1";var Fc="1.2.840.10045.4.1",gl="1.2.840.10045.4.3.1",Kc="1.2.840.10045.4.3.2",Jc="1.2.840.10045.4.3.3",zc="1.2.840.10045.4.3.4";var gg="1.2.840.10045.3.1.7";var vg="1.3.132.0.34";var bg="1.3.132.0.35";function Gc(t){return new k({algorithm:t})}o(Gc,"create");var V_=Gc(Fc),uW=Gc(gl),H_=Gc(Kc),L_=Gc(Jc),W_=Gc(zc);var nu,Xc=(nu=class{constructor(e={}){Object.assign(this,e)}},o(nu,"FieldID"),nu);f([l({type:h.ObjectIdentifier})],Xc.prototype,"fieldType",void 0);f([l({type:h.Any})],Xc.prototype,"parameters",void 0);Xc=f([b({type:g.Sequence})],Xc);var xg=class xg extends V{};o(xg,"ECPoint");var wg=xg;var iu,su=(iu=class{constructor(e={}){Object.assign(this,e)}},o(iu,"Curve"),iu);f([l({type:h.OctetString})],su.prototype,"a",void 0);f([l({type:h.OctetString})],su.prototype,"b",void 0);f([l({type:h.BitString,optional:!0})],su.prototype,"seed",void 0);su=f([b({type:g.Sequence})],su);var _g;(function(t){t[t.ecpVer1=1]="ecpVer1"})(_g||(_g={}));var ou,Nr=(ou=class{constructor(e={}){this.version=_g.ecpVer1,Object.assign(this,e)}},o(ou,"SpecifiedECDomain"),ou);f([l({type:h.Integer})],Nr.prototype,"version",void 0);f([l({type:Xc})],Nr.prototype,"fieldID",void 0);f([l({type:su})],Nr.prototype,"curve",void 0);f([l({type:wg})],Nr.prototype,"base",void 0);f([l({type:h.Integer,converter:ne})],Nr.prototype,"order",void 0);f([l({type:h.Integer,optional:!0})],Nr.prototype,"cofactor",void 0);Nr=f([b({type:g.Sequence})],Nr);var uu,Br=(uu=class{constructor(e={}){Object.assign(this,e)}},o(uu,"ECParameters"),uu);f([l({type:h.ObjectIdentifier})],Br.prototype,"namedCurve",void 0);f([l({type:h.Null})],Br.prototype,"implicitCurve",void 0);f([l({type:Nr})],Br.prototype,"specifiedCurve",void 0);Br=f([b({type:g.Choice})],Br);var Ag=class Ag{constructor(e={}){this.version=1,this.privateKey=new V,Object.assign(this,e)}};o(Ag,"ECPrivateKey");var au=Ag;f([l({type:h.Integer})],au.prototype,"version",void 0);f([l({type:V})],au.prototype,"privateKey",void 0);f([l({type:Br,context:0,optional:!0})],au.prototype,"parameters",void 0);f([l({type:h.BitString,context:1,optional:!0})],au.prototype,"publicKey",void 0);var Sg=class Sg{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}};o(Sg,"ECDSASigValue");var Yi=Sg;f([l({type:h.Integer,converter:ne})],Yi.prototype,"r",void 0);f([l({type:h.Integer,converter:ne})],Yi.prototype,"s",void 0);var It="1.2.840.113549.1.1",Dr=`${It}.1`,F_=`${It}.7`,K_=`${It}.9`,Xn=`${It}.10`,J_=`${It}.2`,z_=`${It}.4`,cu=`${It}.5`,G_=`${It}.14`;var vl=`${It}.11`,fu=`${It}.12`,du=`${It}.13`,kg=`${It}.15`,Cg=`${It}.16`,eo="1.3.14.3.2.26",bl="2.16.840.1.101.3.4.2.4",to="2.16.840.1.101.3.4.2.1",ro="2.16.840.1.101.3.4.2.2",no="2.16.840.1.101.3.4.2.3",X_="2.16.840.1.101.3.4.2.5",Z_="2.16.840.1.101.3.4.2.6",Q_="1.2.840.113549.2.2",Y_="1.2.840.113549.2.5",Zn=`${It}.8`;function Ke(t){return new k({algorithm:t,parameters:null})}o(Ke,"create");var DW=Ke(Q_),qW=Ke(Y_),pn=Ke(eo),MW=Ke(bl),UW=Ke(to),$W=Ke(ro),VW=Ke(no),HW=Ke(X_),LW=Ke(Z_),wl=new k({algorithm:Zn,parameters:P.serialize(pn)}),Eg=new k({algorithm:K_,parameters:P.serialize(Do.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))}),WW=Ke(Dr),FW=Ke(J_),KW=Ke(z_),JW=Ke(cu),zW=Ke(kg),GW=Ke(Cg),XW=Ke(fu),ZW=Ke(du),QW=Ke(kg),YW=Ke(Cg);var Pg=class Pg{constructor(e={}){this.hashAlgorithm=new k(pn),this.maskGenAlgorithm=new k({algorithm:Zn,parameters:P.serialize(pn)}),this.pSourceAlgorithm=new k(Eg),Object.assign(this,e)}};o(Pg,"RsaEsOaepParams");var lu=Pg;f([l({type:k,context:0,defaultValue:pn})],lu.prototype,"hashAlgorithm",void 0);f([l({type:k,context:1,defaultValue:wl})],lu.prototype,"maskGenAlgorithm",void 0);f([l({type:k,context:2,defaultValue:Eg})],lu.prototype,"pSourceAlgorithm",void 0);var uF=new k({algorithm:F_,parameters:P.serialize(new lu)});var Tg=class Tg{constructor(e={}){this.hashAlgorithm=new k(pn),this.maskGenAlgorithm=new k({algorithm:Zn,parameters:P.serialize(pn)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}};o(Tg,"RsaSaPssParams");var qr=Tg;f([l({type:k,context:0,defaultValue:pn})],qr.prototype,"hashAlgorithm",void 0);f([l({type:k,context:1,defaultValue:wl})],qr.prototype,"maskGenAlgorithm",void 0);f([l({type:h.Integer,context:2,defaultValue:20})],qr.prototype,"saltLength",void 0);f([l({type:h.Integer,context:3,defaultValue:1})],qr.prototype,"trailerField",void 0);var yF=new k({algorithm:Xn,parameters:P.serialize(new qr)});var Ig=class Ig{constructor(e={}){this.digestAlgorithm=new k,this.digest=new V,Object.assign(this,e)}};o(Ig,"DigestInfo");var io=Ig;f([l({type:k})],io.prototype,"digestAlgorithm",void 0);f([l({type:V})],io.prototype,"digest",void 0);var Og,Rg=class Rg{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}};o(Rg,"OtherPrimeInfo");var hu=Rg;f([l({type:h.Integer,converter:ne})],hu.prototype,"prime",void 0);f([l({type:h.Integer,converter:ne})],hu.prototype,"exponent",void 0);f([l({type:h.Integer,converter:ne})],hu.prototype,"coefficient",void 0);var pu,_l=Og=(pu=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,Og.prototype)}},o(pu,"OtherPrimeInfos"),pu);_l=Og=f([b({type:g.Sequence,itemType:hu})],_l);var jg=class jg{constructor(e={}){this.version=0,this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),this.privateExponent=new ArrayBuffer(0),this.prime1=new ArrayBuffer(0),this.prime2=new ArrayBuffer(0),this.exponent1=new ArrayBuffer(0),this.exponent2=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}};o(jg,"RSAPrivateKey");var tr=jg;f([l({type:h.Integer})],tr.prototype,"version",void 0);f([l({type:h.Integer,converter:ne})],tr.prototype,"modulus",void 0);f([l({type:h.Integer,converter:ne})],tr.prototype,"publicExponent",void 0);f([l({type:h.Integer,converter:ne})],tr.prototype,"privateExponent",void 0);f([l({type:h.Integer,converter:ne})],tr.prototype,"prime1",void 0);f([l({type:h.Integer,converter:ne})],tr.prototype,"prime2",void 0);f([l({type:h.Integer,converter:ne})],tr.prototype,"exponent1",void 0);f([l({type:h.Integer,converter:ne})],tr.prototype,"exponent2",void 0);f([l({type:h.Integer,converter:ne})],tr.prototype,"coefficient",void 0);f([l({type:_l,optional:!0})],tr.prototype,"otherPrimeInfos",void 0);var Ng=class Ng{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}};o(Ng,"RSAPublicKey");var yu=Ng;f([l({type:h.Integer,converter:ne})],yu.prototype,"modulus",void 0);f([l({type:h.Integer,converter:ne})],yu.prototype,"publicExponent",void 0);var Bg;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(Bg||(Bg={}));var tt=Bg;var Dg=o(function(t,e){return Dg=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Dg(t,e)},"extendStatics");function Zc(t,e){Dg(t,e);function r(){this.constructor=t}o(r,"__"),t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}o(Zc,"__extends");function e2(t,e,r,n){function i(s){return s instanceof r?s:new r(function(u){u(s)})}return o(i,"adopt"),new(r||(r=Promise))(function(s,u){function a(p){try{d(n.next(p))}catch(y){u(y)}}o(a,"fulfilled");function c(p){try{d(n.throw(p))}catch(y){u(y)}}o(c,"rejected");function d(p){p.done?s(p.value):i(p.value).then(a,c)}o(d,"step"),d((n=n.apply(t,e||[])).next())})}o(e2,"__awaiter");function t2(t,e){var r={label:0,sent:o(function(){if(s[0]&1)throw s[1];return s[1]},"sent"),trys:[],ops:[]},n,i,s,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(d){return function(p){return c([d,p])}}function c(d){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=d[0]&2?i.return:d[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,d[1])).done)return s;switch(i=0,s&&(d=[d[0]&2,s.value]),d[0]){case 0:case 1:s=d;break;case 4:return r.label++,{value:d[1],done:!1};case 5:r.label++,i=d[1],d=[0];continue;case 7:d=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(d[0]===6||d[0]===2)){r=0;continue}if(d[0]===3&&(!s||d[1]>s[0]&&d[1]<s[3])){r.label=d[1];break}if(d[0]===6&&r.label<s[1]){r.label=s[1],s=d;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(d);break}s[2]&&r.ops.pop(),r.trys.pop();continue}d=e.call(t,r)}catch(p){d=[6,p],i=0}finally{n=s=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}o(t2,"__generator");function Qc(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:o(function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}},"next")};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}o(Qc,"__values");function mu(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],u;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){u={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(u)throw u.error}}return s}o(mu,"__read");function Mr(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(mu(arguments[e]));return t}o(Mr,"__spread");var tk="injectionTokens";function qg(t){var e=Reflect.getMetadata("design:paramtypes",t)||[],r=Reflect.getOwnMetadata(tk,t)||{};return Object.keys(r).forEach(function(n){e[+n]=r[n]}),e}o(qg,"getParamInfo");function Yc(t){return!!t.useClass}o(Yc,"isClassProvider");function gu(t){return!!t.useFactory}o(gu,"isFactoryProvider");var xl=(function(){function t(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return o(t,"DelayedConstructor"),t.prototype.createProxy=function(e){var r=this,n={},i=!1,s,u=o(function(){return i||(s=e(r.wrap()),i=!0),s},"delayedObject");return new Proxy(n,this.createHandler(u))},t.prototype.createHandler=function(e){var r={},n=o(function(i){r[i]=function(){for(var s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];s[0]=e();var a=Reflect[i];return a.apply(void 0,Mr(s))}},"install");return this.reflectMethods.forEach(n),r},t})();function Qn(t){return typeof t=="string"||typeof t=="symbol"}o(Qn,"isNormalToken");function Mg(t){return typeof t=="object"&&"token"in t&&"multiple"in t}o(Mg,"isTokenDescriptor");function Al(t){return typeof t=="object"&&"token"in t&&"transform"in t}o(Al,"isTransformDescriptor");function r2(t){return typeof t=="function"||t instanceof xl}o(r2,"isConstructorToken");function oo(t){return!!t.useToken}o(oo,"isTokenProvider");function so(t){return t.useValue!=null}o(so,"isValueProvider");function n2(t){return Yc(t)||so(t)||oo(t)||gu(t)}o(n2,"isProvider");var rk=(function(){function t(){this._registryMap=new Map}return o(t,"RegistryBase"),t.prototype.entries=function(){return this._registryMap.entries()},t.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},t.prototype.get=function(e){this.ensure(e);var r=this._registryMap.get(e);return r[r.length-1]||null},t.prototype.set=function(e,r){this.ensure(e),this._registryMap.get(e).push(r)},t.prototype.setAll=function(e,r){this._registryMap.set(e,r)},t.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},t.prototype.clear=function(){this._registryMap.clear()},t.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},t})(),ef=rk;var nk=(function(t){Zc(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return o(e,"Registry"),e})(ef),i2=nk;var ik=(function(){function t(){this.scopedResolutions=new Map}return o(t,"ResolutionContext"),t})(),tf=ik;function ok(t,e){if(t===null)return"at position #"+e;var r=t.split(",")[e].trim();return'"'+r+'" at position #'+e}o(ok,"formatDependency");function sk(t,e,r){return r===void 0&&(r=" "),Mr([t],e.message.split(`
15
+ `).map(function(n){return r+n})).join(`
16
+ `)}o(sk,"composeErrorMessage");function Ug(t,e,r){var n=mu(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=n[1],s=i===void 0?null:i,u=ok(s,e);return sk("Cannot inject the dependency "+u+' of "'+t.name+'" constructor. Reason:',r)}o(Ug,"formatErrorCtor");function o2(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}o(o2,"isDisposable");var uk=(function(t){Zc(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return o(e,"PreResolutionInterceptors"),e})(ef);var ak=(function(t){Zc(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return o(e,"PostResolutionInterceptors"),e})(ef);var ck=(function(){function t(){this.preResolution=new uk,this.postResolution=new ak}return o(t,"Interceptors"),t})(),s2=ck;var $g=new Map,fk=(function(){function t(e){this.parent=e,this._registry=new i2,this.interceptors=new s2,this.disposed=!1,this.disposables=new Set}return o(t,"InternalDependencyContainer"),t.prototype.register=function(e,r,n){n===void 0&&(n={lifecycle:tt.Transient}),this.ensureNotDisposed();var i;if(n2(r)?i=r:i={useClass:r},oo(i))for(var s=[e],u=i;u!=null;){var a=u.useToken;if(s.includes(a))throw new Error("Token registration cycle detected! "+Mr(s,[a]).join(" -> "));s.push(a);var c=this._registry.get(a);c&&oo(c.provider)?u=c.provider:u=null}if((n.lifecycle===tt.Singleton||n.lifecycle==tt.ContainerScoped||n.lifecycle==tt.ResolutionScoped)&&(so(i)||gu(i)))throw new Error('Cannot use lifecycle "'+tt[n.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:i,options:n}),this},t.prototype.registerType=function(e,r){return this.ensureNotDisposed(),Qn(r)?this.register(e,{useToken:r}):this.register(e,{useClass:r})},t.prototype.registerInstance=function(e,r){return this.ensureNotDisposed(),this.register(e,{useValue:r})},t.prototype.registerSingleton=function(e,r){if(this.ensureNotDisposed(),Qn(e)){if(Qn(r))return this.register(e,{useToken:r},{lifecycle:tt.Singleton});if(r)return this.register(e,{useClass:r},{lifecycle:tt.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var n=e;return r&&!Qn(r)&&(n=r),this.register(e,{useClass:n},{lifecycle:tt.Singleton})},t.prototype.resolve=function(e,r,n){r===void 0&&(r=new tf),n===void 0&&(n=!1),this.ensureNotDisposed();var i=this.getRegistration(e);if(!i&&Qn(e)){if(n)return;throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"Single"),i){var s=this.resolveRegistration(i,r);return this.executePostResolutionInterceptor(e,s,"Single"),s}if(r2(e)){var s=this.construct(e,r);return this.executePostResolutionInterceptor(e,s,"Single"),s}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,r){var n,i;if(this.interceptors.preResolution.has(e)){var s=[];try{for(var u=Qc(this.interceptors.preResolution.getAll(e)),a=u.next();!a.done;a=u.next()){var c=a.value;c.options.frequency!="Once"&&s.push(c),c.callback(e,r)}}catch(d){n={error:d}}finally{try{a&&!a.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}this.interceptors.preResolution.setAll(e,s)}},t.prototype.executePostResolutionInterceptor=function(e,r,n){var i,s;if(this.interceptors.postResolution.has(e)){var u=[];try{for(var a=Qc(this.interceptors.postResolution.getAll(e)),c=a.next();!c.done;c=a.next()){var d=c.value;d.options.frequency!="Once"&&u.push(d),d.callback(e,r,n)}}catch(p){i={error:p}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(e,u)}},t.prototype.resolveRegistration=function(e,r){if(this.ensureNotDisposed(),e.options.lifecycle===tt.ResolutionScoped&&r.scopedResolutions.has(e))return r.scopedResolutions.get(e);var n=e.options.lifecycle===tt.Singleton,i=e.options.lifecycle===tt.ContainerScoped,s=n||i,u;return so(e.provider)?u=e.provider.useValue:oo(e.provider)?u=s?e.instance||(e.instance=this.resolve(e.provider.useToken,r)):this.resolve(e.provider.useToken,r):Yc(e.provider)?u=s?e.instance||(e.instance=this.construct(e.provider.useClass,r)):this.construct(e.provider.useClass,r):gu(e.provider)?u=e.provider.useFactory(this):u=this.construct(e.provider,r),e.options.lifecycle===tt.ResolutionScoped&&r.scopedResolutions.set(e,u),u},t.prototype.resolveAll=function(e,r,n){var i=this;r===void 0&&(r=new tf),n===void 0&&(n=!1),this.ensureNotDisposed();var s=this.getAllRegistrations(e);if(!s&&Qn(e)){if(n)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"All"),s){var u=s.map(function(c){return i.resolveRegistration(c,r)});return this.executePostResolutionInterceptor(e,u,"All"),u}var a=[this.construct(e,r)];return this.executePostResolutionInterceptor(e,a,"All"),a},t.prototype.isRegistered=function(e,r){return r===void 0&&(r=!1),this.ensureNotDisposed(),this._registry.has(e)||r&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},t.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},t.prototype.clearInstances=function(){var e,r;this.ensureNotDisposed();try{for(var n=Qc(this._registry.entries()),i=n.next();!i.done;i=n.next()){var s=mu(i.value,2),u=s[0],a=s[1];this._registry.setAll(u,a.filter(function(c){return!so(c.provider)}).map(function(c){return c.instance=void 0,c}))}}catch(c){e={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},t.prototype.createChildContainer=function(){var e,r;this.ensureNotDisposed();var n=new t(this);try{for(var i=Qc(this._registry.entries()),s=i.next();!s.done;s=i.next()){var u=mu(s.value,2),a=u[0],c=u[1];c.some(function(d){var p=d.options;return p.lifecycle===tt.ContainerScoped})&&n._registry.setAll(a,c.map(function(d){return d.options.lifecycle===tt.ContainerScoped?{provider:d.provider,options:d.options}:d}))}}catch(d){e={error:d}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return n},t.prototype.beforeResolution=function(e,r,n){n===void 0&&(n={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:r,options:n})},t.prototype.afterResolution=function(e,r,n){n===void 0&&(n={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:r,options:n})},t.prototype.dispose=function(){return e2(this,void 0,void 0,function(){var e;return t2(this,function(r){switch(r.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(n){var i=n.dispose();i&&e.push(i)}),[4,Promise.all(e)];case 1:return r.sent(),[2]}})})},t.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},t.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},t.prototype.construct=function(e,r){var n=this;if(e instanceof xl)return e.createProxy(function(s){return n.resolve(s,r)});var i=(function(){var s=$g.get(e);if(!s||s.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var u=s.map(n.resolveParams(r,e));return new(e.bind.apply(e,Mr([void 0],u)))})();return o2(i)&&this.disposables.add(i),i},t.prototype.resolveParams=function(e,r){var n=this;return function(i,s){var u,a,c;try{return Mg(i)?Al(i)?i.multiple?(u=n.resolve(i.transform)).transform.apply(u,Mr([n.resolveAll(i.token,new tf,i.isOptional)],i.transformArgs)):(a=n.resolve(i.transform)).transform.apply(a,Mr([n.resolve(i.token,e,i.isOptional)],i.transformArgs)):i.multiple?n.resolveAll(i.token,new tf,i.isOptional):n.resolve(i.token,e,i.isOptional):Al(i)?(c=n.resolve(i.transform,e)).transform.apply(c,Mr([n.resolve(i.token,e)],i.transformArgs)):n.resolve(i,e)}catch(d){throw new Error(Ug(r,s,d))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t})(),ke=new fk;function dk(t){return function(e){$g.set(e,qg(e)),t&&t.token&&(Array.isArray(t.token)?t.token.forEach(function(r){ke.register(r,e)}):ke.register(t.token,e))}}o(dk,"injectable");var Yn=dk;if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var Hg,Lg=class Lg{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}};o(Lg,"PKCS12Attribute");var uo=Lg;f([l({type:h.ObjectIdentifier})],uo.prototype,"attrId",void 0);f([l({type:h.Any,repeated:"set"})],uo.prototype,"attrValues",void 0);var vu,u2=Hg=(vu=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,Hg.prototype)}},o(vu,"PKCS12AttrSet"),vu);u2=Hg=f([b({type:g.Sequence,itemType:uo})],u2);var Wg,bu,a2=Wg=(bu=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,Wg.prototype)}},o(bu,"AuthenticatedSafe"),bu);a2=Wg=f([b({type:g.Sequence,itemType:er})],a2);var lk="1.2.840.113549",pk=`${lk}.1`,c2=`${pk}.12`,wu=`${c2}.1`,Iz=`${wu}.1`,Oz=`${wu}.2`,Rz=`${wu}.3`,jz=`${wu}.4`,Nz=`${wu}.5`,Bz=`${wu}.6`,ao=`${c2}.10.1`;var Mz=`${ao}.1`,Uz=`${ao}.2`,$z=`${ao}.3`,Vz=`${ao}.4`,Hz=`${ao}.5`,Lz=`${ao}.6`,Sl="1.2.840.113549.1.9";var Fg=class Fg{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}};o(Fg,"CertBag");var kl=Fg;f([l({type:h.ObjectIdentifier})],kl.prototype,"certId",void 0);f([l({type:h.Any,context:0})],kl.prototype,"certValue",void 0);var f2=`${Sl}.22`,zz=`${f2}.1`,Gz=`${f2}.2`;var Kg=class Kg{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}};o(Kg,"CRLBag");var Cl=Kg;f([l({type:h.ObjectIdentifier})],Cl.prototype,"crlId",void 0);f([l({type:h.Any,context:0})],Cl.prototype,"crltValue",void 0);var hk=`${Sl}.23`,tG=`${hk}.1`;var Jg=class Jg extends V{};o(Jg,"EncryptedData");var El=Jg,zg=class zg{constructor(e={}){this.encryptionAlgorithm=new k,this.encryptedData=new El,Object.assign(this,e)}};o(zg,"EncryptedPrivateKeyInfo");var ei=zg;f([l({type:k})],ei.prototype,"encryptionAlgorithm",void 0);f([l({type:El})],ei.prototype,"encryptedData",void 0);var Gg,Xg;(function(t){t[t.v1=0]="v1"})(Xg||(Xg={}));var Qg=class Qg extends V{};o(Qg,"PrivateKey");var Pl=Qg,_u,Zg=Gg=(_u=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,Gg.prototype)}},o(_u,"Attributes"),_u);Zg=Gg=f([b({type:g.Sequence,itemType:Ye})],Zg);var Yg=class Yg{constructor(e={}){this.version=Xg.v1,this.privateKeyAlgorithm=new k,this.privateKey=new Pl,Object.assign(this,e)}};o(Yg,"PrivateKeyInfo");var ti=Yg;f([l({type:h.Integer})],ti.prototype,"version",void 0);f([l({type:k})],ti.prototype,"privateKeyAlgorithm",void 0);f([l({type:Pl})],ti.prototype,"privateKey",void 0);f([l({type:Zg,implicit:!0,context:0,optional:!0})],ti.prototype,"attributes",void 0);var xu,d2=(xu=class extends ti{},o(xu,"KeyBag"),xu);d2=f([b({type:g.Sequence})],d2);var Au,l2=(Au=class extends ei{},o(Au,"PKCS8ShroudedKeyBag"),Au);l2=f([b({type:g.Sequence})],l2);var ev=class ev{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}};o(ev,"SecretBag");var Tl=ev;f([l({type:h.ObjectIdentifier})],Tl.prototype,"secretTypeId",void 0);f([l({type:h.Any,context:0})],Tl.prototype,"secretValue",void 0);var tv=class tv{constructor(e={}){this.mac=new io,this.macSalt=new V,this.iterations=1,Object.assign(this,e)}};o(tv,"MacData");var ri=tv;f([l({type:io})],ri.prototype,"mac",void 0);f([l({type:V})],ri.prototype,"macSalt",void 0);f([l({type:h.Integer,defaultValue:1})],ri.prototype,"iterations",void 0);var rv=class rv{constructor(e={}){this.version=3,this.authSafe=new er,this.macData=new ri,Object.assign(this,e)}};o(rv,"PFX");var co=rv;f([l({type:h.Integer})],co.prototype,"version",void 0);f([l({type:er})],co.prototype,"authSafe",void 0);f([l({type:ri,optional:!0})],co.prototype,"macData",void 0);var nv,iv=class iv{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}};o(iv,"SafeBag");var ku=iv;f([l({type:h.ObjectIdentifier})],ku.prototype,"bagId",void 0);f([l({type:h.Any,context:0})],ku.prototype,"bagValue",void 0);f([l({type:uo,repeated:"set",optional:!0})],ku.prototype,"bagAttributes",void 0);var Su,p2=nv=(Su=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,nv.prototype)}},o(Su,"SafeContents"),Su);p2=nv=f([b({type:g.Sequence,itemType:ku})],p2);var ov,sv,uv,Re="1.2.840.113549.1.9",aX=`${Re}.0`,E2=`${Re}.24`,nf=`${Re}.25`,P2=`${Re}.26`,T2=`${Re}.27`,cX=`${E2}.1`,fX=`${E2}.2`,dX=`${Re}.1`,lX=`${Re}.2`,pX=`${Re}.3`,hX=`${Re}.4`,yX=`${Re}.5`,mX=`${Re}.6`,yv=`${Re}.7`,gX=`${Re}.8`,vX=`${Re}.9`,bX=`${Re}.13`,of=`${Re}.14`,wX=`${Re}.15`,_X=`${Re}.20`,xX=`${Re}.21`;var AX=`${nf}.1`,SX=`${nf}.2`,kX=`${nf}.3`,CX=`${nf}.4`,EX=`${nf}.5`,sf="1.3.6.1.5.5.7.9",PX=`${sf}.1`,TX=`${sf}.2`,IX=`${sf}.3`,OX=`${sf}.4`,RX=`${sf}.5`,jX=`${P2}.1`,NX=`${P2}.2`,BX=`${T2}.1`,DX=`${T2}.2`,qX=`${Re}.16`,MX=`${Re}.22`,UX=`${Re}.23`,$X=`${$m}.65`,Cu,Il=(Cu=class extends He{constructor(e={}){super(e)}toString(){return{}.toString(),this.ia5String||super.toString()}},o(Cu,"PKCS9String"),Cu);f([l({type:h.IA5String})],Il.prototype,"ia5String",void 0);Il=f([b({type:g.Choice})],Il);var Eu,h2=(Eu=class extends er{},o(Eu,"Pkcs7PDU"),Eu);h2=f([b({type:g.Sequence})],h2);var Pu,y2=(Pu=class extends co{},o(Pu,"UserPKCS12"),Pu);y2=f([b({type:g.Sequence})],y2);var Tu,m2=(Tu=class extends ei{},o(Tu,"EncryptedPrivateKeyInfo"),Tu);m2=f([b({type:g.Sequence})],m2);var Iu,av=(Iu=class{constructor(e=""){this.value=e}toString(){return this.value}},o(Iu,"EmailAddress"),Iu);f([l({type:h.IA5String})],av.prototype,"value",void 0);av=f([b({type:g.Choice})],av);var Ou,g2=(Ou=class extends Il{},o(Ou,"UnstructuredName"),Ou);g2=f([b({type:g.Choice})],g2);var Ru,v2=(Ru=class extends He{},o(Ru,"UnstructuredAddress"),Ru);v2=f([b({type:g.Choice})],v2);var ju,cv=(ju=class{constructor(e=new Date){this.value=e}},o(ju,"DateOfBirth"),ju);f([l({type:h.GeneralizedTime})],cv.prototype,"value",void 0);cv=f([b({type:g.Choice})],cv);var Nu,b2=(Nu=class extends He{},o(Nu,"PlaceOfBirth"),Nu);b2=f([b({type:g.Choice})],b2);var Bu,fv=(Bu=class{constructor(e="M"){this.value=e}toString(){return this.value}},o(Bu,"Gender"),Bu);f([l({type:h.PrintableString})],fv.prototype,"value",void 0);fv=f([b({type:g.Choice})],fv);var Du,Ol=(Du=class{constructor(e=""){this.value=e}toString(){return this.value}},o(Du,"CountryOfCitizenship"),Du);f([l({type:h.PrintableString})],Ol.prototype,"value",void 0);Ol=f([b({type:g.Choice})],Ol);var qu,w2=(qu=class extends Ol{},o(qu,"CountryOfResidence"),qu);w2=f([b({type:g.Choice})],w2);var Mu,_2=(Mu=class extends He{},o(Mu,"Pseudonym"),Mu);_2=f([b({type:g.Choice})],_2);var Uu,dv=(Uu=class{constructor(e=""){this.value=e}toString(){return this.value}},o(Uu,"ContentType"),Uu);f([l({type:h.ObjectIdentifier})],dv.prototype,"value",void 0);dv=f([b({type:g.Choice})],dv);var $u,x2=($u=class extends Oe{},o($u,"SigningTime"),$u);x2=f([b({type:g.Choice})],x2);var Vu,lv=(Vu=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}},o(Vu,"SequenceNumber"),Vu);f([l({type:h.Integer})],lv.prototype,"value",void 0);lv=f([b({type:g.Choice})],lv);var Hu,A2=(Hu=class extends Pt{},o(Hu,"CounterSignature"),Hu);A2=f([b({type:g.Sequence})],A2);var Lu,rf=(Lu=class extends He{},o(Lu,"ChallengePassword"),Lu);rf=f([b({type:g.Choice})],rf);var Wu,S2=ov=(Wu=class extends Zt{constructor(e){super(e),Object.setPrototypeOf(this,ov.prototype)}},o(Wu,"ExtensionRequest"),Wu);S2=ov=f([b({type:g.Sequence})],S2);var Fu,k2=sv=(Fu=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,sv.prototype)}},o(Fu,"ExtendedCertificateAttributes"),Fu);k2=sv=f([b({type:g.Set,itemType:gr})],k2);var Ku,pv=(Ku=class{constructor(e=""){this.value=e}toString(){return this.value}},o(Ku,"FriendlyName"),Ku);f([l({type:h.BmpString})],pv.prototype,"value",void 0);pv=f([b({type:g.Choice})],pv);var Ju,hv=(Ju=class extends k{},o(Ju,"SMIMECapability"),Ju);hv=f([b({type:g.Sequence})],hv);var zu,C2=uv=(zu=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,uv.prototype)}},o(zu,"SMIMECapabilities"),zu);C2=uv=f([b({type:g.Sequence,itemType:hv})],C2);var mv,Gu,uf=mv=(Gu=class extends U{constructor(e){super(e),Object.setPrototypeOf(this,mv.prototype)}},o(Gu,"Attributes"),Gu);uf=mv=f([b({type:g.Sequence,itemType:Ye})],uf);var gv=class gv{constructor(e={}){this.version=0,this.subject=new be,this.subjectPKInfo=new ot,this.attributes=new uf,Object.assign(this,e)}};o(gv,"CertificationRequestInfo");var Ur=gv;f([l({type:h.Integer})],Ur.prototype,"version",void 0);f([l({type:be})],Ur.prototype,"subject",void 0);f([l({type:ot})],Ur.prototype,"subjectPKInfo",void 0);f([l({type:uf,implicit:!0,context:0,optional:!0})],Ur.prototype,"attributes",void 0);var vv=class vv{constructor(e={}){this.certificationRequestInfo=new Ur,this.signatureAlgorithm=new k,this.signature=new ArrayBuffer(0),Object.assign(this,e)}};o(vv,"CertificationRequest");var ni=vv;f([l({type:Ur,raw:!0})],ni.prototype,"certificationRequestInfo",void 0);f([l({type:k})],ni.prototype,"signatureAlgorithm",void 0);f([l({type:h.BitString})],ni.prototype,"signature",void 0);var jf="crypto.algorithm",Bv=class Bv{getAlgorithms(){return ke.resolveAll(jf)}toAsnAlgorithm(e){({...e});for(let r of this.getAlgorithms()){let n=r.toAsnAlgorithm(e);if(n)return n}if(/^[0-9.]+$/.test(e.name)){let r=new k({algorithm:e.name});if("parameters"in e){let n=e;r.parameters=n.parameters}return r}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(let n of this.getAlgorithms()){let i=n.toWebAlgorithm(e);if(i)return i}return{name:e.algorithm,parameters:e.parameters}}};o(Bv,"AlgorithmProvider");var Pv=Bv,ia="crypto.algorithmProvider";ke.registerSingleton(ia,Pv);var Bl,Rt="1.3.36.3.3.2.8.1.1",I2=`${Rt}.1`,O2=`${Rt}.2`,R2=`${Rt}.3`,j2=`${Rt}.4`,N2=`${Rt}.5`,B2=`${Rt}.6`,D2=`${Rt}.7`,q2=`${Rt}.8`,M2=`${Rt}.9`,U2=`${Rt}.10`,$2=`${Rt}.11`,V2=`${Rt}.12`,H2=`${Rt}.13`,L2=`${Rt}.14`,W2="brainpoolP160r1",F2="brainpoolP160t1",K2="brainpoolP192r1",J2="brainpoolP192t1",z2="brainpoolP224r1",G2="brainpoolP224t1",X2="brainpoolP256r1",Z2="brainpoolP256t1",Q2="brainpoolP320r1",Y2="brainpoolP320t1",ex="brainpoolP384r1",tx="brainpoolP384t1",rx="brainpoolP512r1",nx="brainpoolP512t1",Ce="ECDSA",ea,Tf=Bl=(ea=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case Ce.toLowerCase():if("hash"in e)switch((typeof e.hash=="string"?e.hash:e.hash.name).toLowerCase()){case"sha-1":return V_;case"sha-256":return H_;case"sha-384":return L_;case"sha-512":return W_}else if("namedCurve"in e){let r="";switch(e.namedCurve){case"P-256":r=gg;break;case"K-256":r=Bl.SECP256K1;break;case"P-384":r=vg;break;case"P-521":r=bg;break;case W2:r=I2;break;case F2:r=O2;break;case K2:r=R2;break;case J2:r=j2;break;case z2:r=N2;break;case G2:r=B2;break;case X2:r=D2;break;case Z2:r=q2;break;case Q2:r=M2;break;case Y2:r=U2;break;case ex:r=$2;break;case tx:r=V2;break;case rx:r=H2;break;case nx:r=L2;break}if(r)return new k({algorithm:Qi,parameters:P.serialize(new Br({namedCurve:r}))})}}return null}toWebAlgorithm(e){switch(e.algorithm){case Fc:return{name:Ce,hash:{name:"SHA-1"}};case Kc:return{name:Ce,hash:{name:"SHA-256"}};case Jc:return{name:Ce,hash:{name:"SHA-384"}};case zc:return{name:Ce,hash:{name:"SHA-512"}};case Qi:{if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(P.parse(e.parameters,Br).namedCurve){case gg:return{name:Ce,namedCurve:"P-256"};case Bl.SECP256K1:return{name:Ce,namedCurve:"K-256"};case vg:return{name:Ce,namedCurve:"P-384"};case bg:return{name:Ce,namedCurve:"P-521"};case I2:return{name:Ce,namedCurve:W2};case O2:return{name:Ce,namedCurve:F2};case R2:return{name:Ce,namedCurve:K2};case j2:return{name:Ce,namedCurve:J2};case N2:return{name:Ce,namedCurve:z2};case B2:return{name:Ce,namedCurve:G2};case D2:return{name:Ce,namedCurve:X2};case q2:return{name:Ce,namedCurve:Z2};case M2:return{name:Ce,namedCurve:Q2};case U2:return{name:Ce,namedCurve:Y2};case $2:return{name:Ce,namedCurve:ex};case V2:return{name:Ce,namedCurve:tx};case H2:return{name:Ce,namedCurve:rx};case L2:return{name:Ce,namedCurve:nx}}}}return null}},o(ea,"EcAlgorithm"),ea);Tf.SECP256K1="1.3.132.0.10";Tf=Bl=f([Yn()],Tf);ke.registerSingleton(jf,Tf);var hx=Symbol("name"),yx=Symbol("value"),Dv=class Dv{constructor(e,r={},n=""){this[hx]=e,this[yx]=n;for(let i in r)this[i]=r[i]}};o(Dv,"TextObject");var ce=Dv;ce.NAME=hx;ce.VALUE=yx;var qv=class qv{static toTextObject(e){let r=new ce("Algorithm Identifier",{},Vr.toString(e.algorithm));if(e.parameters)if(e.algorithm===Qi){let n=new Tf().toWebAlgorithm(e);n&&"namedCurve"in n?r["Named Curve"]=n.namedCurve:r.Parameters=e.parameters}else r.Parameters=e.parameters;return r}};o(qv,"DefaultAlgorithmSerializer");var Tv=qv,Mv=class Mv{static toString(e){let r=this.items[e];return r||e}};o(Mv,"OidSerializer");var Vr=Mv;Vr.items={[eo]:"sha1",[bl]:"sha224",[to]:"sha256",[ro]:"sha384",[no]:"sha512",[Dr]:"rsaEncryption",[cu]:"sha1WithRSAEncryption",[G_]:"sha224WithRSAEncryption",[vl]:"sha256WithRSAEncryption",[fu]:"sha384WithRSAEncryption",[du]:"sha512WithRSAEncryption",[Qi]:"ecPublicKey",[Fc]:"ecdsaWithSHA1",[gl]:"ecdsaWithSHA224",[Kc]:"ecdsaWithSHA256",[Jc]:"ecdsaWithSHA384",[zc]:"ecdsaWithSHA512",[__]:"TLS WWW server authentication",[x_]:"TLS WWW client authentication",[A_]:"Code Signing",[S_]:"E-mail Protection",[k_]:"Time Stamping",[C_]:"OCSP Signing",[U_]:"Signed Data"};var Uv=class Uv{static serialize(e){return this.serializeObj(e).join(`
17
+ `)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,r=0){let n=[],i=this.pad(r++),s="",u=e[ce.VALUE];u&&(s=` ${u}`),n.push(`${i}${e[ce.NAME]}:${s}`),i=this.pad(r);for(let a in e){if(typeof a=="symbol")continue;let c=e[a],d=a?`${a}: `:"";if(typeof c=="string"||typeof c=="number"||typeof c=="boolean")n.push(`${i}${d}${c}`);else if(c instanceof Date)n.push(`${i}${d}${c.toUTCString()}`);else if(Array.isArray(c))for(let p of c)p[ce.NAME]=a,n.push(...this.serializeObj(p,r));else if(c instanceof ce)c[ce.NAME]=a,n.push(...this.serializeObj(c,r));else if(C.BufferSourceConverter.isBufferSource(c))a?(n.push(`${i}${d}`),n.push(...this.serializeBufferSource(c,r+1))):n.push(...this.serializeBufferSource(c,r));else if("toTextObject"in c){let p=c.toTextObject();p[ce.NAME]=a,n.push(...this.serializeObj(p,r))}else throw new TypeError("Cannot serialize data in text format. Unsupported type.")}return n}static serializeBufferSource(e,r=0){let n=this.pad(r),i=C.BufferSourceConverter.toUint8Array(e),s=[];for(let u=0;u<i.length;){let a=[];for(let c=0;c<16&&u<i.length;c++){c===8&&a.push("");let d=i[u++].toString(16).padStart(2,"0");a.push(d)}s.push(`${n}${a.join(" ")}`)}return s}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}};o(Uv,"TextConverter");var hn=Uv;hn.oidSerializer=Vr;hn.algorithmSerializer=Tv;var Xu,zl=class zl{get rawData(){return X(this,Xu,"f")||_e(this,Xu,P.serialize(this.asn),"f"),X(this,Xu,"f")}constructor(...e){Xu.set(this,void 0),C.BufferSourceConverter.isBufferSource(e[0])?(this.asn=P.parse(e[0],e[1]),_e(this,Xu,C.BufferSourceConverter.toArrayBuffer(e[0]),"f"),this.onInit(this.asn)):(this.asn=e[0],this.onInit(this.asn))}equal(e){return e instanceof zl?(0,C.isEqual)(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return P.toString(this.rawData);case"text":return hn.serialize(this.toTextObject());case"hex":return C.Convert.ToHex(this.rawData);case"base64":return C.Convert.ToBase64(this.rawData);case"base64url":return C.Convert.ToBase64Url(this.rawData);default:throw TypeError("Argument 'format' is unsupported value")}}getTextName(){return this.constructor.NAME}toTextObject(){let e=this.toTextObjectEmpty();return e[""]=this.rawData,e}toTextObjectEmpty(e){return new ce(this.getTextName(),{},e)}};o(zl,"AsnData");var oi=zl;Xu=new WeakMap;oi.NAME="ASN";var Gl=class Gl extends oi{constructor(...e){let r;C.BufferSourceConverter.isBufferSource(e[0])?r=C.BufferSourceConverter.toArrayBuffer(e[0]):r=P.serialize(new st({extnID:e[0],critical:e[1],extnValue:new V(C.BufferSourceConverter.toArrayBuffer(e[2]))})),super(r,st)}onInit(e){this.type=e.extnID,this.critical=e.critical,this.value=e.extnValue.buffer}toTextObject(){let e=this.toTextObjectWithoutValue();return e[""]=this.value,e}toTextObjectWithoutValue(){let e=this.toTextObjectEmpty(this.critical?"critical":void 0);return e[ce.NAME]===Gl.NAME&&(e[ce.NAME]=Vr.toString(this.type)),e}};o(Gl,"Extension");var Ut=Gl,mx,fo=class fo{static isCryptoKeyPair(e){return e&&e.privateKey&&e.publicKey}static isCryptoKey(e){return e&&e.usages&&e.type&&e.algorithm&&e.extractable!==void 0}constructor(){this.items=new Map,this[mx]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(fo.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(fo.DEFAULT,global.crypto)}clear(){this.items.clear()}delete(e){return this.items.delete(e)}forEach(e,r){return this.items.forEach(e,r)}has(e){return this.items.has(e)}get size(){return this.items.size}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}[Symbol.iterator](){return this.items[Symbol.iterator]()}get(e=fo.DEFAULT){let r=this.items.get(e.toLowerCase());if(!r)throw new Error(`Cannot get Crypto by name '${e}'`);return r}set(e,r){if(typeof e=="string"){if(!r)throw new TypeError("Argument 'value' is required");this.items.set(e.toLowerCase(),r)}else this.items.set(fo.DEFAULT,e);return this}};o(fo,"CryptoProvider");var If=fo;mx=Symbol.toStringTag;If.DEFAULT="default";var yt=new If,vk=/^[0-2](?:\.[1-9][0-9]*)+$/;function bk(t){return new RegExp(vk).test(t)}o(bk,"isOID");var $v=class $v{constructor(e={}){this.items={};for(let r in e)this.register(r,e[r])}get(e){return this.items[e]||null}findId(e){return bk(e)?e:this.get(e)}register(e,r){this.items[e]=r,this.items[r]=e}};o($v,"NameIdentifier");var ql=$v,Ot=new ql;Ot.register("CN","2.5.4.3");Ot.register("L","2.5.4.7");Ot.register("ST","2.5.4.8");Ot.register("O","2.5.4.10");Ot.register("OU","2.5.4.11");Ot.register("C","2.5.4.6");Ot.register("DC","0.9.2342.19200300.100.1.25");Ot.register("E","1.2.840.113549.1.9.1");Ot.register("G","2.5.4.42");Ot.register("I","2.5.4.43");Ot.register("SN","2.5.4.4");Ot.register("T","2.5.4.12");function wk(t,e){return`\\${C.Convert.ToHex(C.Convert.FromUtf8String(e)).toUpperCase()}`}o(wk,"replaceUnknownCharacter");function _k(t){return t.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,wk)}o(_k,"escape");var Xl=class Xl{static isASCII(e){for(let r=0;r<e.length;r++)if(e.charCodeAt(r)>255)return!1;return!0}static isPrintableString(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(e)}constructor(e,r={}){this.extraNames=new ql,this.asn=new be;for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n)){let i=r[n];this.extraNames.register(n,i)}typeof e=="string"?this.asn=this.fromString(e):e instanceof be?this.asn=e:C.BufferSourceConverter.isBufferSource(e)?this.asn=P.parse(e,be):this.asn=this.fromJSON(e)}getField(e){let r=this.extraNames.findId(e)||Ot.findId(e),n=[];for(let i of this.asn)for(let s of i)s.type===r&&n.push(s.value.toString());return n}getName(e){return this.extraNames.get(e)||Ot.get(e)}toString(){return this.asn.map(e=>e.map(r=>{let n=this.getName(r.type)||r.type,i=r.value.anyValue?`#${C.Convert.ToHex(r.value.anyValue)}`:_k(r.value.toString());return`${n}=${i}`}).join("+")).join(", ")}toJSON(){var e;let r=[];for(let n of this.asn){let i={};for(let s of n){let u=this.getName(s.type)||s.type;(e=i[u])!==null&&e!==void 0||(i[u]=[]),i[u].push(s.value.anyValue?`#${C.Convert.ToHex(s.value.anyValue)}`:s.value.toString())}r.push(i)}return r}fromString(e){let r=new be,n=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+"\\](?=[,+]|$))|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g,i=null,s=",";for(;i=n.exec(`${e},`);){let[,u,a]=i,c=a[a.length-1];(c===","||c==="+")&&(a=a.slice(0,a.length-1),i[3]=c);let d=i[3];u=this.getTypeOid(u);let p=this.createAttribute(u,a);s==="+"?r[r.length-1].push(p):r.push(new Mn([p])),s=d}return r}fromJSON(e){let r=new be;for(let n of e){let i=new Mn;for(let s in n){let u=this.getTypeOid(s),a=n[s];for(let c of a){let d=this.createAttribute(u,c);i.push(d)}}r.push(i)}return r}getTypeOid(e){if(/[\d.]+/.test(e)||(e=this.getName(e)||""),!e)throw new Error(`Cannot get OID for name type '${e}'`);return e}createAttribute(e,r){let n=new Oi({type:e});if(typeof r=="object")for(let i in r)switch(i){case"ia5String":n.value.ia5String=r[i];break;case"utf8String":n.value.utf8String=r[i];break;case"universalString":n.value.universalString=r[i];break;case"bmpString":n.value.bmpString=r[i];break;case"printableString":n.value.printableString=r[i];break}else if(r[0]==="#")n.value.anyValue=C.Convert.FromHex(r.slice(1));else{let i=this.processStringValue(r);e===this.getName("E")||e===this.getName("DC")?n.value.ia5String=i:Xl.isPrintableString(i)?n.value.printableString=i:n.value.utf8String=i}return n}processStringValue(e){let r=/"(.*?[^\\])?"/.exec(e);return r&&(e=r[1]),e.replace(/\\0a/ig,`
18
+ `).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return P.serialize(this.asn)}async getThumbprint(...e){var r;let n,i="SHA-1";return e.length>=1&&!(!((r=e[0])===null||r===void 0)&&r.subtle)?(i=e[0]||i,n=e[1]||yt.get()):n=e[0]||yt.get(),await n.subtle.digest(i,this.toArrayBuffer())}};o(Xl,"Name");var po=Xl,gx="Cannot initialize GeneralName from ASN.1 data.",ix=`${gx} Unsupported string format in use.`,xk=`${gx} Value doesn't match to GUID regular expression.`,ox=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,sx="1.3.6.1.4.1.311.25.1",ux="1.3.6.1.4.1.311.20.2.3",bv="dns",wv="dn",_v="email",xv="ip",Av="url",Sv="guid",kv="upn",Rl="id",Vv=class Vv extends oi{constructor(...e){let r;if(e.length===2)switch(e[0]){case wv:{let n=new po(e[1]).toArrayBuffer(),i=P.parse(n,be);r=new W({directoryName:i});break}case bv:r=new W({dNSName:e[1]});break;case _v:r=new W({rfc822Name:e[1]});break;case Sv:{let n=new RegExp(ox,"i").exec(e[1]);if(!n)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");let i=n.slice(1).map((s,u)=>u<3?C.Convert.ToHex(new Uint8Array(C.Convert.FromHex(s)).reverse()):s).join("");r=new W({otherName:new Un({typeId:sx,value:P.serialize(new V(C.Convert.FromHex(i)))})});break}case xv:r=new W({iPAddress:e[1]});break;case Rl:r=new W({registeredID:e[1]});break;case kv:{r=new W({otherName:new Un({typeId:ux,value:P.serialize(a0.toASN(e[1]))})});break}case Av:r=new W({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else C.BufferSourceConverter.isBufferSource(e[0])?r=P.parse(e[0],W):r=e[0];super(r)}onInit(e){if(e.dNSName!=null)this.type=bv,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=_v,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=xv,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=Av,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=Rl,this.value=e.registeredID;else if(e.directoryName!=null)this.type=wv,this.value=new po(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===sx){this.type=Sv;let r=P.parse(e.otherName.value,V),n=new RegExp(ox,"i").exec(C.Convert.ToHex(r));if(!n)throw new Error(xk);this.value=n.slice(1).map((i,s)=>s<3?C.Convert.ToHex(new Uint8Array(C.Convert.FromHex(i)).reverse()):i).join("-")}else if(e.otherName.typeId===ux)this.type=kv,this.value=P.parse(e.otherName.value,He).toString();else throw new Error(ix);else throw new Error(ix)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case wv:case bv:case Sv:case xv:case Rl:case kv:case Av:e=this.type.toUpperCase();break;case _v:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let r=this.value;return this.type===Rl&&(r=Vr.toString(r)),new ce(e,void 0,r)}};o(Vv,"GeneralName");var $r=Vv,Hv=class Hv extends oi{constructor(e){let r;if(e instanceof xe)r=e;else if(Array.isArray(e)){let n=[];for(let i of e)if(i instanceof W)n.push(i);else{let s=P.parse(new $r(i.type,i.value).rawData,W);n.push(s)}r=new xe(n)}else if(C.BufferSourceConverter.isBufferSource(e))r=P.parse(e,xe);else throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(r)}onInit(e){let r=[];for(let n of e){let i=null;try{i=new $r(n)}catch{continue}r.push(i)}this.items=r}toJSON(){return this.items.map(e=>e.toJSON())}toTextObject(){let e=super.toTextObjectEmpty();for(let r of this.items){let n=r.toTextObject(),i=e[n[ce.NAME]];Array.isArray(i)||(i=[],e[n[ce.NAME]]=i),i.push(n)}return e}};o(Hv,"GeneralNames");var yn=Hv;yn.NAME="GeneralNames";var Cf="-{5}",Of="\\n",Ak=`[^${Of}]+`,Sk=`${Cf}BEGIN (${Ak}(?=${Cf}))${Cf}`,kk=`${Cf}END \\1${Cf}`,oa="\\n",Ck=`[^:${Of}]+`,Ek=`(?:[^${Of}]+${oa}(?: +[^${Of}]+${oa})*)`,Pk="[a-zA-Z0-9=+/]+",Tk=`(?:${Pk}${oa})+`,ax=`${Sk}${oa}(?:((?:${Ck}: ${Ek})+))?${oa}?(${Tk})${kk}`,Lv=class Lv{static isPem(e){return typeof e=="string"&&new RegExp(ax,"g").test(e.replace(/\r/g,""))}static decodeWithHeaders(e){e=e.replace(/\r/g,"");let r=new RegExp(ax,"g"),n=[],i=null;for(;i=r.exec(e);){let s=i[3].replace(new RegExp(`[${Of}]+`,"g"),""),u={type:i[1],headers:[],rawData:C.Convert.FromBase64(s)},a=i[2];if(a){let c=a.split(new RegExp(oa,"g")),d=null;for(let p of c){let[y,v]=p.split(/:(.*)/);if(v===void 0){if(!d)throw new Error("Cannot parse PEM string. Incorrect header value");d.value+=y.trim()}else d&&u.headers.push(d),d={key:y,value:v.trim()}}d&&u.headers.push(d)}n.push(u)}return n}static decode(e){return this.decodeWithHeaders(e).map(n=>n.rawData)}static decodeFirst(e){let r=this.decode(e);if(!r.length)throw new RangeError("PEM string doesn't contain any objects");return r[0]}static encode(e,r){if(Array.isArray(e)){let n=new Array;return r?e.forEach(i=>{if(!C.BufferSourceConverter.isBufferSource(i))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");n.push(this.encodeStruct({type:r,rawData:C.BufferSourceConverter.toArrayBuffer(i)}))}):e.forEach(i=>{if(!("type"in i))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");n.push(this.encodeStruct(i))}),n.join(`
19
+ `)}else{if(!r)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:r,rawData:C.BufferSourceConverter.toArrayBuffer(e)})}}static encodeStruct(e){var r;let n=e.type.toLocaleUpperCase(),i=[];if(i.push(`-----BEGIN ${n}-----`),!((r=e.headers)===null||r===void 0)&&r.length){for(let d of e.headers)i.push(`${d.key}: ${d.value}`);i.push("")}let s=C.Convert.ToBase64(e.rawData),u,a=0,c=Array();for(;a<s.length&&(s.length-a<64?u=s.substring(a):(u=s.substring(a,a+64),a+=64),u.length!==0);)if(c.push(u),u.length<64)break;return i.push(...c),i.push(`-----END ${n}-----`),i.join(`
20
+ `)}};o(Lv,"PemConverter");var mt=Lv;mt.CertificateTag="CERTIFICATE";mt.CrlTag="CRL";mt.CertificateRequestTag="CERTIFICATE REQUEST";mt.PublicKeyTag="PUBLIC KEY";mt.PrivateKeyTag="PRIVATE KEY";var Ef=class Ef extends oi{static isAsnEncoded(e){return C.BufferSourceConverter.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(mt.isPem(e))return mt.decode(e)[0];if(C.Convert.isHex(e))return C.Convert.FromHex(e);if(C.Convert.isBase64(e))return C.Convert.FromBase64(e);if(C.Convert.isBase64Url(e))return C.Convert.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{let r=C.BufferSourceConverter.toUint8Array(e);if(r.length>0&&r[0]===48)return C.BufferSourceConverter.toArrayBuffer(e);let n=C.Convert.ToBinary(e);if(mt.isPem(n))return mt.decode(n)[0];if(C.Convert.isHex(n))return C.Convert.FromHex(n);if(C.Convert.isBase64(n))return C.Convert.FromBase64(n);if(C.Convert.isBase64Url(n))return C.Convert.FromBase64Url(n);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}}constructor(...e){Ef.isAsnEncoded(e[0])?super(Ef.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){return e==="pem"?mt.encode(this.rawData,this.tag):super.toString(e)}};o(Ef,"PemData");var si=Ef,Yu=class Yu extends si{static async create(e,r=yt.get()){if(e instanceof Yu)return e;if(If.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");let n=await r.subtle.exportKey("spki",e);return new Yu(n)}else{if(e.publicKey)return e.publicKey;if(C.BufferSourceConverter.isBufferSource(e))return new Yu(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){si.isAsnEncoded(e)?super(e,ot):super(e),this.tag=mt.PublicKeyTag}async export(...e){let r,n=["verify"],i={hash:"SHA-256",...this.algorithm};e.length>1?(i=e[0]||i,n=e[1]||n,r=e[2]||yt.get()):r=e[0]||yt.get();let s=this.rawData,u=P.parse(this.rawData,ot);return u.algorithm.algorithm===Xn&&(s=Ik(u,s)),r.subtle.importKey("spki",s,i,!0,n)}onInit(e){let r=ke.resolve(ia),n=this.algorithm=r.toWebAlgorithm(e.algorithm);if(e.algorithm.algorithm===Dr){let i=P.parse(e.subjectPublicKey,yu),s=C.BufferSourceConverter.toUint8Array(i.modulus);n.publicExponent=C.BufferSourceConverter.toUint8Array(i.publicExponent),n.modulusLength=(s[0]?s:s.slice(1)).byteLength<<3}}async getThumbprint(...e){var r;let n,i="SHA-1";return e.length>=1&&!(!((r=e[0])===null||r===void 0)&&r.subtle)?(i=e[0]||i,n=e[1]||yt.get()):n=e[0]||yt.get(),await n.subtle.digest(i,this.rawData)}async getKeyIdentifier(...e){let r,n="SHA-1";e.length===1?typeof e[0]=="string"?(n=e[0],r=yt.get()):r=e[0]:e.length===2?(n=e[0],r=e[1]):r=yt.get();let i=P.parse(this.rawData,ot);return await r.subtle.digest(n,i.subjectPublicKey)}toTextObject(){let e=this.toTextObjectEmpty(),r=P.parse(this.rawData,ot);switch(e.Algorithm=hn.serializeAlgorithm(r.algorithm),r.algorithm.algorithm){case Qi:e["EC Point"]=r.subjectPublicKey;break;case Dr:default:e["Raw Data"]=r.subjectPublicKey}return e}};o(Yu,"PublicKey");var ii=Yu;function Ik(t,e){return t.algorithm=new k({algorithm:Dr,parameters:null}),e=P.serialize(t),e}o(Ik,"convertSpkiToRsaPkcs1");var Pf=class Pf extends Ut{static async create(e,r=!1,n=yt.get()){if("name"in e&&"serialNumber"in e)return new Pf(e,r);let s=await(await ii.create(e,n)).getKeyIdentifier(n);return new Pf(C.Convert.ToHex(s),r)}constructor(...e){if(C.BufferSourceConverter.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){let r=new Rr({keyIdentifier:new Ni(C.Convert.FromHex(e[0]))});super(zd,e[1],P.serialize(r))}else{let r=e[0],n=r.name instanceof yn?P.parse(r.name.rawData,xe):r.name,i=new Rr({authorityCertIssuer:n,authorityCertSerialNumber:C.Convert.FromHex(r.serialNumber)});super(zd,e[1],P.serialize(i))}}onInit(e){super.onInit(e);let r=P.parse(e.extnValue,Rr);r.keyIdentifier&&(this.keyId=C.Convert.ToHex(r.keyIdentifier)),(r.authorityCertIssuer||r.authorityCertSerialNumber)&&(this.certId={name:r.authorityCertIssuer||[],serialNumber:r.authorityCertSerialNumber?C.Convert.ToHex(r.authorityCertSerialNumber):""})}toTextObject(){let e=this.toTextObjectWithoutValue(),r=P.parse(this.value,Rr);return r.authorityCertIssuer&&(e["Authority Issuer"]=new yn(r.authorityCertIssuer).toTextObject()),r.authorityCertSerialNumber&&(e["Authority Serial Number"]=r.authorityCertSerialNumber),r.keyIdentifier&&(e[""]=r.keyIdentifier),e}};o(Pf,"AuthorityKeyIdentifierExtension");var Ml=Pf;Ml.NAME="Authority Key Identifier";var Wv=class Wv extends Ut{constructor(...e){if(C.BufferSourceConverter.isBufferSource(e[0])){super(e[0]);let r=P.parse(this.value,Bi);this.ca=r.cA,this.pathLength=r.pathLenConstraint}else{let r=new Bi({cA:e[0],pathLenConstraint:e[1]});super(Gd,e[2],P.serialize(r)),this.ca=e[0],this.pathLength=e[1]}}toTextObject(){let e=this.toTextObjectWithoutValue();return this.ca&&(e.CA=this.ca),this.pathLength!==void 0&&(e["Path Length"]=this.pathLength),e}};o(Wv,"BasicConstraintsExtension");var Ul=Wv;Ul.NAME="Basic Constraints";var cx;(function(t){t.serverAuth="1.3.6.1.5.5.7.3.1",t.clientAuth="1.3.6.1.5.5.7.3.2",t.codeSigning="1.3.6.1.5.5.7.3.3",t.emailProtection="1.3.6.1.5.5.7.3.4",t.timeStamping="1.3.6.1.5.5.7.3.8",t.ocspSigning="1.3.6.1.5.5.7.3.9"})(cx||(cx={}));var Fv=class Fv extends Ut{constructor(...e){if(C.BufferSourceConverter.isBufferSource(e[0])){super(e[0]);let r=P.parse(this.value,Cc);this.usages=r.map(n=>n)}else{let r=new Cc(e[0]);super(Yd,e[1],P.serialize(r)),this.usages=e[0]}}toTextObject(){let e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(r=>Vr.toString(r)).join(", "),e}};o(Fv,"ExtendedKeyUsageExtension");var $l=Fv;$l.NAME="Extended Key Usages";var fx;(function(t){t[t.digitalSignature=1]="digitalSignature",t[t.nonRepudiation=2]="nonRepudiation",t[t.keyEncipherment=4]="keyEncipherment",t[t.dataEncipherment=8]="dataEncipherment",t[t.keyAgreement=16]="keyAgreement",t[t.keyCertSign=32]="keyCertSign",t[t.cRLSign=64]="cRLSign",t[t.encipherOnly=128]="encipherOnly",t[t.decipherOnly=256]="decipherOnly"})(fx||(fx={}));var Kv=class Kv extends Ut{constructor(...e){if(C.BufferSourceConverter.isBufferSource(e[0])){super(e[0]);let r=P.parse(this.value,ss);this.usages=r.toNumber()}else{let r=new ss(e[0]);super(el,e[1],P.serialize(r)),this.usages=e[0]}}toTextObject(){let e=this.toTextObjectWithoutValue(),r=P.parse(this.value,ss);return e[""]=r.toJSON().join(", "),e}};o(Kv,"KeyUsagesExtension");var Vl=Kv;Vl.NAME="Key Usages";var Zl=class Zl extends Ut{static async create(e,r=!1,n=yt.get()){let s=await(await ii.create(e,n)).getKeyIdentifier(n);return new Zl(C.Convert.ToHex(s),r)}constructor(...e){if(C.BufferSourceConverter.isBufferSource(e[0])){super(e[0]);let r=P.parse(this.value,Ct);this.keyId=C.Convert.ToHex(r)}else{let r=typeof e[0]=="string"?C.Convert.FromHex(e[0]):e[0],n=new Ct(r);super(om,e[1],P.serialize(n)),this.keyId=C.Convert.ToHex(r)}}toTextObject(){let e=this.toTextObjectWithoutValue(),r=P.parse(this.value,Ct);return e[""]=r,e}};o(Zl,"SubjectKeyIdentifierExtension");var Hl=Zl;Hl.NAME="Subject Key Identifier";var Jv=class Jv extends Ut{constructor(...e){C.BufferSourceConverter.isBufferSource(e[0])?super(e[0]):super(rm,e[1],new yn(e[0]||[]).rawData)}onInit(e){super.onInit(e);let r=P.parse(e.extnValue,il);this.names=new yn(r)}toTextObject(){let e=this.toTextObjectWithoutValue(),r=this.names.toTextObject();for(let n in r)e[n]=r[n];return e}};o(Jv,"SubjectAlternativeNameExtension");var sa=Jv;sa.NAME="Subject Alternative Name";var zv=class zv{static register(e,r){this.items.set(e,r)}static create(e){let r=new Ut(e),n=this.items.get(r.type);return n?new n(e):r}};o(zv,"ExtensionFactory");var gt=zv;gt.items=new Map;var Gv=class Gv extends Ut{constructor(...e){var r;if(C.BufferSourceConverter.isBufferSource(e[0])){super(e[0]);let n=P.parse(this.value,_c);this.policies=n.map(i=>i.policyIdentifier)}else{let n=e[0],i=(r=e[1])!==null&&r!==void 0?r:!1,s=new _c(n.map(u=>new Di({policyIdentifier:u})));super(Zd,i,P.serialize(s)),this.policies=n}}toTextObject(){let e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(r=>new ce("",{},Vr.toString(r))),e}};o(Gv,"CertificatePolicyExtension");var Ll=Gv;Ll.NAME="Certificate Policies";gt.register(Zd,Ll);var Xv=class Xv extends Ut{constructor(...e){var r;if(C.BufferSourceConverter.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){let i=e[0].map(u=>new jr({distributionPoint:new an({fullName:[new W({uniformResourceIdentifier:u})]})})),s=new Hn(i);super(Qd,e[1],P.serialize(s))}else{let n=new Hn(e[0]);super(Qd,e[1],P.serialize(n))}(r=this.distributionPoints)!==null&&r!==void 0||(this.distributionPoints=[])}onInit(e){super.onInit(e);let r=P.parse(e.extnValue,Hn);this.distributionPoints=r}toTextObject(){let e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(r=>{var n;let i={};return r.distributionPoint&&(i[""]=(n=r.distributionPoint.fullName)===null||n===void 0?void 0:n.map(s=>new $r(s).toString()).join(", ")),r.reasons&&(i.Reasons=r.reasons.toString()),r.cRLIssuer&&(i["CRL Issuer"]=r.cRLIssuer.map(s=>s.toString()).join(", ")),i}),e}};o(Xv,"CRLDistributionPointsExtension");var Wl=Xv;Wl.NAME="CRL Distribution Points";var Zv=class Zv extends Ut{constructor(...e){var r,n,i,s;if(C.BufferSourceConverter.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof ji){let u=new ji(e[0]);super(Jd,e[1],P.serialize(u))}else{let u=e[0],a=new ji;Nl(a,u,S0,"ocsp"),Nl(a,u,k0,"caIssuers"),Nl(a,u,C0,"timeStamping"),Nl(a,u,E0,"caRepository"),super(Jd,e[1],P.serialize(a))}(r=this.ocsp)!==null&&r!==void 0||(this.ocsp=[]),(n=this.caIssuers)!==null&&n!==void 0||(this.caIssuers=[]),(i=this.timeStamping)!==null&&i!==void 0||(this.timeStamping=[]),(s=this.caRepository)!==null&&s!==void 0||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],P.parse(e.extnValue,ji).forEach(n=>{switch(n.accessMethod){case S0:this.ocsp.push(new $r(n.accessLocation));break;case k0:this.caIssuers.push(new $r(n.accessLocation));break;case C0:this.timeStamping.push(new $r(n.accessLocation));break;case E0:this.caRepository.push(new $r(n.accessLocation));break}})}toTextObject(){let e=this.toTextObjectWithoutValue();return this.ocsp.length&&jl(e,"OCSP",this.ocsp),this.caIssuers.length&&jl(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&jl(e,"Time Stamping",this.timeStamping),this.caRepository.length&&jl(e,"CA Repository",this.caRepository),e}};o(Zv,"AuthorityInfoAccessExtension");var Fl=Zv;Fl.NAME="Authority Info Access";function jl(t,e,r){if(r.length===1)t[e]=r[0].toTextObject();else{let n=new ce("");r.forEach((i,s)=>{let u=i.toTextObject(),a=`${u[ce.NAME]} ${s+1}`,c=n[a];Array.isArray(c)||(c=[],n[a]=c),c.push(u)}),t[e]=n}}o(jl,"addUrlsToObject");function Nl(t,e,r,n){let i=e[n];i&&(Array.isArray(i)?i:[i]).forEach(u=>{typeof u=="string"&&(u=new $r("url",u)),t.push(new sn({accessMethod:r,accessLocation:P.parse(u.rawData,W)}))})}o(Nl,"addAccessDescriptions");var Qv=class Qv extends Ut{constructor(...e){C.BufferSourceConverter.isBufferSource(e[0])?super(e[0]):super(J0,e[1],new yn(e[0]||[]).rawData)}onInit(e){super.onInit(e);let r=P.parse(e.extnValue,xe);this.names=new yn(r)}toTextObject(){let e=this.toTextObjectWithoutValue(),r=this.names.toTextObject();for(let n in r)e[n]=r[n];return e}};o(Qv,"IssuerAlternativeNameExtension");var Kl=Qv;Kl.NAME="Issuer Alternative Name";var Ql=class Ql extends oi{constructor(...e){let r;if(C.BufferSourceConverter.isBufferSource(e[0]))r=C.BufferSourceConverter.toArrayBuffer(e[0]);else{let n=e[0],i=Array.isArray(e[1])?e[1].map(s=>C.BufferSourceConverter.toArrayBuffer(s)):[];r=P.serialize(new Ye({type:n,values:i}))}super(r,Ye)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){let e=this.toTextObjectWithoutValue();return e.Value=this.values.map(r=>new ce("",{"":r})),e}toTextObjectWithoutValue(){let e=this.toTextObjectEmpty();return e[ce.NAME]===Ql.NAME&&(e[ce.NAME]=Vr.toString(this.type)),e}};o(Ql,"Attribute");var ua=Ql;ua.NAME="Attribute";var Yv=class Yv extends ua{constructor(...e){var r;if(C.BufferSourceConverter.isBufferSource(e[0]))super(e[0]);else{let n=new rf({printableString:e[0]});super(yv,[P.serialize(n)])}(r=this.password)!==null&&r!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){let r=P.parse(this.values[0],rf);this.password=r.toString()}}toTextObject(){let e=this.toTextObjectWithoutValue();return e[ce.VALUE]=this.password,e}};o(Yv,"ChallengePasswordAttribute");var Jl=Yv;Jl.NAME="Challenge Password";var eb=class eb extends ua{constructor(...e){var r;if(C.BufferSourceConverter.isBufferSource(e[0]))super(e[0]);else{let n=e[0],i=new Zt;for(let s of n)i.push(P.parse(s.rawData,st));super(of,[P.serialize(i)])}(r=this.items)!==null&&r!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){let r=P.parse(this.values[0],Zt);this.items=r.map(n=>gt.create(P.serialize(n)))}}toTextObject(){let e=this.toTextObjectWithoutValue(),r=this.items.map(n=>n.toTextObject());for(let n of r)e[n[ce.NAME]]=n;return e}};o(eb,"ExtensionsAttribute");var Rf=eb;Rf.NAME="Extensions";var tb=class tb{static register(e,r){this.items.set(e,r)}static create(e){let r=new ua(e),n=this.items.get(r.type);return n?new n(e):r}};o(tb,"AttributeFactory");var aa=tb;aa.items=new Map;var Yl="crypto.signatureFormatter",rb=class rb{toAsnSignature(e,r){return C.BufferSourceConverter.toArrayBuffer(r)}toWebSignature(e,r){return C.BufferSourceConverter.toArrayBuffer(r)}};o(rb,"AsnDefaultSignatureFormatter");var Iv=rb,Dl,ta,Ov=Dl=(ta=class{static createPssParams(e,r){let n=Dl.getHashAlgorithm(e);return n?new qr({hashAlgorithm:n,maskGenAlgorithm:new k({algorithm:Zn,parameters:P.serialize(n)}),saltLength:r}):null}static getHashAlgorithm(e){let r=ke.resolve(ia);return typeof e=="string"?r.toAsnAlgorithm({name:e}):typeof e=="object"&&e&&"name"in e?r.toAsnAlgorithm(e):null}toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if("hash"in e){let r;if(typeof e.hash=="string")r=e.hash;else if(e.hash&&typeof e.hash=="object"&&"name"in e.hash&&typeof e.hash.name=="string")r=e.hash.name.toUpperCase();else throw new Error("Cannot get hash algorithm name");switch(r.toLowerCase()){case"sha-1":return new k({algorithm:cu,parameters:null});case"sha-256":return new k({algorithm:vl,parameters:null});case"sha-384":return new k({algorithm:fu,parameters:null});case"sha-512":return new k({algorithm:du,parameters:null})}}else return new k({algorithm:Dr,parameters:null});break;case"rsa-pss":if("hash"in e){if(!("saltLength"in e&&typeof e.saltLength=="number"))throw new Error("Cannot get 'saltLength' from 'alg' argument");let r=Dl.createPssParams(e.hash,e.saltLength);if(!r)throw new Error("Cannot create PSS parameters");return new k({algorithm:Xn,parameters:P.serialize(r)})}else return new k({algorithm:Xn,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case Dr:return{name:"RSASSA-PKCS1-v1_5"};case cu:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case vl:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case fu:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case du:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case Xn:if(e.parameters){let r=P.parse(e.parameters,qr);return{name:"RSA-PSS",hash:ke.resolve(ia).toWebAlgorithm(r.hashAlgorithm),saltLength:r.saltLength}}else return{name:"RSA-PSS"}}return null}},o(ta,"RsaAlgorithm"),ta);Ov=Dl=f([Yn()],Ov);ke.registerSingleton(jf,Ov);var ra,Rv=(ra=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new k({algorithm:eo});case"sha-256":return new k({algorithm:to});case"sha-384":return new k({algorithm:ro});case"sha-512":return new k({algorithm:no})}return null}toWebAlgorithm(e){switch(e.algorithm){case eo:return{name:"SHA-1"};case to:return{name:"SHA-256"};case ro:return{name:"SHA-384"};case no:return{name:"SHA-512"}}return null}},o(ra,"ShaAlgorithm"),ra);Rv=f([Yn()],Rv);ke.registerSingleton(jf,Rv);var lo=class lo{addPadding(e,r){let n=C.BufferSourceConverter.toUint8Array(r),i=new Uint8Array(e);return i.set(n,e-n.length),i.buffer}removePadding(e,r=!1){let n=C.BufferSourceConverter.toUint8Array(e);for(let i=0;i<n.length;i++)if(n[i]){n=n.slice(i);break}if(r&&n[0]>127){let i=new Uint8Array(n.length+1);return i.set(n,1),i.buffer}return n.buffer}toAsnSignature(e,r){if(e.name==="ECDSA"){let n=e.namedCurve,i=lo.namedCurveSize.get(n)||lo.defaultNamedCurveSize,s=new Yi,u=C.BufferSourceConverter.toUint8Array(r);return s.r=this.removePadding(u.slice(0,i),!0),s.s=this.removePadding(u.slice(i,i+i),!0),P.serialize(s)}return null}toWebSignature(e,r){if(e.name==="ECDSA"){let n=P.parse(r,Yi),i=e.namedCurve,s=lo.namedCurveSize.get(i)||lo.defaultNamedCurveSize,u=this.addPadding(s,this.removePadding(n.r)),a=this.addPadding(s,this.removePadding(n.s));return(0,C.combine)(u,a)}return null}};o(lo,"AsnEcSignatureFormatter");var mn=lo;mn.namedCurveSize=new Map;mn.defaultNamedCurveSize=32;var Cv="1.3.101.110",dx="1.3.101.111",Ev="1.3.101.112",lx="1.3.101.113",na,jv=(na=class{toAsnAlgorithm(e){let r=null;switch(e.name.toLowerCase()){case"ed25519":r=Ev;break;case"x25519":r=Cv;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":r=Ev;break;case"ed448":r=lx;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":r=Cv;break;case"x448":r=dx;break}}return r?new k({algorithm:r}):null}toWebAlgorithm(e){switch(e.algorithm){case Ev:return{name:"Ed25519"};case lx:return{name:"EdDSA",namedCurve:"Ed448"};case Cv:return{name:"X25519"};case dx:return{name:"ECDH-ES",namedCurve:"X448"}}return null}},o(na,"EdAlgorithm"),na);jv=f([Yn()],jv);ke.registerSingleton(jf,jv);var af,cf,ff,df,lf,pf,hf,Zu,nb=class nb extends si{get subjectName(){return X(this,cf,"f")||_e(this,cf,new po(this.asn.certificationRequestInfo.subject),"f"),X(this,cf,"f")}get subject(){return X(this,ff,"f")||_e(this,ff,this.subjectName.toString(),"f"),X(this,ff,"f")}get signatureAlgorithm(){if(!X(this,df,"f")){let e=ke.resolve(ia);_e(this,df,e.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return X(this,df,"f")}get signature(){return X(this,lf,"f")||_e(this,lf,this.asn.signature,"f"),X(this,lf,"f")}get publicKey(){return X(this,pf,"f")||_e(this,pf,new ii(this.asn.certificationRequestInfo.subjectPKInfo),"f"),X(this,pf,"f")}get attributes(){return X(this,hf,"f")||_e(this,hf,this.asn.certificationRequestInfo.attributes.map(e=>aa.create(P.serialize(e))),"f"),X(this,hf,"f")}get extensions(){if(!X(this,Zu,"f")){_e(this,Zu,[],"f");let e=this.getAttribute(of);e instanceof Rf&&_e(this,Zu,e.items,"f")}return X(this,Zu,"f")}get tbs(){return X(this,af,"f")||_e(this,af,this.asn.certificationRequestInfoRaw||P.serialize(this.asn.certificationRequestInfo),"f"),X(this,af,"f")}constructor(e){let r=si.isAsnEncoded(e)?[e,ni]:[e];super(r[0],r[1]),af.set(this,void 0),cf.set(this,void 0),ff.set(this,void 0),df.set(this,void 0),lf.set(this,void 0),pf.set(this,void 0),hf.set(this,void 0),Zu.set(this,void 0),this.tag=mt.CertificateRequestTag}onInit(e){}getAttribute(e){for(let r of this.attributes)if(r.type===e)return r;return null}getAttributes(e){return this.attributes.filter(r=>r.type===e)}getExtension(e){for(let r of this.extensions)if(r.type===e)return r;return null}getExtensions(e){return this.extensions.filter(r=>r.type===e)}async verify(e=yt.get()){let r={...this.publicKey.algorithm,...this.signatureAlgorithm},n=await this.publicKey.export(r,["verify"],e),i=ke.resolveAll(Yl).reverse(),s=null;for(let a of i)if(s=a.toWebSignature(r,this.signature),s)break;if(!s)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,n,s,this.tbs)}toTextObject(){let e=this.toTextObjectEmpty(),r=P.parse(this.rawData,ni),n=r.certificationRequestInfo,i=new ce("",{Version:`${cn[n.version]} (${n.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){let s=new ce("");for(let u of this.attributes){let a=u.toTextObject();s[a[ce.NAME]]=a}i.Attributes=s}return e.Data=i,e.Signature=new ce("",{Algorithm:hn.serializeAlgorithm(r.signatureAlgorithm),"":r.signature}),e}};o(nb,"Pkcs10CertificateRequest");var Nv=nb;af=new WeakMap,cf=new WeakMap,ff=new WeakMap,df=new WeakMap,lf=new WeakMap,pf=new WeakMap,hf=new WeakMap,Zu=new WeakMap;Nv.NAME="PKCS#10 Certificate Request";var yf,mf,gf,vf,bf,wf,_f,xf,Af,Sf,Qu,kf,ib=class ib extends si{get publicKey(){return X(this,kf,"f")||_e(this,kf,new ii(this.asn.tbsCertificate.subjectPublicKeyInfo),"f"),X(this,kf,"f")}get serialNumber(){if(!X(this,mf,"f")){let e=this.asn.tbsCertificate,r=new Uint8Array(e.serialNumber);r.length>1&&r[0]===0&&r[1]>127&&(r=r.slice(1)),_e(this,mf,C.Convert.ToHex(r),"f")}return X(this,mf,"f")}get subjectName(){return X(this,gf,"f")||_e(this,gf,new po(this.asn.tbsCertificate.subject),"f"),X(this,gf,"f")}get subject(){return X(this,vf,"f")||_e(this,vf,this.subjectName.toString(),"f"),X(this,vf,"f")}get issuerName(){return X(this,bf,"f")||_e(this,bf,new po(this.asn.tbsCertificate.issuer),"f"),X(this,bf,"f")}get issuer(){return X(this,wf,"f")||_e(this,wf,this.issuerName.toString(),"f"),X(this,wf,"f")}get notBefore(){if(!X(this,_f,"f")){let e=this.asn.tbsCertificate.validity.notBefore.utcTime||this.asn.tbsCertificate.validity.notBefore.generalTime;if(!e)throw new Error("Cannot get 'notBefore' value");_e(this,_f,e,"f")}return X(this,_f,"f")}get notAfter(){if(!X(this,xf,"f")){let e=this.asn.tbsCertificate.validity.notAfter.utcTime||this.asn.tbsCertificate.validity.notAfter.generalTime;if(!e)throw new Error("Cannot get 'notAfter' value");_e(this,xf,e,"f")}return X(this,xf,"f")}get signatureAlgorithm(){if(!X(this,Af,"f")){let e=ke.resolve(ia);_e(this,Af,e.toWebAlgorithm(this.asn.signatureAlgorithm),"f")}return X(this,Af,"f")}get signature(){return X(this,Sf,"f")||_e(this,Sf,this.asn.signatureValue,"f"),X(this,Sf,"f")}get extensions(){return X(this,Qu,"f")||(_e(this,Qu,[],"f"),this.asn.tbsCertificate.extensions&&_e(this,Qu,this.asn.tbsCertificate.extensions.map(e=>gt.create(P.serialize(e))),"f")),X(this,Qu,"f")}get tbs(){return X(this,yf,"f")||_e(this,yf,this.asn.tbsCertificateRaw||P.serialize(this.asn.tbsCertificate),"f"),X(this,yf,"f")}constructor(e){let r=si.isAsnEncoded(e)?[e,yr]:[e];super(r[0],r[1]),yf.set(this,void 0),mf.set(this,void 0),gf.set(this,void 0),vf.set(this,void 0),bf.set(this,void 0),wf.set(this,void 0),_f.set(this,void 0),xf.set(this,void 0),Af.set(this,void 0),Sf.set(this,void 0),Qu.set(this,void 0),kf.set(this,void 0),this.tag=mt.CertificateTag}onInit(e){}getExtension(e){for(let r of this.extensions)if(typeof e=="string"){if(r.type===e)return r}else if(r instanceof e)return r;return null}getExtensions(e){return this.extensions.filter(r=>typeof e=="string"?r.type===e:r instanceof e)}async verify(e={},r=yt.get()){let n,i,s=e.publicKey;try{if(!s)n={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(n,["verify"],r);else if("publicKey"in s)n={...s.publicKey.algorithm,...this.signatureAlgorithm},i=await s.publicKey.export(n,["verify"],r);else if(s instanceof ii)n={...s.algorithm,...this.signatureAlgorithm},i=await s.export(n,["verify"],r);else if(C.BufferSourceConverter.isBufferSource(s)){let d=new ii(s);n={...d.algorithm,...this.signatureAlgorithm},i=await d.export(n,["verify"],r)}else n={...s.algorithm,...this.signatureAlgorithm},i=s}catch{return!1}let u=ke.resolveAll(Yl).reverse(),a=null;for(let d of u)if(a=d.toWebSignature(n,this.signature),a)break;if(!a)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");let c=await r.subtle.verify(this.signatureAlgorithm,i,a,this.tbs);if(e.signatureOnly)return c;{let p=(e.date||new Date).getTime();return c&&this.notBefore.getTime()<p&&p<this.notAfter.getTime()}}async getThumbprint(...e){let r,n="SHA-1";return e[0]&&(e[0].subtle?r=e[0]:(n=e[0]||n,r=e[1])),r??(r=yt.get()),await r.subtle.digest(n,this.rawData)}async isSelfSigned(e=yt.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){let e=this.toTextObjectEmpty(),r=P.parse(this.rawData,yr),n=r.tbsCertificate,i=new ce("",{Version:`${cn[n.version]} (${n.version})`,"Serial Number":n.serialNumber,"Signature Algorithm":hn.serializeAlgorithm(n.signature),Issuer:this.issuer,Validity:new ce("",{"Not Before":n.validity.notBefore.getTime(),"Not After":n.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(n.issuerUniqueID&&(i["Issuer Unique ID"]=n.issuerUniqueID),n.subjectUniqueID&&(i["Subject Unique ID"]=n.subjectUniqueID),this.extensions.length){let s=new ce("");for(let u of this.extensions){let a=u.toTextObject();s[a[ce.NAME]]=a}i.Extensions=s}return e.Data=i,e.Signature=new ce("",{Algorithm:hn.serializeAlgorithm(r.signatureAlgorithm),"":r.signatureValue}),e}};o(ib,"X509Certificate");var ca=ib;yf=new WeakMap,mf=new WeakMap,gf=new WeakMap,vf=new WeakMap,bf=new WeakMap,wf=new WeakMap,_f=new WeakMap,xf=new WeakMap,Af=new WeakMap,Sf=new WeakMap,Qu=new WeakMap,kf=new WeakMap;ca.NAME="Certificate";var Ok,Rk,jk,Nk,Bk,px;(function(t){t[t.unspecified=0]="unspecified",t[t.keyCompromise=1]="keyCompromise",t[t.cACompromise=2]="cACompromise",t[t.affiliationChanged=3]="affiliationChanged",t[t.superseded=4]="superseded",t[t.cessationOfOperation=5]="cessationOfOperation",t[t.certificateHold=6]="certificateHold",t[t.removeFromCRL=8]="removeFromCRL",t[t.privilegeWithdrawn=9]="privilegeWithdrawn",t[t.aACompromise=10]="aACompromise"})(px||(px={}));Ok=new WeakMap,Rk=new WeakMap,jk=new WeakMap,Nk=new WeakMap,Bk=new WeakMap;var Dk,qk,Mk,Uk,$k,Vk,Hk;Dk=new WeakMap,qk=new WeakMap,Mk=new WeakMap,Uk=new WeakMap,$k=new WeakMap,Vk=new WeakMap,Hk=new WeakMap;gt.register(Gd,Ul);gt.register(Yd,$l);gt.register(el,Vl);gt.register(om,Hl);gt.register(zd,Ml);gt.register(rm,sa);gt.register(Qd,Wl);gt.register(Jd,Fl);gt.register(J0,Kl);aa.register(yv,Jl);aa.register(of,Rf);ke.registerSingleton(Yl,Iv);ke.registerSingleton(Yl,mn);mn.namedCurveSize.set("P-256",32);mn.namedCurveSize.set("K-256",32);mn.namedCurveSize.set("P-384",48);mn.namedCurveSize.set("P-521",66);var Wk=["pre-registered","redirect_uri","https","did","verifier_attestation","x509_san_dns","x509_hash"],ep=o((t,e)=>{if(typeof t!="string"||t.length===0)return{prefix:"pre-registered",value:"",inferred:!0};if(typeof e=="string"&&e.length>0&&Fk(e))return{prefix:e,value:t,inferred:!1};let r=["redirect_uri","verifier_attestation","x509_san_dns","x509_hash"];for(let n of r){let i=`${n}:`;if(t.startsWith(i))return{prefix:n,value:t.slice(i.length),inferred:!1}}return t.startsWith("https://")?{prefix:"https",value:t,inferred:!0}:/^did:[a-z0-9]+:/.test(t)?{prefix:"did",value:t,inferred:!0}:{prefix:"pre-registered",value:t,inferred:!0}},"deriveClientIdPrefix"),Fk=o(t=>Wk.includes(t),"isKnownPrefix");var ob;function sb(t){return{lang:t?.lang??ob?.lang,message:t?.message,abortEarly:t?.abortEarly??ob?.abortEarly,abortPipeEarly:t?.abortPipeEarly??ob?.abortPipeEarly}}o(sb,"getGlobalConfig");var Kk;function Jk(t){return Kk?.get(t)}o(Jk,"getGlobalMessage");var zk;function Gk(t){return zk?.get(t)}o(Gk,"getSchemaMessage");var Xk;function Zk(t,e){return Xk?.get(t)?.get(e)}o(Zk,"getSpecificMessage");function Nf(t){let e=typeof t;return e==="string"?`"${t}"`:e==="number"||e==="bigint"||e==="boolean"?`${t}`:e==="object"||e==="function"?(t&&Object.getPrototypeOf(t)?.constructor?.name)??"null":e}o(Nf,"_stringify");function Ae(t,e,r,n,i){let s=i&&"input"in i?i.input:r.value,u=i?.expected??t.expects??null,a=i?.received??Nf(s),c={kind:t.kind,type:t.type,input:s,expected:u,received:a,message:`Invalid ${e}: ${u?`Expected ${u} but r`:"R"}eceived ${a}`,requirement:t.requirement,path:i?.path,issues:i?.issues,lang:n.lang,abortEarly:n.abortEarly,abortPipeEarly:n.abortPipeEarly},d=t.kind==="schema",p=i?.message??t.message??Zk(t.reference,c.lang)??(d?Gk(c.lang):null)??n.message??Jk(c.lang);p!==void 0&&(c.message=typeof p=="function"?p(c):p),d&&(r.typed=!1),r.issues?r.issues.push(c):r.issues=[c]}o(Ae,"_addIssue");function je(t){return{version:1,vendor:"valibot",validate(e){return t["~run"]({value:e},sb())}}}o(je,"_getStandardProps");function Qk(t,e){return Object.hasOwn(t,e)&&e!=="__proto__"&&e!=="prototype"&&e!=="constructor"}o(Qk,"_isValidObjectKey");function ub(t,e){let r=[...new Set(t)];return r.length>1?`(${r.join(` ${e} `)})`:r[0]??"never"}o(ub,"_joinExpects");function Yk(t){if(t.path){let e="";for(let r of t.path)if(typeof r.key=="string"||typeof r.key=="number")e?e+=`.${r.key}`:e+=r.key;else return null;return e}return null}o(Yk,"getDotPath");var fa,ab=(fa=class extends Error{constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}},o(fa,"ValiError"),fa);function Bf(t,e){return{kind:"validation",type:"check",reference:Bf,async:!1,expects:null,requirement:t,message:e,"~run"(r,n){return r.typed&&!this.requirement(r.value)&&Ae(this,"input",r,n),r}}}o(Bf,"check");function G(t){return{kind:"metadata",type:"description",reference:G,description:t}}o(G,"description");function tp(t){return{kind:"validation",type:"integer",reference:tp,async:!1,expects:null,requirement:Number.isInteger,message:t,"~run"(e,r){return e.typed&&!this.requirement(e.value)&&Ae(this,"integer",e,r),e}}}o(tp,"integer");function cb(t,e){return{kind:"validation",type:"min_value",reference:cb,async:!1,expects:`>=${t instanceof Date?t.toJSON():Nf(t)}`,requirement:t,message:e,"~run"(r,n){return r.typed&&!(r.value>=this.requirement)&&Ae(this,"value",r,n,{received:r.value instanceof Date?r.value.toJSON():Nf(r.value)}),r}}}o(cb,"minValue");function fb(t){return{kind:"validation",type:"non_empty",reference:fb,async:!1,expects:"!0",message:t,"~run"(e,r){return e.typed&&e.value.length===0&&Ae(this,"length",e,r,{received:"0"}),e}}}o(fb,"nonEmpty");function ho(t){return{kind:"transformation",type:"raw_transform",reference:ho,async:!1,"~run"(e,r){let n=t({dataset:e,config:r,addIssue:o(i=>Ae(this,i?.label??"input",e,r,i),"addIssue"),NEVER:null});return e.issues?e.typed=!1:e.value=n,e}}}o(ho,"rawTransform");function Df(t,e){return{kind:"validation",type:"regex",reference:Df,async:!1,expects:`${t}`,requirement:t,message:e,"~run"(r,n){return r.typed&&!this.requirement.test(r.value)&&Ae(this,"format",r,n),r}}}o(Df,"regex");function db(t,e){return{kind:"validation",type:"some_item",reference:db,async:!1,expects:null,requirement:t,message:e,"~run"(r,n){return r.typed&&!r.value.some(this.requirement)&&Ae(this,"item",r,n),r}}}o(db,"someItem");function lb(t){return{kind:"transformation",type:"transform",reference:lb,async:!1,operation:t,"~run"(e){return e.value=this.operation(e.value),e}}}o(lb,"transform");function rp(t){return{kind:"validation",type:"url",reference:rp,async:!1,expects:null,requirement(e){try{return new URL(e),!0}catch{return!1}},message:t,"~run"(e,r){return e.typed&&!this.requirement(e.value)&&Ae(this,"URL",e,r),e}}}o(rp,"url");function eC(t,e,r){return typeof t.fallback=="function"?t.fallback(e,r):t.fallback}o(eC,"getFallback");function qf(t){let e={};for(let r of t)if(r.path){let n=Yk(r);n?(e.nested||(e.nested={}),e.nested[n]?e.nested[n].push(r.message):e.nested[n]=[r.message]):e.other?e.other.push(r.message):e.other=[r.message]}else e.root?e.root.push(r.message):e.root=[r.message];return e}o(qf,"flatten");function bx(t,e,r){return typeof t.default=="function"?t.default(e,r):t.default}o(bx,"getDefault");function pb(t,e){return!t["~run"]({value:e},{abortEarly:!0}).issues}o(pb,"is");function Mf(){return{kind:"schema",type:"any",reference:Mf,expects:"any",async:!1,get"~standard"(){return je(this)},"~run"(t){return t.typed=!0,t}}}o(Mf,"any");function jt(t,e){return{kind:"schema",type:"array",reference:jt,expects:"Array",async:!1,item:t,message:e,get"~standard"(){return je(this)},"~run"(r,n){let i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let s=0;s<i.length;s++){let u=i[s],a=this.item["~run"]({value:u},n);if(a.issues){let c={type:"array",origin:"value",input:i,key:s,value:u};for(let d of a.issues)d.path?d.path.unshift(c):d.path=[c],r.issues?.push(d);if(r.issues||(r.issues=a.issues),n.abortEarly){r.typed=!1;break}}a.typed||(r.typed=!1),r.value.push(a.value)}}else Ae(this,"type",r,n);return r}}}o(jt,"array");function vr(t){return{kind:"schema",type:"boolean",reference:vr,expects:"boolean",async:!1,message:t,get"~standard"(){return je(this)},"~run"(e,r){return typeof e.value=="boolean"?e.typed=!0:Ae(this,"type",e,r),e}}}o(vr,"boolean");function Uf(t,e){return{kind:"schema",type:"custom",reference:Uf,expects:"unknown",async:!1,check:t,message:e,get"~standard"(){return je(this)},"~run"(r,n){return this.check(r.value)?r.typed=!0:Ae(this,"type",r,n),r}}}o(Uf,"custom");function np(t){return{kind:"schema",type:"lazy",reference:np,expects:"unknown",async:!1,getter:t,get"~standard"(){return je(this)},"~run"(e,r){return this.getter(e.value)["~run"](e,r)}}}o(np,"lazy");function he(t,e){return{kind:"schema",type:"literal",reference:he,expects:Nf(t),async:!1,literal:t,message:e,get"~standard"(){return je(this)},"~run"(r,n){return r.value===this.literal?r.typed=!0:Ae(this,"type",r,n),r}}}o(he,"literal");function ip(t){return{kind:"schema",type:"null",reference:ip,expects:"null",async:!1,message:t,get"~standard"(){return je(this)},"~run"(e,r){return e.value===null?e.typed=!0:Ae(this,"type",e,r),e}}}o(ip,"null_");function rt(t){return{kind:"schema",type:"number",reference:rt,expects:"number",async:!1,message:t,get"~standard"(){return je(this)},"~run"(e,r){return typeof e.value=="number"&&!isNaN(e.value)?e.typed=!0:Ae(this,"type",e,r),e}}}o(rt,"number");function F(t,e){return{kind:"schema",type:"object",reference:F,expects:"Object",async:!1,entries:t,message:e,get"~standard"(){return je(this)},"~run"(r,n){let i=r.value;if(i&&typeof i=="object"){r.typed=!0,r.value={};for(let s in this.entries){let u=this.entries[s];if(s in i||(u.type==="exact_optional"||u.type==="optional"||u.type==="nullish")&&u.default!==void 0){let a=s in i?i[s]:bx(u),c=u["~run"]({value:a},n);if(c.issues){let d={type:"object",origin:"value",input:i,key:s,value:a};for(let p of c.issues)p.path?p.path.unshift(d):p.path=[d],r.issues?.push(p);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}c.typed||(r.typed=!1),r.value[s]=c.value}else if(u.fallback!==void 0)r.value[s]=eC(u);else if(u.type!=="exact_optional"&&u.type!=="optional"&&u.type!=="nullish"&&(Ae(this,"key",r,n,{input:void 0,expected:`"${s}"`,path:[{type:"object",origin:"key",input:i,key:s,value:i[s]}]}),n.abortEarly))break}}else Ae(this,"type",r,n);return r}}}o(F,"object");function Q(t,e){return{kind:"schema",type:"optional",reference:Q,expects:`(${t.expects} | undefined)`,async:!1,wrapped:t,default:e,get"~standard"(){return je(this)},"~run"(r,n){return r.value===void 0&&(this.default!==void 0&&(r.value=bx(this,r,n)),r.value===void 0)?(r.typed=!0,r):this.wrapped["~run"](r,n)}}}o(Q,"optional");function yo(t,e){return{kind:"schema",type:"picklist",reference:yo,expects:ub(t.map(Nf),"|"),async:!1,options:t,message:e,get"~standard"(){return je(this)},"~run"(r,n){return this.options.includes(r.value)?r.typed=!0:Ae(this,"type",r,n),r}}}o(yo,"picklist");function vt(t,e,r){return{kind:"schema",type:"record",reference:vt,expects:"Object",async:!1,key:t,value:e,message:r,get"~standard"(){return je(this)},"~run"(n,i){let s=n.value;if(s&&typeof s=="object"){n.typed=!0,n.value={};for(let u in s)if(Qk(s,u)){let a=s[u],c=this.key["~run"]({value:u},i);if(c.issues){let p={type:"object",origin:"key",input:s,key:u,value:a};for(let y of c.issues)y.path=[p],n.issues?.push(y);if(n.issues||(n.issues=c.issues),i.abortEarly){n.typed=!1;break}}let d=this.value["~run"]({value:a},i);if(d.issues){let p={type:"object",origin:"value",input:s,key:u,value:a};for(let y of d.issues)y.path?y.path.unshift(p):y.path=[p],n.issues?.push(y);if(n.issues||(n.issues=d.issues),i.abortEarly){n.typed=!1;break}}(!c.typed||!d.typed)&&(n.typed=!1),c.typed&&(n.value[c.value]=d.value)}}else Ae(this,"type",n,i);return n}}}o(vt,"record");function ie(t){return{kind:"schema",type:"string",reference:ie,expects:"string",async:!1,message:t,get"~standard"(){return je(this)},"~run"(e,r){return typeof e.value=="string"?e.typed=!0:Ae(this,"type",e,r),e}}}o(ie,"string");function hb(t,e){return{kind:"schema",type:"tuple",reference:hb,expects:"Array",async:!1,items:t,message:e,get"~standard"(){return je(this)},"~run"(r,n){let i=r.value;if(Array.isArray(i)){r.typed=!0,r.value=[];for(let s=0;s<this.items.length;s++){let u=i[s],a=this.items[s]["~run"]({value:u},n);if(a.issues){let c={type:"array",origin:"value",input:i,key:s,value:u};for(let d of a.issues)d.path?d.path.unshift(c):d.path=[c],r.issues?.push(d);if(r.issues||(r.issues=a.issues),n.abortEarly){r.typed=!1;break}}a.typed||(r.typed=!1),r.value.push(a.value)}}else Ae(this,"type",r,n);return r}}}o(hb,"tuple");function br(t){return{kind:"schema",type:"undefined",reference:br,expects:"undefined",async:!1,message:t,get"~standard"(){return je(this)},"~run"(e,r){return e.value===void 0?e.typed=!0:Ae(this,"type",e,r),e}}}o(br,"undefined_");function vx(t){let e;if(t)for(let r of t)e?e.push(...r.issues):e=r.issues;return e}o(vx,"_subIssues");function Ee(t,e){return{kind:"schema",type:"union",reference:Ee,expects:ub(t.map(r=>r.expects),"|"),async:!1,options:t,message:e,get"~standard"(){return je(this)},"~run"(r,n){let i,s,u;for(let a of this.options){let c=a["~run"]({value:r.value},n);if(c.typed)if(c.issues)s?s.push(c):s=[c];else{i=c;break}else u?u.push(c):u=[c]}if(i)return i;if(s){if(s.length===1)return s[0];Ae(this,"type",r,n,{issues:vx(s)}),r.typed=!0}else{if(u?.length===1)return u[0];Ae(this,"type",r,n,{issues:vx(u)})}return r}}}o(Ee,"union");function rr(){return{kind:"schema",type:"unknown",reference:rr,expects:"unknown",async:!1,get"~standard"(){return je(this)},"~run"(t){return t.typed=!0,t}}}o(rr,"unknown");function gn(t,e,r){return{kind:"schema",type:"variant",reference:gn,expects:"Object",async:!1,key:t,options:e,message:r,get"~standard"(){return je(this)},"~run"(n,i){let s=n.value;if(s&&typeof s=="object"){let u,a=0,c=this.key,d=[],p=o((y,v)=>{for(let x of y.options){if(x.type==="variant")p(x,new Set(v).add(x.key));else{let A=!0,B=0;for(let I of v){let J=x.entries[I];if(I in s?J["~run"]({typed:!1,value:s[I]},{abortEarly:!0}).issues:J.type!=="exact_optional"&&J.type!=="optional"&&J.type!=="nullish"){A=!1,c!==I&&(a<B||a===B&&I in s&&!(c in s))&&(a=B,c=I,d=[]),c===I&&d.push(x.entries[I].expects);break}B++}if(A){let I=x["~run"]({value:s},i);(!u||!u.typed&&I.typed)&&(u=I)}}if(u&&!u.issues)break}},"parseOptions");if(p(this,new Set([this.key])),u)return u;Ae(this,"type",n,i,{input:s[c],expected:ub(d,"|"),path:[{type:"object",origin:"value",input:s,key:c,value:s[c]}]})}else Ae(this,"type",n,i);return n}}}o(gn,"variant");function wx(t,e){return{...t,get"~standard"(){return je(this)},"~run"(r,n){return t["~run"](r,{...n,message:e})}}}o(wx,"message");function _x(t,e){let r={...t.entries};for(let n of e)delete r[n];return{...t,entries:r,get"~standard"(){return je(this)}}}o(_x,"omit");function $f(t,e,r){let n=t["~run"]({value:e},sb(r));if(n.issues)throw new ab(n.issues);return n.value}o($f,"parse");function op(t,e){let r={};for(let n of e)r[n]=t.entries[n];return{...t,entries:r,get"~standard"(){return je(this)}}}o(op,"pick");function H(...t){return{...t[0],pipe:t,get"~standard"(){return je(this)},"~run"(e,r){for(let n of t)if(n.kind!=="metadata"){if(e.issues&&(n.kind==="schema"||n.kind==="transformation")){e.typed=!1;break}(!e.issues||!r.abortEarly&&!r.abortPipeEarly)&&(e=n["~run"](e,r))}return e}}}o(H,"pipe");function Hr(t,e,r){let n=t["~run"]({value:e},sb(r));return{typed:n.typed,success:!n.issues,output:n.value,issues:n.issues}}o(Hr,"safeParse");function rC(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}o(rC,"isObject");var la,nC=(la=class extends Error{},o(la,"UnknownCauseError"),la);function iC(t){if(t instanceof Error)return t;let e=typeof t;if(!(e==="undefined"||e==="function"||t===null)){if(e!=="object")return new Error(String(t));if(rC(t)){let r=new nC;for(let n in t)r[n]=t[n];return r}}}o(iC,"getCauseFromUnknown");var pa,Lr=(pa=class extends Error{constructor(e){let r=iC(e.cause),n=e.message??r?.message??e.code;super(n,{cause:r}),this.code=e.code,this.name="DcqlError",this.cause||(this.cause=r)}},o(pa,"DcqlError"),pa),ha,oC=(ha=class extends Lr{constructor(e){super({code:"BAD_REQUEST",...e})}},o(ha,"DcqlCredentialSetError"),ha),ya,sC=(ya=class extends Lr{constructor(e){super({code:"BAD_REQUEST",...e})}},o(ya,"DcqlUndefinedClaimSetIdError"),ya),ma,uC=(ma=class extends Lr{constructor(e){super({code:"BAD_REQUEST",...e})}},o(ma,"DcqlNonUniqueCredentialQueryIdsError"),ma),ga,Ix=(ga=class extends Lr{constructor(e){super({code:"PARSE_ERROR",...e})}},o(ga,"DcqlParseError"),ga);var va,aC=(va=class extends Lr{constructor(e){super({code:"BAD_REQUEST",...e})}},o(va,"DcqlInvalidPresentationRecordError"),va),ba,yb=(ba=class extends Lr{constructor(e){super({code:"BAD_REQUEST",...e})}},o(ba,"DcqlPresentationResultError"),ba),Ox=/^[a-zA-Z0-9_-]+$/;function vn(t){return t.length>0?t:void 0}o(vn,"asNonEmptyArrayOrUndefined");function Rx(t){return t.length>0}o(Rx,"isNonEmptyArray");var se=o(t=>H(jt(t,e=>`Expected input to be an array, but received '${e.received}'`),Uf(e=>e.length>0,"Array must be non-empty and have length of at least 1")),"vNonEmptyArray"),cC=o(t=>Uf(e=>Array.isArray(e)?t.every(r=>e.includes(r)):!1,`Value must include all of: ${t.join(", ")}`),"vIncludesAll"),wr=H(ie(),Df(Ox),fb()),fC=Df(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==)?|[\w-]{3}=?)?$/iu,"must be base64url");function dC(t){return t===null||typeof t!="object"?!1:typeof t.toJson=="function"}o(dC,"isToJsonable");var lC=o(t=>H(Uf(()=>!0),ho(({dataset:e,addIssue:r,NEVER:n})=>{let i=Hr(t,e.value);if(i.success)return e.value;if(!dC(e.value)){for(let a of i.issues)r({...a,expected:a.expected??void 0});return n}let s;try{s=e.value.toJson()}catch{for(let a of i.issues)r({...a,expected:a.expected??void 0});return r({message:"Json Transformation failed"}),n}let u=Hr(t,s);if(u.success)return e.value;for(let a of u.issues)r({...a,expected:a.expected??void 0});return n})),"vWithJT"),jx=Ee([ie(),rt(),vr(),ip()]),Vf=np(()=>Ee([jx,jt(Vf),vt(ie(),Vf)])),AZ=np(()=>lC(Ee([jx,jt(Vf),vt(ie(),Vf)]))),xb=vt(ie(),Vf),pC=ho(({dataset:t,addIssue:e,NEVER:r})=>{try{return JSON.parse(t.value)}catch{return e({message:"Invalid JSON"}),r}});function xx(t,e){let r=H(Q(t,()=>{}),t);return e?wx(r,e):r}o(xx,"vCustomRequiredMessage");var hC=o(t=>H(F({type:he(t.type,e=>`Expected trusted authority type to be '${t.type}' but received ${typeof e.input=="string"?`'${e.input}'`:e.input}`),values:H(se(ie()),db(e=>t.values.includes(e),e=>`Expected one of the trusted authority values to be '${t.values.join("' | '")}' but received '${e.input.join("' , '")}'`))},`Expected trusted authority object with type '${t.type}' to be defined, but received undefined`),lb(({values:e,...r})=>({...r,value:e.find(n=>t.values.includes(n))}))),"getTrustedAuthorityParser"),Nx=[F({type:he("aki"),values:se(H(ie("aki trusted authority value must be a string"),fC,G("Contains a list of KeyIdentifier entries of the AuthorityKeyIdentifier as defined in Section 4.2.1.1 of [RFC5280], encoded as base64url. The raw byte representation of one of the elements MUST match with the AuthorityKeyIdentifier element of an X.509 certificate in the certificate chain present in the credential (e.g., in the header of an mdoc or SD-JWT). Note that the chain can consist of a single certificate and the credential can include the entire X.509 chain or parts of it.")))}),F({type:he("etsi_tl"),values:se(H(ie("etsi_tl trusted authority value must be a string"),rp("etsi_tl trusted authority value must be a valid https url"),Bf(t=>t.startsWith("http://")||t.startsWith("https://"),"etsi_tl trusted authority value must be a valid https url"),G("The identifier of a Trusted List as specified in ETSI TS 119 612 [ETSI.TL]. An ETSI Trusted List contains references to other Trusted Lists, creating a list of trusted lists, or entries for Trust Service Providers with corresponding service description and X.509 Certificates. The trust chain of a matching Credential MUST contain at least one X.509 Certificate that matches one of the entries of the Trusted List or its cascading Trusted Lists.")))}),F({type:he("openid_federation"),values:se(H(ie("openid_federation trusted authority value must be a string"),rp("openid_federation trusted authority value must be a valid https url"),Bf(t=>t.startsWith("http://")||t.startsWith("https://"),"openid_federation trusted authority value must be a valid https url"),G("The Entity Identifier as defined in Section 1 of [OpenID.Federation] that is bound to an entity in a federation. While this Entity Identifier could be any entity in that ecosystem, this entity would usually have the Entity Configuration of a Trust Anchor. A valid trust path, including the given Entity Identifier, must be constructible from a matching credential.")))})],mb;(function(t){let e=Nx.map(r=>F({type:H(r.entries.type,G("REQUIRED. A string uniquely identifying the type of information about the issuer trust framework.")),values:H(se(r.entries.values.item),G("REQUIRED. An array of strings, where each string (value) contains information specific to the used Trusted Authorities Query type that allows to identify an issuer, trust framework, or a federation that an issuer belongs to."))}));t.vModel=gn("type",e)})(mb||(mb={}));var up;(function(t){t.vModel=gn("type",Nx)})(up||(up={}));var wa,ui=(wa=class{constructor(e){this.input=e}get v(){return this.input.vModel}parse(e){let r=this.safeParse(e);return r.success?r.output:new Ix({message:JSON.stringify(r.flattened),cause:r.error})}safeParse(e){let r=Hr(this.input.vModel,e);return r.success?{success:!0,output:r.output}:{success:!1,error:new ab(r.issues),flattened:qf(r.issues)}}is(e){return pb(this.v,e)}},o(wa,"ModelDefinition"),wa),Ab=F({authority:Q(up.vModel),cryptographic_holder_binding:H(vr(),G("Indicates support/inclusion of cryptographic holder binding. This will be checked against the `require_cryptographic_holder_binding` property from the query."))}),_a;(function(t){let e=t.vNamespaces=vt(ie(),vt(ie(),rr()));t.model=new ui({vModel:t.vModel=F({...Ab.entries,credential_format:he("mso_mdoc"),doctype:ie(),namespaces:e})})})(_a||(_a={}));var xa;(function(t){let e=t.vClaims=xb;t.model=new ui({vModel:t.vModel=F({...Ab.entries,credential_format:yo(["vc+sd-jwt","dc+sd-jwt"]),vct:ie(),claims:e})})})(xa||(xa={}));var Aa;(function(t){let e=t.vClaims=xb;t.model=new ui({vModel:t.vModel=F({...Ab.entries,credential_format:yo(["ldp_vc","jwt_vc_json","vc+sd-jwt"]),claims:e,type:jt(ie())})})})(Aa||(Aa={}));var Ax;(function(t){t.model=new ui({vModel:t.vModel=gn("credential_format",[_a.vModel,xa.vModel,Aa.vModel])})})(Ax||(Ax={}));var gb;(function(t){t.model=new ui({vModel:t.vModel=_a.vModel})})(gb||(gb={}));var vb;(function(t){t.model=new ui({vModel:t.vModel=xa.vModel})})(vb||(vb={}));var bb;(function(t){t.model=new ui({vModel:t.vModel=Aa.vModel})})(bb||(bb={}));var Sx;(function(t){t.model=new ui({vModel:gn("credential_format",[gb.vModel,vb.vModel,bb.vModel])})})(Sx||(Sx={}));var kx;(function(t){let e=Ee([ie(),xb]),r=t.vModel=H(Ee([vt(wr,se(e)),vt(wr,e)]),G("REQUIRED. This is a JSON-encoded object containing entries where the key is the id value used for a Credential Query in the DCQL query and the value is an array of one or more Presentations that match the respective Credential Query. When multiple is omitted, or set to false, the array MUST contain only one Presentation. There MUST NOT be any entry in the JSON-encoded object for optional Credential Queries when there are no matching Credentials for the respective Credential Query. Each Presentation is represented as a string or object, depending on the format as defined in Appendix B. The same rules as above apply for encoding the Presentations."));t.parse=n=>typeof n=="string"?$f(H(ie(),pC,r),n):$f(r,n),t.encode=n=>JSON.stringify(n)})(kx||(kx={}));var da;(function(t){let e=t.vValue=Ee([ie(),H(rt(),tp()),vr()]),r=t.vPath=Ee([ie(),H(rt(),tp(),cb(0)),ip()]),n=t.vW3cSdJwtVc=F({id:H(Q(wr),G("A string identifying the particular claim. The value MUST be a non-empty string consisting of alphanumeric, underscore (_) or hyphen (-) characters. Within the particular claims array, the same id MUST NOT be present more than once.")),path:H(se(r),G("A non-empty array representing a claims path pointer that specifies the path to a claim within the Verifiable Credential.")),values:H(Q(jt(e)),G("An array of strings, integers or boolean values that specifies the expected values of the claim. If the values property is present, the Wallet SHOULD return the claim only if the type and value of the claim both match for at least one of the elements in the array."))}),i=F({id:H(Q(wr),G("A string identifying the particular claim. The value MUST be a non-empty string consisting of alphanumeric, underscore (_) or hyphen (-) characters. Within the particular claims array, the same id MUST NOT be present more than once.")),values:H(Q(jt(e)),G("An array of strings, integers or boolean values that specifies the expected values of the claim. If the values property is present, the Wallet SHOULD return the claim only if the type and value of the claim both match for at least one of the elements in the array."))}),s=t.vMdocNamespace=F({...i.entries,namespace:H(ie(),G("A string that specifies the namespace of the data element within the mdoc, e.g., org.iso.18013.5.1.")),claim_name:H(ie(),G("A string that specifies the data element identifier of the data element within the provided namespace in the mdoc, e.g., first_name."))}),u=t.vMdocPath=F({...i.entries,intent_to_retain:H(Q(vr()),G("A boolean that is equivalent to `IntentToRetain` variable defined in Section 8.3.2.1.2.1 of [@ISO.18013-5].")),path:H(hb([H(ie(),G("A string that specifies the namespace of the data element within the mdoc, e.g., org.iso.18013.5.1.")),H(ie(),G("A string that specifies the data element identifier of the data element within the provided namespace in the mdoc, e.g., first_name."))]),G("An array defining a claims path pointer into an mdoc. It must contain two elements of type string. The first element refers to a namespace and the second element refers to a data element identifier."))}),a=t.vMdoc=Ee([s,u]);t.vModel=Ee([a,n])})(da||(da={}));function wb(t,e){let r=e;if(Object.getPrototypeOf(t)!==Object.prototype&&!Array.isArray(t))throw new Lr({message:"source value provided to deepMerge is neither an array or object.",code:"PARSE_ERROR"});if(Object.getPrototypeOf(e)!==Object.prototype&&!Array.isArray(e))throw new Lr({message:"target value provided to deepMerge is neither an array or object.",code:"PARSE_ERROR"});for(let[n,i]of Object.entries(t))if(i!==null&&typeof i=="object"&&(Object.getPrototypeOf(i)===Object.prototype||Array.isArray(i))){let s=wb(i,r[n]??new(Object.getPrototypeOf(i)).constructor);r=Cx(r,n,s)}else i!=null&&(r=Cx(r,n,i));return r}o(wb,"deepMerge");function Cx(t,e,r){let n=t;if(Array.isArray(n))n=[...n],n[e]=r;else if(Object.getPrototypeOf(n)===Object.prototype)n={...n,[e]:r};else throw new Lr({message:"Unsupported type for deep merge. Only primitive types or Array and Object are supported",code:"INTERNAL_SERVER_ERROR"});return n}o(Cx,"setValue");var bn=o(t=>t.map(e=>typeof e=="string"?`'${e}'`:`${e}`).join("."),"pathToString"),Bx=o((t,e)=>e?Ee(e.map(r=>he(r,n=>`Expected claim ${bn(t)} to be ${typeof r=="string"?`'${r}'`:r} but received ${typeof n.input=="string"?`'${n.input}'`:n.input}`)),r=>`Expected claim ${bn(t)} to be ${e.map(n=>typeof n=="string"?`'${n}'`:n).join(" | ")} but received ${typeof r.input=="string"?`'${r.input}'`:r.input}`):H(rr(),Bf(r=>r!=null,`Expected claim '${t.join("'.'")}' to be defined`)),"getClaimParser"),yC=o(t=>{let e=pb(da.vMdocNamespace,t)?{id:t.id,path:[t.namespace,t.claim_name],values:t.values}:t,r=e.path[0],n=e.path[1];return F({[r]:F({[n]:Bx(e.path,t.values)},`Expected claim ${bn(e.path)} to be defined`)},`Expected claim ${bn(e.path)} to be defined`)},"getMdocClaimParser"),sp=o((t,e)=>{let{index:r,presentation:n}=e,i=t.path[r],s=r===t.path.length-1,u=Bx(t.path,t.values);if(typeof i=="number"){let a=s?u:sp(t,{...e,index:r+1});return n?H(jt(Mf(),`Expected path ${bn(t.path.slice(0,r+1))} to be an array`),ho(({dataset:c,addIssue:d})=>{let p=[];for(let y of c.value){let v=Hr(a,y);if(v.success)return c.value;p.push(v.issues[0])}return d({...p[0],message:s?p[0].message:`Expected any element in array ${bn(t.path.slice(0,r+1))} to match sub requirement but none matched: ${p[0].message}`}),c.value})):H(jt(Mf(),`Expected path ${bn(t.path.slice(0,r+1))} to be an array`),ho(({addIssue:c,dataset:d,NEVER:p})=>{let y=Hr(a,d.value[i]);return y.success?[...d.value.slice(0,i).map(()=>null),y.output]:(c(y.issues[0]),p)}))}return typeof i=="string"?F({[i]:s?u:sp(t,{...e,index:r+1})},`Expected claim ${bn(t.path)} to be defined`):H(jt(Mf(),`Expected path ${bn(t.path.slice(0,r+1))} to be an array`),ho(({addIssue:a,dataset:c,NEVER:d})=>{let p=c.value.map(y=>Hr(s?u:sp(t,{...e,index:r+1}),y));if(p.every(y=>!y.success)){for(let y of p)for(let v of y.issues)a(v);return d}return p.map(y=>y.success?y.output:null)}))},"getJsonClaimParser"),mC=o((t,e)=>{if(!t.claims)return{success:!0,valid_claims:void 0,failed_claims:void 0,valid_claim_sets:[{claim_set_index:void 0,output:{},success:!0,valid_claim_indexes:void 0}],failed_claim_sets:void 0};let r=[],n=[];for(let[u,a]of t.claims.entries()){let c=t.format==="mso_mdoc"?yC(a):sp(a,{index:0,presentation:e.presentation}),d=Hr(c,e.credential.credential_format==="mso_mdoc"?e.credential.namespaces:e.credential.claims);if(d.success)n.push({success:!0,claim_index:u,claim_id:a.id,output:d.output,parser:c});else{let p=qf(d.issues);r.push({success:!1,issues:p.nested??p,claim_index:u,claim_id:a.id,output:d.output,parser:c})}}let i=[],s=[];for(let[u,a]of t.claim_sets?.entries()??[[void 0,void 0]]){let c=a?.map(d=>{let p=n.find(y=>y.claim_id===d)??r.find(y=>y.claim_id===d);if(!p)throw new Ix({message:`Claim with id '${d}' in query '${t.id}' from claim set with index '${u}' not found in claims of claim`});return p})??[...n,...r];if(c.every(d=>d.success)){let d=c.reduce((p,y)=>wb(y.output,p),{});s.push({success:!0,claim_set_index:u,output:d,valid_claim_indexes:vn(c.map(p=>p.claim_index))})}else{let d=r.reduce((p,y)=>wb(y.issues,p),{});i.push({success:!1,issues:d,claim_set_index:u,failed_claim_indexes:c.filter(p=>!p.success).map(p=>p.claim_index),valid_claim_indexes:vn(c.filter(p=>p.success).map(p=>p.claim_index))})}}return Rx(s)?{success:!0,failed_claim_sets:vn(i),valid_claim_sets:s,valid_claims:vn(n.map(({parser:u,...a})=>a)),failed_claims:vn(r.map(({parser:u,...a})=>a))}:{success:!1,failed_claim_sets:i,failed_claims:r.map(({parser:u,...a})=>a),valid_claims:vn(n.map(({parser:u,...a})=>a))}},"runClaimsQuery"),Sb=o(t=>F({cryptographic_holder_binding:t.require_cryptographic_holder_binding?he(!0,e=>`Expected cryptographic_holder_binding to be true (because credential query '${t.id}' requires cryptographic holder binding), but received ${e.input}`):vr()}),"getCryptographicHolderBindingValue"),gC=o(t=>{let e=t.meta?.doctype_value?he(t.meta.doctype_value,r=>`Expected doctype to be '${t.meta?.doctype_value}' but received '${r.input}'`):ie("Expected doctype to be defined");return F({credential_format:he("mso_mdoc",r=>`Expected credential format to be 'mso_mdoc' but received '${r.input}'`),doctype:e,...Sb(t).entries})},"getMdocMetaParser"),Ex=o(t=>F({credential_format:he(t.format,e=>`Expected credential format to be '${t.format}' but received '${e.input}'`),vct:t.meta?.vct_values?xx(yo(t.meta.vct_values,e=>`Expected vct to be '${t.meta?.vct_values?.join("' | '")}' but received '${e.input}'`),e=>`Expected vct to be '${t.meta?.vct_values?.join("' | '")}' but received '${e.input}'`):xx(ie("Expected vct to be a string"),"Expected vct to be defined"),...Sb(t).entries}),"getSdJwtVcMetaParser"),Px=o(t=>F({credential_format:he(t.format,e=>`Expected credential format to be '${t.format}' but received '${e.input}'`),type:t.meta?.type_values?Ee(t.meta.type_values.map(e=>cC(e)),`Expected type to include all values from one of the following subsets: ${t.meta.type_values.map(e=>`[${e.join(", ")}]`).join(" | ")}`):se(ie()),...Sb(t).entries}),"getW3cVcMetaParser"),vC=o(t=>{if(t.format==="mso_mdoc")return gC(t);if(t.format==="dc+sd-jwt")return Ex(t);if(t.format==="vc+sd-jwt")return t.meta&&"type_values"in t.meta?Px(t):Ex(t);if(t.format==="ldp_vc"||t.format==="jwt_vc_json")return Px(t);throw new Lr({code:"NOT_IMPLEMENTED",message:`Unsupported format '${t.format}'`})},"getMetaParser"),bC=o((t,e)=>{let r=vC(t),n=Hr(r,e);if(!n.success){let i=qf(n.issues);return{success:!1,issues:i.nested??i,output:n.output}}return{success:!0,output:n.output}},"runMetaQuery"),wC=o((t,e)=>{if(!t.trusted_authorities)return{success:!0};let r=[];for(let[n,i]of t.trusted_authorities.entries()){let s=hC(i),u=Hr(s,e.authority);if(u.success)return{success:!0,valid_trusted_authority:{success:!0,trusted_authority_index:n,output:u.output},failed_trusted_authorities:vn(r)};let a=qf(u.issues);r.push({success:!1,trusted_authority_index:n,issues:a.nested??a,output:u.output})}return{success:!1,failed_trusted_authorities:r}},"runTrustedAuthoritiesQuery"),Dx=o((t,e)=>{let{credentials:r,presentation:n}=e,i=[],s=[];for(let[u,a]of r.entries()){let c=wC(t,a),d=mC(t,{credential:a,presentation:n}),p=bC(t,a);d.success&&c.success&&p.success?i.push({success:!0,input_credential_index:u,trusted_authorities:c,meta:p,claims:d}):s.push({success:!1,input_credential_index:u,trusted_authorities:c,meta:p,claims:d})}return Rx(i)?{success:!0,credential_query_id:t.id,failed_credentials:vn(s),valid_credentials:i}:{success:!1,credential_query_id:t.id,failed_credentials:vn(s),valid_credentials:void 0}},"runCredentialQuery"),Hf;(function(t){let e=F({id:H(ie(),Df(Ox),G("REQUIRED. A string identifying the Credential in the response and, if provided, the constraints in 'credential_sets'.")),require_cryptographic_holder_binding:H(Q(vr(),!0),G("OPTIONAL. A boolean which indicates whether the Verifier requires a Cryptographic Holder Binding proof. The default value is true, i.e., a Verifiable Presentation with Cryptographic Holder Binding is required. If set to false, the Verifier accepts a Credential without Cryptographic Holder Binding proof.")),multiple:H(Q(vr(),!1),G("OPTIONAL. A boolean which indicates whether multiple Credentials can be returned for this Credential Query. If omitted, the default value is false.")),claim_sets:H(Q(se(se(wr))),G("OPTIONAL. A non-empty array containing arrays of identifiers for elements in 'claims' that specifies which combinations of 'claims' for the Credential are requested.")),trusted_authorities:H(Q(se(mb.vModel)),G("OPTIONAL. A non-empty array of objects as defined in Section 6.1.1 that specifies expected authorities or trust frameworks that certify Issuers, that the Verifier will accept. Every Credential returned by the Wallet SHOULD match at least one of the conditions present in the corresponding trusted_authorities array if present."))}),r=t.vMdoc=F({...e.entries,format:H(he("mso_mdoc"),G("REQUIRED. A string that specifies the format of the requested Verifiable Credential.")),claims:H(Q(se(da.vMdoc)),G("OPTIONAL. A non-empty array of objects as that specifies claims in the requested Credential.")),meta:H(Q(F({doctype_value:H(Q(ie()),G("OPTIONAL. String that specifies an allowed value for the doctype of the requested Verifiable Credential."))})),G("OPTIONAL. An object defining additional properties requested by the Verifier that apply to the metadata and validity data of the Credential."))}),n=t.vSdJwtVc=F({...e.entries,format:H(yo(["vc+sd-jwt","dc+sd-jwt"]),G("REQUIRED. A string that specifies the format of the requested Verifiable Credential.")),claims:H(Q(se(da.vW3cSdJwtVc)),G("OPTIONAL. A non-empty array of objects as that specifies claims in the requested Credential.")),meta:H(Q(H(F({vct_values:Q(jt(ie()))}),G("OPTIONAL. An array of strings that specifies allowed values for the type of the requested Verifiable Credential."))),G("OPTIONAL. An object defining additional properties requested by the Verifier that apply to the metadata and validity data of the Credential."))}),i=t.vW3cVc=F({...e.entries,format:H(yo(["jwt_vc_json","ldp_vc","vc+sd-jwt"]),G("REQUIRED. A string that specifies the format of the requested Verifiable Credential.")),claims:H(Q(se(da.vW3cSdJwtVc)),G("OPTIONAL. A non-empty array of objects as that specifies claims in the requested Credential.")),meta:H(H(F({type_values:H(se(se(ie())),G("REQUIRED. An array of string arrays that specifies the fully expanded types (IRIs) after the @context was applied that the Verifier accepts to be presented in the Presentation. Each of the top-level arrays specifies one alternative to match the type values of the Verifiable Credential against. Each inner array specifies a set of fully expanded types that MUST be present in the type property of the Verifiable Credential, regardless of order or the presence of additional types."))})),G("REQUIRED. An object defining additional properties requested by the Verifier that apply to the metadata and validity data of the Credential."))});t.vModel=gn("format",[r,i,n]),t.validate=s=>{_C(s)}})(Hf||(Hf={}));var _C=o(t=>{if(!t.claim_sets)return;let e=new Set(t.claims?.map(n=>n.id)),r=[];for(let n of t.claim_sets)for(let i of n)e.has(i)||r.push(i);if(r.length>0)throw new sC({message:`Credential set contains undefined credential id${r.length===0?"":"`s"} '${r.join(", ")}'`})},"claimSetIdsAreDefined"),ap;(function(t){t.vModel=F({options:H(se(jt(wr)),G("REQUIRED. A non-empty array, where each value in the array is a list of Credential Query identifiers representing one set of Credentials that satisfies the use case.")),required:H(Q(vr(),!0),G("OPTIONAL. Boolean which indicates whether this set of Credentials is required to satisfy the particular use case at the Verifier. If omitted, the default value is 'true'.")),purpose:H(Q(Ee([ie(),rt(),vt(ie(),rr())])),G("OPTIONAL. A string, number or object specifying the purpose of the query."))})})(ap||(ap={}));var cp;(function(t){let e=Ee([_a.vModel.entries.namespaces,xa.vModel.entries.claims,Aa.vModel.entries.claims]),r=t.vClaimsEntrySuccessResult=F({success:he(!0),claim_index:rt(),claim_id:Q(wr),output:e}),n=t.vClaimsEntryFailureResult=F({success:he(!1),claim_index:rt(),claim_id:Q(wr),issues:vt(ie(),rr()),output:rr()}),i=t.vClaimSetSuccessResult=F({success:he(!0),claim_set_index:Ee([rt(),br()]),valid_claim_indexes:Q(se(rt())),failed_claim_indexes:Q(br()),output:e}),s=t.vClaimSetFailureResult=F({success:he(!1),claim_set_index:Ee([rt(),br()]),valid_claim_indexes:Q(se(rt())),failed_claim_indexes:se(rt()),issues:vt(ie(),rr())}),u=t.vClaimsSuccessResult=F({success:he(!0),valid_claims:Q(se(r)),failed_claims:Q(se(n)),valid_claim_sets:se(i),failed_claim_sets:Q(se(s))}),a=t.vClaimsFailureResult=F({success:he(!1),valid_claims:Q(se(r)),failed_claims:se(n),valid_claim_sets:Q(br()),failed_claim_sets:se(s)});t.vModel=Ee([u,a])})(cp||(cp={}));var fp;(function(t){let e=t.vMetaSuccessResult=F({success:he(!0),output:gn("credential_format",[op(xa.vModel,["credential_format","cryptographic_holder_binding","vct"]),op(_a.vModel,["credential_format","cryptographic_holder_binding","doctype"]),op(Aa.vModel,["credential_format","cryptographic_holder_binding","type"])])}),r=t.vMetaFailureResult=F({success:he(!1),issues:vt(ie(),rr()),output:rr()});t.vModel=Ee([e,r])})(fp||(fp={}));var dp;(function(t){let e=t.vTrustedAuthorityEntrySuccessResult=F({success:he(!0),trusted_authority_index:rt(),output:gn("type",up.vModel.options.map(s=>F({type:s.entries.type,value:s.entries.values.item})))}),r=t.vTrustedAuthorityEntryFailureResult=F({success:he(!1),trusted_authority_index:rt(),issues:vt(ie(),rr()),output:rr()}),n=t.vTrustedAuthoritySuccessResult=Ee([F({success:he(!0),valid_trusted_authority:Q(br()),failed_trusted_authorities:Q(br())}),F({success:he(!0),valid_trusted_authority:e,failed_trusted_authorities:Q(se(r))})]),i=t.vTrustedAuthorityFailureResult=F({success:he(!1),valid_trusted_authority:Q(br()),failed_trusted_authorities:se(r)});t.vModel=Ee([...n.options,i])})(dp||(dp={}));var _b;(function(t){let e=t.vCredentialQueryItemCredentialSuccessResult=F({success:he(!0),input_credential_index:rt(),trusted_authorities:dp.vTrustedAuthoritySuccessResult,claims:cp.vClaimsSuccessResult,meta:fp.vMetaSuccessResult}),r=t.vCredentialQueryItemCredentialFailureResult=F({success:he(!1),input_credential_index:rt(),trusted_authorities:dp.vModel,claims:cp.vModel,meta:fp.vModel}),n=t.vCredentialQueryItemResult=Ee([F({success:he(!0),credential_query_id:wr,valid_credentials:se(e),failed_credentials:Q(se(r))}),F({success:he(!1),credential_query_id:wr,valid_credentials:Q(br()),failed_credentials:Q(se(r))})]),i=t.vCredentialQueryResult=vt(wr,n);t.vModel=F({credentials:H(se(Hf.vModel),G("REQUIRED. A non-empty array of Credential Queries that specify the requested Verifiable Credentials.")),credential_matches:i,credential_sets:Q(H(se(F({...ap.vModel.entries,matching_options:Ee([br(),se(jt(ie()))])})),G("OPTIONAL. A non-empty array of credential set queries that specifies additional constraints on which of the requested Verifiable Credentials to return."))),can_be_satisfied:vr()})})(_b||(_b={}));var Tx;(function(t){let e=t.vModel=_x(_b.vModel,["credentials"]);t.parse=r=>$f(e,r),t.fromDcqlPresentation=(r,n)=>{let{dcqlQuery:i}=n,s=Object.entries(r).map(([a,c])=>{let d=i.credentials.find(p=>p.id===a);if(!d)throw new yb({message:`Query ${a} not found in the dcql query. Cannot validate presentation.`});if(Array.isArray(c)){if(c.length===0)throw new yb({message:`Query credential '${a}' is present in the presentations but the value is an empty array. Each entry must at least provide one presentation.`});if(!d.multiple&&c.length>1)throw new yb({message:`Query credential '${a}' has not enabled 'multiple', but multiple presentations were provided. Only a single presentation is allowed for each query credential when 'multiple' is not enabled on the query.`})}return Dx(d,{presentation:!0,credentials:c?Array.isArray(c)?c:[c]:[]})}),u=i.credential_sets?.map(a=>{let c=a.options.filter(d=>d.every(p=>s.find(y=>y.credential_query_id===p)?.success));return{...a,matching_options:c.length>0?c:void 0}});return{can_be_satisfied:s.every(a=>a.success&&!a.failed_credentials)&&(u?u.every(a=>!a.required||a.matching_options):i.credentials.every(a=>s.find(c=>c.credential_query_id===a.id)?.success)),credential_sets:u,credential_matches:Object.fromEntries(s.map(a=>[a.credential_query_id,a]))}},t.validate=r=>{if(!r.can_be_satisfied)throw new aC({message:"Invalid Presentation record",cause:r});return r}})(Tx||(Tx={}));var xC=o((t,e)=>{let r=Object.fromEntries(t.credentials.map(s=>[s.id,Dx(s,e)])),n=t.credential_sets?.map(s=>{let u=s.options.filter(a=>a.every(c=>r[c].success));return{...s,matching_options:u.length>0?u:void 0}}),i=n?n.every(s=>!s.required||s.matching_options):t.credentials.every(({id:s})=>r[s].success===!0);return{...t,can_be_satisfied:i,credential_matches:r,credential_sets:n}},"runDcqlQuery"),mo;(function(t){let e=t.vModel=F({credentials:H(se(Hf.vModel),G("REQUIRED. A non-empty array of Credential Queries that specify the requested Verifiable Credentials.")),credential_sets:H(Q(se(ap.vModel)),G("OPTIONAL. A non-empty array of credential set queries that specifies additional constraints on which of the requested Verifiable Credentials to return."))});t.validate=r=>{AC(r),SC(r),r.credentials.forEach(Hf.validate)},t.query=(r,n)=>xC(r,{credentials:n,presentation:!1}),t.parse=r=>$f(e,r)})(mo||(mo={}));var AC=o(t=>{let e=t.credentials.map(n=>n.id),r=e.filter((n,i)=>e.indexOf(n)!==i);if(r.length>0)throw new uC({message:`Duplicate credential query ids found: ${r.join(", ")}`})},"validateUniqueCredentialQueryIds"),SC=o(t=>{if(!t.credential_sets)return;let e=new Set(t.credentials.map(n=>n.id)),r=[];for(let n of t.credential_sets)for(let i of n.options)for(let s of i)e.has(s)||r.push(s);if(r.length>0)throw new oC({message:`Credential set contains undefined credential id${r.length===1?"":"`s"} '${r.join(", ")}'`})},"validateCredentialSets");var ai=o(t=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new te("invalid_dcql_query","dcql_query must be a JSON object");let e;try{e=mo.parse(t)}catch(r){throw new te("invalid_dcql_query",`dcql_query failed structural validation: ${Mx(r)}`,{cause:r})}try{mo.validate(e)}catch(r){throw new te("invalid_dcql_query",`dcql_query failed content validation: ${Mx(r)}`,{cause:r})}return e},"parseDcqlQuery"),Mx=o(t=>t instanceof Error?t.message:String(t),"describe");var Eb=class Eb extends Error{constructor(e,r,n){super(r),this.name="RequestObjectError",this.code=e,n?.cause!==void 0&&(this.cause=n.cause)}};o(Eb,"RequestObjectError");var Z=Eb,lp=o(async t=>{let e=await kC(t),{header:r,claims:n}=CC(e),i=bt(n.client_id);if(!i)throw new Z("invalid_request_object","Request Object JWS payload is missing client_id");let s=bt(n.client_id_scheme)??t.urlClientIdScheme,{prefix:u,value:a}=ep(i,s);if(t.urlClientId&&t.urlClientId!==i)throw new Z("client_id_mismatch",`Outer URL client_id (${t.urlClientId}) does not match signed Request Object client_id (${i})`);if(t.unsafeSkipRequestObjectSignatureVerification)return Vx(i,u,n);switch(u){case"redirect_uri":throw new Z("unsupported_client_id_scheme","client-id prefix=redirect_uri does not permit signed Request Objects (OID4VP \xA75)");case"did":await EC({jws:e,header:r,clientId:a,opts:t});break;case"x509_san_dns":await TC({jws:e,header:r,clientId:a,opts:t});break;case"pre-registered":await NC({jws:e,header:r,clientId:a,opts:t});break;case"https":case"verifier_attestation":case"x509_hash":throw new Z("unsupported_client_id_scheme",`client-id prefix=${u} is not yet supported (supported: did, x509_san_dns, pre-registered)`);default:{let c=u;throw new Z("unsupported_client_id_scheme",`client-id prefix=${c} is not supported`)}}return Vx(i,u,n)},"verifyAndDecodeRequestObject"),kC=o(async t=>{if(t.inlineJwt){if(!Lx(t.inlineJwt))throw new Z("invalid_request_object","Inline `request` parameter is not a compact JWS");return t.inlineJwt}if(!t.requestUri)throw new Z("invalid_request_object","verifyAndDecodeRequestObject requires either inlineJwt or requestUri");let e=t.fetchImpl??globalThis.fetch;if(typeof e!="function")throw new Z("request_fetch_failed","No fetch implementation available to resolve request_uri");let r;try{r=await e(t.requestUri,{method:"GET"})}catch(i){throw new Z("request_fetch_failed",`Failed to fetch request_uri: ${$t(i)}`,{cause:i})}if(!r.ok)throw new Z("request_fetch_failed",`request_uri returned ${r.status} ${r.statusText}`);let n=(await r.text()).trim();if(!Lx(n))throw new Z("invalid_request_object","request_uri response is not a compact JWS");return n},"loadJws"),CC=o(t=>{let[e,r]=t.split(".");try{let n=JSON.parse(Wx(e)),i=JSON.parse(Wx(r));return{header:n,claims:i}}catch(n){throw new Z("invalid_request_object",`Failed to decode Request Object JWS: ${$t(n)}`,{cause:n})}},"decodeHeaderAndClaims"),EC=o(async t=>{let{jws:e,header:r,clientId:n,opts:i}=t,s=bt(r.kid);if(!s)throw new Z("invalid_request_object","Request Object JWS header is missing kid (required for client_id_scheme=did)");let u=n.split("#")[0],a=i.didResolver??Cb(i.fetchImpl),c;try{c=await a(u)}catch(v){throw new Z("did_resolution_failed",`Failed to resolve ${u}: ${$t(v)}`,{cause:v})}let d=PC(c,s);if(!d)throw new Z("request_signer_untrusted",`Verification method ${s} not found on ${u}`);if(!d.publicKeyJwk)throw new Z("request_signer_untrusted",`Verification method ${d.id} has no publicKeyJwk (publicKeyMultibase not supported by default resolver)`);let p=bt(r.alg);if(!p)throw new Z("invalid_request_object","Request Object JWS header is missing alg");let y;try{y=await Xr(d.publicKeyJwk,p)}catch(v){throw new Z("request_signer_untrusted",`Failed to import publicKeyJwk from ${d.id}: ${$t(v)}`,{cause:v})}try{await za(e,y)}catch(v){throw new Z("request_signature_invalid",`JWS signature verification failed: ${$t(v)}`,{cause:v})}},"verifyWithDid"),PC=o((t,e)=>{let r=[];for(let i of t.verificationMethod??[])r.push(i);for(let i of t.authentication??[])typeof i=="object"&&r.push(i);for(let i of t.assertionMethod??[])typeof i=="object"&&r.push(i);let n=e.includes("#")?e.split("#").pop():e;return r.find(i=>i.id===e||i.id.split("#").pop()===n)},"findVerificationMethod"),TC=o(async t=>{let{jws:e,header:r,clientId:n,opts:i}=t,s=r.x5c;if(!Array.isArray(s)||s.length===0)throw new Z("invalid_request_object","Request Object JWS header is missing x5c (required for client_id_scheme=x509_san_dns)");let u;try{u=IC(s)}catch(x){throw new Z("invalid_request_object",`Failed to parse x5c chain: ${$t(x)}`,{cause:x})}let a=u[0],c=BC(n);if(!RC(a,c))throw new Z("client_id_mismatch",`Leaf certificate SAN does not cover client_id host "${c}" (sanDnsNames=${Fx(a).join(",")||"none"})`);let d=i.trustedX509Roots??[],p=!!i.unsafeAllowSelfSigned;if(d.length===0&&!p)throw new Z("request_signer_untrusted","client_id_scheme=x509_san_dns requires trustedX509Roots (or unsafeAllowSelfSigned for dev)");d.length>0&&await OC(u,d);let y=kb(s[0]),v;try{v=await pd(y,bt(r.alg)??"RS256")}catch(x){throw new Z("request_signer_untrusted",`Failed to import leaf X.509 cert: ${$t(x)}`,{cause:x})}try{await za(e,v)}catch(x){throw new Z("request_signature_invalid",`JWS signature verification failed: ${$t(x)}`,{cause:x})}},"verifyWithX509"),IC=o(t=>t.map(e=>new ca(kb(e))),"buildCertChain"),OC=o(async(t,e)=>{let r=e.map(i=>new ca(i));for(let i=0;i<t.length-1;i++){let s=t[i],u=t[i+1];if(!await Ux(s,u))throw new Z("request_signer_untrusted",`x5c chain broken at position ${i}: cert is not signed by its successor`)}let n=t[t.length-1];if(t.length===1){let i=await $x(n);for(let s of r)if(await $x(s)===i)return;throw new Z("request_signer_untrusted","Leaf certificate is self-contained and does not match any trustedX509Roots")}for(let i of r)if(await Ux(n,i))return;throw new Z("request_signer_untrusted","Top of x5c chain is not rooted in any trustedX509Roots")},"verifyChainToTrustedRoots"),Ux=o(async(t,e)=>{try{return await t.verify({publicKey:e.publicKey})}catch{return!1}},"safeVerify"),$x=o(async t=>{let e=await t.getThumbprint("SHA-256"),r=new Uint8Array(e),n="";for(let i=0;i<r.length;i++)n+=r[i].toString(16).padStart(2,"0");return n},"fingerprintHex"),RC=o((t,e)=>{let r=e.toLowerCase();for(let n of Fx(t))if(jC(n,r))return!0;return!1},"leafCoversHost"),Fx=o(t=>{let e=t.getExtension(sa);return e?e.names.toJSON().filter(r=>r.type==="dns").map(r=>r.value):[]},"listLeafSanDnsNames"),jC=o((t,e)=>{let r=t.toLowerCase();if(r===e)return!0;if(!r.startsWith("*."))return!1;let n=r.slice(1);if(!e.endsWith(n))return!1;let i=e.slice(0,-n.length);return i.length>0&&!i.includes(".")},"matchesDnsName");var kb=o(t=>{let e=t.replace(/\s+/g,"");return`-----BEGIN CERTIFICATE-----
21
+ ${(e.match(/.{1,64}/g)??[e]).join(`
22
+ `)}
23
+ -----END CERTIFICATE-----
24
+ `},"derToPem"),NC=o(async t=>{let{jws:e,header:r,opts:n}=t;if(!!!n.unsafeAllowSelfSigned)throw new Z("unsupported_client_id_scheme","client-id prefix=pre-registered without a registry binding requires unsafeAllowSelfSigned=true (signing key cannot be derived from client_id alone)");let s=r.x5c;if(!Array.isArray(s)||s.length===0)throw new Z("invalid_request_object","client-id prefix=pre-registered requires an x5c header to verify the signature against (no key material available otherwise)");let u=kb(s[0]),a;try{a=await pd(u,bt(r.alg)??"RS256")}catch(c){throw new Z("request_signer_untrusted",`Failed to import leaf X.509 cert: ${$t(c)}`,{cause:c})}try{await za(e,a)}catch(c){throw new Z("request_signature_invalid",`JWS signature verification failed: ${$t(c)}`,{cause:c})}},"verifyWithPreRegistered"),BC=o(t=>{try{return new URL(t.includes("://")?t:`https://${t}`).hostname}catch{return t}},"hostFromClientId"),Cb=o((t=globalThis.fetch)=>async e=>{if(e.startsWith("did:jwk:"))return DC(e);if(e.startsWith("did:web:"))return qC(e,t);throw new Z("did_resolution_failed",`Built-in resolver does not support ${e.split(":").slice(0,2).join(":")} \u2014 pass a custom didResolver`)},"builtInDidResolver"),DC=o(t=>{let e=t.replace(/^did:jwk:/,"").split("#")[0],r;try{let i="=".repeat((4-e.length%4)%4),s=e.replace(/-/g,"+").replace(/_/g,"/")+i;r=JSON.parse(Buffer.from(s,"base64").toString("utf8"))}catch(i){throw new Z("did_resolution_failed",`Failed to decode did:jwk identifier: ${$t(i)}`,{cause:i})}let n=`${t}#0`;return{id:t,verificationMethod:[{id:n,type:"JsonWebKey2020",controller:t,publicKeyJwk:r}],authentication:[n],assertionMethod:[n]}},"resolveDidJwk"),qC=o(async(t,e)=>{if(typeof e!="function")throw new Z("did_resolution_failed","did:web resolution requires a fetch implementation");let n=t.replace(/^did:web:/,"").split(":").map(d=>decodeURIComponent(d)),i=n.shift(),s=n.length===0?"/.well-known/did.json":`/${n.join("/")}/did.json`,u=`https://${i}${s}`,a;try{a=await e(u,{method:"GET"})}catch(d){throw new Z("did_resolution_failed",`Failed to fetch ${u}: ${$t(d)}`,{cause:d})}if(!a.ok)throw new Z("did_resolution_failed",`${u} returned ${a.status} ${a.statusText}`);let c;try{c=await a.json()}catch(d){throw new Z("did_resolution_failed",`${u} response was not JSON: ${$t(d)}`,{cause:d})}if(!c||typeof c!="object"||Array.isArray(c))throw new Z("did_resolution_failed",`${u} response was not a DID Document object`);return c},"resolveDidWeb"),Vx=o((t,e,r)=>{let n=Hx(r.presentation_definition)?r.presentation_definition:void 0,i=bt(r.presentation_definition_uri),s;if(r.dcql_query!==void 0&&r.dcql_query!==null){if(n||i)throw new te("both_pex_and_dcql","Request Object claims carry both PEX (presentation_definition[_uri]) and DCQL (dcql_query); OID4VP 1.0 \xA75.3 forbids this");s=ai(r.dcql_query)}let u=Hx(r.client_metadata)?r.client_metadata:void 0;return{client_id:t,client_id_scheme:e,response_type:bt(r.response_type)??"vp_token",response_mode:bt(r.response_mode),response_uri:bt(r.response_uri),redirect_uri:bt(r.redirect_uri),nonce:bt(r.nonce)??"",state:bt(r.state),presentation_definition:n,presentation_definition_uri:i,dcql_query:s,client_metadata:u,client_metadata_uri:bt(r.client_metadata_uri),scope:bt(r.scope)}},"buildRequestFromClaims"),bt=o(t=>typeof t=="string"&&t.length>0?t:void 0,"asString"),Hx=o(t=>t!==null&&typeof t=="object"&&!Array.isArray(t),"isObject"),Lx=o(t=>/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(t),"looksLikeJws"),Wx=o(t=>{let e="=".repeat((4-t.length%4)%4),r=t.replace(/-/g,"+").replace(/_/g,"/")+e;return Buffer.from(r,"base64").toString("utf8")},"b64urlDecode"),$t=o(t=>t instanceof Error?t.message:String(t),"describe");var Lf=o(t=>{if(typeof t!="string"||t.trim().length===0)throw new te("invalid_uri","Authorization Request URI must be a non-empty string");let e=MC(t),r=e.get("request_uri");if(typeof r=="string"&&r.length>0){if(!Jx(r))throw new te("invalid_uri","request_uri must be an absolute https:// URL");return{kind:"by_reference_request_uri",requestUri:r,rawParams:e}}let n=e.get("request");return typeof n=="string"&&n.length>0?{kind:"by_reference_request_jwt",jwt:n,rawParams:e}:{kind:"by_value",request:UC(e)}},"parseAuthorizationRequestUri"),Pb=o(async(t,e=globalThis.fetch)=>{if(typeof e!="function")throw new te("presentation_definition_fetch_failed","No fetch implementation available to resolve presentation_definition_uri");if(!Jx(t))throw new te("invalid_uri","presentation_definition_uri must be an absolute https:// URL");let r;try{r=await e(t,{method:"GET"})}catch(i){throw new te("presentation_definition_fetch_failed",`Failed to fetch presentation_definition_uri: ${$C(i)}`,{cause:i})}if(!r.ok)throw new te("presentation_definition_fetch_failed",`presentation_definition_uri returned ${r.status} ${r.statusText}`);let n;try{n=await r.json()}catch(i){throw new te("invalid_json","presentation_definition_uri response was not valid JSON",{cause:i})}return Kx(n)},"resolvePresentationDefinitionByReference"),Wf=o(async(t,e=globalThis.fetch,r={})=>{let n=Lf(t),i;if(n.kind==="by_value")i=n.request;else{let s=n.rawParams.get("client_id")??void 0,u=n.rawParams.get("client_id_scheme")??void 0;i=await lp({requestUri:n.kind==="by_reference_request_uri"?n.requestUri:void 0,inlineJwt:n.kind==="by_reference_request_jwt"?n.jwt:void 0,urlClientId:s,urlClientIdScheme:u,fetchImpl:e,didResolver:r.didResolver,trustedX509Roots:r.trustedX509Roots,unsafeAllowSelfSigned:r.unsafeAllowSelfSigned,unsafeSkipRequestObjectSignatureVerification:r.unsafeSkipRequestObjectSignatureVerification})}if(i.presentation_definition)return i;if(i.presentation_definition_uri){let s=await Pb(i.presentation_definition_uri,e);return{...i,presentation_definition:s}}return i},"resolveAuthorizationRequest"),MC=o(t=>{let e=t.indexOf("?");if(e!==-1)return new URLSearchParams(t.slice(e+1));if(t.includes("://")||/^[a-z][a-z0-9+.-]*:/i.test(t))throw new te("invalid_uri","Authorization Request URI has no query string");if(t.includes("="))return new URLSearchParams(t);throw new te("invalid_uri","Authorization Request URI has no query string")},"extractSearchParams"),UC=o(t=>{let e=t.get("client_id");if(!e)throw new te("missing_client_id","Authorization Request is missing client_id");let r=t.get("nonce");if(!r)throw new te("missing_nonce","Authorization Request is missing nonce");let n=t.get("response_type");if(!n)throw new te("missing_response_type","Authorization Request is missing response_type");let i=n.split(/\s+/).filter(Boolean),s=new Set(["vp_token","id_token"]);if(!i.some(Y=>s.has(Y)))throw new te("unsupported_response_type",`Authorization Request response_type "${n}" is not supported (expected vp_token and/or id_token)`);let u=t.get("response_uri")??void 0,a=t.get("redirect_uri")??void 0,c=t.get("response_mode")??void 0;if(!u&&!a)throw new te("missing_response_target","Authorization Request is missing both response_uri and redirect_uri");let d=t.get("presentation_definition"),p=t.get("presentation_definition_uri"),y=t.get("dcql_query");if(d&&p)throw new te("both_definition_and_uri","Authorization Request has both presentation_definition and presentation_definition_uri");if(y&&(d||p))throw new te("both_pex_and_dcql","Authorization Request carries both PEX (presentation_definition[_uri]) and DCQL (dcql_query); OID4VP 1.0 \xA75.3 forbids this");let v;if(d){let Y;try{Y=JSON.parse(d)}catch(ye){throw new te("invalid_json","presentation_definition query parameter was not valid JSON",{cause:ye})}v=Kx(Y)}let x;if(y){let Y;try{Y=JSON.parse(y)}catch(ye){throw new te("invalid_json","dcql_query query parameter was not valid JSON",{cause:ye})}x=ai(Y)}let A=t.get("scope")??void 0;if(i.includes("vp_token")&&!v&&!p&&!x&&!A)throw new te("missing_presentation_definition","Authorization Request has none of presentation_definition, presentation_definition_uri, dcql_query, or scope");let I=t.get("client_metadata"),J;if(I)try{let Y=JSON.parse(I);if(Y&&typeof Y=="object"&&!Array.isArray(Y))J=Y;else throw new te("invalid_json","client_metadata query parameter must be a JSON object")}catch(Y){throw Y instanceof te?Y:new te("invalid_json","client_metadata query parameter was not valid JSON",{cause:Y})}let de=new Set(["client_id","client_id_scheme","response_type","response_mode","response_uri","redirect_uri","nonce","state","presentation_definition","presentation_definition_uri","dcql_query","client_metadata","client_metadata_uri","scope"]),fe={};t.forEach((Y,ye)=>{de.has(ye)||(fe[ye]=Y)});let{prefix:ve}=ep(e,t.get("client_id_scheme")??void 0);return{client_id:e,client_id_scheme:ve,response_type:n,response_mode:c,response_uri:u,redirect_uri:a,nonce:r,state:t.get("state")??void 0,presentation_definition:v,presentation_definition_uri:p??void 0,dcql_query:x,client_metadata:J,client_metadata_uri:t.get("client_metadata_uri")??void 0,scope:A,...Object.keys(fe).length>0?{extra:fe}:{}}},"buildRequestFromParams"),Kx=o(t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new te("invalid_presentation_definition","presentation_definition must be a JSON object");let e=t;if(typeof e.id!="string"||e.id.length===0)throw new te("invalid_presentation_definition","presentation_definition is missing a string `id`");if(!Array.isArray(e.input_descriptors)||e.input_descriptors.length===0)throw new te("invalid_presentation_definition","presentation_definition must declare a non-empty input_descriptors array");for(let[r,n]of e.input_descriptors.entries()){if(!n||typeof n!="object")throw new te("invalid_presentation_definition",`input_descriptors[${r}] must be an object`);let i=n;if(typeof i.id!="string"||i.id.length===0)throw new te("invalid_presentation_definition",`input_descriptors[${r}].id must be a non-empty string`);if(!i.constraints||typeof i.constraints!="object")throw new te("invalid_presentation_definition",`input_descriptors[${r}].constraints must be an object`)}return e},"validatePresentationDefinition"),Jx=o(t=>{try{return new URL(t).protocol==="https:"}catch{return!1}},"isHttpsUrl"),$C=o(t=>t instanceof Error?t.message:String(t),"describe");var b4=kr(y4());var C6=512,u1=o((t,e)=>{if(!Array.isArray(e.path)||e.path.length===0)return{matched:!1,reason:"Field has no `path[]` declared"};for(let r of e.path){let n;try{n=a1(t,r)}catch(i){return{matched:!1,reason:`JSONPath "${r}" could not be evaluated: ${R6(i)}`}}if(n.length!==0)for(let i of n){if(!e.filter)return{matched:!0,matchedPath:r,value:i};if(Ta(i,e.filter))return{matched:!0,matchedPath:r,value:i};if(Array.isArray(i)&&T6(e.filter)){for(let s of i)if(Ta(s,e.filter))return{matched:!0,matchedPath:r,value:s}}}}return e.optional?{matched:!0,reason:"Field is optional and yielded no value"}:{matched:!1,reason:e.filter?`No value from paths ${JSON.stringify(e.path)} satisfied the filter`:`None of paths ${JSON.stringify(e.path)} resolved on the candidate`}},"evaluateField"),Np=o((t,e)=>{let n=e.constraints?.fields??[],i=[];for(let s of n){let u=u1(t,s);if(i.push(u),!u.matched)return{matched:!1,descriptorId:e.id,fields:i,reason:u.reason}}return{matched:!0,descriptorId:e.id,fields:i}},"matchInputDescriptor"),a1=o((t,e)=>{if(typeof e!="string"||e.length===0)throw new Error("JSONPath must be a non-empty string");if(e!=="$"&&!e.startsWith("$"))throw new Error(`JSONPath "${e}" must start with "$"`);if(/\[\?\(/.test(e))throw new Error(`JSONPath filter expressions are not supported yet (found in "${e}")`);if(/\[\s*\d+\s*:/.test(e)||/\[\s*:\s*\d+\s*\]/.test(e))throw new Error(`JSONPath array slicing is not supported yet (found in "${e}")`);let r=P6(e),n=[t];for(let i of r){let s=[];for(let u of n)switch(i.kind){case"property":{let a=E6(u,i.name);a!==void 0&&s.push(a);break}case"index":{Array.isArray(u)&&i.index<u.length&&s.push(u[i.index]);break}case"wildcard":{if(Array.isArray(u))for(let a of u)s.push(a);else if(u&&typeof u=="object")for(let a of Object.values(u))s.push(a);break}case"descendant":{s1(u,i.name,s);break}}n=s}return n},"queryJsonPath"),E6=o((t,e)=>{if(t!=null&&!Array.isArray(t)&&typeof t=="object")return t[e]},"getProperty"),s1=o((t,e,r)=>{if(t!=null){if(Array.isArray(t)){for(let n of t)s1(n,e,r);return}if(typeof t=="object"){let n=t;for(let[i,s]of Object.entries(n))i===e&&r.push(s),s1(s,e,r)}}},"collectDescendants"),P6=o(t=>{let e=[],r=t.startsWith("$")?1:0;for(;r<t.length;){let n=t[r];if(n===".")if(t[r+1]==="."){r+=2;let i=m4(t,r);if(!i.text)throw new Error(`Recursive descent ".." at position ${r} must be followed by a property name`);e.push({kind:"descendant",name:i.text}),r=i.next}else{if(r+=1,t[r]==="*"){e.push({kind:"wildcard"}),r+=1;continue}let i=m4(t,r);if(!i.text)throw new Error(`Property accessor "." at position ${r} must be followed by an identifier`);e.push({kind:"property",name:i.text}),r=i.next}else if(n==="["){let i=t.indexOf("]",r+1);if(i===-1)throw new Error(`Unterminated "[" in JSONPath "${t}"`);let s=t.slice(r+1,i).trim();if(s==="*")e.push({kind:"wildcard"});else if(/^-?\d+$/.test(s))e.push({kind:"index",index:parseInt(s,10)});else if(/^'[^']*'$/.test(s)||/^"[^"]*"$/.test(s))e.push({kind:"property",name:s.slice(1,-1)});else throw new Error(`Unsupported bracket expression [${s}] in JSONPath "${t}"`);r=i+1}else throw new Error(`Unexpected character "${n}" at position ${r} in JSONPath "${t}"`)}return e},"tokenizeJsonPath"),m4=o((t,e)=>{let r=e;for(;r<t.length;){let n=t[r];if(!/[A-Za-z0-9_\-@:]/.test(n))break;r+=1}return{text:t.slice(e,r),next:r}},"readIdentifier"),Ta=o((t,e)=>{if("type"in e&&!(Array.isArray(e.type)?e.type:[e.type]).some(i=>O6(t,i))||"const"in e&&!jp(t,e.const))return!1;if("enum"in e){let r=e.enum;if(!Array.isArray(r)||!r.some(n=>jp(t,n)))return!1}if("pattern"in e){if(typeof t!="string")return!1;let r=e.pattern;if(typeof r!="string"||r.length>C6||!(0,b4.default)(r))return!1;let n;try{n=new RegExp(r)}catch{return!1}try{if(!n.test(t))return!1}catch{return!1}}if(typeof t=="number"&&(typeof e.minimum=="number"&&t<e.minimum||typeof e.maximum=="number"&&t>e.maximum||typeof e.exclusiveMinimum=="number"&&t<=e.exclusiveMinimum||typeof e.exclusiveMaximum=="number"&&t>=e.exclusiveMaximum)||typeof t=="string"&&(typeof e.minLength=="number"&&t.length<e.minLength||typeof e.maxLength=="number"&&t.length>e.maxLength))return!1;if(Array.isArray(t)){if(e.contains&&typeof e.contains=="object"){let r=e.contains;if(!t.some(i=>Ta(i,r)))return!1}if(e.items&&typeof e.items=="object"&&!Array.isArray(e.items)){let r=e.items;if(!t.every(i=>Ta(i,r)))return!1}if(typeof e.minItems=="number"&&t.length<e.minItems||typeof e.maxItems=="number"&&t.length>e.maxItems)return!1}return!0},"satisfiesFilter"),T6=o(t=>{if(v4(t,["contains","items","minItems","maxItems"]))return!1;if("type"in t){let e=Array.isArray(t.type)?t.type:[t.type];return e.length===0?!1:e.every(r=>typeof r=="string"&&I6.has(r))}return v4(t,["pattern","minLength","maxLength","minimum","maximum","exclusiveMinimum","exclusiveMaximum"])||"const"in t&&g4(t.const)?!0:"enum"in t&&Array.isArray(t.enum)&&t.enum.length>0?t.enum.every(g4):!1},"expectsPrimitive"),I6=new Set(["string","number","integer","boolean","null"]),g4=o(t=>t===null||typeof t=="string"||typeof t=="number"||typeof t=="boolean","isPrimitiveValue"),v4=o((t,e)=>e.some(r=>r in t),"hasAnyKeyword"),O6=o((t,e)=>{switch(e){case"string":return typeof t=="string";case"number":return typeof t=="number";case"integer":return typeof t=="number"&&Number.isInteger(t);case"boolean":return typeof t=="boolean";case"null":return t===null;case"array":return Array.isArray(t);case"object":return t!==null&&typeof t=="object"&&!Array.isArray(t);default:return!1}},"matchesType"),jp=o((t,e)=>{if(t===e)return!0;if(t===null||e===null)return t===e;if(typeof t!=typeof e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!jp(t[r],e[r]))return!1;return!0}if(typeof t=="object"){if(typeof e!="object"||Array.isArray(e))return!1;let r=t,n=e,i=Object.keys(r),s=Object.keys(n);if(i.length!==s.length)return!1;for(let u of i)if(!jp(r[u],n[u]))return!1;return!0}return!1},"deepEqual"),R6=o(t=>t instanceof Error?t.message:String(t),"describe");var Bp=o((t,e)=>{let r=t.map((u,a)=>({index:a,candidate:{...u,format:u.format??Zf(u.credential)}})),n=e.input_descriptors.map(u=>{let a=[],c=u.format??e.format;for(let d of r){let{candidate:p,index:y}=d;if(c&&!N6(p.format,c))continue;let v=B6(p),x=Np(v,u);x.matched&&a.push({descriptorId:u.id,candidate:p,match:x,candidateIndex:y})}return{descriptorId:u.id,candidates:a,reason:a.length===0?q6(u,r.length,c):void 0}}),i=new Set(n.filter(u=>u.candidates.length>0).map(u=>u.descriptorId)),s=j6(e,i);return{descriptors:n,canSatisfy:s.satisfied,reason:s.satisfied?void 0:s.reason}},"selectCredentials"),x4=o((t,e,r={})=>{let n=r.makeId??M6;return{id:r.submissionId??n(),definition_id:t.id,descriptor_map:e.map(i=>{let s={id:i.descriptorId,format:i.format,path:i.path};return i.pathNested&&(s.path_nested={id:i.descriptorId,format:i.format,path:i.pathNested}),s})}},"buildPresentationSubmission"),Zf=o(t=>{if(typeof t=="string")return/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(t)?"jwt_vc_json":void 0;if(!t||typeof t!="object")return;let r=t.proof;if(r&&typeof r=="object"){if(typeof r.jwt=="string"||r.type==="JwtProof2020")return"jwt_vc_json";if(typeof r.type=="string")return"ldp_vc"}},"inferCredentialFormat"),j6=o((t,e)=>{let r=t.submission_requirements;if(!r||r.length===0){let n=t.input_descriptors.map(i=>i.id).filter(i=>!e.has(i));return n.length===0?{satisfied:!0}:{satisfied:!1,reason:n.length===1?`Input descriptor "${n[0]}" has no matching credential`:`${n.length} input descriptors have no matching credential: ${n.join(", ")}`}}for(let n of r){let i=A4(n,t,e);if(!i.satisfied)return i}return{satisfied:!0}},"evaluateSubmissionRequirements"),A4=o((t,e,r)=>{if(typeof t.from=="string"&&t.from.length>0){let n=e.input_descriptors.filter(s=>s.group?.includes(t.from));if(n.length===0)return{satisfied:!1,reason:`submission_requirement references unknown group "${t.from}"`};let i=n.filter(s=>r.has(s.id));return w4(t,i.length,n.length)}if(Array.isArray(t.from_nested)&&t.from_nested.length>0){let n=0;for(let i of t.from_nested)A4(i,e,r).satisfied&&(n+=1);return w4(t,n,t.from_nested.length)}return{satisfied:!1,reason:"submission_requirement has neither `from` nor `from_nested`"}},"evaluateRequirement"),w4=o((t,e,r)=>{let n=t.name??t.from??"<anonymous>";return t.rule==="all"?e>=r?{satisfied:!0}:{satisfied:!1,reason:`Requirement "${n}" (rule=all) needs ${r} matches, only ${e} available`}:t.rule==="pick"?typeof t.count=="number"&&e<t.count?{satisfied:!1,reason:`Requirement "${n}" (rule=pick) needs count=${t.count} matches, only ${e} available`}:typeof t.min=="number"&&e<t.min?{satisfied:!1,reason:`Requirement "${n}" (rule=pick) needs min=${t.min} matches, only ${e} available`}:t.count===void 0&&t.min===void 0&&e===0?{satisfied:!1,reason:`Requirement "${n}" (rule=pick) needs at least one match, none available`}:{satisfied:!0}:{satisfied:!1,reason:`Unknown submission_requirement rule "${t.rule}"`}},"applyRule"),N6=o((t,e)=>t?Object.prototype.hasOwnProperty.call(e,t):!1,"formatIsPermitted"),B6=o(t=>{let{credential:e,format:r}=t;if(r==="jwt_vc_json"){if(typeof e=="string"){let n=_4(e);if(n)return n}if(e&&typeof e=="object"){let n=e.proof;if(n&&typeof n=="object"){let i=n.jwt;if(typeof i=="string"){let s=_4(i);if(s)return s}}}}return e},"decodeCandidateForMatching"),_4=o(t=>{let e=t.split(".");if(e.length===3)try{return JSON.parse(D6(e[1]))}catch{return}},"decodeJwtVc"),D6=o(t=>{let r=(t+"=".repeat((4-t.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/");return typeof atob=="function"?atob(r):Buffer.from(r,"base64").toString("binary")},"base64UrlDecode"),q6=o((t,e,r)=>{if(e===0)return"You have no credentials in your wallet yet";let n=t.name??t.id;if(r){let i=Object.keys(r).join(", ");return`No credential satisfies "${n}" (required format: ${i})`}return`No credential satisfies "${n}"`},"explainNoMatches"),M6=o(()=>{let t=typeof globalThis<"u"&&"crypto"in globalThis?globalThis.crypto:void 0;if(t&&typeof t.getRandomValues=="function"){let e=new Uint8Array(8);return t.getRandomValues(e),Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}return Math.random().toString(36).slice(2,18)},"defaultMakeId");var c1=class c1 extends Error{constructor(e,r){super(r),this.name="BuildPresentationError",this.code=e}};o(c1,"BuildPresentationError");var fi=c1,Qf=o(t=>{let{pd:e,chosen:r,holder:n}=t;if(!r||r.length===0)throw new fi("no_selections","buildPresentation requires at least one chosen credential");let i=new Set(e.input_descriptors.map(p=>p.id)),s=r.map((p,y)=>{if(!i.has(p.descriptorId))throw new fi("unknown_descriptor",`Chosen credential at index ${y} references unknown descriptor "${p.descriptorId}"`);return{descriptorId:p.descriptorId,...U6(p.candidate,y)}}),u=t.envelopeFormat??V6(e,s.map(p=>p.format)),a=t.makeId??F6,c={"@context":["https://www.w3.org/2018/credentials/v1"],id:t.presentationId??`urn:uuid:${K6(a)}`,type:["VerifiablePresentation"],holder:n,verifiableCredential:s.map(p=>p.credential)},d={id:t.submissionId??a(),definition_id:e.id,descriptor_map:s.map((p,y)=>({id:p.descriptorId,format:p.format,path:W6(y,u)}))};return{unsignedVp:c,submission:d,vpFormat:u,innerFormats:s.map(p=>p.format)}},"buildPresentation"),U6=o((t,e)=>{let r=t.format??Zf(t.credential);if(!r)throw new fi("unknown_credential_format",`Chosen credential at index ${e} has no detectable format (provide candidate.format or a shape inferCredentialFormat recognizes)`);if(r==="jwt_vc_json"){let n=$6(t.credential);if(!n)throw new fi("invalid_jwt_vc",`Chosen credential at index ${e} is tagged jwt_vc_json but has no compact JWS (expected a string, or an object with string \`proof.jwt\`)`);return{credential:n,format:r}}return{credential:t.credential,format:r}},"normalizeForEmbedding"),$6=o(t=>{if(typeof t=="string")return/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(t)?t:void 0;if(t&&typeof t=="object"){let e=t.proof;if(e&&typeof e=="object"){let r=e.jwt;if(typeof r=="string")return r}}},"extractCompactJws"),V6=o((t,e)=>{let r=H6(t.format),n=L6(e);return r.has("jwt_vp_json")&&!r.has("ldp_vp")?"jwt_vp_json":r.has("ldp_vp")&&!r.has("jwt_vp_json")?"ldp_vp":(r.has("jwt_vp_json")&&r.has("ldp_vp"),n)},"inferEnvelopeFormat"),H6=o(t=>{let e=new Set;return t&&("jwt_vp_json"in t&&e.add("jwt_vp_json"),"ldp_vp"in t&&e.add("ldp_vp")),e},"vpFormatsFromDesignation"),L6=o(t=>t.length===0?"ldp_vp":t.every(r=>r==="jwt_vc_json")?"jwt_vp_json":"ldp_vp","homogeneousVpFormatFromInner"),W6=o((t,e)=>e==="jwt_vp_json"?`$.vp.verifiableCredential[${t}]`:`$.verifiableCredential[${t}]`,"pathForIndex"),F6=o(()=>{let t=typeof globalThis<"u"&&"crypto"in globalThis?globalThis.crypto:void 0;if(t&&typeof t.getRandomValues=="function"){let e=new Uint8Array(8);return t.getRandomValues(e),Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}return Math.random().toString(36).slice(2,18)},"defaultMakeId"),K6=o(t=>{let r=(t().replace(/[^0-9a-f]/gi,"")+"0".repeat(32)).slice(0,32);return[r.slice(0,8),r.slice(8,12),"4"+r.slice(13,16),(parseInt(r.charAt(16),16)&3|8).toString(16)+r.slice(17,20),r.slice(20,32)].join("-")},"makeUuidV4");var f1=class f1 extends Error{constructor(e,r,n){super(r),this.name="VpSignError",this.code=e,n?.cause!==void 0&&(this.cause=n.cause)}};o(f1,"VpSignError");var Lt=f1,di=o(async(t,e)=>(J6(t),t.vpFormat==="jwt_vp_json"?z6(t,e):G6(t,e)),"signPresentation"),J6=o(t=>{let{unsignedVp:e,holder:r,audience:n,nonce:i}=t;if(!e||typeof e!="object")throw new Lt("invalid_input","signPresentation requires an unsignedVp object");if(typeof n!="string"||n.length===0)throw new Lt("invalid_input","signPresentation requires a non-empty `audience`");if(typeof i!="string"||i.length===0)throw new Lt("invalid_input","signPresentation requires a non-empty `nonce`");if(typeof r!="string"||r.length===0)throw new Lt("invalid_input","signPresentation requires a non-empty `holder`");if(e.holder!==void 0&&e.holder!==r)throw new Lt("holder_mismatch",`unsignedVp.holder (${e.holder}) does not match options.holder (${r})`)},"validateInput"),z6=o(async(t,e)=>{if(!e.jwtSigner)throw new Lt("missing_jwt_signer","vpFormat=jwt_vp_json requires helpers.jwtSigner");let r=t.iat??Math.floor(Date.now()/1e3),n={alg:e.jwtSigner.alg,kid:e.jwtSigner.kid,typ:"JWT"},i=t.jti??(typeof t.unsignedVp.id=="string"?t.unsignedVp.id:void 0),s={iss:t.holder,sub:t.holder,aud:t.audience,nonce:t.nonce,iat:r,vp:t.unsignedVp};i&&(s.jti=i);let u;try{u=await e.jwtSigner.sign(n,s)}catch(a){throw new Lt("jwt_sign_failed",`Failed to sign jwt_vp_json: ${a instanceof Error?a.message:String(a)}`,{cause:a})}return{vpToken:u,vpFormat:"jwt_vp_json"}},"signJwtVp"),G6=o(async(t,e)=>{if(!e.ldpVpSigner)throw new Lt("missing_ldp_signer","vpFormat=ldp_vp requires helpers.ldpVpSigner");let r;try{r=await e.ldpVpSigner.sign(t.unsignedVp,{domain:t.audience,challenge:t.nonce})}catch(n){throw new Lt("ldp_sign_failed",`Failed to sign ldp_vp: ${n instanceof Error?n.message:String(n)}`,{cause:n})}return{vpToken:r,vpFormat:"ldp_vp"}},"signLdpVp");var p1=class p1 extends Error{constructor(e,r,n={}){super(r),this.name="JarmEncryptError",this.code=e,n.cause!==void 0&&(this.cause=n.cause)}};o(p1,"JarmEncryptError");var ze=p1,d1="ECDH-ES",l1="A256GCM",Dp=o(async t=>{let{payload:e,clientMetadata:r,verifierNonce:n,walletNonce:i,signer:s}=t,u=r.authorization_encrypted_response_alg??d1,a=r.authorization_encrypted_response_enc??l1,c=r.authorization_signed_response_alg,d=await X6(r,t.fetchImpl),p=Z6(d,u),y,v;if(c){if(!s)throw new ze("missing_signer",`Verifier requires authorization_signed_response_alg=${c} but no wallet signer was supplied`);let I=await Q6(e,c,s);y=new TextEncoder().encode(I),v="JWT"}else y=new TextEncoder().encode(JSON.stringify(e)),v=void 0;let x;try{x=await Xr(p,u)}catch(I){throw new ze("unsupported_alg",`Failed to import verifier encryption key (alg=${u}, kty=${p.kty}): ${Yf(I)}`,{cause:I})}let A={alg:u,enc:a};typeof p.kid=="string"&&p.kid.length>0&&(A.kid=p.kid),v&&(A.cty=v);let B={apv:new TextEncoder().encode(n)};typeof i=="string"&&i.length>0&&(B.apu=new TextEncoder().encode(i));try{return await new Ga(y).setProtectedHeader(A).setKeyManagementParameters(B).encrypt(x)}catch(I){throw new ze("encrypt_failed",`JWE encryption failed (alg=${u}, enc=${a}): ${Yf(I)}`,{cause:I})}},"encryptResponseObject"),X6=o(async(t,e)=>{if(t.jwks&&Array.isArray(t.jwks.keys))return t.jwks.keys;if(typeof t.jwks_uri=="string"&&t.jwks_uri.length>0){let r=e??globalThis.fetch;if(typeof r!="function")throw new ze("jwks_fetch_failed",`client_metadata.jwks_uri=${t.jwks_uri} but no fetch implementation is available`);let n;try{n=await r(t.jwks_uri,{headers:{Accept:"application/json"}})}catch(s){throw new ze("jwks_fetch_failed",`Failed to fetch jwks_uri=${t.jwks_uri}: ${Yf(s)}`,{cause:s})}if(!n.ok)throw new ze("jwks_fetch_failed",`jwks_uri returned HTTP ${n.status} for ${t.jwks_uri}`);let i;try{i=await n.json()}catch(s){throw new ze("invalid_jwks",`jwks_uri body was not valid JSON: ${Yf(s)}`,{cause:s})}if(!i||typeof i!="object"||!Array.isArray(i.keys))throw new ze("invalid_jwks","jwks_uri body must be a JSON object with a `keys` array");return i.keys}throw new ze("no_encryption_key","client_metadata declares neither inline `jwks` nor `jwks_uri` \u2014 verifier cannot receive encrypted responses")},"resolveVerifierJwks"),Z6=o((t,e)=>{if(t.length===0)throw new ze("no_encryption_key","Verifier JWKS contained no keys");let r=t.filter(s=>s.use!=="sig");if(r.length===0)throw new ze("no_encryption_key",'Verifier JWKS contains only `use:"sig"` keys; no encryption-capable key advertised');let n=r.find(s=>s.alg===e);if(n)return n;let i=r.find(s=>!s.alg);return i||r[0]},"pickEncryptionKey"),Q6=o(async(t,e,r)=>{try{return await r.sign({alg:e,kid:r.kid,typ:"JWT"},t)}catch(n){throw new ze("sign_failed",`Wallet signer failed during JARM inner-JWS signing: ${Yf(n)}`,{cause:n})}},"signResponse"),Yf=o(t=>t instanceof Error?t.message:String(t),"describe");var h1=class h1 extends Error{constructor(e,r,n={}){super(r),this.name="VpSubmitError",this.code=e,this.status=n.status,this.body=n.body,n.cause!==void 0&&(this.cause=n.cause)}};o(h1,"VpSubmitError");var Wt=h1,Ia=o(async t=>{let{responseUri:e,vpToken:r,submission:n,state:i}=t;if(typeof e!="string"||e.length===0)throw new Wt("invalid_input","`responseUri` must be a non-empty string");if(r==null)throw new Wt("invalid_input","`vpToken` is required");if(n!==void 0&&(n===null||typeof n!="object"))throw new Wt("invalid_input","`submission` must be a PresentationSubmission object when provided (omit it entirely for DCQL flows)");let s=t.fetchImpl??globalThis.fetch;if(typeof s!="function")throw new Wt("no_fetch","No fetch implementation available; pass `fetchImpl` or configure the plugin with one");let a=t.responseMode==="direct_post.jwt"?await tP({vpToken:r,submission:n,state:i,idToken:t.idToken,clientMetadata:t.clientMetadata,nonce:t.nonce,signer:t.signer,fetchImpl:s}):Y6({vpToken:r,submission:n,state:i,idToken:t.idToken}),c;try{c=await s(e,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json, text/plain;q=0.9, */*;q=0.8"},body:a})}catch(p){throw new Wt("network_error",`Failed to POST to ${e}: ${p instanceof Error?p.message:String(p)}`,{cause:p})}let d=await rP(c);if(!c.ok)throw new Wt("server_error",`Verifier returned ${c.status} ${c.statusText||""}`.trim(),{status:c.status,body:d});return{status:c.status,redirectUri:nP(d),body:d}},"submitPresentation"),Y6=o(t=>{let e=new URLSearchParams;return e.set("vp_token",eP(t.vpToken)),t.submission&&e.set("presentation_submission",JSON.stringify(t.submission)),typeof t.idToken=="string"&&t.idToken.length>0&&e.set("id_token",t.idToken),typeof t.state=="string"&&t.state.length>0&&e.set("state",t.state),e.toString()},"encodeFormBody"),eP=o(t=>typeof t=="string"?t:JSON.stringify(t),"stringifyVpToken"),tP=o(async t=>{if(!t.clientMetadata)throw new Wt("invalid_input","response_mode=direct_post.jwt requires `clientMetadata` (verifier's JWKS + JWE algs)");if(typeof t.nonce!="string"||t.nonce.length===0)throw new Wt("invalid_input","response_mode=direct_post.jwt requires the verifier `nonce` for the JWE `apv` ECDH-ES KDF input");let e={vp_token:t.vpToken};t.submission&&(e.presentation_submission=t.submission),typeof t.state=="string"&&t.state.length>0&&(e.state=t.state),typeof t.idToken=="string"&&t.idToken.length>0&&(e.id_token=t.idToken);let r;try{r=await Dp({payload:e,clientMetadata:t.clientMetadata,verifierNonce:t.nonce,signer:t.signer,fetchImpl:t.fetchImpl})}catch(i){throw i instanceof ze?new Wt("jarm_encrypt_failed",`Failed to build JARM response (${i.code}): ${i.message}`,{cause:i}):i}let n=new URLSearchParams;return n.set("response",r),n.toString()},"encodeJarmBody"),rP=o(async t=>{let e=await t.text().catch(()=>"");if(!e)return;if((t.headers.get("content-type")??"").includes("application/json"))try{return JSON.parse(e)}catch{return e}try{return JSON.parse(e)}catch{return e}},"parseResponseBody"),nP=o(t=>{if(t&&typeof t=="object"){let e=t.redirect_uri;if(typeof e=="string"&&e.length>0)return e}},"extractRedirectUri");var m1=class m1 extends Error{constructor(e,r,n){super(r),this.name="SiopSignError",this.code=e,n?.cause!==void 0&&(this.cause=n.cause)}};o(m1,"SiopSignError");var An=m1,ed=o(async(t,e)=>{iP(t,e);let{holder:r,audience:n,nonce:i}=t,s=t.iat??Math.floor(Date.now()/1e3),u=s+(t.lifetimeSeconds??300),a=t.issuerMode??"did",c={alg:e.signer.alg,kid:e.signer.kid,typ:"JWT"},d={iss:a==="did"?r:"https://self-issued.me/v2",sub:r,aud:n,nonce:i,iat:s,exp:u};t.vpTokenHash&&(d._vp_token={vp_token_hash:t.vpTokenHash});let p;try{p=await e.signer.sign(c,d)}catch(y){throw new An("id_token_sign_failed",`Failed to sign SIOPv2 id_token: ${y instanceof Error?y.message:String(y)}`,{cause:y})}return{idToken:p}},"signIdToken"),iP=o((t,e)=>{if(!e.signer)throw new An("missing_signer","signIdToken requires helpers.signer");if(typeof t.holder!="string"||t.holder.length===0)throw new An("invalid_input","signIdToken requires a non-empty `holder`");if(typeof t.audience!="string"||t.audience.length===0)throw new An("invalid_input","signIdToken requires a non-empty `audience`");if(typeof t.nonce!="string"||t.nonce.length===0)throw new An("invalid_input","signIdToken requires a non-empty `nonce`")},"validateInput"),y1=o(t=>t?new Set(t.split(/\s+/).filter(Boolean)):new Set,"responseTypeSet"),qp=o(t=>y1(t).has("id_token"),"requiresIdToken");var g1=o(t=>{let e=t.format??uP(t.credential);if(e==="jwt_vc_json")return oP(t.credential);if(e==="ldp_vc")return sP(t.credential)},"adaptCredentialForDcql"),Mp=o(t=>{let e=[];for(let r of t){let n=g1(r);n&&e.push({original:r,adapted:n})}return e},"adaptCredentialsForDcql"),oP=o(t=>{let e;if(typeof t=="string")e=S4(t);else if(t&&typeof t=="object"){let s=t.proof;if(s&&typeof s=="object"){let u=s.jwt;typeof u=="string"&&(e=S4(u))}}if(!e)return;let r=e.vc;if(!r||typeof r!="object"||Array.isArray(r))return;let n=r,i=k4(n.type);if(i.length!==0)return{credential_format:"jwt_vc_json",type:i,claims:n,cryptographic_holder_binding:!0}},"adaptJwtVc"),sP=o(t=>{if(!t||typeof t!="object"||Array.isArray(t))return;let e=t,r=k4(e.type);if(r.length!==0)return{credential_format:"ldp_vc",type:r,claims:e,cryptographic_holder_binding:!0}},"adaptLdpVc"),k4=o(t=>Array.isArray(t)?t.filter(e=>typeof e=="string"):typeof t=="string"?[t]:[],"extractTypes"),uP=o(t=>{if(typeof t=="string")return/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(t)?"jwt_vc_json":void 0;if(t&&typeof t=="object"&&!Array.isArray(t)){let e=t.proof;if(e&&typeof e=="object")return e.type==="JwtProof2020"?"jwt_vc_json":"ldp_vc"}},"inferDcqlFormat"),S4=o(t=>{let e=t.split(".");if(e.length===3)try{let r=JSON.parse(aP(e[1]));return r&&typeof r=="object"&&!Array.isArray(r)?r:void 0}catch{return}},"decodeJwtPayload"),aP=o(t=>{let r=(t+"=".repeat((4-t.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/");return typeof atob=="function"?atob(r):Buffer.from(r,"base64").toString("binary")},"base64UrlDecode");var Up=o((t,e)=>{let r=Mp(t),n=r.map(u=>u.adapted),i=mo.query(e,n),s={};for(let[u,a]of Object.entries(i.credential_matches)){if(a.success){let c=a.valid_credentials.map(d=>r[d.input_credential_index]?.original).filter(d=>d!==void 0);s[u]={credentialQueryId:u,candidates:c};continue}s[u]={credentialQueryId:u,candidates:[],reason:`No held credential satisfies query "${u}"`}}return{canSatisfy:i.can_be_satisfied,matches:s,reason:i.can_be_satisfied?void 0:"No combination of held credentials satisfies the verifier's DCQL query",raw:i}},"selectCredentialsForDcql");var v1=class v1 extends Error{constructor(e,r){super(r),this.name="BuildDcqlPresentationError",this.code=e}};o(v1,"BuildDcqlPresentationError");var Sn=v1,$p=o(t=>{let{query:e,chosen:r,holder:n}=t;if(r.length===0)throw new Sn("no_selections","buildDcqlPresentations requires at least one chosen credential");let i=t.makeId??lP,s=new Map;for(let c of r){let d=s.get(c.credentialQueryId);d?d.push(c.candidate):s.set(c.credentialQueryId,[c.candidate])}let u=new Map;for(let c of e.credentials)u.set(c.id,c);let a=[];for(let c of e.credentials){let d=s.get(c.id);d&&(a.push(cP(c,d,n,i)),s.delete(c.id))}if(s.size>0){let c=Array.from(s.keys()).join(", ");throw new Sn("unknown_credential_query",`chosen credentials reference query ids the DCQL query doesn't declare: ${c}`)}return a},"buildDcqlPresentations"),cP=o((t,e,r,n)=>{let i=fP(t.format,t.id),s=e.map((a,c)=>dP(a,t.id,c)),u={"@context":["https://www.w3.org/2018/credentials/v1"],id:`urn:uuid:${pP(n)}`,type:["VerifiablePresentation"],holder:r,verifiableCredential:s};return{credentialQueryId:t.id,unsignedVp:u,vpFormat:i,candidates:e}},"buildOnePresentation"),fP=o((t,e)=>{if(t==="jwt_vc_json")return"jwt_vp_json";if(t==="ldp_vc")return"ldp_vp";throw new Sn("unsupported_format",`DCQL query "${e}" requests format "${t}", which the plugin doesn't yet build presentations for (sd-jwt-vc and mso_mdoc are tracked for follow-up slices)`)},"vpFormatForQueryFormat"),dP=o((t,e,r)=>{let n=t.credential;if(typeof n=="string"){if(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(n))return n;throw new Sn("invalid_jwt_vc",`chosen candidate at index ${r} for query "${e}" is a string but not a compact JWS`)}if(n&&typeof n=="object"){let i=n.proof;if(i&&typeof i=="object"){let s=i.jwt;if(typeof s=="string")return s}return n}throw new Sn("invalid_jwt_vc",`chosen candidate at index ${r} for query "${e}" is neither a JWT string nor a JSON object`)},"normalizeForEmbedding"),lP=o(()=>{let t=typeof globalThis<"u"&&"crypto"in globalThis?globalThis.crypto:void 0;if(t&&typeof t.getRandomValues=="function"){let e=new Uint8Array(8);return t.getRandomValues(e),Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}return Math.random().toString(36).slice(2,18)},"defaultMakeId"),pP=o(t=>{let r=(t().replace(/[^0-9a-f]/gi,"")+"0".repeat(32)).slice(0,32);return[r.slice(0,8),r.slice(8,12),"4"+r.slice(13,16),(parseInt(r.slice(16,17),16)&3|8).toString(16)+r.slice(17,20),r.slice(20,32)].join("-")},"makeUuidV4");var b1=o(async(t,e)=>{let r=[];for(let n of t.built){let i=await di({unsignedVp:n.unsignedVp,vpFormat:n.vpFormat,audience:t.audience,nonce:t.nonce,holder:t.holder,iat:t.iat},e);r.push({credentialQueryId:n.credentialQueryId,vpToken:i.vpToken,vpFormat:n.vpFormat})}return r},"signDcqlPresentations"),Vp=o(async(t,e)=>{let r=await b1(t,e);return{vpToken:w1(r),presentations:r}},"buildDcqlResponse"),w1=o(t=>{let e={};for(let r of t)e[r.credentialQueryId]=r.vpToken;return e},"assembleDcqlVpToken");var E4=o((t,e={})=>{let r=e.fetch??globalThis.fetch,n={didResolver:e.didResolver,trustedX509Roots:e.trustedX509Roots,unsafeAllowSelfSigned:e.unsafeAllowSelfSignedRequestObject,unsafeSkipRequestObjectSignatureVerification:e.unsafeSkipRequestObjectSignatureVerification},i=o(async s=>{let u=id(s);if(u.kind==="by_value")return u.offer;if(typeof r!="function")throw new ge("invalid_uri","No fetch implementation available; pass `config.fetch` to getOpenID4VCPlugin()");let a=await Kp(u.uri,r);if(a.kind!=="by_value")throw new ge("invalid_uri","Unexpected by_reference result after resolving credential_offer_uri");return a.offer},"resolveOffer");return{name:"OpenID4VC",displayName:"OpenID4VC",description:"OpenID for Verifiable Credentials holder support \u2014 Credential Offers, VCI, VP, and SIOPv2.",methods:{parseCredentialOffer:o((s,u)=>id(u),"parseCredentialOffer"),resolveCredentialOffer:o(async(s,u)=>i(u),"resolveCredentialOffer"),acceptCredentialOffer:o(async(s,u,a={})=>{let c=typeof u=="string"?await i(u):u,d=await S1(s,a);return _d({offer:c,signer:d,options:a,fetchImpl:r})},"acceptCredentialOffer"),acceptAndStoreCredentialOffer:o(async(s,u,a={})=>{let c=await(async()=>{let p=typeof u=="string"?await i(u):u,y=await S1(s,a);return _d({offer:p,signer:y,options:a,fetchImpl:r})})(),d=await Hh(s,c,mP(a));return{...c,...d}},"acceptAndStoreCredentialOffer"),beginCredentialOfferAuthCode:o(async(s,u,a)=>{let c=typeof u=="string"?await i(u):u;return Uh({offer:c,redirectUri:a.redirectUri,clientId:a.clientId,configurationIds:a.configurationIds,scope:a.scope,fetchImpl:r})},"beginCredentialOfferAuthCode"),completeCredentialOfferAuthCode:o(async(s,u)=>{let a=u.signer??await S1(s,{});return $h({flowHandle:u.flowHandle,code:u.code,state:u.state,signer:a,fetchImpl:r})},"completeCredentialOfferAuthCode"),parseAuthorizationRequest:o((s,u)=>Lf(u),"parseAuthorizationRequest"),resolveAuthorizationRequest:o(async(s,u)=>Wf(u,r,n),"resolveAuthorizationRequest"),prepareVerifiablePresentation:o(async(s,u,a)=>{let c=await Oa(u,r,n);if(c.dcql_query){let d=Up(a,c.dcql_query);return{request:c,dcqlSelection:d}}if(c.presentation_definition){let d=Bp(a,c.presentation_definition);return{request:c,selection:d}}return{request:c,selection:{descriptors:[],canSatisfy:!0,reason:void 0}}},"prepareVerifiablePresentation"),buildPresentation:o(async(s,u,a,c={})=>{let d=await Oa(u,r,n),p=C4(d),y=c.holder??s.id.did(),v=Qf({pd:p,chosen:a,holder:y,envelopeFormat:c.envelopeFormat});return{request:d,prepared:v}},"buildPresentation"),signPresentation:o(async(s,u,a,c={})=>{let d=await Oa(u,r,n),p=c.holder??(typeof a.unsignedVp.holder=="string"?a.unsignedVp.holder:s.id.did());if(a.vpFormat==="jwt_vp_json"){let y=c.signer??await Hp(s);return di({unsignedVp:a.unsignedVp,vpFormat:a.vpFormat,audience:d.client_id,nonce:d.nonce,holder:p},{jwtSigner:y})}return di({unsignedVp:a.unsignedVp,vpFormat:a.vpFormat,audience:d.client_id,nonce:d.nonce,holder:p},{ldpVpSigner:A1(s)})},"signPresentation"),submitPresentation:o(async(s,u,a,c,d={})=>{let p=await Oa(u,r,n),y=p.response_uri??p.redirect_uri;if(!y)throw new Error("Authorization Request has no response_uri / redirect_uri \u2014 cannot submitPresentation");return Ia({responseUri:y,vpToken:a.vpToken,submission:c,idToken:d.idToken,state:p.state,fetchImpl:r,..._1(p,await x1(s,p))})},"submitPresentation"),signIdToken:o(async(s,u,a={})=>{let c=await Oa(u,r,n),d=a.holder??s.id.did(),p=a.signer??await Hp(s);return ed({holder:d,audience:c.client_id,nonce:c.nonce,lifetimeSeconds:a.lifetimeSeconds,issuerMode:a.issuerMode,vpTokenHash:a.vpTokenHash},{signer:p})},"signIdToken"),presentCredentials:o(async(s,u,a,c={})=>{let d=await Oa(u,r,n),p=c.holder??s.id.did(),y=c.signer,v=o(async()=>(y||(y=await Hp(s)),y),"ensureSharedJwtSigner"),x=o(async()=>{if(qp(d.response_type))return ed({holder:p,audience:d.client_id,nonce:d.nonce},{signer:await v()})},"signIdTokenIfRequested"),A=d.response_uri??d.redirect_uri;if(!A)throw new Error("Authorization Request has no response_uri / redirect_uri \u2014 cannot presentCredentials");if(d.dcql_query){let ye=yP(a),ae=$p({query:d.dcql_query,chosen:ye,holder:p}),Ne=ae.some(ct=>ct.vpFormat==="jwt_vp_json"),xt=ae.some(ct=>ct.vpFormat==="ldp_vp"),at={...Ne?{jwtSigner:await v()}:{},...xt?{ldpVpSigner:A1(s)}:{}},Bt=await Vp({built:ae,audience:d.client_id,nonce:d.nonce,holder:p},at),_r=await x(),Fr=await Ia({responseUri:A,vpToken:Bt.vpToken,idToken:_r?.idToken,state:d.state,fetchImpl:r,..._1(d,await x1(s,d))});return{request:d,dcqlBuilt:ae,dcqlSigned:Bt.presentations,dcqlVpToken:Bt.vpToken,signedIdToken:_r,submitted:Fr}}let B=C4(d),I=hP(a),J=Qf({pd:B,chosen:I,holder:p,envelopeFormat:c.envelopeFormat}),de=J.vpFormat==="jwt_vp_json"?{jwtSigner:await v()}:{ldpVpSigner:A1(s)},fe=await di({unsignedVp:J.unsignedVp,vpFormat:J.vpFormat,audience:d.client_id,nonce:d.nonce,holder:p},de),ve=await x(),Y=await Ia({responseUri:A,vpToken:fe.vpToken,submission:J.submission,idToken:ve?.idToken,state:d.state,fetchImpl:r,..._1(d,await x1(s,d))});return{request:d,prepared:J,signed:fe,signedIdToken:ve,submitted:Y}},"presentCredentials")}}},"getOpenID4VCPlugin"),Oa=o(async(t,e,r)=>typeof t=="string"?await Wf(t,e,r):t,"resolveRequestInput"),C4=o(t=>{if(!t.presentation_definition)throw new Error("Authorization Request has no presentation_definition \u2014 cannot build a VP");return t.presentation_definition},"requirePresentationDefinition"),hP=o(t=>{for(let[e,r]of t.entries())if(!("descriptorId"in r)||typeof r.descriptorId!="string")throw new Error(`chosen[${e}] is missing 'descriptorId' \u2014 PEX requests need ChosenCredential entries (received DCQL-shape entry with credentialQueryId="${r.credentialQueryId}")`);return t},"assertPexChosen"),yP=o(t=>{for(let[e,r]of t.entries())if(!("credentialQueryId"in r)||typeof r.credentialQueryId!="string")throw new Error(`chosen[${e}] is missing 'credentialQueryId' \u2014 DCQL requests need DcqlChosenCredential entries (received PEX-shape entry with descriptorId="${r.descriptorId}")`);return t},"assertDcqlChosen"),_1=o((t,e)=>t.response_mode!=="direct_post.jwt"?{}:{responseMode:"direct_post.jwt",clientMetadata:t.client_metadata,nonce:t.nonce,signer:e},"buildJarmOptions"),x1=o(async(t,e)=>{if(e.response_mode!=="direct_post.jwt")return;let r=e.client_metadata?.authorization_signed_response_alg;if(!(typeof r!="string"||r.length===0))return Hp(t)},"maybeJarmSigner"),Hp=o(async t=>{let e=P4(t,"VP signing"),r=t.id.did(),n=await t.invoke.didToVerificationMethod(r);return wd({keypair:e,kid:n})},"ensureVpJwtSigner"),A1=o(t=>({sign:o(async(e,{domain:r,challenge:n})=>t.invoke.issuePresentation(e,{domain:r,challenge:n}),"sign")}),"buildLdpVpSigner"),S1=o(async(t,e)=>{if(e.signer)return e.signer;let r=P4(t,"VCI proof-of-possession"),n=t.id.did(),i=await t.invoke.didToVerificationMethod(n);return wd({keypair:r,kid:i})},"ensureSigner"),P4=o((t,e)=>{let r;try{r=t.id.keypair("ed25519")}catch(n){throw new Error(`OpenID4VC ${e} requires an Ed25519 keypair on the host LearnCard, but \`id.keypair('ed25519')\` threw: ${n instanceof Error?n.message:String(n)}. Pass \`options.signer\` to bring your own signer (HSM / secp256k1 / external backend).`)}if(!r||r.kty!=="OKP"||r.crv!=="Ed25519")throw new Error(`OpenID4VC ${e} requires an Ed25519 keypair, but the host LearnCard returned ${r?`kty=${r.kty} crv=${r.crv??"<none>"}`:"no keypair"}. Pass \`options.signer\` to bring your own signer (HSM / secp256k1 / external backend).`);return r},"requireEd25519Keypair"),mP=o(t=>({storage:t.storage,encrypt:t.encrypt,category:t.category,title:t.title,imgUrl:t.imgUrl,upload:t.upload,addToIndex:t.addToIndex,makeId:t.makeId}),"splitStoreOptions");var k1=o(t=>ai(t),"buildDcqlQuery"),T4=o(t=>{let e=t.format??"jwt_vc_json";if(t.types.length===0)throw new Error("requestW3cVc: `types` must contain at least one type string");let r={id:t.id,format:e,meta:{type_values:[Array.from(t.types)]}};return t.claims&&t.claims.length>0&&(r.claims=t.claims.map(n=>{let i={path:Array.from(n.path)};return n.values&&n.values.length>0&&(i.values=Array.from(n.values)),n.id&&(i.id=n.id),i})),t.requireHolderBinding===!1&&(r.require_cryptographic_holder_binding=!1),k1({credentials:[r]})},"requestW3cVc");
25
+ /*! Bundled license information:
26
+
27
+ reflect-metadata/Reflect.js:
28
+ (*! *****************************************************************************
29
+ Copyright (C) Microsoft. All rights reserved.
30
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
31
+ this file except in compliance with the License. You may obtain a copy of the
32
+ License at http://www.apache.org/licenses/LICENSE-2.0
33
+
34
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
35
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
36
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
37
+ MERCHANTABLITY OR NON-INFRINGEMENT.
38
+
39
+ See the Apache Version 2.0 License for specific language governing permissions
40
+ and limitations under the License.
41
+ ***************************************************************************** *)
42
+
43
+ pvtsutils/build/index.js:
44
+ (*!
45
+ * MIT License
46
+ *
47
+ * Copyright (c) 2017-2024 Peculiar Ventures, LLC
48
+ *
49
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
50
+ * of this software and associated documentation files (the "Software"), to deal
51
+ * in the Software without restriction, including without limitation the rights
52
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
53
+ * copies of the Software, and to permit persons to whom the Software is
54
+ * furnished to do so, subject to the following conditions:
55
+ *
56
+ * The above copyright notice and this permission notice shall be included in all
57
+ * copies or substantial portions of the Software.
58
+ *
59
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
60
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
61
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
62
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
63
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
64
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
65
+ * SOFTWARE.
66
+ *
67
+ *)
68
+
69
+ asn1js/build/index.es.js:
70
+ (*!
71
+ * Copyright (c) 2014, GMO GlobalSign
72
+ * Copyright (c) 2015-2022, Peculiar Ventures
73
+ * All rights reserved.
74
+ *
75
+ * Author 2014-2019, Yury Strozhevsky
76
+ *
77
+ * Redistribution and use in source and binary forms, with or without modification,
78
+ * are permitted provided that the following conditions are met:
79
+ *
80
+ * * Redistributions of source code must retain the above copyright notice, this
81
+ * list of conditions and the following disclaimer.
82
+ *
83
+ * * Redistributions in binary form must reproduce the above copyright notice, this
84
+ * list of conditions and the following disclaimer in the documentation and/or
85
+ * other materials provided with the distribution.
86
+ *
87
+ * * Neither the name of the copyright holder nor the names of its
88
+ * contributors may be used to endorse or promote products derived from
89
+ * this software without specific prior written permission.
90
+ *
91
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
92
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
93
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
94
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
95
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
96
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
97
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
98
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
99
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
100
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
101
+ *
102
+ *)
103
+
104
+ tslib/tslib.es6.js:
105
+ (*! *****************************************************************************
106
+ Copyright (c) Microsoft Corporation.
107
+
108
+ Permission to use, copy, modify, and/or distribute this software for any
109
+ purpose with or without fee is hereby granted.
110
+
111
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
112
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
113
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
114
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
115
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
116
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
117
+ PERFORMANCE OF THIS SOFTWARE.
118
+ ***************************************************************************** *)
119
+
120
+ @peculiar/x509/build/x509.es.js:
121
+ (*!
122
+ * MIT License
123
+ *
124
+ * Copyright (c) Peculiar Ventures. All rights reserved.
125
+ *
126
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
127
+ * of this software and associated documentation files (the "Software"), to deal
128
+ * in the Software without restriction, including without limitation the rights
129
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
130
+ * copies of the Software, and to permit persons to whom the Software is
131
+ * furnished to do so, subject to the following conditions:
132
+ *
133
+ * The above copyright notice and this permission notice shall be included in all
134
+ * copies or substantial portions of the Software.
135
+ *
136
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
137
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
138
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
139
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
140
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
141
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
142
+ * SOFTWARE.
143
+ *
144
+ *)
145
+ */
146
+ //# sourceMappingURL=openid4vc-plugin.cjs.production.min.js.map