New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

request-crypto

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

request-crypto - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

dist/extension/index.d.ts

2

dist/index.cjs.js

@@ -1,1 +0,1 @@

"use strict";var t=require("axios"),r=require("buffer");const e=(t=16,r="high")=>{const e=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],i=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],n=[0,1,2,3,4,5,6,7,8,9],o=["!","@","-","_","=","<",">","#","*","%","+","&","^","$"],s=[];let h="";const u=function(...t){let r="";return t.forEach((t=>{r+=t[Math.floor(Math.random()*t.length)]})),r};switch(r){case"high":h+=u(e,i,n,o),s.push(...e,...i,...n,...o);break;case"medium":h+=u(e,i,n),s.push(...e,...i,...n);break;default:h+=u(e,n),s.push(...e,...n)}const a=t-h.length;for(let t=0;t<a;t++)h+=u(s);return h};function i(t,r="utf-8"){return new TextDecoder(r).decode(t)}function n(t){try{return t instanceof ArrayBuffer?o(i(t)):t}catch(t){throw console.error("error",t),t}}function o(t){try{return"string"==typeof t?JSON.parse(t):t}catch(t){throw console.error("error",t),t}}const s=t=>{let r=!0;return!(t=>/^\/bi-api\/api/.test(t))(t)&&(t.startsWith("/api")&&(r=!1,(t=>/^\/(api\/logmanage|api\/data-source|api\/enterpriseadmin|api\/componentmanager|api\/spacemanager|api\/filemanager)/.test(t))(t)&&(r=!0)),r)},h=t=>({...{key:e(16,"high"),algorithm:t||"SM4"}}),u=()=>({mode:"ecb",padding:"pkcs#5",output:"array"});var a,f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},c={exports:{}};a=c,function(){var t;function r(t,r,e){null!=t&&("number"==typeof t?this.fromNumber(t,r,e):null==r&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,r))}function e(){return new r(null)}var i="undefined"!=typeof navigator;i&&"Microsoft Internet Explorer"==navigator.appName?(r.prototype.am=function(t,r,e,i,n,o){for(var s=32767&r,h=r>>15;--o>=0;){var u=32767&this[t],a=this[t++]>>15,f=h*u+a*s;n=((u=s*u+((32767&f)<<15)+e[i]+(1073741823&n))>>>30)+(f>>>15)+h*a+(n>>>30),e[i++]=1073741823&u}return n},t=30):i&&"Netscape"!=navigator.appName?(r.prototype.am=function(t,r,e,i,n,o){for(;--o>=0;){var s=r*this[t++]+e[i]+n;n=Math.floor(s/67108864),e[i++]=67108863&s}return n},t=26):(r.prototype.am=function(t,r,e,i,n,o){for(var s=16383&r,h=r>>14;--o>=0;){var u=16383&this[t],a=this[t++]>>14,f=h*u+a*s;n=((u=s*u+((16383&f)<<14)+e[i]+n)>>28)+(f>>14)+h*a,e[i++]=268435455&u}return n},t=28),r.prototype.DB=t,r.prototype.DM=(1<<t)-1,r.prototype.DV=1<<t,r.prototype.FV=Math.pow(2,52),r.prototype.F1=52-t,r.prototype.F2=2*t-52;var n,o,s="0123456789abcdefghijklmnopqrstuvwxyz",h=new Array;for(n="0".charCodeAt(0),o=0;o<=9;++o)h[n++]=o;for(n="a".charCodeAt(0),o=10;o<36;++o)h[n++]=o;for(n="A".charCodeAt(0),o=10;o<36;++o)h[n++]=o;function u(t){return s.charAt(t)}function f(t,r){var e=h[t.charCodeAt(r)];return null==e?-1:e}function c(t){var r=e();return r.fromInt(t),r}function l(t){var r,e=1;return 0!=(r=t>>>16)&&(t=r,e+=16),0!=(r=t>>8)&&(t=r,e+=8),0!=(r=t>>4)&&(t=r,e+=4),0!=(r=t>>2)&&(t=r,e+=2),0!=(r=t>>1)&&(t=r,e+=1),e}function p(t){this.m=t}function y(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function m(t,r){return t&r}function g(t,r){return t|r}function d(t,r){return t^r}function v(t,r){return t&~r}function w(t){if(0==t)return-1;var r=0;return 65535&t||(t>>=16,r+=16),255&t||(t>>=8,r+=8),15&t||(t>>=4,r+=4),3&t||(t>>=2,r+=2),1&t||++r,r}function T(t){for(var r=0;0!=t;)t&=t-1,++r;return r}function F(){}function b(t){return t}function B(t){this.r2=e(),this.q3=e(),r.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}p.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},p.prototype.revert=function(t){return t},p.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},p.prototype.mulTo=function(t,r,e){t.multiplyTo(r,e),this.reduce(e)},p.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)},y.prototype.convert=function(t){var i=e();return t.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),t.s<0&&i.compareTo(r.ZERO)>0&&this.m.subTo(i,i),i},y.prototype.revert=function(t){var r=e();return t.copyTo(r),this.reduce(r),r},y.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var r=0;r<this.m.t;++r){var e=32767&t[r],i=e*this.mpl+((e*this.mph+(t[r]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[e=r+this.m.t]+=this.m.am(0,i,t,r,0,this.m.t);t[e]>=t.DV;)t[e]-=t.DV,t[++e]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},y.prototype.mulTo=function(t,r,e){t.multiplyTo(r,e),this.reduce(e)},y.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)},r.prototype.copyTo=function(t){for(var r=this.t-1;r>=0;--r)t[r]=this[r];t.t=this.t,t.s=this.s},r.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},r.prototype.fromString=function(t,e){var i;if(16==e)i=4;else if(8==e)i=3;else if(256==e)i=8;else if(2==e)i=1;else if(32==e)i=5;else{if(4!=e)return void this.fromRadix(t,e);i=2}this.t=0,this.s=0;for(var n=t.length,o=!1,s=0;--n>=0;){var h=8==i?255&t[n]:f(t,n);h<0?"-"==t.charAt(n)&&(o=!0):(o=!1,0==s?this[this.t++]=h:s+i>this.DB?(this[this.t-1]|=(h&(1<<this.DB-s)-1)<<s,this[this.t++]=h>>this.DB-s):this[this.t-1]|=h<<s,(s+=i)>=this.DB&&(s-=this.DB))}8==i&&128&t[0]&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&r.ZERO.subTo(this,this)},r.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},r.prototype.dlShiftTo=function(t,r){var e;for(e=this.t-1;e>=0;--e)r[e+t]=this[e];for(e=t-1;e>=0;--e)r[e]=0;r.t=this.t+t,r.s=this.s},r.prototype.drShiftTo=function(t,r){for(var e=t;e<this.t;++e)r[e-t]=this[e];r.t=Math.max(this.t-t,0),r.s=this.s},r.prototype.lShiftTo=function(t,r){var e,i=t%this.DB,n=this.DB-i,o=(1<<n)-1,s=Math.floor(t/this.DB),h=this.s<<i&this.DM;for(e=this.t-1;e>=0;--e)r[e+s+1]=this[e]>>n|h,h=(this[e]&o)<<i;for(e=s-1;e>=0;--e)r[e]=0;r[s]=h,r.t=this.t+s+1,r.s=this.s,r.clamp()},r.prototype.rShiftTo=function(t,r){r.s=this.s;var e=Math.floor(t/this.DB);if(e>=this.t)r.t=0;else{var i=t%this.DB,n=this.DB-i,o=(1<<i)-1;r[0]=this[e]>>i;for(var s=e+1;s<this.t;++s)r[s-e-1]|=(this[s]&o)<<n,r[s-e]=this[s]>>i;i>0&&(r[this.t-e-1]|=(this.s&o)<<n),r.t=this.t-e,r.clamp()}},r.prototype.subTo=function(t,r){for(var e=0,i=0,n=Math.min(t.t,this.t);e<n;)i+=this[e]-t[e],r[e++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i-=t.s;e<this.t;)i+=this[e],r[e++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;e<t.t;)i-=t[e],r[e++]=i&this.DM,i>>=this.DB;i-=t.s}r.s=i<0?-1:0,i<-1?r[e++]=this.DV+i:i>0&&(r[e++]=i),r.t=e,r.clamp()},r.prototype.multiplyTo=function(t,e){var i=this.abs(),n=t.abs(),o=i.t;for(e.t=o+n.t;--o>=0;)e[o]=0;for(o=0;o<n.t;++o)e[o+i.t]=i.am(0,n[o],e,o,0,i.t);e.s=0,e.clamp(),this.s!=t.s&&r.ZERO.subTo(e,e)},r.prototype.squareTo=function(t){for(var r=this.abs(),e=t.t=2*r.t;--e>=0;)t[e]=0;for(e=0;e<r.t-1;++e){var i=r.am(e,r[e],t,2*e,0,1);(t[e+r.t]+=r.am(e+1,2*r[e],t,2*e+1,i,r.t-e-1))>=r.DV&&(t[e+r.t]-=r.DV,t[e+r.t+1]=1)}t.t>0&&(t[t.t-1]+=r.am(e,r[e],t,2*e,0,1)),t.s=0,t.clamp()},r.prototype.divRemTo=function(t,i,n){var o=t.abs();if(!(o.t<=0)){var s=this.abs();if(s.t<o.t)return null!=i&&i.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=e());var h=e(),u=this.s,a=t.s,f=this.DB-l(o[o.t-1]);f>0?(o.lShiftTo(f,h),s.lShiftTo(f,n)):(o.copyTo(h),s.copyTo(n));var c=h.t,p=h[c-1];if(0!=p){var y=p*(1<<this.F1)+(c>1?h[c-2]>>this.F2:0),m=this.FV/y,g=(1<<this.F1)/y,d=1<<this.F2,v=n.t,w=v-c,T=null==i?e():i;for(h.dlShiftTo(w,T),n.compareTo(T)>=0&&(n[n.t++]=1,n.subTo(T,n)),r.ONE.dlShiftTo(c,T),T.subTo(h,h);h.t<c;)h[h.t++]=0;for(;--w>=0;){var F=n[--v]==p?this.DM:Math.floor(n[v]*m+(n[v-1]+d)*g);if((n[v]+=h.am(0,F,n,w,0,c))<F)for(h.dlShiftTo(w,T),n.subTo(T,n);n[v]<--F;)n.subTo(T,n)}null!=i&&(n.drShiftTo(c,i),u!=a&&r.ZERO.subTo(i,i)),n.t=c,n.clamp(),f>0&&n.rShiftTo(f,n),u<0&&r.ZERO.subTo(n,n)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var r=3&t;return(r=(r=(r=(r=r*(2-(15&t)*r)&15)*(2-(255&t)*r)&255)*(2-((65535&t)*r&65535))&65535)*(2-t*r%this.DV)%this.DV)>0?this.DV-r:-r},r.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},r.prototype.exp=function(t,i){if(t>4294967295||t<1)return r.ONE;var n=e(),o=e(),s=i.convert(this),h=l(t)-1;for(s.copyTo(n);--h>=0;)if(i.sqrTo(n,o),(t&1<<h)>0)i.mulTo(o,s,n);else{var u=n;n=o,o=u}return i.revert(n)},r.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var r;if(16==t)r=4;else if(8==t)r=3;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return this.toRadix(t);r=2}var e,i=(1<<r)-1,n=!1,o="",s=this.t,h=this.DB-s*this.DB%r;if(s-- >0)for(h<this.DB&&(e=this[s]>>h)>0&&(n=!0,o=u(e));s>=0;)h<r?(e=(this[s]&(1<<h)-1)<<r-h,e|=this[--s]>>(h+=this.DB-r)):(e=this[s]>>(h-=r)&i,h<=0&&(h+=this.DB,--s)),e>0&&(n=!0),n&&(o+=u(e));return n?o:"0"},r.prototype.negate=function(){var t=e();return r.ZERO.subTo(this,t),t},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(t){var r=this.s-t.s;if(0!=r)return r;var e=this.t;if(0!=(r=e-t.t))return this.s<0?-r:r;for(;--e>=0;)if(0!=(r=this[e]-t[e]))return r;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+l(this[this.t-1]^this.s&this.DM)},r.prototype.mod=function(t){var i=e();return this.abs().divRemTo(t,null,i),this.s<0&&i.compareTo(r.ZERO)>0&&t.subTo(i,i),i},r.prototype.modPowInt=function(t,r){var e;return e=t<256||r.isEven()?new p(r):new y(r),this.exp(t,e)},r.ZERO=c(0),r.ONE=c(1),F.prototype.convert=b,F.prototype.revert=b,F.prototype.mulTo=function(t,r,e){t.multiplyTo(r,e)},F.prototype.sqrTo=function(t,r){t.squareTo(r)},B.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var r=e();return t.copyTo(r),this.reduce(r),r},B.prototype.revert=function(t){return t},B.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},B.prototype.mulTo=function(t,r,e){t.multiplyTo(r,e),this.reduce(e)},B.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)};var q,x,E,S=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],D=(1<<26)/S[S.length-1];function I(){var t;t=(new Date).getTime(),x[E++]^=255&t,x[E++]^=t>>8&255,x[E++]^=t>>16&255,x[E++]^=t>>24&255,E>=H&&(E-=H)}if(r.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},r.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var r=this.chunkSize(t),i=Math.pow(t,r),n=c(i),o=e(),s=e(),h="";for(this.divRemTo(n,o,s);o.signum()>0;)h=(i+s.intValue()).toString(t).substr(1)+h,o.divRemTo(n,o,s);return s.intValue().toString(t)+h},r.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var i=this.chunkSize(e),n=Math.pow(e,i),o=!1,s=0,h=0,u=0;u<t.length;++u){var a=f(t,u);a<0?"-"==t.charAt(u)&&0==this.signum()&&(o=!0):(h=e*h+a,++s>=i&&(this.dMultiply(n),this.dAddOffset(h,0),s=0,h=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(h,0)),o&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(t,e,i){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(r.ONE.shiftLeft(t-1),g,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(r.ONE.shiftLeft(t-1),this);else{var n=new Array,o=7&t;n.length=1+(t>>3),e.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}},r.prototype.bitwiseTo=function(t,r,e){var i,n,o=Math.min(t.t,this.t);for(i=0;i<o;++i)e[i]=r(this[i],t[i]);if(t.t<this.t){for(n=t.s&this.DM,i=o;i<this.t;++i)e[i]=r(this[i],n);e.t=this.t}else{for(n=this.s&this.DM,i=o;i<t.t;++i)e[i]=r(n,t[i]);e.t=t.t}e.s=r(this.s,t.s),e.clamp()},r.prototype.changeBit=function(t,e){var i=r.ONE.shiftLeft(t);return this.bitwiseTo(i,e,i),i},r.prototype.addTo=function(t,r){for(var e=0,i=0,n=Math.min(t.t,this.t);e<n;)i+=this[e]+t[e],r[e++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i+=t.s;e<this.t;)i+=this[e],r[e++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;e<t.t;)i+=t[e],r[e++]=i&this.DM,i>>=this.DB;i+=t.s}r.s=i<0?-1:0,i>0?r[e++]=i:i<-1&&(r[e++]=this.DV+i),r.t=e,r.clamp()},r.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(t,r){if(0!=t){for(;this.t<=r;)this[this.t++]=0;for(this[r]+=t;this[r]>=this.DV;)this[r]-=this.DV,++r>=this.t&&(this[this.t++]=0),++this[r]}},r.prototype.multiplyLowerTo=function(t,r,e){var i,n=Math.min(this.t+t.t,r);for(e.s=0,e.t=n;n>0;)e[--n]=0;for(i=e.t-this.t;n<i;++n)e[n+this.t]=this.am(0,t[n],e,n,0,this.t);for(i=Math.min(t.t,r);n<i;++n)this.am(0,t[n],e,n,0,r-n);e.clamp()},r.prototype.multiplyUpperTo=function(t,r,e){--r;var i=e.t=this.t+t.t-r;for(e.s=0;--i>=0;)e[i]=0;for(i=Math.max(r-this.t,0);i<t.t;++i)e[this.t+i-r]=this.am(r-i,t[i],e,0,0,this.t+i-r);e.clamp(),e.drShiftTo(1,e)},r.prototype.modInt=function(t){if(t<=0)return 0;var r=this.DV%t,e=this.s<0?t-1:0;if(this.t>0)if(0==r)e=this[0]%t;else for(var i=this.t-1;i>=0;--i)e=(r*e+this[i])%t;return e},r.prototype.millerRabin=function(t){var i=this.subtract(r.ONE),n=i.getLowestSetBit();if(n<=0)return!1;var o=i.shiftRight(n);(t=t+1>>1)>S.length&&(t=S.length);for(var s=e(),h=0;h<t;++h){s.fromInt(S[Math.floor(Math.random()*S.length)]);var u=s.modPow(o,this);if(0!=u.compareTo(r.ONE)&&0!=u.compareTo(i)){for(var a=1;a++<n&&0!=u.compareTo(i);)if(0==(u=u.modPowInt(2,this)).compareTo(r.ONE))return!1;if(0!=u.compareTo(i))return!1}}return!0},r.prototype.clone=function(){var t=e();return this.copyTo(t),t},r.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},r.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},r.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},r.prototype.toByteArray=function(){var t=this.t,r=new Array;r[0]=this.s;var e,i=this.DB-t*this.DB%8,n=0;if(t-- >0)for(i<this.DB&&(e=this[t]>>i)!=(this.s&this.DM)>>i&&(r[n++]=e|this.s<<this.DB-i);t>=0;)i<8?(e=(this[t]&(1<<i)-1)<<8-i,e|=this[--t]>>(i+=this.DB-8)):(e=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),128&e&&(e|=-256),0==n&&(128&this.s)!=(128&e)&&++n,(n>0||e!=this.s)&&(r[n++]=e);return r},r.prototype.equals=function(t){return 0==this.compareTo(t)},r.prototype.min=function(t){return this.compareTo(t)<0?this:t},r.prototype.max=function(t){return this.compareTo(t)>0?this:t},r.prototype.and=function(t){var r=e();return this.bitwiseTo(t,m,r),r},r.prototype.or=function(t){var r=e();return this.bitwiseTo(t,g,r),r},r.prototype.xor=function(t){var r=e();return this.bitwiseTo(t,d,r),r},r.prototype.andNot=function(t){var r=e();return this.bitwiseTo(t,v,r),r},r.prototype.not=function(){for(var t=e(),r=0;r<this.t;++r)t[r]=this.DM&~this[r];return t.t=this.t,t.s=~this.s,t},r.prototype.shiftLeft=function(t){var r=e();return t<0?this.rShiftTo(-t,r):this.lShiftTo(t,r),r},r.prototype.shiftRight=function(t){var r=e();return t<0?this.lShiftTo(-t,r):this.rShiftTo(t,r),r},r.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+w(this[t]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var t=0,r=this.s&this.DM,e=0;e<this.t;++e)t+=T(this[e]^r);return t},r.prototype.testBit=function(t){var r=Math.floor(t/this.DB);return r>=this.t?0!=this.s:!!(this[r]&1<<t%this.DB)},r.prototype.setBit=function(t){return this.changeBit(t,g)},r.prototype.clearBit=function(t){return this.changeBit(t,v)},r.prototype.flipBit=function(t){return this.changeBit(t,d)},r.prototype.add=function(t){var r=e();return this.addTo(t,r),r},r.prototype.subtract=function(t){var r=e();return this.subTo(t,r),r},r.prototype.multiply=function(t){var r=e();return this.multiplyTo(t,r),r},r.prototype.divide=function(t){var r=e();return this.divRemTo(t,r,null),r},r.prototype.remainder=function(t){var r=e();return this.divRemTo(t,null,r),r},r.prototype.divideAndRemainder=function(t){var r=e(),i=e();return this.divRemTo(t,r,i),new Array(r,i)},r.prototype.modPow=function(t,r){var i,n,o=t.bitLength(),s=c(1);if(o<=0)return s;i=o<18?1:o<48?3:o<144?4:o<768?5:6,n=o<8?new p(r):r.isEven()?new B(r):new y(r);var h=new Array,u=3,a=i-1,f=(1<<i)-1;if(h[1]=n.convert(this),i>1){var m=e();for(n.sqrTo(h[1],m);u<=f;)h[u]=e(),n.mulTo(m,h[u-2],h[u]),u+=2}var g,d,v=t.t-1,w=!0,T=e();for(o=l(t[v])-1;v>=0;){for(o>=a?g=t[v]>>o-a&f:(g=(t[v]&(1<<o+1)-1)<<a-o,v>0&&(g|=t[v-1]>>this.DB+o-a)),u=i;!(1&g);)g>>=1,--u;if((o-=u)<0&&(o+=this.DB,--v),w)h[g].copyTo(s),w=!1;else{for(;u>1;)n.sqrTo(s,T),n.sqrTo(T,s),u-=2;u>0?n.sqrTo(s,T):(d=s,s=T,T=d),n.mulTo(T,h[g],s)}for(;v>=0&&!(t[v]&1<<o);)n.sqrTo(s,T),d=s,s=T,T=d,--o<0&&(o=this.DB-1,--v)}return n.revert(s)},r.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return r.ZERO;for(var i=t.clone(),n=this.clone(),o=c(1),s=c(0),h=c(0),u=c(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),e?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(t,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?(h.isEven()&&u.isEven()||(h.addTo(this,h),u.subTo(t,u)),h.rShiftTo(1,h)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);i.compareTo(n)>=0?(i.subTo(n,i),e&&o.subTo(h,o),s.subTo(u,s)):(n.subTo(i,n),e&&h.subTo(o,h),u.subTo(s,u))}return 0!=n.compareTo(r.ONE)?r.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u},r.prototype.pow=function(t){return this.exp(t,new F)},r.prototype.gcd=function(t){var r=this.s<0?this.negate():this.clone(),e=t.s<0?t.negate():t.clone();if(r.compareTo(e)<0){var i=r;r=e,e=i}var n=r.getLowestSetBit(),o=e.getLowestSetBit();if(o<0)return r;for(n<o&&(o=n),o>0&&(r.rShiftTo(o,r),e.rShiftTo(o,e));r.signum()>0;)(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),r.compareTo(e)>=0?(r.subTo(e,r),r.rShiftTo(1,r)):(e.subTo(r,e),e.rShiftTo(1,e));return o>0&&e.lShiftTo(o,e),e},r.prototype.isProbablePrime=function(t){var r,e=this.abs();if(1==e.t&&e[0]<=S[S.length-1]){for(r=0;r<S.length;++r)if(e[0]==S[r])return!0;return!1}if(e.isEven())return!1;for(r=1;r<S.length;){for(var i=S[r],n=r+1;n<S.length&&i<D;)i*=S[n++];for(i=e.modInt(i);r<n;)if(i%S[r++]==0)return!1}return e.millerRabin(t)},r.prototype.square=function(){var t=e();return this.squareTo(t),t},r.prototype.Barrett=B,null==x){var A;if(x=new Array,E=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var R=new Uint8Array(32);for(window.crypto.getRandomValues(R),A=0;A<32;++A)x[E++]=R[A]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var P=window.crypto.random(32);for(A=0;A<P.length;++A)x[E++]=255&P.charCodeAt(A)}for(;E<H;)A=Math.floor(65536*Math.random()),x[E++]=A>>>8,x[E++]=255&A;E=0,I()}function O(){if(null==q){for(I(),(q=new C).init(x),E=0;E<x.length;++E)x[E]=0;E=0}return q.next()}function M(){}function C(){this.i=0,this.j=0,this.S=new Array}M.prototype.nextBytes=function(t){var r;for(r=0;r<t.length;++r)t[r]=O()},C.prototype.init=function(t){var r,e,i;for(r=0;r<256;++r)this.S[r]=r;for(e=0,r=0;r<256;++r)e=e+this.S[r]+t[r%t.length]&255,i=this.S[r],this.S[r]=this.S[e],this.S[e]=i;this.i=0,this.j=0},C.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var H=256;a.exports={default:r,BigInteger:r,SecureRandom:M}}.call(f);var l=c.exports;const{BigInteger:p}=l;class y{constructor(){this.tlv=null,this.t="00",this.l="00",this.v=""}getEncodedHex(){return this.tlv||(this.v=this.getValue(),this.l=this.getLength(),this.tlv=this.t+this.l+this.v),this.tlv}getLength(){const t=this.v.length/2;let r=t.toString(16);if(r.length%2==1&&(r="0"+r),t<128)return r;return(128+r.length/2).toString(16)+r}getValue(){return""}}class m extends y{constructor(t){super(),this.t="02",t&&(this.v=function(t){let r=t.toString(16);if("-"!==r[0])r.length%2==1?r="0"+r:r.match(/^[0-7]/)||(r="00"+r);else{r=r.substr(1);let e=r.length;e%2==1?e+=1:r.match(/^[0-7]/)||(e+=2);let i="";for(let t=0;t<e;t++)i+="f";i=new p(i,16),r=i.xor(t).add(p.ONE),r=r.toString(16).replace(/^-/,"")}return r}(t))}getValue(){return this.v}}class g extends y{constructor(t){super(),this.t="30",this.asn1Array=t}getValue(){return this.v=this.asn1Array.map((t=>t.getEncodedHex())).join(""),this.v}}function d(t,r){return+t[r+2]<8?1:128&+t.substr(r+2,2)}function v(t,r){const e=d(t,r),i=t.substr(r+2,2*e);if(!i)return-1;return(+i[0]<8?new p(i,16):new p(i.substr(2),16)).intValue()}function w(t,r){return r+2*(d(t,r)+1)}var T={encodeDer(t,r){const e=new m(t),i=new m(r);return new g([e,i]).getEncodedHex()},decodeDer(t){const r=w(t,0),e=w(t,r),i=v(t,r),n=t.substr(e,2*i),o=e+n.length,s=w(t,o),h=v(t,o),u=t.substr(s,2*h);return{r:new p(n,16),s:new p(u,16)}}};const{BigInteger:F}=l,b=new F("2"),B=new F("3");class q{constructor(t,r){this.x=r,this.q=t}equals(t){return t===this||this.q.equals(t.q)&&this.x.equals(t.x)}toBigInteger(){return this.x}negate(){return new q(this.q,this.x.negate().mod(this.q))}add(t){return new q(this.q,this.x.add(t.toBigInteger()).mod(this.q))}subtract(t){return new q(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))}multiply(t){return new q(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))}divide(t){return new q(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))}square(){return new q(this.q,this.x.square().mod(this.q))}}class x{constructor(t,r,e,i){this.curve=t,this.x=r,this.y=e,this.z=null==i?F.ONE:i,this.zinv=null}getX(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}getY(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}equals(t){if(t===this)return!0;if(this.isInfinity())return t.isInfinity();if(t.isInfinity())return this.isInfinity();if(!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(F.ZERO))return!1;return t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(F.ZERO)}isInfinity(){return null===this.x&&null===this.y||this.z.equals(F.ZERO)&&!this.y.toBigInteger().equals(F.ZERO)}negate(){return new x(this.curve,this.x,this.y.negate(),this.z)}add(t){if(this.isInfinity())return t;if(t.isInfinity())return this;const r=this.x.toBigInteger(),e=this.y.toBigInteger(),i=this.z,n=t.x.toBigInteger(),o=t.y.toBigInteger(),s=t.z,h=this.curve.q,u=r.multiply(s).mod(h),a=n.multiply(i).mod(h),f=u.subtract(a),c=e.multiply(s).mod(h),l=o.multiply(i).mod(h),p=c.subtract(l);if(F.ZERO.equals(f))return F.ZERO.equals(p)?this.twice():this.curve.infinity;const y=u.add(a),m=i.multiply(s).mod(h),g=f.square().mod(h),d=f.multiply(g).mod(h),v=m.multiply(p.square()).subtract(y.multiply(g)).mod(h),w=f.multiply(v).mod(h),T=p.multiply(g.multiply(u).subtract(v)).subtract(c.multiply(d)).mod(h),b=d.multiply(m).mod(h);return new x(this.curve,this.curve.fromBigInteger(w),this.curve.fromBigInteger(T),b)}twice(){if(this.isInfinity())return this;if(!this.y.toBigInteger().signum())return this.curve.infinity;const t=this.x.toBigInteger(),r=this.y.toBigInteger(),e=this.z,i=this.curve.q,n=this.curve.a.toBigInteger(),o=t.square().multiply(B).add(n.multiply(e.square())).mod(i),s=r.shiftLeft(1).multiply(e).mod(i),h=r.square().mod(i),u=h.multiply(t).multiply(e).mod(i),a=s.square().mod(i),f=o.square().subtract(u.shiftLeft(3)).mod(i),c=s.multiply(f).mod(i),l=o.multiply(u.shiftLeft(2).subtract(f)).subtract(a.shiftLeft(1).multiply(h)).mod(i),p=s.multiply(a).mod(i);return new x(this.curve,this.curve.fromBigInteger(c),this.curve.fromBigInteger(l),p)}multiply(t){if(this.isInfinity())return this;if(!t.signum())return this.curve.infinity;const r=t.multiply(B),e=this.negate();let i=this;for(let n=r.bitLength()-2;n>0;n--){i=i.twice();const o=r.testBit(n);o!==t.testBit(n)&&(i=i.add(o?this:e))}return i}}var E={ECPointFp:x,ECCurveFp:class{constructor(t,r,e){this.q=t,this.a=this.fromBigInteger(r),this.b=this.fromBigInteger(e),this.infinity=new x(this,null,null)}equals(t){return t===this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)}fromBigInteger(t){return new q(this.q,t)}decodePointHex(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:const r=this.fromBigInteger(new F(t.substr(2),16));let e=this.fromBigInteger(r.multiply(r.square()).add(r.multiply(this.a)).add(this.b).toBigInteger().modPow(this.q.divide(new F("4")).add(F.ONE),this.q));return e.toBigInteger().mod(b).equals(new F(t.substr(0,2),16).subtract(b))||(e=e.negate()),new x(this,r,e);case 4:case 6:case 7:const i=(t.length-2)/2,n=t.substr(2,i),o=t.substr(i+2,i);return new x(this,this.fromBigInteger(new F(n,16)),this.fromBigInteger(new F(o,16)));default:return null}}}};const{BigInteger:S,SecureRandom:D}=l,{ECCurveFp:I}=E,A=new D,{curve:R,G:P,n:O}=M();function M(){const t=new S("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF",16),r=new S("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC",16),e=new S("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93",16),i=new I(t,r,e),n=i.decodePointHex("0432C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0");return{curve:i,G:n,n:new S("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123",16)}}function C(t,r){return t.length>=r?t:new Array(r-t.length+1).join("0")+t}var H={getGlobalCurve:function(){return R},generateEcparam:M,generateKeyPairHex:function(t,r,e){const i=(t?new S(t,r,e):new S(O.bitLength(),A)).mod(O.subtract(S.ONE)).add(S.ONE),n=C(i.toString(16),64),o=P.multiply(i);return{privateKey:n,publicKey:"04"+C(o.getX().toBigInteger().toString(16),64)+C(o.getY().toBigInteger().toString(16),64)}},compressPublicKeyHex:function(t){if(130!==t.length)throw new Error("Invalid public key to compress");const r=(t.length-2)/2,e=t.substr(2,r);let i="03";return new S(t.substr(r+2,r),16).mod(new S("2")).equals(S.ZERO)&&(i="02"),i+e},utf8ToHex:function(t){const r=(t=unescape(encodeURIComponent(t))).length,e=[];for(let i=0;i<r;i++)e[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;const i=[];for(let t=0;t<r;t++){const r=e[t>>>2]>>>24-t%4*8&255;i.push((r>>>4).toString(16)),i.push((15&r).toString(16))}return i.join("")},leftPad:C,arrayToHex:function(t){return t.map((t=>1===(t=t.toString(16)).length?"0"+t:t)).join("")},arrayToUtf8:function(t){const r=[];let e=0;for(let i=0;i<2*t.length;i+=2)r[i>>>3]|=parseInt(t[e],10)<<24-i%8*4,e++;try{const e=[];for(let i=0;i<t.length;i++){const t=r[i>>>2]>>>24-i%4*8&255;e.push(String.fromCharCode(t))}return decodeURIComponent(escape(e.join("")))}catch(t){throw new Error("Malformed UTF-8 data")}},hexToArray:function(t){const r=[];let e=t.length;e%2!=0&&(t=C(t,e+1)),e=t.length;for(let i=0;i<e;i+=2)r.push(parseInt(t.substr(i,2),16));return r},verifyPublicKey:function(t){const r=R.decodePointHex(t);if(!r)return!1;const e=r.getX();return r.getY().square().equals(e.multiply(e.square()).add(e.multiply(R.a)).add(R.b))},comparePublicKeyHex:function(t,r){const e=R.decodePointHex(t);if(!e)return!1;const i=R.decodePointHex(r);return!!i&&e.equals(i)}};const K=new Uint32Array(68),N=new Uint32Array(64);function V(t,r){const e=31&r;return t<<e|t>>>32-e}function L(t,r){const e=[];for(let i=t.length-1;i>=0;i--)e[i]=255&(t[i]^r[i]);return e}function z(t){return t^V(t,9)^V(t,17)}function k(t){let r=8*t.length,e=r%512;e=e>=448?512-e%448-1:448-e-1;const i=new Array((e-7)/8),n=new Array(8);for(let t=0,r=i.length;t<r;t++)i[t]=0;for(let t=0,r=n.length;t<r;t++)n[t]=0;r=r.toString(2);for(let t=7;t>=0;t--)if(r.length>8){const e=r.length-8;n[t]=parseInt(r.substr(e),2),r=r.substr(0,e)}else r.length>0&&(n[t]=parseInt(r,2),r="");const o=new Uint8Array([...t,128,...i,...n]),s=new DataView(o.buffer,0),h=o.length/64,u=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]);for(let t=0;t<h;t++){K.fill(0),N.fill(0);const r=16*t;for(let t=0;t<16;t++)K[t]=s.getUint32(4*(r+t),!1);for(let t=16;t<68;t++)K[t]=(a=K[t-16]^K[t-9]^V(K[t-3],15))^V(a,15)^V(a,23)^V(K[t-13],7)^K[t-6];for(let t=0;t<64;t++)N[t]=K[t]^K[t+4];const e=2043430169,i=2055708042;let n,o,h,f,c,l=u[0],p=u[1],y=u[2],m=u[3],g=u[4],d=u[5],v=u[6],w=u[7];for(let t=0;t<64;t++)c=t>=0&&t<=15?e:i,n=V(V(l,12)+g+V(c,t),7),o=n^V(l,12),h=(t>=0&&t<=15?l^p^y:l&p|l&y|p&y)+m+o+N[t],f=(t>=0&&t<=15?g^d^v:g&d|~g&v)+w+n+K[t],m=y,y=V(p,9),p=l,l=h,w=v,v=V(d,19),d=g,g=z(f);u[0]^=l,u[1]^=p,u[2]^=y,u[3]^=m,u[4]^=g,u[5]^=d,u[6]^=v,u[7]^=w}var a;const f=[];for(let t=0,r=u.length;t<r;t++){const r=u[t];f.push((4278190080&r)>>>24,(16711680&r)>>>16,(65280&r)>>>8,255&r)}return f}const Z=new Uint8Array(64),j=new Uint8Array(64);for(let t=0;t<64;t++)Z[t]=54,j[t]=92;var U={sm3:k,hmac:function(t,r){for(r.length>64&&(r=k(r));r.length<64;)r.push(0);const e=L(r,Z),i=L(r,j),n=k([...e,...t]);return k([...i,...n])}};const{BigInteger:$}=l,{encodeDer:X,decodeDer:_}=T,Y=H,G=U.sm3,{G:J,curve:W,n:Q}=Y.generateEcparam();function tt(t,r,e="1234567812345678"){e=Y.utf8ToHex(e);const i=Y.leftPad(J.curve.a.toBigInteger().toRadix(16),64),n=Y.leftPad(J.curve.b.toBigInteger().toRadix(16),64),o=Y.leftPad(J.getX().toBigInteger().toRadix(16),64),s=Y.leftPad(J.getY().toBigInteger().toRadix(16),64);let h,u;if(128===r.length)h=r.substr(0,64),u=r.substr(64,64);else{const t=J.curve.decodePointHex(r);h=Y.leftPad(t.getX().toBigInteger().toRadix(16),64),u=Y.leftPad(t.getY().toBigInteger().toRadix(16),64)}const a=Y.hexToArray(e+i+n+o+s+h+u),f=4*e.length;a.unshift(255&f),a.unshift(f>>8&255);const c=G(a);return Y.arrayToHex(G(c.concat(Y.hexToArray(t))))}function rt(t){const r=J.multiply(new $(t,16));return"04"+Y.leftPad(r.getX().toBigInteger().toString(16),64)+Y.leftPad(r.getY().toBigInteger().toString(16),64)}function et(){const t=Y.generateKeyPairHex(),r=W.decodePointHex(t.publicKey);return t.k=new $(t.privateKey,16),t.x1=r.getX().toBigInteger(),t}var it={generateKeyPairHex:Y.generateKeyPairHex,compressPublicKeyHex:Y.compressPublicKeyHex,comparePublicKeyHex:Y.comparePublicKeyHex,doEncrypt:function(t,r,e=1){t="string"==typeof t?Y.hexToArray(Y.utf8ToHex(t)):Array.prototype.slice.call(t),r=Y.getGlobalCurve().decodePointHex(r);const i=Y.generateKeyPairHex(),n=new $(i.privateKey,16);let o=i.publicKey;o.length>128&&(o=o.substr(o.length-128));const s=r.multiply(n),h=Y.hexToArray(Y.leftPad(s.getX().toBigInteger().toRadix(16),64)),u=Y.hexToArray(Y.leftPad(s.getY().toBigInteger().toRadix(16),64)),a=Y.arrayToHex(G([].concat(h,t,u)));let f=1,c=0,l=[];const p=[].concat(h,u),y=()=>{l=G([...p,f>>24&255,f>>16&255,f>>8&255,255&f]),f++,c=0};y();for(let r=0,e=t.length;r<e;r++)c===l.length&&y(),t[r]^=255&l[c++];const m=Y.arrayToHex(t);return 0===e?o+m+a:o+a+m},doDecrypt:function(t,r,e=1,{output:i="string"}={}){r=new $(r,16);let n=t.substr(128,64),o=t.substr(192);0===e&&(n=t.substr(t.length-64),o=t.substr(128,t.length-128-64));const s=Y.hexToArray(o),h=Y.getGlobalCurve().decodePointHex("04"+t.substr(0,128)).multiply(r),u=Y.hexToArray(Y.leftPad(h.getX().toBigInteger().toRadix(16),64)),a=Y.hexToArray(Y.leftPad(h.getY().toBigInteger().toRadix(16),64));let f=1,c=0,l=[];const p=[].concat(u,a),y=()=>{l=G([...p,f>>24&255,f>>16&255,f>>8&255,255&f]),f++,c=0};y();for(let t=0,r=s.length;t<r;t++)c===l.length&&y(),s[t]^=255&l[c++];return Y.arrayToHex(G([].concat(u,s,a)))===n.toLowerCase()?"array"===i?s:Y.arrayToUtf8(s):"array"===i?[]:""},doSignature:function(t,r,{pointPool:e,der:i,hash:n,publicKey:o,userId:s}={}){let h="string"==typeof t?Y.utf8ToHex(t):Y.arrayToHex(t);n&&(h=tt(h,o=o||rt(r),s));const u=new $(r,16),a=new $(h,16);let f=null,c=null,l=null;do{do{let t;t=e&&e.length?e.pop():et(),f=t.k,c=a.add(t.x1).mod(Q)}while(c.equals($.ZERO)||c.add(f).equals(Q));l=u.add($.ONE).modInverse(Q).multiply(f.subtract(c.multiply(u))).mod(Q)}while(l.equals($.ZERO));return i?X(c,l):Y.leftPad(c.toString(16),64)+Y.leftPad(l.toString(16),64)},doVerifySignature:function(t,r,e,{der:i,hash:n,userId:o}={}){let s,h,u="string"==typeof t?Y.utf8ToHex(t):Y.arrayToHex(t);if(n&&(u=tt(u,e,o)),i){const t=_(r);s=t.r,h=t.s}else s=new $(r.substring(0,64),16),h=new $(r.substring(64),16);const a=W.decodePointHex(e),f=new $(u,16),c=s.add(h).mod(Q);if(c.equals($.ZERO))return!1;const l=J.multiply(h).add(a.multiply(c)),p=f.add(l.getX().toBigInteger()).mod(Q);return s.equals(p)},getPublicKeyFromPrivateKey:rt,getPoint:et,verifyPublicKey:Y.verifyPublicKey};const{sm3:nt,hmac:ot}=U;function st(t){return t.map((t=>1===(t=t.toString(16)).length?"0"+t:t)).join("")}function ht(t){const r=[];let e=t.length;var i,n;e%2!=0&&(n=e+1,t=(i=t).length>=n?i:new Array(n-i.length+1).join("0")+i),e=t.length;for(let i=0;i<e;i+=2)r.push(parseInt(t.substr(i,2),16));return r}const ut=0,at=16,ft=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],ct=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function lt(t){const r=[];for(let e=0,i=t.length;e<i;e+=2)r.push(parseInt(t.substr(e,2),16));return r}function pt(t,r){const e=31&r;return t<<e|t>>>32-e}function yt(t){return(255&ft[t>>>24&255])<<24|(255&ft[t>>>16&255])<<16|(255&ft[t>>>8&255])<<8|255&ft[255&t]}function mt(t){return t^pt(t,2)^pt(t,10)^pt(t,18)^pt(t,24)}function gt(t){return t^pt(t,13)^pt(t,23)}function dt(t,r,e){const i=new Array(4),n=new Array(4);for(let r=0;r<4;r++)n[0]=255&t[4*r],n[1]=255&t[4*r+1],n[2]=255&t[4*r+2],n[3]=255&t[4*r+3],i[r]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(let t,r=0;r<32;r+=4)t=i[1]^i[2]^i[3]^e[r+0],i[0]^=mt(yt(t)),t=i[2]^i[3]^i[0]^e[r+1],i[1]^=mt(yt(t)),t=i[3]^i[0]^i[1]^e[r+2],i[2]^=mt(yt(t)),t=i[0]^i[1]^i[2]^e[r+3],i[3]^=mt(yt(t));for(let t=0;t<16;t+=4)r[t]=i[3-t/4]>>>24&255,r[t+1]=i[3-t/4]>>>16&255,r[t+2]=i[3-t/4]>>>8&255,r[t+3]=255&i[3-t/4]}function vt(t,r,e,{padding:i="pkcs#7",mode:n,iv:o=[],output:s="string"}={}){if("cbc"===n&&("string"==typeof o&&(o=lt(o)),16!==o.length))throw new Error("iv is invalid");if("string"==typeof r&&(r=lt(r)),16!==r.length)throw new Error("key is invalid");if(t="string"==typeof t?e!==ut?function(t){const r=[];for(let e=0,i=t.length;e<i;e++){const i=t.codePointAt(e);if(i<=127)r.push(i);else if(i<=2047)r.push(192|i>>>6),r.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)r.push(224|i>>>12),r.push(128|i>>>6&63),r.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw r.push(i),new Error("input is not supported");e++,r.push(240|i>>>18&28),r.push(128|i>>>12&63),r.push(128|i>>>6&63),r.push(128|63&i)}}return r}(t):lt(t):[...t],("pkcs#5"===i||"pkcs#7"===i)&&e!==ut){const r=at-t.length%at;for(let e=0;e<r;e++)t.push(r)}const h=new Array(32);!function(t,r,e){const i=new Array(4),n=new Array(4);for(let r=0;r<4;r++)n[0]=255&t[0+4*r],n[1]=255&t[1+4*r],n[2]=255&t[2+4*r],n[3]=255&t[3+4*r],i[r]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let t,e=0;e<32;e+=4)t=i[1]^i[2]^i[3]^ct[e+0],r[e+0]=i[0]^=gt(yt(t)),t=i[2]^i[3]^i[0]^ct[e+1],r[e+1]=i[1]^=gt(yt(t)),t=i[3]^i[0]^i[1]^ct[e+2],r[e+2]=i[2]^=gt(yt(t)),t=i[0]^i[1]^i[2]^ct[e+3],r[e+3]=i[3]^=gt(yt(t));if(e===ut)for(let t,e=0;e<16;e++)t=r[e],r[e]=r[31-e],r[31-e]=t}(r,h,e);const u=[];let a=o,f=t.length,c=0;for(;f>=at;){const r=t.slice(c,c+16),i=new Array(16);if("cbc"===n)for(let t=0;t<at;t++)e!==ut&&(r[t]^=a[t]);dt(r,i,h);for(let t=0;t<at;t++)"cbc"===n&&e===ut&&(i[t]^=a[t]),u[c+t]=i[t];"cbc"===n&&(a=e!==ut?i:r),f-=at,c+=at}if(("pkcs#5"===i||"pkcs#7"===i)&&e===ut){const t=u.length,r=u[t-1];for(let e=1;e<=r;e++)if(u[t-e]!==r)throw new Error("padding is invalid");u.splice(t-r,r)}return"array"!==s?e!==ut?u.map((t=>1===(t=t.toString(16)).length?"0"+t:t)).join(""):function(t){const r=[];for(let e=0,i=t.length;e<i;e++)t[e]>=240&&t[e]<=247?(r.push(String.fromCodePoint(((7&t[e])<<18)+((63&t[e+1])<<12)+((63&t[e+2])<<6)+(63&t[e+3]))),e+=3):t[e]>=224&&t[e]<=239?(r.push(String.fromCodePoint(((15&t[e])<<12)+((63&t[e+1])<<6)+(63&t[e+2]))),e+=2):t[e]>=192&&t[e]<=223?(r.push(String.fromCodePoint(((31&t[e])<<6)+(63&t[e+1]))),e++):r.push(String.fromCodePoint(t[e]));return r.join("")}(u):u}var wt={sm2:it,sm3:function(t,r){if(t="string"==typeof t?function(t){const r=[];for(let e=0,i=t.length;e<i;e++){const i=t.codePointAt(e);if(i<=127)r.push(i);else if(i<=2047)r.push(192|i>>>6),r.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)r.push(224|i>>>12),r.push(128|i>>>6&63),r.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw r.push(i),new Error("input is not supported");e++,r.push(240|i>>>18&28),r.push(128|i>>>12&63),r.push(128|i>>>6&63),r.push(128|63&i)}}return r}(t):Array.prototype.slice.call(t),r){if("hmac"!==(r.mode||"hmac"))throw new Error("invalid mode");let e=r.key;if(!e)throw new Error("invalid key");return e="string"==typeof e?ht(e):Array.prototype.slice.call(e),st(ot(t,e))}return st(nt(t))},sm4:{encrypt:(t,r,e)=>vt(t,r,1,e),decrypt:(t,r,e)=>vt(t,r,0,e)}};const Tt={mode:"ecb",padding:"pkcs#5",output:"array"},Ft=r.Buffer,bt=function(t,r,e,i){return(n,o)=>{try{if(o.closeCrypto)return n;t.info=h(),t.publicKey=[...Ft.from(t.info.key)];const s=wt.sm2.doEncrypt(JSON.stringify(t.info),r,1);if(e.set(i,function(t){if("string"==typeof t)return String(t);return JSON.parse(JSON.stringify(t))}(s)),((t,r)=>{t.set("X-Encrypt-Key",r)})(o,s),n){"string"!=typeof n&&(n=JSON.stringify(n));const r=wt.sm4.encrypt(n,t.publicKey,Tt);return n=Ft.from(r)}return n}catch(t){console.error("encrypt error",t,n,o)}}};const Bt=function(){const t=new Map;return{get:function(r){return t.get(r)},generateKey:function r(i){const n=`${e(8,"low")}-/${i}`;return t.has(n)?r(i):n},set:function(r,e){t.set(r,e)},clear:function(r){t.delete(r)},sm:function(){return wt.sm2}}}();function qt(t,r){if(!r||"string"!=typeof r)throw new Error(`publicKey is required and must be a string ${r}`);t.interceptors.request.use((t=>{const e=t.transformRequest,i=t?.headers?.__requestKey,s={info:null,publicKey:[]};if(!e)throw new Error(`request ${t} has no transformRequest`);if(!Array.isArray(e))throw new Error(`transformRequest ${e} is not an array`);e.push(bt(s,r,Bt,i));const h=function(t){return(r,e)=>{try{if((t=>{const r=t.get("X-Encrypt-With");return r&&"string"==typeof r&&"sm4"===r.toLowerCase()})(e)){const e=Ft.from(r);return o(wt.sm4.decrypt(e,t.publicKey,{mode:"ecb",padding:"pkcs#7"}))}return n(r)}catch(t){console.error("decrypt error",t,r,e)}}}(s);if(!h)return t;const u=t.transformResponse;if(!u)throw new Error(`request ${t} has no transformResponse`);if("function"!=typeof h)throw new Error(`decryptFn ${h} is not a function`);if(!Array.isArray(u))throw new Error(`transformResponse ${u} is not an array`);return u.unshift(h),t})),t.interceptors.request.use((t=>{const r=t.url,e=t.headers;return r?(e.__requestKey=Bt.generateKey(r),t):t})),t.interceptors.request.use((t=>(t.headers.closeCrypto||(t.responseType="arraybuffer"),t))),t.interceptors.request.use((t=>{const r=t.data,e=t.headers;return r?(r instanceof FormData&&(e.closeCrypto=!0),t):t})),t.interceptors.request.use((t=>{const r=t.url,e=t.headers;if(!r)throw new Error("url is required");if({}.hasOwnProperty.call(e,"closeCrypto"))return t;return s(r)||(e.closeCrypto=!0),t})),t.interceptors.response.use((t=>(t.data=n(t.data),t.data=o(t.data),t)),(t=>{const r=t.response;throw r?.data&&(r.data=function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){throw console.error("error",t),t}return t instanceof ArrayBuffer?i(t):t}(r.data)),t}))}window.__map_store__=Bt;exports.createCryptoAxiosInstance=(r,e)=>{const i=t.create(r);return qt(i,e),i},exports.createRequestInstance=(r,e)=>{const i=t.create(r);return function(t,r){if(!r)return t;const{encryptFn:e,decryptFn:i}=r();e&&t.interceptors.request.use((t=>{const r=t.transformRequest;if(!r)throw new Error(`request ${t} has no transformRequest`);if(!Array.isArray(r))throw new Error(`transformRequest ${r} is not an array`);if(r.push(e),!i)return t;const n=t.transformResponse;if(!n)throw new Error(`request ${t} has no transformResponse`);if("function"!=typeof i)throw new Error(`decryptFn ${i} is not a function`);if(!Array.isArray(n))throw new Error(`transformResponse ${n} is not an array`);return n.unshift(i),t}))}(i,e),i},exports.getCryptoInfo=h,exports.getSm4EncryptConfig=u,exports.randomPassword=e,exports.shouldEncrypt=s;
"use strict";var t=require("axios"),r=require("buffer");const e=(t=16,r="high")=>{const e=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],i=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],n=[0,1,2,3,4,5,6,7,8,9],o=["!","@","-","_","=","<",">","#","*","%","+","&","^","$"],s=[];let h="";const u=function(...t){let r="";return t.forEach((t=>{r+=t[Math.floor(Math.random()*t.length)]})),r};switch(r){case"high":h+=u(e,i,n,o),s.push(...e,...i,...n,...o);break;case"medium":h+=u(e,i,n),s.push(...e,...i,...n);break;default:h+=u(e,n),s.push(...e,...n)}const a=t-h.length;for(let t=0;t<a;t++)h+=u(s);return h};function i(t,r="utf-8"){return new TextDecoder(r).decode(t)}function n(t){try{return t instanceof ArrayBuffer?o(i(t)):t}catch(t){throw console.error("error",t),t}}function o(t){try{return"string"==typeof t?JSON.parse(t):t}catch(t){throw console.error("error",t),t}}const s=t=>{let r=!0;return!(t=>/^\/bi-api\/api/.test(t))(t)&&(t.startsWith("/api")&&(r=!1,(t=>/^\/(api\/logmanage|api\/data-source|api\/enterpriseadmin|api\/componentmanager|api\/spacemanager|api\/filemanager)/.test(t))(t)&&(r=!0)),r)},h=t=>({...{key:e(16,"high"),algorithm:t||"SM4"}}),u=()=>({mode:"ecb",padding:"pkcs#5",output:"array"});var a,f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},c={exports:{}};a=c,function(){var t;function r(t,r,e){null!=t&&("number"==typeof t?this.fromNumber(t,r,e):null==r&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,r))}function e(){return new r(null)}var i="undefined"!=typeof navigator;i&&"Microsoft Internet Explorer"==navigator.appName?(r.prototype.am=function(t,r,e,i,n,o){for(var s=32767&r,h=r>>15;--o>=0;){var u=32767&this[t],a=this[t++]>>15,f=h*u+a*s;n=((u=s*u+((32767&f)<<15)+e[i]+(1073741823&n))>>>30)+(f>>>15)+h*a+(n>>>30),e[i++]=1073741823&u}return n},t=30):i&&"Netscape"!=navigator.appName?(r.prototype.am=function(t,r,e,i,n,o){for(;--o>=0;){var s=r*this[t++]+e[i]+n;n=Math.floor(s/67108864),e[i++]=67108863&s}return n},t=26):(r.prototype.am=function(t,r,e,i,n,o){for(var s=16383&r,h=r>>14;--o>=0;){var u=16383&this[t],a=this[t++]>>14,f=h*u+a*s;n=((u=s*u+((16383&f)<<14)+e[i]+n)>>28)+(f>>14)+h*a,e[i++]=268435455&u}return n},t=28),r.prototype.DB=t,r.prototype.DM=(1<<t)-1,r.prototype.DV=1<<t,r.prototype.FV=Math.pow(2,52),r.prototype.F1=52-t,r.prototype.F2=2*t-52;var n,o,s="0123456789abcdefghijklmnopqrstuvwxyz",h=new Array;for(n="0".charCodeAt(0),o=0;o<=9;++o)h[n++]=o;for(n="a".charCodeAt(0),o=10;o<36;++o)h[n++]=o;for(n="A".charCodeAt(0),o=10;o<36;++o)h[n++]=o;function u(t){return s.charAt(t)}function f(t,r){var e=h[t.charCodeAt(r)];return null==e?-1:e}function c(t){var r=e();return r.fromInt(t),r}function l(t){var r,e=1;return 0!=(r=t>>>16)&&(t=r,e+=16),0!=(r=t>>8)&&(t=r,e+=8),0!=(r=t>>4)&&(t=r,e+=4),0!=(r=t>>2)&&(t=r,e+=2),0!=(r=t>>1)&&(t=r,e+=1),e}function p(t){this.m=t}function y(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function m(t,r){return t&r}function g(t,r){return t|r}function d(t,r){return t^r}function v(t,r){return t&~r}function w(t){if(0==t)return-1;var r=0;return 65535&t||(t>>=16,r+=16),255&t||(t>>=8,r+=8),15&t||(t>>=4,r+=4),3&t||(t>>=2,r+=2),1&t||++r,r}function T(t){for(var r=0;0!=t;)t&=t-1,++r;return r}function F(){}function b(t){return t}function B(t){this.r2=e(),this.q3=e(),r.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}p.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},p.prototype.revert=function(t){return t},p.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},p.prototype.mulTo=function(t,r,e){t.multiplyTo(r,e),this.reduce(e)},p.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)},y.prototype.convert=function(t){var i=e();return t.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),t.s<0&&i.compareTo(r.ZERO)>0&&this.m.subTo(i,i),i},y.prototype.revert=function(t){var r=e();return t.copyTo(r),this.reduce(r),r},y.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var r=0;r<this.m.t;++r){var e=32767&t[r],i=e*this.mpl+((e*this.mph+(t[r]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[e=r+this.m.t]+=this.m.am(0,i,t,r,0,this.m.t);t[e]>=t.DV;)t[e]-=t.DV,t[++e]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},y.prototype.mulTo=function(t,r,e){t.multiplyTo(r,e),this.reduce(e)},y.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)},r.prototype.copyTo=function(t){for(var r=this.t-1;r>=0;--r)t[r]=this[r];t.t=this.t,t.s=this.s},r.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},r.prototype.fromString=function(t,e){var i;if(16==e)i=4;else if(8==e)i=3;else if(256==e)i=8;else if(2==e)i=1;else if(32==e)i=5;else{if(4!=e)return void this.fromRadix(t,e);i=2}this.t=0,this.s=0;for(var n=t.length,o=!1,s=0;--n>=0;){var h=8==i?255&t[n]:f(t,n);h<0?"-"==t.charAt(n)&&(o=!0):(o=!1,0==s?this[this.t++]=h:s+i>this.DB?(this[this.t-1]|=(h&(1<<this.DB-s)-1)<<s,this[this.t++]=h>>this.DB-s):this[this.t-1]|=h<<s,(s+=i)>=this.DB&&(s-=this.DB))}8==i&&128&t[0]&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&r.ZERO.subTo(this,this)},r.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},r.prototype.dlShiftTo=function(t,r){var e;for(e=this.t-1;e>=0;--e)r[e+t]=this[e];for(e=t-1;e>=0;--e)r[e]=0;r.t=this.t+t,r.s=this.s},r.prototype.drShiftTo=function(t,r){for(var e=t;e<this.t;++e)r[e-t]=this[e];r.t=Math.max(this.t-t,0),r.s=this.s},r.prototype.lShiftTo=function(t,r){var e,i=t%this.DB,n=this.DB-i,o=(1<<n)-1,s=Math.floor(t/this.DB),h=this.s<<i&this.DM;for(e=this.t-1;e>=0;--e)r[e+s+1]=this[e]>>n|h,h=(this[e]&o)<<i;for(e=s-1;e>=0;--e)r[e]=0;r[s]=h,r.t=this.t+s+1,r.s=this.s,r.clamp()},r.prototype.rShiftTo=function(t,r){r.s=this.s;var e=Math.floor(t/this.DB);if(e>=this.t)r.t=0;else{var i=t%this.DB,n=this.DB-i,o=(1<<i)-1;r[0]=this[e]>>i;for(var s=e+1;s<this.t;++s)r[s-e-1]|=(this[s]&o)<<n,r[s-e]=this[s]>>i;i>0&&(r[this.t-e-1]|=(this.s&o)<<n),r.t=this.t-e,r.clamp()}},r.prototype.subTo=function(t,r){for(var e=0,i=0,n=Math.min(t.t,this.t);e<n;)i+=this[e]-t[e],r[e++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i-=t.s;e<this.t;)i+=this[e],r[e++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;e<t.t;)i-=t[e],r[e++]=i&this.DM,i>>=this.DB;i-=t.s}r.s=i<0?-1:0,i<-1?r[e++]=this.DV+i:i>0&&(r[e++]=i),r.t=e,r.clamp()},r.prototype.multiplyTo=function(t,e){var i=this.abs(),n=t.abs(),o=i.t;for(e.t=o+n.t;--o>=0;)e[o]=0;for(o=0;o<n.t;++o)e[o+i.t]=i.am(0,n[o],e,o,0,i.t);e.s=0,e.clamp(),this.s!=t.s&&r.ZERO.subTo(e,e)},r.prototype.squareTo=function(t){for(var r=this.abs(),e=t.t=2*r.t;--e>=0;)t[e]=0;for(e=0;e<r.t-1;++e){var i=r.am(e,r[e],t,2*e,0,1);(t[e+r.t]+=r.am(e+1,2*r[e],t,2*e+1,i,r.t-e-1))>=r.DV&&(t[e+r.t]-=r.DV,t[e+r.t+1]=1)}t.t>0&&(t[t.t-1]+=r.am(e,r[e],t,2*e,0,1)),t.s=0,t.clamp()},r.prototype.divRemTo=function(t,i,n){var o=t.abs();if(!(o.t<=0)){var s=this.abs();if(s.t<o.t)return null!=i&&i.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=e());var h=e(),u=this.s,a=t.s,f=this.DB-l(o[o.t-1]);f>0?(o.lShiftTo(f,h),s.lShiftTo(f,n)):(o.copyTo(h),s.copyTo(n));var c=h.t,p=h[c-1];if(0!=p){var y=p*(1<<this.F1)+(c>1?h[c-2]>>this.F2:0),m=this.FV/y,g=(1<<this.F1)/y,d=1<<this.F2,v=n.t,w=v-c,T=null==i?e():i;for(h.dlShiftTo(w,T),n.compareTo(T)>=0&&(n[n.t++]=1,n.subTo(T,n)),r.ONE.dlShiftTo(c,T),T.subTo(h,h);h.t<c;)h[h.t++]=0;for(;--w>=0;){var F=n[--v]==p?this.DM:Math.floor(n[v]*m+(n[v-1]+d)*g);if((n[v]+=h.am(0,F,n,w,0,c))<F)for(h.dlShiftTo(w,T),n.subTo(T,n);n[v]<--F;)n.subTo(T,n)}null!=i&&(n.drShiftTo(c,i),u!=a&&r.ZERO.subTo(i,i)),n.t=c,n.clamp(),f>0&&n.rShiftTo(f,n),u<0&&r.ZERO.subTo(n,n)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var r=3&t;return(r=(r=(r=(r=r*(2-(15&t)*r)&15)*(2-(255&t)*r)&255)*(2-((65535&t)*r&65535))&65535)*(2-t*r%this.DV)%this.DV)>0?this.DV-r:-r},r.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},r.prototype.exp=function(t,i){if(t>4294967295||t<1)return r.ONE;var n=e(),o=e(),s=i.convert(this),h=l(t)-1;for(s.copyTo(n);--h>=0;)if(i.sqrTo(n,o),(t&1<<h)>0)i.mulTo(o,s,n);else{var u=n;n=o,o=u}return i.revert(n)},r.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var r;if(16==t)r=4;else if(8==t)r=3;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return this.toRadix(t);r=2}var e,i=(1<<r)-1,n=!1,o="",s=this.t,h=this.DB-s*this.DB%r;if(s-- >0)for(h<this.DB&&(e=this[s]>>h)>0&&(n=!0,o=u(e));s>=0;)h<r?(e=(this[s]&(1<<h)-1)<<r-h,e|=this[--s]>>(h+=this.DB-r)):(e=this[s]>>(h-=r)&i,h<=0&&(h+=this.DB,--s)),e>0&&(n=!0),n&&(o+=u(e));return n?o:"0"},r.prototype.negate=function(){var t=e();return r.ZERO.subTo(this,t),t},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(t){var r=this.s-t.s;if(0!=r)return r;var e=this.t;if(0!=(r=e-t.t))return this.s<0?-r:r;for(;--e>=0;)if(0!=(r=this[e]-t[e]))return r;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+l(this[this.t-1]^this.s&this.DM)},r.prototype.mod=function(t){var i=e();return this.abs().divRemTo(t,null,i),this.s<0&&i.compareTo(r.ZERO)>0&&t.subTo(i,i),i},r.prototype.modPowInt=function(t,r){var e;return e=t<256||r.isEven()?new p(r):new y(r),this.exp(t,e)},r.ZERO=c(0),r.ONE=c(1),F.prototype.convert=b,F.prototype.revert=b,F.prototype.mulTo=function(t,r,e){t.multiplyTo(r,e)},F.prototype.sqrTo=function(t,r){t.squareTo(r)},B.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var r=e();return t.copyTo(r),this.reduce(r),r},B.prototype.revert=function(t){return t},B.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},B.prototype.mulTo=function(t,r,e){t.multiplyTo(r,e),this.reduce(e)},B.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)};var q,x,E,S=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],D=(1<<26)/S[S.length-1];function I(){var t;t=(new Date).getTime(),x[E++]^=255&t,x[E++]^=t>>8&255,x[E++]^=t>>16&255,x[E++]^=t>>24&255,E>=H&&(E-=H)}if(r.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},r.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var r=this.chunkSize(t),i=Math.pow(t,r),n=c(i),o=e(),s=e(),h="";for(this.divRemTo(n,o,s);o.signum()>0;)h=(i+s.intValue()).toString(t).substr(1)+h,o.divRemTo(n,o,s);return s.intValue().toString(t)+h},r.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var i=this.chunkSize(e),n=Math.pow(e,i),o=!1,s=0,h=0,u=0;u<t.length;++u){var a=f(t,u);a<0?"-"==t.charAt(u)&&0==this.signum()&&(o=!0):(h=e*h+a,++s>=i&&(this.dMultiply(n),this.dAddOffset(h,0),s=0,h=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(h,0)),o&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(t,e,i){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(r.ONE.shiftLeft(t-1),g,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(r.ONE.shiftLeft(t-1),this);else{var n=new Array,o=7&t;n.length=1+(t>>3),e.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}},r.prototype.bitwiseTo=function(t,r,e){var i,n,o=Math.min(t.t,this.t);for(i=0;i<o;++i)e[i]=r(this[i],t[i]);if(t.t<this.t){for(n=t.s&this.DM,i=o;i<this.t;++i)e[i]=r(this[i],n);e.t=this.t}else{for(n=this.s&this.DM,i=o;i<t.t;++i)e[i]=r(n,t[i]);e.t=t.t}e.s=r(this.s,t.s),e.clamp()},r.prototype.changeBit=function(t,e){var i=r.ONE.shiftLeft(t);return this.bitwiseTo(i,e,i),i},r.prototype.addTo=function(t,r){for(var e=0,i=0,n=Math.min(t.t,this.t);e<n;)i+=this[e]+t[e],r[e++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i+=t.s;e<this.t;)i+=this[e],r[e++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;e<t.t;)i+=t[e],r[e++]=i&this.DM,i>>=this.DB;i+=t.s}r.s=i<0?-1:0,i>0?r[e++]=i:i<-1&&(r[e++]=this.DV+i),r.t=e,r.clamp()},r.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(t,r){if(0!=t){for(;this.t<=r;)this[this.t++]=0;for(this[r]+=t;this[r]>=this.DV;)this[r]-=this.DV,++r>=this.t&&(this[this.t++]=0),++this[r]}},r.prototype.multiplyLowerTo=function(t,r,e){var i,n=Math.min(this.t+t.t,r);for(e.s=0,e.t=n;n>0;)e[--n]=0;for(i=e.t-this.t;n<i;++n)e[n+this.t]=this.am(0,t[n],e,n,0,this.t);for(i=Math.min(t.t,r);n<i;++n)this.am(0,t[n],e,n,0,r-n);e.clamp()},r.prototype.multiplyUpperTo=function(t,r,e){--r;var i=e.t=this.t+t.t-r;for(e.s=0;--i>=0;)e[i]=0;for(i=Math.max(r-this.t,0);i<t.t;++i)e[this.t+i-r]=this.am(r-i,t[i],e,0,0,this.t+i-r);e.clamp(),e.drShiftTo(1,e)},r.prototype.modInt=function(t){if(t<=0)return 0;var r=this.DV%t,e=this.s<0?t-1:0;if(this.t>0)if(0==r)e=this[0]%t;else for(var i=this.t-1;i>=0;--i)e=(r*e+this[i])%t;return e},r.prototype.millerRabin=function(t){var i=this.subtract(r.ONE),n=i.getLowestSetBit();if(n<=0)return!1;var o=i.shiftRight(n);(t=t+1>>1)>S.length&&(t=S.length);for(var s=e(),h=0;h<t;++h){s.fromInt(S[Math.floor(Math.random()*S.length)]);var u=s.modPow(o,this);if(0!=u.compareTo(r.ONE)&&0!=u.compareTo(i)){for(var a=1;a++<n&&0!=u.compareTo(i);)if(0==(u=u.modPowInt(2,this)).compareTo(r.ONE))return!1;if(0!=u.compareTo(i))return!1}}return!0},r.prototype.clone=function(){var t=e();return this.copyTo(t),t},r.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},r.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},r.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},r.prototype.toByteArray=function(){var t=this.t,r=new Array;r[0]=this.s;var e,i=this.DB-t*this.DB%8,n=0;if(t-- >0)for(i<this.DB&&(e=this[t]>>i)!=(this.s&this.DM)>>i&&(r[n++]=e|this.s<<this.DB-i);t>=0;)i<8?(e=(this[t]&(1<<i)-1)<<8-i,e|=this[--t]>>(i+=this.DB-8)):(e=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),128&e&&(e|=-256),0==n&&(128&this.s)!=(128&e)&&++n,(n>0||e!=this.s)&&(r[n++]=e);return r},r.prototype.equals=function(t){return 0==this.compareTo(t)},r.prototype.min=function(t){return this.compareTo(t)<0?this:t},r.prototype.max=function(t){return this.compareTo(t)>0?this:t},r.prototype.and=function(t){var r=e();return this.bitwiseTo(t,m,r),r},r.prototype.or=function(t){var r=e();return this.bitwiseTo(t,g,r),r},r.prototype.xor=function(t){var r=e();return this.bitwiseTo(t,d,r),r},r.prototype.andNot=function(t){var r=e();return this.bitwiseTo(t,v,r),r},r.prototype.not=function(){for(var t=e(),r=0;r<this.t;++r)t[r]=this.DM&~this[r];return t.t=this.t,t.s=~this.s,t},r.prototype.shiftLeft=function(t){var r=e();return t<0?this.rShiftTo(-t,r):this.lShiftTo(t,r),r},r.prototype.shiftRight=function(t){var r=e();return t<0?this.lShiftTo(-t,r):this.rShiftTo(t,r),r},r.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+w(this[t]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var t=0,r=this.s&this.DM,e=0;e<this.t;++e)t+=T(this[e]^r);return t},r.prototype.testBit=function(t){var r=Math.floor(t/this.DB);return r>=this.t?0!=this.s:!!(this[r]&1<<t%this.DB)},r.prototype.setBit=function(t){return this.changeBit(t,g)},r.prototype.clearBit=function(t){return this.changeBit(t,v)},r.prototype.flipBit=function(t){return this.changeBit(t,d)},r.prototype.add=function(t){var r=e();return this.addTo(t,r),r},r.prototype.subtract=function(t){var r=e();return this.subTo(t,r),r},r.prototype.multiply=function(t){var r=e();return this.multiplyTo(t,r),r},r.prototype.divide=function(t){var r=e();return this.divRemTo(t,r,null),r},r.prototype.remainder=function(t){var r=e();return this.divRemTo(t,null,r),r},r.prototype.divideAndRemainder=function(t){var r=e(),i=e();return this.divRemTo(t,r,i),new Array(r,i)},r.prototype.modPow=function(t,r){var i,n,o=t.bitLength(),s=c(1);if(o<=0)return s;i=o<18?1:o<48?3:o<144?4:o<768?5:6,n=o<8?new p(r):r.isEven()?new B(r):new y(r);var h=new Array,u=3,a=i-1,f=(1<<i)-1;if(h[1]=n.convert(this),i>1){var m=e();for(n.sqrTo(h[1],m);u<=f;)h[u]=e(),n.mulTo(m,h[u-2],h[u]),u+=2}var g,d,v=t.t-1,w=!0,T=e();for(o=l(t[v])-1;v>=0;){for(o>=a?g=t[v]>>o-a&f:(g=(t[v]&(1<<o+1)-1)<<a-o,v>0&&(g|=t[v-1]>>this.DB+o-a)),u=i;!(1&g);)g>>=1,--u;if((o-=u)<0&&(o+=this.DB,--v),w)h[g].copyTo(s),w=!1;else{for(;u>1;)n.sqrTo(s,T),n.sqrTo(T,s),u-=2;u>0?n.sqrTo(s,T):(d=s,s=T,T=d),n.mulTo(T,h[g],s)}for(;v>=0&&!(t[v]&1<<o);)n.sqrTo(s,T),d=s,s=T,T=d,--o<0&&(o=this.DB-1,--v)}return n.revert(s)},r.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return r.ZERO;for(var i=t.clone(),n=this.clone(),o=c(1),s=c(0),h=c(0),u=c(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),e?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(t,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?(h.isEven()&&u.isEven()||(h.addTo(this,h),u.subTo(t,u)),h.rShiftTo(1,h)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);i.compareTo(n)>=0?(i.subTo(n,i),e&&o.subTo(h,o),s.subTo(u,s)):(n.subTo(i,n),e&&h.subTo(o,h),u.subTo(s,u))}return 0!=n.compareTo(r.ONE)?r.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u},r.prototype.pow=function(t){return this.exp(t,new F)},r.prototype.gcd=function(t){var r=this.s<0?this.negate():this.clone(),e=t.s<0?t.negate():t.clone();if(r.compareTo(e)<0){var i=r;r=e,e=i}var n=r.getLowestSetBit(),o=e.getLowestSetBit();if(o<0)return r;for(n<o&&(o=n),o>0&&(r.rShiftTo(o,r),e.rShiftTo(o,e));r.signum()>0;)(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),r.compareTo(e)>=0?(r.subTo(e,r),r.rShiftTo(1,r)):(e.subTo(r,e),e.rShiftTo(1,e));return o>0&&e.lShiftTo(o,e),e},r.prototype.isProbablePrime=function(t){var r,e=this.abs();if(1==e.t&&e[0]<=S[S.length-1]){for(r=0;r<S.length;++r)if(e[0]==S[r])return!0;return!1}if(e.isEven())return!1;for(r=1;r<S.length;){for(var i=S[r],n=r+1;n<S.length&&i<D;)i*=S[n++];for(i=e.modInt(i);r<n;)if(i%S[r++]==0)return!1}return e.millerRabin(t)},r.prototype.square=function(){var t=e();return this.squareTo(t),t},r.prototype.Barrett=B,null==x){var A;if(x=new Array,E=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var R=new Uint8Array(32);for(window.crypto.getRandomValues(R),A=0;A<32;++A)x[E++]=R[A]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var P=window.crypto.random(32);for(A=0;A<P.length;++A)x[E++]=255&P.charCodeAt(A)}for(;E<H;)A=Math.floor(65536*Math.random()),x[E++]=A>>>8,x[E++]=255&A;E=0,I()}function O(){if(null==q){for(I(),(q=new C).init(x),E=0;E<x.length;++E)x[E]=0;E=0}return q.next()}function M(){}function C(){this.i=0,this.j=0,this.S=new Array}M.prototype.nextBytes=function(t){var r;for(r=0;r<t.length;++r)t[r]=O()},C.prototype.init=function(t){var r,e,i;for(r=0;r<256;++r)this.S[r]=r;for(e=0,r=0;r<256;++r)e=e+this.S[r]+t[r%t.length]&255,i=this.S[r],this.S[r]=this.S[e],this.S[e]=i;this.i=0,this.j=0},C.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var H=256;a.exports={default:r,BigInteger:r,SecureRandom:M}}.call(f);var l=c.exports;const{BigInteger:p}=l;class y{constructor(){this.tlv=null,this.t="00",this.l="00",this.v=""}getEncodedHex(){return this.tlv||(this.v=this.getValue(),this.l=this.getLength(),this.tlv=this.t+this.l+this.v),this.tlv}getLength(){const t=this.v.length/2;let r=t.toString(16);if(r.length%2==1&&(r="0"+r),t<128)return r;return(128+r.length/2).toString(16)+r}getValue(){return""}}class m extends y{constructor(t){super(),this.t="02",t&&(this.v=function(t){let r=t.toString(16);if("-"!==r[0])r.length%2==1?r="0"+r:r.match(/^[0-7]/)||(r="00"+r);else{r=r.substr(1);let e=r.length;e%2==1?e+=1:r.match(/^[0-7]/)||(e+=2);let i="";for(let t=0;t<e;t++)i+="f";i=new p(i,16),r=i.xor(t).add(p.ONE),r=r.toString(16).replace(/^-/,"")}return r}(t))}getValue(){return this.v}}class g extends y{constructor(t){super(),this.t="30",this.asn1Array=t}getValue(){return this.v=this.asn1Array.map((t=>t.getEncodedHex())).join(""),this.v}}function d(t,r){return+t[r+2]<8?1:128&+t.substr(r+2,2)}function v(t,r){const e=d(t,r),i=t.substr(r+2,2*e);if(!i)return-1;return(+i[0]<8?new p(i,16):new p(i.substr(2),16)).intValue()}function w(t,r){return r+2*(d(t,r)+1)}var T={encodeDer(t,r){const e=new m(t),i=new m(r);return new g([e,i]).getEncodedHex()},decodeDer(t){const r=w(t,0),e=w(t,r),i=v(t,r),n=t.substr(e,2*i),o=e+n.length,s=w(t,o),h=v(t,o),u=t.substr(s,2*h);return{r:new p(n,16),s:new p(u,16)}}};const{BigInteger:F}=l,b=new F("2"),B=new F("3");class q{constructor(t,r){this.x=r,this.q=t}equals(t){return t===this||this.q.equals(t.q)&&this.x.equals(t.x)}toBigInteger(){return this.x}negate(){return new q(this.q,this.x.negate().mod(this.q))}add(t){return new q(this.q,this.x.add(t.toBigInteger()).mod(this.q))}subtract(t){return new q(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))}multiply(t){return new q(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))}divide(t){return new q(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))}square(){return new q(this.q,this.x.square().mod(this.q))}}class x{constructor(t,r,e,i){this.curve=t,this.x=r,this.y=e,this.z=null==i?F.ONE:i,this.zinv=null}getX(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}getY(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}equals(t){if(t===this)return!0;if(this.isInfinity())return t.isInfinity();if(t.isInfinity())return this.isInfinity();if(!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(F.ZERO))return!1;return t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(F.ZERO)}isInfinity(){return null===this.x&&null===this.y||this.z.equals(F.ZERO)&&!this.y.toBigInteger().equals(F.ZERO)}negate(){return new x(this.curve,this.x,this.y.negate(),this.z)}add(t){if(this.isInfinity())return t;if(t.isInfinity())return this;const r=this.x.toBigInteger(),e=this.y.toBigInteger(),i=this.z,n=t.x.toBigInteger(),o=t.y.toBigInteger(),s=t.z,h=this.curve.q,u=r.multiply(s).mod(h),a=n.multiply(i).mod(h),f=u.subtract(a),c=e.multiply(s).mod(h),l=o.multiply(i).mod(h),p=c.subtract(l);if(F.ZERO.equals(f))return F.ZERO.equals(p)?this.twice():this.curve.infinity;const y=u.add(a),m=i.multiply(s).mod(h),g=f.square().mod(h),d=f.multiply(g).mod(h),v=m.multiply(p.square()).subtract(y.multiply(g)).mod(h),w=f.multiply(v).mod(h),T=p.multiply(g.multiply(u).subtract(v)).subtract(c.multiply(d)).mod(h),b=d.multiply(m).mod(h);return new x(this.curve,this.curve.fromBigInteger(w),this.curve.fromBigInteger(T),b)}twice(){if(this.isInfinity())return this;if(!this.y.toBigInteger().signum())return this.curve.infinity;const t=this.x.toBigInteger(),r=this.y.toBigInteger(),e=this.z,i=this.curve.q,n=this.curve.a.toBigInteger(),o=t.square().multiply(B).add(n.multiply(e.square())).mod(i),s=r.shiftLeft(1).multiply(e).mod(i),h=r.square().mod(i),u=h.multiply(t).multiply(e).mod(i),a=s.square().mod(i),f=o.square().subtract(u.shiftLeft(3)).mod(i),c=s.multiply(f).mod(i),l=o.multiply(u.shiftLeft(2).subtract(f)).subtract(a.shiftLeft(1).multiply(h)).mod(i),p=s.multiply(a).mod(i);return new x(this.curve,this.curve.fromBigInteger(c),this.curve.fromBigInteger(l),p)}multiply(t){if(this.isInfinity())return this;if(!t.signum())return this.curve.infinity;const r=t.multiply(B),e=this.negate();let i=this;for(let n=r.bitLength()-2;n>0;n--){i=i.twice();const o=r.testBit(n);o!==t.testBit(n)&&(i=i.add(o?this:e))}return i}}var E={ECPointFp:x,ECCurveFp:class{constructor(t,r,e){this.q=t,this.a=this.fromBigInteger(r),this.b=this.fromBigInteger(e),this.infinity=new x(this,null,null)}equals(t){return t===this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)}fromBigInteger(t){return new q(this.q,t)}decodePointHex(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:const r=this.fromBigInteger(new F(t.substr(2),16));let e=this.fromBigInteger(r.multiply(r.square()).add(r.multiply(this.a)).add(this.b).toBigInteger().modPow(this.q.divide(new F("4")).add(F.ONE),this.q));return e.toBigInteger().mod(b).equals(new F(t.substr(0,2),16).subtract(b))||(e=e.negate()),new x(this,r,e);case 4:case 6:case 7:const i=(t.length-2)/2,n=t.substr(2,i),o=t.substr(i+2,i);return new x(this,this.fromBigInteger(new F(n,16)),this.fromBigInteger(new F(o,16)));default:return null}}}};const{BigInteger:S,SecureRandom:D}=l,{ECCurveFp:I}=E,A=new D,{curve:R,G:P,n:O}=M();function M(){const t=new S("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF",16),r=new S("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC",16),e=new S("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93",16),i=new I(t,r,e),n=i.decodePointHex("0432C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0");return{curve:i,G:n,n:new S("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123",16)}}function C(t,r){return t.length>=r?t:new Array(r-t.length+1).join("0")+t}var H={getGlobalCurve:function(){return R},generateEcparam:M,generateKeyPairHex:function(t,r,e){const i=(t?new S(t,r,e):new S(O.bitLength(),A)).mod(O.subtract(S.ONE)).add(S.ONE),n=C(i.toString(16),64),o=P.multiply(i);return{privateKey:n,publicKey:"04"+C(o.getX().toBigInteger().toString(16),64)+C(o.getY().toBigInteger().toString(16),64)}},compressPublicKeyHex:function(t){if(130!==t.length)throw new Error("Invalid public key to compress");const r=(t.length-2)/2,e=t.substr(2,r);let i="03";return new S(t.substr(r+2,r),16).mod(new S("2")).equals(S.ZERO)&&(i="02"),i+e},utf8ToHex:function(t){const r=(t=unescape(encodeURIComponent(t))).length,e=[];for(let i=0;i<r;i++)e[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;const i=[];for(let t=0;t<r;t++){const r=e[t>>>2]>>>24-t%4*8&255;i.push((r>>>4).toString(16)),i.push((15&r).toString(16))}return i.join("")},leftPad:C,arrayToHex:function(t){return t.map((t=>1===(t=t.toString(16)).length?"0"+t:t)).join("")},arrayToUtf8:function(t){const r=[];let e=0;for(let i=0;i<2*t.length;i+=2)r[i>>>3]|=parseInt(t[e],10)<<24-i%8*4,e++;try{const e=[];for(let i=0;i<t.length;i++){const t=r[i>>>2]>>>24-i%4*8&255;e.push(String.fromCharCode(t))}return decodeURIComponent(escape(e.join("")))}catch(t){throw new Error("Malformed UTF-8 data")}},hexToArray:function(t){const r=[];let e=t.length;e%2!=0&&(t=C(t,e+1)),e=t.length;for(let i=0;i<e;i+=2)r.push(parseInt(t.substr(i,2),16));return r},verifyPublicKey:function(t){const r=R.decodePointHex(t);if(!r)return!1;const e=r.getX();return r.getY().square().equals(e.multiply(e.square()).add(e.multiply(R.a)).add(R.b))},comparePublicKeyHex:function(t,r){const e=R.decodePointHex(t);if(!e)return!1;const i=R.decodePointHex(r);return!!i&&e.equals(i)}};const K=new Uint32Array(68),N=new Uint32Array(64);function V(t,r){const e=31&r;return t<<e|t>>>32-e}function L(t,r){const e=[];for(let i=t.length-1;i>=0;i--)e[i]=255&(t[i]^r[i]);return e}function z(t){return t^V(t,9)^V(t,17)}function k(t){let r=8*t.length,e=r%512;e=e>=448?512-e%448-1:448-e-1;const i=new Array((e-7)/8),n=new Array(8);for(let t=0,r=i.length;t<r;t++)i[t]=0;for(let t=0,r=n.length;t<r;t++)n[t]=0;r=r.toString(2);for(let t=7;t>=0;t--)if(r.length>8){const e=r.length-8;n[t]=parseInt(r.substr(e),2),r=r.substr(0,e)}else r.length>0&&(n[t]=parseInt(r,2),r="");const o=new Uint8Array([...t,128,...i,...n]),s=new DataView(o.buffer,0),h=o.length/64,u=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]);for(let t=0;t<h;t++){K.fill(0),N.fill(0);const r=16*t;for(let t=0;t<16;t++)K[t]=s.getUint32(4*(r+t),!1);for(let t=16;t<68;t++)K[t]=(a=K[t-16]^K[t-9]^V(K[t-3],15))^V(a,15)^V(a,23)^V(K[t-13],7)^K[t-6];for(let t=0;t<64;t++)N[t]=K[t]^K[t+4];const e=2043430169,i=2055708042;let n,o,h,f,c,l=u[0],p=u[1],y=u[2],m=u[3],g=u[4],d=u[5],v=u[6],w=u[7];for(let t=0;t<64;t++)c=t>=0&&t<=15?e:i,n=V(V(l,12)+g+V(c,t),7),o=n^V(l,12),h=(t>=0&&t<=15?l^p^y:l&p|l&y|p&y)+m+o+N[t],f=(t>=0&&t<=15?g^d^v:g&d|~g&v)+w+n+K[t],m=y,y=V(p,9),p=l,l=h,w=v,v=V(d,19),d=g,g=z(f);u[0]^=l,u[1]^=p,u[2]^=y,u[3]^=m,u[4]^=g,u[5]^=d,u[6]^=v,u[7]^=w}var a;const f=[];for(let t=0,r=u.length;t<r;t++){const r=u[t];f.push((4278190080&r)>>>24,(16711680&r)>>>16,(65280&r)>>>8,255&r)}return f}const Z=new Uint8Array(64),j=new Uint8Array(64);for(let t=0;t<64;t++)Z[t]=54,j[t]=92;var U={sm3:k,hmac:function(t,r){for(r.length>64&&(r=k(r));r.length<64;)r.push(0);const e=L(r,Z),i=L(r,j),n=k([...e,...t]);return k([...i,...n])}};const{BigInteger:$}=l,{encodeDer:X,decodeDer:Y}=T,G=H,J=U.sm3,{G:_,curve:W,n:Q}=G.generateEcparam();function tt(t,r,e="1234567812345678"){e=G.utf8ToHex(e);const i=G.leftPad(_.curve.a.toBigInteger().toRadix(16),64),n=G.leftPad(_.curve.b.toBigInteger().toRadix(16),64),o=G.leftPad(_.getX().toBigInteger().toRadix(16),64),s=G.leftPad(_.getY().toBigInteger().toRadix(16),64);let h,u;if(128===r.length)h=r.substr(0,64),u=r.substr(64,64);else{const t=_.curve.decodePointHex(r);h=G.leftPad(t.getX().toBigInteger().toRadix(16),64),u=G.leftPad(t.getY().toBigInteger().toRadix(16),64)}const a=G.hexToArray(e+i+n+o+s+h+u),f=4*e.length;a.unshift(255&f),a.unshift(f>>8&255);const c=J(a);return G.arrayToHex(J(c.concat(G.hexToArray(t))))}function rt(t){const r=_.multiply(new $(t,16));return"04"+G.leftPad(r.getX().toBigInteger().toString(16),64)+G.leftPad(r.getY().toBigInteger().toString(16),64)}function et(){const t=G.generateKeyPairHex(),r=W.decodePointHex(t.publicKey);return t.k=new $(t.privateKey,16),t.x1=r.getX().toBigInteger(),t}var it={generateKeyPairHex:G.generateKeyPairHex,compressPublicKeyHex:G.compressPublicKeyHex,comparePublicKeyHex:G.comparePublicKeyHex,doEncrypt:function(t,r,e=1){t="string"==typeof t?G.hexToArray(G.utf8ToHex(t)):Array.prototype.slice.call(t),r=G.getGlobalCurve().decodePointHex(r);const i=G.generateKeyPairHex(),n=new $(i.privateKey,16);let o=i.publicKey;o.length>128&&(o=o.substr(o.length-128));const s=r.multiply(n),h=G.hexToArray(G.leftPad(s.getX().toBigInteger().toRadix(16),64)),u=G.hexToArray(G.leftPad(s.getY().toBigInteger().toRadix(16),64)),a=G.arrayToHex(J([].concat(h,t,u)));let f=1,c=0,l=[];const p=[].concat(h,u),y=()=>{l=J([...p,f>>24&255,f>>16&255,f>>8&255,255&f]),f++,c=0};y();for(let r=0,e=t.length;r<e;r++)c===l.length&&y(),t[r]^=255&l[c++];const m=G.arrayToHex(t);return 0===e?o+m+a:o+a+m},doDecrypt:function(t,r,e=1,{output:i="string"}={}){r=new $(r,16);let n=t.substr(128,64),o=t.substr(192);0===e&&(n=t.substr(t.length-64),o=t.substr(128,t.length-128-64));const s=G.hexToArray(o),h=G.getGlobalCurve().decodePointHex("04"+t.substr(0,128)).multiply(r),u=G.hexToArray(G.leftPad(h.getX().toBigInteger().toRadix(16),64)),a=G.hexToArray(G.leftPad(h.getY().toBigInteger().toRadix(16),64));let f=1,c=0,l=[];const p=[].concat(u,a),y=()=>{l=J([...p,f>>24&255,f>>16&255,f>>8&255,255&f]),f++,c=0};y();for(let t=0,r=s.length;t<r;t++)c===l.length&&y(),s[t]^=255&l[c++];return G.arrayToHex(J([].concat(u,s,a)))===n.toLowerCase()?"array"===i?s:G.arrayToUtf8(s):"array"===i?[]:""},doSignature:function(t,r,{pointPool:e,der:i,hash:n,publicKey:o,userId:s}={}){let h="string"==typeof t?G.utf8ToHex(t):G.arrayToHex(t);n&&(h=tt(h,o=o||rt(r),s));const u=new $(r,16),a=new $(h,16);let f=null,c=null,l=null;do{do{let t;t=e&&e.length?e.pop():et(),f=t.k,c=a.add(t.x1).mod(Q)}while(c.equals($.ZERO)||c.add(f).equals(Q));l=u.add($.ONE).modInverse(Q).multiply(f.subtract(c.multiply(u))).mod(Q)}while(l.equals($.ZERO));return i?X(c,l):G.leftPad(c.toString(16),64)+G.leftPad(l.toString(16),64)},doVerifySignature:function(t,r,e,{der:i,hash:n,userId:o}={}){let s,h,u="string"==typeof t?G.utf8ToHex(t):G.arrayToHex(t);if(n&&(u=tt(u,e,o)),i){const t=Y(r);s=t.r,h=t.s}else s=new $(r.substring(0,64),16),h=new $(r.substring(64),16);const a=W.decodePointHex(e),f=new $(u,16),c=s.add(h).mod(Q);if(c.equals($.ZERO))return!1;const l=_.multiply(h).add(a.multiply(c)),p=f.add(l.getX().toBigInteger()).mod(Q);return s.equals(p)},getPublicKeyFromPrivateKey:rt,getPoint:et,verifyPublicKey:G.verifyPublicKey};const{sm3:nt,hmac:ot}=U;function st(t){return t.map((t=>1===(t=t.toString(16)).length?"0"+t:t)).join("")}function ht(t){const r=[];let e=t.length;var i,n;e%2!=0&&(n=e+1,t=(i=t).length>=n?i:new Array(n-i.length+1).join("0")+i),e=t.length;for(let i=0;i<e;i+=2)r.push(parseInt(t.substr(i,2),16));return r}const ut=0,at=16,ft=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],ct=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function lt(t){const r=[];for(let e=0,i=t.length;e<i;e+=2)r.push(parseInt(t.substr(e,2),16));return r}function pt(t,r){const e=31&r;return t<<e|t>>>32-e}function yt(t){return(255&ft[t>>>24&255])<<24|(255&ft[t>>>16&255])<<16|(255&ft[t>>>8&255])<<8|255&ft[255&t]}function mt(t){return t^pt(t,2)^pt(t,10)^pt(t,18)^pt(t,24)}function gt(t){return t^pt(t,13)^pt(t,23)}function dt(t,r,e){const i=new Array(4),n=new Array(4);for(let r=0;r<4;r++)n[0]=255&t[4*r],n[1]=255&t[4*r+1],n[2]=255&t[4*r+2],n[3]=255&t[4*r+3],i[r]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(let t,r=0;r<32;r+=4)t=i[1]^i[2]^i[3]^e[r+0],i[0]^=mt(yt(t)),t=i[2]^i[3]^i[0]^e[r+1],i[1]^=mt(yt(t)),t=i[3]^i[0]^i[1]^e[r+2],i[2]^=mt(yt(t)),t=i[0]^i[1]^i[2]^e[r+3],i[3]^=mt(yt(t));for(let t=0;t<16;t+=4)r[t]=i[3-t/4]>>>24&255,r[t+1]=i[3-t/4]>>>16&255,r[t+2]=i[3-t/4]>>>8&255,r[t+3]=255&i[3-t/4]}function vt(t,r,e,{padding:i="pkcs#7",mode:n,iv:o=[],output:s="string"}={}){if("cbc"===n&&("string"==typeof o&&(o=lt(o)),16!==o.length))throw new Error("iv is invalid");if("string"==typeof r&&(r=lt(r)),16!==r.length)throw new Error("key is invalid");if(t="string"==typeof t?e!==ut?function(t){const r=[];for(let e=0,i=t.length;e<i;e++){const i=t.codePointAt(e);if(i<=127)r.push(i);else if(i<=2047)r.push(192|i>>>6),r.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)r.push(224|i>>>12),r.push(128|i>>>6&63),r.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw r.push(i),new Error("input is not supported");e++,r.push(240|i>>>18&28),r.push(128|i>>>12&63),r.push(128|i>>>6&63),r.push(128|63&i)}}return r}(t):lt(t):[...t],("pkcs#5"===i||"pkcs#7"===i)&&e!==ut){const r=at-t.length%at;for(let e=0;e<r;e++)t.push(r)}const h=new Array(32);!function(t,r,e){const i=new Array(4),n=new Array(4);for(let r=0;r<4;r++)n[0]=255&t[0+4*r],n[1]=255&t[1+4*r],n[2]=255&t[2+4*r],n[3]=255&t[3+4*r],i[r]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let t,e=0;e<32;e+=4)t=i[1]^i[2]^i[3]^ct[e+0],r[e+0]=i[0]^=gt(yt(t)),t=i[2]^i[3]^i[0]^ct[e+1],r[e+1]=i[1]^=gt(yt(t)),t=i[3]^i[0]^i[1]^ct[e+2],r[e+2]=i[2]^=gt(yt(t)),t=i[0]^i[1]^i[2]^ct[e+3],r[e+3]=i[3]^=gt(yt(t));if(e===ut)for(let t,e=0;e<16;e++)t=r[e],r[e]=r[31-e],r[31-e]=t}(r,h,e);const u=[];let a=o,f=t.length,c=0;for(;f>=at;){const r=t.slice(c,c+16),i=new Array(16);if("cbc"===n)for(let t=0;t<at;t++)e!==ut&&(r[t]^=a[t]);dt(r,i,h);for(let t=0;t<at;t++)"cbc"===n&&e===ut&&(i[t]^=a[t]),u[c+t]=i[t];"cbc"===n&&(a=e!==ut?i:r),f-=at,c+=at}if(("pkcs#5"===i||"pkcs#7"===i)&&e===ut){const t=u.length,r=u[t-1];for(let e=1;e<=r;e++)if(u[t-e]!==r)throw new Error("padding is invalid");u.splice(t-r,r)}return"array"!==s?e!==ut?u.map((t=>1===(t=t.toString(16)).length?"0"+t:t)).join(""):function(t){const r=[];for(let e=0,i=t.length;e<i;e++)t[e]>=240&&t[e]<=247?(r.push(String.fromCodePoint(((7&t[e])<<18)+((63&t[e+1])<<12)+((63&t[e+2])<<6)+(63&t[e+3]))),e+=3):t[e]>=224&&t[e]<=239?(r.push(String.fromCodePoint(((15&t[e])<<12)+((63&t[e+1])<<6)+(63&t[e+2]))),e+=2):t[e]>=192&&t[e]<=223?(r.push(String.fromCodePoint(((31&t[e])<<6)+(63&t[e+1]))),e++):r.push(String.fromCodePoint(t[e]));return r.join("")}(u):u}var wt={sm2:it,sm3:function(t,r){if(t="string"==typeof t?function(t){const r=[];for(let e=0,i=t.length;e<i;e++){const i=t.codePointAt(e);if(i<=127)r.push(i);else if(i<=2047)r.push(192|i>>>6),r.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)r.push(224|i>>>12),r.push(128|i>>>6&63),r.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw r.push(i),new Error("input is not supported");e++,r.push(240|i>>>18&28),r.push(128|i>>>12&63),r.push(128|i>>>6&63),r.push(128|63&i)}}return r}(t):Array.prototype.slice.call(t),r){if("hmac"!==(r.mode||"hmac"))throw new Error("invalid mode");let e=r.key;if(!e)throw new Error("invalid key");return e="string"==typeof e?ht(e):Array.prototype.slice.call(e),st(ot(t,e))}return st(nt(t))},sm4:{encrypt:(t,r,e)=>vt(t,r,1,e),decrypt:(t,r,e)=>vt(t,r,0,e)}};const Tt={mode:"ecb",padding:"pkcs#5",output:"array"},Ft=r.Buffer,bt=function(t,r,e,i){return(n,o)=>{try{if(o.closeCrypto)return n;t.info=h(),t.publicKey=[...Ft.from(t.info.key)];const s=wt.sm2.doEncrypt(JSON.stringify(t.info),r,1);if(e.set(i,function(t){if("string"==typeof t)return String(t);return JSON.parse(JSON.stringify(t))}(s)),((t,r)=>{t.set("X-Encrypt-Key",r)})(o,s),n){"string"!=typeof n&&(n=JSON.stringify(n));const r=wt.sm4.encrypt(n,t.publicKey,Tt);return n=Ft.from(r)}return n}catch(t){console.error("encrypt error",t,n,o)}}};const Bt=function(){const t=new Map;return{get:function(r){return t.get(r)},generateKey:function r(i){const n=`${e(8,"low")}-/${i}`;return t.has(n)?r(i):n},set:function(r,e){t.set(r,e)},clear:function(r){t.delete(r)}}}();function qt(t,r){if(!r||"string"!=typeof r)throw new Error(`publicKey is required and must be a string ${r}`);t.interceptors.request.use((t=>{const e=t.transformRequest,i=t?.headers?.__requestKey,s={info:null,publicKey:[]};if(!e)throw new Error(`request ${t} has no transformRequest`);if(!Array.isArray(e))throw new Error(`transformRequest ${e} is not an array`);e.push(bt(s,r,Bt,i));const h=function(t){return(r,e)=>{try{if((t=>{const r=t.get("X-Encrypt-With");return r&&"string"==typeof r&&"sm4"===r.toLowerCase()})(e)){const e=Ft.from(r);return o(wt.sm4.decrypt(e,t.publicKey,{mode:"ecb",padding:"pkcs#7"}))}return n(r)}catch(t){console.error("decrypt error",t,r,e)}}}(s);if(!h)return t;const u=t.transformResponse;if(!u)throw new Error(`request ${t} has no transformResponse`);if("function"!=typeof h)throw new Error(`decryptFn ${h} is not a function`);if(!Array.isArray(u))throw new Error(`transformResponse ${u} is not an array`);return u.unshift(h),t})),t.interceptors.request.use((t=>{const r=t.url,e=t.headers;return r?(e.__requestKey=Bt.generateKey(r),t):t})),t.interceptors.request.use((t=>(t.headers.closeCrypto||(t.responseType="arraybuffer"),t))),t.interceptors.request.use((t=>{const r=t.data,e=t.headers;return r?(r instanceof FormData&&(e.closeCrypto=!0),t):t})),t.interceptors.request.use((t=>{const r=t.url,e=t.headers;if(!r)throw new Error("url is required");if({}.hasOwnProperty.call(e,"closeCrypto"))return t;return s(r)||(e.closeCrypto=!0),t})),t.interceptors.response.use((t=>(t.data=n(t.data),t.data=o(t.data),t)),(t=>{const r=t.response;throw r?.data&&(r.data=function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){throw console.error("error",t),t}return t instanceof ArrayBuffer?i(t):t}(r.data)),t}))}const xt=wt.sm2.doDecrypt;exports.createCryptoAxiosInstance=(r,e)=>{const i=t.create(r);return qt(i,e),i},exports.createRequestInstance=(r,e)=>{const i=t.create(r);return function(t,r){if(!r)return t;const{encryptFn:e,decryptFn:i}=r();e&&t.interceptors.request.use((t=>{const r=t.transformRequest;if(!r)throw new Error(`request ${t} has no transformRequest`);if(!Array.isArray(r))throw new Error(`transformRequest ${r} is not an array`);if(r.push(e),!i)return t;const n=t.transformResponse;if(!n)throw new Error(`request ${t} has no transformResponse`);if("function"!=typeof i)throw new Error(`decryptFn ${i} is not a function`);if(!Array.isArray(n))throw new Error(`transformResponse ${n} is not an array`);return n.unshift(i),t}))}(i,e),i},exports.decryptHeadersInfo=xt,exports.getCryptoInfo=h,exports.getSm4EncryptConfig=u,exports.randomPassword=e,exports.shouldEncrypt=s;

@@ -6,1 +6,2 @@ export { createRequestInstance } from './instance/instance';

export { shouldEncrypt } from './helpers/utils';
export { decryptHeadersInfo } from './extension';

@@ -1,1 +0,1 @@

import t from"axios";import r from"buffer";const e=(r,e)=>{const i=t.create(r);return function(t,r){if(!r)return t;const{encryptFn:e,decryptFn:i}=r();e&&t.interceptors.request.use((t=>{const r=t.transformRequest;if(!r)throw new Error(`request ${t} has no transformRequest`);if(!Array.isArray(r))throw new Error(`transformRequest ${r} is not an array`);if(r.push(e),!i)return t;const n=t.transformResponse;if(!n)throw new Error(`request ${t} has no transformResponse`);if("function"!=typeof i)throw new Error(`decryptFn ${i} is not a function`);if(!Array.isArray(n))throw new Error(`transformResponse ${n} is not an array`);return n.unshift(i),t}))}(i,e),i};const i=(t=16,r="high")=>{const e=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],i=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],n=[0,1,2,3,4,5,6,7,8,9],o=["!","@","-","_","=","<",">","#","*","%","+","&","^","$"],s=[];let h="";const u=function(...t){let r="";return t.forEach((t=>{r+=t[Math.floor(Math.random()*t.length)]})),r};switch(r){case"high":h+=u(e,i,n,o),s.push(...e,...i,...n,...o);break;case"medium":h+=u(e,i,n),s.push(...e,...i,...n);break;default:h+=u(e,n),s.push(...e,...n)}const a=t-h.length;for(let t=0;t<a;t++)h+=u(s);return h};function n(t,r="utf-8"){return new TextDecoder(r).decode(t)}function o(t){try{return t instanceof ArrayBuffer?s(n(t)):t}catch(t){throw console.error("error",t),t}}function s(t){try{return"string"==typeof t?JSON.parse(t):t}catch(t){throw console.error("error",t),t}}const h=t=>{let r=!0;return!(t=>/^\/bi-api\/api/.test(t))(t)&&(t.startsWith("/api")&&(r=!1,(t=>/^\/(api\/logmanage|api\/data-source|api\/enterpriseadmin|api\/componentmanager|api\/spacemanager|api\/filemanager)/.test(t))(t)&&(r=!0)),r)},u=t=>({...{key:i(16,"high"),algorithm:t||"SM4"}}),a=()=>({mode:"ecb",padding:"pkcs#5",output:"array"});var f,c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},l={exports:{}};f=l,function(){var t;function r(t,r,e){null!=t&&("number"==typeof t?this.fromNumber(t,r,e):null==r&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,r))}function e(){return new r(null)}var i="undefined"!=typeof navigator;i&&"Microsoft Internet Explorer"==navigator.appName?(r.prototype.am=function(t,r,e,i,n,o){for(var s=32767&r,h=r>>15;--o>=0;){var u=32767&this[t],a=this[t++]>>15,f=h*u+a*s;n=((u=s*u+((32767&f)<<15)+e[i]+(1073741823&n))>>>30)+(f>>>15)+h*a+(n>>>30),e[i++]=1073741823&u}return n},t=30):i&&"Netscape"!=navigator.appName?(r.prototype.am=function(t,r,e,i,n,o){for(;--o>=0;){var s=r*this[t++]+e[i]+n;n=Math.floor(s/67108864),e[i++]=67108863&s}return n},t=26):(r.prototype.am=function(t,r,e,i,n,o){for(var s=16383&r,h=r>>14;--o>=0;){var u=16383&this[t],a=this[t++]>>14,f=h*u+a*s;n=((u=s*u+((16383&f)<<14)+e[i]+n)>>28)+(f>>14)+h*a,e[i++]=268435455&u}return n},t=28),r.prototype.DB=t,r.prototype.DM=(1<<t)-1,r.prototype.DV=1<<t,r.prototype.FV=Math.pow(2,52),r.prototype.F1=52-t,r.prototype.F2=2*t-52;var n,o,s="0123456789abcdefghijklmnopqrstuvwxyz",h=new Array;for(n="0".charCodeAt(0),o=0;o<=9;++o)h[n++]=o;for(n="a".charCodeAt(0),o=10;o<36;++o)h[n++]=o;for(n="A".charCodeAt(0),o=10;o<36;++o)h[n++]=o;function u(t){return s.charAt(t)}function a(t,r){var e=h[t.charCodeAt(r)];return null==e?-1:e}function c(t){var r=e();return r.fromInt(t),r}function l(t){var r,e=1;return 0!=(r=t>>>16)&&(t=r,e+=16),0!=(r=t>>8)&&(t=r,e+=8),0!=(r=t>>4)&&(t=r,e+=4),0!=(r=t>>2)&&(t=r,e+=2),0!=(r=t>>1)&&(t=r,e+=1),e}function p(t){this.m=t}function y(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function m(t,r){return t&r}function g(t,r){return t|r}function d(t,r){return t^r}function v(t,r){return t&~r}function w(t){if(0==t)return-1;var r=0;return 65535&t||(t>>=16,r+=16),255&t||(t>>=8,r+=8),15&t||(t>>=4,r+=4),3&t||(t>>=2,r+=2),1&t||++r,r}function T(t){for(var r=0;0!=t;)t&=t-1,++r;return r}function F(){}function b(t){return t}function B(t){this.r2=e(),this.q3=e(),r.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}p.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},p.prototype.revert=function(t){return t},p.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},p.prototype.mulTo=function(t,r,e){t.multiplyTo(r,e),this.reduce(e)},p.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)},y.prototype.convert=function(t){var i=e();return t.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),t.s<0&&i.compareTo(r.ZERO)>0&&this.m.subTo(i,i),i},y.prototype.revert=function(t){var r=e();return t.copyTo(r),this.reduce(r),r},y.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var r=0;r<this.m.t;++r){var e=32767&t[r],i=e*this.mpl+((e*this.mph+(t[r]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[e=r+this.m.t]+=this.m.am(0,i,t,r,0,this.m.t);t[e]>=t.DV;)t[e]-=t.DV,t[++e]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},y.prototype.mulTo=function(t,r,e){t.multiplyTo(r,e),this.reduce(e)},y.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)},r.prototype.copyTo=function(t){for(var r=this.t-1;r>=0;--r)t[r]=this[r];t.t=this.t,t.s=this.s},r.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},r.prototype.fromString=function(t,e){var i;if(16==e)i=4;else if(8==e)i=3;else if(256==e)i=8;else if(2==e)i=1;else if(32==e)i=5;else{if(4!=e)return void this.fromRadix(t,e);i=2}this.t=0,this.s=0;for(var n=t.length,o=!1,s=0;--n>=0;){var h=8==i?255&t[n]:a(t,n);h<0?"-"==t.charAt(n)&&(o=!0):(o=!1,0==s?this[this.t++]=h:s+i>this.DB?(this[this.t-1]|=(h&(1<<this.DB-s)-1)<<s,this[this.t++]=h>>this.DB-s):this[this.t-1]|=h<<s,(s+=i)>=this.DB&&(s-=this.DB))}8==i&&128&t[0]&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&r.ZERO.subTo(this,this)},r.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},r.prototype.dlShiftTo=function(t,r){var e;for(e=this.t-1;e>=0;--e)r[e+t]=this[e];for(e=t-1;e>=0;--e)r[e]=0;r.t=this.t+t,r.s=this.s},r.prototype.drShiftTo=function(t,r){for(var e=t;e<this.t;++e)r[e-t]=this[e];r.t=Math.max(this.t-t,0),r.s=this.s},r.prototype.lShiftTo=function(t,r){var e,i=t%this.DB,n=this.DB-i,o=(1<<n)-1,s=Math.floor(t/this.DB),h=this.s<<i&this.DM;for(e=this.t-1;e>=0;--e)r[e+s+1]=this[e]>>n|h,h=(this[e]&o)<<i;for(e=s-1;e>=0;--e)r[e]=0;r[s]=h,r.t=this.t+s+1,r.s=this.s,r.clamp()},r.prototype.rShiftTo=function(t,r){r.s=this.s;var e=Math.floor(t/this.DB);if(e>=this.t)r.t=0;else{var i=t%this.DB,n=this.DB-i,o=(1<<i)-1;r[0]=this[e]>>i;for(var s=e+1;s<this.t;++s)r[s-e-1]|=(this[s]&o)<<n,r[s-e]=this[s]>>i;i>0&&(r[this.t-e-1]|=(this.s&o)<<n),r.t=this.t-e,r.clamp()}},r.prototype.subTo=function(t,r){for(var e=0,i=0,n=Math.min(t.t,this.t);e<n;)i+=this[e]-t[e],r[e++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i-=t.s;e<this.t;)i+=this[e],r[e++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;e<t.t;)i-=t[e],r[e++]=i&this.DM,i>>=this.DB;i-=t.s}r.s=i<0?-1:0,i<-1?r[e++]=this.DV+i:i>0&&(r[e++]=i),r.t=e,r.clamp()},r.prototype.multiplyTo=function(t,e){var i=this.abs(),n=t.abs(),o=i.t;for(e.t=o+n.t;--o>=0;)e[o]=0;for(o=0;o<n.t;++o)e[o+i.t]=i.am(0,n[o],e,o,0,i.t);e.s=0,e.clamp(),this.s!=t.s&&r.ZERO.subTo(e,e)},r.prototype.squareTo=function(t){for(var r=this.abs(),e=t.t=2*r.t;--e>=0;)t[e]=0;for(e=0;e<r.t-1;++e){var i=r.am(e,r[e],t,2*e,0,1);(t[e+r.t]+=r.am(e+1,2*r[e],t,2*e+1,i,r.t-e-1))>=r.DV&&(t[e+r.t]-=r.DV,t[e+r.t+1]=1)}t.t>0&&(t[t.t-1]+=r.am(e,r[e],t,2*e,0,1)),t.s=0,t.clamp()},r.prototype.divRemTo=function(t,i,n){var o=t.abs();if(!(o.t<=0)){var s=this.abs();if(s.t<o.t)return null!=i&&i.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=e());var h=e(),u=this.s,a=t.s,f=this.DB-l(o[o.t-1]);f>0?(o.lShiftTo(f,h),s.lShiftTo(f,n)):(o.copyTo(h),s.copyTo(n));var c=h.t,p=h[c-1];if(0!=p){var y=p*(1<<this.F1)+(c>1?h[c-2]>>this.F2:0),m=this.FV/y,g=(1<<this.F1)/y,d=1<<this.F2,v=n.t,w=v-c,T=null==i?e():i;for(h.dlShiftTo(w,T),n.compareTo(T)>=0&&(n[n.t++]=1,n.subTo(T,n)),r.ONE.dlShiftTo(c,T),T.subTo(h,h);h.t<c;)h[h.t++]=0;for(;--w>=0;){var F=n[--v]==p?this.DM:Math.floor(n[v]*m+(n[v-1]+d)*g);if((n[v]+=h.am(0,F,n,w,0,c))<F)for(h.dlShiftTo(w,T),n.subTo(T,n);n[v]<--F;)n.subTo(T,n)}null!=i&&(n.drShiftTo(c,i),u!=a&&r.ZERO.subTo(i,i)),n.t=c,n.clamp(),f>0&&n.rShiftTo(f,n),u<0&&r.ZERO.subTo(n,n)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var r=3&t;return(r=(r=(r=(r=r*(2-(15&t)*r)&15)*(2-(255&t)*r)&255)*(2-((65535&t)*r&65535))&65535)*(2-t*r%this.DV)%this.DV)>0?this.DV-r:-r},r.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},r.prototype.exp=function(t,i){if(t>4294967295||t<1)return r.ONE;var n=e(),o=e(),s=i.convert(this),h=l(t)-1;for(s.copyTo(n);--h>=0;)if(i.sqrTo(n,o),(t&1<<h)>0)i.mulTo(o,s,n);else{var u=n;n=o,o=u}return i.revert(n)},r.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var r;if(16==t)r=4;else if(8==t)r=3;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return this.toRadix(t);r=2}var e,i=(1<<r)-1,n=!1,o="",s=this.t,h=this.DB-s*this.DB%r;if(s-- >0)for(h<this.DB&&(e=this[s]>>h)>0&&(n=!0,o=u(e));s>=0;)h<r?(e=(this[s]&(1<<h)-1)<<r-h,e|=this[--s]>>(h+=this.DB-r)):(e=this[s]>>(h-=r)&i,h<=0&&(h+=this.DB,--s)),e>0&&(n=!0),n&&(o+=u(e));return n?o:"0"},r.prototype.negate=function(){var t=e();return r.ZERO.subTo(this,t),t},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(t){var r=this.s-t.s;if(0!=r)return r;var e=this.t;if(0!=(r=e-t.t))return this.s<0?-r:r;for(;--e>=0;)if(0!=(r=this[e]-t[e]))return r;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+l(this[this.t-1]^this.s&this.DM)},r.prototype.mod=function(t){var i=e();return this.abs().divRemTo(t,null,i),this.s<0&&i.compareTo(r.ZERO)>0&&t.subTo(i,i),i},r.prototype.modPowInt=function(t,r){var e;return e=t<256||r.isEven()?new p(r):new y(r),this.exp(t,e)},r.ZERO=c(0),r.ONE=c(1),F.prototype.convert=b,F.prototype.revert=b,F.prototype.mulTo=function(t,r,e){t.multiplyTo(r,e)},F.prototype.sqrTo=function(t,r){t.squareTo(r)},B.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var r=e();return t.copyTo(r),this.reduce(r),r},B.prototype.revert=function(t){return t},B.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},B.prototype.mulTo=function(t,r,e){t.multiplyTo(r,e),this.reduce(e)},B.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)};var q,x,E,S=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],D=(1<<26)/S[S.length-1];function I(){var t;t=(new Date).getTime(),x[E++]^=255&t,x[E++]^=t>>8&255,x[E++]^=t>>16&255,x[E++]^=t>>24&255,E>=H&&(E-=H)}if(r.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},r.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var r=this.chunkSize(t),i=Math.pow(t,r),n=c(i),o=e(),s=e(),h="";for(this.divRemTo(n,o,s);o.signum()>0;)h=(i+s.intValue()).toString(t).substr(1)+h,o.divRemTo(n,o,s);return s.intValue().toString(t)+h},r.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var i=this.chunkSize(e),n=Math.pow(e,i),o=!1,s=0,h=0,u=0;u<t.length;++u){var f=a(t,u);f<0?"-"==t.charAt(u)&&0==this.signum()&&(o=!0):(h=e*h+f,++s>=i&&(this.dMultiply(n),this.dAddOffset(h,0),s=0,h=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(h,0)),o&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(t,e,i){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(r.ONE.shiftLeft(t-1),g,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(r.ONE.shiftLeft(t-1),this);else{var n=new Array,o=7&t;n.length=1+(t>>3),e.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}},r.prototype.bitwiseTo=function(t,r,e){var i,n,o=Math.min(t.t,this.t);for(i=0;i<o;++i)e[i]=r(this[i],t[i]);if(t.t<this.t){for(n=t.s&this.DM,i=o;i<this.t;++i)e[i]=r(this[i],n);e.t=this.t}else{for(n=this.s&this.DM,i=o;i<t.t;++i)e[i]=r(n,t[i]);e.t=t.t}e.s=r(this.s,t.s),e.clamp()},r.prototype.changeBit=function(t,e){var i=r.ONE.shiftLeft(t);return this.bitwiseTo(i,e,i),i},r.prototype.addTo=function(t,r){for(var e=0,i=0,n=Math.min(t.t,this.t);e<n;)i+=this[e]+t[e],r[e++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i+=t.s;e<this.t;)i+=this[e],r[e++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;e<t.t;)i+=t[e],r[e++]=i&this.DM,i>>=this.DB;i+=t.s}r.s=i<0?-1:0,i>0?r[e++]=i:i<-1&&(r[e++]=this.DV+i),r.t=e,r.clamp()},r.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(t,r){if(0!=t){for(;this.t<=r;)this[this.t++]=0;for(this[r]+=t;this[r]>=this.DV;)this[r]-=this.DV,++r>=this.t&&(this[this.t++]=0),++this[r]}},r.prototype.multiplyLowerTo=function(t,r,e){var i,n=Math.min(this.t+t.t,r);for(e.s=0,e.t=n;n>0;)e[--n]=0;for(i=e.t-this.t;n<i;++n)e[n+this.t]=this.am(0,t[n],e,n,0,this.t);for(i=Math.min(t.t,r);n<i;++n)this.am(0,t[n],e,n,0,r-n);e.clamp()},r.prototype.multiplyUpperTo=function(t,r,e){--r;var i=e.t=this.t+t.t-r;for(e.s=0;--i>=0;)e[i]=0;for(i=Math.max(r-this.t,0);i<t.t;++i)e[this.t+i-r]=this.am(r-i,t[i],e,0,0,this.t+i-r);e.clamp(),e.drShiftTo(1,e)},r.prototype.modInt=function(t){if(t<=0)return 0;var r=this.DV%t,e=this.s<0?t-1:0;if(this.t>0)if(0==r)e=this[0]%t;else for(var i=this.t-1;i>=0;--i)e=(r*e+this[i])%t;return e},r.prototype.millerRabin=function(t){var i=this.subtract(r.ONE),n=i.getLowestSetBit();if(n<=0)return!1;var o=i.shiftRight(n);(t=t+1>>1)>S.length&&(t=S.length);for(var s=e(),h=0;h<t;++h){s.fromInt(S[Math.floor(Math.random()*S.length)]);var u=s.modPow(o,this);if(0!=u.compareTo(r.ONE)&&0!=u.compareTo(i)){for(var a=1;a++<n&&0!=u.compareTo(i);)if(0==(u=u.modPowInt(2,this)).compareTo(r.ONE))return!1;if(0!=u.compareTo(i))return!1}}return!0},r.prototype.clone=function(){var t=e();return this.copyTo(t),t},r.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},r.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},r.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},r.prototype.toByteArray=function(){var t=this.t,r=new Array;r[0]=this.s;var e,i=this.DB-t*this.DB%8,n=0;if(t-- >0)for(i<this.DB&&(e=this[t]>>i)!=(this.s&this.DM)>>i&&(r[n++]=e|this.s<<this.DB-i);t>=0;)i<8?(e=(this[t]&(1<<i)-1)<<8-i,e|=this[--t]>>(i+=this.DB-8)):(e=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),128&e&&(e|=-256),0==n&&(128&this.s)!=(128&e)&&++n,(n>0||e!=this.s)&&(r[n++]=e);return r},r.prototype.equals=function(t){return 0==this.compareTo(t)},r.prototype.min=function(t){return this.compareTo(t)<0?this:t},r.prototype.max=function(t){return this.compareTo(t)>0?this:t},r.prototype.and=function(t){var r=e();return this.bitwiseTo(t,m,r),r},r.prototype.or=function(t){var r=e();return this.bitwiseTo(t,g,r),r},r.prototype.xor=function(t){var r=e();return this.bitwiseTo(t,d,r),r},r.prototype.andNot=function(t){var r=e();return this.bitwiseTo(t,v,r),r},r.prototype.not=function(){for(var t=e(),r=0;r<this.t;++r)t[r]=this.DM&~this[r];return t.t=this.t,t.s=~this.s,t},r.prototype.shiftLeft=function(t){var r=e();return t<0?this.rShiftTo(-t,r):this.lShiftTo(t,r),r},r.prototype.shiftRight=function(t){var r=e();return t<0?this.lShiftTo(-t,r):this.rShiftTo(t,r),r},r.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+w(this[t]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var t=0,r=this.s&this.DM,e=0;e<this.t;++e)t+=T(this[e]^r);return t},r.prototype.testBit=function(t){var r=Math.floor(t/this.DB);return r>=this.t?0!=this.s:!!(this[r]&1<<t%this.DB)},r.prototype.setBit=function(t){return this.changeBit(t,g)},r.prototype.clearBit=function(t){return this.changeBit(t,v)},r.prototype.flipBit=function(t){return this.changeBit(t,d)},r.prototype.add=function(t){var r=e();return this.addTo(t,r),r},r.prototype.subtract=function(t){var r=e();return this.subTo(t,r),r},r.prototype.multiply=function(t){var r=e();return this.multiplyTo(t,r),r},r.prototype.divide=function(t){var r=e();return this.divRemTo(t,r,null),r},r.prototype.remainder=function(t){var r=e();return this.divRemTo(t,null,r),r},r.prototype.divideAndRemainder=function(t){var r=e(),i=e();return this.divRemTo(t,r,i),new Array(r,i)},r.prototype.modPow=function(t,r){var i,n,o=t.bitLength(),s=c(1);if(o<=0)return s;i=o<18?1:o<48?3:o<144?4:o<768?5:6,n=o<8?new p(r):r.isEven()?new B(r):new y(r);var h=new Array,u=3,a=i-1,f=(1<<i)-1;if(h[1]=n.convert(this),i>1){var m=e();for(n.sqrTo(h[1],m);u<=f;)h[u]=e(),n.mulTo(m,h[u-2],h[u]),u+=2}var g,d,v=t.t-1,w=!0,T=e();for(o=l(t[v])-1;v>=0;){for(o>=a?g=t[v]>>o-a&f:(g=(t[v]&(1<<o+1)-1)<<a-o,v>0&&(g|=t[v-1]>>this.DB+o-a)),u=i;!(1&g);)g>>=1,--u;if((o-=u)<0&&(o+=this.DB,--v),w)h[g].copyTo(s),w=!1;else{for(;u>1;)n.sqrTo(s,T),n.sqrTo(T,s),u-=2;u>0?n.sqrTo(s,T):(d=s,s=T,T=d),n.mulTo(T,h[g],s)}for(;v>=0&&!(t[v]&1<<o);)n.sqrTo(s,T),d=s,s=T,T=d,--o<0&&(o=this.DB-1,--v)}return n.revert(s)},r.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return r.ZERO;for(var i=t.clone(),n=this.clone(),o=c(1),s=c(0),h=c(0),u=c(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),e?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(t,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?(h.isEven()&&u.isEven()||(h.addTo(this,h),u.subTo(t,u)),h.rShiftTo(1,h)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);i.compareTo(n)>=0?(i.subTo(n,i),e&&o.subTo(h,o),s.subTo(u,s)):(n.subTo(i,n),e&&h.subTo(o,h),u.subTo(s,u))}return 0!=n.compareTo(r.ONE)?r.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u},r.prototype.pow=function(t){return this.exp(t,new F)},r.prototype.gcd=function(t){var r=this.s<0?this.negate():this.clone(),e=t.s<0?t.negate():t.clone();if(r.compareTo(e)<0){var i=r;r=e,e=i}var n=r.getLowestSetBit(),o=e.getLowestSetBit();if(o<0)return r;for(n<o&&(o=n),o>0&&(r.rShiftTo(o,r),e.rShiftTo(o,e));r.signum()>0;)(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),r.compareTo(e)>=0?(r.subTo(e,r),r.rShiftTo(1,r)):(e.subTo(r,e),e.rShiftTo(1,e));return o>0&&e.lShiftTo(o,e),e},r.prototype.isProbablePrime=function(t){var r,e=this.abs();if(1==e.t&&e[0]<=S[S.length-1]){for(r=0;r<S.length;++r)if(e[0]==S[r])return!0;return!1}if(e.isEven())return!1;for(r=1;r<S.length;){for(var i=S[r],n=r+1;n<S.length&&i<D;)i*=S[n++];for(i=e.modInt(i);r<n;)if(i%S[r++]==0)return!1}return e.millerRabin(t)},r.prototype.square=function(){var t=e();return this.squareTo(t),t},r.prototype.Barrett=B,null==x){var A;if(x=new Array,E=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var R=new Uint8Array(32);for(window.crypto.getRandomValues(R),A=0;A<32;++A)x[E++]=R[A]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var P=window.crypto.random(32);for(A=0;A<P.length;++A)x[E++]=255&P.charCodeAt(A)}for(;E<H;)A=Math.floor(65536*Math.random()),x[E++]=A>>>8,x[E++]=255&A;E=0,I()}function O(){if(null==q){for(I(),(q=new C).init(x),E=0;E<x.length;++E)x[E]=0;E=0}return q.next()}function M(){}function C(){this.i=0,this.j=0,this.S=new Array}M.prototype.nextBytes=function(t){var r;for(r=0;r<t.length;++r)t[r]=O()},C.prototype.init=function(t){var r,e,i;for(r=0;r<256;++r)this.S[r]=r;for(e=0,r=0;r<256;++r)e=e+this.S[r]+t[r%t.length]&255,i=this.S[r],this.S[r]=this.S[e],this.S[e]=i;this.i=0,this.j=0},C.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var H=256;f.exports={default:r,BigInteger:r,SecureRandom:M}}.call(c);var p=l.exports;const{BigInteger:y}=p;class m{constructor(){this.tlv=null,this.t="00",this.l="00",this.v=""}getEncodedHex(){return this.tlv||(this.v=this.getValue(),this.l=this.getLength(),this.tlv=this.t+this.l+this.v),this.tlv}getLength(){const t=this.v.length/2;let r=t.toString(16);if(r.length%2==1&&(r="0"+r),t<128)return r;return(128+r.length/2).toString(16)+r}getValue(){return""}}class g extends m{constructor(t){super(),this.t="02",t&&(this.v=function(t){let r=t.toString(16);if("-"!==r[0])r.length%2==1?r="0"+r:r.match(/^[0-7]/)||(r="00"+r);else{r=r.substr(1);let e=r.length;e%2==1?e+=1:r.match(/^[0-7]/)||(e+=2);let i="";for(let t=0;t<e;t++)i+="f";i=new y(i,16),r=i.xor(t).add(y.ONE),r=r.toString(16).replace(/^-/,"")}return r}(t))}getValue(){return this.v}}class d extends m{constructor(t){super(),this.t="30",this.asn1Array=t}getValue(){return this.v=this.asn1Array.map((t=>t.getEncodedHex())).join(""),this.v}}function v(t,r){return+t[r+2]<8?1:128&+t.substr(r+2,2)}function w(t,r){const e=v(t,r),i=t.substr(r+2,2*e);if(!i)return-1;return(+i[0]<8?new y(i,16):new y(i.substr(2),16)).intValue()}function T(t,r){return r+2*(v(t,r)+1)}var F={encodeDer(t,r){const e=new g(t),i=new g(r);return new d([e,i]).getEncodedHex()},decodeDer(t){const r=T(t,0),e=T(t,r),i=w(t,r),n=t.substr(e,2*i),o=e+n.length,s=T(t,o),h=w(t,o),u=t.substr(s,2*h);return{r:new y(n,16),s:new y(u,16)}}};const{BigInteger:b}=p,B=new b("2"),q=new b("3");class x{constructor(t,r){this.x=r,this.q=t}equals(t){return t===this||this.q.equals(t.q)&&this.x.equals(t.x)}toBigInteger(){return this.x}negate(){return new x(this.q,this.x.negate().mod(this.q))}add(t){return new x(this.q,this.x.add(t.toBigInteger()).mod(this.q))}subtract(t){return new x(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))}multiply(t){return new x(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))}divide(t){return new x(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))}square(){return new x(this.q,this.x.square().mod(this.q))}}class E{constructor(t,r,e,i){this.curve=t,this.x=r,this.y=e,this.z=null==i?b.ONE:i,this.zinv=null}getX(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}getY(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}equals(t){if(t===this)return!0;if(this.isInfinity())return t.isInfinity();if(t.isInfinity())return this.isInfinity();if(!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(b.ZERO))return!1;return t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(b.ZERO)}isInfinity(){return null===this.x&&null===this.y||this.z.equals(b.ZERO)&&!this.y.toBigInteger().equals(b.ZERO)}negate(){return new E(this.curve,this.x,this.y.negate(),this.z)}add(t){if(this.isInfinity())return t;if(t.isInfinity())return this;const r=this.x.toBigInteger(),e=this.y.toBigInteger(),i=this.z,n=t.x.toBigInteger(),o=t.y.toBigInteger(),s=t.z,h=this.curve.q,u=r.multiply(s).mod(h),a=n.multiply(i).mod(h),f=u.subtract(a),c=e.multiply(s).mod(h),l=o.multiply(i).mod(h),p=c.subtract(l);if(b.ZERO.equals(f))return b.ZERO.equals(p)?this.twice():this.curve.infinity;const y=u.add(a),m=i.multiply(s).mod(h),g=f.square().mod(h),d=f.multiply(g).mod(h),v=m.multiply(p.square()).subtract(y.multiply(g)).mod(h),w=f.multiply(v).mod(h),T=p.multiply(g.multiply(u).subtract(v)).subtract(c.multiply(d)).mod(h),F=d.multiply(m).mod(h);return new E(this.curve,this.curve.fromBigInteger(w),this.curve.fromBigInteger(T),F)}twice(){if(this.isInfinity())return this;if(!this.y.toBigInteger().signum())return this.curve.infinity;const t=this.x.toBigInteger(),r=this.y.toBigInteger(),e=this.z,i=this.curve.q,n=this.curve.a.toBigInteger(),o=t.square().multiply(q).add(n.multiply(e.square())).mod(i),s=r.shiftLeft(1).multiply(e).mod(i),h=r.square().mod(i),u=h.multiply(t).multiply(e).mod(i),a=s.square().mod(i),f=o.square().subtract(u.shiftLeft(3)).mod(i),c=s.multiply(f).mod(i),l=o.multiply(u.shiftLeft(2).subtract(f)).subtract(a.shiftLeft(1).multiply(h)).mod(i),p=s.multiply(a).mod(i);return new E(this.curve,this.curve.fromBigInteger(c),this.curve.fromBigInteger(l),p)}multiply(t){if(this.isInfinity())return this;if(!t.signum())return this.curve.infinity;const r=t.multiply(q),e=this.negate();let i=this;for(let n=r.bitLength()-2;n>0;n--){i=i.twice();const o=r.testBit(n);o!==t.testBit(n)&&(i=i.add(o?this:e))}return i}}var S={ECPointFp:E,ECCurveFp:class{constructor(t,r,e){this.q=t,this.a=this.fromBigInteger(r),this.b=this.fromBigInteger(e),this.infinity=new E(this,null,null)}equals(t){return t===this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)}fromBigInteger(t){return new x(this.q,t)}decodePointHex(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:const r=this.fromBigInteger(new b(t.substr(2),16));let e=this.fromBigInteger(r.multiply(r.square()).add(r.multiply(this.a)).add(this.b).toBigInteger().modPow(this.q.divide(new b("4")).add(b.ONE),this.q));return e.toBigInteger().mod(B).equals(new b(t.substr(0,2),16).subtract(B))||(e=e.negate()),new E(this,r,e);case 4:case 6:case 7:const i=(t.length-2)/2,n=t.substr(2,i),o=t.substr(i+2,i);return new E(this,this.fromBigInteger(new b(n,16)),this.fromBigInteger(new b(o,16)));default:return null}}}};const{BigInteger:D,SecureRandom:I}=p,{ECCurveFp:A}=S,R=new I,{curve:P,G:O,n:M}=C();function C(){const t=new D("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF",16),r=new D("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC",16),e=new D("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93",16),i=new A(t,r,e),n=i.decodePointHex("0432C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0");return{curve:i,G:n,n:new D("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123",16)}}function H(t,r){return t.length>=r?t:new Array(r-t.length+1).join("0")+t}var K={getGlobalCurve:function(){return P},generateEcparam:C,generateKeyPairHex:function(t,r,e){const i=(t?new D(t,r,e):new D(M.bitLength(),R)).mod(M.subtract(D.ONE)).add(D.ONE),n=H(i.toString(16),64),o=O.multiply(i);return{privateKey:n,publicKey:"04"+H(o.getX().toBigInteger().toString(16),64)+H(o.getY().toBigInteger().toString(16),64)}},compressPublicKeyHex:function(t){if(130!==t.length)throw new Error("Invalid public key to compress");const r=(t.length-2)/2,e=t.substr(2,r);let i="03";return new D(t.substr(r+2,r),16).mod(new D("2")).equals(D.ZERO)&&(i="02"),i+e},utf8ToHex:function(t){const r=(t=unescape(encodeURIComponent(t))).length,e=[];for(let i=0;i<r;i++)e[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;const i=[];for(let t=0;t<r;t++){const r=e[t>>>2]>>>24-t%4*8&255;i.push((r>>>4).toString(16)),i.push((15&r).toString(16))}return i.join("")},leftPad:H,arrayToHex:function(t){return t.map((t=>1===(t=t.toString(16)).length?"0"+t:t)).join("")},arrayToUtf8:function(t){const r=[];let e=0;for(let i=0;i<2*t.length;i+=2)r[i>>>3]|=parseInt(t[e],10)<<24-i%8*4,e++;try{const e=[];for(let i=0;i<t.length;i++){const t=r[i>>>2]>>>24-i%4*8&255;e.push(String.fromCharCode(t))}return decodeURIComponent(escape(e.join("")))}catch(t){throw new Error("Malformed UTF-8 data")}},hexToArray:function(t){const r=[];let e=t.length;e%2!=0&&(t=H(t,e+1)),e=t.length;for(let i=0;i<e;i+=2)r.push(parseInt(t.substr(i,2),16));return r},verifyPublicKey:function(t){const r=P.decodePointHex(t);if(!r)return!1;const e=r.getX();return r.getY().square().equals(e.multiply(e.square()).add(e.multiply(P.a)).add(P.b))},comparePublicKeyHex:function(t,r){const e=P.decodePointHex(t);if(!e)return!1;const i=P.decodePointHex(r);return!!i&&e.equals(i)}};const N=new Uint32Array(68),V=new Uint32Array(64);function L(t,r){const e=31&r;return t<<e|t>>>32-e}function z(t,r){const e=[];for(let i=t.length-1;i>=0;i--)e[i]=255&(t[i]^r[i]);return e}function k(t){return t^L(t,9)^L(t,17)}function Z(t){let r=8*t.length,e=r%512;e=e>=448?512-e%448-1:448-e-1;const i=new Array((e-7)/8),n=new Array(8);for(let t=0,r=i.length;t<r;t++)i[t]=0;for(let t=0,r=n.length;t<r;t++)n[t]=0;r=r.toString(2);for(let t=7;t>=0;t--)if(r.length>8){const e=r.length-8;n[t]=parseInt(r.substr(e),2),r=r.substr(0,e)}else r.length>0&&(n[t]=parseInt(r,2),r="");const o=new Uint8Array([...t,128,...i,...n]),s=new DataView(o.buffer,0),h=o.length/64,u=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]);for(let t=0;t<h;t++){N.fill(0),V.fill(0);const r=16*t;for(let t=0;t<16;t++)N[t]=s.getUint32(4*(r+t),!1);for(let t=16;t<68;t++)N[t]=(a=N[t-16]^N[t-9]^L(N[t-3],15))^L(a,15)^L(a,23)^L(N[t-13],7)^N[t-6];for(let t=0;t<64;t++)V[t]=N[t]^N[t+4];const e=2043430169,i=2055708042;let n,o,h,f,c,l=u[0],p=u[1],y=u[2],m=u[3],g=u[4],d=u[5],v=u[6],w=u[7];for(let t=0;t<64;t++)c=t>=0&&t<=15?e:i,n=L(L(l,12)+g+L(c,t),7),o=n^L(l,12),h=(t>=0&&t<=15?l^p^y:l&p|l&y|p&y)+m+o+V[t],f=(t>=0&&t<=15?g^d^v:g&d|~g&v)+w+n+N[t],m=y,y=L(p,9),p=l,l=h,w=v,v=L(d,19),d=g,g=k(f);u[0]^=l,u[1]^=p,u[2]^=y,u[3]^=m,u[4]^=g,u[5]^=d,u[6]^=v,u[7]^=w}var a;const f=[];for(let t=0,r=u.length;t<r;t++){const r=u[t];f.push((4278190080&r)>>>24,(16711680&r)>>>16,(65280&r)>>>8,255&r)}return f}const j=new Uint8Array(64),U=new Uint8Array(64);for(let t=0;t<64;t++)j[t]=54,U[t]=92;var $={sm3:Z,hmac:function(t,r){for(r.length>64&&(r=Z(r));r.length<64;)r.push(0);const e=z(r,j),i=z(r,U),n=Z([...e,...t]);return Z([...i,...n])}};const{BigInteger:X}=p,{encodeDer:_,decodeDer:Y}=F,G=K,J=$.sm3,{G:W,curve:Q,n:tt}=G.generateEcparam();function rt(t,r,e="1234567812345678"){e=G.utf8ToHex(e);const i=G.leftPad(W.curve.a.toBigInteger().toRadix(16),64),n=G.leftPad(W.curve.b.toBigInteger().toRadix(16),64),o=G.leftPad(W.getX().toBigInteger().toRadix(16),64),s=G.leftPad(W.getY().toBigInteger().toRadix(16),64);let h,u;if(128===r.length)h=r.substr(0,64),u=r.substr(64,64);else{const t=W.curve.decodePointHex(r);h=G.leftPad(t.getX().toBigInteger().toRadix(16),64),u=G.leftPad(t.getY().toBigInteger().toRadix(16),64)}const a=G.hexToArray(e+i+n+o+s+h+u),f=4*e.length;a.unshift(255&f),a.unshift(f>>8&255);const c=J(a);return G.arrayToHex(J(c.concat(G.hexToArray(t))))}function et(t){const r=W.multiply(new X(t,16));return"04"+G.leftPad(r.getX().toBigInteger().toString(16),64)+G.leftPad(r.getY().toBigInteger().toString(16),64)}function it(){const t=G.generateKeyPairHex(),r=Q.decodePointHex(t.publicKey);return t.k=new X(t.privateKey,16),t.x1=r.getX().toBigInteger(),t}var nt={generateKeyPairHex:G.generateKeyPairHex,compressPublicKeyHex:G.compressPublicKeyHex,comparePublicKeyHex:G.comparePublicKeyHex,doEncrypt:function(t,r,e=1){t="string"==typeof t?G.hexToArray(G.utf8ToHex(t)):Array.prototype.slice.call(t),r=G.getGlobalCurve().decodePointHex(r);const i=G.generateKeyPairHex(),n=new X(i.privateKey,16);let o=i.publicKey;o.length>128&&(o=o.substr(o.length-128));const s=r.multiply(n),h=G.hexToArray(G.leftPad(s.getX().toBigInteger().toRadix(16),64)),u=G.hexToArray(G.leftPad(s.getY().toBigInteger().toRadix(16),64)),a=G.arrayToHex(J([].concat(h,t,u)));let f=1,c=0,l=[];const p=[].concat(h,u),y=()=>{l=J([...p,f>>24&255,f>>16&255,f>>8&255,255&f]),f++,c=0};y();for(let r=0,e=t.length;r<e;r++)c===l.length&&y(),t[r]^=255&l[c++];const m=G.arrayToHex(t);return 0===e?o+m+a:o+a+m},doDecrypt:function(t,r,e=1,{output:i="string"}={}){r=new X(r,16);let n=t.substr(128,64),o=t.substr(192);0===e&&(n=t.substr(t.length-64),o=t.substr(128,t.length-128-64));const s=G.hexToArray(o),h=G.getGlobalCurve().decodePointHex("04"+t.substr(0,128)).multiply(r),u=G.hexToArray(G.leftPad(h.getX().toBigInteger().toRadix(16),64)),a=G.hexToArray(G.leftPad(h.getY().toBigInteger().toRadix(16),64));let f=1,c=0,l=[];const p=[].concat(u,a),y=()=>{l=J([...p,f>>24&255,f>>16&255,f>>8&255,255&f]),f++,c=0};y();for(let t=0,r=s.length;t<r;t++)c===l.length&&y(),s[t]^=255&l[c++];return G.arrayToHex(J([].concat(u,s,a)))===n.toLowerCase()?"array"===i?s:G.arrayToUtf8(s):"array"===i?[]:""},doSignature:function(t,r,{pointPool:e,der:i,hash:n,publicKey:o,userId:s}={}){let h="string"==typeof t?G.utf8ToHex(t):G.arrayToHex(t);n&&(h=rt(h,o=o||et(r),s));const u=new X(r,16),a=new X(h,16);let f=null,c=null,l=null;do{do{let t;t=e&&e.length?e.pop():it(),f=t.k,c=a.add(t.x1).mod(tt)}while(c.equals(X.ZERO)||c.add(f).equals(tt));l=u.add(X.ONE).modInverse(tt).multiply(f.subtract(c.multiply(u))).mod(tt)}while(l.equals(X.ZERO));return i?_(c,l):G.leftPad(c.toString(16),64)+G.leftPad(l.toString(16),64)},doVerifySignature:function(t,r,e,{der:i,hash:n,userId:o}={}){let s,h,u="string"==typeof t?G.utf8ToHex(t):G.arrayToHex(t);if(n&&(u=rt(u,e,o)),i){const t=Y(r);s=t.r,h=t.s}else s=new X(r.substring(0,64),16),h=new X(r.substring(64),16);const a=Q.decodePointHex(e),f=new X(u,16),c=s.add(h).mod(tt);if(c.equals(X.ZERO))return!1;const l=W.multiply(h).add(a.multiply(c)),p=f.add(l.getX().toBigInteger()).mod(tt);return s.equals(p)},getPublicKeyFromPrivateKey:et,getPoint:it,verifyPublicKey:G.verifyPublicKey};const{sm3:ot,hmac:st}=$;function ht(t){return t.map((t=>1===(t=t.toString(16)).length?"0"+t:t)).join("")}function ut(t){const r=[];let e=t.length;var i,n;e%2!=0&&(n=e+1,t=(i=t).length>=n?i:new Array(n-i.length+1).join("0")+i),e=t.length;for(let i=0;i<e;i+=2)r.push(parseInt(t.substr(i,2),16));return r}const at=0,ft=16,ct=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],lt=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function pt(t){const r=[];for(let e=0,i=t.length;e<i;e+=2)r.push(parseInt(t.substr(e,2),16));return r}function yt(t,r){const e=31&r;return t<<e|t>>>32-e}function mt(t){return(255&ct[t>>>24&255])<<24|(255&ct[t>>>16&255])<<16|(255&ct[t>>>8&255])<<8|255&ct[255&t]}function gt(t){return t^yt(t,2)^yt(t,10)^yt(t,18)^yt(t,24)}function dt(t){return t^yt(t,13)^yt(t,23)}function vt(t,r,e){const i=new Array(4),n=new Array(4);for(let r=0;r<4;r++)n[0]=255&t[4*r],n[1]=255&t[4*r+1],n[2]=255&t[4*r+2],n[3]=255&t[4*r+3],i[r]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(let t,r=0;r<32;r+=4)t=i[1]^i[2]^i[3]^e[r+0],i[0]^=gt(mt(t)),t=i[2]^i[3]^i[0]^e[r+1],i[1]^=gt(mt(t)),t=i[3]^i[0]^i[1]^e[r+2],i[2]^=gt(mt(t)),t=i[0]^i[1]^i[2]^e[r+3],i[3]^=gt(mt(t));for(let t=0;t<16;t+=4)r[t]=i[3-t/4]>>>24&255,r[t+1]=i[3-t/4]>>>16&255,r[t+2]=i[3-t/4]>>>8&255,r[t+3]=255&i[3-t/4]}function wt(t,r,e,{padding:i="pkcs#7",mode:n,iv:o=[],output:s="string"}={}){if("cbc"===n&&("string"==typeof o&&(o=pt(o)),16!==o.length))throw new Error("iv is invalid");if("string"==typeof r&&(r=pt(r)),16!==r.length)throw new Error("key is invalid");if(t="string"==typeof t?e!==at?function(t){const r=[];for(let e=0,i=t.length;e<i;e++){const i=t.codePointAt(e);if(i<=127)r.push(i);else if(i<=2047)r.push(192|i>>>6),r.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)r.push(224|i>>>12),r.push(128|i>>>6&63),r.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw r.push(i),new Error("input is not supported");e++,r.push(240|i>>>18&28),r.push(128|i>>>12&63),r.push(128|i>>>6&63),r.push(128|63&i)}}return r}(t):pt(t):[...t],("pkcs#5"===i||"pkcs#7"===i)&&e!==at){const r=ft-t.length%ft;for(let e=0;e<r;e++)t.push(r)}const h=new Array(32);!function(t,r,e){const i=new Array(4),n=new Array(4);for(let r=0;r<4;r++)n[0]=255&t[0+4*r],n[1]=255&t[1+4*r],n[2]=255&t[2+4*r],n[3]=255&t[3+4*r],i[r]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let t,e=0;e<32;e+=4)t=i[1]^i[2]^i[3]^lt[e+0],r[e+0]=i[0]^=dt(mt(t)),t=i[2]^i[3]^i[0]^lt[e+1],r[e+1]=i[1]^=dt(mt(t)),t=i[3]^i[0]^i[1]^lt[e+2],r[e+2]=i[2]^=dt(mt(t)),t=i[0]^i[1]^i[2]^lt[e+3],r[e+3]=i[3]^=dt(mt(t));if(e===at)for(let t,e=0;e<16;e++)t=r[e],r[e]=r[31-e],r[31-e]=t}(r,h,e);const u=[];let a=o,f=t.length,c=0;for(;f>=ft;){const r=t.slice(c,c+16),i=new Array(16);if("cbc"===n)for(let t=0;t<ft;t++)e!==at&&(r[t]^=a[t]);vt(r,i,h);for(let t=0;t<ft;t++)"cbc"===n&&e===at&&(i[t]^=a[t]),u[c+t]=i[t];"cbc"===n&&(a=e!==at?i:r),f-=ft,c+=ft}if(("pkcs#5"===i||"pkcs#7"===i)&&e===at){const t=u.length,r=u[t-1];for(let e=1;e<=r;e++)if(u[t-e]!==r)throw new Error("padding is invalid");u.splice(t-r,r)}return"array"!==s?e!==at?u.map((t=>1===(t=t.toString(16)).length?"0"+t:t)).join(""):function(t){const r=[];for(let e=0,i=t.length;e<i;e++)t[e]>=240&&t[e]<=247?(r.push(String.fromCodePoint(((7&t[e])<<18)+((63&t[e+1])<<12)+((63&t[e+2])<<6)+(63&t[e+3]))),e+=3):t[e]>=224&&t[e]<=239?(r.push(String.fromCodePoint(((15&t[e])<<12)+((63&t[e+1])<<6)+(63&t[e+2]))),e+=2):t[e]>=192&&t[e]<=223?(r.push(String.fromCodePoint(((31&t[e])<<6)+(63&t[e+1]))),e++):r.push(String.fromCodePoint(t[e]));return r.join("")}(u):u}var Tt={sm2:nt,sm3:function(t,r){if(t="string"==typeof t?function(t){const r=[];for(let e=0,i=t.length;e<i;e++){const i=t.codePointAt(e);if(i<=127)r.push(i);else if(i<=2047)r.push(192|i>>>6),r.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)r.push(224|i>>>12),r.push(128|i>>>6&63),r.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw r.push(i),new Error("input is not supported");e++,r.push(240|i>>>18&28),r.push(128|i>>>12&63),r.push(128|i>>>6&63),r.push(128|63&i)}}return r}(t):Array.prototype.slice.call(t),r){if("hmac"!==(r.mode||"hmac"))throw new Error("invalid mode");let e=r.key;if(!e)throw new Error("invalid key");return e="string"==typeof e?ut(e):Array.prototype.slice.call(e),ht(st(t,e))}return ht(ot(t))},sm4:{encrypt:(t,r,e)=>wt(t,r,1,e),decrypt:(t,r,e)=>wt(t,r,0,e)}};const Ft={mode:"ecb",padding:"pkcs#5",output:"array"},bt=r.Buffer,Bt=function(t,r,e,i){return(n,o)=>{try{if(o.closeCrypto)return n;t.info=u(),t.publicKey=[...bt.from(t.info.key)];const s=Tt.sm2.doEncrypt(JSON.stringify(t.info),r,1);if(e.set(i,function(t){if("string"==typeof t)return String(t);return JSON.parse(JSON.stringify(t))}(s)),((t,r)=>{t.set("X-Encrypt-Key",r)})(o,s),n){"string"!=typeof n&&(n=JSON.stringify(n));const r=Tt.sm4.encrypt(n,t.publicKey,Ft);return n=bt.from(r)}return n}catch(t){console.error("encrypt error",t,n,o)}}};const qt=function(){const t=new Map;return{get:function(r){return t.get(r)},generateKey:function r(e){const n=`${i(8,"low")}-/${e}`;return t.has(n)?r(e):n},set:function(r,e){t.set(r,e)},clear:function(r){t.delete(r)},sm:function(){return Tt.sm2}}}();function xt(t,r){if(!r||"string"!=typeof r)throw new Error(`publicKey is required and must be a string ${r}`);t.interceptors.request.use((t=>{const e=t.transformRequest,i=t?.headers?.__requestKey,n={info:null,publicKey:[]};if(!e)throw new Error(`request ${t} has no transformRequest`);if(!Array.isArray(e))throw new Error(`transformRequest ${e} is not an array`);e.push(Bt(n,r,qt,i));const h=function(t){return(r,e)=>{try{if((t=>{const r=t.get("X-Encrypt-With");return r&&"string"==typeof r&&"sm4"===r.toLowerCase()})(e)){const e=bt.from(r);return s(Tt.sm4.decrypt(e,t.publicKey,{mode:"ecb",padding:"pkcs#7"}))}return o(r)}catch(t){console.error("decrypt error",t,r,e)}}}(n);if(!h)return t;const u=t.transformResponse;if(!u)throw new Error(`request ${t} has no transformResponse`);if("function"!=typeof h)throw new Error(`decryptFn ${h} is not a function`);if(!Array.isArray(u))throw new Error(`transformResponse ${u} is not an array`);return u.unshift(h),t})),t.interceptors.request.use((t=>{const r=t.url,e=t.headers;return r?(e.__requestKey=qt.generateKey(r),t):t})),t.interceptors.request.use((t=>(t.headers.closeCrypto||(t.responseType="arraybuffer"),t))),t.interceptors.request.use((t=>{const r=t.data,e=t.headers;return r?(r instanceof FormData&&(e.closeCrypto=!0),t):t})),t.interceptors.request.use((t=>{const r=t.url,e=t.headers;if(!r)throw new Error("url is required");if({}.hasOwnProperty.call(e,"closeCrypto"))return t;return h(r)||(e.closeCrypto=!0),t})),t.interceptors.response.use((t=>(t.data=o(t.data),t.data=s(t.data),t)),(t=>{const r=t.response;throw r?.data&&(r.data=function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){throw console.error("error",t),t}return t instanceof ArrayBuffer?n(t):t}(r.data)),t}))}window.__map_store__=qt;const Et=(r,e)=>{const i=t.create(r);return xt(i,e),i};export{Et as createCryptoAxiosInstance,e as createRequestInstance,u as getCryptoInfo,a as getSm4EncryptConfig,i as randomPassword,h as shouldEncrypt};
import t from"axios";import r from"buffer";const e=(r,e)=>{const i=t.create(r);return function(t,r){if(!r)return t;const{encryptFn:e,decryptFn:i}=r();e&&t.interceptors.request.use((t=>{const r=t.transformRequest;if(!r)throw new Error(`request ${t} has no transformRequest`);if(!Array.isArray(r))throw new Error(`transformRequest ${r} is not an array`);if(r.push(e),!i)return t;const n=t.transformResponse;if(!n)throw new Error(`request ${t} has no transformResponse`);if("function"!=typeof i)throw new Error(`decryptFn ${i} is not a function`);if(!Array.isArray(n))throw new Error(`transformResponse ${n} is not an array`);return n.unshift(i),t}))}(i,e),i};const i=(t=16,r="high")=>{const e=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],i=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],n=[0,1,2,3,4,5,6,7,8,9],o=["!","@","-","_","=","<",">","#","*","%","+","&","^","$"],s=[];let h="";const u=function(...t){let r="";return t.forEach((t=>{r+=t[Math.floor(Math.random()*t.length)]})),r};switch(r){case"high":h+=u(e,i,n,o),s.push(...e,...i,...n,...o);break;case"medium":h+=u(e,i,n),s.push(...e,...i,...n);break;default:h+=u(e,n),s.push(...e,...n)}const a=t-h.length;for(let t=0;t<a;t++)h+=u(s);return h};function n(t,r="utf-8"){return new TextDecoder(r).decode(t)}function o(t){try{return t instanceof ArrayBuffer?s(n(t)):t}catch(t){throw console.error("error",t),t}}function s(t){try{return"string"==typeof t?JSON.parse(t):t}catch(t){throw console.error("error",t),t}}const h=t=>{let r=!0;return!(t=>/^\/bi-api\/api/.test(t))(t)&&(t.startsWith("/api")&&(r=!1,(t=>/^\/(api\/logmanage|api\/data-source|api\/enterpriseadmin|api\/componentmanager|api\/spacemanager|api\/filemanager)/.test(t))(t)&&(r=!0)),r)},u=t=>({...{key:i(16,"high"),algorithm:t||"SM4"}}),a=()=>({mode:"ecb",padding:"pkcs#5",output:"array"});var f,c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},l={exports:{}};f=l,function(){var t;function r(t,r,e){null!=t&&("number"==typeof t?this.fromNumber(t,r,e):null==r&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,r))}function e(){return new r(null)}var i="undefined"!=typeof navigator;i&&"Microsoft Internet Explorer"==navigator.appName?(r.prototype.am=function(t,r,e,i,n,o){for(var s=32767&r,h=r>>15;--o>=0;){var u=32767&this[t],a=this[t++]>>15,f=h*u+a*s;n=((u=s*u+((32767&f)<<15)+e[i]+(1073741823&n))>>>30)+(f>>>15)+h*a+(n>>>30),e[i++]=1073741823&u}return n},t=30):i&&"Netscape"!=navigator.appName?(r.prototype.am=function(t,r,e,i,n,o){for(;--o>=0;){var s=r*this[t++]+e[i]+n;n=Math.floor(s/67108864),e[i++]=67108863&s}return n},t=26):(r.prototype.am=function(t,r,e,i,n,o){for(var s=16383&r,h=r>>14;--o>=0;){var u=16383&this[t],a=this[t++]>>14,f=h*u+a*s;n=((u=s*u+((16383&f)<<14)+e[i]+n)>>28)+(f>>14)+h*a,e[i++]=268435455&u}return n},t=28),r.prototype.DB=t,r.prototype.DM=(1<<t)-1,r.prototype.DV=1<<t,r.prototype.FV=Math.pow(2,52),r.prototype.F1=52-t,r.prototype.F2=2*t-52;var n,o,s="0123456789abcdefghijklmnopqrstuvwxyz",h=new Array;for(n="0".charCodeAt(0),o=0;o<=9;++o)h[n++]=o;for(n="a".charCodeAt(0),o=10;o<36;++o)h[n++]=o;for(n="A".charCodeAt(0),o=10;o<36;++o)h[n++]=o;function u(t){return s.charAt(t)}function a(t,r){var e=h[t.charCodeAt(r)];return null==e?-1:e}function c(t){var r=e();return r.fromInt(t),r}function l(t){var r,e=1;return 0!=(r=t>>>16)&&(t=r,e+=16),0!=(r=t>>8)&&(t=r,e+=8),0!=(r=t>>4)&&(t=r,e+=4),0!=(r=t>>2)&&(t=r,e+=2),0!=(r=t>>1)&&(t=r,e+=1),e}function p(t){this.m=t}function y(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function m(t,r){return t&r}function g(t,r){return t|r}function d(t,r){return t^r}function v(t,r){return t&~r}function w(t){if(0==t)return-1;var r=0;return 65535&t||(t>>=16,r+=16),255&t||(t>>=8,r+=8),15&t||(t>>=4,r+=4),3&t||(t>>=2,r+=2),1&t||++r,r}function T(t){for(var r=0;0!=t;)t&=t-1,++r;return r}function F(){}function b(t){return t}function B(t){this.r2=e(),this.q3=e(),r.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}p.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},p.prototype.revert=function(t){return t},p.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},p.prototype.mulTo=function(t,r,e){t.multiplyTo(r,e),this.reduce(e)},p.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)},y.prototype.convert=function(t){var i=e();return t.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),t.s<0&&i.compareTo(r.ZERO)>0&&this.m.subTo(i,i),i},y.prototype.revert=function(t){var r=e();return t.copyTo(r),this.reduce(r),r},y.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var r=0;r<this.m.t;++r){var e=32767&t[r],i=e*this.mpl+((e*this.mph+(t[r]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[e=r+this.m.t]+=this.m.am(0,i,t,r,0,this.m.t);t[e]>=t.DV;)t[e]-=t.DV,t[++e]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},y.prototype.mulTo=function(t,r,e){t.multiplyTo(r,e),this.reduce(e)},y.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)},r.prototype.copyTo=function(t){for(var r=this.t-1;r>=0;--r)t[r]=this[r];t.t=this.t,t.s=this.s},r.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},r.prototype.fromString=function(t,e){var i;if(16==e)i=4;else if(8==e)i=3;else if(256==e)i=8;else if(2==e)i=1;else if(32==e)i=5;else{if(4!=e)return void this.fromRadix(t,e);i=2}this.t=0,this.s=0;for(var n=t.length,o=!1,s=0;--n>=0;){var h=8==i?255&t[n]:a(t,n);h<0?"-"==t.charAt(n)&&(o=!0):(o=!1,0==s?this[this.t++]=h:s+i>this.DB?(this[this.t-1]|=(h&(1<<this.DB-s)-1)<<s,this[this.t++]=h>>this.DB-s):this[this.t-1]|=h<<s,(s+=i)>=this.DB&&(s-=this.DB))}8==i&&128&t[0]&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&r.ZERO.subTo(this,this)},r.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},r.prototype.dlShiftTo=function(t,r){var e;for(e=this.t-1;e>=0;--e)r[e+t]=this[e];for(e=t-1;e>=0;--e)r[e]=0;r.t=this.t+t,r.s=this.s},r.prototype.drShiftTo=function(t,r){for(var e=t;e<this.t;++e)r[e-t]=this[e];r.t=Math.max(this.t-t,0),r.s=this.s},r.prototype.lShiftTo=function(t,r){var e,i=t%this.DB,n=this.DB-i,o=(1<<n)-1,s=Math.floor(t/this.DB),h=this.s<<i&this.DM;for(e=this.t-1;e>=0;--e)r[e+s+1]=this[e]>>n|h,h=(this[e]&o)<<i;for(e=s-1;e>=0;--e)r[e]=0;r[s]=h,r.t=this.t+s+1,r.s=this.s,r.clamp()},r.prototype.rShiftTo=function(t,r){r.s=this.s;var e=Math.floor(t/this.DB);if(e>=this.t)r.t=0;else{var i=t%this.DB,n=this.DB-i,o=(1<<i)-1;r[0]=this[e]>>i;for(var s=e+1;s<this.t;++s)r[s-e-1]|=(this[s]&o)<<n,r[s-e]=this[s]>>i;i>0&&(r[this.t-e-1]|=(this.s&o)<<n),r.t=this.t-e,r.clamp()}},r.prototype.subTo=function(t,r){for(var e=0,i=0,n=Math.min(t.t,this.t);e<n;)i+=this[e]-t[e],r[e++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i-=t.s;e<this.t;)i+=this[e],r[e++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;e<t.t;)i-=t[e],r[e++]=i&this.DM,i>>=this.DB;i-=t.s}r.s=i<0?-1:0,i<-1?r[e++]=this.DV+i:i>0&&(r[e++]=i),r.t=e,r.clamp()},r.prototype.multiplyTo=function(t,e){var i=this.abs(),n=t.abs(),o=i.t;for(e.t=o+n.t;--o>=0;)e[o]=0;for(o=0;o<n.t;++o)e[o+i.t]=i.am(0,n[o],e,o,0,i.t);e.s=0,e.clamp(),this.s!=t.s&&r.ZERO.subTo(e,e)},r.prototype.squareTo=function(t){for(var r=this.abs(),e=t.t=2*r.t;--e>=0;)t[e]=0;for(e=0;e<r.t-1;++e){var i=r.am(e,r[e],t,2*e,0,1);(t[e+r.t]+=r.am(e+1,2*r[e],t,2*e+1,i,r.t-e-1))>=r.DV&&(t[e+r.t]-=r.DV,t[e+r.t+1]=1)}t.t>0&&(t[t.t-1]+=r.am(e,r[e],t,2*e,0,1)),t.s=0,t.clamp()},r.prototype.divRemTo=function(t,i,n){var o=t.abs();if(!(o.t<=0)){var s=this.abs();if(s.t<o.t)return null!=i&&i.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=e());var h=e(),u=this.s,a=t.s,f=this.DB-l(o[o.t-1]);f>0?(o.lShiftTo(f,h),s.lShiftTo(f,n)):(o.copyTo(h),s.copyTo(n));var c=h.t,p=h[c-1];if(0!=p){var y=p*(1<<this.F1)+(c>1?h[c-2]>>this.F2:0),m=this.FV/y,g=(1<<this.F1)/y,d=1<<this.F2,v=n.t,w=v-c,T=null==i?e():i;for(h.dlShiftTo(w,T),n.compareTo(T)>=0&&(n[n.t++]=1,n.subTo(T,n)),r.ONE.dlShiftTo(c,T),T.subTo(h,h);h.t<c;)h[h.t++]=0;for(;--w>=0;){var F=n[--v]==p?this.DM:Math.floor(n[v]*m+(n[v-1]+d)*g);if((n[v]+=h.am(0,F,n,w,0,c))<F)for(h.dlShiftTo(w,T),n.subTo(T,n);n[v]<--F;)n.subTo(T,n)}null!=i&&(n.drShiftTo(c,i),u!=a&&r.ZERO.subTo(i,i)),n.t=c,n.clamp(),f>0&&n.rShiftTo(f,n),u<0&&r.ZERO.subTo(n,n)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var r=3&t;return(r=(r=(r=(r=r*(2-(15&t)*r)&15)*(2-(255&t)*r)&255)*(2-((65535&t)*r&65535))&65535)*(2-t*r%this.DV)%this.DV)>0?this.DV-r:-r},r.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},r.prototype.exp=function(t,i){if(t>4294967295||t<1)return r.ONE;var n=e(),o=e(),s=i.convert(this),h=l(t)-1;for(s.copyTo(n);--h>=0;)if(i.sqrTo(n,o),(t&1<<h)>0)i.mulTo(o,s,n);else{var u=n;n=o,o=u}return i.revert(n)},r.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var r;if(16==t)r=4;else if(8==t)r=3;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return this.toRadix(t);r=2}var e,i=(1<<r)-1,n=!1,o="",s=this.t,h=this.DB-s*this.DB%r;if(s-- >0)for(h<this.DB&&(e=this[s]>>h)>0&&(n=!0,o=u(e));s>=0;)h<r?(e=(this[s]&(1<<h)-1)<<r-h,e|=this[--s]>>(h+=this.DB-r)):(e=this[s]>>(h-=r)&i,h<=0&&(h+=this.DB,--s)),e>0&&(n=!0),n&&(o+=u(e));return n?o:"0"},r.prototype.negate=function(){var t=e();return r.ZERO.subTo(this,t),t},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(t){var r=this.s-t.s;if(0!=r)return r;var e=this.t;if(0!=(r=e-t.t))return this.s<0?-r:r;for(;--e>=0;)if(0!=(r=this[e]-t[e]))return r;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+l(this[this.t-1]^this.s&this.DM)},r.prototype.mod=function(t){var i=e();return this.abs().divRemTo(t,null,i),this.s<0&&i.compareTo(r.ZERO)>0&&t.subTo(i,i),i},r.prototype.modPowInt=function(t,r){var e;return e=t<256||r.isEven()?new p(r):new y(r),this.exp(t,e)},r.ZERO=c(0),r.ONE=c(1),F.prototype.convert=b,F.prototype.revert=b,F.prototype.mulTo=function(t,r,e){t.multiplyTo(r,e)},F.prototype.sqrTo=function(t,r){t.squareTo(r)},B.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var r=e();return t.copyTo(r),this.reduce(r),r},B.prototype.revert=function(t){return t},B.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},B.prototype.mulTo=function(t,r,e){t.multiplyTo(r,e),this.reduce(e)},B.prototype.sqrTo=function(t,r){t.squareTo(r),this.reduce(r)};var q,x,E,D=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],S=(1<<26)/D[D.length-1];function I(){var t;t=(new Date).getTime(),x[E++]^=255&t,x[E++]^=t>>8&255,x[E++]^=t>>16&255,x[E++]^=t>>24&255,E>=H&&(E-=H)}if(r.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},r.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var r=this.chunkSize(t),i=Math.pow(t,r),n=c(i),o=e(),s=e(),h="";for(this.divRemTo(n,o,s);o.signum()>0;)h=(i+s.intValue()).toString(t).substr(1)+h,o.divRemTo(n,o,s);return s.intValue().toString(t)+h},r.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var i=this.chunkSize(e),n=Math.pow(e,i),o=!1,s=0,h=0,u=0;u<t.length;++u){var f=a(t,u);f<0?"-"==t.charAt(u)&&0==this.signum()&&(o=!0):(h=e*h+f,++s>=i&&(this.dMultiply(n),this.dAddOffset(h,0),s=0,h=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(h,0)),o&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(t,e,i){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(r.ONE.shiftLeft(t-1),g,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(r.ONE.shiftLeft(t-1),this);else{var n=new Array,o=7&t;n.length=1+(t>>3),e.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}},r.prototype.bitwiseTo=function(t,r,e){var i,n,o=Math.min(t.t,this.t);for(i=0;i<o;++i)e[i]=r(this[i],t[i]);if(t.t<this.t){for(n=t.s&this.DM,i=o;i<this.t;++i)e[i]=r(this[i],n);e.t=this.t}else{for(n=this.s&this.DM,i=o;i<t.t;++i)e[i]=r(n,t[i]);e.t=t.t}e.s=r(this.s,t.s),e.clamp()},r.prototype.changeBit=function(t,e){var i=r.ONE.shiftLeft(t);return this.bitwiseTo(i,e,i),i},r.prototype.addTo=function(t,r){for(var e=0,i=0,n=Math.min(t.t,this.t);e<n;)i+=this[e]+t[e],r[e++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i+=t.s;e<this.t;)i+=this[e],r[e++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;e<t.t;)i+=t[e],r[e++]=i&this.DM,i>>=this.DB;i+=t.s}r.s=i<0?-1:0,i>0?r[e++]=i:i<-1&&(r[e++]=this.DV+i),r.t=e,r.clamp()},r.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(t,r){if(0!=t){for(;this.t<=r;)this[this.t++]=0;for(this[r]+=t;this[r]>=this.DV;)this[r]-=this.DV,++r>=this.t&&(this[this.t++]=0),++this[r]}},r.prototype.multiplyLowerTo=function(t,r,e){var i,n=Math.min(this.t+t.t,r);for(e.s=0,e.t=n;n>0;)e[--n]=0;for(i=e.t-this.t;n<i;++n)e[n+this.t]=this.am(0,t[n],e,n,0,this.t);for(i=Math.min(t.t,r);n<i;++n)this.am(0,t[n],e,n,0,r-n);e.clamp()},r.prototype.multiplyUpperTo=function(t,r,e){--r;var i=e.t=this.t+t.t-r;for(e.s=0;--i>=0;)e[i]=0;for(i=Math.max(r-this.t,0);i<t.t;++i)e[this.t+i-r]=this.am(r-i,t[i],e,0,0,this.t+i-r);e.clamp(),e.drShiftTo(1,e)},r.prototype.modInt=function(t){if(t<=0)return 0;var r=this.DV%t,e=this.s<0?t-1:0;if(this.t>0)if(0==r)e=this[0]%t;else for(var i=this.t-1;i>=0;--i)e=(r*e+this[i])%t;return e},r.prototype.millerRabin=function(t){var i=this.subtract(r.ONE),n=i.getLowestSetBit();if(n<=0)return!1;var o=i.shiftRight(n);(t=t+1>>1)>D.length&&(t=D.length);for(var s=e(),h=0;h<t;++h){s.fromInt(D[Math.floor(Math.random()*D.length)]);var u=s.modPow(o,this);if(0!=u.compareTo(r.ONE)&&0!=u.compareTo(i)){for(var a=1;a++<n&&0!=u.compareTo(i);)if(0==(u=u.modPowInt(2,this)).compareTo(r.ONE))return!1;if(0!=u.compareTo(i))return!1}}return!0},r.prototype.clone=function(){var t=e();return this.copyTo(t),t},r.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},r.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},r.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},r.prototype.toByteArray=function(){var t=this.t,r=new Array;r[0]=this.s;var e,i=this.DB-t*this.DB%8,n=0;if(t-- >0)for(i<this.DB&&(e=this[t]>>i)!=(this.s&this.DM)>>i&&(r[n++]=e|this.s<<this.DB-i);t>=0;)i<8?(e=(this[t]&(1<<i)-1)<<8-i,e|=this[--t]>>(i+=this.DB-8)):(e=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),128&e&&(e|=-256),0==n&&(128&this.s)!=(128&e)&&++n,(n>0||e!=this.s)&&(r[n++]=e);return r},r.prototype.equals=function(t){return 0==this.compareTo(t)},r.prototype.min=function(t){return this.compareTo(t)<0?this:t},r.prototype.max=function(t){return this.compareTo(t)>0?this:t},r.prototype.and=function(t){var r=e();return this.bitwiseTo(t,m,r),r},r.prototype.or=function(t){var r=e();return this.bitwiseTo(t,g,r),r},r.prototype.xor=function(t){var r=e();return this.bitwiseTo(t,d,r),r},r.prototype.andNot=function(t){var r=e();return this.bitwiseTo(t,v,r),r},r.prototype.not=function(){for(var t=e(),r=0;r<this.t;++r)t[r]=this.DM&~this[r];return t.t=this.t,t.s=~this.s,t},r.prototype.shiftLeft=function(t){var r=e();return t<0?this.rShiftTo(-t,r):this.lShiftTo(t,r),r},r.prototype.shiftRight=function(t){var r=e();return t<0?this.lShiftTo(-t,r):this.rShiftTo(t,r),r},r.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+w(this[t]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var t=0,r=this.s&this.DM,e=0;e<this.t;++e)t+=T(this[e]^r);return t},r.prototype.testBit=function(t){var r=Math.floor(t/this.DB);return r>=this.t?0!=this.s:!!(this[r]&1<<t%this.DB)},r.prototype.setBit=function(t){return this.changeBit(t,g)},r.prototype.clearBit=function(t){return this.changeBit(t,v)},r.prototype.flipBit=function(t){return this.changeBit(t,d)},r.prototype.add=function(t){var r=e();return this.addTo(t,r),r},r.prototype.subtract=function(t){var r=e();return this.subTo(t,r),r},r.prototype.multiply=function(t){var r=e();return this.multiplyTo(t,r),r},r.prototype.divide=function(t){var r=e();return this.divRemTo(t,r,null),r},r.prototype.remainder=function(t){var r=e();return this.divRemTo(t,null,r),r},r.prototype.divideAndRemainder=function(t){var r=e(),i=e();return this.divRemTo(t,r,i),new Array(r,i)},r.prototype.modPow=function(t,r){var i,n,o=t.bitLength(),s=c(1);if(o<=0)return s;i=o<18?1:o<48?3:o<144?4:o<768?5:6,n=o<8?new p(r):r.isEven()?new B(r):new y(r);var h=new Array,u=3,a=i-1,f=(1<<i)-1;if(h[1]=n.convert(this),i>1){var m=e();for(n.sqrTo(h[1],m);u<=f;)h[u]=e(),n.mulTo(m,h[u-2],h[u]),u+=2}var g,d,v=t.t-1,w=!0,T=e();for(o=l(t[v])-1;v>=0;){for(o>=a?g=t[v]>>o-a&f:(g=(t[v]&(1<<o+1)-1)<<a-o,v>0&&(g|=t[v-1]>>this.DB+o-a)),u=i;!(1&g);)g>>=1,--u;if((o-=u)<0&&(o+=this.DB,--v),w)h[g].copyTo(s),w=!1;else{for(;u>1;)n.sqrTo(s,T),n.sqrTo(T,s),u-=2;u>0?n.sqrTo(s,T):(d=s,s=T,T=d),n.mulTo(T,h[g],s)}for(;v>=0&&!(t[v]&1<<o);)n.sqrTo(s,T),d=s,s=T,T=d,--o<0&&(o=this.DB-1,--v)}return n.revert(s)},r.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return r.ZERO;for(var i=t.clone(),n=this.clone(),o=c(1),s=c(0),h=c(0),u=c(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),e?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(t,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?(h.isEven()&&u.isEven()||(h.addTo(this,h),u.subTo(t,u)),h.rShiftTo(1,h)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);i.compareTo(n)>=0?(i.subTo(n,i),e&&o.subTo(h,o),s.subTo(u,s)):(n.subTo(i,n),e&&h.subTo(o,h),u.subTo(s,u))}return 0!=n.compareTo(r.ONE)?r.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u},r.prototype.pow=function(t){return this.exp(t,new F)},r.prototype.gcd=function(t){var r=this.s<0?this.negate():this.clone(),e=t.s<0?t.negate():t.clone();if(r.compareTo(e)<0){var i=r;r=e,e=i}var n=r.getLowestSetBit(),o=e.getLowestSetBit();if(o<0)return r;for(n<o&&(o=n),o>0&&(r.rShiftTo(o,r),e.rShiftTo(o,e));r.signum()>0;)(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),r.compareTo(e)>=0?(r.subTo(e,r),r.rShiftTo(1,r)):(e.subTo(r,e),e.rShiftTo(1,e));return o>0&&e.lShiftTo(o,e),e},r.prototype.isProbablePrime=function(t){var r,e=this.abs();if(1==e.t&&e[0]<=D[D.length-1]){for(r=0;r<D.length;++r)if(e[0]==D[r])return!0;return!1}if(e.isEven())return!1;for(r=1;r<D.length;){for(var i=D[r],n=r+1;n<D.length&&i<S;)i*=D[n++];for(i=e.modInt(i);r<n;)if(i%D[r++]==0)return!1}return e.millerRabin(t)},r.prototype.square=function(){var t=e();return this.squareTo(t),t},r.prototype.Barrett=B,null==x){var A;if(x=new Array,E=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var R=new Uint8Array(32);for(window.crypto.getRandomValues(R),A=0;A<32;++A)x[E++]=R[A]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var P=window.crypto.random(32);for(A=0;A<P.length;++A)x[E++]=255&P.charCodeAt(A)}for(;E<H;)A=Math.floor(65536*Math.random()),x[E++]=A>>>8,x[E++]=255&A;E=0,I()}function O(){if(null==q){for(I(),(q=new C).init(x),E=0;E<x.length;++E)x[E]=0;E=0}return q.next()}function M(){}function C(){this.i=0,this.j=0,this.S=new Array}M.prototype.nextBytes=function(t){var r;for(r=0;r<t.length;++r)t[r]=O()},C.prototype.init=function(t){var r,e,i;for(r=0;r<256;++r)this.S[r]=r;for(e=0,r=0;r<256;++r)e=e+this.S[r]+t[r%t.length]&255,i=this.S[r],this.S[r]=this.S[e],this.S[e]=i;this.i=0,this.j=0},C.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var H=256;f.exports={default:r,BigInteger:r,SecureRandom:M}}.call(c);var p=l.exports;const{BigInteger:y}=p;class m{constructor(){this.tlv=null,this.t="00",this.l="00",this.v=""}getEncodedHex(){return this.tlv||(this.v=this.getValue(),this.l=this.getLength(),this.tlv=this.t+this.l+this.v),this.tlv}getLength(){const t=this.v.length/2;let r=t.toString(16);if(r.length%2==1&&(r="0"+r),t<128)return r;return(128+r.length/2).toString(16)+r}getValue(){return""}}class g extends m{constructor(t){super(),this.t="02",t&&(this.v=function(t){let r=t.toString(16);if("-"!==r[0])r.length%2==1?r="0"+r:r.match(/^[0-7]/)||(r="00"+r);else{r=r.substr(1);let e=r.length;e%2==1?e+=1:r.match(/^[0-7]/)||(e+=2);let i="";for(let t=0;t<e;t++)i+="f";i=new y(i,16),r=i.xor(t).add(y.ONE),r=r.toString(16).replace(/^-/,"")}return r}(t))}getValue(){return this.v}}class d extends m{constructor(t){super(),this.t="30",this.asn1Array=t}getValue(){return this.v=this.asn1Array.map((t=>t.getEncodedHex())).join(""),this.v}}function v(t,r){return+t[r+2]<8?1:128&+t.substr(r+2,2)}function w(t,r){const e=v(t,r),i=t.substr(r+2,2*e);if(!i)return-1;return(+i[0]<8?new y(i,16):new y(i.substr(2),16)).intValue()}function T(t,r){return r+2*(v(t,r)+1)}var F={encodeDer(t,r){const e=new g(t),i=new g(r);return new d([e,i]).getEncodedHex()},decodeDer(t){const r=T(t,0),e=T(t,r),i=w(t,r),n=t.substr(e,2*i),o=e+n.length,s=T(t,o),h=w(t,o),u=t.substr(s,2*h);return{r:new y(n,16),s:new y(u,16)}}};const{BigInteger:b}=p,B=new b("2"),q=new b("3");class x{constructor(t,r){this.x=r,this.q=t}equals(t){return t===this||this.q.equals(t.q)&&this.x.equals(t.x)}toBigInteger(){return this.x}negate(){return new x(this.q,this.x.negate().mod(this.q))}add(t){return new x(this.q,this.x.add(t.toBigInteger()).mod(this.q))}subtract(t){return new x(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))}multiply(t){return new x(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))}divide(t){return new x(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))}square(){return new x(this.q,this.x.square().mod(this.q))}}class E{constructor(t,r,e,i){this.curve=t,this.x=r,this.y=e,this.z=null==i?b.ONE:i,this.zinv=null}getX(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}getY(){return null===this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}equals(t){if(t===this)return!0;if(this.isInfinity())return t.isInfinity();if(t.isInfinity())return this.isInfinity();if(!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(b.ZERO))return!1;return t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(b.ZERO)}isInfinity(){return null===this.x&&null===this.y||this.z.equals(b.ZERO)&&!this.y.toBigInteger().equals(b.ZERO)}negate(){return new E(this.curve,this.x,this.y.negate(),this.z)}add(t){if(this.isInfinity())return t;if(t.isInfinity())return this;const r=this.x.toBigInteger(),e=this.y.toBigInteger(),i=this.z,n=t.x.toBigInteger(),o=t.y.toBigInteger(),s=t.z,h=this.curve.q,u=r.multiply(s).mod(h),a=n.multiply(i).mod(h),f=u.subtract(a),c=e.multiply(s).mod(h),l=o.multiply(i).mod(h),p=c.subtract(l);if(b.ZERO.equals(f))return b.ZERO.equals(p)?this.twice():this.curve.infinity;const y=u.add(a),m=i.multiply(s).mod(h),g=f.square().mod(h),d=f.multiply(g).mod(h),v=m.multiply(p.square()).subtract(y.multiply(g)).mod(h),w=f.multiply(v).mod(h),T=p.multiply(g.multiply(u).subtract(v)).subtract(c.multiply(d)).mod(h),F=d.multiply(m).mod(h);return new E(this.curve,this.curve.fromBigInteger(w),this.curve.fromBigInteger(T),F)}twice(){if(this.isInfinity())return this;if(!this.y.toBigInteger().signum())return this.curve.infinity;const t=this.x.toBigInteger(),r=this.y.toBigInteger(),e=this.z,i=this.curve.q,n=this.curve.a.toBigInteger(),o=t.square().multiply(q).add(n.multiply(e.square())).mod(i),s=r.shiftLeft(1).multiply(e).mod(i),h=r.square().mod(i),u=h.multiply(t).multiply(e).mod(i),a=s.square().mod(i),f=o.square().subtract(u.shiftLeft(3)).mod(i),c=s.multiply(f).mod(i),l=o.multiply(u.shiftLeft(2).subtract(f)).subtract(a.shiftLeft(1).multiply(h)).mod(i),p=s.multiply(a).mod(i);return new E(this.curve,this.curve.fromBigInteger(c),this.curve.fromBigInteger(l),p)}multiply(t){if(this.isInfinity())return this;if(!t.signum())return this.curve.infinity;const r=t.multiply(q),e=this.negate();let i=this;for(let n=r.bitLength()-2;n>0;n--){i=i.twice();const o=r.testBit(n);o!==t.testBit(n)&&(i=i.add(o?this:e))}return i}}var D={ECPointFp:E,ECCurveFp:class{constructor(t,r,e){this.q=t,this.a=this.fromBigInteger(r),this.b=this.fromBigInteger(e),this.infinity=new E(this,null,null)}equals(t){return t===this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)}fromBigInteger(t){return new x(this.q,t)}decodePointHex(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:const r=this.fromBigInteger(new b(t.substr(2),16));let e=this.fromBigInteger(r.multiply(r.square()).add(r.multiply(this.a)).add(this.b).toBigInteger().modPow(this.q.divide(new b("4")).add(b.ONE),this.q));return e.toBigInteger().mod(B).equals(new b(t.substr(0,2),16).subtract(B))||(e=e.negate()),new E(this,r,e);case 4:case 6:case 7:const i=(t.length-2)/2,n=t.substr(2,i),o=t.substr(i+2,i);return new E(this,this.fromBigInteger(new b(n,16)),this.fromBigInteger(new b(o,16)));default:return null}}}};const{BigInteger:S,SecureRandom:I}=p,{ECCurveFp:A}=D,R=new I,{curve:P,G:O,n:M}=C();function C(){const t=new S("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF",16),r=new S("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC",16),e=new S("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93",16),i=new A(t,r,e),n=i.decodePointHex("0432C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0");return{curve:i,G:n,n:new S("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123",16)}}function H(t,r){return t.length>=r?t:new Array(r-t.length+1).join("0")+t}var K={getGlobalCurve:function(){return P},generateEcparam:C,generateKeyPairHex:function(t,r,e){const i=(t?new S(t,r,e):new S(M.bitLength(),R)).mod(M.subtract(S.ONE)).add(S.ONE),n=H(i.toString(16),64),o=O.multiply(i);return{privateKey:n,publicKey:"04"+H(o.getX().toBigInteger().toString(16),64)+H(o.getY().toBigInteger().toString(16),64)}},compressPublicKeyHex:function(t){if(130!==t.length)throw new Error("Invalid public key to compress");const r=(t.length-2)/2,e=t.substr(2,r);let i="03";return new S(t.substr(r+2,r),16).mod(new S("2")).equals(S.ZERO)&&(i="02"),i+e},utf8ToHex:function(t){const r=(t=unescape(encodeURIComponent(t))).length,e=[];for(let i=0;i<r;i++)e[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;const i=[];for(let t=0;t<r;t++){const r=e[t>>>2]>>>24-t%4*8&255;i.push((r>>>4).toString(16)),i.push((15&r).toString(16))}return i.join("")},leftPad:H,arrayToHex:function(t){return t.map((t=>1===(t=t.toString(16)).length?"0"+t:t)).join("")},arrayToUtf8:function(t){const r=[];let e=0;for(let i=0;i<2*t.length;i+=2)r[i>>>3]|=parseInt(t[e],10)<<24-i%8*4,e++;try{const e=[];for(let i=0;i<t.length;i++){const t=r[i>>>2]>>>24-i%4*8&255;e.push(String.fromCharCode(t))}return decodeURIComponent(escape(e.join("")))}catch(t){throw new Error("Malformed UTF-8 data")}},hexToArray:function(t){const r=[];let e=t.length;e%2!=0&&(t=H(t,e+1)),e=t.length;for(let i=0;i<e;i+=2)r.push(parseInt(t.substr(i,2),16));return r},verifyPublicKey:function(t){const r=P.decodePointHex(t);if(!r)return!1;const e=r.getX();return r.getY().square().equals(e.multiply(e.square()).add(e.multiply(P.a)).add(P.b))},comparePublicKeyHex:function(t,r){const e=P.decodePointHex(t);if(!e)return!1;const i=P.decodePointHex(r);return!!i&&e.equals(i)}};const N=new Uint32Array(68),V=new Uint32Array(64);function L(t,r){const e=31&r;return t<<e|t>>>32-e}function z(t,r){const e=[];for(let i=t.length-1;i>=0;i--)e[i]=255&(t[i]^r[i]);return e}function k(t){return t^L(t,9)^L(t,17)}function Z(t){let r=8*t.length,e=r%512;e=e>=448?512-e%448-1:448-e-1;const i=new Array((e-7)/8),n=new Array(8);for(let t=0,r=i.length;t<r;t++)i[t]=0;for(let t=0,r=n.length;t<r;t++)n[t]=0;r=r.toString(2);for(let t=7;t>=0;t--)if(r.length>8){const e=r.length-8;n[t]=parseInt(r.substr(e),2),r=r.substr(0,e)}else r.length>0&&(n[t]=parseInt(r,2),r="");const o=new Uint8Array([...t,128,...i,...n]),s=new DataView(o.buffer,0),h=o.length/64,u=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]);for(let t=0;t<h;t++){N.fill(0),V.fill(0);const r=16*t;for(let t=0;t<16;t++)N[t]=s.getUint32(4*(r+t),!1);for(let t=16;t<68;t++)N[t]=(a=N[t-16]^N[t-9]^L(N[t-3],15))^L(a,15)^L(a,23)^L(N[t-13],7)^N[t-6];for(let t=0;t<64;t++)V[t]=N[t]^N[t+4];const e=2043430169,i=2055708042;let n,o,h,f,c,l=u[0],p=u[1],y=u[2],m=u[3],g=u[4],d=u[5],v=u[6],w=u[7];for(let t=0;t<64;t++)c=t>=0&&t<=15?e:i,n=L(L(l,12)+g+L(c,t),7),o=n^L(l,12),h=(t>=0&&t<=15?l^p^y:l&p|l&y|p&y)+m+o+V[t],f=(t>=0&&t<=15?g^d^v:g&d|~g&v)+w+n+N[t],m=y,y=L(p,9),p=l,l=h,w=v,v=L(d,19),d=g,g=k(f);u[0]^=l,u[1]^=p,u[2]^=y,u[3]^=m,u[4]^=g,u[5]^=d,u[6]^=v,u[7]^=w}var a;const f=[];for(let t=0,r=u.length;t<r;t++){const r=u[t];f.push((4278190080&r)>>>24,(16711680&r)>>>16,(65280&r)>>>8,255&r)}return f}const j=new Uint8Array(64),U=new Uint8Array(64);for(let t=0;t<64;t++)j[t]=54,U[t]=92;var $={sm3:Z,hmac:function(t,r){for(r.length>64&&(r=Z(r));r.length<64;)r.push(0);const e=z(r,j),i=z(r,U),n=Z([...e,...t]);return Z([...i,...n])}};const{BigInteger:X}=p,{encodeDer:Y,decodeDer:G}=F,J=K,_=$.sm3,{G:W,curve:Q,n:tt}=J.generateEcparam();function rt(t,r,e="1234567812345678"){e=J.utf8ToHex(e);const i=J.leftPad(W.curve.a.toBigInteger().toRadix(16),64),n=J.leftPad(W.curve.b.toBigInteger().toRadix(16),64),o=J.leftPad(W.getX().toBigInteger().toRadix(16),64),s=J.leftPad(W.getY().toBigInteger().toRadix(16),64);let h,u;if(128===r.length)h=r.substr(0,64),u=r.substr(64,64);else{const t=W.curve.decodePointHex(r);h=J.leftPad(t.getX().toBigInteger().toRadix(16),64),u=J.leftPad(t.getY().toBigInteger().toRadix(16),64)}const a=J.hexToArray(e+i+n+o+s+h+u),f=4*e.length;a.unshift(255&f),a.unshift(f>>8&255);const c=_(a);return J.arrayToHex(_(c.concat(J.hexToArray(t))))}function et(t){const r=W.multiply(new X(t,16));return"04"+J.leftPad(r.getX().toBigInteger().toString(16),64)+J.leftPad(r.getY().toBigInteger().toString(16),64)}function it(){const t=J.generateKeyPairHex(),r=Q.decodePointHex(t.publicKey);return t.k=new X(t.privateKey,16),t.x1=r.getX().toBigInteger(),t}var nt={generateKeyPairHex:J.generateKeyPairHex,compressPublicKeyHex:J.compressPublicKeyHex,comparePublicKeyHex:J.comparePublicKeyHex,doEncrypt:function(t,r,e=1){t="string"==typeof t?J.hexToArray(J.utf8ToHex(t)):Array.prototype.slice.call(t),r=J.getGlobalCurve().decodePointHex(r);const i=J.generateKeyPairHex(),n=new X(i.privateKey,16);let o=i.publicKey;o.length>128&&(o=o.substr(o.length-128));const s=r.multiply(n),h=J.hexToArray(J.leftPad(s.getX().toBigInteger().toRadix(16),64)),u=J.hexToArray(J.leftPad(s.getY().toBigInteger().toRadix(16),64)),a=J.arrayToHex(_([].concat(h,t,u)));let f=1,c=0,l=[];const p=[].concat(h,u),y=()=>{l=_([...p,f>>24&255,f>>16&255,f>>8&255,255&f]),f++,c=0};y();for(let r=0,e=t.length;r<e;r++)c===l.length&&y(),t[r]^=255&l[c++];const m=J.arrayToHex(t);return 0===e?o+m+a:o+a+m},doDecrypt:function(t,r,e=1,{output:i="string"}={}){r=new X(r,16);let n=t.substr(128,64),o=t.substr(192);0===e&&(n=t.substr(t.length-64),o=t.substr(128,t.length-128-64));const s=J.hexToArray(o),h=J.getGlobalCurve().decodePointHex("04"+t.substr(0,128)).multiply(r),u=J.hexToArray(J.leftPad(h.getX().toBigInteger().toRadix(16),64)),a=J.hexToArray(J.leftPad(h.getY().toBigInteger().toRadix(16),64));let f=1,c=0,l=[];const p=[].concat(u,a),y=()=>{l=_([...p,f>>24&255,f>>16&255,f>>8&255,255&f]),f++,c=0};y();for(let t=0,r=s.length;t<r;t++)c===l.length&&y(),s[t]^=255&l[c++];return J.arrayToHex(_([].concat(u,s,a)))===n.toLowerCase()?"array"===i?s:J.arrayToUtf8(s):"array"===i?[]:""},doSignature:function(t,r,{pointPool:e,der:i,hash:n,publicKey:o,userId:s}={}){let h="string"==typeof t?J.utf8ToHex(t):J.arrayToHex(t);n&&(h=rt(h,o=o||et(r),s));const u=new X(r,16),a=new X(h,16);let f=null,c=null,l=null;do{do{let t;t=e&&e.length?e.pop():it(),f=t.k,c=a.add(t.x1).mod(tt)}while(c.equals(X.ZERO)||c.add(f).equals(tt));l=u.add(X.ONE).modInverse(tt).multiply(f.subtract(c.multiply(u))).mod(tt)}while(l.equals(X.ZERO));return i?Y(c,l):J.leftPad(c.toString(16),64)+J.leftPad(l.toString(16),64)},doVerifySignature:function(t,r,e,{der:i,hash:n,userId:o}={}){let s,h,u="string"==typeof t?J.utf8ToHex(t):J.arrayToHex(t);if(n&&(u=rt(u,e,o)),i){const t=G(r);s=t.r,h=t.s}else s=new X(r.substring(0,64),16),h=new X(r.substring(64),16);const a=Q.decodePointHex(e),f=new X(u,16),c=s.add(h).mod(tt);if(c.equals(X.ZERO))return!1;const l=W.multiply(h).add(a.multiply(c)),p=f.add(l.getX().toBigInteger()).mod(tt);return s.equals(p)},getPublicKeyFromPrivateKey:et,getPoint:it,verifyPublicKey:J.verifyPublicKey};const{sm3:ot,hmac:st}=$;function ht(t){return t.map((t=>1===(t=t.toString(16)).length?"0"+t:t)).join("")}function ut(t){const r=[];let e=t.length;var i,n;e%2!=0&&(n=e+1,t=(i=t).length>=n?i:new Array(n-i.length+1).join("0")+i),e=t.length;for(let i=0;i<e;i+=2)r.push(parseInt(t.substr(i,2),16));return r}const at=0,ft=16,ct=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],lt=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function pt(t){const r=[];for(let e=0,i=t.length;e<i;e+=2)r.push(parseInt(t.substr(e,2),16));return r}function yt(t,r){const e=31&r;return t<<e|t>>>32-e}function mt(t){return(255&ct[t>>>24&255])<<24|(255&ct[t>>>16&255])<<16|(255&ct[t>>>8&255])<<8|255&ct[255&t]}function gt(t){return t^yt(t,2)^yt(t,10)^yt(t,18)^yt(t,24)}function dt(t){return t^yt(t,13)^yt(t,23)}function vt(t,r,e){const i=new Array(4),n=new Array(4);for(let r=0;r<4;r++)n[0]=255&t[4*r],n[1]=255&t[4*r+1],n[2]=255&t[4*r+2],n[3]=255&t[4*r+3],i[r]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(let t,r=0;r<32;r+=4)t=i[1]^i[2]^i[3]^e[r+0],i[0]^=gt(mt(t)),t=i[2]^i[3]^i[0]^e[r+1],i[1]^=gt(mt(t)),t=i[3]^i[0]^i[1]^e[r+2],i[2]^=gt(mt(t)),t=i[0]^i[1]^i[2]^e[r+3],i[3]^=gt(mt(t));for(let t=0;t<16;t+=4)r[t]=i[3-t/4]>>>24&255,r[t+1]=i[3-t/4]>>>16&255,r[t+2]=i[3-t/4]>>>8&255,r[t+3]=255&i[3-t/4]}function wt(t,r,e,{padding:i="pkcs#7",mode:n,iv:o=[],output:s="string"}={}){if("cbc"===n&&("string"==typeof o&&(o=pt(o)),16!==o.length))throw new Error("iv is invalid");if("string"==typeof r&&(r=pt(r)),16!==r.length)throw new Error("key is invalid");if(t="string"==typeof t?e!==at?function(t){const r=[];for(let e=0,i=t.length;e<i;e++){const i=t.codePointAt(e);if(i<=127)r.push(i);else if(i<=2047)r.push(192|i>>>6),r.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)r.push(224|i>>>12),r.push(128|i>>>6&63),r.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw r.push(i),new Error("input is not supported");e++,r.push(240|i>>>18&28),r.push(128|i>>>12&63),r.push(128|i>>>6&63),r.push(128|63&i)}}return r}(t):pt(t):[...t],("pkcs#5"===i||"pkcs#7"===i)&&e!==at){const r=ft-t.length%ft;for(let e=0;e<r;e++)t.push(r)}const h=new Array(32);!function(t,r,e){const i=new Array(4),n=new Array(4);for(let r=0;r<4;r++)n[0]=255&t[0+4*r],n[1]=255&t[1+4*r],n[2]=255&t[2+4*r],n[3]=255&t[3+4*r],i[r]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let t,e=0;e<32;e+=4)t=i[1]^i[2]^i[3]^lt[e+0],r[e+0]=i[0]^=dt(mt(t)),t=i[2]^i[3]^i[0]^lt[e+1],r[e+1]=i[1]^=dt(mt(t)),t=i[3]^i[0]^i[1]^lt[e+2],r[e+2]=i[2]^=dt(mt(t)),t=i[0]^i[1]^i[2]^lt[e+3],r[e+3]=i[3]^=dt(mt(t));if(e===at)for(let t,e=0;e<16;e++)t=r[e],r[e]=r[31-e],r[31-e]=t}(r,h,e);const u=[];let a=o,f=t.length,c=0;for(;f>=ft;){const r=t.slice(c,c+16),i=new Array(16);if("cbc"===n)for(let t=0;t<ft;t++)e!==at&&(r[t]^=a[t]);vt(r,i,h);for(let t=0;t<ft;t++)"cbc"===n&&e===at&&(i[t]^=a[t]),u[c+t]=i[t];"cbc"===n&&(a=e!==at?i:r),f-=ft,c+=ft}if(("pkcs#5"===i||"pkcs#7"===i)&&e===at){const t=u.length,r=u[t-1];for(let e=1;e<=r;e++)if(u[t-e]!==r)throw new Error("padding is invalid");u.splice(t-r,r)}return"array"!==s?e!==at?u.map((t=>1===(t=t.toString(16)).length?"0"+t:t)).join(""):function(t){const r=[];for(let e=0,i=t.length;e<i;e++)t[e]>=240&&t[e]<=247?(r.push(String.fromCodePoint(((7&t[e])<<18)+((63&t[e+1])<<12)+((63&t[e+2])<<6)+(63&t[e+3]))),e+=3):t[e]>=224&&t[e]<=239?(r.push(String.fromCodePoint(((15&t[e])<<12)+((63&t[e+1])<<6)+(63&t[e+2]))),e+=2):t[e]>=192&&t[e]<=223?(r.push(String.fromCodePoint(((31&t[e])<<6)+(63&t[e+1]))),e++):r.push(String.fromCodePoint(t[e]));return r.join("")}(u):u}var Tt={sm2:nt,sm3:function(t,r){if(t="string"==typeof t?function(t){const r=[];for(let e=0,i=t.length;e<i;e++){const i=t.codePointAt(e);if(i<=127)r.push(i);else if(i<=2047)r.push(192|i>>>6),r.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)r.push(224|i>>>12),r.push(128|i>>>6&63),r.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw r.push(i),new Error("input is not supported");e++,r.push(240|i>>>18&28),r.push(128|i>>>12&63),r.push(128|i>>>6&63),r.push(128|63&i)}}return r}(t):Array.prototype.slice.call(t),r){if("hmac"!==(r.mode||"hmac"))throw new Error("invalid mode");let e=r.key;if(!e)throw new Error("invalid key");return e="string"==typeof e?ut(e):Array.prototype.slice.call(e),ht(st(t,e))}return ht(ot(t))},sm4:{encrypt:(t,r,e)=>wt(t,r,1,e),decrypt:(t,r,e)=>wt(t,r,0,e)}};const Ft={mode:"ecb",padding:"pkcs#5",output:"array"},bt=r.Buffer,Bt=function(t,r,e,i){return(n,o)=>{try{if(o.closeCrypto)return n;t.info=u(),t.publicKey=[...bt.from(t.info.key)];const s=Tt.sm2.doEncrypt(JSON.stringify(t.info),r,1);if(e.set(i,function(t){if("string"==typeof t)return String(t);return JSON.parse(JSON.stringify(t))}(s)),((t,r)=>{t.set("X-Encrypt-Key",r)})(o,s),n){"string"!=typeof n&&(n=JSON.stringify(n));const r=Tt.sm4.encrypt(n,t.publicKey,Ft);return n=bt.from(r)}return n}catch(t){console.error("encrypt error",t,n,o)}}};const qt=function(){const t=new Map;return{get:function(r){return t.get(r)},generateKey:function r(e){const n=`${i(8,"low")}-/${e}`;return t.has(n)?r(e):n},set:function(r,e){t.set(r,e)},clear:function(r){t.delete(r)}}}();function xt(t,r){if(!r||"string"!=typeof r)throw new Error(`publicKey is required and must be a string ${r}`);t.interceptors.request.use((t=>{const e=t.transformRequest,i=t?.headers?.__requestKey,n={info:null,publicKey:[]};if(!e)throw new Error(`request ${t} has no transformRequest`);if(!Array.isArray(e))throw new Error(`transformRequest ${e} is not an array`);e.push(Bt(n,r,qt,i));const h=function(t){return(r,e)=>{try{if((t=>{const r=t.get("X-Encrypt-With");return r&&"string"==typeof r&&"sm4"===r.toLowerCase()})(e)){const e=bt.from(r);return s(Tt.sm4.decrypt(e,t.publicKey,{mode:"ecb",padding:"pkcs#7"}))}return o(r)}catch(t){console.error("decrypt error",t,r,e)}}}(n);if(!h)return t;const u=t.transformResponse;if(!u)throw new Error(`request ${t} has no transformResponse`);if("function"!=typeof h)throw new Error(`decryptFn ${h} is not a function`);if(!Array.isArray(u))throw new Error(`transformResponse ${u} is not an array`);return u.unshift(h),t})),t.interceptors.request.use((t=>{const r=t.url,e=t.headers;return r?(e.__requestKey=qt.generateKey(r),t):t})),t.interceptors.request.use((t=>(t.headers.closeCrypto||(t.responseType="arraybuffer"),t))),t.interceptors.request.use((t=>{const r=t.data,e=t.headers;return r?(r instanceof FormData&&(e.closeCrypto=!0),t):t})),t.interceptors.request.use((t=>{const r=t.url,e=t.headers;if(!r)throw new Error("url is required");if({}.hasOwnProperty.call(e,"closeCrypto"))return t;return h(r)||(e.closeCrypto=!0),t})),t.interceptors.response.use((t=>(t.data=o(t.data),t.data=s(t.data),t)),(t=>{const r=t.response;throw r?.data&&(r.data=function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){throw console.error("error",t),t}return t instanceof ArrayBuffer?n(t):t}(r.data)),t}))}const Et=(r,e)=>{const i=t.create(r);return xt(i,e),i},Dt=Tt.sm2.doDecrypt;export{Et as createCryptoAxiosInstance,e as createRequestInstance,Dt as decryptHeadersInfo,u as getCryptoInfo,a as getSm4EncryptConfig,i as randomPassword,h as shouldEncrypt};
{
"name": "request-crypto",
"description": "axios with crypto callback",
"version": "1.4.10",
"version": "1.5.1",
"main": "index.cjs.js",

@@ -6,0 +6,0 @@ "module": "index.esm.js",

{
"name": "request-crypto",
"version": "1.5.0",
"version": "1.5.1",
"description": "axios with crypto callback",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc