@kong-ui-public/entities-certificates 3.8.28-pr.2132.c7fba69a4.0 → 3.8.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entities-certificates.es.js +11066 -0
- package/dist/entities-certificates.umd.js +117 -0
- package/dist/style.css +1 -0
- package/dist/types/ca-certificates-endpoints.d.ts +20 -0
- package/dist/types/ca-certificates-endpoints.d.ts.map +1 -0
- package/dist/types/certificates-endpoints.d.ts +20 -0
- package/dist/types/certificates-endpoints.d.ts.map +1 -0
- package/dist/types/components/CACertificateConfigCard.vue.d.ts +62 -0
- package/dist/types/components/CACertificateConfigCard.vue.d.ts.map +1 -0
- package/dist/types/components/CACertificateForm.vue.d.ts +43 -0
- package/dist/types/components/CACertificateForm.vue.d.ts.map +1 -0
- package/dist/types/components/CACertificateList.vue.d.ts +123 -0
- package/dist/types/components/CACertificateList.vue.d.ts.map +1 -0
- package/dist/types/components/CertificateConfigCard.vue.d.ts +62 -0
- package/dist/types/components/CertificateConfigCard.vue.d.ts.map +1 -0
- package/dist/types/components/CertificateForm.vue.d.ts +56 -0
- package/dist/types/components/CertificateForm.vue.d.ts.map +1 -0
- package/dist/types/components/CertificateFormSniField.vue.d.ts +42 -0
- package/dist/types/components/CertificateFormSniField.vue.d.ts.map +1 -0
- package/dist/types/components/CertificateList.vue.d.ts +137 -0
- package/dist/types/components/CertificateList.vue.d.ts.map +1 -0
- package/dist/types/composables/index.d.ts +10 -0
- package/dist/types/composables/index.d.ts.map +1 -0
- package/dist/types/composables/useCertificate.d.ts +16 -0
- package/dist/types/composables/useCertificate.d.ts.map +1 -0
- package/dist/types/composables/useI18n.d.ts +9 -0
- package/dist/types/composables/useI18n.d.ts.map +1 -0
- package/dist/types/composables/x509Helper.d.ts +5 -0
- package/dist/types/composables/x509Helper.d.ts.map +1 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/types/certificate-config-card.d.ts +33 -0
- package/dist/types/types/certificate-config-card.d.ts.map +1 -0
- package/dist/types/types/certificate-form.d.ts +46 -0
- package/dist/types/types/certificate-form.d.ts.map +1 -0
- package/dist/types/types/certificate-list.d.ts +33 -0
- package/dist/types/types/certificate-list.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/x509.d.ts +8 -0
- package/dist/types/types/x509.d.ts.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
(function(xe,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("vue"),require("@kong-ui-public/entities-shared"),require("vue-router"),require("@kong/icons"),require("@kong-ui-public/i18n")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/entities-shared","vue-router","@kong/icons","@kong-ui-public/i18n"],o):(xe=typeof globalThis<"u"?globalThis:xe||self,o(xe["kong-ui-public-entities-certificates"]={},xe.Vue,xe["kong-ui-public-entities-shared"],xe.VueRouter,xe.KongIcons,xe["kong-ui-public-i18n"]))})(this,function(xe,o,N,hi,tt,Sa){"use strict";const Zu="#d60027",Aa="#00abd2",ka="24px";var eo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/*! *****************************************************************************
|
|
2
|
+
Copyright (C) Microsoft. All rights reserved.
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
4
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
5
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
8
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
9
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
10
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
11
|
+
|
|
12
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
13
|
+
and limitations under the License.
|
|
14
|
+
***************************************************************************** */var Ca;(function(r){(function(e){var t=typeof globalThis=="object"?globalThis:typeof eo=="object"?eo:typeof self=="object"?self:typeof this=="object"?this:u(),i=n(r);typeof t.Reflect<"u"&&(i=n(t.Reflect,i)),e(i,t),typeof t.Reflect>"u"&&(t.Reflect=r);function n(f,p){return function(b,y){Object.defineProperty(f,b,{configurable:!0,writable:!0,value:y}),p&&p(b,y)}}function s(){try{return Function("return this;")()}catch{}}function c(){try{return(0,eval)("(function() { return this; })()")}catch{}}function u(){return s()||c()}})(function(e,t){var i=Object.prototype.hasOwnProperty,n=typeof Symbol=="function",s=n&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",c=n&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",u=typeof Object.create=="function",f={__proto__:[]}instanceof Array,p=!u&&!f,b={create:u?function(){return wa(Object.create(null))}:f?function(){return wa({__proto__:null})}:function(){return wa({})},has:p?function(m,v){return i.call(m,v)}:function(m,v){return v in m},get:p?function(m,v){return i.call(m,v)?m[v]:void 0}:function(m,v){return m[v]}},y=Object.getPrototypeOf(Function),q=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:Vp(),O=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:_p(),d=typeof WeakMap=="function"?WeakMap:jp(),g=n?Symbol.for("@reflect-metadata:registry"):void 0,S=Np(),w=Op(S);function E(m,v,A,V){if(z(A)){if(!$e(m))throw new TypeError;if(!Ce(v))throw new TypeError;return ut(m,v)}else{if(!$e(m))throw new TypeError;if(!le(v))throw new TypeError;if(!le(V)&&!z(V)&&!dt(V))throw new TypeError;return dt(V)&&(V=void 0),A=Q(A),fe(m,v,A,V)}}e("decorate",E);function k(m,v){function A(V,K){if(!le(V))throw new TypeError;if(!z(K)&&!G(K))throw new TypeError;rr(m,v,V,K)}return A}e("metadata",k);function I(m,v,A,V){if(!le(A))throw new TypeError;return z(V)||(V=Q(V)),rr(m,v,A,V)}e("defineMetadata",I);function W(m,v,A){if(!le(v))throw new TypeError;return z(A)||(A=Q(A)),pe(m,v,A)}e("hasMetadata",W);function se(m,v,A){if(!le(v))throw new TypeError;return z(A)||(A=Q(A)),Ee(m,v,A)}e("hasOwnMetadata",se);function M(m,v,A){if(!le(v))throw new TypeError;return z(A)||(A=Q(A)),ee(m,v,A)}e("getMetadata",M);function C(m,v,A){if(!le(v))throw new TypeError;return z(A)||(A=Q(A)),ft(m,v,A)}e("getOwnMetadata",C);function T(m,v){if(!le(m))throw new TypeError;return z(v)||(v=Q(v)),Tr(m,v)}e("getMetadataKeys",T);function me(m,v){if(!le(m))throw new TypeError;return z(v)||(v=Q(v)),Pt(m,v)}e("getOwnMetadataKeys",me);function ae(m,v,A){if(!le(v))throw new TypeError;if(z(A)||(A=Q(A)),!le(v))throw new TypeError;z(A)||(A=Q(A));var V=pi(v,A,!1);return z(V)?!1:V.OrdinaryDeleteMetadata(m,v,A)}e("deleteMetadata",ae);function ut(m,v){for(var A=m.length-1;A>=0;--A){var V=m[A],K=V(v);if(!z(K)&&!dt(K)){if(!Ce(K))throw new TypeError;v=K}}return v}function fe(m,v,A,V){for(var K=m.length-1;K>=0;--K){var we=m[K],be=we(v,A,V);if(!z(be)&&!dt(be)){if(!le(be))throw new TypeError;V=be}}return V}function pe(m,v,A){var V=Ee(m,v,A);if(V)return!0;var K=va(v);return dt(K)?!1:pe(m,K,A)}function Ee(m,v,A){var V=pi(v,A,!1);return z(V)?!1:D(V.OrdinaryHasOwnMetadata(m,v,A))}function ee(m,v,A){var V=Ee(m,v,A);if(V)return ft(m,v,A);var K=va(v);if(!dt(K))return ee(m,K,A)}function ft(m,v,A){var V=pi(v,A,!1);if(!z(V))return V.OrdinaryGetOwnMetadata(m,v,A)}function rr(m,v,A,V){var K=pi(A,V,!0);K.OrdinaryDefineOwnMetadata(m,v,A,V)}function Tr(m,v){var A=Pt(m,v),V=va(m);if(V===null)return A;var K=Tr(V,v);if(K.length<=0)return A;if(A.length<=0)return K;for(var we=new O,be=[],te=0,P=A;te<P.length;te++){var U=P[te],H=we.has(U);H||(we.add(U),be.push(U))}for(var F=0,re=K;F<re.length;F++){var U=re[F],H=we.has(U);H||(we.add(U),be.push(U))}return be}function Pt(m,v){var A=pi(m,v,!1);return A?A.OrdinaryOwnMetadataKeys(m,v):[]}function Ct(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}}function z(m){return m===void 0}function dt(m){return m===null}function di(m){return typeof m=="symbol"}function le(m){return typeof m=="object"?m!==null:typeof m=="function"}function Rt(m,v){switch(Ct(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 A="string",V=Xn(m,s);if(V!==void 0){var K=V.call(m,A);if(le(K))throw new TypeError;return K}return Z(m)}function Z(m,v){var A,V;{var K=m.toString;if(Y(K)){var V=K.call(m);if(!le(V))return V}var A=m.valueOf;if(Y(A)){var V=A.call(m);if(!le(V))return V}}throw new TypeError}function D(m){return!!m}function J(m){return""+m}function Q(m){var v=Rt(m);return di(v)?v:J(v)}function $e(m){return Array.isArray?Array.isArray(m):m instanceof Object?m instanceof Array:Object.prototype.toString.call(m)==="[object Array]"}function Y(m){return typeof m=="function"}function Ce(m){return typeof m=="function"}function G(m){switch(Ct(m)){case 3:return!0;case 4:return!0;default:return!1}}function ve(m,v){return m===v||m!==m&&v!==v}function Xn(m,v){var A=m[v];if(A!=null){if(!Y(A))throw new TypeError;return A}}function qu(m){var v=Xn(m,c);if(!Y(v))throw new TypeError;var A=v.call(m);if(!le(A))throw new TypeError;return A}function Ku(m){return m.value}function zu(m){var v=m.next();return v.done?!1:v}function Gu(m){var v=m.return;v&&v.call(m)}function va(m){var v=Object.getPrototypeOf(m);if(typeof m!="function"||m===y||v!==y)return v;var A=m.prototype,V=A&&Object.getPrototypeOf(A);if(V==null||V===Object.prototype)return v;var K=V.constructor;return typeof K!="function"||K===m?v:K}function Ip(){var m;!z(g)&&typeof t.Reflect<"u"&&!(g in t.Reflect)&&typeof t.Reflect.defineMetadata=="function"&&(m=Tp(t.Reflect));var v,A,V,K=new d,we={registerProvider:be,getProvider:P,setProvider:H};return we;function be(F){if(!Object.isExtensible(we))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case m===F:break;case z(v):v=F;break;case v===F:break;case z(A):A=F;break;case A===F:break;default:V===void 0&&(V=new O),V.add(F);break}}function te(F,re){if(!z(v)){if(v.isProviderFor(F,re))return v;if(!z(A)){if(A.isProviderFor(F,re))return v;if(!z(V))for(var ue=qu(V);;){var he=zu(ue);if(!he)return;var et=Ku(he);if(et.isProviderFor(F,re))return Gu(ue),et}}}if(!z(m)&&m.isProviderFor(F,re))return m}function P(F,re){var ue=K.get(F),he;return z(ue)||(he=ue.get(re)),z(he)&&(he=te(F,re),z(he)||(z(ue)&&(ue=new q,K.set(F,ue)),ue.set(re,he))),he}function U(F){if(z(F))throw new TypeError;return v===F||A===F||!z(V)&&V.has(F)}function H(F,re,ue){if(!U(ue))throw new Error("Metadata provider not registered.");var he=P(F,re);if(he!==ue){if(!z(he))return!1;var et=K.get(F);z(et)&&(et=new q,K.set(F,et)),et.set(re,ue)}return!0}}function Np(){var m;return!z(g)&&le(t.Reflect)&&Object.isExtensible(t.Reflect)&&(m=t.Reflect[g]),z(m)&&(m=Ip()),!z(g)&&le(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,g,{enumerable:!1,configurable:!1,writable:!1,value:m}),m}function Op(m){var v=new d,A={isProviderFor:function(U,H){var F=v.get(U);return z(F)?!1:F.has(H)},OrdinaryDefineOwnMetadata:be,OrdinaryHasOwnMetadata:K,OrdinaryGetOwnMetadata:we,OrdinaryOwnMetadataKeys:te,OrdinaryDeleteMetadata:P};return S.registerProvider(A),A;function V(U,H,F){var re=v.get(U),ue=!1;if(z(re)){if(!F)return;re=new q,v.set(U,re),ue=!0}var he=re.get(H);if(z(he)){if(!F)return;if(he=new q,re.set(H,he),!m.setProvider(U,H,A))throw re.delete(H),ue&&v.delete(U),new Error("Wrong provider for target.")}return he}function K(U,H,F){var re=V(H,F,!1);return z(re)?!1:D(re.has(U))}function we(U,H,F){var re=V(H,F,!1);if(!z(re))return re.get(U)}function be(U,H,F,re){var ue=V(F,re,!0);ue.set(U,H)}function te(U,H){var F=[],re=V(U,H,!1);if(z(re))return F;for(var ue=re.keys(),he=qu(ue),et=0;;){var Wu=zu(he);if(!Wu)return F.length=et,F;var Pp=Ku(Wu);try{F[et]=Pp}catch(Rp){try{Gu(he)}finally{throw Rp}}et++}}function P(U,H,F){var re=V(H,F,!1);if(z(re)||!re.delete(U))return!1;if(re.size===0){var ue=v.get(H);z(ue)||(ue.delete(F),ue.size===0&&v.delete(ue))}return!0}}function Tp(m){var v=m.defineMetadata,A=m.hasOwnMetadata,V=m.getOwnMetadata,K=m.getOwnMetadataKeys,we=m.deleteMetadata,be=new d,te={isProviderFor:function(P,U){var H=be.get(P);return!z(H)&&H.has(U)?!0:K(P,U).length?(z(H)&&(H=new O,be.set(P,H)),H.add(U),!0):!1},OrdinaryDefineOwnMetadata:v,OrdinaryHasOwnMetadata:A,OrdinaryGetOwnMetadata:V,OrdinaryOwnMetadataKeys:K,OrdinaryDeleteMetadata:we};return te}function pi(m,v,A){var V=S.getProvider(m,v);if(!z(V))return V;if(A){if(S.setProvider(m,v,w))return w;throw new Error("Illegal state.")}}function Vp(){var m={},v=[],A=function(){function te(P,U,H){this._index=0,this._keys=P,this._values=U,this._selector=H}return te.prototype["@@iterator"]=function(){return this},te.prototype[c]=function(){return this},te.prototype.next=function(){var P=this._index;if(P>=0&&P<this._keys.length){var U=this._selector(this._keys[P],this._values[P]);return P+1>=this._keys.length?(this._index=-1,this._keys=v,this._values=v):this._index++,{value:U,done:!1}}return{value:void 0,done:!0}},te.prototype.throw=function(P){throw this._index>=0&&(this._index=-1,this._keys=v,this._values=v),P},te.prototype.return=function(P){return this._index>=0&&(this._index=-1,this._keys=v,this._values=v),{value:P,done:!0}},te}(),V=function(){function te(){this._keys=[],this._values=[],this._cacheKey=m,this._cacheIndex=-2}return Object.defineProperty(te.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),te.prototype.has=function(P){return this._find(P,!1)>=0},te.prototype.get=function(P){var U=this._find(P,!1);return U>=0?this._values[U]:void 0},te.prototype.set=function(P,U){var H=this._find(P,!0);return this._values[H]=U,this},te.prototype.delete=function(P){var U=this._find(P,!1);if(U>=0){for(var H=this._keys.length,F=U+1;F<H;F++)this._keys[F-1]=this._keys[F],this._values[F-1]=this._values[F];return this._keys.length--,this._values.length--,ve(P,this._cacheKey)&&(this._cacheKey=m,this._cacheIndex=-2),!0}return!1},te.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=m,this._cacheIndex=-2},te.prototype.keys=function(){return new A(this._keys,this._values,K)},te.prototype.values=function(){return new A(this._keys,this._values,we)},te.prototype.entries=function(){return new A(this._keys,this._values,be)},te.prototype["@@iterator"]=function(){return this.entries()},te.prototype[c]=function(){return this.entries()},te.prototype._find=function(P,U){if(!ve(this._cacheKey,P)){this._cacheIndex=-1;for(var H=0;H<this._keys.length;H++)if(ve(this._keys[H],P)){this._cacheIndex=H;break}}return this._cacheIndex<0&&U&&(this._cacheIndex=this._keys.length,this._keys.push(P),this._values.push(void 0)),this._cacheIndex},te}();return V;function K(te,P){return te}function we(te,P){return P}function be(te,P){return[te,P]}}function _p(){var m=function(){function v(){this._map=new q}return Object.defineProperty(v.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),v.prototype.has=function(A){return this._map.has(A)},v.prototype.add=function(A){return this._map.set(A,A),this},v.prototype.delete=function(A){return this._map.delete(A)},v.prototype.clear=function(){this._map.clear()},v.prototype.keys=function(){return this._map.keys()},v.prototype.values=function(){return this._map.keys()},v.prototype.entries=function(){return this._map.entries()},v.prototype["@@iterator"]=function(){return this.keys()},v.prototype[c]=function(){return this.keys()},v}();return m}function jp(){var m=16,v=b.create(),A=V();return function(){function P(){this._key=V()}return P.prototype.has=function(U){var H=K(U,!1);return H!==void 0?b.has(H,this._key):!1},P.prototype.get=function(U){var H=K(U,!1);return H!==void 0?b.get(H,this._key):void 0},P.prototype.set=function(U,H){var F=K(U,!0);return F[this._key]=H,this},P.prototype.delete=function(U){var H=K(U,!1);return H!==void 0?delete H[this._key]:!1},P.prototype.clear=function(){this._key=V()},P}();function V(){var P;do P="@@WeakMap@@"+te();while(b.has(v,P));return v[P]=!0,P}function K(P,U){if(!i.call(P,A)){if(!U)return;Object.defineProperty(P,A,{value:b.create()})}return P[A]}function we(P,U){for(var H=0;H<U;++H)P[H]=Math.random()*255|0;return P}function be(P){if(typeof Uint8Array=="function"){var U=new Uint8Array(P);return typeof crypto<"u"?crypto.getRandomValues(U):typeof msCrypto<"u"?msCrypto.getRandomValues(U):we(U,P),U}return we(new Array(P),P)}function te(){var P=be(m);P[6]=P[6]&79|64,P[8]=P[8]&191|128;for(var U="",H=0;H<m;++H){var F=P[H];(H===4||H===6||H===8)&&(U+="-"),F<16&&(U+="0"),U+=F.toString(16).toLowerCase()}return U}}function wa(m){return m.__=void 0,delete m.__,m}})})(Ca||(Ca={}));/*!
|
|
15
|
+
* MIT License
|
|
16
|
+
*
|
|
17
|
+
* Copyright (c) 2017-2022 Peculiar Ventures, LLC
|
|
18
|
+
*
|
|
19
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
21
|
+
* in the Software without restriction, including without limitation the rights
|
|
22
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
24
|
+
* furnished to do so, subject to the following conditions:
|
|
25
|
+
*
|
|
26
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
27
|
+
* copies or substantial portions of the Software.
|
|
28
|
+
*
|
|
29
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
30
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
32
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
34
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
|
+
* SOFTWARE.
|
|
36
|
+
*
|
|
37
|
+
*/const Qu="[object ArrayBuffer]";class _{static isArrayBuffer(e){return Object.prototype.toString.call(e)===Qu}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,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(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,t){const i=_.toUint8Array(e),n=_.toUint8Array(t);if(i.length!==n.byteLength)return!1;for(let s=0;s<i.length;s++)if(i[s]!==n[s])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let i=0;for(const c of t)i+=c.byteLength;const n=new Uint8Array(i);let s=0;for(const c of t){const u=this.toUint8Array(c);n.set(u,s),s+=u.length}return e[e.length-1]instanceof Function?this.toView(n,e[e.length-1]):n.buffer}}const to="string",Xu=/^[0-9a-f]+$/i,ef=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,tf=/^[a-zA-Z0-9-_]+$/;class xa{static fromString(e){const t=unescape(encodeURIComponent(e)),i=new Uint8Array(t.length);for(let n=0;n<t.length;n++)i[n]=t.charCodeAt(n);return i.buffer}static toString(e){const t=_.toUint8Array(e);let i="";for(let s=0;s<t.length;s++)i+=String.fromCharCode(t[s]);return decodeURIComponent(escape(i))}}class rt{static toString(e,t=!1){const i=_.toArrayBuffer(e),n=new DataView(i);let s="";for(let c=0;c<i.byteLength;c+=2){const u=n.getUint16(c,t);s+=String.fromCharCode(u)}return s}static fromString(e,t=!1){const i=new ArrayBuffer(e.length*2),n=new DataView(i);for(let s=0;s<e.length;s++)n.setUint16(s*2,e.charCodeAt(s),t);return i}}class L{static isHex(e){return typeof e===to&&Xu.test(e)}static isBase64(e){return typeof e===to&&ef.test(e)}static isBase64Url(e){return typeof e===to&&tf.test(e)}static ToString(e,t="utf8"){const i=_.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(i);case"binary":return this.ToBinary(i);case"hex":return this.ToHex(i);case"base64":return this.ToBase64(i);case"base64url":return this.ToBase64Url(i);case"utf16le":return rt.toString(i,!0);case"utf16":case"utf16be":return rt.toString(i);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.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 rt.fromString(e,!0);case"utf16":case"utf16be":return rt.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){const t=_.toUint8Array(e);if(typeof btoa<"u"){const i=this.ToString(t,"binary");return btoa(i)}else return Buffer.from(t).toString("base64")}static FromBase64(e){const t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!L.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){const t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!L.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=L.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return xa.fromString(e);case"utf16":case"utf16be":return rt.fromString(e);case"utf16le":case"usc2":return rt.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=L.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return xa.toString(e);case"utf16":case"utf16be":return rt.toString(e);case"utf16le":case"usc2":return rt.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){const t=e.length,i=new Uint8Array(t);for(let n=0;n<t;n++)i[n]=e.charCodeAt(n);return i.buffer}static ToBinary(e){const t=_.toUint8Array(e);let i="";for(let n=0;n<t.length;n++)i+=String.fromCharCode(t[n]);return i}static ToHex(e){const t=_.toUint8Array(e);let i="";const n=t.length;for(let s=0;s<n;s++){const c=t[s];c<16&&(i+="0"),i+=c.toString(16)}return i}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!L.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);const i=new Uint8Array(t.length/2);for(let n=0;n<t.length;n=n+2){const s=t.slice(n,n+2);i[n/2]=parseInt(s,16)}return i.buffer}static ToUtf16String(e,t=!1){return rt.toString(e,t)}static FromUtf16String(e,t=!1){return rt.fromString(e,t)}static Base64Padding(e){const t=4-e.length%4;if(t<4)for(let i=0;i<t;i++)e+="=";return e}static formatString(e){return(e==null?void 0:e.replace(/[\n\r\t ]/g,""))||""}}L.DEFAULT_UTF8_ENCODING="utf8";function rf(...r){const e=r.map(n=>n.byteLength).reduce((n,s)=>n+s),t=new Uint8Array(e);let i=0;return r.map(n=>new Uint8Array(n)).forEach(n=>{for(const s of n)t[i++]=s}),t.buffer}function Ba(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),i=new Uint8Array(e);for(let n=0;n<r.byteLength;n++)if(t[n]!==i[n])return!1;return!0}/*!
|
|
38
|
+
Copyright (c) Peculiar Ventures, LLC
|
|
39
|
+
*/function ir(r,e){let t=0;if(r.length===1)return r[0];for(let i=r.length-1;i>=0;i--)t+=r[r.length-1-i]*Math.pow(2,e*i);return t}function Dt(r,e,t=-1){const i=t;let n=r,s=0,c=Math.pow(2,e);for(let u=1;u<8;u++){if(r<c){let f;if(i<0)f=new ArrayBuffer(u),s=u;else{if(i<u)return new ArrayBuffer(0);f=new ArrayBuffer(i),s=i}const p=new Uint8Array(f);for(let b=u-1;b>=0;b--){const y=Math.pow(2,b*e);p[s-b-1]=Math.floor(n/y),n-=p[s-b-1]*y}return f}c*=Math.pow(2,e)}return new ArrayBuffer(0)}function ro(...r){let e=0,t=0;for(const s of r)e+=s.length;const i=new ArrayBuffer(e),n=new Uint8Array(i);for(const s of r)n.set(s,t),t+=s.length;return n}function Ea(){const r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const u=r[0]===255&&r[1]&128,f=r[0]===0&&(r[1]&128)===0;(u||f)&&this.warnings.push("Needlessly long format")}const e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let u=0;u<this.valueHex.byteLength;u++)t[u]=0;t[0]=r[0]&128;const i=ir(t,8),n=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(n);for(let u=0;u<this.valueHex.byteLength;u++)s[u]=r[u];return s[0]&=127,ir(s,8)-i}function nf(r){const e=r<0?r*-1:r;let t=128;for(let i=1;i<8;i++){if(e<=t){if(r<0){const c=t-e,u=Dt(c,8,i),f=new Uint8Array(u);return f[0]|=128,u}let n=Dt(e,8,i),s=new Uint8Array(n);if(s[0]&128){const c=n.slice(0),u=new Uint8Array(c);n=new ArrayBuffer(n.byteLength+1),s=new Uint8Array(n);for(let f=0;f<c.byteLength;f++)s[f+1]=u[f];s[0]=0}return n}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function of(r,e){if(r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),i=new Uint8Array(e);for(let n=0;n<t.length;n++)if(t[n]!==i[n])return!1;return!0}function Me(r,e){const t=r.toString(10);if(e<t.length)return"";const i=e-t.length,n=new Array(i);for(let c=0;c<i;c++)n[c]="0";return n.join("").concat(t)}/*!
|
|
40
|
+
* Copyright (c) 2014, GMO GlobalSign
|
|
41
|
+
* Copyright (c) 2015-2022, Peculiar Ventures
|
|
42
|
+
* All rights reserved.
|
|
43
|
+
*
|
|
44
|
+
* Author 2014-2019, Yury Strozhevsky
|
|
45
|
+
*
|
|
46
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
|
47
|
+
* are permitted provided that the following conditions are met:
|
|
48
|
+
*
|
|
49
|
+
* * Redistributions of source code must retain the above copyright notice, this
|
|
50
|
+
* list of conditions and the following disclaimer.
|
|
51
|
+
*
|
|
52
|
+
* * Redistributions in binary form must reproduce the above copyright notice, this
|
|
53
|
+
* list of conditions and the following disclaimer in the documentation and/or
|
|
54
|
+
* other materials provided with the distribution.
|
|
55
|
+
*
|
|
56
|
+
* * Neither the name of the copyright holder nor the names of its
|
|
57
|
+
* contributors may be used to endorse or promote products derived from
|
|
58
|
+
* this software without specific prior written permission.
|
|
59
|
+
*
|
|
60
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
61
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
62
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
63
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
64
|
+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
65
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
66
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
67
|
+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
68
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
69
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
70
|
+
*
|
|
71
|
+
*/function yi(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function io(r){let e=0,t=0;for(let n=0;n<r.length;n++){const s=r[n];e+=s.byteLength}const i=new Uint8Array(e);for(let n=0;n<r.length;n++){const s=r[n];i.set(new Uint8Array(s),t),t+=s.byteLength}return i.buffer}function pt(r,e,t,i){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):i<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-i<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class gi{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return io(this.items)}}const Vr=[new Uint8Array([1])],Ia="0123456789",no="name",Na="valueHexView",sf="isHexOnly",af="idBlock",cf="tagClass",lf="tagNumber",uf="isConstructed",ff="fromBER",df="toBER",pf="local",Ve="",We=new ArrayBuffer(0),mi=new Uint8Array(0),_r="EndOfContent",Oa="OCTET STRING",Ta="BIT STRING";function it(r){var e;return e=class extends r{constructor(...i){var n;super(...i);const s=i[0]||{};this.isHexOnly=(n=s.isHexOnly)!==null&&n!==void 0?n:!1,this.valueHexView=s.valueHex?_.toUint8Array(s.valueHex):mi}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(i){this.valueHexView=new Uint8Array(i)}fromBER(i,n,s){const c=i instanceof ArrayBuffer?new Uint8Array(i):i;if(!pt(this,c,n,s))return-1;const u=n+s;return this.valueHexView=c.subarray(n,u),this.valueHexView.length?(this.blockLength=s,u):(this.warnings.push("Zero buffer length"),n)}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",We)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:L.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}class $t{constructor({blockLength:e=0,error:t=Ve,warnings:i=[],valueBeforeDecode:n=mi}={}){this.blockLength=e,this.error=t,this.warnings=i,this.valueBeforeDecodeView=_.toUint8Array(n)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:L.ToHex(this.valueBeforeDecodeView)}}}$t.NAME="baseBlock";class Ie extends $t{fromBER(e,t,i){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}Ie.NAME="valueBlock";class Va extends it($t){constructor({idBlock:e={}}={}){var t,i,n,s;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?_.toUint8Array(e.valueHex):mi,this.tagClass=(i=e.tagClass)!==null&&i!==void 0?i:-1,this.tagNumber=(n=e.tagNumber)!==null&&n!==void 0?n:-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 t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",We}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){const n=new Uint8Array(1);if(!e){let s=this.tagNumber;s&=31,t|=s,n[0]=t}return n.buffer}if(!this.isHexOnly){const n=Dt(this.tagNumber,7),s=new Uint8Array(n),c=n.byteLength,u=new Uint8Array(c+1);if(u[0]=t|31,!e){for(let f=0;f<c-1;f++)u[f+1]=s[f]|128;u[c]=s[c-1]}return u.buffer}const i=new Uint8Array(this.valueHexView.byteLength+1);if(i[0]=t|31,!e){const n=this.valueHexView;for(let s=0;s<n.length-1;s++)i[s+1]=n[s]|128;i[this.valueHexView.byteLength]=n[n.length-1]}return i.buffer}fromBER(e,t,i){const n=_.toUint8Array(e);if(!pt(this,n,t,i))return-1;const s=n.subarray(t,t+i);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;const u=s[0]&31;if(u!==31)this.tagNumber=u,this.blockLength=1;else{let f=1,p=this.valueHexView=new Uint8Array(255),b=255;for(;s[f]&128;){if(p[f-1]=s[f]&127,f++,f>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(f===b){b+=255;const q=new Uint8Array(b);for(let O=0;O<p.length;O++)q[O]=p[O];p=this.valueHexView=new Uint8Array(b)}}this.blockLength=f+1,p[f-1]=s[f]&127;const y=new Uint8Array(f);for(let q=0;q<f;q++)y[q]=p[q];p=this.valueHexView=new Uint8Array(f),p.set(y),this.blockLength<=9?this.tagNumber=ir(p,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 t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}Va.NAME="identificationBlock";class _a extends $t{constructor({lenBlock:e={}}={}){var t,i,n;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(i=e.longFormUsed)!==null&&i!==void 0?i:!1,this.length=(n=e.length)!==null&&n!==void 0?n:0}fromBER(e,t,i){const n=_.toUint8Array(e);if(!pt(this,n,t,i))return-1;const s=n.subarray(t,t+i);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,t+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,t+this.blockLength;const c=s[0]&127;if(c>8)return this.error="Too big integer",-1;if(c+1>s.length)return this.error="End of input reached before message was fully decoded",-1;const u=t+1,f=n.subarray(u,u+c);return f[c-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=ir(f,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=c+1,t+this.blockLength}toBER(e=!1){let t,i;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=128),t;if(this.longFormUsed){const n=Dt(this.length,8);if(n.byteLength>127)return this.error="Too big length",We;if(t=new ArrayBuffer(n.byteLength+1),e)return t;const s=new Uint8Array(n);i=new Uint8Array(t),i[0]=n.byteLength|128;for(let c=0;c<n.byteLength;c++)i[c+1]=s[c];return t}return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}_a.NAME="lengthBlock";const $={};class Se extends $t{constructor({name:e=Ve,optional:t=!1,primitiveSchema:i,...n}={},s){super(n),this.name=e,this.optional=t,i&&(this.primitiveSchema=i),this.idBlock=new Va(n),this.lenBlock=new _a(n),this.valueBlock=s?new s(n):new Ie(n)}fromBER(e,t,i){const n=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return n===-1?(this.error=this.valueBlock.error,n):(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),n)}toBER(e,t){const i=t||new gi;t||ja(this);const n=this.idBlock.toBER(e);if(i.write(n),this.lenBlock.isIndefiniteForm)i.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,i),i.write(new ArrayBuffer(2));else{const s=this.valueBlock.toBER(e);this.lenBlock.length=s.byteLength;const c=this.lenBlock.toBER(e);i.write(c),i.write(s)}return t?We:i.final()}toJSON(){const 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():L.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${L.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const t=this.toBER(),i=e.toBER();return of(t,i)}}Se.NAME="BaseBlock";function ja(r){if(r instanceof $.Constructed)for(const e of r.valueBlock.value)ja(e)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}class oo extends Se{constructor({value:e=Ve,...t}={},i){super(t,i),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,i){const n=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return n===-1?(this.error=this.valueBlock.error,n):(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),n)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}oo.NAME="BaseStringBlock";class Pa extends it(Ie){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}}Pa.NAME="PrimitiveValueBlock";var Ra;class jr extends Se{constructor(e={}){super(e,Pa),this.idBlock.isConstructed=!1}}Ra=jr,$.Primitive=Ra,jr.NAME="PRIMITIVE";function hf(r,e){if(r instanceof e)return r;const t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}function nr(r,e=0,t=r.length){const i=e;let n=new Se({},Ie);const s=new $t;if(!pt(s,r,e,t))return n.error=s.error,{offset:-1,result:n};if(!r.subarray(e,e+t).length)return n.error="Zero buffer length",{offset:-1,result:n};let u=n.idBlock.fromBER(r,e,t);if(n.idBlock.warnings.length&&n.warnings.concat(n.idBlock.warnings),u===-1)return n.error=n.idBlock.error,{offset:-1,result:n};if(e=u,t-=n.idBlock.blockLength,u=n.lenBlock.fromBER(r,e,t),n.lenBlock.warnings.length&&n.warnings.concat(n.lenBlock.warnings),u===-1)return n.error=n.lenBlock.error,{offset:-1,result:n};if(e=u,t-=n.lenBlock.blockLength,!n.idBlock.isConstructed&&n.lenBlock.isIndefiniteForm)return n.error="Indefinite length form used for primitive encoding form",{offset:-1,result:n};let f=Se;switch(n.idBlock.tagClass){case 1:if(n.idBlock.tagNumber>=37&&n.idBlock.isHexOnly===!1)return n.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:n};switch(n.idBlock.tagNumber){case 0:if(n.idBlock.isConstructed&&n.lenBlock.length>0)return n.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:n};f=$.EndOfContent;break;case 1:f=$.Boolean;break;case 2:f=$.Integer;break;case 3:f=$.BitString;break;case 4:f=$.OctetString;break;case 5:f=$.Null;break;case 6:f=$.ObjectIdentifier;break;case 10:f=$.Enumerated;break;case 12:f=$.Utf8String;break;case 13:f=$.RelativeObjectIdentifier;break;case 14:f=$.TIME;break;case 15:return n.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:n};case 16:f=$.Sequence;break;case 17:f=$.Set;break;case 18:f=$.NumericString;break;case 19:f=$.PrintableString;break;case 20:f=$.TeletexString;break;case 21:f=$.VideotexString;break;case 22:f=$.IA5String;break;case 23:f=$.UTCTime;break;case 24:f=$.GeneralizedTime;break;case 25:f=$.GraphicString;break;case 26:f=$.VisibleString;break;case 27:f=$.GeneralString;break;case 28:f=$.UniversalString;break;case 29:f=$.CharacterString;break;case 30:f=$.BmpString;break;case 31:f=$.DATE;break;case 32:f=$.TimeOfDay;break;case 33:f=$.DateTime;break;case 34:f=$.Duration;break;default:{const p=n.idBlock.isConstructed?new $.Constructed:new $.Primitive;p.idBlock=n.idBlock,p.lenBlock=n.lenBlock,p.warnings=n.warnings,n=p}}break;case 2:case 3:case 4:default:f=n.idBlock.isConstructed?$.Constructed:$.Primitive}return n=hf(n,f),u=n.fromBER(r,e,n.lenBlock.isIndefiniteForm?t:n.lenBlock.length),n.valueBeforeDecodeView=r.subarray(i,i+n.blockLength),{offset:u,result:n}}function or(r){if(!r.byteLength){const e=new Se({},Ie);return e.error="Input buffer has zero length",{offset:-1,result:e}}return nr(_.toUint8Array(r).slice(),0,r.byteLength)}function yf(r,e){return r?1:e}class xt extends Ie{constructor({value:e=[],isIndefiniteForm:t=!1,...i}={}){super(i),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,i){const n=_.toUint8Array(e);if(!pt(this,n,t,i))return-1;if(this.valueBeforeDecodeView=n.subarray(t,t+i),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let s=t;for(;yf(this.isIndefiniteForm,i)>0;){const c=nr(n,s,i);if(c.offset===-1)return this.error=c.result.error,this.warnings.concat(c.result.warnings),-1;if(s=c.offset,this.blockLength+=c.result.blockLength,i-=c.result.blockLength,this.value.push(c.result),this.isIndefiniteForm&&c.result.constructor.NAME===_r)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===_r?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(e,t){const i=t||new gi;for(let n=0;n<this.value.length;n++)this.value[n].toBER(e,i);return t?We:i.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const t of this.value)e.value.push(t.toJSON());return e}}xt.NAME="ConstructedValueBlock";var Da;class _e extends Se{constructor(e={}){super(e,xt),this.idBlock.isConstructed=!0}fromBER(e,t,i){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const n=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return n===-1?(this.error=this.valueBlock.error,n):(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),n)}onAsciiEncoding(){const e=[];for(const i of this.valueBlock.value)e.push(i.toString("ascii").split(`
|
|
72
|
+
`).map(n=>` ${n}`).join(`
|
|
73
|
+
`));const t=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :
|
|
74
|
+
${e.join(`
|
|
75
|
+
`)}`:`${t} :`}}Da=_e,$.Constructed=Da,_e.NAME="CONSTRUCTED";class $a extends Ie{fromBER(e,t,i){return t}toBER(e){return We}}$a.override="EndOfContentValueBlock";var Ma;class so extends Se{constructor(e={}){super(e,$a),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}Ma=so,$.EndOfContent=Ma,so.NAME=_r;var Ua;class Mt extends Se{constructor(e={}){super(e,Ie),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,i){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+=i,t+i>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+i}toBER(e,t){const i=new ArrayBuffer(2);if(!e){const n=new Uint8Array(i);n[0]=5,n[1]=0}return t&&t.write(i),i}onAsciiEncoding(){return`${this.constructor.NAME}`}}Ua=Mt,$.Null=Ua,Mt.NAME="NULL";class La extends it(Ie){constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=_.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,t,i){const n=_.toUint8Array(e);return pt(this,n,t,i)?(this.valueHexView=n.subarray(t,t+i),i>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,Ea.call(this),this.blockLength=i,t+i):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}La.NAME="BooleanValueBlock";var Ha;let bi=class extends Se{constructor(e={}){super(e,La),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};Ha=bi,$.Boolean=Ha,bi.NAME="BOOLEAN";class Fa extends it(xt){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,i){let n=0;if(this.isConstructed){if(this.isHexOnly=!1,n=xt.prototype.fromBER.call(this,e,t,i),n===-1)return n;for(let s=0;s<this.value.length;s++){const c=this.value[s].constructor.NAME;if(c===_r){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(c!==Oa)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,n=super.fromBER(e,t,i),this.blockLength=i;return n}toBER(e,t){return this.isConstructed?xt.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}Fa.NAME="OctetStringValueBlock";var qa;let Ut=class Ju extends Se{constructor({idBlock:e={},lenBlock:t={},...i}={}){var n,s;(n=i.isConstructed)!==null&&n!==void 0||(i.isConstructed=!!(!((s=i.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},Fa),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,i){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,i===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){const s=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+i);try{if(s.byteLength){const c=nr(s,0,s.byteLength);c.offset!==-1&&c.offset===i&&(this.valueBlock.value=[c.result])}}catch{}}return super.fromBER(e,t,i)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?_e.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${L.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const t of this.valueBlock.value)t instanceof Ju&&e.push(t.valueBlock.valueHexView);return _.concat(e)}};qa=Ut,$.OctetString=qa,Ut.NAME=Oa;class Ka extends it(xt){constructor({unusedBits:e=0,isConstructed:t=!1,...i}={}){super(i),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,i){if(!i)return t;let n=-1;if(this.isConstructed){if(n=xt.prototype.fromBER.call(this,e,t,i),n===-1)return n;for(const u of this.value){const f=u.constructor.NAME;if(f===_r){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(f!==Ta)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const p=u.valueBlock;if(this.unusedBits>0&&p.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=p.unusedBits}return n}const s=_.toUint8Array(e);if(!pt(this,s,t,i))return-1;const c=s.subarray(t,t+i);if(this.unusedBits=c[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const u=c.subarray(1);try{if(u.byteLength){const f=nr(u,0,u.byteLength);f.offset!==-1&&f.offset===i-1&&(this.value=[f.result])}}catch{}}return this.valueHexView=c.subarray(1),this.blockLength=c.length,t+i}toBER(e,t){if(this.isConstructed)return xt.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return We;const i=new Uint8Array(this.valueHexView.length+1);return i[0]=this.unusedBits,i.set(this.valueHexView,1),i.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}Ka.NAME="BitStringValueBlock";var za;let Lt=class extends Se{constructor({idBlock:e={},lenBlock:t={},...i}={}){var n,s;(n=i.isConstructed)!==null&&n!==void 0||(i.isConstructed=!!(!((s=i.value)===null||s===void 0)&&s.length)),super({idBlock:{isConstructed:i.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!i.isIndefiniteForm},...i},Ka),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,i){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return _e.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const n of t)e.push(n.toString(2).padStart(8,"0"));const i=e.join("");return`${this.constructor.NAME} : ${i.substring(0,i.length-this.valueBlock.unusedBits)}`}}};za=Lt,$.BitString=za,Lt.NAME=Ta;var Ga;function gf(r,e){const t=new Uint8Array([0]),i=new Uint8Array(r),n=new Uint8Array(e);let s=i.slice(0);const c=s.length-1,u=n.slice(0),f=u.length-1;let p=0;const b=f<c?c:f;let y=0;for(let q=b;q>=0;q--,y++){switch(!0){case y<u.length:p=s[c-y]+u[f-y]+t[0];break;default:p=s[c-y]+t[0]}switch(t[0]=p/10,!0){case y>=s.length:s=ro(new Uint8Array([p%10]),s);break;default:s[c-y]=p%10}}return t[0]>0&&(s=ro(t,s)),s}function Wa(r){if(r>=Vr.length)for(let e=Vr.length;e<=r;e++){const t=new Uint8Array([0]);let i=Vr[e-1].slice(0);for(let n=i.length-1;n>=0;n--){const s=new Uint8Array([(i[n]<<1)+t[0]]);t[0]=s[0]/10,i[n]=s[0]%10}t[0]>0&&(i=ro(t,i)),Vr.push(i)}return Vr[r]}function mf(r,e){let t=0;const i=new Uint8Array(r),n=new Uint8Array(e),s=i.slice(0),c=s.length-1,u=n.slice(0),f=u.length-1;let p,b=0;for(let y=f;y>=0;y--,b++)switch(p=s[c-b]-u[f-b]-t,!0){case p<0:t=1,s[c-b]=p+10;break;default:t=0,s[c-b]=p}if(t>0)for(let y=c-f+1;y>=0;y--,b++)if(p=s[c-b]-t,p<0)t=1,s[c-b]=p+10;else{t=0,s[c-b]=p;break}return s.slice()}class ao extends it(Ie){constructor({value:e,...t}={}){super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}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=Ea.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(nf(e))}get valueDec(){return this._valueDec}fromDER(e,t,i,n=0){const s=this.fromBER(e,t,i);if(s===-1)return s;const c=this.valueHexView;return c[0]===0&&c[1]&128?this.valueHexView=c.subarray(1):n!==0&&c.length<n&&(n-c.length>1&&(n=c.length+1),this.valueHexView=c.subarray(n-c.length)),s}toDER(e=!1){const t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{const i=new Uint8Array(this.valueHexView.length+1);i[0]=0,i.set(t,1),this.valueHexView=i}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,i){const n=super.fromBER(e,t,i);return n===-1||this.setValueHex(),n}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=this.valueHexView.length*8-1;let t=new Uint8Array(this.valueHexView.length*8/3),i=0,n;const s=this.valueHexView;let c="",u=!1;for(let f=s.byteLength-1;f>=0;f--){n=s[f];for(let p=0;p<8;p++){if((n&1)===1)switch(i){case e:t=mf(Wa(i),t),c="-";break;default:t=gf(t,Wa(i))}i++,n>>=1}}for(let f=0;f<t.length;f++)t[f]&&(u=!0),u&&(c+=Ia.charAt(t[f]));return u===!1&&(c+=Ia.charAt(0)),c}}Ga=ao,ao.NAME="IntegerValueBlock",Object.defineProperty(Ga.prototype,"valueHex",{set:function(r){this.valueHexView=new Uint8Array(r),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var Ja;class nt extends Se{constructor(e={}){super(e,ao),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return yi(),BigInt(this.valueBlock.toString())}static fromBigInt(e){yi();const t=BigInt(e),i=new gi,n=t.toString(16).replace(/^-/,""),s=new Uint8Array(L.FromHex(n));if(t<0){const u=new Uint8Array(s.length+(s[0]&128?1:0));u[0]|=128;const p=BigInt(`0x${L.ToHex(u)}`)+t,b=_.toUint8Array(L.FromHex(p.toString(16)));b[0]|=128,i.write(b)}else s[0]&128&&i.write(new Uint8Array([0])),i.write(s);return new nt({valueHex:i.final()})}convertToDER(){const e=new nt({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new nt({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}Ja=nt,$.Integer=Ja,nt.NAME="INTEGER";var Ya;class vi extends nt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}Ya=vi,$.Enumerated=Ya,vi.NAME="ENUMERATED";class co extends it(Ie){constructor({valueDec:e=-1,isFirstSid:t=!1,...i}={}){super(i),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,i){if(!i)return t;const n=_.toUint8Array(e);if(!pt(this,n,t,i))return-1;const s=n.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let u=0;u<i&&(this.valueHexView[u]=s[u]&127,this.blockLength++,!!(s[u]&128));u++);const c=new Uint8Array(this.blockLength);for(let u=0;u<this.blockLength;u++)c[u]=this.valueHexView[u];return this.valueHexView=c,s[this.blockLength-1]&128?(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=ir(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){yi();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;const i=new Uint8Array(t.length/7);for(let n=0;n<i.length;n++)i[n]=parseInt(t.slice(n*7,n*7+7),2)+(n+1<i.length?128:0);this.fromBER(i.buffer,0,i.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const n=this.valueHexView,s=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength-1;c++)s[c]=n[c]|128;return s[this.blockLength-1]=n[this.blockLength-1],s.buffer}const t=Dt(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",We;const i=new Uint8Array(t.byteLength);if(!e){const n=new Uint8Array(t),s=t.byteLength-1;for(let c=0;c<s;c++)i[c]=n[c]|128;i[s]=n[s]}return i}toString(){let e="";if(this.isHexOnly)e=L.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}co.NAME="sidBlock";class Za extends Ie{constructor({value:e=Ve,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let n=t;for(;i>0;){const s=new co;if(n=s.fromBER(e,n,i),n===-1)return this.blockLength=0,this.error=s.error,n;this.value.length===0&&(s.isFirstSid=!0),this.blockLength+=s.blockLength,i-=s.blockLength,this.value.push(s)}return n}toBER(e){const t=[];for(let i=0;i<this.value.length;i++){const n=this.value[i].toBER(e);if(n.byteLength===0)return this.error=this.value[i].error,We;t.push(n)}return io(t)}fromString(e){this.value=[];let t=0,i=0,n="",s=!1;do if(i=e.indexOf(".",t),i===-1?n=e.substring(t):n=e.substring(t,i),t=i+1,s){const c=this.value[0];let u=0;switch(c.valueDec){case 0:break;case 1:u=40;break;case 2:u=80;break;default:this.value=[];return}const f=parseInt(n,10);if(isNaN(f))return;c.valueDec=f+u,s=!1}else{const c=new co;if(n>Number.MAX_SAFE_INTEGER){yi();const u=BigInt(n);c.valueBigInt=u}else if(c.valueDec=parseInt(n,10),isNaN(c.valueDec))return;this.value.length||(c.isFirstSid=!0,s=!0),this.value.push(c)}while(i!==-1)}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let n=this.value[i].toString();i!==0&&(e=`${e}.`),t?(n=`{${n}}`,this.value[i].isFirstSid?e=`2.{${n} - 80}`:e+=n):e+=n}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}Za.NAME="ObjectIdentifierValueBlock";var Qa;class wi extends Se{constructor(e={}){super(e,Za),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}Qa=wi,$.ObjectIdentifier=Qa,wi.NAME="OBJECT IDENTIFIER";class lo extends it($t){constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,i){if(i===0)return t;const n=_.toUint8Array(e);if(!pt(this,n,t,i))return-1;const s=n.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let u=0;u<i&&(this.valueHexView[u]=s[u]&127,this.blockLength++,!!(s[u]&128));u++);const c=new Uint8Array(this.blockLength);for(let u=0;u<this.blockLength;u++)c[u]=this.valueHexView[u];return this.valueHexView=c,s[this.blockLength-1]&128?(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=ir(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const n=this.valueHexView,s=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength-1;c++)s[c]=n[c]|128;return s[this.blockLength-1]=n[this.blockLength-1],s.buffer}const t=Dt(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",We;const i=new Uint8Array(t.byteLength);if(!e){const n=new Uint8Array(t),s=t.byteLength-1;for(let c=0;c<s;c++)i[c]=n[c]|128;i[s]=n[s]}return i.buffer}toString(){let e="";return this.isHexOnly?e=L.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}lo.NAME="relativeSidBlock";class Xa extends Ie{constructor({value:e=Ve,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let n=t;for(;i>0;){const s=new lo;if(n=s.fromBER(e,n,i),n===-1)return this.blockLength=0,this.error=s.error,n;this.blockLength+=s.blockLength,i-=s.blockLength,this.value.push(s)}return n}toBER(e,t){const i=[];for(let n=0;n<this.value.length;n++){const s=this.value[n].toBER(e);if(s.byteLength===0)return this.error=this.value[n].error,We;i.push(s)}return io(i)}fromString(e){this.value=[];let t=0,i=0,n="";do{i=e.indexOf(".",t),i===-1?n=e.substring(t):n=e.substring(t,i),t=i+1;const s=new lo;if(s.valueDec=parseInt(n,10),isNaN(s.valueDec))return!0;this.value.push(s)}while(i!==-1);return!0}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let n=this.value[i].toString();i!==0&&(e=`${e}.`),t&&(n=`{${n}}`),e+=n}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}Xa.NAME="RelativeObjectIdentifierValueBlock";var ec;class uo extends Se{constructor(e={}){super(e,Xa),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}ec=uo,$.RelativeObjectIdentifier=ec,uo.NAME="RelativeObjectIdentifier";var tc;class ht extends _e{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}tc=ht,$.Sequence=tc,ht.NAME="SEQUENCE";var rc;let yt=class extends _e{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};rc=yt,$.Set=rc,yt.NAME="SET";class ic extends it(Ie){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=Ve}toJSON(){return{...super.toJSON(),value:this.value}}}ic.NAME="StringValueBlock";class nc extends ic{}nc.NAME="SimpleStringValueBlock";class Ue extends oo{constructor({...e}={}){super(e,nc)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,_.toUint8Array(e))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t);for(let n=0;n<t;n++)i[n]=e.charCodeAt(n);this.valueBlock.value=e}}Ue.NAME="SIMPLE STRING";class oc extends Ue{fromBuffer(e){this.valueBlock.valueHexView=_.toUint8Array(e);try{this.valueBlock.value=L.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=L.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(L.FromUtf8String(e)),this.valueBlock.value=e}}oc.NAME="Utf8StringValueBlock";var sc;class gt extends oc{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}sc=gt,$.Utf8String=sc,gt.NAME="UTF8String";class ac extends Ue{fromBuffer(e){this.valueBlock.value=L.ToUtf16String(e),this.valueBlock.valueHexView=_.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(L.FromUtf16String(e))}}ac.NAME="BmpStringValueBlock";var cc;class Si extends ac{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}cc=Si,$.BmpString=cc,Si.NAME="BMPString";class lc extends Ue{fromBuffer(e){const t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),i=new Uint8Array(t);for(let n=0;n<i.length;n+=4)i[n]=i[n+3],i[n+1]=i[n+2],i[n+2]=0,i[n+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let n=0;n<t;n++){const s=Dt(e.charCodeAt(n),8),c=new Uint8Array(s);if(c.length>4)continue;const u=4-c.length;for(let f=c.length-1;f>=0;f--)i[n*4+f+u]=c[f]}this.valueBlock.value=e}}lc.NAME="UniversalStringValueBlock";var uc;class Ai extends lc{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}uc=Ai,$.UniversalString=uc,Ai.NAME="UniversalString";var fc;class ki extends Ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}fc=ki,$.NumericString=fc,ki.NAME="NumericString";var dc;class Ci extends Ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}dc=Ci,$.PrintableString=dc,Ci.NAME="PrintableString";var pc;class xi extends Ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}pc=xi,$.TeletexString=pc,xi.NAME="TeletexString";var hc;class Bi extends Ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}hc=Bi,$.VideotexString=hc,Bi.NAME="VideotexString";var yc;class Ei extends Ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}yc=Ei,$.IA5String=yc,Ei.NAME="IA5String";var gc;class Ii extends Ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}gc=Ii,$.GraphicString=gc,Ii.NAME="GraphicString";var mc;class Pr extends Ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}mc=Pr,$.VisibleString=mc,Pr.NAME="VisibleString";var bc;class Ni extends Ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}bc=Ni,$.GeneralString=bc,Ni.NAME="GeneralString";var vc;class Oi extends Ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}vc=Oi,$.CharacterString=vc,Oi.NAME="CharacterString";var wc;class Rr extends Pr{constructor({value:e,valueDate:t,...i}={}){if(super(i),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 n=0;n<e.length;n++)this.valueBlock.valueHexView[n]=e.charCodeAt(n)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,_.toUint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let n=0;n<e.length;n++)i[n]=e.charCodeAt(n);return t}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){const i=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(i===null){this.error="Wrong input string for conversion";return}const n=parseInt(i[1],10);n>=50?this.year=1900+n:this.year=2e3+n,this.month=parseInt(i[2],10),this.day=parseInt(i[3],10),this.hour=parseInt(i[4],10),this.minute=parseInt(i[5],10),this.second=parseInt(i[6],10)}toString(e="iso"){if(e==="iso"){const t=new Array(7);return t[0]=Me(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=Me(this.month,2),t[2]=Me(this.day,2),t[3]=Me(this.hour,2),t[4]=Me(this.minute,2),t[5]=Me(this.second,2),t[6]="Z",t.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}}}wc=Rr,$.UTCTime=wc,Rr.NAME="UTCTime";var Sc;class Ti extends Rr{constructor(e={}){var t;super(e),(t=this.millisecond)!==null&&t!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let t=!1,i="",n="",s=0,c,u=0,f=0;if(e[e.length-1]==="Z")i=e.substring(0,e.length-1),t=!0;else{const y=new Number(e[e.length-1]);if(isNaN(y.valueOf()))throw new Error("Wrong input string for conversion");i=e}if(t){if(i.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(i.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let y=1,q=i.indexOf("+"),O="";if(q===-1&&(q=i.indexOf("-"),y=-1),q!==-1){if(O=i.substring(q+1),i=i.substring(0,q),O.length!==2&&O.length!==4)throw new Error("Wrong input string for conversion");let d=parseInt(O.substring(0,2),10);if(isNaN(d.valueOf()))throw new Error("Wrong input string for conversion");if(u=y*d,O.length===4){if(d=parseInt(O.substring(2,4),10),isNaN(d.valueOf()))throw new Error("Wrong input string for conversion");f=y*d}}}let p=i.indexOf(".");if(p===-1&&(p=i.indexOf(",")),p!==-1){const y=new Number(`0${i.substring(p)}`);if(isNaN(y.valueOf()))throw new Error("Wrong input string for conversion");s=y.valueOf(),n=i.substring(0,p)}else n=i;switch(!0){case n.length===8:if(c=/(\d{4})(\d{2})(\d{2})/ig,p!==-1)throw new Error("Wrong input string for conversion");break;case n.length===10:if(c=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,p!==-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 n.length===12:if(c=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,p!==-1){let y=60*s;this.second=Math.floor(y),y=1e3*(y-this.second),this.millisecond=Math.floor(y)}break;case n.length===14:if(c=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,p!==-1){const y=1e3*s;this.millisecond=Math.floor(y)}break;default:throw new Error("Wrong input string for conversion")}const b=c.exec(n);if(b===null)throw new Error("Wrong input string for conversion");for(let y=1;y<b.length;y++)switch(y){case 1:this.year=parseInt(b[y],10);break;case 2:this.month=parseInt(b[y],10);break;case 3:this.day=parseInt(b[y],10);break;case 4:this.hour=parseInt(b[y],10)+u;break;case 5:this.minute=parseInt(b[y],10)+f;break;case 6:this.second=parseInt(b[y],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){const 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"){const t=[];return t.push(Me(this.year,4)),t.push(Me(this.month,2)),t.push(Me(this.day,2)),t.push(Me(this.hour,2)),t.push(Me(this.minute,2)),t.push(Me(this.second,2)),this.millisecond!==0&&(t.push("."),t.push(Me(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}Sc=Ti,$.GeneralizedTime=Sc,Ti.NAME="GeneralizedTime";var Ac;class fo extends gt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}Ac=fo,$.DATE=Ac,fo.NAME="DATE";var kc;class po extends gt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}kc=po,$.TimeOfDay=kc,po.NAME="TimeOfDay";var Cc;class ho extends gt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}Cc=ho,$.DateTime=Cc,ho.NAME="DateTime";var xc;class yo extends gt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}xc=yo,$.Duration=xc,yo.NAME="Duration";var Bc;class go extends gt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}Bc=go,$.TIME=Bc,go.NAME="TIME";class Ht{constructor({name:e=Ve,optional:t=!1}={}){this.name=e,this.optional=t}}class mo extends Ht{constructor({value:e=[],...t}={}){super(t),this.value=e}}class Vi extends Ht{constructor({value:e=new Ht,local:t=!1,...i}={}){super(i),this.value=e,this.local=t}}class bf{constructor({data:e=mi}={}){this.dataView=_.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=_.toUint8Array(e)}fromBER(e,t,i){const n=t+i;return this.dataView=_.toUint8Array(e).subarray(t,n),n}toBER(e){return this.dataView.slice().buffer}}function Ft(r,e,t){if(t instanceof mo){for(let s=0;s<t.value.length;s++)if(Ft(r,e,t.value[s]).verified)return{verified:!0,result:r};{const s={verified:!1,result:{error:"Wrong values for Choice type"}};return t.hasOwnProperty(no)&&(s.name=t.name),s}}if(t instanceof Ht)return t.hasOwnProperty(no)&&(r[t.name]=e),{verified:!0,result:r};if(!(r instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(af in t))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(ff in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(df in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const i=t.idBlock.toBER(!1);if(i.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(t.idBlock.fromBER(i,0,i.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(t.idBlock.hasOwnProperty(cf)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(lf)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(uf)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:r};if(!(sf in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:r};if(t.idBlock.isHexOnly){if(!(Na in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const s=t.idBlock.valueHexView,c=e.idBlock.valueHexView;if(s.length!==c.length)return{verified:!1,result:r};for(let u=0;u<s.length;u++)if(s[u]!==c[1])return{verified:!1,result:r}}if(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ve),t.name&&(r[t.name]=e)),t instanceof $.Constructed){let s=0,c={verified:!1,result:{error:"Unknown error"}},u=t.valueBlock.value.length;if(u>0&&t.valueBlock.value[0]instanceof Vi&&(u=e.valueBlock.value.length),u===0)return{verified:!0,result:r};if(e.valueBlock.value.length===0&&t.valueBlock.value.length!==0){let f=!0;for(let p=0;p<t.valueBlock.value.length;p++)f=f&&(t.valueBlock.value[p].optional||!1);return f?{verified:!0,result:r}:(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ve),t.name&&delete r[t.name]),r.error="Inconsistent object length",{verified:!1,result:r})}for(let f=0;f<u;f++)if(f-s>=e.valueBlock.value.length){if(t.valueBlock.value[f].optional===!1){const p={verified:!1,result:r};return r.error="Inconsistent length between ASN.1 data and schema",t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ve),t.name&&(delete r[t.name],p.name=t.name)),p}}else if(t.valueBlock.value[0]instanceof Vi){if(c=Ft(r,e.valueBlock.value[f],t.valueBlock.value[0].value),c.verified===!1)if(t.valueBlock.value[0].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ve),t.name&&delete r[t.name]),c;if(no in t.valueBlock.value[0]&&t.valueBlock.value[0].name.length>0){let p={};pf in t.valueBlock.value[0]&&t.valueBlock.value[0].local?p=e:p=r,typeof p[t.valueBlock.value[0].name]>"u"&&(p[t.valueBlock.value[0].name]=[]),p[t.valueBlock.value[0].name].push(e.valueBlock.value[f])}}else if(c=Ft(r,e.valueBlock.value[f-s],t.valueBlock.value[f]),c.verified===!1)if(t.valueBlock.value[f].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ve),t.name&&delete r[t.name]),c;if(c.verified===!1){const f={verified:!1,result:r};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ve),t.name&&(delete r[t.name],f.name=t.name)),f}return{verified:!0,result:r}}if(t.primitiveSchema&&Na in e.valueBlock){const s=nr(e.valueBlock.valueHexView);if(s.offset===-1){const c={verified:!1,result:s.result};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ve),t.name&&(delete r[t.name],c.name=t.name)),c}return Ft(r,s.result,t.primitiveSchema)}return{verified:!0,result:r}}function vf(r,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const t=nr(_.toUint8Array(r));return t.offset===-1?{verified:!1,result:t.result}:Ft(t.result,t.result,e)}const Ec=Object.freeze(Object.defineProperty({__proto__:null,Any:Ht,BaseBlock:Se,BaseStringBlock:oo,BitString:Lt,BmpString:Si,Boolean:bi,CharacterString:Oi,Choice:mo,Constructed:_e,DATE:fo,DateTime:ho,Duration:yo,EndOfContent:so,Enumerated:vi,GeneralString:Ni,GeneralizedTime:Ti,GraphicString:Ii,HexBlock:it,IA5String:Ei,Integer:nt,Null:Mt,NumericString:ki,ObjectIdentifier:wi,OctetString:Ut,Primitive:jr,PrintableString:Ci,RawData:bf,RelativeObjectIdentifier:uo,Repeated:Vi,Sequence:ht,Set:yt,TIME:go,TeletexString:xi,TimeOfDay:po,UTCTime:Rr,UniversalString:Ai,Utf8String:gt,ValueBlock:Ie,VideotexString:Bi,ViewWriter:gi,VisibleString:Pr,compareSchema:Ft,fromBER:or,verifySchema:vf},Symbol.toStringTag,{value:"Module"}));var x;(function(r){r[r.Sequence=0]="Sequence",r[r.Set=1]="Set",r[r.Choice=2]="Choice"})(x||(x={}));var h;(function(r){r[r.Any=1]="Any",r[r.Boolean=2]="Boolean",r[r.OctetString=3]="OctetString",r[r.BitString=4]="BitString",r[r.Integer=5]="Integer",r[r.Enumerated=6]="Enumerated",r[r.ObjectIdentifier=7]="ObjectIdentifier",r[r.Utf8String=8]="Utf8String",r[r.BmpString=9]="BmpString",r[r.UniversalString=10]="UniversalString",r[r.NumericString=11]="NumericString",r[r.PrintableString=12]="PrintableString",r[r.TeletexString=13]="TeletexString",r[r.VideotexString=14]="VideotexString",r[r.IA5String=15]="IA5String",r[r.GraphicString=16]="GraphicString",r[r.VisibleString=17]="VisibleString",r[r.GeneralString=18]="GeneralString",r[r.CharacterString=19]="CharacterString",r[r.UTCTime=20]="UTCTime",r[r.GeneralizedTime=21]="GeneralizedTime",r[r.DATE=22]="DATE",r[r.TimeOfDay=23]="TimeOfDay",r[r.DateTime=24]="DateTime",r[r.Duration=25]="Duration",r[r.TIME=26]="TIME",r[r.Null=27]="Null"})(h||(h={}));class _i{constructor(e,t=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(_.isBufferSource(e))this.unusedBits=t,this.value=_.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof Lt))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 Lt({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new Lt({name:e})}toNumber(){let e="";const t=new Uint8Array(this.value);for(const i of t)e+=i.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 t=e.toString(2);const i=t.length+7>>3;this.unusedBits=(i<<3)-t.length;const n=new Uint8Array(i);t=t.padStart(i<<3,"0").split("").reverse().join("");let s=0;for(;s<i;)n[s]=parseInt(t.slice(s<<3,(s<<3)+8),2),s++;this.value=n.buffer}}class ie{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):_.isBufferSource(e)?this.buffer=_.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof Ut))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new Ut({valueHex:this.buffer})}toSchema(e){return new Ut({name:e})}}const wf={fromASN:r=>r instanceof Mt?null:r.valueBeforeDecodeView,toASN:r=>{if(r===null)return new Mt;const e=or(r);if(e.result.error)throw new Error(e.result.error);return e.result}},Sf={fromASN:r=>r.valueBlock.valueHexView.byteLength>=4?r.valueBlock.toString():r.valueBlock.valueDec,toASN:r=>new nt({value:+r})},Af={fromASN:r=>r.valueBlock.valueDec,toASN:r=>new vi({value:r})},ce={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new nt({valueHex:r})},kf={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new Lt({valueHex:r})},Cf={fromASN:r=>r.valueBlock.toString(),toASN:r=>new wi({value:r})},xf={fromASN:r=>r.valueBlock.value,toASN:r=>new bi({value:r})},ji={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new Ut({valueHex:r})},Bf={fromASN:r=>new ie(r.getValue()),toASN:r=>r.toASN()};function He(r){return{fromASN:e=>e.valueBlock.value,toASN:e=>new r({value:e})}}const Ic=He(gt),Ef=He(Si),If=He(Ai),Nf=He(ki),Of=He(Ci),Tf=He(xi),Vf=He(Bi),_f=He(Ei),jf=He(Ii),Pf=He(Pr),Rf=He(Ni),Df=He(Oi),$f={fromASN:r=>r.toDate(),toASN:r=>new Rr({valueDate:r})},Mf={fromASN:r=>r.toDate(),toASN:r=>new Ti({valueDate:r})},Uf={fromASN:()=>null,toASN:()=>new Mt};function bo(r){switch(r){case h.Any:return wf;case h.BitString:return kf;case h.BmpString:return Ef;case h.Boolean:return xf;case h.CharacterString:return Df;case h.Enumerated:return Af;case h.GeneralString:return Rf;case h.GeneralizedTime:return Mf;case h.GraphicString:return jf;case h.IA5String:return _f;case h.Integer:return Sf;case h.Null:return Uf;case h.NumericString:return Nf;case h.ObjectIdentifier:return Cf;case h.OctetString:return ji;case h.PrintableString:return Of;case h.TeletexString:return Tf;case h.UTCTime:return $f;case h.UniversalString:return If;case h.Utf8String:return Ic;case h.VideotexString:return Vf;case h.VisibleString:return Pf;default:return null}}function mt(r){return typeof r=="function"&&r.prototype?r.prototype.toASN&&r.prototype.fromASN?!0:mt(r.prototype):!!(r&&typeof r=="object"&&"toASN"in r&&"fromASN"in r)}function Nc(r){var e;if(r){const t=Object.getPrototypeOf(r);return((e=t==null?void 0:t.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:Nc(t)}return!1}function Lf(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),i=new Uint8Array(e);for(let n=0;n<r.byteLength;n++)if(t[n]!==i[n])return!1;return!0}class Hf{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,t=!1){const i=this.items.get(e);if(!i)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(t&&!i.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return i}cache(e){const t=this.get(e);t.schema||(t.schema=this.create(e,!0))}createDefault(e){const t={type:x.Sequence,items:{}},i=this.findParentSchema(e);return i&&(Object.assign(t,i),t.items=Object.assign({},t.items,i.items)),t}create(e,t){const i=this.items.get(e)||this.createDefault(e),n=[];for(const s in i.items){const c=i.items[s],u=t?s:"";let f;if(typeof c.type=="number"){const b=h[c.type],y=Ec[b];if(!y)throw new Error(`Cannot get ASN1 class by name '${b}'`);f=new y({name:u})}else mt(c.type)?f=new c.type().toSchema(u):c.optional?this.get(c.type).type===x.Choice?f=new Ht({name:u}):(f=this.create(c.type,!1),f.name=u):f=new Ht({name:u});const p=!!c.optional||c.defaultValue!==void 0;if(c.repeated){f.name="";const b=c.repeated==="set"?yt:ht;f=new b({name:"",value:[new Vi({name:u,value:f})]})}if(c.context!==null&&c.context!==void 0)if(c.implicit)if(typeof c.type=="number"||mt(c.type)){const b=c.repeated?_e:jr;n.push(new b({name:u,optional:p,idBlock:{tagClass:3,tagNumber:c.context}}))}else{this.cache(c.type);const b=!!c.repeated;let y=b?f:this.get(c.type,!0).schema;y="valueBlock"in y?y.valueBlock.value:y.value,n.push(new _e({name:b?"":u,optional:p,idBlock:{tagClass:3,tagNumber:c.context},value:y}))}else n.push(new _e({optional:p,idBlock:{tagClass:3,tagNumber:c.context},value:[f]}));else f.optional=p,n.push(f)}switch(i.type){case x.Sequence:return new ht({value:n,name:""});case x.Set:return new yt({value:n,name:""});case x.Choice:return new mo({value:n,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,t){return this.items.set(e,t),this}findParentSchema(e){const t=Object.getPrototypeOf(e);return t?this.items.get(t)||this.findParentSchema(t):null}}const Fe=new Hf,B=r=>e=>{let t;Fe.has(e)?t=Fe.get(e):(t=Fe.createDefault(e),Fe.set(e,t)),Object.assign(t,r)},l=r=>(e,t)=>{let i;Fe.has(e.constructor)?i=Fe.get(e.constructor):(i=Fe.createDefault(e.constructor),Fe.set(e.constructor,i));const n=Object.assign({},r);if(typeof n.type=="number"&&!n.converter){const s=bo(r.type);if(!s)throw new Error(`Cannot get default converter for property '${t}' of ${e.constructor.name}`);n.converter=s}i.items[t]=n};class Oc extends Error{constructor(){super(...arguments),this.schemas=[]}}class Ff{static parse(e,t){const i=or(e);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,t)}static fromASN(e,t){var i;try{if(mt(t))return new t().fromASN(e);const n=Fe.get(t);Fe.cache(t);let s=n.schema;if(e.constructor===_e&&n.type!==x.Choice){s=new _e({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:n.schema.valueBlock.value});for(const f in n.items)delete e[f]}const c=Ft({},e,s);if(!c.verified)throw new Oc(`Data does not match to ${t.name} ASN1 schema. ${c.result.error}`);const u=new t;if(Nc(t)){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.");const f=n.itemType;if(typeof f=="number"){const p=bo(f);if(!p)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);return t.from(e.valueBlock.value,b=>p.fromASN(b))}else return t.from(e.valueBlock.value,p=>this.fromASN(p,f))}for(const f in n.items){const p=c.result[f];if(!p)continue;const b=n.items[f],y=b.type;if(typeof y=="number"||mt(y)){const q=(i=b.converter)!==null&&i!==void 0?i:mt(y)?new y:null;if(!q)throw new Error("Converter is empty");if(b.repeated)if(b.implicit){const O=b.repeated==="sequence"?ht:yt,d=new O;d.valueBlock=p.valueBlock;const g=or(d.toBER(!1));if(g.offset===-1)throw new Error(`Cannot parse the child item. ${g.result.error}`);if(!("value"in g.result.valueBlock&&Array.isArray(g.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const S=g.result.valueBlock.value;u[f]=Array.from(S,w=>q.fromASN(w))}else u[f]=Array.from(p,O=>q.fromASN(O));else{let O=p;if(b.implicit){let d;if(mt(y))d=new y().toSchema("");else{const g=h[y],S=Ec[g];if(!S)throw new Error(`Cannot get '${g}' class from asn1js module`);d=new S}d.valueBlock=O.valueBlock,O=or(d.toBER(!1)).result}u[f]=q.fromASN(O)}}else if(b.repeated){if(!Array.isArray(p))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");u[f]=Array.from(p,q=>this.fromASN(q,y))}else u[f]=this.fromASN(p,y)}return u}catch(n){throw n instanceof Oc&&n.schemas.push(t.name),n}}}class vo{static serialize(e){return e instanceof Se?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&mt(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const t=e.constructor,i=Fe.get(t);Fe.cache(t);let n=[];if(i.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof i.itemType=="number"){const c=bo(i.itemType);if(!c)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);n=e.map(u=>c.toASN(u))}else n=e.map(c=>this.toAsnItem({type:i.itemType},"[]",t,c))}else for(const c in i.items){const u=i.items[c],f=e[c];if(f===void 0||u.defaultValue===f||typeof u.defaultValue=="object"&&typeof f=="object"&&Lf(this.serialize(u.defaultValue),this.serialize(f)))continue;const p=vo.toAsnItem(u,c,t,f);if(typeof u.context=="number")if(u.implicit)if(!u.repeated&&(typeof u.type=="number"||mt(u.type))){const b={};b.valueHex=p instanceof Mt?p.valueBeforeDecodeView:p.valueBlock.toBER(),n.push(new jr({optional:u.optional,idBlock:{tagClass:3,tagNumber:u.context},...b}))}else n.push(new _e({optional:u.optional,idBlock:{tagClass:3,tagNumber:u.context},value:p.valueBlock.value}));else n.push(new _e({optional:u.optional,idBlock:{tagClass:3,tagNumber:u.context},value:[p]}));else u.repeated?n=n.concat(p):n.push(p)}let s;switch(i.type){case x.Sequence:s=new ht({value:n});break;case x.Set:s=new yt({value:n});break;case x.Choice:if(!n[0])throw new Error(`Schema '${t.name}' has wrong data. Choice cannot be empty.`);s=n[0];break}return s}static toAsnItem(e,t,i,n){let s;if(typeof e.type=="number"){const c=e.converter;if(!c)throw new Error(`Property '${t}' doesn't have converter for type ${h[e.type]} in schema '${i.name}'`);if(e.repeated){if(!Array.isArray(n))throw new TypeError("Parameter 'objProp' should be type of Array.");const u=Array.from(n,p=>c.toASN(p)),f=e.repeated==="sequence"?ht:yt;s=new f({value:u})}else s=c.toASN(n)}else if(e.repeated){if(!Array.isArray(n))throw new TypeError("Parameter 'objProp' should be type of Array.");const c=Array.from(n,f=>this.toASN(f)),u=e.repeated==="sequence"?ht:yt;s=new u({value:c})}else s=this.toASN(n);return s}}class oe extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const t of e)this.push(t)}}}class j{static serialize(e){return vo.serialize(e)}static parse(e,t){return Ff.parse(e,t)}static toString(e){const t=_.isBufferSource(e)?_.toArrayBuffer(e):j.serialize(e),i=or(t);if(i.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${i.result.error}`);return i.result.toString()}}function a(r,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,i);else for(var u=r.length-1;u>=0;u--)(c=r[u])&&(s=(n<3?c(s):n>3?c(e,t,s):c(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}typeof SuppressedError=="function"&&SuppressedError;var Tc={exports:{}};(function(r){(function(e){const t="(0?\\d+|0x[a-f0-9]+)",i={fourOctet:new RegExp(`^${t}\\.${t}\\.${t}\\.${t}$`,"i"),threeOctet:new RegExp(`^${t}\\.${t}\\.${t}$`,"i"),twoOctet:new RegExp(`^${t}\\.${t}$`,"i"),longValue:new RegExp(`^${t}$`,"i")},n=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),c="%[0-9a-z]{1,}",u="(?:[0-9a-f]+::?)+",f={zoneIndex:new RegExp(c,"i"),native:new RegExp(`^(::)?(${u})?([0-9a-f]+)?(::)?(${c})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${t}\\.${t}\\.${t}\\.${t}(${c})?)$`,"i"),transitional:new RegExp(`^((?:${u})|(?:::)(?:${u})?)${t}\\.${t}\\.${t}\\.${t}(${c})?$`,"i")};function p(d,g){if(d.indexOf("::")!==d.lastIndexOf("::"))return null;let S=0,w=-1,E=(d.match(f.zoneIndex)||[])[0],k,I;for(E&&(E=E.substring(1),d=d.replace(/%.+$/,""));(w=d.indexOf(":",w+1))>=0;)S++;if(d.substr(0,2)==="::"&&S--,d.substr(-2,2)==="::"&&S--,S>g)return null;for(I=g-S,k=":";I--;)k+="0:";return d=d.replace("::",k),d[0]===":"&&(d=d.slice(1)),d[d.length-1]===":"&&(d=d.slice(0,-1)),g=function(){const W=d.split(":"),se=[];for(let M=0;M<W.length;M++)se.push(parseInt(W[M],16));return se}(),{parts:g,zoneId:E}}function b(d,g,S,w){if(d.length!==g.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let E=0,k;for(;w>0;){if(k=S-w,k<0&&(k=0),d[E]>>k!==g[E]>>k)return!1;w-=S,E+=1}return!0}function y(d){if(s.test(d))return parseInt(d,16);if(d[0]==="0"&&!isNaN(parseInt(d[1],10))){if(n.test(d))return parseInt(d,8);throw new Error(`ipaddr: cannot parse ${d} as octal`)}return parseInt(d,10)}function q(d,g){for(;d.length<g;)d=`0${d}`;return d}const O={};O.IPv4=function(){function d(g){if(g.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let S,w;for(S=0;S<g.length;S++)if(w=g[S],!(0<=w&&w<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=g}return d.prototype.SpecialRanges={unspecified:[[new d([0,0,0,0]),8]],broadcast:[[new d([255,255,255,255]),32]],multicast:[[new d([224,0,0,0]),4]],linkLocal:[[new d([169,254,0,0]),16]],loopback:[[new d([127,0,0,0]),8]],carrierGradeNat:[[new d([100,64,0,0]),10]],private:[[new d([10,0,0,0]),8],[new d([172,16,0,0]),12],[new d([192,168,0,0]),16]],reserved:[[new d([192,0,0,0]),24],[new d([192,0,2,0]),24],[new d([192,88,99,0]),24],[new d([198,18,0,0]),15],[new d([198,51,100,0]),24],[new d([203,0,113,0]),24],[new d([240,0,0,0]),4]],as112:[[new d([192,175,48,0]),24],[new d([192,31,196,0]),24]],amt:[[new d([192,52,193,0]),24]]},d.prototype.kind=function(){return"ipv4"},d.prototype.match=function(g,S){let w;if(S===void 0&&(w=g,g=w[0],S=w[1]),g.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return b(this.octets,g.octets,8,S)},d.prototype.prefixLengthFromSubnetMask=function(){let g=0,S=!1;const w={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let E,k,I;for(E=3;E>=0;E-=1)if(k=this.octets[E],k in w){if(I=w[k],S&&I!==0)return null;I!==8&&(S=!0),g+=I}else return null;return 32-g},d.prototype.range=function(){return O.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){return this.octets.slice(0)},d.prototype.toIPv4MappedAddress=function(){return O.IPv6.parse(`::ffff:${this.toString()}`)},d.prototype.toNormalizedString=function(){return this.toString()},d.prototype.toString=function(){return this.octets.join(".")},d}(),O.IPv4.broadcastAddressFromCIDR=function(d){try{const g=this.parseCIDR(d),S=g[0].toByteArray(),w=this.subnetMaskFromPrefixLength(g[1]).toByteArray(),E=[];let k=0;for(;k<4;)E.push(parseInt(S[k],10)|parseInt(w[k],10)^255),k++;return new this(E)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},O.IPv4.isIPv4=function(d){return this.parser(d)!==null},O.IPv4.isValid=function(d){try{return new this(this.parser(d)),!0}catch{return!1}},O.IPv4.isValidCIDR=function(d){try{return this.parseCIDR(d),!0}catch{return!1}},O.IPv4.isValidFourPartDecimal=function(d){return!!(O.IPv4.isValid(d)&&d.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},O.IPv4.networkAddressFromCIDR=function(d){let g,S,w,E,k;try{for(g=this.parseCIDR(d),w=g[0].toByteArray(),k=this.subnetMaskFromPrefixLength(g[1]).toByteArray(),E=[],S=0;S<4;)E.push(parseInt(w[S],10)&parseInt(k[S],10)),S++;return new this(E)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},O.IPv4.parse=function(d){const g=this.parser(d);if(g===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(g)},O.IPv4.parseCIDR=function(d){let g;if(g=d.match(/^(.+)\/(\d+)$/)){const S=parseInt(g[2]);if(S>=0&&S<=32){const w=[this.parse(g[1]),S];return Object.defineProperty(w,"toString",{value:function(){return this.join("/")}}),w}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},O.IPv4.parser=function(d){let g,S,w;if(g=d.match(i.fourOctet))return function(){const E=g.slice(1,6),k=[];for(let I=0;I<E.length;I++)S=E[I],k.push(y(S));return k}();if(g=d.match(i.longValue)){if(w=y(g[1]),w>4294967295||w<0)throw new Error("ipaddr: address outside defined range");return function(){const E=[];let k;for(k=0;k<=24;k+=8)E.push(w>>k&255);return E}().reverse()}else return(g=d.match(i.twoOctet))?function(){const E=g.slice(1,4),k=[];if(w=y(E[1]),w>16777215||w<0)throw new Error("ipaddr: address outside defined range");return k.push(y(E[0])),k.push(w>>16&255),k.push(w>>8&255),k.push(w&255),k}():(g=d.match(i.threeOctet))?function(){const E=g.slice(1,5),k=[];if(w=y(E[2]),w>65535||w<0)throw new Error("ipaddr: address outside defined range");return k.push(y(E[0])),k.push(y(E[1])),k.push(w>>8&255),k.push(w&255),k}():null},O.IPv4.subnetMaskFromPrefixLength=function(d){if(d=parseInt(d),d<0||d>32)throw new Error("ipaddr: invalid IPv4 prefix length");const g=[0,0,0,0];let S=0;const w=Math.floor(d/8);for(;S<w;)g[S]=255,S++;return w<4&&(g[w]=Math.pow(2,d%8)-1<<8-d%8),new this(g)},O.IPv6=function(){function d(g,S){let w,E;if(g.length===16)for(this.parts=[],w=0;w<=14;w+=2)this.parts.push(g[w]<<8|g[w+1]);else if(g.length===8)this.parts=g;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(w=0;w<this.parts.length;w++)if(E=this.parts[w],!(0<=E&&E<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");S&&(this.zoneId=S)}return d.prototype.SpecialRanges={unspecified:[new d([0,0,0,0,0,0,0,0]),128],linkLocal:[new d([65152,0,0,0,0,0,0,0]),10],multicast:[new d([65280,0,0,0,0,0,0,0]),8],loopback:[new d([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new d([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new d([0,0,0,0,0,65535,0,0]),96],discard:[new d([256,0,0,0,0,0,0,0]),64],rfc6145:[new d([0,0,0,0,65535,0,0,0]),96],rfc6052:[new d([100,65435,0,0,0,0,0,0]),96],"6to4":[new d([8194,0,0,0,0,0,0,0]),16],teredo:[new d([8193,0,0,0,0,0,0,0]),32],benchmarking:[new d([8193,2,0,0,0,0,0,0]),48],amt:[new d([8193,3,0,0,0,0,0,0]),32],as112v6:[[new d([8193,4,274,0,0,0,0,0]),48],[new d([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new d([8193,16,0,0,0,0,0,0]),28],orchid2:[new d([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new d([8193,48,0,0,0,0,0,0]),28],reserved:[[new d([8193,0,0,0,0,0,0,0]),23],[new d([8193,3512,0,0,0,0,0,0]),32]]},d.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},d.prototype.kind=function(){return"ipv6"},d.prototype.match=function(g,S){let w;if(S===void 0&&(w=g,g=w[0],S=w[1]),g.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return b(this.parts,g.parts,16,S)},d.prototype.prefixLengthFromSubnetMask=function(){let g=0,S=!1;const w={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let E,k;for(let I=7;I>=0;I-=1)if(E=this.parts[I],E in w){if(k=w[E],S&&k!==0)return null;k!==16&&(S=!0),g+=k}else return null;return 128-g},d.prototype.range=function(){return O.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){let g;const S=[],w=this.parts;for(let E=0;E<w.length;E++)g=w[E],S.push(g>>8),S.push(g&255);return S},d.prototype.toFixedLengthString=function(){const g=(function(){const w=[];for(let E=0;E<this.parts.length;E++)w.push(q(this.parts[E].toString(16),4));return w}).call(this).join(":");let S="";return this.zoneId&&(S=`%${this.zoneId}`),g+S},d.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const g=this.parts.slice(-2),S=g[0],w=g[1];return new O.IPv4([S>>8,S&255,w>>8,w&255])},d.prototype.toNormalizedString=function(){const g=(function(){const w=[];for(let E=0;E<this.parts.length;E++)w.push(this.parts[E].toString(16));return w}).call(this).join(":");let S="";return this.zoneId&&(S=`%${this.zoneId}`),g+S},d.prototype.toRFC5952String=function(){const g=/((^|:)(0(:|$)){2,})/g,S=this.toNormalizedString();let w=0,E=-1,k;for(;k=g.exec(S);)k[0].length>E&&(w=k.index,E=k[0].length);return E<0?S:`${S.substring(0,w)}::${S.substring(w+E)}`},d.prototype.toString=function(){return this.toRFC5952String()},d}(),O.IPv6.broadcastAddressFromCIDR=function(d){try{const g=this.parseCIDR(d),S=g[0].toByteArray(),w=this.subnetMaskFromPrefixLength(g[1]).toByteArray(),E=[];let k=0;for(;k<16;)E.push(parseInt(S[k],10)|parseInt(w[k],10)^255),k++;return new this(E)}catch(g){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${g})`)}},O.IPv6.isIPv6=function(d){return this.parser(d)!==null},O.IPv6.isValid=function(d){if(typeof d=="string"&&d.indexOf(":")===-1)return!1;try{const g=this.parser(d);return new this(g.parts,g.zoneId),!0}catch{return!1}},O.IPv6.isValidCIDR=function(d){if(typeof d=="string"&&d.indexOf(":")===-1)return!1;try{return this.parseCIDR(d),!0}catch{return!1}},O.IPv6.networkAddressFromCIDR=function(d){let g,S,w,E,k;try{for(g=this.parseCIDR(d),w=g[0].toByteArray(),k=this.subnetMaskFromPrefixLength(g[1]).toByteArray(),E=[],S=0;S<16;)E.push(parseInt(w[S],10)&parseInt(k[S],10)),S++;return new this(E)}catch(I){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${I})`)}},O.IPv6.parse=function(d){const g=this.parser(d);if(g.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(g.parts,g.zoneId)},O.IPv6.parseCIDR=function(d){let g,S,w;if((S=d.match(/^(.+)\/(\d+)$/))&&(g=parseInt(S[2]),g>=0&&g<=128))return w=[this.parse(S[1]),g],Object.defineProperty(w,"toString",{value:function(){return this.join("/")}}),w;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},O.IPv6.parser=function(d){let g,S,w,E,k,I;if(w=d.match(f.deprecatedTransitional))return this.parser(`::ffff:${w[1]}`);if(f.native.test(d))return p(d,8);if((w=d.match(f.transitional))&&(I=w[6]||"",g=w[1],w[1].endsWith("::")||(g=g.slice(0,-1)),g=p(g+I,6),g.parts)){for(k=[parseInt(w[2]),parseInt(w[3]),parseInt(w[4]),parseInt(w[5])],S=0;S<k.length;S++)if(E=k[S],!(0<=E&&E<=255))return null;return g.parts.push(k[0]<<8|k[1]),g.parts.push(k[2]<<8|k[3]),{parts:g.parts,zoneId:g.zoneId}}return null},O.IPv6.subnetMaskFromPrefixLength=function(d){if(d=parseInt(d),d<0||d>128)throw new Error("ipaddr: invalid IPv6 prefix length");const g=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let S=0;const w=Math.floor(d/8);for(;S<w;)g[S]=255,S++;return w<16&&(g[w]=Math.pow(2,d%8)-1<<8-d%8),new this(g)},O.fromByteArray=function(d){const g=d.length;if(g===4)return new O.IPv4(d);if(g===16)return new O.IPv6(d);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},O.isValid=function(d){return O.IPv6.isValid(d)||O.IPv4.isValid(d)},O.isValidCIDR=function(d){return O.IPv6.isValidCIDR(d)||O.IPv4.isValidCIDR(d)},O.parse=function(d){if(O.IPv6.isValid(d))return O.IPv6.parse(d);if(O.IPv4.isValid(d))return O.IPv4.parse(d);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},O.parseCIDR=function(d){try{return O.IPv6.parseCIDR(d)}catch{try{return O.IPv4.parseCIDR(d)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},O.process=function(d){const g=this.parse(d);return g.kind()==="ipv6"&&g.isIPv4MappedAddress()?g.toIPv4Address():g},O.subnetMatch=function(d,g,S){let w,E,k,I;S==null&&(S="unicast");for(E in g)if(Object.prototype.hasOwnProperty.call(g,E)){for(k=g[E],k[0]&&!(k[0]instanceof Array)&&(k=[k]),w=0;w<k.length;w++)if(I=k[w],d.kind()===I[0].kind()&&d.match.apply(d,I))return E}return S},r.exports?r.exports=O:e.ipaddr=O})(eo)})(Tc);var Vc=Tc.exports;class _c{static decodeIP(e){if(e.length===64&&parseInt(e,16)===0)return"::/0";if(e.length!==16)return e;const t=parseInt(e.slice(8),16).toString(2).split("").reduce((n,s)=>n+ +s,0);let i=e.slice(0,8).replace(/(.{2})/g,n=>`${parseInt(n,16)}.`);return i=i.slice(0,-1),`${i}/${t}`}static toString(e){if(e.byteLength===4||e.byteLength===16){const t=new Uint8Array(e);return Vc.fromByteArray(Array.from(t)).toString()}return this.decodeIP(L.ToHex(e))}static fromString(e){const t=Vc.parse(e);return new Uint8Array(t.toByteArray()).buffer}}var wo,So,Ao;let Ae=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};a([l({type:h.TeletexString})],Ae.prototype,"teletexString",void 0),a([l({type:h.PrintableString})],Ae.prototype,"printableString",void 0),a([l({type:h.UniversalString})],Ae.prototype,"universalString",void 0),a([l({type:h.Utf8String})],Ae.prototype,"utf8String",void 0),a([l({type:h.BmpString})],Ae.prototype,"bmpString",void 0),Ae=a([B({type:x.Choice})],Ae);let sr=class extends Ae{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?L.ToHex(this.anyValue):super.toString())}};a([l({type:h.IA5String})],sr.prototype,"ia5String",void 0),a([l({type:h.Any})],sr.prototype,"anyValue",void 0),sr=a([B({type:x.Choice})],sr);class Pi{constructor(e={}){this.type="",this.value=new sr,Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Pi.prototype,"type",void 0),a([l({type:sr})],Pi.prototype,"value",void 0);let ar=wo=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,wo.prototype)}};ar=wo=a([B({type:x.Set,itemType:Pi})],ar);let ko=So=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,So.prototype)}};ko=So=a([B({type:x.Sequence,itemType:ar})],ko);let ye=Ao=class extends ko{constructor(e){super(e),Object.setPrototypeOf(this,Ao.prototype)}};ye=Ao=a([B({type:x.Sequence})],ye);const qf={fromASN:r=>_c.toString(ji.fromASN(r)),toASN:r=>ji.toASN(_c.fromString(r))};class Dr{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Dr.prototype,"typeId",void 0),a([l({type:h.Any,context:0})],Dr.prototype,"value",void 0);class Co{constructor(e={}){this.partyName=new Ae,Object.assign(this,e)}}a([l({type:Ae,optional:!0,context:0,implicit:!0})],Co.prototype,"nameAssigner",void 0),a([l({type:Ae,context:1,implicit:!0})],Co.prototype,"partyName",void 0);let X=class{constructor(e={}){Object.assign(this,e)}};a([l({type:Dr,context:0,implicit:!0})],X.prototype,"otherName",void 0),a([l({type:h.IA5String,context:1,implicit:!0})],X.prototype,"rfc822Name",void 0),a([l({type:h.IA5String,context:2,implicit:!0})],X.prototype,"dNSName",void 0),a([l({type:h.Any,context:3,implicit:!0})],X.prototype,"x400Address",void 0),a([l({type:ye,context:4,implicit:!1})],X.prototype,"directoryName",void 0),a([l({type:Co,context:5})],X.prototype,"ediPartyName",void 0),a([l({type:h.IA5String,context:6,implicit:!0})],X.prototype,"uniformResourceIdentifier",void 0),a([l({type:h.OctetString,context:7,implicit:!0,converter:qf})],X.prototype,"iPAddress",void 0),a([l({type:h.ObjectIdentifier,context:8,implicit:!0})],X.prototype,"registeredID",void 0),X=a([B({type:x.Choice})],X);const xo="1.3.6.1.5.5.7",Kf=`${xo}.1`,cr=`${xo}.3`,Ri=`${xo}.48`,jc=`${Ri}.1`,Pc=`${Ri}.2`,Rc=`${Ri}.3`,Dc=`${Ri}.5`,Bt="2.5.29";var Bo;const Eo=`${Kf}.1`;class $r{constructor(e={}){this.accessMethod="",this.accessLocation=new X,Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],$r.prototype,"accessMethod",void 0),a([l({type:X})],$r.prototype,"accessLocation",void 0);let lr=Bo=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,Bo.prototype)}};lr=Bo=a([B({type:x.Sequence,itemType:$r})],lr);const Io=`${Bt}.35`;class No extends ie{}class qt{constructor(e={}){e&&Object.assign(this,e)}}a([l({type:No,context:0,optional:!0,implicit:!0})],qt.prototype,"keyIdentifier",void 0),a([l({type:X,context:1,optional:!0,implicit:!0,repeated:"sequence"})],qt.prototype,"authorityCertIssuer",void 0),a([l({type:h.Integer,context:2,optional:!0,implicit:!0,converter:ce})],qt.prototype,"authorityCertSerialNumber",void 0);const $c=`${Bt}.19`;class Di{constructor(e={}){this.cA=!1,Object.assign(this,e)}}a([l({type:h.Boolean,defaultValue:!1})],Di.prototype,"cA",void 0),a([l({type:h.Integer,optional:!0})],Di.prototype,"pathLenConstraint",void 0);var Oo;let Ne=Oo=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,Oo.prototype)}};Ne=Oo=a([B({type:x.Sequence,itemType:X})],Ne);var To;let Mc=To=class extends Ne{constructor(e){super(e),Object.setPrototypeOf(this,To.prototype)}};Mc=To=a([B({type:x.Sequence})],Mc);var Vo;const Uc=`${Bt}.32`;let bt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};a([l({type:h.IA5String})],bt.prototype,"ia5String",void 0),a([l({type:h.VisibleString})],bt.prototype,"visibleString",void 0),a([l({type:h.BmpString})],bt.prototype,"bmpString",void 0),a([l({type:h.Utf8String})],bt.prototype,"utf8String",void 0),bt=a([B({type:x.Choice})],bt);class _o{constructor(e={}){this.organization=new bt,this.noticeNumbers=[],Object.assign(this,e)}}a([l({type:bt})],_o.prototype,"organization",void 0),a([l({type:h.Integer,repeated:"sequence"})],_o.prototype,"noticeNumbers",void 0);class jo{constructor(e={}){Object.assign(this,e)}}a([l({type:_o,optional:!0})],jo.prototype,"noticeRef",void 0),a([l({type:bt,optional:!0})],jo.prototype,"explicitText",void 0);let $i=class{constructor(e={}){Object.assign(this,e)}};a([l({type:h.IA5String})],$i.prototype,"cPSuri",void 0),a([l({type:jo})],$i.prototype,"userNotice",void 0),$i=a([B({type:x.Choice})],$i);class Po{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Po.prototype,"policyQualifierId",void 0),a([l({type:h.Any})],Po.prototype,"qualifier",void 0);class Mi{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Mi.prototype,"policyIdentifier",void 0),a([l({type:Po,repeated:"sequence",optional:!0})],Mi.prototype,"policyQualifiers",void 0);let Ui=Vo=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,Vo.prototype)}};Ui=Vo=a([B({type:x.Sequence,itemType:Mi})],Ui);let Li=class{constructor(e=0){this.value=e}};a([l({type:h.Integer})],Li.prototype,"value",void 0),Li=a([B({type:x.Choice})],Li);let Lc=class extends Li{};Lc=a([B({type:x.Choice})],Lc);var Ro;const Do=`${Bt}.31`;var Je;(function(r){r[r.unused=1]="unused",r[r.keyCompromise=2]="keyCompromise",r[r.cACompromise=4]="cACompromise",r[r.affiliationChanged=8]="affiliationChanged",r[r.superseded=16]="superseded",r[r.cessationOfOperation=32]="cessationOfOperation",r[r.certificateHold=64]="certificateHold",r[r.privilegeWithdrawn=128]="privilegeWithdrawn",r[r.aACompromise=256]="aACompromise"})(Je||(Je={}));class Hc extends _i{toJSON(){const e=[],t=this.toNumber();return t&Je.aACompromise&&e.push("aACompromise"),t&Je.affiliationChanged&&e.push("affiliationChanged"),t&Je.cACompromise&&e.push("cACompromise"),t&Je.certificateHold&&e.push("certificateHold"),t&Je.cessationOfOperation&&e.push("cessationOfOperation"),t&Je.keyCompromise&&e.push("keyCompromise"),t&Je.privilegeWithdrawn&&e.push("privilegeWithdrawn"),t&Je.superseded&&e.push("superseded"),t&Je.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let Kt=class{constructor(e={}){Object.assign(this,e)}};a([l({type:X,context:0,repeated:"sequence",implicit:!0})],Kt.prototype,"fullName",void 0),a([l({type:ar,context:1,implicit:!0})],Kt.prototype,"nameRelativeToCRLIssuer",void 0),Kt=a([B({type:x.Choice})],Kt);class ur{constructor(e={}){Object.assign(this,e)}}a([l({type:Kt,context:0,optional:!0})],ur.prototype,"distributionPoint",void 0),a([l({type:Hc,context:1,optional:!0,implicit:!0})],ur.prototype,"reasons",void 0),a([l({type:X,context:2,optional:!0,repeated:"sequence",implicit:!0})],ur.prototype,"cRLIssuer",void 0);let fr=Ro=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,Ro.prototype)}};fr=Ro=a([B({type:x.Sequence,itemType:ur})],fr);var $o;let Fc=$o=class extends fr{constructor(e){super(e),Object.setPrototypeOf(this,$o.prototype)}};Fc=$o=a([B({type:x.Sequence,itemType:ur})],Fc);class Be{constructor(e={}){this.onlyContainsUserCerts=Be.ONLY,this.onlyContainsCACerts=Be.ONLY,this.indirectCRL=Be.ONLY,this.onlyContainsAttributeCerts=Be.ONLY,Object.assign(this,e)}}Be.ONLY=!1,a([l({type:Kt,context:0,optional:!0})],Be.prototype,"distributionPoint",void 0),a([l({type:h.Boolean,context:1,defaultValue:Be.ONLY,implicit:!0})],Be.prototype,"onlyContainsUserCerts",void 0),a([l({type:h.Boolean,context:2,defaultValue:Be.ONLY,implicit:!0})],Be.prototype,"onlyContainsCACerts",void 0),a([l({type:Hc,context:3,optional:!0,implicit:!0})],Be.prototype,"onlySomeReasons",void 0),a([l({type:h.Boolean,context:4,defaultValue:Be.ONLY,implicit:!0})],Be.prototype,"indirectCRL",void 0),a([l({type:h.Boolean,context:5,defaultValue:Be.ONLY,implicit:!0})],Be.prototype,"onlyContainsAttributeCerts",void 0);var Mr;(function(r){r[r.unspecified=0]="unspecified",r[r.keyCompromise=1]="keyCompromise",r[r.cACompromise=2]="cACompromise",r[r.affiliationChanged=3]="affiliationChanged",r[r.superseded=4]="superseded",r[r.cessationOfOperation=5]="cessationOfOperation",r[r.certificateHold=6]="certificateHold",r[r.removeFromCRL=8]="removeFromCRL",r[r.privilegeWithdrawn=9]="privilegeWithdrawn",r[r.aACompromise=10]="aACompromise"})(Mr||(Mr={}));let Mo=class{constructor(e=Mr.unspecified){this.reason=Mr.unspecified,this.reason=e}toJSON(){return Mr[this.reason]}toString(){return this.toJSON()}};a([l({type:h.Enumerated})],Mo.prototype,"reason",void 0),Mo=a([B({type:x.Choice})],Mo);var Uo;const qc=`${Bt}.37`;let Hi=Uo=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,Uo.prototype)}};Hi=Uo=a([B({type:x.Sequence,itemType:h.ObjectIdentifier})],Hi);const zf=`${cr}.1`,Gf=`${cr}.2`,Wf=`${cr}.3`,Jf=`${cr}.4`,Yf=`${cr}.8`,Zf=`${cr}.9`;let Lo=class{constructor(e=new ArrayBuffer(0)){this.value=e}};a([l({type:h.Integer,converter:ce})],Lo.prototype,"value",void 0),Lo=a([B({type:x.Choice})],Lo);let Ho=class{constructor(e){this.value=new Date,e&&(this.value=e)}};a([l({type:h.GeneralizedTime})],Ho.prototype,"value",void 0),Ho=a([B({type:x.Choice})],Ho);var Fo;let Kc=Fo=class extends Ne{constructor(e){super(e),Object.setPrototypeOf(this,Fo.prototype)}};Kc=Fo=a([B({type:x.Sequence})],Kc);const zc=`${Bt}.15`;var Ye;(function(r){r[r.digitalSignature=1]="digitalSignature",r[r.nonRepudiation=2]="nonRepudiation",r[r.keyEncipherment=4]="keyEncipherment",r[r.dataEncipherment=8]="dataEncipherment",r[r.keyAgreement=16]="keyAgreement",r[r.keyCertSign=32]="keyCertSign",r[r.cRLSign=64]="cRLSign",r[r.encipherOnly=128]="encipherOnly",r[r.decipherOnly=256]="decipherOnly"})(Ye||(Ye={}));class qo extends _i{toJSON(){const e=this.toNumber(),t=[];return e&Ye.cRLSign&&t.push("crlSign"),e&Ye.dataEncipherment&&t.push("dataEncipherment"),e&Ye.decipherOnly&&t.push("decipherOnly"),e&Ye.digitalSignature&&t.push("digitalSignature"),e&Ye.encipherOnly&&t.push("encipherOnly"),e&Ye.keyAgreement&&t.push("keyAgreement"),e&Ye.keyCertSign&&t.push("keyCertSign"),e&Ye.keyEncipherment&&t.push("keyEncipherment"),e&Ye.nonRepudiation&&t.push("nonRepudiation"),t}toString(){return`[${this.toJSON().join(", ")}]`}}var Ko;class Fi{constructor(e={}){this.base=new X,this.minimum=0,Object.assign(this,e)}}a([l({type:X})],Fi.prototype,"base",void 0),a([l({type:h.Integer,context:0,defaultValue:0,implicit:!0})],Fi.prototype,"minimum",void 0),a([l({type:h.Integer,context:1,optional:!0,implicit:!0})],Fi.prototype,"maximum",void 0);let qi=Ko=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,Ko.prototype)}};qi=Ko=a([B({type:x.Sequence,itemType:Fi})],qi);class Gc{constructor(e={}){Object.assign(this,e)}}a([l({type:qi,context:0,optional:!0,implicit:!0})],Gc.prototype,"permittedSubtrees",void 0),a([l({type:qi,context:1,optional:!0,implicit:!0})],Gc.prototype,"excludedSubtrees",void 0);class Wc{constructor(e={}){Object.assign(this,e)}}a([l({type:h.Integer,context:0,implicit:!0,optional:!0,converter:ce})],Wc.prototype,"requireExplicitPolicy",void 0),a([l({type:h.Integer,context:1,implicit:!0,optional:!0,converter:ce})],Wc.prototype,"inhibitPolicyMapping",void 0);var zo;class Go{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Go.prototype,"issuerDomainPolicy",void 0),a([l({type:h.ObjectIdentifier})],Go.prototype,"subjectDomainPolicy",void 0);let Jc=zo=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,zo.prototype)}};Jc=zo=a([B({type:x.Sequence,itemType:Go})],Jc);var Wo;const Yc=`${Bt}.17`;let Jo=Wo=class extends Ne{constructor(e){super(e),Object.setPrototypeOf(this,Wo.prototype)}};Jo=Wo=a([B({type:x.Sequence})],Jo);let vt=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};a([l({type:h.ObjectIdentifier})],vt.prototype,"type",void 0),a([l({type:h.Any,repeated:"set"})],vt.prototype,"values",void 0);var Yo;let Zc=Yo=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,Yo.prototype)}};Zc=Yo=a([B({type:x.Sequence,itemType:vt})],Zc);const Qc=`${Bt}.14`;class Et extends No{}class Xc{constructor(e={}){Object.assign(this,e)}}a([l({type:h.GeneralizedTime,context:0,implicit:!0,optional:!0})],Xc.prototype,"notBefore",void 0),a([l({type:h.GeneralizedTime,context:1,implicit:!0,optional:!0})],Xc.prototype,"notAfter",void 0);var Ur;(function(r){r[r.keyUpdateAllowed=1]="keyUpdateAllowed",r[r.newExtensions=2]="newExtensions",r[r.pKIXCertificate=4]="pKIXCertificate"})(Ur||(Ur={}));class el extends _i{toJSON(){const e=[],t=this.toNumber();return t&Ur.pKIXCertificate&&e.push("pKIXCertificate"),t&Ur.newExtensions&&e.push("newExtensions"),t&Ur.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class tl{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new el,Object.assign(this,e)}}a([l({type:h.GeneralString})],tl.prototype,"entrustVers",void 0),a([l({type:el})],tl.prototype,"entrustInfoFlags",void 0);var Zo;let rl=Zo=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,Zo.prototype)}};rl=Zo=a([B({type:x.Sequence,itemType:$r})],rl);class R{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof R&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&Ba(e.parameters,this.parameters)||e.parameters===this.parameters)}}a([l({type:h.ObjectIdentifier})],R.prototype,"algorithm",void 0),a([l({type:h.Any,optional:!0})],R.prototype,"parameters",void 0);class ot{constructor(e={}){this.algorithm=new R,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:R})],ot.prototype,"algorithm",void 0),a([l({type:h.BitString})],ot.prototype,"subjectPublicKey",void 0);let ke=class{constructor(e){if(e)if(typeof e=="string"||typeof e=="number"||e instanceof Date){const t=new Date(e);t.getUTCFullYear()>2049?this.generalTime=t:this.utcTime=t}else Object.assign(this,e)}getTime(){const e=this.utcTime||this.generalTime;if(!e)throw new Error("Cannot get time from CHOICE object");return e}};a([l({type:h.UTCTime})],ke.prototype,"utcTime",void 0),a([l({type:h.GeneralizedTime})],ke.prototype,"generalTime",void 0),ke=a([B({type:x.Choice})],ke);class Ki{constructor(e){this.notBefore=new ke(new Date),this.notAfter=new ke(new Date),e&&(this.notBefore=new ke(e.notBefore),this.notAfter=new ke(e.notAfter))}}a([l({type:ke})],Ki.prototype,"notBefore",void 0),a([l({type:ke})],Ki.prototype,"notAfter",void 0);var Qo;let Ze=class Yu{constructor(e={}){this.extnID="",this.critical=Yu.CRITICAL,this.extnValue=new ie,Object.assign(this,e)}};Ze.CRITICAL=!1,a([l({type:h.ObjectIdentifier})],Ze.prototype,"extnID",void 0),a([l({type:h.Boolean,defaultValue:Ze.CRITICAL})],Ze.prototype,"critical",void 0),a([l({type:ie})],Ze.prototype,"extnValue",void 0);let zt=Qo=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,Qo.prototype)}};zt=Qo=a([B({type:x.Sequence,itemType:Ze})],zt);var dr;(function(r){r[r.v1=0]="v1",r[r.v2=1]="v2",r[r.v3=2]="v3"})(dr||(dr={}));class qe{constructor(e={}){this.version=dr.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new R,this.issuer=new ye,this.validity=new Ki,this.subject=new ye,this.subjectPublicKeyInfo=new ot,Object.assign(this,e)}}a([l({type:h.Integer,context:0,defaultValue:dr.v1})],qe.prototype,"version",void 0),a([l({type:h.Integer,converter:ce})],qe.prototype,"serialNumber",void 0),a([l({type:R})],qe.prototype,"signature",void 0),a([l({type:ye})],qe.prototype,"issuer",void 0),a([l({type:Ki})],qe.prototype,"validity",void 0),a([l({type:ye})],qe.prototype,"subject",void 0),a([l({type:ot})],qe.prototype,"subjectPublicKeyInfo",void 0),a([l({type:h.BitString,context:1,implicit:!0,optional:!0})],qe.prototype,"issuerUniqueID",void 0),a([l({type:h.BitString,context:2,implicit:!0,optional:!0})],qe.prototype,"subjectUniqueID",void 0),a([l({type:zt,context:3,optional:!0})],qe.prototype,"extensions",void 0);class pr{constructor(e={}){this.tbsCertificate=new qe,this.signatureAlgorithm=new R,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:qe})],pr.prototype,"tbsCertificate",void 0),a([l({type:R})],pr.prototype,"signatureAlgorithm",void 0),a([l({type:h.BitString})],pr.prototype,"signatureValue",void 0);class zi{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new ke,Object.assign(this,e)}}a([l({type:h.Integer,converter:ce})],zi.prototype,"userCertificate",void 0),a([l({type:ke})],zi.prototype,"revocationDate",void 0),a([l({type:Ze,optional:!0,repeated:"sequence"})],zi.prototype,"crlEntryExtensions",void 0);class wt{constructor(e={}){this.signature=new R,this.issuer=new ye,this.thisUpdate=new ke,Object.assign(this,e)}}a([l({type:h.Integer,optional:!0})],wt.prototype,"version",void 0),a([l({type:R})],wt.prototype,"signature",void 0),a([l({type:ye})],wt.prototype,"issuer",void 0),a([l({type:ke})],wt.prototype,"thisUpdate",void 0),a([l({type:ke,optional:!0})],wt.prototype,"nextUpdate",void 0),a([l({type:zi,repeated:"sequence",optional:!0})],wt.prototype,"revokedCertificates",void 0),a([l({type:Ze,optional:!0,context:0,repeated:"sequence"})],wt.prototype,"crlExtensions",void 0);let Xo=class{constructor(e={}){this.tbsCertList=new wt,this.signatureAlgorithm=new R,this.signature=new ArrayBuffer(0),Object.assign(this,e)}};a([l({type:wt})],Xo.prototype,"tbsCertList",void 0),a([l({type:R})],Xo.prototype,"signatureAlgorithm",void 0),a([l({type:h.BitString})],Xo.prototype,"signature",void 0);class hr{constructor(e={}){this.issuer=new ye,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:ye})],hr.prototype,"issuer",void 0),a([l({type:h.Integer,converter:ce})],hr.prototype,"serialNumber",void 0);let yr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:Et,context:0,implicit:!0})],yr.prototype,"subjectKeyIdentifier",void 0),a([l({type:hr})],yr.prototype,"issuerAndSerialNumber",void 0),yr=a([B({type:x.Choice})],yr);var St;(function(r){r[r.v0=0]="v0",r[r.v1=1]="v1",r[r.v2=2]="v2",r[r.v3=3]="v3",r[r.v4=4]="v4",r[r.v5=5]="v5"})(St||(St={}));let Lr=class extends R{};Lr=a([B({type:x.Sequence})],Lr);let Gi=class extends R{};Gi=a([B({type:x.Sequence})],Gi);let st=class extends R{};st=a([B({type:x.Sequence})],st);let Wi=class extends R{};Wi=a([B({type:x.Sequence})],Wi);let il=class extends R{};il=a([B({type:x.Sequence})],il);let es=class extends R{};es=a([B({type:x.Sequence})],es);let gr=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};a([l({type:h.ObjectIdentifier})],gr.prototype,"attrType",void 0),a([l({type:h.Any,repeated:"set"})],gr.prototype,"attrValues",void 0);var ts;class at{constructor(e={}){this.version=St.v0,this.sid=new yr,this.digestAlgorithm=new Lr,this.signatureAlgorithm=new Gi,this.signature=new ie,Object.assign(this,e)}}a([l({type:h.Integer})],at.prototype,"version",void 0),a([l({type:yr})],at.prototype,"sid",void 0),a([l({type:Lr})],at.prototype,"digestAlgorithm",void 0),a([l({type:gr,repeated:"set",context:0,implicit:!0,optional:!0})],at.prototype,"signedAttrs",void 0),a([l({type:Gi})],at.prototype,"signatureAlgorithm",void 0),a([l({type:ie})],at.prototype,"signature",void 0),a([l({type:gr,repeated:"set",context:1,implicit:!0,optional:!0})],at.prototype,"unsignedAttrs",void 0);let Ji=ts=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,ts.prototype)}};Ji=ts=a([B({type:x.Set,itemType:at})],Ji);let nl=class extends ke{};nl=a([B({type:x.Choice})],nl);let ol=class extends at{};ol=a([B({type:x.Sequence})],ol);class rs{constructor(e={}){this.acIssuer=new X,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}a([l({type:X})],rs.prototype,"acIssuer",void 0),a([l({type:h.Integer})],rs.prototype,"acSerial",void 0),a([l({type:vt,repeated:"sequence"})],rs.prototype,"attrs",void 0);var is;let Yi=is=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,is.prototype)}};Yi=is=a([B({type:x.Sequence,itemType:h.ObjectIdentifier})],Yi);class Zi{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}a([l({type:h.Integer,optional:!0})],Zi.prototype,"pathLenConstraint",void 0),a([l({type:Yi,implicit:!0,context:0,optional:!0})],Zi.prototype,"permittedAttrs",void 0),a([l({type:Yi,implicit:!0,context:1,optional:!0})],Zi.prototype,"excludedAttrs",void 0),a([l({type:h.Boolean,defaultValue:!0})],Zi.prototype,"permitUnSpecified",void 0);class Gt{constructor(e={}){this.issuer=new Ne,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:Ne})],Gt.prototype,"issuer",void 0),a([l({type:h.Integer,converter:ce})],Gt.prototype,"serial",void 0),a([l({type:h.BitString,optional:!0})],Gt.prototype,"issuerUID",void 0);var ns;(function(r){r[r.publicKey=0]="publicKey",r[r.publicKeyCert=1]="publicKeyCert",r[r.otherObjectTypes=2]="otherObjectTypes"})(ns||(ns={}));class Wt{constructor(e={}){this.digestedObjectType=ns.publicKey,this.digestAlgorithm=new R,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.Enumerated})],Wt.prototype,"digestedObjectType",void 0),a([l({type:h.ObjectIdentifier,optional:!0})],Wt.prototype,"otherObjectTypeID",void 0),a([l({type:R})],Wt.prototype,"digestAlgorithm",void 0),a([l({type:h.BitString})],Wt.prototype,"objectDigest",void 0);class Qi{constructor(e={}){Object.assign(this,e)}}a([l({type:Ne,optional:!0})],Qi.prototype,"issuerName",void 0),a([l({type:Gt,context:0,implicit:!0,optional:!0})],Qi.prototype,"baseCertificateID",void 0),a([l({type:Wt,context:1,implicit:!0,optional:!0})],Qi.prototype,"objectDigestInfo",void 0);let mr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:X,repeated:"sequence"})],mr.prototype,"v1Form",void 0),a([l({type:Qi,context:0,implicit:!0})],mr.prototype,"v2Form",void 0),mr=a([B({type:x.Choice})],mr);class Xi{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}a([l({type:h.GeneralizedTime})],Xi.prototype,"notBeforeTime",void 0),a([l({type:h.GeneralizedTime})],Xi.prototype,"notAfterTime",void 0);class Hr{constructor(e={}){Object.assign(this,e)}}a([l({type:Gt,implicit:!0,context:0,optional:!0})],Hr.prototype,"baseCertificateID",void 0),a([l({type:Ne,implicit:!0,context:1,optional:!0})],Hr.prototype,"entityName",void 0),a([l({type:Wt,implicit:!0,context:2,optional:!0})],Hr.prototype,"objectDigestInfo",void 0);var os;(function(r){r[r.v2=1]="v2"})(os||(os={}));class Qe{constructor(e={}){this.version=os.v2,this.holder=new Hr,this.issuer=new mr,this.signature=new R,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new Xi,this.attributes=[],Object.assign(this,e)}}a([l({type:h.Integer})],Qe.prototype,"version",void 0),a([l({type:Hr})],Qe.prototype,"holder",void 0),a([l({type:mr})],Qe.prototype,"issuer",void 0),a([l({type:R})],Qe.prototype,"signature",void 0),a([l({type:h.Integer,converter:ce})],Qe.prototype,"serialNumber",void 0),a([l({type:Xi})],Qe.prototype,"attrCertValidityPeriod",void 0),a([l({type:vt,repeated:"sequence"})],Qe.prototype,"attributes",void 0),a([l({type:h.BitString,optional:!0})],Qe.prototype,"issuerUniqueID",void 0),a([l({type:zt,optional:!0})],Qe.prototype,"extensions",void 0);class en{constructor(e={}){this.acinfo=new Qe,this.signatureAlgorithm=new R,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:Qe})],en.prototype,"acinfo",void 0),a([l({type:R})],en.prototype,"signatureAlgorithm",void 0),a([l({type:h.BitString})],en.prototype,"signatureValue",void 0);var tn;(function(r){r[r.unmarked=1]="unmarked",r[r.unclassified=2]="unclassified",r[r.restricted=4]="restricted",r[r.confidential=8]="confidential",r[r.secret=16]="secret",r[r.topSecret=32]="topSecret"})(tn||(tn={}));class ss extends _i{}class as{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier,implicit:!0,context:0})],as.prototype,"type",void 0),a([l({type:h.Any,implicit:!0,context:1})],as.prototype,"value",void 0);class cs{constructor(e={}){this.policyId="",this.classList=new ss(tn.unclassified),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],cs.prototype,"policyId",void 0),a([l({type:ss,defaultValue:new ss(tn.unclassified)})],cs.prototype,"classList",void 0),a([l({type:as,repeated:"set"})],cs.prototype,"securityCategories",void 0);class rn{constructor(e={}){Object.assign(this,e)}}a([l({type:ie})],rn.prototype,"cotets",void 0),a([l({type:h.ObjectIdentifier})],rn.prototype,"oid",void 0),a([l({type:h.Utf8String})],rn.prototype,"string",void 0);class sl{constructor(e={}){this.values=[],Object.assign(this,e)}}a([l({type:Ne,implicit:!0,context:0,optional:!0})],sl.prototype,"policyAuthority",void 0),a([l({type:rn,repeated:"sequence"})],sl.prototype,"values",void 0);var ls;class nn{constructor(e={}){this.targetCertificate=new Gt,Object.assign(this,e)}}a([l({type:Gt})],nn.prototype,"targetCertificate",void 0),a([l({type:X,optional:!0})],nn.prototype,"targetName",void 0),a([l({type:Wt,optional:!0})],nn.prototype,"certDigestInfo",void 0);let br=class{constructor(e={}){Object.assign(this,e)}};a([l({type:X,context:0,implicit:!0})],br.prototype,"targetName",void 0),a([l({type:X,context:1,implicit:!0})],br.prototype,"targetGroup",void 0),a([l({type:nn,context:2,implicit:!0})],br.prototype,"targetCert",void 0),br=a([B({type:x.Choice})],br);let us=ls=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,ls.prototype)}};us=ls=a([B({type:x.Sequence,itemType:br})],us);var fs;let al=fs=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,fs.prototype)}};al=fs=a([B({type:x.Sequence,itemType:us})],al);class cl{constructor(e={}){Object.assign(this,e)}}a([l({type:Ne,implicit:!0,context:0,optional:!0})],cl.prototype,"roleAuthority",void 0),a([l({type:X,implicit:!0,context:1})],cl.prototype,"roleName",void 0);class ds{constructor(e={}){this.service=new X,this.ident=new X,Object.assign(this,e)}}a([l({type:X})],ds.prototype,"service",void 0),a([l({type:X})],ds.prototype,"ident",void 0),a([l({type:ie,optional:!0})],ds.prototype,"authInfo",void 0);var ps;class hs{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],hs.prototype,"otherCertFormat",void 0),a([l({type:h.Any})],hs.prototype,"otherCert",void 0);let vr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:pr})],vr.prototype,"certificate",void 0),a([l({type:en,context:2,implicit:!0})],vr.prototype,"v2AttrCert",void 0),a([l({type:hs,context:3,implicit:!0})],vr.prototype,"other",void 0),vr=a([B({type:x.Choice})],vr);let on=ps=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,ps.prototype)}};on=ps=a([B({type:x.Set,itemType:vr})],on);class wr{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],wr.prototype,"contentType",void 0),a([l({type:h.Any,context:0})],wr.prototype,"content",void 0);let Fr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:ie})],Fr.prototype,"single",void 0),a([l({type:h.Any})],Fr.prototype,"any",void 0),Fr=a([B({type:x.Choice})],Fr);class sn{constructor(e={}){this.eContentType="",Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],sn.prototype,"eContentType",void 0),a([l({type:Fr,context:0,optional:!0})],sn.prototype,"eContent",void 0);let qr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:ie,context:0,implicit:!0,optional:!0})],qr.prototype,"value",void 0),a([l({type:ie,converter:Bf,context:0,implicit:!0,optional:!0,repeated:"sequence"})],qr.prototype,"constructedValue",void 0),qr=a([B({type:x.Choice})],qr);class Kr{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new Wi,Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Kr.prototype,"contentType",void 0),a([l({type:Wi})],Kr.prototype,"contentEncryptionAlgorithm",void 0),a([l({type:qr,optional:!0})],Kr.prototype,"encryptedContent",void 0);class an{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],an.prototype,"keyAttrId",void 0),a([l({type:h.Any,optional:!0})],an.prototype,"keyAttr",void 0);var ys;class cn{constructor(e={}){this.subjectKeyIdentifier=new Et,Object.assign(this,e)}}a([l({type:Et})],cn.prototype,"subjectKeyIdentifier",void 0),a([l({type:h.GeneralizedTime,optional:!0})],cn.prototype,"date",void 0),a([l({type:an,optional:!0})],cn.prototype,"other",void 0);let Sr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:cn,context:0,implicit:!0,optional:!0})],Sr.prototype,"rKeyId",void 0),a([l({type:hr,optional:!0})],Sr.prototype,"issuerAndSerialNumber",void 0),Sr=a([B({type:x.Choice})],Sr);class gs{constructor(e={}){this.rid=new Sr,this.encryptedKey=new ie,Object.assign(this,e)}}a([l({type:Sr})],gs.prototype,"rid",void 0),a([l({type:ie})],gs.prototype,"encryptedKey",void 0);let ln=ys=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,ys.prototype)}};ln=ys=a([B({type:x.Sequence,itemType:gs})],ln);class ms{constructor(e={}){this.algorithm=new R,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:R})],ms.prototype,"algorithm",void 0),a([l({type:h.BitString})],ms.prototype,"publicKey",void 0);let Jt=class{constructor(e={}){Object.assign(this,e)}};a([l({type:Et,context:0,implicit:!0,optional:!0})],Jt.prototype,"subjectKeyIdentifier",void 0),a([l({type:ms,context:1,implicit:!0,optional:!0})],Jt.prototype,"originatorKey",void 0),a([l({type:hr,optional:!0})],Jt.prototype,"issuerAndSerialNumber",void 0),Jt=a([B({type:x.Choice})],Jt);class Ar{constructor(e={}){this.version=St.v3,this.originator=new Jt,this.keyEncryptionAlgorithm=new st,this.recipientEncryptedKeys=new ln,Object.assign(this,e)}}a([l({type:h.Integer})],Ar.prototype,"version",void 0),a([l({type:Jt,context:0})],Ar.prototype,"originator",void 0),a([l({type:ie,context:1,optional:!0})],Ar.prototype,"ukm",void 0),a([l({type:st})],Ar.prototype,"keyEncryptionAlgorithm",void 0),a([l({type:ln})],Ar.prototype,"recipientEncryptedKeys",void 0);let kr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:Et,context:0,implicit:!0})],kr.prototype,"subjectKeyIdentifier",void 0),a([l({type:hr})],kr.prototype,"issuerAndSerialNumber",void 0),kr=a([B({type:x.Choice})],kr);class zr{constructor(e={}){this.version=St.v0,this.rid=new kr,this.keyEncryptionAlgorithm=new st,this.encryptedKey=new ie,Object.assign(this,e)}}a([l({type:h.Integer})],zr.prototype,"version",void 0),a([l({type:kr})],zr.prototype,"rid",void 0),a([l({type:st})],zr.prototype,"keyEncryptionAlgorithm",void 0),a([l({type:ie})],zr.prototype,"encryptedKey",void 0);class Gr{constructor(e={}){this.keyIdentifier=new ie,Object.assign(this,e)}}a([l({type:ie})],Gr.prototype,"keyIdentifier",void 0),a([l({type:h.GeneralizedTime,optional:!0})],Gr.prototype,"date",void 0),a([l({type:an,optional:!0})],Gr.prototype,"other",void 0);class Wr{constructor(e={}){this.version=St.v4,this.kekid=new Gr,this.keyEncryptionAlgorithm=new st,this.encryptedKey=new ie,Object.assign(this,e)}}a([l({type:h.Integer})],Wr.prototype,"version",void 0),a([l({type:Gr})],Wr.prototype,"kekid",void 0),a([l({type:st})],Wr.prototype,"keyEncryptionAlgorithm",void 0),a([l({type:ie})],Wr.prototype,"encryptedKey",void 0);class Jr{constructor(e={}){this.version=St.v0,this.keyEncryptionAlgorithm=new st,this.encryptedKey=new ie,Object.assign(this,e)}}a([l({type:h.Integer})],Jr.prototype,"version",void 0),a([l({type:es,context:0,optional:!0})],Jr.prototype,"keyDerivationAlgorithm",void 0),a([l({type:st})],Jr.prototype,"keyEncryptionAlgorithm",void 0),a([l({type:ie})],Jr.prototype,"encryptedKey",void 0);class bs{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],bs.prototype,"oriType",void 0),a([l({type:h.Any})],bs.prototype,"oriValue",void 0);let It=class{constructor(e={}){Object.assign(this,e)}};a([l({type:zr,optional:!0})],It.prototype,"ktri",void 0),a([l({type:Ar,context:1,implicit:!0,optional:!0})],It.prototype,"kari",void 0),a([l({type:Wr,context:2,implicit:!0,optional:!0})],It.prototype,"kekri",void 0),a([l({type:Jr,context:3,implicit:!0,optional:!0})],It.prototype,"pwri",void 0),a([l({type:bs,context:4,implicit:!0,optional:!0})],It.prototype,"ori",void 0),It=a([B({type:x.Choice})],It);var vs;let un=vs=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,vs.prototype)}};un=vs=a([B({type:x.Set,itemType:It})],un);var ws;class fn{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],fn.prototype,"otherRevInfoFormat",void 0),a([l({type:h.Any})],fn.prototype,"otherRevInfo",void 0);let dn=class{constructor(e={}){this.other=new fn,Object.assign(this,e)}};a([l({type:fn,context:1,implicit:!0})],dn.prototype,"other",void 0),dn=a([B({type:x.Choice})],dn);let pn=ws=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,ws.prototype)}};pn=ws=a([B({type:x.Set,itemType:dn})],pn);class Ss{constructor(e={}){Object.assign(this,e)}}a([l({type:on,context:0,implicit:!0,optional:!0})],Ss.prototype,"certs",void 0),a([l({type:pn,context:1,implicit:!0,optional:!0})],Ss.prototype,"crls",void 0);var As;let ks=As=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,As.prototype)}};ks=As=a([B({type:x.Set,itemType:gr})],ks);class Yr{constructor(e={}){this.version=St.v0,this.recipientInfos=new un,this.encryptedContentInfo=new Kr,Object.assign(this,e)}}a([l({type:h.Integer})],Yr.prototype,"version",void 0),a([l({type:Ss,context:0,implicit:!0,optional:!0})],Yr.prototype,"originatorInfo",void 0),a([l({type:un})],Yr.prototype,"recipientInfos",void 0),a([l({type:Kr})],Yr.prototype,"encryptedContentInfo",void 0),a([l({type:ks,context:1,implicit:!0,optional:!0})],Yr.prototype,"unprotectedAttrs",void 0);const Qf="1.2.840.113549.1.7.2";var Cs;let hn=Cs=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,Cs.prototype)}};hn=Cs=a([B({type:x.Set,itemType:Lr})],hn);class Cr{constructor(e={}){this.version=St.v0,this.digestAlgorithms=new hn,this.encapContentInfo=new sn,this.signerInfos=new Ji,Object.assign(this,e)}}a([l({type:h.Integer})],Cr.prototype,"version",void 0),a([l({type:hn})],Cr.prototype,"digestAlgorithms",void 0),a([l({type:sn})],Cr.prototype,"encapContentInfo",void 0),a([l({type:on,context:0,implicit:!0,optional:!0})],Cr.prototype,"certificates",void 0),a([l({type:pn,context:1,implicit:!0,optional:!0})],Cr.prototype,"crls",void 0),a([l({type:Ji})],Cr.prototype,"signerInfos",void 0);const Zr="1.2.840.10045.2.1",xs="1.2.840.10045.4.1",ll="1.2.840.10045.4.3.1",Bs="1.2.840.10045.4.3.2",Es="1.2.840.10045.4.3.3",Is="1.2.840.10045.4.3.4",ul="1.2.840.10045.3.1.7",fl="1.3.132.0.34",dl="1.3.132.0.35";function Qr(r){return new R({algorithm:r})}const Xf=Qr(xs);Qr(ll);const ed=Qr(Bs),td=Qr(Es),rd=Qr(Is);let Xr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:h.ObjectIdentifier})],Xr.prototype,"fieldType",void 0),a([l({type:h.Any})],Xr.prototype,"parameters",void 0),Xr=a([B({type:x.Sequence})],Xr);class id extends ie{}let xr=class{constructor(e={}){Object.assign(this,e)}};a([l({type:h.OctetString})],xr.prototype,"a",void 0),a([l({type:h.OctetString})],xr.prototype,"b",void 0),a([l({type:h.BitString,optional:!0})],xr.prototype,"seed",void 0),xr=a([B({type:x.Sequence})],xr);var Ns;(function(r){r[r.ecpVer1=1]="ecpVer1"})(Ns||(Ns={}));let At=class{constructor(e={}){this.version=Ns.ecpVer1,Object.assign(this,e)}};a([l({type:h.Integer})],At.prototype,"version",void 0),a([l({type:Xr})],At.prototype,"fieldID",void 0),a([l({type:xr})],At.prototype,"curve",void 0),a([l({type:id})],At.prototype,"base",void 0),a([l({type:h.Integer,converter:ce})],At.prototype,"order",void 0),a([l({type:h.Integer,optional:!0})],At.prototype,"cofactor",void 0),At=a([B({type:x.Sequence})],At);let Nt=class{constructor(e={}){Object.assign(this,e)}};a([l({type:h.ObjectIdentifier})],Nt.prototype,"namedCurve",void 0),a([l({type:h.Null})],Nt.prototype,"implicitCurve",void 0),a([l({type:At})],Nt.prototype,"specifiedCurve",void 0),Nt=a([B({type:x.Choice})],Nt);class yn{constructor(e={}){this.version=1,this.privateKey=new ie,Object.assign(this,e)}}a([l({type:h.Integer})],yn.prototype,"version",void 0),a([l({type:ie})],yn.prototype,"privateKey",void 0),a([l({type:Nt,context:0,optional:!0})],yn.prototype,"parameters",void 0),a([l({type:h.BitString,context:1,optional:!0})],yn.prototype,"publicKey",void 0);class gn{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.Integer,converter:ce})],gn.prototype,"r",void 0),a([l({type:h.Integer,converter:ce})],gn.prototype,"s",void 0);const je="1.2.840.113549.1.1",Yt=`${je}.1`,nd=`${je}.7`,od=`${je}.9`,ei=`${je}.10`,sd=`${je}.2`,ad=`${je}.4`,mn=`${je}.5`,cd=`${je}.14`,Os=`${je}.11`,bn=`${je}.12`,vn=`${je}.13`,pl=`${je}.15`,hl=`${je}.16`,wn="1.3.14.3.2.26",yl="2.16.840.1.101.3.4.2.4",Sn="2.16.840.1.101.3.4.2.1",An="2.16.840.1.101.3.4.2.2",kn="2.16.840.1.101.3.4.2.3",ld="2.16.840.1.101.3.4.2.5",ud="2.16.840.1.101.3.4.2.6",fd="1.2.840.113549.2.2",dd="1.2.840.113549.2.5",Cn=`${je}.8`;function ge(r){return new R({algorithm:r,parameters:null})}ge(fd),ge(dd);const Zt=ge(wn);ge(yl),ge(Sn),ge(An),ge(kn),ge(ld),ge(ud);const gl=new R({algorithm:Cn,parameters:j.serialize(Zt)}),ml=new R({algorithm:od,parameters:j.serialize(ji.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});ge(Yt),ge(sd),ge(ad),ge(mn),ge(pl),ge(hl),ge(bn),ge(vn),ge(pl),ge(hl);class xn{constructor(e={}){this.hashAlgorithm=new R(Zt),this.maskGenAlgorithm=new R({algorithm:Cn,parameters:j.serialize(Zt)}),this.pSourceAlgorithm=new R(ml),Object.assign(this,e)}}a([l({type:R,context:0,defaultValue:Zt})],xn.prototype,"hashAlgorithm",void 0),a([l({type:R,context:1,defaultValue:gl})],xn.prototype,"maskGenAlgorithm",void 0),a([l({type:R,context:2,defaultValue:ml})],xn.prototype,"pSourceAlgorithm",void 0),new R({algorithm:nd,parameters:j.serialize(new xn)});class Qt{constructor(e={}){this.hashAlgorithm=new R(Zt),this.maskGenAlgorithm=new R({algorithm:Cn,parameters:j.serialize(Zt)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}a([l({type:R,context:0,defaultValue:Zt})],Qt.prototype,"hashAlgorithm",void 0),a([l({type:R,context:1,defaultValue:gl})],Qt.prototype,"maskGenAlgorithm",void 0),a([l({type:h.Integer,context:2,defaultValue:20})],Qt.prototype,"saltLength",void 0),a([l({type:h.Integer,context:3,defaultValue:1})],Qt.prototype,"trailerField",void 0),new R({algorithm:ei,parameters:j.serialize(new Qt)});class Bn{constructor(e={}){this.digestAlgorithm=new R,this.digest=new ie,Object.assign(this,e)}}a([l({type:R})],Bn.prototype,"digestAlgorithm",void 0),a([l({type:ie})],Bn.prototype,"digest",void 0);var Ts;class En{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.Integer,converter:ce})],En.prototype,"prime",void 0),a([l({type:h.Integer,converter:ce})],En.prototype,"exponent",void 0),a([l({type:h.Integer,converter:ce})],En.prototype,"coefficient",void 0);let Vs=Ts=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,Ts.prototype)}};Vs=Ts=a([B({type:x.Sequence,itemType:En})],Vs);class ct{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)}}a([l({type:h.Integer})],ct.prototype,"version",void 0),a([l({type:h.Integer,converter:ce})],ct.prototype,"modulus",void 0),a([l({type:h.Integer,converter:ce})],ct.prototype,"publicExponent",void 0),a([l({type:h.Integer,converter:ce})],ct.prototype,"privateExponent",void 0),a([l({type:h.Integer,converter:ce})],ct.prototype,"prime1",void 0),a([l({type:h.Integer,converter:ce})],ct.prototype,"prime2",void 0),a([l({type:h.Integer,converter:ce})],ct.prototype,"exponent1",void 0),a([l({type:h.Integer,converter:ce})],ct.prototype,"exponent2",void 0),a([l({type:h.Integer,converter:ce})],ct.prototype,"coefficient",void 0),a([l({type:Vs,optional:!0})],ct.prototype,"otherPrimeInfos",void 0);class _s{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.Integer,converter:ce})],_s.prototype,"modulus",void 0),a([l({type:h.Integer,converter:ce})],_s.prototype,"publicExponent",void 0);var js;(function(r){r[r.Transient=0]="Transient",r[r.Singleton=1]="Singleton",r[r.ResolutionScoped=2]="ResolutionScoped",r[r.ContainerScoped=3]="ContainerScoped"})(js||(js={}));const Pe=js;/*! *****************************************************************************
|
|
76
|
+
Copyright (c) Microsoft Corporation.
|
|
77
|
+
|
|
78
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
79
|
+
purpose with or without fee is hereby granted.
|
|
80
|
+
|
|
81
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
82
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
83
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
84
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
85
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
86
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
87
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
88
|
+
***************************************************************************** */var Ps=function(r,e){return Ps=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},Ps(r,e)};function Rs(r,e){Ps(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function pd(r,e,t,i){function n(s){return s instanceof t?s:new t(function(c){c(s)})}return new(t||(t=Promise))(function(s,c){function u(b){try{p(i.next(b))}catch(y){c(y)}}function f(b){try{p(i.throw(b))}catch(y){c(y)}}function p(b){b.done?s(b.value):n(b.value).then(u,f)}p((i=i.apply(r,[])).next())})}function hd(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,c;return c={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function u(p){return function(b){return f([p,b])}}function f(p){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=p[0]&2?n.return:p[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,p[1])).done)return s;switch(n=0,s&&(p=[p[0]&2,s.value]),p[0]){case 0:case 1:s=p;break;case 4:return t.label++,{value:p[1],done:!1};case 5:t.label++,n=p[1],p=[0];continue;case 7:p=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(p[0]===6||p[0]===2)){t=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]<s[3])){t.label=p[1];break}if(p[0]===6&&t.label<s[1]){t.label=s[1],s=p;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(p);break}s[2]&&t.ops.pop(),t.trys.pop();continue}p=e.call(r,t)}catch(b){p=[6,b],n=0}finally{i=s=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function In(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],i=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&i>=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Nn(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],c;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(u){c={error:u}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(c)throw c.error}}return s}function Xt(){for(var r=[],e=0;e<arguments.length;e++)r=r.concat(Nn(arguments[e]));return r}var yd="injectionTokens";function gd(r){var e=Reflect.getMetadata("design:paramtypes",r)||[],t=Reflect.getOwnMetadata(yd,r)||{};return Object.keys(t).forEach(function(i){e[+i]=t[i]}),e}function bl(r){return!!r.useClass}function Ds(r){return!!r.useFactory}var vl=function(){function r(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return r.prototype.createProxy=function(e){var t=this,i={},n=!1,s,c=function(){return n||(s=e(t.wrap()),n=!0),s};return new Proxy(i,this.createHandler(c))},r.prototype.createHandler=function(e){var t={},i=function(n){t[n]=function(){for(var s=[],c=0;c<arguments.length;c++)s[c]=arguments[c];s[0]=e();var u=Reflect[n];return u.apply(void 0,Xt(s))}};return this.reflectMethods.forEach(i),t},r}();function Br(r){return typeof r=="string"||typeof r=="symbol"}function md(r){return typeof r=="object"&&"token"in r&&"multiple"in r}function wl(r){return typeof r=="object"&&"token"in r&&"transform"in r}function bd(r){return typeof r=="function"||r instanceof vl}function On(r){return!!r.useToken}function Tn(r){return r.useValue!=null}function vd(r){return bl(r)||Tn(r)||On(r)||Ds(r)}var $s=function(){function r(){this._registryMap=new Map}return r.prototype.entries=function(){return this._registryMap.entries()},r.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},r.prototype.get=function(e){this.ensure(e);var t=this._registryMap.get(e);return t[t.length-1]||null},r.prototype.set=function(e,t){this.ensure(e),this._registryMap.get(e).push(t)},r.prototype.setAll=function(e,t){this._registryMap.set(e,t)},r.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},r.prototype.clear=function(){this._registryMap.clear()},r.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},r}(),wd=function(r){Rs(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}($s),Sl=function(){function r(){this.scopedResolutions=new Map}return r}();function Sd(r,e){if(r===null)return"at position #"+e;var t=r.split(",")[e].trim();return'"'+t+'" at position #'+e}function Ad(r,e,t){return t===void 0&&(t=" "),Xt([r],e.message.split(`
|
|
89
|
+
`).map(function(i){return t+i})).join(`
|
|
90
|
+
`)}function kd(r,e,t){var i=Nn(r.toString().match(/constructor\(([\w, ]+)\)/)||[],2),n=i[1],s=n===void 0?null:n,c=Sd(s,e);return Ad("Cannot inject the dependency "+c+' of "'+r.name+'" constructor. Reason:',t)}function Cd(r){if(typeof r.dispose!="function")return!1;var e=r.dispose;return!(e.length>0)}var xd=function(r){Rs(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}($s),Bd=function(r){Rs(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}($s),Ed=function(){function r(){this.preResolution=new xd,this.postResolution=new Bd}return r}(),Al=new Map,Id=function(){function r(e){this.parent=e,this._registry=new wd,this.interceptors=new Ed,this.disposed=!1,this.disposables=new Set}return r.prototype.register=function(e,t,i){i===void 0&&(i={lifecycle:Pe.Transient}),this.ensureNotDisposed();var n;if(vd(t)?n=t:n={useClass:t},On(n))for(var s=[e],c=n;c!=null;){var u=c.useToken;if(s.includes(u))throw new Error("Token registration cycle detected! "+Xt(s,[u]).join(" -> "));s.push(u);var f=this._registry.get(u);f&&On(f.provider)?c=f.provider:c=null}if((i.lifecycle===Pe.Singleton||i.lifecycle==Pe.ContainerScoped||i.lifecycle==Pe.ResolutionScoped)&&(Tn(n)||Ds(n)))throw new Error('Cannot use lifecycle "'+Pe[i.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:n,options:i}),this},r.prototype.registerType=function(e,t){return this.ensureNotDisposed(),Br(t)?this.register(e,{useToken:t}):this.register(e,{useClass:t})},r.prototype.registerInstance=function(e,t){return this.ensureNotDisposed(),this.register(e,{useValue:t})},r.prototype.registerSingleton=function(e,t){if(this.ensureNotDisposed(),Br(e)){if(Br(t))return this.register(e,{useToken:t},{lifecycle:Pe.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:Pe.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var i=e;return t&&!Br(t)&&(i=t),this.register(e,{useClass:i},{lifecycle:Pe.Singleton})},r.prototype.resolve=function(e,t){t===void 0&&(t=new Sl),this.ensureNotDisposed();var i=this.getRegistration(e);if(!i&&Br(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"Single"),i){var n=this.resolveRegistration(i,t);return this.executePostResolutionInterceptor(e,n,"Single"),n}if(bd(e)){var n=this.construct(e,t);return this.executePostResolutionInterceptor(e,n,"Single"),n}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},r.prototype.executePreResolutionInterceptor=function(e,t){var i,n;if(this.interceptors.preResolution.has(e)){var s=[];try{for(var c=In(this.interceptors.preResolution.getAll(e)),u=c.next();!u.done;u=c.next()){var f=u.value;f.options.frequency!="Once"&&s.push(f),f.callback(e,t)}}catch(p){i={error:p}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(i)throw i.error}}this.interceptors.preResolution.setAll(e,s)}},r.prototype.executePostResolutionInterceptor=function(e,t,i){var n,s;if(this.interceptors.postResolution.has(e)){var c=[];try{for(var u=In(this.interceptors.postResolution.getAll(e)),f=u.next();!f.done;f=u.next()){var p=f.value;p.options.frequency!="Once"&&c.push(p),p.callback(e,t,i)}}catch(b){n={error:b}}finally{try{f&&!f.done&&(s=u.return)&&s.call(u)}finally{if(n)throw n.error}}this.interceptors.postResolution.setAll(e,c)}},r.prototype.resolveRegistration=function(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===Pe.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);var i=e.options.lifecycle===Pe.Singleton,n=e.options.lifecycle===Pe.ContainerScoped,s=i||n,c;return Tn(e.provider)?c=e.provider.useValue:On(e.provider)?c=s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):bl(e.provider)?c=s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):Ds(e.provider)?c=e.provider.useFactory(this):c=this.construct(e.provider,t),e.options.lifecycle===Pe.ResolutionScoped&&t.scopedResolutions.set(e,c),c},r.prototype.resolveAll=function(e,t){var i=this;t===void 0&&(t=new Sl),this.ensureNotDisposed();var n=this.getAllRegistrations(e);if(!n&&Br(e))throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"');if(this.executePreResolutionInterceptor(e,"All"),n){var s=n.map(function(u){return i.resolveRegistration(u,t)});return this.executePostResolutionInterceptor(e,s,"All"),s}var c=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,c,"All"),c},r.prototype.isRegistered=function(e,t){return t===void 0&&(t=!1),this.ensureNotDisposed(),this._registry.has(e)||t&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},r.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},r.prototype.clearInstances=function(){var e,t;this.ensureNotDisposed();try{for(var i=In(this._registry.entries()),n=i.next();!n.done;n=i.next()){var s=Nn(n.value,2),c=s[0],u=s[1];this._registry.setAll(c,u.filter(function(f){return!Tn(f.provider)}).map(function(f){return f.instance=void 0,f}))}}catch(f){e={error:f}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},r.prototype.createChildContainer=function(){var e,t;this.ensureNotDisposed();var i=new r(this);try{for(var n=In(this._registry.entries()),s=n.next();!s.done;s=n.next()){var c=Nn(s.value,2),u=c[0],f=c[1];f.some(function(p){var b=p.options;return b.lifecycle===Pe.ContainerScoped})&&i._registry.setAll(u,f.map(function(p){return p.options.lifecycle===Pe.ContainerScoped?{provider:p.provider,options:p.options}:p}))}}catch(p){e={error:p}}finally{try{s&&!s.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return i},r.prototype.beforeResolution=function(e,t,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:t,options:i})},r.prototype.afterResolution=function(e,t,i){i===void 0&&(i={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:t,options:i})},r.prototype.dispose=function(){return pd(this,void 0,void 0,function(){var e;return hd(this,function(t){switch(t.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(i){var n=i.dispose();n&&e.push(n)}),[4,Promise.all(e)];case 1:return t.sent(),[2]}})})},r.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},r.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},r.prototype.construct=function(e,t){var i=this;if(e instanceof vl)return e.createProxy(function(s){return i.resolve(s,t)});var n=function(){var s=Al.get(e);if(!s||s.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var c=s.map(i.resolveParams(t,e));return new(e.bind.apply(e,Xt([void 0],c)))}();return Cd(n)&&this.disposables.add(n),n},r.prototype.resolveParams=function(e,t){var i=this;return function(n,s){var c,u,f;try{return md(n)?wl(n)?n.multiple?(c=i.resolve(n.transform)).transform.apply(c,Xt([i.resolveAll(n.token)],n.transformArgs)):(u=i.resolve(n.transform)).transform.apply(u,Xt([i.resolve(n.token,e)],n.transformArgs)):n.multiple?i.resolveAll(n.token):i.resolve(n.token,e):wl(n)?(f=i.resolve(n.transform,e)).transform.apply(f,Xt([i.resolve(n.token,e)],n.transformArgs)):i.resolve(n,e)}catch(p){throw new Error(kd(t,s,p))}}},r.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},r}(),Oe=new Id;function Vn(){return function(r){Al.set(r,gd(r))}}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 Ms;class _n{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}a([l({type:h.ObjectIdentifier})],_n.prototype,"attrId",void 0),a([l({type:h.Any,repeated:"set"})],_n.prototype,"attrValues",void 0);let kl=Ms=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,Ms.prototype)}};kl=Ms=a([B({type:x.Sequence,itemType:_n})],kl);var Us;let Cl=Us=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,Us.prototype)}};Cl=Us=a([B({type:x.Sequence,itemType:wr})],Cl);class xl{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],xl.prototype,"certId",void 0),a([l({type:h.Any,context:0})],xl.prototype,"certValue",void 0);class Bl{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Bl.prototype,"crlId",void 0),a([l({type:h.Any,context:0})],Bl.prototype,"crltValue",void 0);class El extends ie{}let jn=class{constructor(e={}){this.encryptionAlgorithm=new R,this.encryptedData=new El,Object.assign(this,e)}};a([l({type:R})],jn.prototype,"encryptionAlgorithm",void 0),a([l({type:El})],jn.prototype,"encryptedData",void 0);var Ls,Hs;(function(r){r[r.v1=0]="v1"})(Hs||(Hs={}));class Il extends ie{}let Fs=Ls=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,Ls.prototype)}};Fs=Ls=a([B({type:x.Sequence,itemType:vt})],Fs);class ti{constructor(e={}){this.version=Hs.v1,this.privateKeyAlgorithm=new R,this.privateKey=new Il,Object.assign(this,e)}}a([l({type:h.Integer})],ti.prototype,"version",void 0),a([l({type:R})],ti.prototype,"privateKeyAlgorithm",void 0),a([l({type:Il})],ti.prototype,"privateKey",void 0),a([l({type:Fs,implicit:!0,context:0,optional:!0})],ti.prototype,"attributes",void 0);let Nl=class extends ti{};Nl=a([B({type:x.Sequence})],Nl);let Ol=class extends jn{};Ol=a([B({type:x.Sequence})],Ol);class Tl{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Tl.prototype,"secretTypeId",void 0),a([l({type:h.Any,context:0})],Tl.prototype,"secretValue",void 0);class ri{constructor(e={}){this.mac=new Bn,this.macSalt=new ie,this.iterations=1,Object.assign(this,e)}}a([l({type:Bn})],ri.prototype,"mac",void 0),a([l({type:ie})],ri.prototype,"macSalt",void 0),a([l({type:h.Integer,defaultValue:1})],ri.prototype,"iterations",void 0);class Pn{constructor(e={}){this.version=3,this.authSafe=new wr,this.macData=new ri,Object.assign(this,e)}}a([l({type:h.Integer})],Pn.prototype,"version",void 0),a([l({type:wr})],Pn.prototype,"authSafe",void 0),a([l({type:ri,optional:!0})],Pn.prototype,"macData",void 0);var qs;class Rn{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:h.ObjectIdentifier})],Rn.prototype,"bagId",void 0),a([l({type:h.Any,context:0})],Rn.prototype,"bagValue",void 0),a([l({type:_n,repeated:"set",optional:!0})],Rn.prototype,"bagAttributes",void 0);let Vl=qs=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,qs.prototype)}};Vl=qs=a([B({type:x.Sequence,itemType:Rn})],Vl);var Ks,zs,Gs;const _l="1.2.840.113549.1.9",jl=`${_l}.7`,Ws=`${_l}.14`;let Dn=class extends Ae{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};a([l({type:h.IA5String})],Dn.prototype,"ia5String",void 0),Dn=a([B({type:x.Choice})],Dn);let Pl=class extends wr{};Pl=a([B({type:x.Sequence})],Pl);let Rl=class extends Pn{};Rl=a([B({type:x.Sequence})],Rl);let Dl=class extends jn{};Dl=a([B({type:x.Sequence})],Dl);let Js=class{constructor(e=""){this.value=e}toString(){return this.value}};a([l({type:h.IA5String})],Js.prototype,"value",void 0),Js=a([B({type:x.Choice})],Js);let $l=class extends Dn{};$l=a([B({type:x.Choice})],$l);let Ml=class extends Ae{};Ml=a([B({type:x.Choice})],Ml);let Ys=class{constructor(e=new Date){this.value=e}};a([l({type:h.GeneralizedTime})],Ys.prototype,"value",void 0),Ys=a([B({type:x.Choice})],Ys);let Ul=class extends Ae{};Ul=a([B({type:x.Choice})],Ul);let Zs=class{constructor(e="M"){this.value=e}toString(){return this.value}};a([l({type:h.PrintableString})],Zs.prototype,"value",void 0),Zs=a([B({type:x.Choice})],Zs);let $n=class{constructor(e=""){this.value=e}toString(){return this.value}};a([l({type:h.PrintableString})],$n.prototype,"value",void 0),$n=a([B({type:x.Choice})],$n);let Ll=class extends $n{};Ll=a([B({type:x.Choice})],Ll);let Hl=class extends Ae{};Hl=a([B({type:x.Choice})],Hl);let Qs=class{constructor(e=""){this.value=e}toString(){return this.value}};a([l({type:h.ObjectIdentifier})],Qs.prototype,"value",void 0),Qs=a([B({type:x.Choice})],Qs);let Fl=class extends ke{};Fl=a([B({type:x.Choice})],Fl);let Xs=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};a([l({type:h.Integer})],Xs.prototype,"value",void 0),Xs=a([B({type:x.Choice})],Xs);let ql=class extends at{};ql=a([B({type:x.Sequence})],ql);let Mn=class extends Ae{};Mn=a([B({type:x.Choice})],Mn);let Kl=Ks=class extends zt{constructor(e){super(e),Object.setPrototypeOf(this,Ks.prototype)}};Kl=Ks=a([B({type:x.Sequence})],Kl);let zl=zs=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,zs.prototype)}};zl=zs=a([B({type:x.Set,itemType:gr})],zl);let ea=class{constructor(e=""){this.value=e}toString(){return this.value}};a([l({type:h.BmpString})],ea.prototype,"value",void 0),ea=a([B({type:x.Choice})],ea);let ta=class extends R{};ta=a([B({type:x.Sequence})],ta);let Gl=Gs=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,Gs.prototype)}};Gl=Gs=a([B({type:x.Sequence,itemType:ta})],Gl);var ra;let Un=ra=class extends oe{constructor(e){super(e),Object.setPrototypeOf(this,ra.prototype)}};Un=ra=a([B({type:x.Sequence,itemType:vt})],Un);class Er{constructor(e={}){this.version=0,this.subject=new ye,this.subjectPKInfo=new ot,this.attributes=new Un,Object.assign(this,e)}}a([l({type:h.Integer})],Er.prototype,"version",void 0),a([l({type:ye})],Er.prototype,"subject",void 0),a([l({type:ot})],Er.prototype,"subjectPKInfo",void 0),a([l({type:Un,implicit:!0,context:0})],Er.prototype,"attributes",void 0);class ii{constructor(e={}){this.certificationRequestInfo=new Er,this.signatureAlgorithm=new R,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}a([l({type:Er})],ii.prototype,"certificationRequestInfo",void 0),a([l({type:R})],ii.prototype,"signatureAlgorithm",void 0),a([l({type:h.BitString})],ii.prototype,"signature",void 0);/*!
|
|
91
|
+
* MIT License
|
|
92
|
+
*
|
|
93
|
+
* Copyright (c) Peculiar Ventures. All rights reserved.
|
|
94
|
+
*
|
|
95
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
96
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
97
|
+
* in the Software without restriction, including without limitation the rights
|
|
98
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
99
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
100
|
+
* furnished to do so, subject to the following conditions:
|
|
101
|
+
*
|
|
102
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
103
|
+
* copies or substantial portions of the Software.
|
|
104
|
+
*
|
|
105
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
106
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
107
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
108
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
109
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
110
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
111
|
+
* SOFTWARE.
|
|
112
|
+
*
|
|
113
|
+
*/const ni="crypto.algorithm";class Nd{getAlgorithms(){return Oe.resolveAll(ni)}toAsnAlgorithm(e){({...e});for(const t of this.getAlgorithms()){const i=t.toAsnAlgorithm(e);if(i)return i}if(/^[0-9.]+$/.test(e.name)){const t=new R({algorithm:e.name});if("parameters"in e){const i=e;t.parameters=i.parameters}return t}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(const i of this.getAlgorithms()){const n=i.toWebAlgorithm(e);if(n)return n}return{name:e.algorithm,parameters:e.parameters}}}const Ir="crypto.algorithmProvider";Oe.registerSingleton(Ir,Nd);var Ln;const Re="1.3.36.3.3.2.8.1.1",Wl=`${Re}.1`,Jl=`${Re}.2`,Yl=`${Re}.3`,Zl=`${Re}.4`,Ql=`${Re}.5`,Xl=`${Re}.6`,eu=`${Re}.7`,tu=`${Re}.8`,ru=`${Re}.9`,iu=`${Re}.10`,nu=`${Re}.11`,ou=`${Re}.12`,su=`${Re}.13`,au=`${Re}.14`,cu="brainpoolP160r1",lu="brainpoolP160t1",uu="brainpoolP192r1",fu="brainpoolP192t1",du="brainpoolP224r1",pu="brainpoolP224t1",hu="brainpoolP256r1",yu="brainpoolP256t1",gu="brainpoolP320r1",mu="brainpoolP320t1",bu="brainpoolP384r1",vu="brainpoolP384t1",wu="brainpoolP512r1",Su="brainpoolP512t1",de="ECDSA";let oi=Ln=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case de.toLowerCase():if("hash"in e)switch((typeof e.hash=="string"?e.hash:e.hash.name).toLowerCase()){case"sha-1":return Xf;case"sha-256":return ed;case"sha-384":return td;case"sha-512":return rd}else if("namedCurve"in e){let t="";switch(e.namedCurve){case"P-256":t=ul;break;case"K-256":t=Ln.SECP256K1;break;case"P-384":t=fl;break;case"P-521":t=dl;break;case cu:t=Wl;break;case lu:t=Jl;break;case uu:t=Yl;break;case fu:t=Zl;break;case du:t=Ql;break;case pu:t=Xl;break;case hu:t=eu;break;case yu:t=tu;break;case gu:t=ru;break;case mu:t=iu;break;case bu:t=nu;break;case vu:t=ou;break;case wu:t=su;break;case Su:t=au;break}if(t)return new R({algorithm:Zr,parameters:j.serialize(new Nt({namedCurve:t}))})}}return null}toWebAlgorithm(e){switch(e.algorithm){case xs:return{name:de,hash:{name:"SHA-1"}};case Bs:return{name:de,hash:{name:"SHA-256"}};case Es:return{name:de,hash:{name:"SHA-384"}};case Is:return{name:de,hash:{name:"SHA-512"}};case Zr:{if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(j.parse(e.parameters,Nt).namedCurve){case ul:return{name:de,namedCurve:"P-256"};case Ln.SECP256K1:return{name:de,namedCurve:"K-256"};case fl:return{name:de,namedCurve:"P-384"};case dl:return{name:de,namedCurve:"P-521"};case Wl:return{name:de,namedCurve:cu};case Jl:return{name:de,namedCurve:lu};case Yl:return{name:de,namedCurve:uu};case Zl:return{name:de,namedCurve:fu};case Ql:return{name:de,namedCurve:du};case Xl:return{name:de,namedCurve:pu};case eu:return{name:de,namedCurve:hu};case tu:return{name:de,namedCurve:yu};case ru:return{name:de,namedCurve:gu};case iu:return{name:de,namedCurve:mu};case nu:return{name:de,namedCurve:bu};case ou:return{name:de,namedCurve:vu};case su:return{name:de,namedCurve:wu};case au:return{name:de,namedCurve:Su}}}}return null}};oi.SECP256K1="1.3.132.0.10",oi=Ln=a([Vn()],oi),Oe.registerSingleton(ni,oi);const Au=Symbol("name"),ku=Symbol("value");class ne{constructor(e,t={},i=""){this[Au]=e,this[ku]=i;for(const n in t)this[n]=t[n]}}ne.NAME=Au,ne.VALUE=ku;class Od{static toTextObject(e){const t=new ne("Algorithm Identifier",{},Ot.toString(e.algorithm));if(e.parameters)switch(e.algorithm){case Zr:{const i=new oi().toWebAlgorithm(e);i&&"namedCurve"in i?t["Named Curve"]=i.namedCurve:t.Parameters=e.parameters;break}default:t.Parameters=e.parameters}return t}}class Ot{static toString(e){const t=this.items[e];return t||e}}Ot.items={[wn]:"sha1",[yl]:"sha224",[Sn]:"sha256",[An]:"sha384",[kn]:"sha512",[Yt]:"rsaEncryption",[mn]:"sha1WithRSAEncryption",[cd]:"sha224WithRSAEncryption",[Os]:"sha256WithRSAEncryption",[bn]:"sha384WithRSAEncryption",[vn]:"sha512WithRSAEncryption",[Zr]:"ecPublicKey",[xs]:"ecdsaWithSHA1",[ll]:"ecdsaWithSHA224",[Bs]:"ecdsaWithSHA256",[Es]:"ecdsaWithSHA384",[Is]:"ecdsaWithSHA512",[zf]:"TLS WWW server authentication",[Gf]:"TLS WWW client authentication",[Wf]:"Code Signing",[Jf]:"E-mail Protection",[Yf]:"Time Stamping",[Zf]:"OCSP Signing",[Qf]:"Signed Data"};class er{static serialize(e){return this.serializeObj(e).join(`
|
|
114
|
+
`)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,t=0){const i=[];let n=this.pad(t++),s="";const c=e[ne.VALUE];c&&(s=` ${c}`),i.push(`${n}${e[ne.NAME]}:${s}`),n=this.pad(t);for(const u in e){if(typeof u=="symbol")continue;const f=e[u],p=u?`${u}: `:"";if(typeof f=="string"||typeof f=="number"||typeof f=="boolean")i.push(`${n}${p}${f}`);else if(f instanceof Date)i.push(`${n}${p}${f.toUTCString()}`);else if(Array.isArray(f))for(const b of f)b[ne.NAME]=u,i.push(...this.serializeObj(b,t));else if(f instanceof ne)f[ne.NAME]=u,i.push(...this.serializeObj(f,t));else if(_.isBufferSource(f))u?(i.push(`${n}${p}`),i.push(...this.serializeBufferSource(f,t+1))):i.push(...this.serializeBufferSource(f,t));else if("toTextObject"in f){const b=f.toTextObject();b[ne.NAME]=u,i.push(...this.serializeObj(b,t))}else throw new TypeError("Cannot serialize data in text format. Unsupported type.")}return i}static serializeBufferSource(e,t=0){const i=this.pad(t),n=_.toUint8Array(e),s=[];for(let c=0;c<n.length;){const u=[];for(let f=0;f<16&&c<n.length;f++){f===8&&u.push("");const p=n[c++].toString(16).padStart(2,"0");u.push(p)}s.push(`${i}${u.join(" ")}`)}return s}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}er.oidSerializer=Ot,er.algorithmSerializer=Od;class Tt{constructor(...e){if(e.length===1){const t=e[0];this.rawData=j.serialize(t),this.onInit(t)}else{const t=j.parse(e[0],e[1]);this.rawData=_.toArrayBuffer(e[0]),this.onInit(t)}}equal(e){return e instanceof Tt?Ba(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return j.toString(this.rawData);case"text":return er.serialize(this.toTextObject());case"hex":return L.ToHex(this.rawData);case"base64":return L.ToBase64(this.rawData);case"base64url":return L.ToBase64Url(this.rawData);default:throw TypeError("Argument 'format' is unsupported value")}}getTextName(){return this.constructor.NAME}toTextObject(){const e=this.toTextObjectEmpty();return e[""]=this.rawData,e}toTextObjectEmpty(e){return new ne(this.getTextName(),{},e)}}Tt.NAME="ASN";class Ke extends Tt{constructor(...e){let t;_.isBufferSource(e[0])?t=_.toArrayBuffer(e[0]):t=j.serialize(new Ze({extnID:e[0],critical:e[1],extnValue:new ie(_.toArrayBuffer(e[2]))})),super(t,Ze)}onInit(e){this.type=e.extnID,this.critical=e.critical,this.value=e.extnValue.buffer}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.value,e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty(this.critical?"critical":void 0);return e[ne.NAME]===Ke.NAME&&(e[ne.NAME]=Ot.toString(this.type)),e}}var Cu;class Vt{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[Cu]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(Vt.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(Vt.DEFAULT,global.crypto)}clear(){this.items.clear()}delete(e){return this.items.delete(e)}forEach(e,t){return this.items.forEach(e,t)}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=Vt.DEFAULT){const t=this.items.get(e.toLowerCase());if(!t)throw new Error(`Cannot get Crypto by name '${e}'`);return t}set(e,t){if(typeof e=="string"){if(!t)throw new TypeError("Argument 'value' is required");this.items.set(e.toLowerCase(),t)}else this.items.set(Vt.DEFAULT,e);return this}}Cu=Symbol.toStringTag,Vt.DEFAULT="default";const Te=new Vt,Td=/^[0-2](?:\.[1-9][0-9]*)+$/;function Vd(r){return new RegExp(Td).test(r)}class xu{constructor(e={}){this.items={};for(const t in e)this.register(t,e[t])}get(e){return this.items[e]||null}findId(e){return Vd(e)?e:this.get(e)}register(e,t){this.items[e]=t,this.items[t]=e}}const De=new xu;De.register("CN","2.5.4.3"),De.register("L","2.5.4.7"),De.register("ST","2.5.4.8"),De.register("O","2.5.4.10"),De.register("OU","2.5.4.11"),De.register("C","2.5.4.6"),De.register("DC","0.9.2342.19200300.100.1.25"),De.register("E","1.2.840.113549.1.9.1"),De.register("G","2.5.4.42"),De.register("I","2.5.4.43"),De.register("SN","2.5.4.4"),De.register("T","2.5.4.12");function _d(r,e){return`\\${L.ToHex(L.FromUtf8String(e)).toUpperCase()}`}function jd(r){return r.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,_d)}class _t{static isASCII(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return!1;return!0}static isPrintableString(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(e)}constructor(e,t={}){this.extraNames=new xu,this.asn=new ye;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const n=t[i];this.extraNames.register(i,n)}typeof e=="string"?this.asn=this.fromString(e):e instanceof ye?this.asn=e:_.isBufferSource(e)?this.asn=j.parse(e,ye):this.asn=this.fromJSON(e)}getField(e){const t=this.extraNames.findId(e)||De.findId(e),i=[];for(const n of this.asn)for(const s of n)s.type===t&&i.push(s.value.toString());return i}getName(e){return this.extraNames.get(e)||De.get(e)}toString(){return this.asn.map(e=>e.map(t=>{const i=this.getName(t.type)||t.type,n=t.value.anyValue?`#${L.ToHex(t.value.anyValue)}`:jd(t.value.toString());return`${i}=${n}`}).join("+")).join(", ")}toJSON(){var e;const t=[];for(const i of this.asn){const n={};for(const s of i){const c=this.getName(s.type)||s.type;(e=n[c])!==null&&e!==void 0||(n[c]=[]),n[c].push(s.value.anyValue?`#${L.ToHex(s.value.anyValue)}`:s.value.toString())}t.push(n)}return t}fromString(e){const t=new ye,i=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let n=null,s=",";for(;n=i.exec(`${e},`);){let[,c,u]=n;const f=u[u.length-1];(f===","||f==="+")&&(u=u.slice(0,u.length-1),n[3]=f);const p=n[3];c=this.getTypeOid(c);const b=this.createAttribute(c,u);s==="+"?t[t.length-1].push(b):t.push(new ar([b])),s=p}return t}fromJSON(e){const t=new ye;for(const i of e){const n=new ar;for(const s in i){const c=this.getTypeOid(s),u=i[s];for(const f of u){const p=this.createAttribute(c,f);n.push(p)}}t.push(n)}return t}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,t){const i=new Pi({type:e});if(typeof t=="object")for(const n in t)switch(n){case"ia5String":i.value.ia5String=t[n];break;case"utf8String":i.value.utf8String=t[n];break;case"universalString":i.value.universalString=t[n];break;case"bmpString":i.value.bmpString=t[n];break;case"printableString":i.value.printableString=t[n];break}else if(t[0]==="#")i.value.anyValue=L.FromHex(t.slice(1));else{const n=this.processStringValue(t);e===this.getName("E")||e===this.getName("DC")?i.value.ia5String=n:_t.isPrintableString(n)?i.value.printableString=n:i.value.utf8String=n}return i}processStringValue(e){const t=/"(.*?[^\\])?"/.exec(e);return t&&(e=t[1]),e.replace(/\\0a/ig,`
|
|
115
|
+
`).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return j.serialize(this.asn)}async getThumbprint(...e){var t;let i,n="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(n=e[0]||n,i=e[1]||Te.get()):i=e[0]||Te.get(),await i.subtle.digest(n,this.toArrayBuffer())}}const Bu="Cannot initialize GeneralName from ASN.1 data.",Eu=`${Bu} Unsupported string format in use.`,Pd=`${Bu} Value doesn't match to GUID regular expression.`,Iu=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,Nu="1.3.6.1.4.1.311.25.1",Ou="1.3.6.1.4.1.311.20.2.3",ia="dns",na="dn",oa="email",sa="ip",aa="url",ca="guid",la="upn",Hn="id";class jt extends Tt{constructor(...e){let t;if(e.length===2)switch(e[0]){case na:{const i=new _t(e[1]).toArrayBuffer(),n=j.parse(i,ye);t=new X({directoryName:n});break}case ia:t=new X({dNSName:e[1]});break;case oa:t=new X({rfc822Name:e[1]});break;case ca:{const i=new RegExp(Iu,"i").exec(e[1]);if(!i)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const n=i.slice(1).map((s,c)=>c<3?L.ToHex(new Uint8Array(L.FromHex(s)).reverse()):s).join("");t=new X({otherName:new Dr({typeId:Nu,value:j.serialize(new ie(L.FromHex(n)))})});break}case sa:t=new X({iPAddress:e[1]});break;case Hn:t=new X({registeredID:e[1]});break;case la:{t=new X({otherName:new Dr({typeId:Ou,value:j.serialize(Ic.toASN(e[1]))})});break}case aa:t=new X({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else _.isBufferSource(e[0])?t=j.parse(e[0],X):t=e[0];super(t)}onInit(e){if(e.dNSName!=null)this.type=ia,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=oa,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=sa,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=aa,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=Hn,this.value=e.registeredID;else if(e.directoryName!=null)this.type=na,this.value=new _t(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===Nu){this.type=ca;const t=j.parse(e.otherName.value,ie),i=new RegExp(Iu,"i").exec(L.ToHex(t));if(!i)throw new Error(Pd);this.value=i.slice(1).map((n,s)=>s<3?L.ToHex(new Uint8Array(L.FromHex(n)).reverse()):n).join("-")}else if(e.otherName.typeId===Ou)this.type=la,this.value=j.parse(e.otherName.value,Ae).toString();else throw new Error(Eu);else throw new Error(Eu)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case na:case ia:case ca:case sa:case Hn:case la:case aa:e=this.type.toUpperCase();break;case oa:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let t=this.value;return this.type===Hn&&(t=Ot.toString(t)),new ne(e,void 0,t)}}class si extends Tt{constructor(e){let t;if(e instanceof Ne)t=e;else if(Array.isArray(e)){const i=[];for(const n of e)if(n instanceof X)i.push(n);else{const s=j.parse(new jt(n.type,n.value).rawData,X);i.push(s)}t=new Ne(i)}else if(_.isBufferSource(e))t=j.parse(e,Ne);else throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(t)}onInit(e){const t=[];for(const i of e){let n=null;try{n=new jt(i)}catch{continue}t.push(n)}this.items=t}toJSON(){return this.items.map(e=>e.toJSON())}toTextObject(){const e=super.toTextObjectEmpty();for(const t of this.items){const i=t.toTextObject();let n=e[i[ne.NAME]];Array.isArray(n)||(n=[],e[i[ne.NAME]]=n),n.push(i)}return e}}si.NAME="GeneralNames";const ai="-{5}",ci="\\n",Rd=`[^${ci}]+`,Dd=`${ai}BEGIN (${Rd}(?=${ai}))${ai}`,$d=`${ai}END \\1${ai}`,Nr="\\n",Md=`[^:${ci}]+`,Ud=`(?:[^${ci}]+${Nr}(?: +[^${ci}]+${Nr})*)`,Ld=`(?:[a-zA-Z0-9=+/]+${Nr})+`,Tu=`${Dd}${Nr}(?:((?:${Md}: ${Ud})+))?${Nr}?(${Ld})${$d}`;class Le{static isPem(e){return typeof e=="string"&&new RegExp(Tu,"g").test(e)}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const t=new RegExp(Tu,"g"),i=[];let n=null;for(;n=t.exec(e);){const s=n[3].replace(new RegExp(`[${ci}]+`,"g"),""),c={type:n[1],headers:[],rawData:L.FromBase64(s)},u=n[2];if(u){const f=u.split(new RegExp(Nr,"g"));let p=null;for(const b of f){const[y,q]=b.split(/:(.*)/);if(q===void 0){if(!p)throw new Error("Cannot parse PEM string. Incorrect header value");p.value+=y.trim()}else p&&c.headers.push(p),p={key:y,value:q.trim()}}p&&c.headers.push(p)}i.push(c)}return i}static decode(e){return this.decodeWithHeaders(e).map(i=>i.rawData)}static decodeFirst(e){const t=this.decode(e);if(!t.length)throw new RangeError("PEM string doesn't contain any objects");return t[0]}static encode(e,t){if(Array.isArray(e)){const i=new Array;return t?e.forEach(n=>{if(!_.isBufferSource(n))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");i.push(this.encodeStruct({type:t,rawData:_.toArrayBuffer(n)}))}):e.forEach(n=>{if(!("type"in n))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");i.push(this.encodeStruct(n))}),i.join(`
|
|
116
|
+
`)}else{if(!t)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:t,rawData:_.toArrayBuffer(e)})}}static encodeStruct(e){var t;const i=e.type.toLocaleUpperCase(),n=[];if(n.push(`-----BEGIN ${i}-----`),!((t=e.headers)===null||t===void 0)&&t.length){for(const p of e.headers)n.push(`${p.key}: ${p.value}`);n.push("")}const s=L.ToBase64(e.rawData);let c,u=0;const f=Array();for(;u<s.length&&(s.length-u<64?c=s.substring(u):(c=s.substring(u,u+64),u+=64),c.length!==0);)if(f.push(c),c.length<64)break;return n.push(...f),n.push(`-----END ${i}-----`),n.join(`
|
|
117
|
+
`)}}Le.CertificateTag="CERTIFICATE",Le.CrlTag="CRL",Le.CertificateRequestTag="CERTIFICATE REQUEST",Le.PublicKeyTag="PUBLIC KEY",Le.PrivateKeyTag="PRIVATE KEY";class kt extends Tt{static isAsnEncoded(e){return _.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(Le.isPem(e))return Le.decode(e)[0];if(L.isHex(e))return L.FromHex(e);if(L.isBase64(e))return L.FromBase64(e);if(L.isBase64Url(e))return L.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const t=L.ToBinary(e);return Le.isPem(t)?Le.decode(t)[0]:L.isHex(t)?L.FromHex(t):L.isBase64(t)?L.FromBase64(t):L.isBase64Url(t)?L.FromBase64Url(t):_.toArrayBuffer(e)}}constructor(...e){kt.isAsnEncoded(e[0])?super(kt.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return Le.encode(this.rawData,this.tag);default:return super.toString(e)}}}class lt extends kt{static async create(e,t=Te.get()){if(e instanceof lt)return e;if(Vt.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");const i=await t.subtle.exportKey("spki",e);return new lt(i)}else{if(e.publicKey)return e.publicKey;if(_.isBufferSource(e))return new lt(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){kt.isAsnEncoded(e)?super(e,ot):super(e),this.tag=Le.PublicKeyTag}async export(...e){let t,i=["verify"],n={hash:"SHA-256",...this.algorithm};e.length>1?(n=e[0]||n,i=e[1]||i,t=e[2]||Te.get()):t=e[0]||Te.get();let s=this.rawData;const c=j.parse(this.rawData,ot);return c.algorithm.algorithm===ei&&(s=Hd(c,s)),t.subtle.importKey("spki",s,n,!0,i)}onInit(e){const t=Oe.resolve(Ir),i=this.algorithm=t.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case Yt:{const n=j.parse(e.subjectPublicKey,_s),s=_.toUint8Array(n.modulus);i.publicExponent=_.toUint8Array(n.publicExponent),i.modulusLength=(s[0]?s:s.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var t;let i,n="SHA-1";return e.length>=1&&!(!((t=e[0])===null||t===void 0)&&t.subtle)?(n=e[0]||n,i=e[1]||Te.get()):i=e[0]||Te.get(),await i.subtle.digest(n,this.rawData)}async getKeyIdentifier(...e){let t,i="SHA-1";e.length===1?typeof e[0]=="string"?(i=e[0],t=Te.get()):t=e[0]:e.length===2?(i=e[0],t=e[1]):t=Te.get();const n=j.parse(this.rawData,ot);return await t.subtle.digest(i,n.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),t=j.parse(this.rawData,ot);switch(e.Algorithm=er.serializeAlgorithm(t.algorithm),t.algorithm.algorithm){case Zr:e["EC Point"]=t.subjectPublicKey;break;case Yt:default:e["Raw Data"]=t.subjectPublicKey}return e}}function Hd(r,e){return r.algorithm=new R({algorithm:Yt,parameters:null}),e=j.serialize(r),e}class li extends Ke{static async create(e,t=!1,i=Te.get()){if("name"in e&&"serialNumber"in e)return new li(e,t);const s=await(await lt.create(e,i)).getKeyIdentifier(i);return new li(L.ToHex(s),t)}constructor(...e){if(_.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const t=new qt({keyIdentifier:new No(L.FromHex(e[0]))});super(Io,e[1],j.serialize(t))}else{const t=e[0],i=t.name instanceof si?j.parse(t.name.rawData,Ne):t.name,n=new qt({authorityCertIssuer:i,authorityCertSerialNumber:L.FromHex(t.serialNumber)});super(Io,e[1],j.serialize(n))}}onInit(e){super.onInit(e);const t=j.parse(e.extnValue,qt);t.keyIdentifier&&(this.keyId=L.ToHex(t.keyIdentifier)),(t.authorityCertIssuer||t.authorityCertSerialNumber)&&(this.certId={name:t.authorityCertIssuer||[],serialNumber:t.authorityCertSerialNumber?L.ToHex(t.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),t=j.parse(this.value,qt);return t.authorityCertIssuer&&(e["Authority Issuer"]=new si(t.authorityCertIssuer).toTextObject()),t.authorityCertSerialNumber&&(e["Authority Serial Number"]=t.authorityCertSerialNumber),t.keyIdentifier&&(e[""]=t.keyIdentifier),e}}li.NAME="Authority Key Identifier";class Vu extends Ke{constructor(...e){if(_.isBufferSource(e[0])){super(e[0]);const t=j.parse(this.value,Di);this.ca=t.cA,this.pathLength=t.pathLenConstraint}else{const t=new Di({cA:e[0],pathLenConstraint:e[1]});super($c,e[2],j.serialize(t)),this.ca=e[0],this.pathLength=e[1]}}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ca&&(e.CA=this.ca),this.pathLength!==void 0&&(e["Path Length"]=this.pathLength),e}}Vu.NAME="Basic Constraints";var _u;(function(r){r.serverAuth="1.3.6.1.5.5.7.3.1",r.clientAuth="1.3.6.1.5.5.7.3.2",r.codeSigning="1.3.6.1.5.5.7.3.3",r.emailProtection="1.3.6.1.5.5.7.3.4",r.timeStamping="1.3.6.1.5.5.7.3.8",r.ocspSigning="1.3.6.1.5.5.7.3.9"})(_u||(_u={}));class ju extends Ke{constructor(...e){if(_.isBufferSource(e[0])){super(e[0]);const t=j.parse(this.value,Hi);this.usages=t.map(i=>i)}else{const t=new Hi(e[0]);super(qc,e[1],j.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(t=>Ot.toString(t)).join(", "),e}}ju.NAME="Extended Key Usages";var ua;(function(r){r[r.digitalSignature=1]="digitalSignature",r[r.nonRepudiation=2]="nonRepudiation",r[r.keyEncipherment=4]="keyEncipherment",r[r.dataEncipherment=8]="dataEncipherment",r[r.keyAgreement=16]="keyAgreement",r[r.keyCertSign=32]="keyCertSign",r[r.cRLSign=64]="cRLSign",r[r.encipherOnly=128]="encipherOnly",r[r.decipherOnly=256]="decipherOnly"})(ua||(ua={}));class fa extends Ke{constructor(...e){if(_.isBufferSource(e[0])){super(e[0]);const t=j.parse(this.value,qo);this.usages=t.toNumber()}else{const t=new qo(e[0]);super(zc,e[1],j.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=j.parse(this.value,qo);return e[""]=t.toJSON().join(", "),e}}fa.NAME="Key Usages";class Fn extends Ke{static async create(e,t=!1,i=Te.get()){const s=await(await lt.create(e,i)).getKeyIdentifier(i);return new Fn(L.ToHex(s),t)}constructor(...e){if(_.isBufferSource(e[0])){super(e[0]);const t=j.parse(this.value,Et);this.keyId=L.ToHex(t)}else{const t=typeof e[0]=="string"?L.FromHex(e[0]):e[0],i=new Et(t);super(Qc,e[1],j.serialize(i)),this.keyId=L.ToHex(t)}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=j.parse(this.value,Et);return e[""]=t,e}}Fn.NAME="Subject Key Identifier";class da extends Ke{constructor(...e){_.isBufferSource(e[0])?super(e[0]):super(Yc,e[1],new si(e[0]||[]).rawData)}onInit(e){super.onInit(e);const t=j.parse(e.extnValue,Jo);this.names=new si(t)}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.names.toTextObject();for(const i in t)e[i]=t[i];return e}}da.NAME="Subject Alternative Name";class ze{static register(e,t){this.items.set(e,t)}static create(e){const t=new Ke(e),i=this.items.get(t.type);return i?new i(e):t}}ze.items=new Map;class Pu extends Ke{constructor(...e){var t;if(_.isBufferSource(e[0])){super(e[0]);const i=j.parse(this.value,Ui);this.policies=i.map(n=>n.policyIdentifier)}else{const i=e[0],n=(t=e[1])!==null&&t!==void 0?t:!1,s=new Ui(i.map(c=>new Mi({policyIdentifier:c})));super(Uc,n,j.serialize(s)),this.policies=i}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(t=>new ne("",{},Ot.toString(t))),e}}Pu.NAME="Certificate Policies",ze.register(Uc,Pu);class Ru extends Ke{constructor(...e){var t;if(_.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){const n=e[0].map(c=>new ur({distributionPoint:new Kt({fullName:[new X({uniformResourceIdentifier:c})]})})),s=new fr(n);super(Do,e[1],j.serialize(s))}else{const i=new fr(e[0]);super(Do,e[1],j.serialize(i))}(t=this.distributionPoints)!==null&&t!==void 0||(this.distributionPoints=[])}onInit(e){super.onInit(e);const t=j.parse(e.extnValue,fr);this.distributionPoints=t}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(t=>{var i;const n={};return t.distributionPoint&&(n[""]=(i=t.distributionPoint.fullName)===null||i===void 0?void 0:i.map(s=>new jt(s).toString()).join(", ")),t.reasons&&(n.Reasons=t.reasons.toString()),t.cRLIssuer&&(n["CRL Issuer"]=t.cRLIssuer.map(s=>s.toString()).join(", ")),n}),e}}Ru.NAME="CRL Distribution Points";class Du extends Ke{constructor(...e){var t,i,n,s;if(_.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof lr){const c=new lr(e[0]);super(Eo,e[1],j.serialize(c))}else{const c=e[0],u=new lr;Kn(u,c,jc,"ocsp"),Kn(u,c,Pc,"caIssuers"),Kn(u,c,Rc,"timeStamping"),Kn(u,c,Dc,"caRepository"),super(Eo,e[1],j.serialize(u))}(t=this.ocsp)!==null&&t!==void 0||(this.ocsp=[]),(i=this.caIssuers)!==null&&i!==void 0||(this.caIssuers=[]),(n=this.timeStamping)!==null&&n!==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=[],j.parse(e.extnValue,lr).forEach(i=>{switch(i.accessMethod){case jc:this.ocsp.push(new jt(i.accessLocation));break;case Pc:this.caIssuers.push(new jt(i.accessLocation));break;case Rc:this.timeStamping.push(new jt(i.accessLocation));break;case Dc:this.caRepository.push(new jt(i.accessLocation));break}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&qn(e,"OCSP",this.ocsp),this.caIssuers.length&&qn(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&qn(e,"Time Stamping",this.timeStamping),this.caRepository.length&&qn(e,"CA Repository",this.caRepository),e}}Du.NAME="Authority Info Access";function qn(r,e,t){if(t.length===1)r[e]=t[0].toTextObject();else{const i=new ne("");t.forEach((n,s)=>{const c=n.toTextObject(),u=`${c[ne.NAME]} ${s+1}`;let f=i[u];Array.isArray(f)||(f=[],i[u]=f),f.push(c)}),r[e]=i}}function Kn(r,e,t,i){const n=e[i];n&&(Array.isArray(n)?n:[n]).forEach(c=>{typeof c=="string"&&(c=new jt("url",c)),r.push(new $r({accessMethod:t,accessLocation:j.parse(c.rawData,X)}))})}class Or extends Tt{constructor(...e){let t;if(_.isBufferSource(e[0]))t=_.toArrayBuffer(e[0]);else{const i=e[0],n=Array.isArray(e[1])?e[1].map(s=>_.toArrayBuffer(s)):[];t=j.serialize(new vt({type:i,values:n}))}super(t,vt)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(t=>new ne("",{"":t})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[ne.NAME]===Or.NAME&&(e[ne.NAME]=Ot.toString(this.type)),e}}Or.NAME="Attribute";class $u extends Or{constructor(...e){var t;if(_.isBufferSource(e[0]))super(e[0]);else{const i=new Mn({printableString:e[0]});super(jl,[j.serialize(i)])}(t=this.password)!==null&&t!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const t=j.parse(this.values[0],Mn);this.password=t.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[ne.VALUE]=this.password,e}}$u.NAME="Challenge Password";class pa extends Or{constructor(...e){var t;if(_.isBufferSource(e[0]))super(e[0]);else{const i=e[0],n=new zt;for(const s of i)n.push(j.parse(s.rawData,Ze));super(Ws,[j.serialize(n)])}(t=this.items)!==null&&t!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const t=j.parse(this.values[0],zt);this.items=t.map(i=>ze.create(j.serialize(i)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.items.map(i=>i.toTextObject());for(const i of t)e[i[ne.NAME]]=i;return e}}pa.NAME="Extensions";class zn{static register(e,t){this.items.set(e,t)}static create(e){const t=new Or(e),i=this.items.get(t.type);return i?new i(e):t}}zn.items=new Map;const Gn="crypto.signatureFormatter";class Fd{toAsnSignature(e,t){return _.toArrayBuffer(t)}toWebSignature(e,t){return _.toArrayBuffer(t)}}var Wn;let ha=Wn=class{static createPssParams(e,t){const i=Wn.getHashAlgorithm(e);return i?new Qt({hashAlgorithm:i,maskGenAlgorithm:new R({algorithm:Cn,parameters:j.serialize(i)}),saltLength:t}):null}static getHashAlgorithm(e){const t=Oe.resolve(Ir);return typeof e=="string"?t.toAsnAlgorithm({name:e}):typeof e=="object"&&e&&"name"in e?t.toAsnAlgorithm(e):null}toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if("hash"in e){let t;if(typeof e.hash=="string")t=e.hash;else if(e.hash&&typeof e.hash=="object"&&"name"in e.hash&&typeof e.hash.name=="string")t=e.hash.name.toUpperCase();else throw new Error("Cannot get hash algorithm name");switch(t.toLowerCase()){case"sha-1":return new R({algorithm:mn,parameters:null});case"sha-256":return new R({algorithm:Os,parameters:null});case"sha-384":return new R({algorithm:bn,parameters:null});case"sha-512":return new R({algorithm:vn,parameters:null})}}else return new R({algorithm:Yt,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");const t=Wn.createPssParams(e.hash,e.saltLength);if(!t)throw new Error("Cannot create PSS parameters");return new R({algorithm:ei,parameters:j.serialize(t)})}else return new R({algorithm:ei,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case Yt:return{name:"RSASSA-PKCS1-v1_5"};case mn:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case Os:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case bn:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case vn:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case ei:if(e.parameters){const t=j.parse(e.parameters,Qt);return{name:"RSA-PSS",hash:Oe.resolve(Ir).toWebAlgorithm(t.hashAlgorithm),saltLength:t.saltLength}}else return{name:"RSA-PSS"}}return null}};ha=Wn=a([Vn()],ha),Oe.registerSingleton(ni,ha);let ya=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new R({algorithm:wn});case"sha-256":return new R({algorithm:Sn});case"sha-384":return new R({algorithm:An});case"sha-512":return new R({algorithm:kn})}return null}toWebAlgorithm(e){switch(e.algorithm){case wn:return{name:"SHA-1"};case Sn:return{name:"SHA-256"};case An:return{name:"SHA-384"};case kn:return{name:"SHA-512"}}return null}};ya=a([Vn()],ya),Oe.registerSingleton(ni,ya);class Ge{addPadding(e,t){const i=_.toUint8Array(t),n=new Uint8Array(e);return n.set(i,e-i.length),n}removePadding(e,t=!1){let i=_.toUint8Array(e);for(let n=0;n<i.length;n++)if(i[n]){i=i.slice(n);break}if(t&&i[0]>127){const n=new Uint8Array(i.length+1);return n.set(i,1),n.buffer}return i.buffer}toAsnSignature(e,t){if(e.name==="ECDSA"){const i=e.namedCurve,n=Ge.namedCurveSize.get(i)||Ge.defaultNamedCurveSize,s=new gn,c=_.toUint8Array(t);return s.r=this.removePadding(c.slice(0,n),!0),s.s=this.removePadding(c.slice(n,n+n),!0),j.serialize(s)}return null}toWebSignature(e,t){if(e.name==="ECDSA"){const i=j.parse(t,gn),n=e.namedCurve,s=Ge.namedCurveSize.get(n)||Ge.defaultNamedCurveSize,c=this.addPadding(s,this.removePadding(i.r)),u=this.addPadding(s,this.removePadding(i.s));return rf(c,u)}return null}}Ge.namedCurveSize=new Map,Ge.defaultNamedCurveSize=32;const ga="1.3.101.110",Mu="1.3.101.111",ma="1.3.101.112",Uu="1.3.101.113";let ba=class{toAsnAlgorithm(e){let t=null;switch(e.name.toLowerCase()){case"ed25519":t=ma;break;case"x25519":t=ga;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":t=ma;break;case"ed448":t=Uu;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":t=ga;break;case"x448":t=Mu;break}}return t?new R({algorithm:t}):null}toWebAlgorithm(e){switch(e.algorithm){case ma:return{name:"Ed25519"};case Uu:return{name:"EdDSA",namedCurve:"Ed448"};case ga:return{name:"X25519"};case Mu:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};ba=a([Vn()],ba),Oe.registerSingleton(ni,ba);class qd extends kt{constructor(e){kt.isAsnEncoded(e)?super(e,ii):super(e),this.tag=Le.CertificateRequestTag}onInit(e){this.tbs=j.serialize(e.certificationRequestInfo),this.publicKey=new lt(e.certificationRequestInfo.subjectPKInfo);const t=Oe.resolve(Ir);this.signatureAlgorithm=t.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(n=>zn.create(j.serialize(n)));const i=this.getAttribute(Ws);this.extensions=[],i instanceof pa&&(this.extensions=i.items),this.subjectName=new _t(e.certificationRequestInfo.subject),this.subject=this.subjectName.toString()}getAttribute(e){for(const t of this.attributes)if(t.type===e)return t;return null}getAttributes(e){return this.attributes.filter(t=>t.type===e)}getExtension(e){for(const t of this.extensions)if(t.type===e)return t;return null}getExtensions(e){return this.extensions.filter(t=>t.type===e)}async verify(e=Te.get()){const t={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(t,["verify"],e),n=Oe.resolveAll(Gn).reverse();let s=null;for(const u of n)if(s=u.toWebSignature(t,this.signature),s)break;if(!s)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,i,s,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),t=j.parse(this.rawData,ii),i=t.certificationRequestInfo,n=new ne("",{Version:`${dr[i.version]} (${i.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const s=new ne("");for(const c of this.attributes){const u=c.toTextObject();s[u[ne.NAME]]=u}n.Attributes=s}return e.Data=n,e.Signature=new ne("",{Algorithm:er.serializeAlgorithm(t.signatureAlgorithm),"":t.signature}),e}}qd.NAME="PKCS#10 Certificate Request";class Lu extends kt{constructor(e){kt.isAsnEncoded(e)?super(e,pr):super(e),this.tag=Le.CertificateTag}onInit(e){const t=e.tbsCertificate;this.tbs=j.serialize(t),this.serialNumber=L.ToHex(t.serialNumber),this.subjectName=new _t(t.subject),this.subject=new _t(t.subject).toString(),this.issuerName=new _t(t.issuer),this.issuer=this.issuerName.toString();const i=Oe.resolve(Ir);this.signatureAlgorithm=i.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const n=t.validity.notBefore.utcTime||t.validity.notBefore.generalTime;if(!n)throw new Error("Cannot get 'notBefore' value");this.notBefore=n;const s=t.validity.notAfter.utcTime||t.validity.notAfter.generalTime;if(!s)throw new Error("Cannot get 'notAfter' value");this.notAfter=s,this.extensions=[],t.extensions&&(this.extensions=t.extensions.map(c=>ze.create(j.serialize(c)))),this.publicKey=new lt(t.subjectPublicKeyInfo)}getExtension(e){for(const t of this.extensions)if(typeof e=="string"){if(t.type===e)return t}else if(t instanceof e)return t;return null}getExtensions(e){return this.extensions.filter(t=>typeof e=="string"?t.type===e:t instanceof e)}async verify(e={},t=Te.get()){let i,n;const s=e.publicKey;try{if(!s)i={...this.publicKey.algorithm,...this.signatureAlgorithm},n=await this.publicKey.export(i,["verify"],t);else if("publicKey"in s)i={...s.publicKey.algorithm,...this.signatureAlgorithm},n=await s.publicKey.export(i,["verify"],t);else if(s instanceof lt)i={...s.algorithm,...this.signatureAlgorithm},n=await s.export(i,["verify"],t);else if(_.isBufferSource(s)){const p=new lt(s);i={...p.algorithm,...this.signatureAlgorithm},n=await p.export(i,["verify"],t)}else i={...s.algorithm,...this.signatureAlgorithm},n=s}catch{return!1}const c=Oe.resolveAll(Gn).reverse();let u=null;for(const p of c)if(u=p.toWebSignature(i,this.signature),u)break;if(!u)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const f=await t.subtle.verify(this.signatureAlgorithm,n,u,this.tbs);if(e.signatureOnly)return f;{const b=(e.date||new Date).getTime();return f&&this.notBefore.getTime()<b&&b<this.notAfter.getTime()}}async getThumbprint(...e){let t,i="SHA-1";return e[0]&&(e[0].subtle?t=e[0]:(i=e[0]||i,t=e[1])),t??(t=Te.get()),await t.subtle.digest(i,this.rawData)}async isSelfSigned(e=Te.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),t=j.parse(this.rawData,pr),i=t.tbsCertificate,n=new ne("",{Version:`${dr[i.version]} (${i.version})`,"Serial Number":i.serialNumber,"Signature Algorithm":er.serializeAlgorithm(i.signature),Issuer:this.issuer,Validity:new ne("",{"Not Before":i.validity.notBefore.getTime(),"Not After":i.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(i.issuerUniqueID&&(n["Issuer Unique ID"]=i.issuerUniqueID),i.subjectUniqueID&&(n["Subject Unique ID"]=i.subjectUniqueID),this.extensions.length){const s=new ne("");for(const c of this.extensions){const u=c.toTextObject();s[u[ne.NAME]]=u}n.Extensions=s}return e.Data=n,e.Signature=new ne("",{Algorithm:er.serializeAlgorithm(t.signatureAlgorithm),"":t.signatureValue}),e}}Lu.NAME="Certificate";var Hu;(function(r){r[r.unspecified=0]="unspecified",r[r.keyCompromise=1]="keyCompromise",r[r.cACompromise=2]="cACompromise",r[r.affiliationChanged=3]="affiliationChanged",r[r.superseded=4]="superseded",r[r.cessationOfOperation=5]="cessationOfOperation",r[r.certificateHold=6]="certificateHold",r[r.removeFromCRL=8]="removeFromCRL",r[r.privilegeWithdrawn=9]="privilegeWithdrawn",r[r.aACompromise=10]="aACompromise"})(Hu||(Hu={})),ze.register($c,Vu),ze.register(qc,ju),ze.register(zc,fa),ze.register(Qc,Fn),ze.register(Io,li),ze.register(Yc,da),ze.register(Do,Ru),ze.register(Eo,Du),zn.register(jl,$u),zn.register(Ws,pa),Oe.registerSingleton(Gn,Fd),Oe.registerSingleton(Gn,Ge),Ge.namedCurveSize.set("P-256",32),Ge.namedCurveSize.set("K-256",32),Ge.namedCurveSize.set("P-384",48),Ge.namedCurveSize.set("P-521",66);function Fu(){return{parseMetaCertificateData:e=>{if(/{vault:\/\/.*}/g.test(e))throw new Error("not a X.509 certificate");const t=new Lu(e),i={subject:t.subjectName.toString(),issuer:t.issuer,notAfter:t.notAfter};for(const n of t.extensions)if(n instanceof da){const s=n.names.toJSON(),u=Object.entries(s).map(f=>({type:f[1].type,value:f[1].value})).reduce((f,p)=>{const b=p.type,y=f[b]??[];return{...f,[b]:[...y,p.value]}},{});for(const f in u)i.subjectAltName=`${f}=${u[f].join(", ")}`}else if(n instanceof fa){const s=Object.values(ua),c=Array(s.length/2).fill(null).reduce((u,f,p)=>{const b=s[s.length/2+p];if(n.usages&b){const y=s[p];u.push(y)}return u},[]);i.keyUsage=c}return i}}}function Kd(){const r=Fu(),e=o.ref({}),t=n=>{if(!(n.id in e.value))try{e.value[n.id]=r.parseMetaCertificateData(n.cert)}catch{e.value[n.id]=void 0}return e.value[n.id]};return{certificateDataCache:e,getCertificateData:n=>{const s=t(n);return{schemaIssuer:(s==null?void 0:s.issuer)||"",schemaSubject:(s==null?void 0:s.subject)||"",schemaExpiry:(s==null?void 0:s.notAfter)instanceof Date?s.notAfter.getTime()/1e3:0,schemaSanNames:(s==null?void 0:s.subjectAltName)||"",schemaKeyUsages:(s==null?void 0:s.keyUsage)||[]}}}}const zd={certificates:{title:"Certificates",list:{toolbar_actions:{new_certificate:"New certificate"},table_headers:{subject:"Subject",expiry:"Expiry",san:"SAN",cert:"Cert",tags:"Tags",issuer:"Issuer",snis:"SNIs"},empty_state:{title:"Configure a New Certificate",description:"Certificates handle SSL/TLS termination for encrypted requests."},empty_state_v2:{create:"New certificate",title:"Configure your first certificate",group:"Certificates created in gateways within this group will automatically appear here.",description:"Certificates manage SSL/TLS encryption, ensuring secure communication between clients and your API services."}},form:{sections:{ssl:{title:"SSL Key Pair",description:"The PEM-encoded public certificate chain and private key of the SSL key pair and the alternate."},general:{title:"General Information",description:"General information will help identify and manage this key."}},fields:{cert:{label:"Cert",tooltip:"PEM-encoded public certificate chain of the SSL key pair. This field is {emphasis}, which means it can be securely stored as a secret in a vault. References must follow a specific format.",emphasis:"referenceable"},key:{label:"Key",tooltip:"PEM-encoded private key of the SSL key pair. This field is {emphasis}, which means it can be securely stored as a secret in a vault. References must follow a specific format.",emphasis:"referenceable"},cert_alt:{label:"Cert Alt",tooltip:"PEM-encoded public certificate chain of the alternate SSL key pair. This should only be set if you have both RSA and ECDSA types of certificate available and would like Kong to prefer serving using ECDSA certs when client advertises support for it. This field is {emphasis}, which means it can be securely stored as a secret in a vault. References must follow a specific format.",emphasis:"referenceable"},key_alt:{label:"Key Alt",tooltip:"PEM-encoded private key of the alternate SSL key pair. This should only be set if you have both RSA and ECDSA types of certificate available and would like Kong to prefer serving using ECDSA certs when client advertises support for it. This field is {emphasis}, which means it can be securely stored as a secret in a vault. References must follow a specific format.",emphasis:"referenceable"},snis:{label:"SNIs",placeholder:"Enter an SNI",add:"Add an SNI",tooltip:"Zero or more hostnames to associate with this certificate as SNIs",editingTip:"To manage SNIs for this certificate, click {link}.",editingTipLink:"here"},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3",tooltip:"An optional set of strings for grouping and filtering, separated by commas."}}},actions:{create:"New certificate",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",addSni:"Add to New SNI",delete:"Delete",clear:"Clear",view:"View Details"},search:{placeholder:"Filter by exact ID"},delete:{title:"Delete a Certificate",description:"Your organization's original certificate {bolded-text}.",boldedText:"will not be affected",description2:"This action cannot be reversed so make sure to check the certificate usage before deleting."},errors:{general:"Certificates could not be retrieved",delete:"The certificate could not be deleted at this time",copy:"Failed to copy to clipboard"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"}},"ca-certificates":{title:"CA Certificates",list:{toolbar_actions:{new_ca_certificate:"New CA certificate"},table_headers:{issuer:"Issuer",expiry:"Expiry",tags:"Tags"},empty_state:{title:"Configure a New CA Certificate",description:"CA certificates validate client or server certificates."},empty_state_v2:{create:"New CA certificate",title:"Configure your first CA certificate",group:"CA Certificates created in gateways within this group will automatically appear here.",description:"CA Certificates validate the authenticity of client and server certificates, reinforcing the trust and security of your API communications."}},form:{sections:{cert:{title:"Public Certificate",description:"The PEM-encoded public certificate of the CA and it’s SHA256 hex digest."},general:{title:"General Information",description:"General information will help identify and manage this key."}},fields:{cert:{label:"Cert",tooltip:"PEM-encoded public certificate of the CA."},cert_digest:{label:"Cert Digest",tooltip:"SHA256 hex digest of the public certificate"},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3",tooltip:"An optional set of strings for grouping and filtering, separated by commas."}}},actions:{create:"New CA certificate",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",delete:"Delete",clear:"Clear",view:"View Details"},search:{placeholder:"Filter by exact ID"},delete:{title:"Delete a CA Certificate",description:"Your organization's original certificate {bolded-text}.",boldedText:"will not be affected",description2:"This action cannot be reversed so make sure to check the certificate usage before deleting."},errors:{general:"CA Certificates could not be retrieved",delete:"The CA Certificate could not be deleted at this time",copy:"Failed to copy to clipboard"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"}},general:{"key-usages":{KEY_USAGE_TYPE_KEY_CERT_SIGN:"keyCertSign",KEY_USAGE_TYPE_CRL_SIGN:"cRLSign",KEY_USAGE_TYPE_ENCIPHER_ONLY:"encipherOnly",KEY_USAGE_TYPE_DIGITAL_SIGNATURE:"digitalSignature",KEY_USAGE_TYPE_KEY_ENCIPHERMENT:"keyEncipherment",KEY_USAGE_TYPE_DATA_ENCIPHERMENT:"dataEncipherment",KEY_USAGE_TYPE_KEY_AGREEMENT:"keyAgreement",KEY_USAGE_TYPE_CONTENT_COMMITMENT:"nonRepudiation"}}};function Gd(){const r=Sa.createI18n("en-us",zd);return{i18n:r,i18nT:Sa.i18nTComponent(r)}}const Xe={useCertificate:Kd,useI18n:Gd,useX509:Fu},Jn="/v2/control-planes/{controlPlaneId}/core-entities",Yn="/{workspace}",ui={list:{konnect:`${Jn}/certificates`,kongManager:`${Yn}/certificates`},form:{konnect:{create:`${Jn}/certificates`,edit:`${Jn}/certificates/{id}`,validate:`${Jn}/v1/schemas/json/certificate/validate`},kongManager:{create:`${Yn}/certificates`,edit:`${Yn}/certificates/{id}`,validate:`${Yn}/schemas/certificates/validate`}}},Wd={class:"kong-ui-entities-certificates-list"},Jd={class:"button-row"},Yd={class:"empty-state-icon-gateway"},Zd={key:0},Qd={key:1},Xd={key:0},ep={key:1},tp={key:0},rp={key:1},ip={key:1},np=o.defineComponent({__name:"CertificateList",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||!r.createRoute||!r.getViewRoute||!r.getEditRoute||r.app==="kongManager"&&!r.isExactMatch&&!r.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canCreateSni:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},useActionOutside:{type:Boolean,default:!1},enableV2EmptyStates:{type:Boolean,default:!1}},emits:["error","click:learn-more","copy:success","copy:error","delete:success"],setup(r,{emit:e}){var Z;const t=e,i=r,{i18n:{t:n,formatUnixTimeStamp:s},i18nT:c}=Xe.useI18n(),u=hi.useRouter(),{axiosInstance:f}=N.useAxios((Z=i.config)==null?void 0:Z.axiosRequestConfig),{handleStateChange:p,hasRecords:b}=N.useTableState(()=>w.value),y=o.computed(()=>b.value&&i.config.app==="konnect"),q=o.computed(()=>!i.enableV2EmptyStates&&i.config.app==="konnect"),O=o.computed(()=>i.config.app!=="kongManager"||!!i.config.disableSorting),g={subject:{label:n("certificates.list.table_headers.subject"),hidable:!1},expiry:{label:n("certificates.list.table_headers.expiry")},san:{label:n("certificates.list.table_headers.san")},cert:{label:n("certificates.list.table_headers.cert")},tags:{label:n("certificates.list.table_headers.tags"),sortable:!0}},S=o.computed(()=>{var J,Q;let D=`${i.config.apiBaseUrl}${ui.list[i.config.app]}`;return i.config.app==="konnect"?D=D.replace(/{controlPlaneId}/gi,((J=i.config)==null?void 0:J.controlPlaneId)||""):i.config.app==="kongManager"&&(D=D.replace(/\/{workspace}/gi,(Q=i.config)!=null&&Q.workspace?`/${i.config.workspace}`:"")),D}),w=o.ref(""),E=o.computed(()=>{const D=i.config.app==="konnect"||i.config.isExactMatch;return D?{isExactMatch:D,placeholder:n("certificates.search.placeholder")}:{isExactMatch:D,schema:i.config.filterSchema}}),{fetcher:k,fetcherState:I,fetcherCacheKey:W}=N.useFetcher(o.computed(()=>({...i.config,cacheIdentifier:i.cacheIdentifier})),S),se=()=>{w.value=""},M=()=>{W.value++},C=o.ref(null),T=async(D,J)=>{const Q=D.id;if(!await J(Q)){t("copy:error",{entity:D,field:"id",message:n("certificates.errors.copy")});return}t("copy:success",{entity:D,field:"id",message:n("certificates.copy.success",{val:Q})})},me=async(D,J)=>{const Q=JSON.stringify(D);if(!await J(Q)){t("copy:error",{entity:D,message:n("certificates.errors.copy")});return}t("copy:success",{entity:D,message:n("certificates.copy.success_brief")})},ae=async D=>{var Q;await((Q=i.canRetrieve)==null?void 0:Q.call(i,D))&&u.push(i.config.getViewRoute(D.id))},ut=D=>({label:n("certificates.actions.view"),to:i.config.getViewRoute(D)}),fe=D=>({label:n("certificates.actions.edit"),to:i.config.getEditRoute(D)}),pe=D=>{if(i.config.getCreateSniRoute)return{label:n("certificates.actions.addSni"),to:i.config.getCreateSniRoute(D)}},Ee=o.ref(void 0),ee=o.ref(!1),ft=o.ref(!1),rr=o.ref(""),Tr=N.useDeleteUrlBuilder(i.config,S.value),{certificateDataCache:Pt,getCertificateData:Ct}=Xe.useCertificate(),z=D=>{Ee.value=D,ee.value=!0},dt=()=>{ee.value=!1},di=async()=>{var D,J,Q;if((D=Ee.value)!=null&&D.id){ft.value=!0;try{await f.delete(Tr(Ee.value.id)),ft.value=!1,ee.value=!1,W.value++,t("delete:success",Ee.value)}catch($e){rr.value=((Q=(J=$e.response)==null?void 0:J.data)==null?void 0:Q.message)||$e.message||n("certificates.errors.delete"),t("error",$e)}finally{ft.value=!1}}},le=()=>{u.push(i.config.createRoute)};o.watch(I,D=>{var J,Q,$e;if(D.status===N.FetcherStatus.Error){C.value={title:n("certificates.errors.general")},($e=(Q=(J=D.error)==null?void 0:J.response)==null?void 0:Q.data)!=null&&$e.message&&(C.value.message=D.error.response.data.message),t("error",D.error);return}Pt.value={},C.value=null});const Rt=o.ref({ctaPath:i.config.createRoute,ctaText:void 0,message:`${n("certificates.list.empty_state.description")}${i.config.additionMessageForEmptyState?` ${i.config.additionMessageForEmptyState}`:""}`,title:n("certificates.title")});return o.onBeforeMount(async()=>{await i.canCreate()&&(Rt.value.title=n("certificates.list.empty_state.title"),Rt.value.ctaText=n("certificates.actions.create"))}),(D,J)=>{const Q=o.resolveComponent("KButton"),$e=o.resolveComponent("KCopy"),Y=o.resolveComponent("KDropdownItem"),Ce=o.resolveComponent("KClipboardProvider");return o.openBlock(),o.createElementBlock("div",Wd,[o.createVNode(o.unref(N.EntityBaseTable),{"cache-identifier":r.cacheIdentifier,"disable-sorting":O.value,"empty-state-options":Rt.value,"enable-entity-actions":"","error-message":C.value,fetcher:o.unref(k),"fetcher-cache-key":o.unref(W),"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-certificates-list",query:w.value,"table-headers":o.unref(g),onClearSearchInput:se,"onClick:row":J[4]||(J[4]=G=>ae(G)),onSort:M,onState:o.unref(p)},o.createSlots({"toolbar-filter":o.withCtx(()=>[o.createVNode(o.unref(N.EntityFilter),{modelValue:w.value,"onUpdate:modelValue":J[0]||(J[0]=G=>w.value=G),config:E.value},null,8,["modelValue","config"])]),"toolbar-button":o.withCtx(()=>[(o.openBlock(),o.createBlock(o.Teleport,{disabled:!r.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[o.createElementVNode("div",Jd,[y.value?(o.openBlock(),o.createBlock(Q,{key:0,appearance:"secondary",class:"open-learning-hub","data-testid":"certificates-learn-more-button",icon:"",onClick:J[1]||(J[1]=G=>D.$emit("click:learn-more"))},{default:o.withCtx(()=>[o.createVNode(o.unref(tt.BookIcon),{decorative:""})]),_:1})):o.createCommentVNode("",!0),o.createVNode(o.unref(N.PermissionsWrapper),{"auth-function":()=>r.canCreate()},{default:o.withCtx(()=>[o.createVNode(Q,{appearance:"primary","data-testid":"toolbar-add-certificate",size:r.useActionOutside?"medium":"large",to:r.config.createRoute},{default:o.withCtx(()=>[o.createVNode(o.unref(tt.AddIcon)),o.createTextVNode(" "+o.toDisplayString(o.unref(n)("certificates.list.toolbar_actions.new_certificate")),1)]),_:1},8,["size","to"])]),_:1},8,["auth-function"])])],8,["disabled"]))]),subject:o.withCtx(({row:G})=>{var ve;return[r.config.app==="konnect"?(o.openBlock(),o.createElementBlock("b",Zd,o.toDisplayString((ve=G==null?void 0:G.metadata)!=null&&ve.subject?G.metadata.subject:"-"),1)):(o.openBlock(),o.createElementBlock("b",Qd,o.toDisplayString(o.unref(Ct)(G).schemaSubject||"-"),1))]}),expiry:o.withCtx(({row:G})=>{var ve;return[r.config.app==="konnect"?(o.openBlock(),o.createElementBlock("span",Xd,o.toDisplayString((ve=G==null?void 0:G.metadata)!=null&&ve.expiry?o.unref(s)(G.metadata.expiry):"-"),1)):(o.openBlock(),o.createElementBlock("span",ep,o.toDisplayString(o.unref(Ct)(G).schemaExpiry?o.unref(s)(o.unref(Ct)(G).schemaExpiry):"-"),1))]}),san:o.withCtx(({row:G})=>{var ve;return[r.config.app==="konnect"?(o.openBlock(),o.createElementBlock("span",tp,o.toDisplayString((ve=G==null?void 0:G.metadata)!=null&&ve.dns_names?`dns=${G.metadata.dns_names.join(", ")}`:"-"),1)):(o.openBlock(),o.createElementBlock("span",rp,o.toDisplayString(o.unref(Ct)(G).schemaSanNames||"-"),1))]}),cert:o.withCtx(({row:G})=>[G!=null&&G.cert?(o.openBlock(),o.createBlock($e,{key:0,"data-testid":"copy-certificate-cert",text:G.cert,truncate:""},null,8,["text"])):(o.openBlock(),o.createElementBlock("span",ip,"-"))]),tags:o.withCtx(({row:G})=>[o.createVNode(o.unref(N.TableTags),{tags:G==null?void 0:G.tags},null,8,["tags"])]),actions:o.withCtx(({row:G})=>[o.createVNode(Ce,null,{default:o.withCtx(({copyToClipboard:ve})=>[o.createVNode(Y,{"data-testid":"action-entity-copy-id",onClick:Xn=>T(G,ve)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("certificates.actions.copy_id")),1)]),_:2},1032,["onClick"])]),_:2},1024),o.createVNode(Ce,null,{default:o.withCtx(({copyToClipboard:ve})=>[o.createVNode(Y,{"data-testid":"action-entity-copy-json",onClick:Xn=>me(G,ve)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("certificates.actions.copy_json")),1)]),_:2},1032,["onClick"])]),_:2},1024),o.createVNode(o.unref(N.PermissionsWrapper),{"auth-function":()=>r.canRetrieve(G)},{default:o.withCtx(()=>[o.createVNode(Y,{"data-testid":"action-entity-view","has-divider":"",item:ut(G.id)},null,8,["item"])]),_:2},1032,["auth-function"]),o.createVNode(o.unref(N.PermissionsWrapper),{"auth-function":()=>r.canEdit(G)},{default:o.withCtx(()=>[o.createVNode(Y,{"data-testid":"action-entity-edit",item:fe(G.id)},null,8,["item"])]),_:2},1032,["auth-function"]),r.config.getCreateSniRoute?(o.openBlock(),o.createBlock(o.unref(N.PermissionsWrapper),{key:0,"auth-function":()=>r.canCreateSni()},{default:o.withCtx(()=>[o.createVNode(Y,{"data-testid":"action-entity-add-sni",item:pe(G.id)},null,8,["item"])]),_:2},1032,["auth-function"])):o.createCommentVNode("",!0),o.createVNode(o.unref(N.PermissionsWrapper),{"auth-function":()=>r.canDelete(G)},{default:o.withCtx(()=>[o.createVNode(Y,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:ve=>z(G)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("certificates.actions.delete")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"])]),_:2},[!o.unref(b)&&q.value?{name:"outside-actions",fn:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.Teleport,{disabled:!r.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[o.createVNode(Q,{appearance:"secondary",class:"open-learning-hub","data-testid":"certificates-learn-more-button",icon:"",onClick:J[2]||(J[2]=G=>D.$emit("click:learn-more"))},{default:o.withCtx(()=>[o.createVNode(o.unref(tt.BookIcon),{decorative:""})]),_:1})],8,["disabled"]))]),key:"0"}:void 0,!w.value&&r.enableV2EmptyStates&&r.config.app==="konnect"?{name:"empty-state",fn:o.withCtx(()=>{var G;return[o.createVNode(o.unref(N.EntityEmptyState),{"action-button-text":o.unref(n)("certificates.list.empty_state_v2.create"),appearance:"secondary","can-create":()=>r.canCreate(),"data-testid":"certificates-entity-empty-state",description:o.unref(n)("certificates.list.empty_state_v2.description"),"learn-more":r.config.app==="konnect",title:o.unref(n)("certificates.list.empty_state_v2.title"),"onClick:create":le,"onClick:learnMore":J[3]||(J[3]=ve=>D.$emit("click:learn-more"))},o.createSlots({image:o.withCtx(()=>[o.createElementVNode("div",Yd,[o.createVNode(o.unref(tt.ServiceDocumentIcon),{color:o.unref(Aa),size:o.unref(ka)},null,8,["color","size"])])]),_:2},[(G=r.config)!=null&&G.isControlPlaneGroup?{name:"message",fn:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("certificates.list.empty_state_v2.group")),1)]),key:"0"}:void 0]),1032,["action-button-text","can-create","description","learn-more","title"])]}),key:"1"}:void 0]),1032,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","query","table-headers","onState"]),o.createVNode(o.unref(N.EntityDeleteModal),{"action-pending":ft.value,"entity-type":o.unref(N.EntityTypes).Certificate,error:rr.value,title:o.unref(n)("certificates.delete.title"),visible:ee.value,onCancel:dt,onProceed:di},{description:o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"certificates.delete.description",scope:"global"},{"bolded-text":o.withCtx(()=>[o.createElementVNode("b",null,o.toDisplayString(o.unref(n)("certificates.delete.boldedText")),1)]),_:1}),o.createElementVNode("p",null,o.toDisplayString(o.unref(n)("certificates.delete.description2")),1)]),_:1},8,["action-pending","entity-type","error","title","visible"])])}}}),tr=(r,e)=>{const t=r.__vccOpts||r;for(const[i,n]of e)t[i]=n;return t},op=tr(np,[["__scopeId","data-v-93203b6f"]]),sp={class:"sni-field-container"},ap={key:1,class:"sni-field-controls-container"},cp={key:0},lp=tr(o.defineComponent({__name:"CertificateFormSniField",props:{isEditing:{type:Boolean,default:!1},modelValue:{type:Array,required:!0},sniListRoute:{type:Object,required:!0}},emits:["add","remove","update:modelValue"],setup(r,{emit:e}){const t=r,i=e,{i18nT:n,i18n:{t:s}}=Xe.useI18n(),c=o.ref([]);return o.watch(t.modelValue,u=>{c.value=[...u]},{immediate:!0,deep:!0}),o.watch(c,u=>{i("update:modelValue",u)},{deep:!0}),(u,f)=>{const p=o.resolveComponent("KLabel"),b=o.resolveComponent("KInput"),y=o.resolveComponent("KButton"),q=o.resolveComponent("router-link");return o.openBlock(),o.createElementBlock("div",sp,[o.createVNode(p,{info:o.unref(s)("certificates.form.fields.snis.tooltip")},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("certificates.form.fields.snis.label")),1)]),_:1},8,["info"]),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(c.value,(O,d)=>(o.openBlock(),o.createElementBlock("div",{key:d,class:"sni-field-input"},[!r.isEditing||c.value[d]?(o.openBlock(),o.createBlock(b,{key:0,modelValue:c.value[d],"onUpdate:modelValue":g=>c.value[d]=g,modelModifiers:{trim:!0},"data-testid":`sni-field-input-${d+1}`,disabled:r.isEditing,placeholder:o.unref(s)("certificates.form.fields.snis.placeholder")},null,8,["modelValue","onUpdate:modelValue","data-testid","disabled","placeholder"])):o.createCommentVNode("",!0),r.isEditing?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",ap,[o.createVNode(y,{appearance:"tertiary",class:"remove-button","data-testid":"remove-sni",icon:"",onClick:g=>u.$emit("remove",d)},{default:o.withCtx(()=>[o.createVNode(o.unref(tt.TrashIcon),{color:o.unref(Zu)},null,8,["color"])]),_:2},1032,["onClick"]),o.createVNode(y,{appearance:"tertiary","data-testid":"add-sni",disabled:d!==c.value.length-1,icon:"",onClick:f[0]||(f[0]=g=>u.$emit("add"))},{default:o.withCtx(()=>[o.createVNode(o.unref(tt.AddIcon))]),_:2},1032,["disabled"])]))]))),128)),c.value.length===0?(o.openBlock(),o.createElementBlock("div",cp,[o.createVNode(y,{onClick:f[1]||(f[1]=O=>u.$emit("add"))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("certificates.form.fields.snis.add")),1)]),_:1})])):o.createCommentVNode("",!0),r.isEditing?(o.openBlock(),o.createBlock(o.unref(n),{key:1,keypath:"certificates.form.fields.snis.editingTip"},{link:o.withCtx(()=>[o.createVNode(q,{to:r.sniListRoute},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)("certificates.form.fields.snis.editingTipLink")),1)]),_:1},8,["to"])]),_:1})):o.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-89e994ac"]]),up={class:"kong-ui-entities-certificates-form"},fp=tr(o.defineComponent({__name:"CertificateForm",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||r.app==="konnect"&&!r.controlPlaneId||r.app==="kongManager"&&typeof r.workspace!="string"||!r.cancelRoute)},certificateId:{type:String,required:!1,default:""},showSnisField:{type:Boolean,required:!1,default:!1}},emits:["update","error","loading"],setup(r,{emit:e}){var se;const t=e,i=r,n=hi.useRouter(),{i18nT:s,i18n:{t:c}}=Xe.useI18n(),{getMessageFromError:u}=N.useErrors(),{axiosInstance:f}=N.useAxios((se=i.config)==null?void 0:se.axiosRequestConfig),p=o.computed(()=>ui.form[i.config.app].edit),b=o.computed(()=>i.certificateId?N.EntityBaseFormType.Edit:N.EntityBaseFormType.Create),y=o.reactive({fields:{cert:"",key:"",certAlt:"",keyAlt:"",snis:[""],tags:""},isReadonly:!1,errorMessage:""}),q=o.reactive({cert:"",key:"",certAlt:"",keyAlt:"",snis:[""],tags:""}),O=o.computed(()=>(b.value===N.EntityBaseFormType.Create||JSON.stringify(y.fields)!==JSON.stringify(q))&&!!y.fields.cert&&!!y.fields.key),d=M=>{var C,T;y.fields.cert=(M==null?void 0:M.cert)||"",y.fields.key=(M==null?void 0:M.key)||"",y.fields.certAlt=(M==null?void 0:M.cert_alt)||"",y.fields.keyAlt=(M==null?void 0:M.key_alt)||"",y.fields.snis=(C=M==null?void 0:M.snis)!=null&&C.length?M.snis:[""],y.fields.tags=((T=M==null?void 0:M.tags)==null?void 0:T.join(", "))||"",Object.assign(q,y.fields)},g=()=>{n.push(i.config.cancelRoute)},S=()=>{y.fields.snis.push("")},w=M=>{y.fields.snis.splice(M,1)},E=o.computed(()=>{var C,T;let M=`${i.config.apiBaseUrl}${ui.form[i.config.app].validate}`;return i.config.app==="konnect"?M=M.replace(/{controlPlaneId}/gi,((C=i.config)==null?void 0:C.controlPlaneId)||""):i.config.app==="kongManager"&&(M=M.replace(/\/{workspace}/gi,(T=i.config)!=null&&T.workspace?`/${i.config.workspace}`:"")),M=M.replace(/{id}/gi,i.certificateId),M}),k=o.computed(()=>{var C,T;let M=`${i.config.apiBaseUrl}${ui.form[i.config.app][b.value]}`;return i.config.app==="konnect"?M=M.replace(/{controlPlaneId}/gi,((C=i.config)==null?void 0:C.controlPlaneId)||""):i.config.app==="kongManager"&&(M=M.replace(/\/{workspace}/gi,(T=i.config)!=null&&T.workspace?`/${i.config.workspace}`:"")),M=M.replace(/{id}/gi,i.certificateId),M}),I=o.computed(()=>{var M,C;return{cert:y.fields.cert,key:y.fields.key,cert_alt:y.fields.certAlt||null,key_alt:y.fields.keyAlt||null,...i.showSnisField?{snis:y.fields.snis.filter(Boolean)}:{},tags:(C=(M=y.fields.tags.split(","))==null?void 0:M.map(T=>String(T||"").trim()))==null?void 0:C.filter(T=>T!=="")}}),W=async()=>{var M,C,T,me,ae,ut,fe,pe,Ee;try{y.isReadonly=!0;let ee;await f.post(E.value,I.value),b.value==="create"?ee=await f.post(k.value,I.value):b.value==="edit"&&(ee=((M=i.config)==null?void 0:M.app)==="konnect"?await f.put(k.value,I.value):await f.patch(k.value,I.value)),y.fields.cert=((C=ee==null?void 0:ee.data)==null?void 0:C.cert)||"",y.fields.key=((T=ee==null?void 0:ee.data)==null?void 0:T.key)||"",y.fields.certAlt=((me=ee==null?void 0:ee.data)==null?void 0:me.cert_alt)||"",y.fields.keyAlt=((ae=ee==null?void 0:ee.data)==null?void 0:ae.key_alt)||"",y.fields.snis=(fe=(ut=ee==null?void 0:ee.data)==null?void 0:ut.snis)!=null&&fe.length?ee.data.snis:[""],y.fields.tags=((Ee=(pe=ee==null?void 0:ee.data)==null?void 0:pe.tags)==null?void 0:Ee.join(", "))||"",Object.assign(q,y.fields),t("update",ee==null?void 0:ee.data)}catch(ee){y.errorMessage=u(ee),t("error",ee)}finally{y.isReadonly=!1}};return(M,C)=>{const T=o.resolveComponent("KTextArea"),me=o.resolveComponent("KInput");return o.openBlock(),o.createElementBlock("div",up,[o.createVNode(o.unref(N.EntityBaseForm),{"can-submit":O.value,config:r.config,"edit-id":r.certificateId,"entity-type":o.unref(N.SupportedEntityType).Certificate,"error-message":y.errorMessage,"fetch-url":p.value,"form-fields":I.value,"is-readonly":y.isReadonly,onCancel:g,"onFetch:error":C[7]||(C[7]=ae=>M.$emit("error",ae)),"onFetch:success":d,onLoading:C[8]||(C[8]=ae=>M.$emit("loading",ae)),onSubmit:W},{default:o.withCtx(()=>[o.createVNode(o.unref(N.EntityFormSection),{description:o.unref(c)("certificates.form.sections.ssl.description"),title:o.unref(c)("certificates.form.sections.ssl.title")},{default:o.withCtx(()=>[o.createVNode(T,{modelValue:y.fields.cert,"onUpdate:modelValue":C[0]||(C[0]=ae=>y.fields.cert=ae),modelModifiers:{trim:!0},"character-limit":!1,class:"certificate-form-textarea","data-testid":"certificate-form-cert",label:o.unref(c)("certificates.form.fields.cert.label"),"label-attributes":{tooltipAttributes:{maxWidth:"400"}},readonly:y.isReadonly,required:""},{"label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(s),{keypath:"certificates.form.fields.cert.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("em",null,o.toDisplayString(o.unref(c)("certificates.form.fields.cert.emphasis")),1)]),_:1})]),_:1},8,["modelValue","label","readonly"]),o.createVNode(T,{modelValue:y.fields.key,"onUpdate:modelValue":C[1]||(C[1]=ae=>y.fields.key=ae),modelModifiers:{trim:!0},"character-limit":!1,class:"certificate-form-textarea","data-testid":"certificate-form-key",label:o.unref(c)("certificates.form.fields.key.label"),"label-attributes":{tooltipAttributes:{maxWidth:"400"}},readonly:y.isReadonly,required:""},{"label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(s),{keypath:"certificates.form.fields.key.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("em",null,o.toDisplayString(o.unref(c)("certificates.form.fields.key.emphasis")),1)]),_:1})]),_:1},8,["modelValue","label","readonly"]),o.createVNode(T,{modelValue:y.fields.certAlt,"onUpdate:modelValue":C[2]||(C[2]=ae=>y.fields.certAlt=ae),modelModifiers:{trim:!0},"character-limit":!1,class:"certificate-form-textarea","data-testid":"certificate-form-cert-alt",label:o.unref(c)("certificates.form.fields.cert_alt.label"),"label-attributes":{tooltipAttributes:{maxWidth:"400"}},readonly:y.isReadonly},{"label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(s),{keypath:"certificates.form.fields.cert_alt.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("em",null,o.toDisplayString(o.unref(c)("certificates.form.fields.cert_alt.emphasis")),1)]),_:1})]),_:1},8,["modelValue","label","readonly"]),o.createVNode(T,{modelValue:y.fields.keyAlt,"onUpdate:modelValue":C[3]||(C[3]=ae=>y.fields.keyAlt=ae),modelModifiers:{trim:!0},"character-limit":!1,class:"certificate-form-textarea","data-testid":"certificate-form-key-alt",label:o.unref(c)("certificates.form.fields.key_alt.label"),"label-attributes":{tooltipAttributes:{maxWidth:"400"}},readonly:y.isReadonly},{"label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(s),{keypath:"certificates.form.fields.key_alt.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("em",null,o.toDisplayString(o.unref(c)("certificates.form.fields.key_alt.emphasis")),1)]),_:1})]),_:1},8,["modelValue","label","readonly"]),r.showSnisField&&r.config.sniListRoute?(o.openBlock(),o.createBlock(lp,{key:0,modelValue:y.fields.snis,"onUpdate:modelValue":C[4]||(C[4]=ae=>y.fields.snis=ae),"is-editing":b.value===o.unref(N.EntityBaseFormType).Edit,"sni-list-route":r.config.sniListRoute,onAdd:S,onRemove:C[5]||(C[5]=ae=>w(ae))},null,8,["modelValue","is-editing","sni-list-route"])):o.createCommentVNode("",!0)]),_:1},8,["description","title"]),o.createVNode(o.unref(N.EntityFormSection),{description:o.unref(c)("certificates.form.sections.general.description"),title:o.unref(c)("certificates.form.sections.general.title")},{default:o.withCtx(()=>[o.createVNode(me,{modelValue:y.fields.tags,"onUpdate:modelValue":C[6]||(C[6]=ae=>y.fields.tags=ae),modelModifiers:{trim:!0},autocomplete:"off","data-testid":"certificate-form-tags",help:o.unref(c)("certificates.form.fields.tags.help"),label:o.unref(c)("certificates.form.fields.tags.label"),"label-attributes":{info:o.unref(c)("certificates.form.fields.tags.tooltip"),tooltipAttributes:{maxWidth:"400"}},placeholder:o.unref(c)("certificates.form.fields.tags.placeholder"),readonly:y.isReadonly,type:"text"},null,8,["modelValue","help","label","label-attributes","placeholder","readonly"])]),_:1},8,["description","title"])]),_:1},8,["can-submit","config","edit-id","entity-type","error-message","fetch-url","form-fields","is-readonly"])])}}}),[["__scopeId","data-v-7988c8e6"]]),Zn="/v2/control-planes/{controlPlaneId}/core-entities",Qn="/{workspace}",fi={list:{konnect:`${Zn}/ca_certificates`,kongManager:`${Qn}/ca_certificates`},form:{konnect:{create:`${Zn}/ca_certificates`,edit:`${Zn}/ca_certificates/{id}`,validate:`${Zn}/v1/schemas/json/ca-certificate/validate`},kongManager:{create:`${Qn}/ca_certificates`,edit:`${Qn}/ca_certificates/{id}`,validate:`${Qn}/schemas/ca_certificates/validate`}}},dp={class:"kong-ui-ca-certificate-entity-config-card"},pp={key:0},hp=tr(o.defineComponent({__name:"CACertificateConfigCard",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||r.app==="konnect"&&!r.controlPlaneId||r.app==="kongManager"&&typeof r.workspace!="string"||!r.entityId)},configCardDoc:{type:String,default:"",required:!1},hideTitle:{type:Boolean,default:!1}},emits:["loading","fetch:error","fetch:success"],setup(r,{emit:e}){const t=["dns_names","san_names","subject"],i=e,n=r,{i18n:{t:s,formatUnixTimeStamp:c}}=Xe.useI18n(),{convertKeyToTitle:u}=N.useStringHelpers(),{getPropValue:f}=N.useHelpers(),{getCertificateData:p}=Xe.useCertificate(),b=o.computed(()=>fi.form[n.config.app].edit),y=o.ref(),q=o.computed(()=>{if(y.value)return p(y.value)}),O=o.computed(()=>{var k;return((k=q.value)==null?void 0:k.schemaIssuer)||""}),d=o.computed(()=>{var k,I;return(k=q.value)!=null&&k.schemaExpiry?c((I=q.value)==null?void 0:I.schemaExpiry):""}),g=o.computed(()=>{var k;return((k=q.value)==null?void 0:k.schemaKeyUsages)||[]}),S=(k,I)=>{const W=f("rowValue",I);if(k==="expiry")return d.value;if(k==="key_usages")return g.value;if(W)return W[k]},w=k=>{y.value=k,i("fetch:success",k)},E=o.ref({id:{},updated_at:{},created_at:{},cert:{section:N.ConfigurationSchemaSection.Basic,label:s("ca-certificates.form.fields.cert.label"),tooltip:s("ca-certificates.form.fields.cert.tooltip"),order:5},cert_digest:{section:N.ConfigurationSchemaSection.Basic,label:s("ca-certificates.form.fields.cert_digest.label"),tooltip:s("ca-certificates.form.fields.cert_digest.tooltip"),order:6},metadata:{section:N.ConfigurationSchemaSection.Basic,type:N.ConfigurationSchemaType.Json,order:7},...n.config.app==="kongManager"&&{expiry:{label:s("certificates.list.table_headers.expiry"),section:N.ConfigurationSchemaSection.Basic,order:1.7,forceShow:!0},issuer:{section:N.ConfigurationSchemaSection.Basic,order:1.5,forceShow:!0},key_usages:{section:N.ConfigurationSchemaSection.Basic,forceShow:!0}},tags:{tooltip:s("ca-certificates.form.fields.tags.tooltip")}});return(k,I)=>{const W=o.resolveComponent("KCodeBlock"),se=o.resolveComponent("KLabel"),M=o.resolveComponent("KBadge");return o.openBlock(),o.createElementBlock("div",dp,[o.createVNode(o.unref(N.EntityBaseConfigCard),{config:r.config,"config-card-doc":r.configCardDoc,"config-schema":E.value,"entity-type":o.unref(N.SupportedEntityType).CaCertificate,"fetch-url":b.value,"hide-title":r.hideTitle,"onFetch:error":I[0]||(I[0]=C=>k.$emit("fetch:error",C)),"onFetch:success":w,onLoading:I[1]||(I[1]=C=>k.$emit("loading",C))},{cert:o.withCtx(C=>[o.unref(f)("rowValue",C)?(o.openBlock(),o.createBlock(W,{key:0,id:`ca-cert-${r.config.entityId}-cert-codeblock`,code:o.unref(f)("rowValue",C),language:"plaintext","single-line":""},null,8,["id","code"])):o.createCommentVNode("",!0)]),"metadata-label":o.withCtx(()=>[o.createVNode(se,{class:"metadata-label"},{default:o.withCtx(()=>I[2]||(I[2]=[o.createTextVNode(" Metadata ")])),_:1})]),metadata:o.withCtx(C=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Object.keys(o.unref(f)("rowValue",C)).filter(T=>!t.includes(T)),T=>(o.openBlock(),o.createBlock(o.unref(N.ConfigCardItem),{key:T,"data-testid":`ca-cert-metadata-${T}`,item:{key:T,label:o.unref(u)(T),value:S(T,C),type:T==="key_usages"?o.unref(N.ConfigurationSchemaType).BadgeTag:o.unref(N.ConfigurationSchemaType).Text}},null,8,["data-testid","item"]))),128))]),expiry:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(d.value||"–"),1)]),issuer:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.value||"–"),1)]),key_usages:o.withCtx(()=>[g.value.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",pp,o.toDisplayString("–"))),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(g.value,(C,T)=>(o.openBlock(),o.createBlock(M,{key:`key_usages-badge-tag-${T}`,class:"config-badge","data-testid":`key_usages-badge-tag-${T}`,tooltip:C,"truncation-tooltip":""},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(C),1)]),_:2},1032,["data-testid","tooltip"]))),128))]),_:1},8,["config","config-card-doc","config-schema","entity-type","fetch-url","hide-title"])])}}}),[["__scopeId","data-v-03b2633e"]]),yp={class:"kong-ui-entities-ca-certificates-list"},gp={class:"button-row"},mp={class:"empty-state-icon-gateway"},bp={key:0},vp={key:1},wp={key:0},Sp={key:1},Ap=tr(o.defineComponent({__name:"CACertificateList",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||!r.createRoute||!r.getViewRoute||!r.getEditRoute||r.app==="kongManager"&&!r.isExactMatch&&!r.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},useActionOutside:{type:Boolean,default:!1},enableV2EmptyStates:{type:Boolean,default:!1}},emits:["error","click:learn-more","copy:success","copy:error","delete:success"],setup(r,{emit:e}){var Rt;const t=e,i=r,{i18n:{t:n,formatUnixTimeStamp:s},i18nT:c}=Xe.useI18n(),u=hi.useRouter(),{axiosInstance:f}=N.useAxios((Rt=i.config)==null?void 0:Rt.axiosRequestConfig),{hasRecords:p,handleStateChange:b}=N.useTableState(()=>w.value),y=o.computed(()=>p.value&&i.config.app==="konnect"),q=o.computed(()=>!i.enableV2EmptyStates&&i.config.app==="konnect"),O=o.computed(()=>i.config.app!=="kongManager"||!!i.config.disableSorting),g={issuer:{label:n("ca-certificates.list.table_headers.issuer"),hidable:!1},expiry:{label:n("ca-certificates.list.table_headers.expiry")},tags:{label:n("ca-certificates.list.table_headers.tags"),sortable:!0}},S=o.computed(()=>{var D,J;let Z=`${i.config.apiBaseUrl}${fi.list[i.config.app]}`;return i.config.app==="konnect"?Z=Z.replace(/{controlPlaneId}/gi,((D=i.config)==null?void 0:D.controlPlaneId)||""):i.config.app==="kongManager"&&(Z=Z.replace(/\/{workspace}/gi,(J=i.config)!=null&&J.workspace?`/${i.config.workspace}`:"")),Z}),w=o.ref(""),E=o.computed(()=>{const Z=i.config.app==="konnect"||i.config.isExactMatch;return Z?{isExactMatch:Z,placeholder:n("ca-certificates.search.placeholder")}:{isExactMatch:Z,schema:i.config.filterSchema}}),{fetcher:k,fetcherState:I,fetcherCacheKey:W}=N.useFetcher(o.computed(()=>({...i.config,cacheIdentifier:i.cacheIdentifier})),S),se=()=>{w.value=""},M=()=>{W.value++},C=o.ref(null),T=async(Z,D)=>{const J=Z.id;if(!await D(J)){t("copy:error",{entity:Z,field:"id",message:n("ca-certificates.errors.copy")});return}t("copy:success",{entity:Z,field:"id",message:n("ca-certificates.copy.success",{val:J})})},me=async(Z,D)=>{const J=JSON.stringify(Z);if(!await D(J)){t("copy:error",{entity:Z,message:n("ca-certificates.errors.copy")});return}t("copy:success",{entity:Z,message:n("ca-certificates.copy.success_brief")})},ae=async Z=>{var J;await((J=i.canRetrieve)==null?void 0:J.call(i,Z))&&u.push(i.config.getViewRoute(Z.id))},ut=Z=>({label:n("ca-certificates.actions.view"),to:i.config.getViewRoute(Z)}),fe=Z=>({label:n("ca-certificates.actions.edit"),to:i.config.getEditRoute(Z)}),pe=o.ref(void 0),Ee=o.ref(!1),ee=o.ref(!1),ft=o.ref(""),rr=N.useDeleteUrlBuilder(i.config,S.value),{certificateDataCache:Tr,getCertificateData:Pt}=Xe.useCertificate(),Ct=Z=>{pe.value=Z,Ee.value=!0},z=()=>{Ee.value=!1},dt=async()=>{var Z,D,J;if((Z=pe.value)!=null&&Z.id){ee.value=!0;try{await f.delete(rr(pe.value.id)),ee.value=!1,Ee.value=!1,W.value++,t("delete:success",pe.value)}catch(Q){ft.value=((J=(D=Q.response)==null?void 0:D.data)==null?void 0:J.message)||Q.message||n("ca-certificates.errors.delete"),t("error",Q)}finally{ee.value=!1}}},di=()=>{u.push(i.config.createRoute)};o.watch(I,Z=>{var D,J,Q;if(Z.status===N.FetcherStatus.Error){C.value={title:n("ca-certificates.errors.general")},(Q=(J=(D=Z.error)==null?void 0:D.response)==null?void 0:J.data)!=null&&Q.message&&(C.value.message=Z.error.response.data.message),t("error",Z.error);return}Tr.value={},C.value=null});const le=o.ref({ctaPath:i.config.createRoute,ctaText:void 0,message:`${n("ca-certificates.list.empty_state.description")}${i.config.additionMessageForEmptyState?` ${i.config.additionMessageForEmptyState}`:""}`,title:n("ca-certificates.title")});return o.onBeforeMount(async()=>{await i.canCreate()&&(le.value.title=n("ca-certificates.list.empty_state.title"),le.value.ctaText=n("ca-certificates.actions.create"))}),(Z,D)=>{const J=o.resolveComponent("KButton"),Q=o.resolveComponent("KDropdownItem"),$e=o.resolveComponent("KClipboardProvider");return o.openBlock(),o.createElementBlock("div",yp,[o.createVNode(o.unref(N.EntityBaseTable),{"cache-identifier":r.cacheIdentifier,"disable-sorting":O.value,"empty-state-options":le.value,"enable-entity-actions":"","error-message":C.value,fetcher:o.unref(k),"fetcher-cache-key":o.unref(W),"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-ca-certificates-list",query:w.value,"table-headers":o.unref(g),onClearSearchInput:se,"onClick:row":D[4]||(D[4]=Y=>ae(Y)),onSort:M,onState:o.unref(b)},o.createSlots({"toolbar-filter":o.withCtx(()=>[o.createVNode(o.unref(N.EntityFilter),{modelValue:w.value,"onUpdate:modelValue":D[0]||(D[0]=Y=>w.value=Y),config:E.value},null,8,["modelValue","config"])]),"toolbar-button":o.withCtx(()=>[(o.openBlock(),o.createBlock(o.Teleport,{disabled:!r.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[o.createElementVNode("div",gp,[y.value?(o.openBlock(),o.createBlock(J,{key:0,appearance:"secondary",class:"open-learning-hub","data-testid":"ca-certificates-learn-more-button",icon:"",onClick:D[1]||(D[1]=Y=>Z.$emit("click:learn-more"))},{default:o.withCtx(()=>[o.createVNode(o.unref(tt.BookIcon),{decorative:""})]),_:1})):o.createCommentVNode("",!0),o.createVNode(o.unref(N.PermissionsWrapper),{"auth-function":()=>r.canCreate()},{default:o.withCtx(()=>[o.createVNode(J,{appearance:"primary","data-testid":"toolbar-add-ca-certificate",size:r.useActionOutside?"medium":"large",to:r.config.createRoute},{default:o.withCtx(()=>[o.createVNode(o.unref(tt.AddIcon)),o.createTextVNode(" "+o.toDisplayString(o.unref(n)("ca-certificates.list.toolbar_actions.new_ca_certificate")),1)]),_:1},8,["size","to"])]),_:1},8,["auth-function"])])],8,["disabled"]))]),issuer:o.withCtx(({row:Y})=>{var Ce;return[r.config.app==="konnect"?(o.openBlock(),o.createElementBlock("b",bp,o.toDisplayString((Ce=Y==null?void 0:Y.metadata)!=null&&Ce.issuer?Y.metadata.issuer:"-"),1)):(o.openBlock(),o.createElementBlock("b",vp,o.toDisplayString(o.unref(Pt)(Y).schemaIssuer||"-"),1))]}),expiry:o.withCtx(({row:Y})=>{var Ce;return[r.config.app==="konnect"?(o.openBlock(),o.createElementBlock("span",wp,o.toDisplayString((Ce=Y==null?void 0:Y.metadata)!=null&&Ce.expiry?o.unref(s)(Y.metadata.expiry):"-"),1)):(o.openBlock(),o.createElementBlock("span",Sp,o.toDisplayString(o.unref(Pt)(Y).schemaExpiry?o.unref(s)(o.unref(Pt)(Y).schemaExpiry):"-"),1))]}),tags:o.withCtx(({row:Y})=>[o.createVNode(o.unref(N.TableTags),{tags:Y==null?void 0:Y.tags},null,8,["tags"])]),actions:o.withCtx(({row:Y})=>[o.createVNode($e,null,{default:o.withCtx(({copyToClipboard:Ce})=>[o.createVNode(Q,{"data-testid":"action-entity-copy-id",onClick:G=>T(Y,Ce)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("ca-certificates.actions.copy_id")),1)]),_:2},1032,["onClick"])]),_:2},1024),o.createVNode($e,null,{default:o.withCtx(({copyToClipboard:Ce})=>[o.createVNode(Q,{"data-testid":"action-entity-copy-json",onClick:G=>me(Y,Ce)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("ca-certificates.actions.copy_json")),1)]),_:2},1032,["onClick"])]),_:2},1024),o.createVNode(o.unref(N.PermissionsWrapper),{"auth-function":()=>r.canRetrieve(Y)},{default:o.withCtx(()=>[o.createVNode(Q,{"data-testid":"action-entity-view","has-divider":"",item:ut(Y.id)},null,8,["item"])]),_:2},1032,["auth-function"]),o.createVNode(o.unref(N.PermissionsWrapper),{"auth-function":()=>r.canEdit(Y)},{default:o.withCtx(()=>[o.createVNode(Q,{"data-testid":"action-entity-edit",item:fe(Y.id)},null,8,["item"])]),_:2},1032,["auth-function"]),o.createVNode(o.unref(N.PermissionsWrapper),{"auth-function":()=>r.canDelete(Y)},{default:o.withCtx(()=>[o.createVNode(Q,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:Ce=>Ct(Y)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("ca-certificates.actions.delete")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"])]),_:2},[!o.unref(p)&&q.value?{name:"outside-actions",fn:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.Teleport,{disabled:!r.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[o.createVNode(J,{appearance:"secondary",class:"open-learning-hub","data-testid":"ca-certificates-learn-more-button",icon:"",onClick:D[2]||(D[2]=Y=>Z.$emit("click:learn-more"))},{default:o.withCtx(()=>[o.createVNode(o.unref(tt.BookIcon),{decorative:""})]),_:1})],8,["disabled"]))]),key:"0"}:void 0,!w.value&&r.enableV2EmptyStates&&r.config.app==="konnect"?{name:"empty-state",fn:o.withCtx(()=>{var Y;return[o.createVNode(o.unref(N.EntityEmptyState),{"action-button-text":o.unref(n)("ca-certificates.list.empty_state_v2.create"),appearance:"secondary","can-create":()=>r.canCreate(),"data-testid":"ca-certificates-entity-empty-state",description:o.unref(n)("ca-certificates.list.empty_state_v2.description"),"learn-more":r.config.app==="konnect",title:o.unref(n)("ca-certificates.list.empty_state_v2.title"),"onClick:create":di,"onClick:learnMore":D[3]||(D[3]=Ce=>Z.$emit("click:learn-more"))},o.createSlots({image:o.withCtx(()=>[o.createElementVNode("div",mp,[o.createVNode(o.unref(tt.ServiceDocumentIcon),{color:o.unref(Aa),size:o.unref(ka)},null,8,["color","size"])])]),_:2},[(Y=r.config)!=null&&Y.isControlPlaneGroup?{name:"message",fn:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("ca-certificates.list.empty_state_v2.group")),1)]),key:"0"}:void 0]),1032,["action-button-text","can-create","description","learn-more","title"])]}),key:"1"}:void 0]),1032,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","query","table-headers","onState"]),o.createVNode(o.unref(N.EntityDeleteModal),{"action-pending":ee.value,"entity-type":o.unref(N.EntityTypes).CACertificate,error:ft.value,title:o.unref(n)("ca-certificates.delete.title"),visible:Ee.value,onCancel:z,onProceed:dt},{description:o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"ca-certificates.delete.description",scope:"global"},{"bolded-text":o.withCtx(()=>[o.createElementVNode("b",null,o.toDisplayString(o.unref(n)("ca-certificates.delete.boldedText")),1)]),_:1}),o.createElementVNode("p",null,o.toDisplayString(o.unref(n)("ca-certificates.delete.description2")),1)]),_:1},8,["action-pending","entity-type","error","title","visible"])])}}}),[["__scopeId","data-v-3f8f4a0c"]]),kp={class:"kong-ui-entities-ca-certificates-form"},Cp=tr(o.defineComponent({__name:"CACertificateForm",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||r.app==="konnect"&&!r.controlPlaneId||r.app==="kongManager"&&typeof r.workspace!="string"||!r.cancelRoute)},certificateId:{type:String,required:!1,default:""}},emits:["update","error","loading"],setup(r,{emit:e}){var k;const t=e,i=r,n=hi.useRouter(),{i18n:{t:s}}=Xe.useI18n(),{getMessageFromError:c}=N.useErrors(),{axiosInstance:u}=N.useAxios((k=i.config)==null?void 0:k.axiosRequestConfig),f=o.computed(()=>fi.form[i.config.app].edit),p=o.computed(()=>i.certificateId?N.EntityBaseFormType.Edit:N.EntityBaseFormType.Create),b=o.reactive({fields:{cert:"",certDigest:"",tags:""},isReadonly:!1,errorMessage:""}),y=o.reactive({cert:"",certDigest:"",tags:""}),q=o.computed(()=>(p.value===N.EntityBaseFormType.Create||JSON.stringify(b.fields)!==JSON.stringify(y))&&!!b.fields.cert),O=I=>{var W;b.fields.cert=(I==null?void 0:I.cert)||"",b.fields.certDigest=(I==null?void 0:I.cert_digest)||"",b.fields.tags=((W=I==null?void 0:I.tags)==null?void 0:W.join(", "))||"",Object.assign(y,b.fields)},d=()=>{n.push(i.config.cancelRoute)},g=o.computed(()=>{var W,se;let I=`${i.config.apiBaseUrl}${fi.form[i.config.app].validate}`;return i.config.app==="konnect"?I=I.replace(/{controlPlaneId}/gi,((W=i.config)==null?void 0:W.controlPlaneId)||""):i.config.app==="kongManager"&&(I=I.replace(/\/{workspace}/gi,(se=i.config)!=null&&se.workspace?`/${i.config.workspace}`:"")),I=I.replace(/{id}/gi,i.certificateId),I}),S=o.computed(()=>{var W,se;let I=`${i.config.apiBaseUrl}${fi.form[i.config.app][p.value]}`;return i.config.app==="konnect"?I=I.replace(/{controlPlaneId}/gi,((W=i.config)==null?void 0:W.controlPlaneId)||""):i.config.app==="kongManager"&&(I=I.replace(/\/{workspace}/gi,(se=i.config)!=null&&se.workspace?`/${i.config.workspace}`:"")),I=I.replace(/{id}/gi,i.certificateId),I}),w=o.computed(()=>{var I,W;return{cert:b.fields.cert,cert_digest:b.fields.certDigest||null,tags:(W=(I=b.fields.tags.split(","))==null?void 0:I.map(se=>String(se||"").trim()))==null?void 0:W.filter(se=>se!=="")}}),E=async()=>{var I,W,se,M,C;try{b.isReadonly=!0;let T;await u.post(g.value,w.value),p.value==="create"?T=await u.post(S.value,w.value):p.value==="edit"&&(T=((I=i.config)==null?void 0:I.app)==="konnect"?await u.put(S.value,w.value):await u.patch(S.value,w.value)),b.fields.cert=((W=T==null?void 0:T.data)==null?void 0:W.cert)||"",b.fields.certDigest=((se=T==null?void 0:T.data)==null?void 0:se.cert_digest)||"",b.fields.tags=((C=(M=T==null?void 0:T.data)==null?void 0:M.tags)==null?void 0:C.join(", "))||"",Object.assign(y,b.fields),t("update",T==null?void 0:T.data)}catch(T){b.errorMessage=c(T),t("error",T)}finally{b.isReadonly=!1}};return(I,W)=>{const se=o.resolveComponent("KTextArea"),M=o.resolveComponent("KInput");return o.openBlock(),o.createElementBlock("div",kp,[o.createVNode(o.unref(N.EntityBaseForm),{"can-submit":q.value,config:r.config,"edit-id":r.certificateId,"entity-type":o.unref(N.SupportedEntityType).CaCertificate,"error-message":b.errorMessage,"fetch-url":f.value,"form-fields":w.value,"is-readonly":b.isReadonly,onCancel:d,"onFetch:error":W[3]||(W[3]=C=>I.$emit("error",C)),"onFetch:success":O,onLoading:W[4]||(W[4]=C=>I.$emit("loading",C)),onSubmit:E},{default:o.withCtx(()=>[o.createVNode(o.unref(N.EntityFormSection),{description:o.unref(s)("ca-certificates.form.sections.cert.description"),title:o.unref(s)("ca-certificates.form.sections.cert.title")},{default:o.withCtx(()=>[o.createVNode(se,{modelValue:b.fields.cert,"onUpdate:modelValue":W[0]||(W[0]=C=>b.fields.cert=C),modelModifiers:{trim:!0},"character-limit":!1,class:"certificate-form-textarea","data-testid":"ca-certificate-form-cert",label:o.unref(s)("ca-certificates.form.fields.cert.label"),"label-attributes":{info:o.unref(s)("ca-certificates.form.fields.cert.tooltip"),tooltipAttributes:{maxWidth:"400"}},readonly:b.isReadonly,required:""},null,8,["modelValue","label","label-attributes","readonly"]),o.createVNode(M,{modelValue:b.fields.certDigest,"onUpdate:modelValue":W[1]||(W[1]=C=>b.fields.certDigest=C),modelModifiers:{trim:!0},autocomplete:"off","data-testid":"ca-certificate-form-cert-digest",label:o.unref(s)("ca-certificates.form.fields.cert_digest.label"),readonly:b.isReadonly,type:"text"},null,8,["modelValue","label","readonly"])]),_:1},8,["description","title"]),o.createVNode(o.unref(N.EntityFormSection),{description:o.unref(s)("ca-certificates.form.sections.general.description"),title:o.unref(s)("ca-certificates.form.sections.general.title")},{default:o.withCtx(()=>[o.createVNode(M,{modelValue:b.fields.tags,"onUpdate:modelValue":W[2]||(W[2]=C=>b.fields.tags=C),modelModifiers:{trim:!0},autocomplete:"off","data-testid":"ca-certificate-form-tags",help:o.unref(s)("ca-certificates.form.fields.tags.help"),label:o.unref(s)("ca-certificates.form.fields.tags.label"),"label-attributes":{info:o.unref(s)("ca-certificates.form.fields.tags.tooltip"),tooltipAttributes:{maxWidth:"400"}},placeholder:o.unref(s)("ca-certificates.form.fields.tags.placeholder"),readonly:b.isReadonly,type:"text"},null,8,["modelValue","help","label","label-attributes","placeholder","readonly"])]),_:1},8,["description","title"])]),_:1},8,["can-submit","config","edit-id","entity-type","error-message","fetch-url","form-fields","is-readonly"])])}}}),[["__scopeId","data-v-a850d9bb"]]),xp={class:"kong-ui-certificate-entity-config-card"},Bp={key:0},Ep=tr(o.defineComponent({__name:"CertificateConfigCard",props:{config:{type:Object,required:!0,validator:r=>!(!r||!["konnect","kongManager"].includes(r==null?void 0:r.app)||r.app==="konnect"&&!r.controlPlaneId||r.app==="kongManager"&&typeof r.workspace!="string"||!r.entityId)},configCardDoc:{type:String,default:"",required:!1},hideTitle:{type:Boolean,default:!1}},emits:["loading","fetch:error","fetch:success"],setup(r,{emit:e}){const t=e,i=r,{i18n:{t:n,formatUnixTimeStamp:s},i18nT:c}=Xe.useI18n(),{convertKeyToTitle:u}=N.useStringHelpers(),{getPropValue:f}=N.useHelpers(),{getCertificateData:p}=Xe.useCertificate(),b=o.computed(()=>ui.form[i.config.app].edit),y=o.ref(),q=o.ref({id:{},cert:{section:N.ConfigurationSchemaSection.Basic},key:{section:N.ConfigurationSchemaSection.Basic,type:N.ConfigurationSchemaType.Redacted},metadata:{section:N.ConfigurationSchemaSection.Basic,type:N.ConfigurationSchemaType.Json},snis:{section:N.ConfigurationSchemaSection.Basic,type:N.ConfigurationSchemaType.BadgeTag,label:n("certificates.list.table_headers.snis")},updated_at:{},created_at:{},tags:{tooltip:n("certificates.form.fields.tags.tooltip")},...i.config.app==="kongManager"&&{expiry:{section:N.ConfigurationSchemaSection.Basic,label:n("certificates.list.table_headers.expiry"),forceShow:!0},issuer:{section:N.ConfigurationSchemaSection.Basic,label:n("certificates.list.table_headers.issuer"),forceShow:!0},san_names:{section:N.ConfigurationSchemaSection.Basic,label:n("certificates.list.table_headers.san"),forceShow:!0},subject:{section:N.ConfigurationSchemaSection.Basic,label:n("certificates.list.table_headers.subject"),forceShow:!0},key_usages:{forceShow:!0}},cert_alt:{section:N.ConfigurationSchemaSection.Advanced},key_alt:{section:N.ConfigurationSchemaSection.Advanced,type:N.ConfigurationSchemaType.Redacted}}),O=C=>{y.value=C,t("fetch:success",C)},d=(C,T)=>{const me=f("rowValue",T);if(C==="expiry")return S.value;if(C==="key_usages")return I.value;if(C==="san_names")return E.value;if(me)return me[C]},g=o.computed(()=>{if(y.value)return p(y.value)}),S=o.computed(()=>{var C,T;return(C=g.value)!=null&&C.schemaExpiry?s((T=g.value)==null?void 0:T.schemaExpiry):""}),w=o.computed(()=>{var C;return((C=g.value)==null?void 0:C.schemaIssuer)||""}),E=o.computed(()=>{var C;return((C=g.value)==null?void 0:C.schemaSanNames)||""}),k=o.computed(()=>{var C;return((C=g.value)==null?void 0:C.schemaSubject)||""}),I=o.computed(()=>{var C;return((C=g.value)==null?void 0:C.schemaKeyUsages)||[]}),W=o.computed(()=>{var C,T;return((T=(C=y==null?void 0:y.value)==null?void 0:C.snis)==null?void 0:T.length)>0}),se=o.computed(()=>{var C;return!!((C=y==null?void 0:y.value)!=null&&C.cert_alt)}),M=C=>{var T,me;return C==="san_names"?n("certificates.list.table_headers.san"):((me=(T=q.value)==null?void 0:T[C])==null?void 0:me.label)||u(C)};return(C,T)=>{const me=o.resolveComponent("KCodeBlock"),ae=o.resolveComponent("KLabel"),ut=o.resolveComponent("KBadge");return o.openBlock(),o.createElementBlock("div",xp,[o.createVNode(o.unref(N.EntityBaseConfigCard),{config:r.config,"config-card-doc":r.configCardDoc,"config-schema":q.value,"entity-type":o.unref(N.SupportedEntityType).Certificate,"fetch-url":b.value,"hide-title":r.hideTitle,"onFetch:error":T[0]||(T[0]=fe=>C.$emit("fetch:error",fe)),"onFetch:success":O,onLoading:T[1]||(T[1]=fe=>C.$emit("loading",fe))},o.createSlots({"cert-label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"certificates.form.fields.cert.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("i",null,o.toDisplayString(o.unref(n)("certificates.form.fields.cert.emphasis")),1)]),_:1})]),cert:o.withCtx(fe=>[o.unref(f)("rowValue",fe)?(o.openBlock(),o.createBlock(me,{key:0,id:`certificate-${r.config.entityId}-cert-codeblock`,code:o.unref(f)("rowValue",fe),language:"plaintext","single-line":""},null,8,["id","code"])):o.createCommentVNode("",!0)]),"key-label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"certificates.form.fields.key.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("i",null,o.toDisplayString(o.unref(n)("certificates.form.fields.key.emphasis")),1)]),_:1})]),"metadata-label":o.withCtx(()=>[o.createVNode(ae,{class:"metadata-label"},{default:o.withCtx(()=>T[2]||(T[2]=[o.createTextVNode(" Metadata ")])),_:1})]),metadata:o.withCtx(fe=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Object.keys(o.unref(f)("rowValue",fe)),pe=>(o.openBlock(),o.createBlock(o.unref(N.ConfigCardItem),{key:pe,item:{key:pe,value:d(pe,fe),label:M(pe),type:pe==="key_usages"||pe==="snis"||pe==="dns_names"?o.unref(N.ConfigurationSchemaType).BadgeTag:o.unref(N.ConfigurationSchemaType).Text}},null,8,["item"]))),128))]),expiry:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(S.value||"–"),1)]),issuer:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(w.value||"–"),1)]),san_names:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(E.value||"–"),1)]),subject:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(k.value||"–"),1)]),"cert_alt-label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"certificates.form.fields.cert_alt.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("i",null,o.toDisplayString(o.unref(n)("certificates.form.fields.cert_alt.emphasis")),1)]),_:1})]),"key_alt-label-tooltip":o.withCtx(()=>[o.createVNode(o.unref(c),{keypath:"certificates.form.fields.key_alt.tooltip",scope:"global"},{emphasis:o.withCtx(()=>[o.createElementVNode("i",null,o.toDisplayString(o.unref(n)("certificates.form.fields.key_alt.emphasis")),1)]),_:1})]),key_usages:o.withCtx(()=>[I.value.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Bp,o.toDisplayString("–"))),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(I.value,(fe,pe)=>(o.openBlock(),o.createBlock(ut,{key:`key_usages-badge-tag-${pe}`,class:"config-badge","data-testid":`key_usages-badge-tag-${pe}`,tooltip:fe,"truncation-tooltip":""},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(fe),1)]),_:2},1032,["data-testid","tooltip"]))),128))]),_:2},[W.value?void 0:{name:"snis",fn:o.withCtx(()=>[T[3]||(T[3]=o.createTextVNode(" – "))]),key:"0"},se.value?{name:"cert_alt",fn:o.withCtx(fe=>[T[4]||(T[4]=o.createTextVNode(" > ")),o.unref(f)("rowValue",fe)?(o.openBlock(),o.createBlock(me,{key:0,id:`certificate-${r.config.entityId}-cert-alt-codeblock`,code:o.unref(f)("rowValue",fe),language:"plaintext","single-line":""},null,8,["id","code"])):o.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["config","config-card-doc","config-schema","entity-type","fetch-url","hide-title"])])}}}),[["__scopeId","data-v-605d185b"]]);xe.CACertificateConfigCard=hp,xe.CACertificateForm=Cp,xe.CACertificateList=Ap,xe.CertificateConfigCard=Ep,xe.CertificateForm=fp,xe.CertificateList=op,Object.defineProperty(xe,Symbol.toStringTag,{value:"Module"})});
|