gws-client 0.5.6 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.es.js +145 -139
- package/dist/index.umd.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -636,7 +636,10 @@ asymmetricDecryption
|
|
|
636
636
|
#### 函数签名
|
|
637
637
|
|
|
638
638
|
```ts
|
|
639
|
-
type AsymmetricDecryption = (
|
|
639
|
+
type AsymmetricDecryption = (
|
|
640
|
+
params: { Data: string },
|
|
641
|
+
curCert?: CertType
|
|
642
|
+
) => Promise<string>;
|
|
640
643
|
```
|
|
641
644
|
|
|
642
645
|
#### 参数说明
|
|
@@ -647,7 +650,7 @@ type AsymmetricDecryption = (params: { Data: string }) => Promise<string>;
|
|
|
647
650
|
|
|
648
651
|
### SM4对称加密
|
|
649
652
|
|
|
650
|
-
SM4
|
|
653
|
+
SM4对称加密,传入curCert时使用该证书,返回加密字符串,加密密钥
|
|
651
654
|
|
|
652
655
|
#### 接口名称
|
|
653
656
|
|
|
@@ -697,3 +700,19 @@ type Sm4Decryption = (params: {
|
|
|
697
700
|
| ------ | -------------------- | -------- | ------ |
|
|
698
701
|
| Data | 必填,待解密原文 | `String` | -- |
|
|
699
702
|
| KeyB64 | 必填,Base64对称密钥 | `String` | -- |
|
|
703
|
+
|
|
704
|
+
### 获取印章列表
|
|
705
|
+
|
|
706
|
+
获取印章列表,传入curCert时使用该证书,可获取印章SealId
|
|
707
|
+
|
|
708
|
+
#### 接口名称
|
|
709
|
+
|
|
710
|
+
getSealList
|
|
711
|
+
|
|
712
|
+
#### 函数签名
|
|
713
|
+
|
|
714
|
+
```ts
|
|
715
|
+
type getSealList = (
|
|
716
|
+
curCert?: CertType
|
|
717
|
+
) => Promise<{ cert: CertType; sealList: SealType[] }>;
|
|
718
|
+
```
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var De=Object.defineProperty,be=Object.defineProperties;var Be=Object.getOwnPropertyDescriptors;var ee=Object.getOwnPropertySymbols;var Se=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable;var J=(n,e,t)=>e in n?De(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,B=(n,e)=>{for(var t in e||(e={}))Se.call(e,t)&&J(n,t,e[t]);if(ee)for(var t of ee(e))xe.call(e,t)&&J(n,t,e[t]);return n},_=(n,e)=>be(n,Be(e));var i=(n,e,t)=>J(n,typeof e!="symbol"?e+"":e,t);var u=(n,e,t)=>new Promise((s,r)=>{var a=d=>{try{l(t.next(d))}catch(h){r(h)}},o=d=>{try{l(t.throw(d))}catch(h){r(h)}},l=d=>d.done?s(d.value):Promise.resolve(d.value).then(a,o);l((t=t.apply(n,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $e=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",Ie="1",Ae="2";var he=(n=>(n[n.MIN=0]="MIN",n[n.LOW=1]="LOW",n[n.MIDDLE=2]="MIDDLE",n[n.HIGH=3]="HIGH",n))(he||{});const Ee="00000001";function _e(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var F={},te;function Le(){if(te)return F;te=1,F.byteLength=l,F.toByteArray=h,F.fromByteArray=g;for(var n=[],e=[],t=typeof Uint8Array!="undefined"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,a=s.length;r<a;++r)n[r]=s[r],e[s.charCodeAt(r)]=r;e[45]=62,e[95]=63;function o(y){var c=y.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var m=y.indexOf("=");m===-1&&(m=c);var k=m===c?0:4-m%4;return[m,k]}function l(y){var c=o(y),m=c[0],k=c[1];return(m+k)*3/4-k}function d(y,c,m){return(c+m)*3/4-m}function h(y){var c,m=o(y),k=m[0],C=m[1],v=new t(d(y,k,C)),D=0,A=C>0?k-4:k,w;for(w=0;w<A;w+=4)c=e[y.charCodeAt(w)]<<18|e[y.charCodeAt(w+1)]<<12|e[y.charCodeAt(w+2)]<<6|e[y.charCodeAt(w+3)],v[D++]=c>>16&255,v[D++]=c>>8&255,v[D++]=c&255;return C===2&&(c=e[y.charCodeAt(w)]<<2|e[y.charCodeAt(w+1)]>>4,v[D++]=c&255),C===1&&(c=e[y.charCodeAt(w)]<<10|e[y.charCodeAt(w+1)]<<4|e[y.charCodeAt(w+2)]>>2,v[D++]=c>>8&255,v[D++]=c&255),v}function f(y){return n[y>>18&63]+n[y>>12&63]+n[y>>6&63]+n[y&63]}function p(y,c,m){for(var k,C=[],v=c;v<m;v+=3)k=(y[v]<<16&16711680)+(y[v+1]<<8&65280)+(y[v+2]&255),C.push(f(k));return C.join("")}function g(y){for(var c,m=y.length,k=m%3,C=[],v=16383,D=0,A=m-k;D<A;D+=v)C.push(p(y,D,D+v>A?A:D+v));return k===1?(c=y[m-1],C.push(n[c>>2]+n[c<<4&63]+"==")):k===2&&(c=(y[m-2]<<8)+y[m-1],C.push(n[c>>10]+n[c>>4&63]+n[c<<2&63]+"=")),C.join("")}return F}var Pe=Le();const ne=_e(Pe);class Me{constructor(){i(this,"deps",new Map)}on(e,t){this.deps.set(e,t)}emit(e,t){const s=this.deps.get(e);s&&s(t)}}(function(){try{var n=document.createElement("style");n.appendChild(document.createTextNode("button.svelte-oivou{background-color:transparent;border:none;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;outline:none}.modal-background.svelte-oivou{display:none;position:fixed;z-index:10000;left:0;top:0;width:100%;height:100%;background-color:#00000080;align-items:center;justify-content:center}.modal-content.svelte-oivou{background-color:#fff;padding:1.42857rem;border-radius:.35714rem;width:40%}.model-title.svelte-oivou{color:#303133;font-size:1.28571rem;margin-bottom:1.14286rem}.modal-visible.svelte-oivou{display:flex}.modal-footer.svelte-oivou{display:flex;align-items:center;justify-content:flex-end;margin-top:1.14286rem}.modal-btn.svelte-oivou{padding:.57143rem 1.07143rem;border-radius:.28571rem;font-size:1rem;border:.07143rem solid #dcdfe6}.success.svelte-oivou{margin-left:.85714rem;color:#fff}.slot.svelte-oivou{max-height:14.28571rem;overflow-y:scroll}.slot.svelte-oivou::-webkit-scrollbar{display:none}.cert-item.svelte-jtc2v4.svelte-jtc2v4{padding:1.14286rem;display:flex;align-items:center;cursor:pointer;border-bottom:.07143rem solid #ebeef5;font-size:1rem}.cert-item-selected.svelte-jtc2v4.svelte-jtc2v4{background-color:#f1f1f1}.cert-item-first.svelte-jtc2v4.svelte-jtc2v4{border-top:.07143rem solid #ebeef5}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4{display:inline-block;color:#606266}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4:first-child{width:30%}.seal-wrapper.svelte-1w19fs3.svelte-1w19fs3{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.seal-item.svelte-1w19fs3.svelte-1w19fs3{width:12.85714rem;height:12.85714rem;display:flex;flex-direction:column;align-items:center;justify-content:center;border:.07143rem solid #ccc;margin-top:.71429rem;margin-right:.71429rem;border-radius:.28571rem}.seal-item.svelte-1w19fs3 img.svelte-1w19fs3{width:7.14286rem;height:7.14286rem}.seal-item-selected.svelte-1w19fs3.svelte-1w19fs3{background-color:#f1f1f1}.seal-name.svelte-1w19fs3.svelte-1w19fs3{margin-top:.71429rem;color:#333}")),document.head.appendChild(n)}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var Te=Object.defineProperty,He=(n,e,t)=>e in n?Te(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,se=(n,e,t)=>He(n,typeof e!="symbol"?e+"":e,t);function q(){}function Ge(n,e){for(const t in e)n[t]=e[t];return n}function ye(n){return n()}function re(){return Object.create(null)}function V(n){n.forEach(ye)}function O(n){return typeof n=="function"}function fe(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function Fe(n){return Object.keys(n).length===0}function je(n,e,t,s){if(n){const r=ge(n,e,t,s);return n[0](r)}}function ge(n,e,t,s){return n[1]&&s?Ge(t.ctx.slice(),n[1](s(e))):t.ctx}function Oe(n,e,t,s){if(n[2]&&s){const r=n[2](s(t));if(e.dirty===void 0)return r;if(typeof r=="object"){const a=[],o=Math.max(e.dirty.length,r.length);for(let l=0;l<o;l+=1)a[l]=e.dirty[l]|r[l];return a}return e.dirty|r}return e.dirty}function Ne(n,e,t,s,r,a){if(r){const o=ge(e,t,s,a);n.p(o,r)}}function Ze(n){if(n.ctx.length>32){const e=[],t=n.ctx.length/32;for(let s=0;s<t;s++)e[s]=-1;return e}return-1}function ae(n){return n!=null?n:""}function b(n,e){n.appendChild(e)}function Q(n,e,t){n.insertBefore(e,t||null)}function U(n){n.parentNode&&n.parentNode.removeChild(n)}function Ve(n,e){for(let t=0;t<n.length;t+=1)n[t]&&n[t].d(e)}function $(n){return document.createElement(n)}function I(n){return document.createTextNode(n)}function N(){return I(" ")}function Re(){return I("")}function j(n,e,t,s){return n.addEventListener(e,t,s),()=>n.removeEventListener(e,t,s)}function S(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function Ue(n){return Array.from(n.childNodes)}function T(n,e){e=""+e,n.data!==e&&(n.data=e)}function oe(n,e,t,s){t==null?n.style.removeProperty(e):n.style.setProperty(e,t,"")}let X;function Z(n){X=n}const P=[],ie=[];let H=[];const ce=[],Je=Promise.resolve();let K=!1;function ze(){K||(K=!0,Je.then(pe))}function W(n){H.push(n)}const z=new Set;let L=0;function pe(){if(L!==0)return;const n=X;do{try{for(;L<P.length;){const e=P[L];L++,Z(e),qe(e.$$)}}catch(e){throw P.length=0,L=0,e}for(Z(null),P.length=0,L=0;ie.length;)ie.pop()();for(let e=0;e<H.length;e+=1){const t=H[e];z.has(t)||(z.add(t),t())}H.length=0}while(P.length);for(;ce.length;)ce.pop()();K=!1,z.clear(),Z(n)}function qe(n){if(n.fragment!==null){n.update(),V(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(W)}}function Ke(n){const e=[],t=[];H.forEach(s=>n.indexOf(s)===-1?e.push(s):t.push(s)),t.forEach(s=>s()),H=e}const R=new Set;let We;function Y(n,e){n&&n.i&&(R.delete(n),n.i(e))}function me(n,e,t,s){if(n&&n.o){if(R.has(n))return;R.add(n),We.c.push(()=>{R.delete(n)}),n.o(e)}}function le(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function Qe(n){n&&n.c()}function ve(n,e,t){const{fragment:s,after_update:r}=n.$$;s&&s.m(e,t),W(()=>{const a=n.$$.on_mount.map(ye).filter(O);n.$$.on_destroy?n.$$.on_destroy.push(...a):V(a),n.$$.on_mount=[]}),r.forEach(W)}function Ce(n,e){const t=n.$$;t.fragment!==null&&(Ke(t.after_update),V(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Xe(n,e){n.$$.dirty[0]===-1&&(P.push(n),ze(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function we(n,e,t,s,r,a,o=null,l=[-1]){const d=X;Z(n);const h=n.$$={fragment:null,ctx:[],props:a,update:q,not_equal:r,bound:re(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(d?d.$$.context:[])),callbacks:re(),dirty:l,skip_bound:!1,root:e.target||d.$$.root};o&&o(h.root);let f=!1;if(h.ctx=t?t(n,e.props||{},(p,g,...y)=>{const c=y.length?y[0]:g;return h.ctx&&r(h.ctx[p],h.ctx[p]=c)&&(!h.skip_bound&&h.bound[p]&&h.bound[p](c),f&&Xe(n,p)),g}):[],h.update(),f=!0,V(h.before_update),h.fragment=s?s(h.ctx):!1,e.target){if(e.hydrate){const p=Ue(e.target);h.fragment&&h.fragment.l(p),p.forEach(U)}else h.fragment&&h.fragment.c();e.intro&&Y(n.$$.fragment),ve(n,e.target,e.anchor),pe()}Z(d)}class ke{constructor(){se(this,"$$"),se(this,"$$set")}$destroy(){Ce(this,1),this.$destroy=q}$on(e,t){if(!O(t))return q;const s=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return s.push(t),()=>{const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}$set(e){this.$$set&&!Fe(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ye="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Ye);function et(n){let e,t,s,r=(n[1]||"标题")+"",a,o,l,d,h,f,p=(n[4]||"取消")+"",g,y,c,m=(n[5]||"确认")+"",k,C,v,D;const A=n[8].default,w=je(A,n,n[7],null);return{c(){e=$("div"),t=$("div"),s=$("div"),a=I(r),o=N(),l=$("div"),w&&w.c(),d=N(),h=$("div"),f=$("button"),g=I(p),y=N(),c=$("button"),k=I(m),S(s,"class","model-title svelte-oivou"),S(l,"class","slot svelte-oivou"),S(f,"class","modal-btn svelte-oivou"),S(c,"class","modal-btn success svelte-oivou"),oe(c,"background-color",n[6]),S(h,"class","modal-footer svelte-oivou"),S(t,"class","modal-content svelte-oivou"),S(e,"class","modal-background modal-visible svelte-oivou")},m(x,E){Q(x,e,E),b(e,t),b(t,s),b(s,a),b(t,o),b(t,l),w&&w.m(l,null),b(t,d),b(t,h),b(h,f),b(f,g),b(h,y),b(h,c),b(c,k),C=!0,v||(D=[j(f,"click",function(){O(n[0])&&n[0].apply(this,arguments)}),j(c,"click",function(){O(n[2])&&n[2].apply(this,arguments)}),j(t,"click",tt),j(e,"click",function(){O(n[3])&&n[3].apply(this,arguments)})],v=!0)},p(x,[E]){n=x,(!C||E&2)&&r!==(r=(n[1]||"标题")+"")&&T(a,r),w&&w.p&&(!C||E&128)&&Ne(w,A,n,n[7],C?Oe(A,n[7],E,null):Ze(n[7]),null),(!C||E&16)&&p!==(p=(n[4]||"取消")+"")&&T(g,p),(!C||E&32)&&m!==(m=(n[5]||"确认")+"")&&T(k,m),(!C||E&64)&&oe(c,"background-color",n[6])},i(x){C||(Y(w,x),C=!0)},o(x){me(w,x),C=!1},d(x){x&&U(e),w&&w.d(x),v=!1,V(D)}}}const tt=n=>n.stopPropagation();function nt(n,e,t){let{$$slots:s={},$$scope:r}=e,{onCancel:a}=e,{title:o}=e,{onOk:l}=e,{onClose:d}=e,{cancelText:h}=e,{okText:f}=e,{theme:p}=e;return n.$$set=g=>{"onCancel"in g&&t(0,a=g.onCancel),"title"in g&&t(1,o=g.title),"onOk"in g&&t(2,l=g.onOk),"onClose"in g&&t(3,d=g.onClose),"cancelText"in g&&t(4,h=g.cancelText),"okText"in g&&t(5,f=g.okText),"theme"in g&&t(6,p=g.theme),"$$scope"in g&&t(7,r=g.$$scope)},[a,o,l,d,h,f,p,r,s]}class st extends ke{constructor(e){super(),we(this,e,nt,et,fe,{onCancel:0,title:1,onOk:2,onClose:3,cancelText:4,okText:5,theme:6})}}function ue(n,e,t){const s=n.slice();return s[11]=e[t],s[13]=t,s}function de(n){let e,t,s=n[11].CN+"",r,a,o,l=n[11].DevClass+"",d,h,f=n[11].sn+"",p,g,y,c,m,k;function C(){return n[10](n[13])}return{c(){e=$("div"),t=$("span"),r=I(s),a=N(),o=$("span"),d=I(l),h=I("("),p=I(f),g=I(")"),y=N(),S(t,"class","svelte-jtc2v4"),S(o,"class","svelte-jtc2v4"),S(e,"class",c=ae(`cert-item ${n[13]===0?"cert-item-first":""} ${n[13]===n[5]?"cert-item-selected":""}`)+" svelte-jtc2v4")},m(v,D){Q(v,e,D),b(e,t),b(t,r),b(e,a),b(e,o),b(o,d),b(o,h),b(o,p),b(o,g),b(e,y),m||(k=j(e,"click",C),m=!0)},p(v,D){n=v,D&1&&s!==(s=n[11].CN+"")&&T(r,s),D&1&&l!==(l=n[11].DevClass+"")&&T(d,l),D&1&&f!==(f=n[11].sn+"")&&T(p,f),D&32&&c!==(c=ae(`cert-item ${n[13]===0?"cert-item-first":""} ${n[13]===n[5]?"cert-item-selected":""}`)+" svelte-jtc2v4")&&S(e,"class",c)},d(v){v&&U(e),m=!1,k()}}}function rt(n){let e,t=le(n[0]),s=[];for(let r=0;r<t.length;r+=1)s[r]=de(ue(n,t,r));return{c(){for(let r=0;r<s.length;r+=1)s[r].c();e=Re()},m(r,a){for(let o=0;o<s.length;o+=1)s[o]&&s[o].m(r,a);Q(r,e,a)},p(r,a){if(a&33){t=le(r[0]);let o;for(o=0;o<t.length;o+=1){const l=ue(r,t,o);s[o]?s[o].p(l,a):(s[o]=de(l),s[o].c(),s[o].m(e.parentNode,e))}for(;o<s.length;o+=1)s[o].d(1);s.length=t.length}},d(r){r&&U(e),Ve(s,r)}}}function at(n){let e,t;return e=new st({props:{onOk:n[7],onClose:n[1],onCancel:n[6],cancelText:n[2],okText:n[3],title:"选择证书",theme:n[4],$$slots:{default:[rt]},$$scope:{ctx:n}}}),{c(){Qe(e.$$.fragment)},m(s,r){ve(e,s,r),t=!0},p(s,[r]){const a={};r&2&&(a.onClose=s[1]),r&4&&(a.cancelText=s[2]),r&8&&(a.okText=s[3]),r&16&&(a.theme=s[4]),r&16417&&(a.$$scope={dirty:r,ctx:s}),e.$set(a)},i(s){t||(Y(e.$$.fragment,s),t=!0)},o(s){me(e.$$.fragment,s),t=!1},d(s){Ce(e,s)}}}function ot(n,e,t){let{certList:s=[]}=e,{onCancel:r}=e,{onOk:a}=e,{onClose:o}=e,{cancelText:l=""}=e,{okText:d=""}=e,{theme:h="#409eff"}=e,f=0;const p=()=>{r("未选择证书"),o==null||o()},g=()=>{a==null||a(s[f]),o==null||o()},y=c=>t(5,f=c);return n.$$set=c=>{"certList"in c&&t(0,s=c.certList),"onCancel"in c&&t(8,r=c.onCancel),"onOk"in c&&t(9,a=c.onOk),"onClose"in c&&t(1,o=c.onClose),"cancelText"in c&&t(2,l=c.cancelText),"okText"in c&&t(3,d=c.okText),"theme"in c&&t(4,h=c.theme)},[s,o,l,d,h,f,p,g,r,a,y]}class it extends ke{constructor(e){super(),we(this,e,ot,at,fe,{certList:0,onCancel:8,onOk:9,onClose:1,cancelText:2,okText:3,theme:4})}}class ct{constructor(){i(this,"modalInstance",{current:null});i(this,"open",e=>new Promise((t,s)=>{this.modalInstance.current=new it({target:document.body,props:_(B({},e),{onCancel:r=>{s({code:-1,msg:r})},onOk:r=>{t(r)},onClose:()=>{this.close()}})})}));i(this,"close",()=>{setTimeout(()=>{var e;(e=this.modalInstance.current)==null||e.$destroy()})})}}const lt=new ct;class ut{constructor(e){i(this,"socketInstance",null);i(this,"eventBus",new Me);i(this,"isRememberPin",!1);i(this,"socketEvent");i(this,"pinPolicy");i(this,"socketConfig",null);i(this,"getSocketReadyState",()=>{var e;return(e=this.socketInstance)==null?void 0:e.readyState});i(this,"destroy",()=>{var e;(e=this.socketInstance)==null||e.close()});i(this,"sendMessage",(e,t)=>new Promise((s,r)=>{var o,l;if(((o=this.socketInstance)==null?void 0:o.readyState)!==WebSocket.OPEN){console.log(e),r({errCode:-1,msg:"socket未连接"});return}const a={function:e,args:[t!=null?t:{}]};(l=this.socketInstance)==null||l.send(JSON.stringify(a)),this.eventBus.on(e,d=>{d.success?s(d.data):r(d)})}));i(this,"handleEventData",e=>u(this,null,function*(){var t,s,r,a,o,l;if(e.data instanceof Blob){const d=yield e.data.arrayBuffer(),f=new TextDecoder("gbk").decode(d),p=JSON.parse(f),g={data:p.data,success:(t=p.result)==null?void 0:t.success,msg:(s=p.result)==null?void 0:s.msg,errCode:(r=p.result)==null?void 0:r.errCode};this.eventBus.emit((a=p.result)==null?void 0:a.function,g),(l=(o=this.socketConfig)==null?void 0:o.onMessage)==null||l.call(o,g)}}));i(this,"base64Encode",e=>{const t=new TextEncoder().encode(e);return ne.fromByteArray(t)});i(this,"base64Decode",e=>{const t=ne.toByteArray(e);return new TextDecoder().decode(t)});i(this,"changeIsRememberPin",e=>u(this,null,function*(){this.isRememberPin=e}));i(this,"changePinPolicy",e=>u(this,null,function*(){this.pinPolicy=e}));i(this,"checkCertIsLogin",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_IsLogin",e)}));i(this,"addUkeyEvents",()=>u(this,null,function*(){this.sendMessage("GZCA_StartListen",{Type:Ee}).then(e=>{var t,s;(s=(t=this.socketConfig)==null?void 0:t.onUkeyEvent)==null||s.call(t,e)})}));i(this,"certLogin",e=>u(this,null,function*(){const t=yield this.checkCertIsLogin({ContainerName:e});t!=null&&t[0].isLogin||(yield this.sendMessage("GZCA_Login",{ContainerName:e,IsLogin:"N",UserPin:"123456",PinPolicy:this.pinPolicy}))}));i(this,"getCert",(e,t)=>u(this,null,function*(){const s=t!=null?t:yield this.chooseCert(e);return yield this.certLogin(s.ContainerName),s}));i(this,"getCertList",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_GetCertList",e)}));i(this,"chooseCert",e=>u(this,null,function*(){var r;const t=yield this.getCertList(e);return(t==null?void 0:t.length)===1?t[0]:yield lt.open({certList:t,theme:(r=this.socketConfig)==null?void 0:r.theme})}));i(this,"pkcs1Sign",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignData",B({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));i(this,"pkcs1Base64Sign",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",B({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));i(this,"pkcs1VerifySignature",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySign",e)}));i(this,"pkcs1Base64VerifySignature",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignEx",e)}));i(this,"getSealList",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_EnumSeals",B({IsLogin:this.getIsLogin()},e!=null?e:{}))}));i(this,"sm2SignPreprocess1",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep1",e)}));i(this,"sm2SignPreprocess2",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep2",e)}));i(this,"pkcs1HashSign",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataForHash",B({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));i(this,"pkcs1HashVerifySignature",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignForHash",e)}));i(this,"pkcs7Sign",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7SignData",B({IsLogin:this.getIsLogin(),IsAuthAttr:"Y",PinPolicy:this.pinPolicy},e!=null?e:{}))}));i(this,"pkcs7VerifySignature",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7VerifySign",e)}));i(this,"sm3Hash",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_HashData",e)}));i(this,"sm3HexHash",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_HashDataEx",e)}));i(this,"sm3FileHash",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_HashFile",e)}));i(this,"sm3HashEncryption",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_HMac",e)}));i(this,"pkcs7Encryption",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7EncryptData",e)}));i(this,"pkcs7Decryption",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7DecryptData",B({IsLogin:this.getIsLogin()},e!=null?e:{}))}));i(this,"asymmetricEncryption",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_AsymEncryptData",e)}));i(this,"asymmetricDecryption",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_AsymDecryptData",B({IsLogin:this.getIsLogin()},e!=null?e:{}))}));i(this,"sm4Encryption",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_EncryptDataEx",e)}));i(this,"sm4Decryption",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_DecryptDataEx",e)}));i(this,"getCertInfo",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfo",e)}));i(this,"getCertInfoByOid",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfoByOid",e)}));var t,s;this.socketConfig=e,this.socketInstance=this.createSocket(e),this.isRememberPin=(t=e.isRememberPin)!=null?t:!1,this.pinPolicy=(s=e.pinPolicy)!=null?s:he.MIN}createSocket(e){const t=new WebSocket(e.url);return t.onerror=s=>{var r;(r=e.onError)==null||r.call(e,s)},t.onopen=s=>{var r;(r=e.onOpen)==null||r.call(e,s),this.addUkeyEvents()},t.onmessage=s=>{this.handleEventData(s)},t.onclose=s=>{var r;(r=e.onClose)==null||r.call(e,s)},t}getIsLogin(){return this.isRememberPin?"Y":"N"}}const M=class M{constructor(e){i(this,"coreInstance",null);i(this,"gwsConfig",{});i(this,"createGwsCore",e=>{this.gwsConfig=e!=null?e:{},this.coreInstance=new ut(_(B({},e!=null?e:{}),{url:$e}))});i(this,"appendCertBase64",(e,t=!0)=>u(this,null,function*(){if(e.CertB64)return e;const s=t?yield this.getSignatureCert():yield this.getEncryptionCert();return _(B({},e!=null?e:{}),{CertB64:s==null?void 0:s.CertB64})}));i(this,"destroy",()=>{var e;(e=this.coreInstance)==null||e.destroy(),this.coreInstance=null});i(this,"restart",e=>{this.coreInstance&&this.destroy(),this.gwsConfig=e!=null?e:this.gwsConfig,this.createGwsCore(e)});i(this,"getSocketReadyState",()=>{var e;return(e=this.coreInstance)==null?void 0:e.getSocketReadyState()});i(this,"getSignatureCert",e=>u(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:Ie},e)}));i(this,"getEncryptionCert",e=>u(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:Ae},e)}));i(this,"base64Encode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Encode(e.Data)});i(this,"base64Decode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Decode(e.DataB64)});i(this,"changeIsRememberPin",e=>{var t;(t=this.coreInstance)==null||t.changeIsRememberPin(e)});i(this,"changePinPolicy",e=>{var t;(t=this.coreInstance)==null||t.changePinPolicy(e)});i(this,"pkcs1Sign",(e,t)=>u(this,null,function*(){var a,o,l;const s=yield this.getSignatureCert(t),r=yield(o=this.coreInstance)==null?void 0:o.pkcs1Sign(_(B({},e!=null?e:{}),{ContainerName:(a=s==null?void 0:s.ContainerName)!=null?a:""}));return(l=r==null?void 0:r[0])==null?void 0:l.SignData}));i(this,"pkcs1VerifySignature",e=>u(this,null,function*(){var r;const t=yield this.appendCertBase64(e),s=yield(r=this.coreInstance)==null?void 0:r.pkcs1VerifySignature(t);return Array.isArray(s)}));i(this,"pkcs1Base64Sign",(e,t)=>u(this,null,function*(){var o,l,d,h,f;const s=yield this.getSignatureCert(t),r=(l=e.DataB64)!=null?l:this.base64Encode({Data:(o=e.Data)!=null?o:""}),a=yield(h=this.coreInstance)==null?void 0:h.pkcs1Base64Sign({ContainerName:(d=s==null?void 0:s.ContainerName)!=null?d:"",DataB64:r});return(f=a==null?void 0:a[0])==null?void 0:f.SignData}));i(this,"pkcs1Base64VerifySignature",e=>u(this,null,function*(){var a,o,l;const t=(o=e.DataB64)!=null?o:this.base64Encode({Data:(a=e.Data)!=null?a:""}),s=yield this.appendCertBase64(e);return!!(yield(l=this.coreInstance)==null?void 0:l.pkcs1Base64VerifySignature({CertB64:s.CertB64,DataB64:t,SignData:s.SignData}))}));i(this,"getSealList",()=>u(this,null,function*(){var s,r;const e=yield this.getSignatureCert(),t=yield(r=this.coreInstance)==null?void 0:r.getSealList({ContainerName:(s=e==null?void 0:e.ContainerName)!=null?s:""});return{cert:e,sealList:t}}));i(this,"sm2SignPreprocess1",e=>u(this,null,function*(){var r,a;const t=yield this.appendCertBase64(e),s=yield(r=this.coreInstance)==null?void 0:r.sm2SignPreprocess1(t);return(a=s==null?void 0:s[0])==null?void 0:a.Z}));i(this,"sm2SignPreprocess2",e=>u(this,null,function*(){var a,o;const t=this.base64Encode({Data:(a=e.Data)!=null?a:""}),s=yield this.appendCertBase64(e),r=yield(o=this.coreInstance)==null?void 0:o.sm2SignPreprocess2({CertB64:s.CertB64,DataB64:t});return r==null?void 0:r[0].H}));i(this,"pkcs1HashSign",(e,t)=>u(this,null,function*(){var a,o,l,d;const s=yield this.getSignatureCert(t),r=yield(l=this.coreInstance)==null?void 0:l.pkcs1HashSign({ContainerName:(a=s==null?void 0:s.ContainerName)!=null?a:"",DataB64:e.DataB64,HashAlg:(o=e.HashAlg)!=null?o:"sm3"});return(d=r==null?void 0:r[0])==null?void 0:d.SignData}));i(this,"pkcs1HashVerifySignature",e=>u(this,null,function*(){var r,a;const t=yield this.appendCertBase64(e);return!!(yield(a=this.coreInstance)==null?void 0:a.pkcs1HashVerifySignature(_(B({},t),{HashAlg:(r=t.HashAlg)!=null?r:"sm3"})))}));i(this,"pkcs7Sign",(e,t)=>u(this,null,function*(){var o,l,d,h,f;const s=(l=e.DataB64)!=null?l:this.base64Encode({Data:(o=e.Data)!=null?o:""}),r=yield this.getSignatureCert(t),a=yield(h=this.coreInstance)==null?void 0:h.pkcs7Sign({IsDetached:e.IsDetached,ContainerName:(d=r==null?void 0:r.ContainerName)!=null?d:"",DataB64:s});return(f=a==null?void 0:a[0])==null?void 0:f.SignData}));i(this,"pkcs7VerifySignature",e=>u(this,null,function*(){var r,a,o;const t=(a=e.DataB64)!=null?a:this.base64Encode({Data:(r=e.Data)!=null?r:""});return!!(yield(o=this.coreInstance)==null?void 0:o.pkcs7VerifySignature({DataB64:t,SignData:e.SignData}))}));i(this,"sm3Hash",e=>u(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.sm3Hash(e);return(r=t==null?void 0:t[0])==null?void 0:r.HashB64}));i(this,"sm3HexHash",e=>u(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.sm3HexHash(e);return(r=t==null?void 0:t[0])==null?void 0:r.HashB64}));i(this,"sm3FileHash",e=>u(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.sm3FileHash(e);return(r=t==null?void 0:t[0])==null?void 0:r.HashB64}));i(this,"sm3HashEncryption",e=>u(this,null,function*(){var a,o,l,d,h,f;const t=(o=e.DataB64)!=null?o:this.base64Encode({Data:(a=e.Data)!=null?a:""}),s=(d=e.KeyB64)!=null?d:this.base64Encode({Data:(l=e.Key)!=null?l:""}),r=yield(h=this.coreInstance)==null?void 0:h.sm3HashEncryption({dataB64:t,keyB64:s,alg:"sm3"});return(f=r==null?void 0:r[0])==null?void 0:f.DataB64}));i(this,"pkcs7Encryption",e=>u(this,null,function*(){var r,a,o,l;if(!e.CertB64List){const d=yield this.getEncryptionCert();e.CertB64List=d==null?void 0:d.CertB64}const t=(a=e.DataB64)!=null?a:this.base64Encode({Data:(r=e.Data)!=null?r:""}),s=yield(o=this.coreInstance)==null?void 0:o.pkcs7Encryption({DataB64:t,CertB64List:e.CertB64List});return(l=s==null?void 0:s[0])==null?void 0:l.DataB64}));i(this,"pkcs7Decryption",e=>u(this,null,function*(){var a,o;const t=yield this.getEncryptionCert(),s=yield(a=this.coreInstance)==null?void 0:a.pkcs7Decryption({DataB64:e.DataB64,ContainerName:t==null?void 0:t.ContainerName}),r=(o=s==null?void 0:s[0])==null?void 0:o.DataB64;return e.shouldDecodeBase64?this.base64Decode({DataB64:r}):r}));i(this,"asymmetricEncryption",e=>u(this,null,function*(){var r,a;const t=yield this.appendCertBase64(e,!1),s=yield(r=this.coreInstance)==null?void 0:r.asymmetricEncryption(t);return(a=s==null?void 0:s[0])==null?void 0:a.Data}));i(this,"asymmetricDecryption",e=>u(this,null,function*(){var r,a;const t=yield this.getEncryptionCert(),s=yield(r=this.coreInstance)==null?void 0:r.asymmetricDecryption({Data:e.Data,ContainerName:t==null?void 0:t.ContainerName});return(a=s==null?void 0:s[0])==null?void 0:a.Data}));i(this,"sm4Encryption",e=>u(this,null,function*(){var s;const t=yield(s=this.coreInstance)==null?void 0:s.sm4Encryption(e);return t==null?void 0:t[0]}));i(this,"sm4Decryption",e=>u(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.sm4Decryption(e);return(r=t==null?void 0:t[0])==null?void 0:r.Data}));i(this,"getCertInfo",e=>u(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.getCertInfo(e);return B({},(r=t==null?void 0:t[0])!=null?r:{})}));i(this,"getCertInfoByOid",e=>u(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.getCertInfoByOid(B({},e!=null?e:{}));return(r=t==null?void 0:t[0])==null?void 0:r.OidValue}));return M.instance&&!(e!=null&&e.isCreateNew)?M.instance:(this.createGwsCore(e),M.instance=this,this)}};i(M,"instance",null);let G=M;function dt(n){return new Promise((e,t)=>{if(G.instance&&!(n!=null&&n.isCreateNew))e(G.instance);else{const s=new G(_(B({},n!=null?n:{}),{onOpen(r){var a;e(s),(a=n==null?void 0:n.onOpen)==null||a.call(n,r)},onClose(r){var a;t(r),(a=n==null?void 0:n.onClose)==null||a.call(n,r)}}))}})}exports.GwsService=G;exports.createService=dt;
|
|
1
|
+
"use strict";var De=Object.defineProperty,be=Object.defineProperties;var Be=Object.getOwnPropertyDescriptors;var ee=Object.getOwnPropertySymbols;var Se=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable;var J=(n,e,t)=>e in n?De(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,B=(n,e)=>{for(var t in e||(e={}))Se.call(e,t)&&J(n,t,e[t]);if(ee)for(var t of ee(e))xe.call(e,t)&&J(n,t,e[t]);return n},L=(n,e)=>be(n,Be(e));var i=(n,e,t)=>J(n,typeof e!="symbol"?e+"":e,t);var u=(n,e,t)=>new Promise((s,r)=>{var a=d=>{try{l(t.next(d))}catch(h){r(h)}},o=d=>{try{l(t.throw(d))}catch(h){r(h)}},l=d=>d.done?s(d.value):Promise.resolve(d.value).then(a,o);l((t=t.apply(n,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ie=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",$e="1",Ae="2";var he=(n=>(n[n.MIN=0]="MIN",n[n.LOW=1]="LOW",n[n.MIDDLE=2]="MIDDLE",n[n.HIGH=3]="HIGH",n))(he||{});const Ee="00000001";function Le(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var N={},te;function _e(){if(te)return N;te=1,N.byteLength=l,N.toByteArray=h,N.fromByteArray=f;for(var n=[],e=[],t=typeof Uint8Array!="undefined"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,a=s.length;r<a;++r)n[r]=s[r],e[s.charCodeAt(r)]=r;e[45]=62,e[95]=63;function o(y){var c=y.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var m=y.indexOf("=");m===-1&&(m=c);var k=m===c?0:4-m%4;return[m,k]}function l(y){var c=o(y),m=c[0],k=c[1];return(m+k)*3/4-k}function d(y,c,m){return(c+m)*3/4-m}function h(y){var c,m=o(y),k=m[0],C=m[1],v=new t(d(y,k,C)),D=0,A=C>0?k-4:k,w;for(w=0;w<A;w+=4)c=e[y.charCodeAt(w)]<<18|e[y.charCodeAt(w+1)]<<12|e[y.charCodeAt(w+2)]<<6|e[y.charCodeAt(w+3)],v[D++]=c>>16&255,v[D++]=c>>8&255,v[D++]=c&255;return C===2&&(c=e[y.charCodeAt(w)]<<2|e[y.charCodeAt(w+1)]>>4,v[D++]=c&255),C===1&&(c=e[y.charCodeAt(w)]<<10|e[y.charCodeAt(w+1)]<<4|e[y.charCodeAt(w+2)]>>2,v[D++]=c>>8&255,v[D++]=c&255),v}function g(y){return n[y>>18&63]+n[y>>12&63]+n[y>>6&63]+n[y&63]}function p(y,c,m){for(var k,C=[],v=c;v<m;v+=3)k=(y[v]<<16&16711680)+(y[v+1]<<8&65280)+(y[v+2]&255),C.push(g(k));return C.join("")}function f(y){for(var c,m=y.length,k=m%3,C=[],v=16383,D=0,A=m-k;D<A;D+=v)C.push(p(y,D,D+v>A?A:D+v));return k===1?(c=y[m-1],C.push(n[c>>2]+n[c<<4&63]+"==")):k===2&&(c=(y[m-2]<<8)+y[m-1],C.push(n[c>>10]+n[c>>4&63]+n[c<<2&63]+"=")),C.join("")}return N}var Pe=_e();const ne=Le(Pe);class Me{constructor(){i(this,"deps",new Map)}on(e,t){this.deps.set(e,t)}emit(e,t){const s=this.deps.get(e);s&&s(t)}}(function(){try{var n=document.createElement("style");n.appendChild(document.createTextNode("button.svelte-oivou{background-color:transparent;border:none;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;outline:none}.modal-background.svelte-oivou{display:none;position:fixed;z-index:10000;left:0;top:0;width:100%;height:100%;background-color:#00000080;align-items:center;justify-content:center}.modal-content.svelte-oivou{background-color:#fff;padding:1.42857rem;border-radius:.35714rem;width:40%}.model-title.svelte-oivou{color:#303133;font-size:1.28571rem;margin-bottom:1.14286rem}.modal-visible.svelte-oivou{display:flex}.modal-footer.svelte-oivou{display:flex;align-items:center;justify-content:flex-end;margin-top:1.14286rem}.modal-btn.svelte-oivou{padding:.57143rem 1.07143rem;border-radius:.28571rem;font-size:1rem;border:.07143rem solid #dcdfe6}.success.svelte-oivou{margin-left:.85714rem;color:#fff}.slot.svelte-oivou{max-height:14.28571rem;overflow-y:scroll}.slot.svelte-oivou::-webkit-scrollbar{display:none}.cert-item.svelte-jtc2v4.svelte-jtc2v4{padding:1.14286rem;display:flex;align-items:center;cursor:pointer;border-bottom:.07143rem solid #ebeef5;font-size:1rem}.cert-item-selected.svelte-jtc2v4.svelte-jtc2v4{background-color:#f1f1f1}.cert-item-first.svelte-jtc2v4.svelte-jtc2v4{border-top:.07143rem solid #ebeef5}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4{display:inline-block;color:#606266}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4:first-child{width:30%}.seal-wrapper.svelte-1w19fs3.svelte-1w19fs3{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.seal-item.svelte-1w19fs3.svelte-1w19fs3{width:12.85714rem;height:12.85714rem;display:flex;flex-direction:column;align-items:center;justify-content:center;border:.07143rem solid #ccc;margin-top:.71429rem;margin-right:.71429rem;border-radius:.28571rem}.seal-item.svelte-1w19fs3 img.svelte-1w19fs3{width:7.14286rem;height:7.14286rem}.seal-item-selected.svelte-1w19fs3.svelte-1w19fs3{background-color:#f1f1f1}.seal-name.svelte-1w19fs3.svelte-1w19fs3{margin-top:.71429rem;color:#333}")),document.head.appendChild(n)}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var Te=Object.defineProperty,He=(n,e,t)=>e in n?Te(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,se=(n,e,t)=>He(n,typeof e!="symbol"?e+"":e,t);function Y(){}function Ge(n,e){for(const t in e)n[t]=e[t];return n}function ye(n){return n()}function re(){return Object.create(null)}function V(n){n.forEach(ye)}function j(n){return typeof n=="function"}function ge(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function Ne(n){return Object.keys(n).length===0}function Fe(n,e,t,s){if(n){const r=fe(n,e,t,s);return n[0](r)}}function fe(n,e,t,s){return n[1]&&s?Ge(t.ctx.slice(),n[1](s(e))):t.ctx}function je(n,e,t,s){if(n[2]&&s){const r=n[2](s(t));if(e.dirty===void 0)return r;if(typeof r=="object"){const a=[],o=Math.max(e.dirty.length,r.length);for(let l=0;l<o;l+=1)a[l]=e.dirty[l]|r[l];return a}return e.dirty|r}return e.dirty}function Oe(n,e,t,s,r,a){if(r){const o=fe(e,t,s,a);n.p(o,r)}}function Ze(n){if(n.ctx.length>32){const e=[],t=n.ctx.length/32;for(let s=0;s<t;s++)e[s]=-1;return e}return-1}function ae(n){return n!=null?n:""}function b(n,e){n.appendChild(e)}function W(n,e,t){n.insertBefore(e,t||null)}function U(n){n.parentNode&&n.parentNode.removeChild(n)}function Ve(n,e){for(let t=0;t<n.length;t+=1)n[t]&&n[t].d(e)}function I(n){return document.createElement(n)}function $(n){return document.createTextNode(n)}function O(){return $(" ")}function Re(){return $("")}function F(n,e,t,s){return n.addEventListener(e,t,s),()=>n.removeEventListener(e,t,s)}function S(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function Ue(n){return Array.from(n.childNodes)}function T(n,e){e=""+e,n.data!==e&&(n.data=e)}function oe(n,e,t,s){t==null?n.style.removeProperty(e):n.style.setProperty(e,t,"")}let Q;function Z(n){Q=n}const P=[],ie=[];let H=[];const ce=[],Je=Promise.resolve();let q=!1;function ze(){q||(q=!0,Je.then(pe))}function K(n){H.push(n)}const z=new Set;let _=0;function pe(){if(_!==0)return;const n=Q;do{try{for(;_<P.length;){const e=P[_];_++,Z(e),Ye(e.$$)}}catch(e){throw P.length=0,_=0,e}for(Z(null),P.length=0,_=0;ie.length;)ie.pop()();for(let e=0;e<H.length;e+=1){const t=H[e];z.has(t)||(z.add(t),t())}H.length=0}while(P.length);for(;ce.length;)ce.pop()();q=!1,z.clear(),Z(n)}function Ye(n){if(n.fragment!==null){n.update(),V(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(K)}}function qe(n){const e=[],t=[];H.forEach(s=>n.indexOf(s)===-1?e.push(s):t.push(s)),t.forEach(s=>s()),H=e}const R=new Set;let Ke;function X(n,e){n&&n.i&&(R.delete(n),n.i(e))}function me(n,e,t,s){if(n&&n.o){if(R.has(n))return;R.add(n),Ke.c.push(()=>{R.delete(n)}),n.o(e)}}function le(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function We(n){n&&n.c()}function ve(n,e,t){const{fragment:s,after_update:r}=n.$$;s&&s.m(e,t),K(()=>{const a=n.$$.on_mount.map(ye).filter(j);n.$$.on_destroy?n.$$.on_destroy.push(...a):V(a),n.$$.on_mount=[]}),r.forEach(K)}function Ce(n,e){const t=n.$$;t.fragment!==null&&(qe(t.after_update),V(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function Qe(n,e){n.$$.dirty[0]===-1&&(P.push(n),ze(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function we(n,e,t,s,r,a,o=null,l=[-1]){const d=Q;Z(n);const h=n.$$={fragment:null,ctx:[],props:a,update:Y,not_equal:r,bound:re(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(d?d.$$.context:[])),callbacks:re(),dirty:l,skip_bound:!1,root:e.target||d.$$.root};o&&o(h.root);let g=!1;if(h.ctx=t?t(n,e.props||{},(p,f,...y)=>{const c=y.length?y[0]:f;return h.ctx&&r(h.ctx[p],h.ctx[p]=c)&&(!h.skip_bound&&h.bound[p]&&h.bound[p](c),g&&Qe(n,p)),f}):[],h.update(),g=!0,V(h.before_update),h.fragment=s?s(h.ctx):!1,e.target){if(e.hydrate){const p=Ue(e.target);h.fragment&&h.fragment.l(p),p.forEach(U)}else h.fragment&&h.fragment.c();e.intro&&X(n.$$.fragment),ve(n,e.target,e.anchor),pe()}Z(d)}class ke{constructor(){se(this,"$$"),se(this,"$$set")}$destroy(){Ce(this,1),this.$destroy=Y}$on(e,t){if(!j(t))return Y;const s=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return s.push(t),()=>{const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}$set(e){this.$$set&&!Ne(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Xe="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Xe);function et(n){let e,t,s,r=(n[1]||"标题")+"",a,o,l,d,h,g,p=(n[4]||"取消")+"",f,y,c,m=(n[5]||"确认")+"",k,C,v,D;const A=n[8].default,w=Fe(A,n,n[7],null);return{c(){e=I("div"),t=I("div"),s=I("div"),a=$(r),o=O(),l=I("div"),w&&w.c(),d=O(),h=I("div"),g=I("button"),f=$(p),y=O(),c=I("button"),k=$(m),S(s,"class","model-title svelte-oivou"),S(l,"class","slot svelte-oivou"),S(g,"class","modal-btn svelte-oivou"),S(c,"class","modal-btn success svelte-oivou"),oe(c,"background-color",n[6]),S(h,"class","modal-footer svelte-oivou"),S(t,"class","modal-content svelte-oivou"),S(e,"class","modal-background modal-visible svelte-oivou")},m(x,E){W(x,e,E),b(e,t),b(t,s),b(s,a),b(t,o),b(t,l),w&&w.m(l,null),b(t,d),b(t,h),b(h,g),b(g,f),b(h,y),b(h,c),b(c,k),C=!0,v||(D=[F(g,"click",function(){j(n[0])&&n[0].apply(this,arguments)}),F(c,"click",function(){j(n[2])&&n[2].apply(this,arguments)}),F(t,"click",tt),F(e,"click",function(){j(n[3])&&n[3].apply(this,arguments)})],v=!0)},p(x,[E]){n=x,(!C||E&2)&&r!==(r=(n[1]||"标题")+"")&&T(a,r),w&&w.p&&(!C||E&128)&&Oe(w,A,n,n[7],C?je(A,n[7],E,null):Ze(n[7]),null),(!C||E&16)&&p!==(p=(n[4]||"取消")+"")&&T(f,p),(!C||E&32)&&m!==(m=(n[5]||"确认")+"")&&T(k,m),(!C||E&64)&&oe(c,"background-color",n[6])},i(x){C||(X(w,x),C=!0)},o(x){me(w,x),C=!1},d(x){x&&U(e),w&&w.d(x),v=!1,V(D)}}}const tt=n=>n.stopPropagation();function nt(n,e,t){let{$$slots:s={},$$scope:r}=e,{onCancel:a}=e,{title:o}=e,{onOk:l}=e,{onClose:d}=e,{cancelText:h}=e,{okText:g}=e,{theme:p}=e;return n.$$set=f=>{"onCancel"in f&&t(0,a=f.onCancel),"title"in f&&t(1,o=f.title),"onOk"in f&&t(2,l=f.onOk),"onClose"in f&&t(3,d=f.onClose),"cancelText"in f&&t(4,h=f.cancelText),"okText"in f&&t(5,g=f.okText),"theme"in f&&t(6,p=f.theme),"$$scope"in f&&t(7,r=f.$$scope)},[a,o,l,d,h,g,p,r,s]}class st extends ke{constructor(e){super(),we(this,e,nt,et,ge,{onCancel:0,title:1,onOk:2,onClose:3,cancelText:4,okText:5,theme:6})}}function ue(n,e,t){const s=n.slice();return s[11]=e[t],s[13]=t,s}function de(n){let e,t,s=n[11].CN+"",r,a,o,l=n[11].DevClass+"",d,h,g=n[11].sn+"",p,f,y,c,m,k;function C(){return n[10](n[13])}return{c(){e=I("div"),t=I("span"),r=$(s),a=O(),o=I("span"),d=$(l),h=$("("),p=$(g),f=$(")"),y=O(),S(t,"class","svelte-jtc2v4"),S(o,"class","svelte-jtc2v4"),S(e,"class",c=ae(`cert-item ${n[13]===0?"cert-item-first":""} ${n[13]===n[5]?"cert-item-selected":""}`)+" svelte-jtc2v4")},m(v,D){W(v,e,D),b(e,t),b(t,r),b(e,a),b(e,o),b(o,d),b(o,h),b(o,p),b(o,f),b(e,y),m||(k=F(e,"click",C),m=!0)},p(v,D){n=v,D&1&&s!==(s=n[11].CN+"")&&T(r,s),D&1&&l!==(l=n[11].DevClass+"")&&T(d,l),D&1&&g!==(g=n[11].sn+"")&&T(p,g),D&32&&c!==(c=ae(`cert-item ${n[13]===0?"cert-item-first":""} ${n[13]===n[5]?"cert-item-selected":""}`)+" svelte-jtc2v4")&&S(e,"class",c)},d(v){v&&U(e),m=!1,k()}}}function rt(n){let e,t=le(n[0]),s=[];for(let r=0;r<t.length;r+=1)s[r]=de(ue(n,t,r));return{c(){for(let r=0;r<s.length;r+=1)s[r].c();e=Re()},m(r,a){for(let o=0;o<s.length;o+=1)s[o]&&s[o].m(r,a);W(r,e,a)},p(r,a){if(a&33){t=le(r[0]);let o;for(o=0;o<t.length;o+=1){const l=ue(r,t,o);s[o]?s[o].p(l,a):(s[o]=de(l),s[o].c(),s[o].m(e.parentNode,e))}for(;o<s.length;o+=1)s[o].d(1);s.length=t.length}},d(r){r&&U(e),Ve(s,r)}}}function at(n){let e,t;return e=new st({props:{onOk:n[7],onClose:n[1],onCancel:n[6],cancelText:n[2],okText:n[3],title:"选择证书",theme:n[4],$$slots:{default:[rt]},$$scope:{ctx:n}}}),{c(){We(e.$$.fragment)},m(s,r){ve(e,s,r),t=!0},p(s,[r]){const a={};r&2&&(a.onClose=s[1]),r&4&&(a.cancelText=s[2]),r&8&&(a.okText=s[3]),r&16&&(a.theme=s[4]),r&16417&&(a.$$scope={dirty:r,ctx:s}),e.$set(a)},i(s){t||(X(e.$$.fragment,s),t=!0)},o(s){me(e.$$.fragment,s),t=!1},d(s){Ce(e,s)}}}function ot(n,e,t){let{certList:s=[]}=e,{onCancel:r}=e,{onOk:a}=e,{onClose:o}=e,{cancelText:l=""}=e,{okText:d=""}=e,{theme:h="#409eff"}=e,g=0;const p=()=>{r("未选择证书"),o==null||o()},f=()=>{a==null||a(s[g]),o==null||o()},y=c=>t(5,g=c);return n.$$set=c=>{"certList"in c&&t(0,s=c.certList),"onCancel"in c&&t(8,r=c.onCancel),"onOk"in c&&t(9,a=c.onOk),"onClose"in c&&t(1,o=c.onClose),"cancelText"in c&&t(2,l=c.cancelText),"okText"in c&&t(3,d=c.okText),"theme"in c&&t(4,h=c.theme)},[s,o,l,d,h,g,p,f,r,a,y]}class it extends ke{constructor(e){super(),we(this,e,ot,at,ge,{certList:0,onCancel:8,onOk:9,onClose:1,cancelText:2,okText:3,theme:4})}}class ct{constructor(){i(this,"modalInstance",{current:null});i(this,"open",e=>new Promise((t,s)=>{this.modalInstance.current=new it({target:document.body,props:L(B({},e),{onCancel:r=>{s({code:-1,msg:r})},onOk:r=>{t(r)},onClose:()=>{this.close()}})})}));i(this,"close",()=>{setTimeout(()=>{var e;(e=this.modalInstance.current)==null||e.$destroy()})})}}const lt=new ct;class ut{constructor(e){i(this,"socketInstance",null);i(this,"eventBus",new Me);i(this,"isRememberPin",!1);i(this,"socketEvent");i(this,"pinPolicy");i(this,"socketConfig",null);i(this,"getSocketReadyState",()=>{var e;return(e=this.socketInstance)==null?void 0:e.readyState});i(this,"destroy",()=>{var e;(e=this.socketInstance)==null||e.close()});i(this,"sendMessage",(e,t)=>new Promise((s,r)=>{var o,l;if(((o=this.socketInstance)==null?void 0:o.readyState)!==WebSocket.OPEN){r({errCode:-1,msg:"socket未连接"});return}const a={function:e,args:[t!=null?t:{}]};(l=this.socketInstance)==null||l.send(JSON.stringify(a)),this.eventBus.on(e,d=>{d.success?s(d.data):r(d)})}));i(this,"handleEventData",e=>u(this,null,function*(){var t,s,r,a,o,l;if(e.data instanceof Blob){const d=yield e.data.arrayBuffer(),g=new TextDecoder("gbk").decode(d),p=JSON.parse(g),f={data:p.data,success:(t=p.result)==null?void 0:t.success,msg:(s=p.result)==null?void 0:s.msg,errCode:(r=p.result)==null?void 0:r.errCode};this.eventBus.emit((a=p.result)==null?void 0:a.function,f),(l=(o=this.socketConfig)==null?void 0:o.onMessage)==null||l.call(o,f)}}));i(this,"base64Encode",e=>{const t=new TextEncoder().encode(e);return ne.fromByteArray(t)});i(this,"base64Decode",e=>{const t=ne.toByteArray(e);return new TextDecoder().decode(t)});i(this,"changeIsRememberPin",e=>u(this,null,function*(){this.isRememberPin=e}));i(this,"changePinPolicy",e=>u(this,null,function*(){this.pinPolicy=e}));i(this,"checkCertIsLogin",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_IsLogin",e)}));i(this,"addUkeyEvents",()=>u(this,null,function*(){this.sendMessage("GZCA_StartListen",{Type:Ee}).then(e=>{var t,s;(s=(t=this.socketConfig)==null?void 0:t.onUkeyEvent)==null||s.call(t,e)})}));i(this,"certLogin",e=>u(this,null,function*(){const t=yield this.checkCertIsLogin({ContainerName:e});t!=null&&t[0].isLogin||(yield this.sendMessage("GZCA_Login",{ContainerName:e,IsLogin:"N",UserPin:"123456",PinPolicy:this.pinPolicy}))}));i(this,"getCert",(e,t)=>u(this,null,function*(){const s=t!=null?t:yield this.chooseCert(e);return yield this.certLogin(s.ContainerName),s}));i(this,"getCertList",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_GetCertList",e)}));i(this,"chooseCert",e=>u(this,null,function*(){var r;const t=yield this.getCertList(e);return(t==null?void 0:t.length)===1?t[0]:yield lt.open({certList:t,theme:(r=this.socketConfig)==null?void 0:r.theme})}));i(this,"pkcs1Sign",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignData",B({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));i(this,"pkcs1Base64Sign",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",B({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));i(this,"pkcs1VerifySignature",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySign",e)}));i(this,"pkcs1Base64VerifySignature",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignEx",e)}));i(this,"getSealList",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_EnumSeals",B({IsLogin:this.getIsLogin()},e!=null?e:{}))}));i(this,"sm2SignPreprocess1",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep1",e)}));i(this,"sm2SignPreprocess2",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep2",e)}));i(this,"pkcs1HashSign",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataForHash",B({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));i(this,"pkcs1HashVerifySignature",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignForHash",e)}));i(this,"pkcs7Sign",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7SignData",B({IsLogin:this.getIsLogin(),IsAuthAttr:"Y",PinPolicy:this.pinPolicy},e!=null?e:{}))}));i(this,"pkcs7VerifySignature",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7VerifySign",e)}));i(this,"sm3Hash",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_HashData",e)}));i(this,"sm3HexHash",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_HashDataEx",e)}));i(this,"sm3FileHash",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_HashFile",e)}));i(this,"sm3HashEncryption",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_HMac",e)}));i(this,"pkcs7Encryption",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7EncryptData",e)}));i(this,"pkcs7Decryption",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7DecryptData",B({IsLogin:this.getIsLogin()},e!=null?e:{}))}));i(this,"asymmetricEncryption",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_AsymEncryptData",e)}));i(this,"asymmetricDecryption",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_AsymDecryptData",B({IsLogin:this.getIsLogin()},e!=null?e:{}))}));i(this,"sm4Encryption",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_EncryptDataEx",e)}));i(this,"sm4Decryption",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_DecryptDataEx",e)}));i(this,"getCertInfo",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfo",e)}));i(this,"getCertInfoByOid",e=>u(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfoByOid",e)}));var t,s;this.socketConfig=e,this.socketInstance=this.createSocket(e),this.isRememberPin=(t=e.isRememberPin)!=null?t:!1,this.pinPolicy=(s=e.pinPolicy)!=null?s:he.MIN}createSocket(e){const t=new WebSocket(e.url);return t.onerror=s=>{var r;(r=e.onError)==null||r.call(e,s)},t.onopen=s=>{var r;(r=e.onOpen)==null||r.call(e,s),this.addUkeyEvents()},t.onmessage=s=>{this.handleEventData(s)},t.onclose=s=>{var r;(r=e.onClose)==null||r.call(e,s)},t}getIsLogin(){return this.isRememberPin?"Y":"N"}}const M=class M{constructor(e){i(this,"coreInstance",null);i(this,"gwsConfig",{});i(this,"createGwsCore",e=>{this.gwsConfig=e!=null?e:{},this.coreInstance=new ut(L(B({},e!=null?e:{}),{url:Ie}))});i(this,"appendCertBase64",(e,t=!0)=>u(this,null,function*(){if(e.CertB64)return e;const s=t?yield this.getSignatureCert():yield this.getEncryptionCert();return L(B({},e!=null?e:{}),{CertB64:s==null?void 0:s.CertB64})}));i(this,"destroy",()=>{var e;(e=this.coreInstance)==null||e.destroy(),this.coreInstance=null});i(this,"restart",e=>{this.coreInstance&&this.destroy(),this.gwsConfig=e!=null?e:this.gwsConfig,this.createGwsCore(e)});i(this,"getSocketReadyState",()=>{var e;return(e=this.coreInstance)==null?void 0:e.getSocketReadyState()});i(this,"getSignatureCert",e=>u(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:$e},e)}));i(this,"getEncryptionCert",e=>u(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:Ae},e)}));i(this,"base64Encode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Encode(e.Data)});i(this,"base64Decode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Decode(e.DataB64)});i(this,"changeIsRememberPin",e=>{var t;(t=this.coreInstance)==null||t.changeIsRememberPin(e)});i(this,"changePinPolicy",e=>{var t;(t=this.coreInstance)==null||t.changePinPolicy(e)});i(this,"pkcs1Sign",(e,t)=>u(this,null,function*(){var a,o,l;const s=yield this.getSignatureCert(t),r=yield(o=this.coreInstance)==null?void 0:o.pkcs1Sign(L(B({},e!=null?e:{}),{ContainerName:(a=s==null?void 0:s.ContainerName)!=null?a:"",IsLogin:t?"Y":"N"}));return(l=r==null?void 0:r[0])==null?void 0:l.SignData}));i(this,"pkcs1VerifySignature",e=>u(this,null,function*(){var r;const t=yield this.appendCertBase64(e),s=yield(r=this.coreInstance)==null?void 0:r.pkcs1VerifySignature(t);return Array.isArray(s)}));i(this,"pkcs1Base64Sign",(e,t)=>u(this,null,function*(){var o,l,d,h,g;const s=yield this.getSignatureCert(t),r=(l=e.DataB64)!=null?l:this.base64Encode({Data:(o=e.Data)!=null?o:""}),a=yield(h=this.coreInstance)==null?void 0:h.pkcs1Base64Sign({ContainerName:(d=s==null?void 0:s.ContainerName)!=null?d:"",DataB64:r,IsLogin:t?"Y":"N"});return(g=a==null?void 0:a[0])==null?void 0:g.SignData}));i(this,"pkcs1Base64VerifySignature",e=>u(this,null,function*(){var a,o,l;const t=(o=e.DataB64)!=null?o:this.base64Encode({Data:(a=e.Data)!=null?a:""}),s=yield this.appendCertBase64(e);return!!(yield(l=this.coreInstance)==null?void 0:l.pkcs1Base64VerifySignature({CertB64:s.CertB64,DataB64:t,SignData:s.SignData}))}));i(this,"getSealList",e=>u(this,null,function*(){var r,a;const t=yield this.getSignatureCert(e),s=yield(a=this.coreInstance)==null?void 0:a.getSealList({ContainerName:(r=t==null?void 0:t.ContainerName)!=null?r:"",IsLogin:e?"Y":"N"});return{cert:t,sealList:s}}));i(this,"sm2SignPreprocess1",e=>u(this,null,function*(){var r,a;const t=yield this.appendCertBase64(e),s=yield(r=this.coreInstance)==null?void 0:r.sm2SignPreprocess1(t);return(a=s==null?void 0:s[0])==null?void 0:a.Z}));i(this,"sm2SignPreprocess2",e=>u(this,null,function*(){var a,o;const t=this.base64Encode({Data:(a=e.Data)!=null?a:""}),s=yield this.appendCertBase64(e),r=yield(o=this.coreInstance)==null?void 0:o.sm2SignPreprocess2({CertB64:s.CertB64,DataB64:t});return r==null?void 0:r[0].H}));i(this,"pkcs1HashSign",(e,t)=>u(this,null,function*(){var a,o,l,d;const s=yield this.getSignatureCert(t),r=yield(l=this.coreInstance)==null?void 0:l.pkcs1HashSign({ContainerName:(a=s==null?void 0:s.ContainerName)!=null?a:"",DataB64:e.DataB64,HashAlg:(o=e.HashAlg)!=null?o:"sm3",IsLogin:t?"Y":"N"});return(d=r==null?void 0:r[0])==null?void 0:d.SignData}));i(this,"pkcs1HashVerifySignature",e=>u(this,null,function*(){var r,a;const t=yield this.appendCertBase64(e);return!!(yield(a=this.coreInstance)==null?void 0:a.pkcs1HashVerifySignature(L(B({},t),{HashAlg:(r=t.HashAlg)!=null?r:"sm3"})))}));i(this,"pkcs7Sign",(e,t)=>u(this,null,function*(){var o,l,d,h,g;const s=(l=e.DataB64)!=null?l:this.base64Encode({Data:(o=e.Data)!=null?o:""}),r=yield this.getSignatureCert(t),a=yield(h=this.coreInstance)==null?void 0:h.pkcs7Sign({IsDetached:e.IsDetached,ContainerName:(d=r==null?void 0:r.ContainerName)!=null?d:"",DataB64:s,IsLogin:t?"Y":"N"});return(g=a==null?void 0:a[0])==null?void 0:g.SignData}));i(this,"pkcs7VerifySignature",e=>u(this,null,function*(){var r,a,o;const t=(a=e.DataB64)!=null?a:this.base64Encode({Data:(r=e.Data)!=null?r:""});return!!(yield(o=this.coreInstance)==null?void 0:o.pkcs7VerifySignature({DataB64:t,SignData:e.SignData}))}));i(this,"sm3Hash",e=>u(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.sm3Hash(e);return(r=t==null?void 0:t[0])==null?void 0:r.HashB64}));i(this,"sm3HexHash",e=>u(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.sm3HexHash(e);return(r=t==null?void 0:t[0])==null?void 0:r.HashB64}));i(this,"sm3FileHash",e=>u(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.sm3FileHash(e);return(r=t==null?void 0:t[0])==null?void 0:r.HashB64}));i(this,"sm3HashEncryption",e=>u(this,null,function*(){var a,o,l,d,h,g;const t=(o=e.DataB64)!=null?o:this.base64Encode({Data:(a=e.Data)!=null?a:""}),s=(d=e.KeyB64)!=null?d:this.base64Encode({Data:(l=e.Key)!=null?l:""}),r=yield(h=this.coreInstance)==null?void 0:h.sm3HashEncryption({dataB64:t,keyB64:s,alg:"sm3"});return(g=r==null?void 0:r[0])==null?void 0:g.DataB64}));i(this,"pkcs7Encryption",e=>u(this,null,function*(){var r,a,o,l;if(!e.CertB64List){const d=yield this.getEncryptionCert();e.CertB64List=d==null?void 0:d.CertB64}const t=(a=e.DataB64)!=null?a:this.base64Encode({Data:(r=e.Data)!=null?r:""}),s=yield(o=this.coreInstance)==null?void 0:o.pkcs7Encryption({DataB64:t,CertB64List:e.CertB64List});return(l=s==null?void 0:s[0])==null?void 0:l.DataB64}));i(this,"pkcs7Decryption",e=>u(this,null,function*(){var a,o;const t=yield this.getEncryptionCert(),s=yield(a=this.coreInstance)==null?void 0:a.pkcs7Decryption({DataB64:e.DataB64,ContainerName:t==null?void 0:t.ContainerName}),r=(o=s==null?void 0:s[0])==null?void 0:o.DataB64;return e.shouldDecodeBase64?this.base64Decode({DataB64:r}):r}));i(this,"asymmetricEncryption",e=>u(this,null,function*(){var r,a;const t=yield this.appendCertBase64(e,!1),s=yield(r=this.coreInstance)==null?void 0:r.asymmetricEncryption(t);return(a=s==null?void 0:s[0])==null?void 0:a.Data}));i(this,"asymmetricDecryption",(e,t)=>u(this,null,function*(){var a,o;const s=yield this.getEncryptionCert(t),r=yield(a=this.coreInstance)==null?void 0:a.asymmetricDecryption({Data:e.Data,ContainerName:s==null?void 0:s.ContainerName,IsLogin:t?"Y":"N"});return(o=r==null?void 0:r[0])==null?void 0:o.Data}));i(this,"sm4Encryption",e=>u(this,null,function*(){var s;const t=yield(s=this.coreInstance)==null?void 0:s.sm4Encryption(e);return t==null?void 0:t[0]}));i(this,"sm4Decryption",e=>u(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.sm4Decryption(e);return(r=t==null?void 0:t[0])==null?void 0:r.Data}));i(this,"getCertInfo",e=>u(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.getCertInfo(e);return B({},(r=t==null?void 0:t[0])!=null?r:{})}));i(this,"getCertInfoByOid",e=>u(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.getCertInfoByOid(B({},e!=null?e:{}));return(r=t==null?void 0:t[0])==null?void 0:r.OidValue}));return M.instance&&!(e!=null&&e.isCreateNew)?M.instance:(this.createGwsCore(e),M.instance=this,this)}};i(M,"instance",null);let G=M;function dt(n){return new Promise((e,t)=>{if(G.instance&&!(n!=null&&n.isCreateNew))e(G.instance);else{const s=new G(L(B({},n!=null?n:{}),{onOpen(r){var a;e(s),(a=n==null?void 0:n.onOpen)==null||a.call(n,r)},onClose(r){var a;t(r),(a=n==null?void 0:n.onClose)==null||a.call(n,r)}}))}})}exports.GwsService=G;exports.createService=dt;
|
package/dist/index.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export declare class GwsService {
|
|
|
49
49
|
DataB64?: string;
|
|
50
50
|
SignData: string;
|
|
51
51
|
}) => Promise<boolean>;
|
|
52
|
-
getSealList: () => Promise<{
|
|
52
|
+
getSealList: (curCert?: CertType) => Promise<{
|
|
53
53
|
cert: CertType | undefined;
|
|
54
54
|
sealList: {
|
|
55
55
|
SealId: string;
|
|
@@ -112,7 +112,7 @@ export declare class GwsService {
|
|
|
112
112
|
}) => Promise<any>;
|
|
113
113
|
asymmetricDecryption: (params: {
|
|
114
114
|
Data: string;
|
|
115
|
-
}) => Promise<any>;
|
|
115
|
+
}, curCert?: CertType) => Promise<any>;
|
|
116
116
|
sm4Encryption: (params: {
|
|
117
117
|
Data: string;
|
|
118
118
|
}) => Promise<any>;
|
package/dist/index.es.js
CHANGED
|
@@ -9,7 +9,7 @@ var J = (n, t, e) => t in n ? Dt(n, t, { enumerable: !0, configurable: !0, writa
|
|
|
9
9
|
for (var e of tt(t))
|
|
10
10
|
St.call(t, e) && J(n, e, t[e]);
|
|
11
11
|
return n;
|
|
12
|
-
},
|
|
12
|
+
}, L = (n, t) => bt(n, Bt(t));
|
|
13
13
|
var i = (n, t, e) => J(n, typeof t != "symbol" ? t + "" : t, e);
|
|
14
14
|
var u = (n, t, e) => new Promise((s, r) => {
|
|
15
15
|
var a = (d) => {
|
|
@@ -27,16 +27,16 @@ var u = (n, t, e) => new Promise((s, r) => {
|
|
|
27
27
|
}, l = (d) => d.done ? s(d.value) : Promise.resolve(d.value).then(a, o);
|
|
28
28
|
l((e = e.apply(n, t)).next());
|
|
29
29
|
});
|
|
30
|
-
const
|
|
30
|
+
const It = window.location.href.includes("https") ? "wss://localhost:19528" : "ws://localhost:9527", $t = "1", At = "2";
|
|
31
31
|
var ht = /* @__PURE__ */ ((n) => (n[n.MIN = 0] = "MIN", n[n.LOW = 1] = "LOW", n[n.MIDDLE = 2] = "MIDDLE", n[n.HIGH = 3] = "HIGH", n))(ht || {});
|
|
32
32
|
const Et = "00000001";
|
|
33
|
-
function
|
|
33
|
+
function Lt(n) {
|
|
34
34
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
35
35
|
}
|
|
36
36
|
var G = {}, et;
|
|
37
|
-
function
|
|
37
|
+
function _t() {
|
|
38
38
|
if (et) return G;
|
|
39
|
-
et = 1, G.byteLength = l, G.toByteArray = h, G.fromByteArray =
|
|
39
|
+
et = 1, G.byteLength = l, G.toByteArray = h, G.fromByteArray = f;
|
|
40
40
|
for (var n = [], t = [], e = typeof Uint8Array != "undefined" ? Uint8Array : Array, s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", r = 0, a = s.length; r < a; ++r)
|
|
41
41
|
n[r] = s[r], t[s.charCodeAt(r)] = r;
|
|
42
42
|
t[45] = 62, t[95] = 63;
|
|
@@ -62,15 +62,15 @@ function Lt() {
|
|
|
62
62
|
c = t[y.charCodeAt(w)] << 18 | t[y.charCodeAt(w + 1)] << 12 | t[y.charCodeAt(w + 2)] << 6 | t[y.charCodeAt(w + 3)], v[D++] = c >> 16 & 255, v[D++] = c >> 8 & 255, v[D++] = c & 255;
|
|
63
63
|
return C === 2 && (c = t[y.charCodeAt(w)] << 2 | t[y.charCodeAt(w + 1)] >> 4, v[D++] = c & 255), C === 1 && (c = t[y.charCodeAt(w)] << 10 | t[y.charCodeAt(w + 1)] << 4 | t[y.charCodeAt(w + 2)] >> 2, v[D++] = c >> 8 & 255, v[D++] = c & 255), v;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function g(y) {
|
|
66
66
|
return n[y >> 18 & 63] + n[y >> 12 & 63] + n[y >> 6 & 63] + n[y & 63];
|
|
67
67
|
}
|
|
68
68
|
function p(y, c, m) {
|
|
69
69
|
for (var k, C = [], v = c; v < m; v += 3)
|
|
70
|
-
k = (y[v] << 16 & 16711680) + (y[v + 1] << 8 & 65280) + (y[v + 2] & 255), C.push(
|
|
70
|
+
k = (y[v] << 16 & 16711680) + (y[v + 1] << 8 & 65280) + (y[v + 2] & 255), C.push(g(k));
|
|
71
71
|
return C.join("");
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function f(y) {
|
|
74
74
|
for (var c, m = y.length, k = m % 3, C = [], v = 16383, D = 0, A = m - k; D < A; D += v)
|
|
75
75
|
C.push(p(y, D, D + v > A ? A : D + v));
|
|
76
76
|
return k === 1 ? (c = y[m - 1], C.push(
|
|
@@ -81,8 +81,8 @@ function Lt() {
|
|
|
81
81
|
}
|
|
82
82
|
return G;
|
|
83
83
|
}
|
|
84
|
-
var Pt =
|
|
85
|
-
const nt = /* @__PURE__ */
|
|
84
|
+
var Pt = _t();
|
|
85
|
+
const nt = /* @__PURE__ */ Lt(Pt);
|
|
86
86
|
class Ht {
|
|
87
87
|
constructor() {
|
|
88
88
|
i(this, "deps", /* @__PURE__ */ new Map());
|
|
@@ -104,7 +104,7 @@ class Ht {
|
|
|
104
104
|
}
|
|
105
105
|
})();
|
|
106
106
|
var Mt = Object.defineProperty, Tt = (n, t, e) => t in n ? Mt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, st = (n, t, e) => Tt(n, typeof t != "symbol" ? t + "" : t, e);
|
|
107
|
-
function
|
|
107
|
+
function Y() {
|
|
108
108
|
}
|
|
109
109
|
function Gt(n, t) {
|
|
110
110
|
for (const e in t) n[e] = t[e];
|
|
@@ -122,25 +122,25 @@ function rt() {
|
|
|
122
122
|
function V(n) {
|
|
123
123
|
n.forEach(yt);
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function F(n) {
|
|
126
126
|
return typeof n == "function";
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function gt(n, t) {
|
|
129
129
|
return n != n ? t == t : n !== t || n && typeof n == "object" || typeof n == "function";
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function Nt(n) {
|
|
132
132
|
return Object.keys(n).length === 0;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function Ft(n, t, e, s) {
|
|
135
135
|
if (n) {
|
|
136
|
-
const r =
|
|
136
|
+
const r = ft(n, t, e, s);
|
|
137
137
|
return n[0](r);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function ft(n, t, e, s) {
|
|
141
141
|
return n[1] && s ? Gt(e.ctx.slice(), n[1](s(t))) : e.ctx;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function jt(n, t, e, s) {
|
|
144
144
|
if (n[2] && s) {
|
|
145
145
|
const r = n[2](s(e));
|
|
146
146
|
if (t.dirty === void 0)
|
|
@@ -155,9 +155,9 @@ function Ot(n, t, e, s) {
|
|
|
155
155
|
}
|
|
156
156
|
return t.dirty;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function Ot(n, t, e, s, r, a) {
|
|
159
159
|
if (r) {
|
|
160
|
-
const o =
|
|
160
|
+
const o = ft(t, e, s, a);
|
|
161
161
|
n.p(o, r);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
@@ -176,7 +176,7 @@ function at(n) {
|
|
|
176
176
|
function b(n, t) {
|
|
177
177
|
n.appendChild(t);
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function W(n, t, e) {
|
|
180
180
|
n.insertBefore(t, e || null);
|
|
181
181
|
}
|
|
182
182
|
function U(n) {
|
|
@@ -186,19 +186,19 @@ function Vt(n, t) {
|
|
|
186
186
|
for (let e = 0; e < n.length; e += 1)
|
|
187
187
|
n[e] && n[e].d(t);
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function I(n) {
|
|
190
190
|
return document.createElement(n);
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function $(n) {
|
|
193
193
|
return document.createTextNode(n);
|
|
194
194
|
}
|
|
195
|
-
function
|
|
196
|
-
return
|
|
195
|
+
function j() {
|
|
196
|
+
return $(" ");
|
|
197
197
|
}
|
|
198
198
|
function Rt() {
|
|
199
|
-
return
|
|
199
|
+
return $("");
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function N(n, t, e, s) {
|
|
202
202
|
return n.addEventListener(t, e, s), () => n.removeEventListener(t, e, s);
|
|
203
203
|
}
|
|
204
204
|
function x(n, t, e) {
|
|
@@ -214,36 +214,36 @@ function M(n, t) {
|
|
|
214
214
|
function ot(n, t, e, s) {
|
|
215
215
|
e == null ? n.style.removeProperty(t) : n.style.setProperty(t, e, "");
|
|
216
216
|
}
|
|
217
|
-
let
|
|
218
|
-
function
|
|
219
|
-
|
|
217
|
+
let Q;
|
|
218
|
+
function O(n) {
|
|
219
|
+
Q = n;
|
|
220
220
|
}
|
|
221
221
|
const P = [], it = [];
|
|
222
222
|
let T = [];
|
|
223
223
|
const ct = [], Jt = /* @__PURE__ */ Promise.resolve();
|
|
224
|
-
let
|
|
224
|
+
let q = !1;
|
|
225
225
|
function zt() {
|
|
226
|
-
|
|
226
|
+
q || (q = !0, Jt.then(pt));
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function K(n) {
|
|
229
229
|
T.push(n);
|
|
230
230
|
}
|
|
231
231
|
const z = /* @__PURE__ */ new Set();
|
|
232
|
-
let
|
|
232
|
+
let _ = 0;
|
|
233
233
|
function pt() {
|
|
234
|
-
if (
|
|
234
|
+
if (_ !== 0)
|
|
235
235
|
return;
|
|
236
|
-
const n =
|
|
236
|
+
const n = Q;
|
|
237
237
|
do {
|
|
238
238
|
try {
|
|
239
|
-
for (;
|
|
240
|
-
const t = P[
|
|
241
|
-
|
|
239
|
+
for (; _ < P.length; ) {
|
|
240
|
+
const t = P[_];
|
|
241
|
+
_++, O(t), Yt(t.$$);
|
|
242
242
|
}
|
|
243
243
|
} catch (t) {
|
|
244
|
-
throw P.length = 0,
|
|
244
|
+
throw P.length = 0, _ = 0, t;
|
|
245
245
|
}
|
|
246
|
-
for (
|
|
246
|
+
for (O(null), P.length = 0, _ = 0; it.length; ) it.pop()();
|
|
247
247
|
for (let t = 0; t < T.length; t += 1) {
|
|
248
248
|
const e = T[t];
|
|
249
249
|
z.has(e) || (z.add(e), e());
|
|
@@ -252,28 +252,28 @@ function pt() {
|
|
|
252
252
|
} while (P.length);
|
|
253
253
|
for (; ct.length; )
|
|
254
254
|
ct.pop()();
|
|
255
|
-
|
|
255
|
+
q = !1, z.clear(), O(n);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Yt(n) {
|
|
258
258
|
if (n.fragment !== null) {
|
|
259
259
|
n.update(), V(n.before_update);
|
|
260
260
|
const t = n.dirty;
|
|
261
|
-
n.dirty = [-1], n.fragment && n.fragment.p(n.ctx, t), n.after_update.forEach(
|
|
261
|
+
n.dirty = [-1], n.fragment && n.fragment.p(n.ctx, t), n.after_update.forEach(K);
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
|
-
function
|
|
264
|
+
function qt(n) {
|
|
265
265
|
const t = [], e = [];
|
|
266
266
|
T.forEach((s) => n.indexOf(s) === -1 ? t.push(s) : e.push(s)), e.forEach((s) => s()), T = t;
|
|
267
267
|
}
|
|
268
268
|
const R = /* @__PURE__ */ new Set();
|
|
269
|
-
let
|
|
270
|
-
function
|
|
269
|
+
let Kt;
|
|
270
|
+
function X(n, t) {
|
|
271
271
|
n && n.i && (R.delete(n), n.i(t));
|
|
272
272
|
}
|
|
273
273
|
function mt(n, t, e, s) {
|
|
274
274
|
if (n && n.o) {
|
|
275
275
|
if (R.has(n)) return;
|
|
276
|
-
R.add(n),
|
|
276
|
+
R.add(n), Kt.c.push(() => {
|
|
277
277
|
R.delete(n);
|
|
278
278
|
}), n.o(t);
|
|
279
279
|
}
|
|
@@ -281,32 +281,32 @@ function mt(n, t, e, s) {
|
|
|
281
281
|
function lt(n) {
|
|
282
282
|
return (n == null ? void 0 : n.length) !== void 0 ? n : Array.from(n);
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function Wt(n) {
|
|
285
285
|
n && n.c();
|
|
286
286
|
}
|
|
287
287
|
function vt(n, t, e) {
|
|
288
288
|
const { fragment: s, after_update: r } = n.$$;
|
|
289
|
-
s && s.m(t, e),
|
|
290
|
-
const a = n.$$.on_mount.map(yt).filter(
|
|
289
|
+
s && s.m(t, e), K(() => {
|
|
290
|
+
const a = n.$$.on_mount.map(yt).filter(F);
|
|
291
291
|
n.$$.on_destroy ? n.$$.on_destroy.push(...a) : V(a), n.$$.on_mount = [];
|
|
292
|
-
}), r.forEach(
|
|
292
|
+
}), r.forEach(K);
|
|
293
293
|
}
|
|
294
294
|
function Ct(n, t) {
|
|
295
295
|
const e = n.$$;
|
|
296
|
-
e.fragment !== null && (
|
|
296
|
+
e.fragment !== null && (qt(e.after_update), V(e.on_destroy), e.fragment && e.fragment.d(t), e.on_destroy = e.fragment = null, e.ctx = []);
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function Qt(n, t) {
|
|
299
299
|
n.$$.dirty[0] === -1 && (P.push(n), zt(), n.$$.dirty.fill(0)), n.$$.dirty[t / 31 | 0] |= 1 << t % 31;
|
|
300
300
|
}
|
|
301
301
|
function wt(n, t, e, s, r, a, o = null, l = [-1]) {
|
|
302
|
-
const d =
|
|
303
|
-
|
|
302
|
+
const d = Q;
|
|
303
|
+
O(n);
|
|
304
304
|
const h = n.$$ = {
|
|
305
305
|
fragment: null,
|
|
306
306
|
ctx: [],
|
|
307
307
|
// state
|
|
308
308
|
props: a,
|
|
309
|
-
update:
|
|
309
|
+
update: Y,
|
|
310
310
|
not_equal: r,
|
|
311
311
|
bound: rt(),
|
|
312
312
|
// lifecycle
|
|
@@ -323,19 +323,19 @@ function wt(n, t, e, s, r, a, o = null, l = [-1]) {
|
|
|
323
323
|
root: t.target || d.$$.root
|
|
324
324
|
};
|
|
325
325
|
o && o(h.root);
|
|
326
|
-
let
|
|
327
|
-
if (h.ctx = e ? e(n, t.props || {}, (p,
|
|
328
|
-
const c = y.length ? y[0] :
|
|
329
|
-
return h.ctx && r(h.ctx[p], h.ctx[p] = c) && (!h.skip_bound && h.bound[p] && h.bound[p](c),
|
|
330
|
-
}) : [], h.update(),
|
|
326
|
+
let g = !1;
|
|
327
|
+
if (h.ctx = e ? e(n, t.props || {}, (p, f, ...y) => {
|
|
328
|
+
const c = y.length ? y[0] : f;
|
|
329
|
+
return h.ctx && r(h.ctx[p], h.ctx[p] = c) && (!h.skip_bound && h.bound[p] && h.bound[p](c), g && Qt(n, p)), f;
|
|
330
|
+
}) : [], h.update(), g = !0, V(h.before_update), h.fragment = s ? s(h.ctx) : !1, t.target) {
|
|
331
331
|
if (t.hydrate) {
|
|
332
332
|
const p = Ut(t.target);
|
|
333
333
|
h.fragment && h.fragment.l(p), p.forEach(U);
|
|
334
334
|
} else
|
|
335
335
|
h.fragment && h.fragment.c();
|
|
336
|
-
t.intro &&
|
|
336
|
+
t.intro && X(n.$$.fragment), vt(n, t.target, t.anchor), pt();
|
|
337
337
|
}
|
|
338
|
-
|
|
338
|
+
O(d);
|
|
339
339
|
}
|
|
340
340
|
class kt {
|
|
341
341
|
constructor() {
|
|
@@ -343,7 +343,7 @@ class kt {
|
|
|
343
343
|
}
|
|
344
344
|
/** @returns {void} */
|
|
345
345
|
$destroy() {
|
|
346
|
-
Ct(this, 1), this.$destroy =
|
|
346
|
+
Ct(this, 1), this.$destroy = Y;
|
|
347
347
|
}
|
|
348
348
|
/**
|
|
349
349
|
* @template {Extract<keyof Events, string>} K
|
|
@@ -352,8 +352,8 @@ class kt {
|
|
|
352
352
|
* @returns {() => void}
|
|
353
353
|
*/
|
|
354
354
|
$on(t, e) {
|
|
355
|
-
if (!
|
|
356
|
-
return
|
|
355
|
+
if (!F(e))
|
|
356
|
+
return Y;
|
|
357
357
|
const s = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
|
|
358
358
|
return s.push(e), () => {
|
|
359
359
|
const r = s.indexOf(e);
|
|
@@ -365,26 +365,26 @@ class kt {
|
|
|
365
365
|
* @returns {void}
|
|
366
366
|
*/
|
|
367
367
|
$set(t) {
|
|
368
|
-
this.$$set && !
|
|
368
|
+
this.$$set && !Nt(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
|
-
const
|
|
372
|
-
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(
|
|
371
|
+
const Xt = "4";
|
|
372
|
+
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(Xt);
|
|
373
373
|
function te(n) {
|
|
374
374
|
let t, e, s, r = (
|
|
375
375
|
/*title*/
|
|
376
376
|
(n[1] || "标题") + ""
|
|
377
|
-
), a, o, l, d, h,
|
|
377
|
+
), a, o, l, d, h, g, p = (
|
|
378
378
|
/*cancelText*/
|
|
379
379
|
(n[4] || "取消") + ""
|
|
380
|
-
),
|
|
380
|
+
), f, y, c, m = (
|
|
381
381
|
/*okText*/
|
|
382
382
|
(n[5] || "确认") + ""
|
|
383
383
|
), k, C, v, D;
|
|
384
384
|
const A = (
|
|
385
385
|
/*#slots*/
|
|
386
386
|
n[8].default
|
|
387
|
-
), w =
|
|
387
|
+
), w = Ft(
|
|
388
388
|
A,
|
|
389
389
|
n,
|
|
390
390
|
/*$$scope*/
|
|
@@ -393,7 +393,7 @@ function te(n) {
|
|
|
393
393
|
);
|
|
394
394
|
return {
|
|
395
395
|
c() {
|
|
396
|
-
t =
|
|
396
|
+
t = I("div"), e = I("div"), s = I("div"), a = $(r), o = j(), l = I("div"), w && w.c(), d = j(), h = I("div"), g = I("button"), f = $(p), y = j(), c = I("button"), k = $(m), x(s, "class", "model-title svelte-oivou"), x(l, "class", "slot svelte-oivou"), x(g, "class", "modal-btn svelte-oivou"), x(c, "class", "modal-btn success svelte-oivou"), ot(
|
|
397
397
|
c,
|
|
398
398
|
"background-color",
|
|
399
399
|
/*theme*/
|
|
@@ -401,22 +401,22 @@ function te(n) {
|
|
|
401
401
|
), x(h, "class", "modal-footer svelte-oivou"), x(e, "class", "modal-content svelte-oivou"), x(t, "class", "modal-background modal-visible svelte-oivou");
|
|
402
402
|
},
|
|
403
403
|
m(S, E) {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
404
|
+
W(S, t, E), b(t, e), b(e, s), b(s, a), b(e, o), b(e, l), w && w.m(l, null), b(e, d), b(e, h), b(h, g), b(g, f), b(h, y), b(h, c), b(c, k), C = !0, v || (D = [
|
|
405
|
+
N(g, "click", function() {
|
|
406
|
+
F(
|
|
407
407
|
/*onCancel*/
|
|
408
408
|
n[0]
|
|
409
409
|
) && n[0].apply(this, arguments);
|
|
410
410
|
}),
|
|
411
|
-
|
|
412
|
-
|
|
411
|
+
N(c, "click", function() {
|
|
412
|
+
F(
|
|
413
413
|
/*onOk*/
|
|
414
414
|
n[2]
|
|
415
415
|
) && n[2].apply(this, arguments);
|
|
416
416
|
}),
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
417
|
+
N(e, "click", ee),
|
|
418
|
+
N(t, "click", function() {
|
|
419
|
+
F(
|
|
420
420
|
/*onClose*/
|
|
421
421
|
n[3]
|
|
422
422
|
) && n[3].apply(this, arguments);
|
|
@@ -427,13 +427,13 @@ function te(n) {
|
|
|
427
427
|
n = S, (!C || E & /*title*/
|
|
428
428
|
2) && r !== (r = /*title*/
|
|
429
429
|
(n[1] || "标题") + "") && M(a, r), w && w.p && (!C || E & /*$$scope*/
|
|
430
|
-
128) &&
|
|
430
|
+
128) && Ot(
|
|
431
431
|
w,
|
|
432
432
|
A,
|
|
433
433
|
n,
|
|
434
434
|
/*$$scope*/
|
|
435
435
|
n[7],
|
|
436
|
-
C ?
|
|
436
|
+
C ? jt(
|
|
437
437
|
A,
|
|
438
438
|
/*$$scope*/
|
|
439
439
|
n[7],
|
|
@@ -446,7 +446,7 @@ function te(n) {
|
|
|
446
446
|
null
|
|
447
447
|
), (!C || E & /*cancelText*/
|
|
448
448
|
16) && p !== (p = /*cancelText*/
|
|
449
|
-
(n[4] || "取消") + "") && M(
|
|
449
|
+
(n[4] || "取消") + "") && M(f, p), (!C || E & /*okText*/
|
|
450
450
|
32) && m !== (m = /*okText*/
|
|
451
451
|
(n[5] || "确认") + "") && M(k, m), (!C || E & /*theme*/
|
|
452
452
|
64) && ot(
|
|
@@ -457,7 +457,7 @@ function te(n) {
|
|
|
457
457
|
);
|
|
458
458
|
},
|
|
459
459
|
i(S) {
|
|
460
|
-
C || (
|
|
460
|
+
C || (X(w, S), C = !0);
|
|
461
461
|
},
|
|
462
462
|
o(S) {
|
|
463
463
|
mt(w, S), C = !1;
|
|
@@ -469,14 +469,14 @@ function te(n) {
|
|
|
469
469
|
}
|
|
470
470
|
const ee = (n) => n.stopPropagation();
|
|
471
471
|
function ne(n, t, e) {
|
|
472
|
-
let { $$slots: s = {}, $$scope: r } = t, { onCancel: a } = t, { title: o } = t, { onOk: l } = t, { onClose: d } = t, { cancelText: h } = t, { okText:
|
|
473
|
-
return n.$$set = (
|
|
474
|
-
"onCancel" in
|
|
475
|
-
}, [a, o, l, d, h,
|
|
472
|
+
let { $$slots: s = {}, $$scope: r } = t, { onCancel: a } = t, { title: o } = t, { onOk: l } = t, { onClose: d } = t, { cancelText: h } = t, { okText: g } = t, { theme: p } = t;
|
|
473
|
+
return n.$$set = (f) => {
|
|
474
|
+
"onCancel" in f && e(0, a = f.onCancel), "title" in f && e(1, o = f.title), "onOk" in f && e(2, l = f.onOk), "onClose" in f && e(3, d = f.onClose), "cancelText" in f && e(4, h = f.cancelText), "okText" in f && e(5, g = f.okText), "theme" in f && e(6, p = f.theme), "$$scope" in f && e(7, r = f.$$scope);
|
|
475
|
+
}, [a, o, l, d, h, g, p, r, s];
|
|
476
476
|
}
|
|
477
477
|
class se extends kt {
|
|
478
478
|
constructor(t) {
|
|
479
|
-
super(), wt(this, t, ne, te,
|
|
479
|
+
super(), wt(this, t, ne, te, gt, {
|
|
480
480
|
onCancel: 0,
|
|
481
481
|
title: 1,
|
|
482
482
|
onOk: 2,
|
|
@@ -498,10 +498,10 @@ function dt(n) {
|
|
|
498
498
|
), r, a, o, l = (
|
|
499
499
|
/*item*/
|
|
500
500
|
n[11].DevClass + ""
|
|
501
|
-
), d, h,
|
|
501
|
+
), d, h, g = (
|
|
502
502
|
/*item*/
|
|
503
503
|
n[11].sn + ""
|
|
504
|
-
), p,
|
|
504
|
+
), p, f, y, c, m, k;
|
|
505
505
|
function C() {
|
|
506
506
|
return (
|
|
507
507
|
/*click_handler*/
|
|
@@ -513,13 +513,13 @@ function dt(n) {
|
|
|
513
513
|
}
|
|
514
514
|
return {
|
|
515
515
|
c() {
|
|
516
|
-
t =
|
|
516
|
+
t = I("div"), e = I("span"), r = $(s), a = j(), o = I("span"), d = $(l), h = $("("), p = $(g), f = $(")"), y = j(), x(e, "class", "svelte-jtc2v4"), x(o, "class", "svelte-jtc2v4"), x(t, "class", c = at(`cert-item ${/*index*/
|
|
517
517
|
n[13] === 0 ? "cert-item-first" : ""} ${/*index*/
|
|
518
518
|
n[13] === /*selectedIndex*/
|
|
519
519
|
n[5] ? "cert-item-selected" : ""}`) + " svelte-jtc2v4");
|
|
520
520
|
},
|
|
521
521
|
m(v, D) {
|
|
522
|
-
|
|
522
|
+
W(v, t, D), b(t, e), b(e, r), b(t, a), b(t, o), b(o, d), b(o, h), b(o, p), b(o, f), b(t, y), m || (k = N(t, "click", C), m = !0);
|
|
523
523
|
},
|
|
524
524
|
p(v, D) {
|
|
525
525
|
n = v, D & /*certList*/
|
|
@@ -527,8 +527,8 @@ function dt(n) {
|
|
|
527
527
|
n[11].CN + "") && M(r, s), D & /*certList*/
|
|
528
528
|
1 && l !== (l = /*item*/
|
|
529
529
|
n[11].DevClass + "") && M(d, l), D & /*certList*/
|
|
530
|
-
1 &&
|
|
531
|
-
n[11].sn + "") && M(p,
|
|
530
|
+
1 && g !== (g = /*item*/
|
|
531
|
+
n[11].sn + "") && M(p, g), D & /*selectedIndex*/
|
|
532
532
|
32 && c !== (c = at(`cert-item ${/*index*/
|
|
533
533
|
n[13] === 0 ? "cert-item-first" : ""} ${/*index*/
|
|
534
534
|
n[13] === /*selectedIndex*/
|
|
@@ -555,7 +555,7 @@ function re(n) {
|
|
|
555
555
|
m(r, a) {
|
|
556
556
|
for (let o = 0; o < s.length; o += 1)
|
|
557
557
|
s[o] && s[o].m(r, a);
|
|
558
|
-
|
|
558
|
+
W(r, t, a);
|
|
559
559
|
},
|
|
560
560
|
p(r, a) {
|
|
561
561
|
if (a & /*selectedIndex, certList*/
|
|
@@ -613,7 +613,7 @@ function ae(n) {
|
|
|
613
613
|
}
|
|
614
614
|
}), {
|
|
615
615
|
c() {
|
|
616
|
-
|
|
616
|
+
Wt(t.$$.fragment);
|
|
617
617
|
},
|
|
618
618
|
m(s, r) {
|
|
619
619
|
vt(t, s, r), e = !0;
|
|
@@ -632,7 +632,7 @@ function ae(n) {
|
|
|
632
632
|
16417 && (a.$$scope = { dirty: r, ctx: s }), t.$set(a);
|
|
633
633
|
},
|
|
634
634
|
i(s) {
|
|
635
|
-
e || (
|
|
635
|
+
e || (X(t.$$.fragment, s), e = !0);
|
|
636
636
|
},
|
|
637
637
|
o(s) {
|
|
638
638
|
mt(t.$$.fragment, s), e = !1;
|
|
@@ -643,12 +643,12 @@ function ae(n) {
|
|
|
643
643
|
};
|
|
644
644
|
}
|
|
645
645
|
function oe(n, t, e) {
|
|
646
|
-
let { certList: s = [] } = t, { onCancel: r } = t, { onOk: a } = t, { onClose: o } = t, { cancelText: l = "" } = t, { okText: d = "" } = t, { theme: h = "#409eff" } = t,
|
|
646
|
+
let { certList: s = [] } = t, { onCancel: r } = t, { onOk: a } = t, { onClose: o } = t, { cancelText: l = "" } = t, { okText: d = "" } = t, { theme: h = "#409eff" } = t, g = 0;
|
|
647
647
|
const p = () => {
|
|
648
648
|
r("未选择证书"), o == null || o();
|
|
649
|
-
},
|
|
650
|
-
a == null || a(s[
|
|
651
|
-
}, y = (c) => e(5,
|
|
649
|
+
}, f = () => {
|
|
650
|
+
a == null || a(s[g]), o == null || o();
|
|
651
|
+
}, y = (c) => e(5, g = c);
|
|
652
652
|
return n.$$set = (c) => {
|
|
653
653
|
"certList" in c && e(0, s = c.certList), "onCancel" in c && e(8, r = c.onCancel), "onOk" in c && e(9, a = c.onOk), "onClose" in c && e(1, o = c.onClose), "cancelText" in c && e(2, l = c.cancelText), "okText" in c && e(3, d = c.okText), "theme" in c && e(4, h = c.theme);
|
|
654
654
|
}, [
|
|
@@ -657,9 +657,9 @@ function oe(n, t, e) {
|
|
|
657
657
|
l,
|
|
658
658
|
d,
|
|
659
659
|
h,
|
|
660
|
-
f,
|
|
661
|
-
p,
|
|
662
660
|
g,
|
|
661
|
+
p,
|
|
662
|
+
f,
|
|
663
663
|
r,
|
|
664
664
|
a,
|
|
665
665
|
y
|
|
@@ -667,7 +667,7 @@ function oe(n, t, e) {
|
|
|
667
667
|
}
|
|
668
668
|
class ie extends kt {
|
|
669
669
|
constructor(t) {
|
|
670
|
-
super(), wt(this, t, oe, ae,
|
|
670
|
+
super(), wt(this, t, oe, ae, gt, {
|
|
671
671
|
certList: 0,
|
|
672
672
|
onCancel: 8,
|
|
673
673
|
onOk: 9,
|
|
@@ -684,7 +684,7 @@ class ce {
|
|
|
684
684
|
i(this, "open", (t) => new Promise((e, s) => {
|
|
685
685
|
this.modalInstance.current = new ie({
|
|
686
686
|
target: document.body,
|
|
687
|
-
props:
|
|
687
|
+
props: L(B({}, t), {
|
|
688
688
|
onCancel: (r) => {
|
|
689
689
|
s({
|
|
690
690
|
code: -1,
|
|
@@ -728,7 +728,7 @@ class ue {
|
|
|
728
728
|
i(this, "sendMessage", (t, e) => new Promise((s, r) => {
|
|
729
729
|
var o, l;
|
|
730
730
|
if (((o = this.socketInstance) == null ? void 0 : o.readyState) !== WebSocket.OPEN) {
|
|
731
|
-
|
|
731
|
+
r({
|
|
732
732
|
errCode: -1,
|
|
733
733
|
msg: "socket未连接"
|
|
734
734
|
});
|
|
@@ -745,13 +745,13 @@ class ue {
|
|
|
745
745
|
i(this, "handleEventData", (t) => u(this, null, function* () {
|
|
746
746
|
var e, s, r, a, o, l;
|
|
747
747
|
if (t.data instanceof Blob) {
|
|
748
|
-
const d = yield t.data.arrayBuffer(),
|
|
748
|
+
const d = yield t.data.arrayBuffer(), g = new TextDecoder("gbk").decode(d), p = JSON.parse(g), f = {
|
|
749
749
|
data: p.data,
|
|
750
750
|
success: (e = p.result) == null ? void 0 : e.success,
|
|
751
751
|
msg: (s = p.result) == null ? void 0 : s.msg,
|
|
752
752
|
errCode: (r = p.result) == null ? void 0 : r.errCode
|
|
753
753
|
};
|
|
754
|
-
this.eventBus.emit((a = p.result) == null ? void 0 : a.function,
|
|
754
|
+
this.eventBus.emit((a = p.result) == null ? void 0 : a.function, f), (l = (o = this.socketConfig) == null ? void 0 : o.onMessage) == null || l.call(o, f);
|
|
755
755
|
}
|
|
756
756
|
}));
|
|
757
757
|
i(this, "base64Encode", (t) => {
|
|
@@ -923,14 +923,14 @@ const H = class H {
|
|
|
923
923
|
i(this, "coreInstance", null);
|
|
924
924
|
i(this, "gwsConfig", {});
|
|
925
925
|
i(this, "createGwsCore", (t) => {
|
|
926
|
-
this.gwsConfig = t != null ? t : {}, this.coreInstance = new ue(
|
|
927
|
-
url:
|
|
926
|
+
this.gwsConfig = t != null ? t : {}, this.coreInstance = new ue(L(B({}, t != null ? t : {}), {
|
|
927
|
+
url: It
|
|
928
928
|
}));
|
|
929
929
|
});
|
|
930
930
|
i(this, "appendCertBase64", (t, e = !0) => u(this, null, function* () {
|
|
931
931
|
if (t.CertB64) return t;
|
|
932
932
|
const s = e ? yield this.getSignatureCert() : yield this.getEncryptionCert();
|
|
933
|
-
return
|
|
933
|
+
return L(B({}, t != null ? t : {}), { CertB64: s == null ? void 0 : s.CertB64 });
|
|
934
934
|
}));
|
|
935
935
|
i(this, "destroy", () => {
|
|
936
936
|
var t;
|
|
@@ -946,7 +946,7 @@ const H = class H {
|
|
|
946
946
|
i(this, "getSignatureCert", (t) => u(this, null, function* () {
|
|
947
947
|
var s;
|
|
948
948
|
return yield (s = this.coreInstance) == null ? void 0 : s.getCert(
|
|
949
|
-
{ CertType:
|
|
949
|
+
{ CertType: $t },
|
|
950
950
|
t
|
|
951
951
|
);
|
|
952
952
|
}));
|
|
@@ -975,8 +975,9 @@ const H = class H {
|
|
|
975
975
|
});
|
|
976
976
|
i(this, "pkcs1Sign", (t, e) => u(this, null, function* () {
|
|
977
977
|
var a, o, l;
|
|
978
|
-
const s = yield this.getSignatureCert(e), r = yield (o = this.coreInstance) == null ? void 0 : o.pkcs1Sign(
|
|
979
|
-
ContainerName: (a = s == null ? void 0 : s.ContainerName) != null ? a : ""
|
|
978
|
+
const s = yield this.getSignatureCert(e), r = yield (o = this.coreInstance) == null ? void 0 : o.pkcs1Sign(L(B({}, t != null ? t : {}), {
|
|
979
|
+
ContainerName: (a = s == null ? void 0 : s.ContainerName) != null ? a : "",
|
|
980
|
+
IsLogin: e ? "Y" : "N"
|
|
980
981
|
}));
|
|
981
982
|
return (l = r == null ? void 0 : r[0]) == null ? void 0 : l.SignData;
|
|
982
983
|
}));
|
|
@@ -986,12 +987,13 @@ const H = class H {
|
|
|
986
987
|
return Array.isArray(s);
|
|
987
988
|
}));
|
|
988
989
|
i(this, "pkcs1Base64Sign", (t, e) => u(this, null, function* () {
|
|
989
|
-
var o, l, d, h,
|
|
990
|
+
var o, l, d, h, g;
|
|
990
991
|
const s = yield this.getSignatureCert(e), r = (l = t.DataB64) != null ? l : this.base64Encode({ Data: (o = t.Data) != null ? o : "" }), a = yield (h = this.coreInstance) == null ? void 0 : h.pkcs1Base64Sign({
|
|
991
992
|
ContainerName: (d = s == null ? void 0 : s.ContainerName) != null ? d : "",
|
|
992
|
-
DataB64: r
|
|
993
|
+
DataB64: r,
|
|
994
|
+
IsLogin: e ? "Y" : "N"
|
|
993
995
|
});
|
|
994
|
-
return (
|
|
996
|
+
return (g = a == null ? void 0 : a[0]) == null ? void 0 : g.SignData;
|
|
995
997
|
}));
|
|
996
998
|
i(this, "pkcs1Base64VerifySignature", (t) => u(this, null, function* () {
|
|
997
999
|
var a, o, l;
|
|
@@ -1002,14 +1004,15 @@ const H = class H {
|
|
|
1002
1004
|
SignData: s.SignData
|
|
1003
1005
|
}));
|
|
1004
1006
|
}));
|
|
1005
|
-
i(this, "getSealList", () => u(this, null, function* () {
|
|
1006
|
-
var
|
|
1007
|
-
const
|
|
1008
|
-
ContainerName: (
|
|
1007
|
+
i(this, "getSealList", (t) => u(this, null, function* () {
|
|
1008
|
+
var r, a;
|
|
1009
|
+
const e = yield this.getSignatureCert(t), s = yield (a = this.coreInstance) == null ? void 0 : a.getSealList({
|
|
1010
|
+
ContainerName: (r = e == null ? void 0 : e.ContainerName) != null ? r : "",
|
|
1011
|
+
IsLogin: t ? "Y" : "N"
|
|
1009
1012
|
});
|
|
1010
1013
|
return {
|
|
1011
|
-
cert:
|
|
1012
|
-
sealList:
|
|
1014
|
+
cert: e,
|
|
1015
|
+
sealList: s
|
|
1013
1016
|
};
|
|
1014
1017
|
}));
|
|
1015
1018
|
i(this, "sm2SignPreprocess1", (t) => u(this, null, function* () {
|
|
@@ -1030,25 +1033,27 @@ const H = class H {
|
|
|
1030
1033
|
const s = yield this.getSignatureCert(e), r = yield (l = this.coreInstance) == null ? void 0 : l.pkcs1HashSign({
|
|
1031
1034
|
ContainerName: (a = s == null ? void 0 : s.ContainerName) != null ? a : "",
|
|
1032
1035
|
DataB64: t.DataB64,
|
|
1033
|
-
HashAlg: (o = t.HashAlg) != null ? o : "sm3"
|
|
1036
|
+
HashAlg: (o = t.HashAlg) != null ? o : "sm3",
|
|
1037
|
+
IsLogin: e ? "Y" : "N"
|
|
1034
1038
|
});
|
|
1035
1039
|
return (d = r == null ? void 0 : r[0]) == null ? void 0 : d.SignData;
|
|
1036
1040
|
}));
|
|
1037
1041
|
i(this, "pkcs1HashVerifySignature", (t) => u(this, null, function* () {
|
|
1038
1042
|
var r, a;
|
|
1039
1043
|
const e = yield this.appendCertBase64(t);
|
|
1040
|
-
return !!(yield (a = this.coreInstance) == null ? void 0 : a.pkcs1HashVerifySignature(
|
|
1044
|
+
return !!(yield (a = this.coreInstance) == null ? void 0 : a.pkcs1HashVerifySignature(L(B({}, e), {
|
|
1041
1045
|
HashAlg: (r = e.HashAlg) != null ? r : "sm3"
|
|
1042
1046
|
})));
|
|
1043
1047
|
}));
|
|
1044
1048
|
i(this, "pkcs7Sign", (t, e) => u(this, null, function* () {
|
|
1045
|
-
var o, l, d, h,
|
|
1049
|
+
var o, l, d, h, g;
|
|
1046
1050
|
const s = (l = t.DataB64) != null ? l : this.base64Encode({ Data: (o = t.Data) != null ? o : "" }), r = yield this.getSignatureCert(e), a = yield (h = this.coreInstance) == null ? void 0 : h.pkcs7Sign({
|
|
1047
1051
|
IsDetached: t.IsDetached,
|
|
1048
1052
|
ContainerName: (d = r == null ? void 0 : r.ContainerName) != null ? d : "",
|
|
1049
|
-
DataB64: s
|
|
1053
|
+
DataB64: s,
|
|
1054
|
+
IsLogin: e ? "Y" : "N"
|
|
1050
1055
|
});
|
|
1051
|
-
return (
|
|
1056
|
+
return (g = a == null ? void 0 : a[0]) == null ? void 0 : g.SignData;
|
|
1052
1057
|
}));
|
|
1053
1058
|
i(this, "pkcs7VerifySignature", (t) => u(this, null, function* () {
|
|
1054
1059
|
var r, a, o;
|
|
@@ -1074,13 +1079,13 @@ const H = class H {
|
|
|
1074
1079
|
return (r = e == null ? void 0 : e[0]) == null ? void 0 : r.HashB64;
|
|
1075
1080
|
}));
|
|
1076
1081
|
i(this, "sm3HashEncryption", (t) => u(this, null, function* () {
|
|
1077
|
-
var a, o, l, d, h,
|
|
1082
|
+
var a, o, l, d, h, g;
|
|
1078
1083
|
const e = (o = t.DataB64) != null ? o : this.base64Encode({ Data: (a = t.Data) != null ? a : "" }), s = (d = t.KeyB64) != null ? d : this.base64Encode({ Data: (l = t.Key) != null ? l : "" }), r = yield (h = this.coreInstance) == null ? void 0 : h.sm3HashEncryption({
|
|
1079
1084
|
dataB64: e,
|
|
1080
1085
|
keyB64: s,
|
|
1081
1086
|
alg: "sm3"
|
|
1082
1087
|
});
|
|
1083
|
-
return (
|
|
1088
|
+
return (g = r == null ? void 0 : r[0]) == null ? void 0 : g.DataB64;
|
|
1084
1089
|
}));
|
|
1085
1090
|
i(this, "pkcs7Encryption", (t) => u(this, null, function* () {
|
|
1086
1091
|
var r, a, o, l;
|
|
@@ -1107,13 +1112,14 @@ const H = class H {
|
|
|
1107
1112
|
const e = yield this.appendCertBase64(t, !1), s = yield (r = this.coreInstance) == null ? void 0 : r.asymmetricEncryption(e);
|
|
1108
1113
|
return (a = s == null ? void 0 : s[0]) == null ? void 0 : a.Data;
|
|
1109
1114
|
}));
|
|
1110
|
-
i(this, "asymmetricDecryption", (t) => u(this, null, function* () {
|
|
1111
|
-
var
|
|
1112
|
-
const
|
|
1115
|
+
i(this, "asymmetricDecryption", (t, e) => u(this, null, function* () {
|
|
1116
|
+
var a, o;
|
|
1117
|
+
const s = yield this.getEncryptionCert(e), r = yield (a = this.coreInstance) == null ? void 0 : a.asymmetricDecryption({
|
|
1113
1118
|
Data: t.Data,
|
|
1114
|
-
ContainerName:
|
|
1119
|
+
ContainerName: s == null ? void 0 : s.ContainerName,
|
|
1120
|
+
IsLogin: e ? "Y" : "N"
|
|
1115
1121
|
});
|
|
1116
|
-
return (
|
|
1122
|
+
return (o = r == null ? void 0 : r[0]) == null ? void 0 : o.Data;
|
|
1117
1123
|
}));
|
|
1118
1124
|
i(this, "sm4Encryption", (t) => u(this, null, function* () {
|
|
1119
1125
|
var s;
|
|
@@ -1145,7 +1151,7 @@ function he(n) {
|
|
|
1145
1151
|
if (Z.instance && !(n != null && n.isCreateNew))
|
|
1146
1152
|
t(Z.instance);
|
|
1147
1153
|
else {
|
|
1148
|
-
const s = new Z(
|
|
1154
|
+
const s = new Z(L(B({}, n != null ? n : {}), {
|
|
1149
1155
|
onOpen(r) {
|
|
1150
1156
|
var a;
|
|
1151
1157
|
t(s), (a = n == null ? void 0 : n.onOpen) == null || a.call(n, r);
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(B,w){typeof exports=="object"&&typeof module!="undefined"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(B=typeof globalThis!="undefined"?globalThis:B||self,w(B.GWS_CLIENT={}))})(this,function(B){"use strict";var ct=Object.defineProperty,lt=Object.defineProperties;var ut=Object.getOwnPropertyDescriptors;var Ie=Object.getOwnPropertySymbols;var dt=Object.prototype.hasOwnProperty,ht=Object.prototype.propertyIsEnumerable;var ce=(B,w,x)=>w in B?ct(B,w,{enumerable:!0,configurable:!0,writable:!0,value:x}):B[w]=x,$=(B,w)=>{for(var x in w||(w={}))dt.call(w,x)&&ce(B,x,w[x]);if(Ie)for(var x of Ie(w))ht.call(w,x)&&ce(B,x,w[x]);return B},H=(B,w)=>lt(B,ut(w));var i=(B,w,x)=>ce(B,typeof w!="symbol"?w+"":w,x);var l=(B,w,x)=>new Promise((X,V)=>{var Y=E=>{try{P(x.next(E))}catch(R){V(R)}},ee=E=>{try{P(x.throw(E))}catch(R){V(R)}},P=E=>E.done?X(E.value):Promise.resolve(E.value).then(Y,ee);P((x=x.apply(B,w)).next())});const w=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",x="1",X="2";var V=(n=>(n[n.MIN=0]="MIN",n[n.LOW=1]="LOW",n[n.MIDDLE=2]="MIDDLE",n[n.HIGH=3]="HIGH",n))(V||{});const Y="00000001";function ee(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var P={},E;function R(){if(E)return P;E=1,P.byteLength=u,P.toByteArray=d,P.fromByteArray=g;for(var n=[],e=[],t=typeof Uint8Array!="undefined"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,a=s.length;r<a;++r)n[r]=s[r],e[s.charCodeAt(r)]=r;e[45]=62,e[95]=63;function o(h){var c=h.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var m=h.indexOf("=");m===-1&&(m=c);var D=m===c?0:4-m%4;return[m,D]}function u(h){var c=o(h),m=c[0],D=c[1];return(m+D)*3/4-D}function y(h,c,m){return(c+m)*3/4-m}function d(h){var c,m=o(h),D=m[0],C=m[1],v=new t(y(h,D,C)),b=0,T=C>0?D-4:D,k;for(k=0;k<T;k+=4)c=e[h.charCodeAt(k)]<<18|e[h.charCodeAt(k+1)]<<12|e[h.charCodeAt(k+2)]<<6|e[h.charCodeAt(k+3)],v[b++]=c>>16&255,v[b++]=c>>8&255,v[b++]=c&255;return C===2&&(c=e[h.charCodeAt(k)]<<2|e[h.charCodeAt(k+1)]>>4,v[b++]=c&255),C===1&&(c=e[h.charCodeAt(k)]<<10|e[h.charCodeAt(k+1)]<<4|e[h.charCodeAt(k+2)]>>2,v[b++]=c>>8&255,v[b++]=c&255),v}function f(h){return n[h>>18&63]+n[h>>12&63]+n[h>>6&63]+n[h&63]}function p(h,c,m){for(var D,C=[],v=c;v<m;v+=3)D=(h[v]<<16&16711680)+(h[v+1]<<8&65280)+(h[v+2]&255),C.push(f(D));return C.join("")}function g(h){for(var c,m=h.length,D=m%3,C=[],v=16383,b=0,T=m-D;b<T;b+=v)C.push(p(h,b,b+v>T?T:b+v));return D===1?(c=h[m-1],C.push(n[c>>2]+n[c<<4&63]+"==")):D===2&&(c=(h[m-2]<<8)+h[m-1],C.push(n[c>>10]+n[c>>4&63]+n[c<<2&63]+"=")),C.join("")}return P}var Ee=R();const le=ee(Ee);class Ae{constructor(){i(this,"deps",new Map)}on(e,t){this.deps.set(e,t)}emit(e,t){const s=this.deps.get(e);s&&s(t)}}(function(){try{var n=document.createElement("style");n.appendChild(document.createTextNode("button.svelte-oivou{background-color:transparent;border:none;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;outline:none}.modal-background.svelte-oivou{display:none;position:fixed;z-index:10000;left:0;top:0;width:100%;height:100%;background-color:#00000080;align-items:center;justify-content:center}.modal-content.svelte-oivou{background-color:#fff;padding:1.42857rem;border-radius:.35714rem;width:40%}.model-title.svelte-oivou{color:#303133;font-size:1.28571rem;margin-bottom:1.14286rem}.modal-visible.svelte-oivou{display:flex}.modal-footer.svelte-oivou{display:flex;align-items:center;justify-content:flex-end;margin-top:1.14286rem}.modal-btn.svelte-oivou{padding:.57143rem 1.07143rem;border-radius:.28571rem;font-size:1rem;border:.07143rem solid #dcdfe6}.success.svelte-oivou{margin-left:.85714rem;color:#fff}.slot.svelte-oivou{max-height:14.28571rem;overflow-y:scroll}.slot.svelte-oivou::-webkit-scrollbar{display:none}.cert-item.svelte-jtc2v4.svelte-jtc2v4{padding:1.14286rem;display:flex;align-items:center;cursor:pointer;border-bottom:.07143rem solid #ebeef5;font-size:1rem}.cert-item-selected.svelte-jtc2v4.svelte-jtc2v4{background-color:#f1f1f1}.cert-item-first.svelte-jtc2v4.svelte-jtc2v4{border-top:.07143rem solid #ebeef5}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4{display:inline-block;color:#606266}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4:first-child{width:30%}.seal-wrapper.svelte-1w19fs3.svelte-1w19fs3{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.seal-item.svelte-1w19fs3.svelte-1w19fs3{width:12.85714rem;height:12.85714rem;display:flex;flex-direction:column;align-items:center;justify-content:center;border:.07143rem solid #ccc;margin-top:.71429rem;margin-right:.71429rem;border-radius:.28571rem}.seal-item.svelte-1w19fs3 img.svelte-1w19fs3{width:7.14286rem;height:7.14286rem}.seal-item-selected.svelte-1w19fs3.svelte-1w19fs3{background-color:#f1f1f1}.seal-name.svelte-1w19fs3.svelte-1w19fs3{margin-top:.71429rem;color:#333}")),document.head.appendChild(n)}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var _e=Object.defineProperty,Le=(n,e,t)=>e in n?_e(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ue=(n,e,t)=>Le(n,typeof e!="symbol"?e+"":e,t);function te(){}function Pe(n,e){for(const t in e)n[t]=e[t];return n}function de(n){return n()}function he(){return Object.create(null)}function U(n){n.forEach(de)}function J(n){return typeof n=="function"}function ye(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function Te(n){return Object.keys(n).length===0}function Me(n,e,t,s){if(n){const r=fe(n,e,t,s);return n[0](r)}}function fe(n,e,t,s){return n[1]&&s?Pe(t.ctx.slice(),n[1](s(e))):t.ctx}function He(n,e,t,s){if(n[2]&&s){const r=n[2](s(t));if(e.dirty===void 0)return r;if(typeof r=="object"){const a=[],o=Math.max(e.dirty.length,r.length);for(let u=0;u<o;u+=1)a[u]=e.dirty[u]|r[u];return a}return e.dirty|r}return e.dirty}function Ge(n,e,t,s,r,a){if(r){const o=fe(e,t,s,a);n.p(o,r)}}function je(n){if(n.ctx.length>32){const e=[],t=n.ctx.length/32;for(let s=0;s<t;s++)e[s]=-1;return e}return-1}function ge(n){return n!=null?n:""}function S(n,e){n.appendChild(e)}function ne(n,e,t){n.insertBefore(e,t||null)}function K(n){n.parentNode&&n.parentNode.removeChild(n)}function Fe(n,e){for(let t=0;t<n.length;t+=1)n[t]&&n[t].d(e)}function A(n){return document.createElement(n)}function _(n){return document.createTextNode(n)}function z(){return _(" ")}function Oe(){return _("")}function W(n,e,t,s){return n.addEventListener(e,t,s),()=>n.removeEventListener(e,t,s)}function I(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function Ne(n){return Array.from(n.childNodes)}function G(n,e){e=""+e,n.data!==e&&(n.data=e)}function pe(n,e,t,s){t==null?n.style.removeProperty(e):n.style.setProperty(e,t,"")}let se;function q(n){se=n}const j=[],me=[];let F=[];const ve=[],Ze=Promise.resolve();let re=!1;function Ve(){re||(re=!0,Ze.then(Ce))}function ae(n){F.push(n)}const oe=new Set;let O=0;function Ce(){if(O!==0)return;const n=se;do{try{for(;O<j.length;){const e=j[O];O++,q(e),Re(e.$$)}}catch(e){throw j.length=0,O=0,e}for(q(null),j.length=0,O=0;me.length;)me.pop()();for(let e=0;e<F.length;e+=1){const t=F[e];oe.has(t)||(oe.add(t),t())}F.length=0}while(j.length);for(;ve.length;)ve.pop()();re=!1,oe.clear(),q(n)}function Re(n){if(n.fragment!==null){n.update(),U(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(ae)}}function Ue(n){const e=[],t=[];F.forEach(s=>n.indexOf(s)===-1?e.push(s):t.push(s)),t.forEach(s=>s()),F=e}const Q=new Set;let Je;function ie(n,e){n&&n.i&&(Q.delete(n),n.i(e))}function we(n,e,t,s){if(n&&n.o){if(Q.has(n))return;Q.add(n),Je.c.push(()=>{Q.delete(n)}),n.o(e)}}function ke(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function ze(n){n&&n.c()}function De(n,e,t){const{fragment:s,after_update:r}=n.$$;s&&s.m(e,t),ae(()=>{const a=n.$$.on_mount.map(de).filter(J);n.$$.on_destroy?n.$$.on_destroy.push(...a):U(a),n.$$.on_mount=[]}),r.forEach(ae)}function be(n,e){const t=n.$$;t.fragment!==null&&(Ue(t.after_update),U(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function We(n,e){n.$$.dirty[0]===-1&&(j.push(n),Ve(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function Be(n,e,t,s,r,a,o=null,u=[-1]){const y=se;q(n);const d=n.$$={fragment:null,ctx:[],props:a,update:te,not_equal:r,bound:he(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(y?y.$$.context:[])),callbacks:he(),dirty:u,skip_bound:!1,root:e.target||y.$$.root};o&&o(d.root);let f=!1;if(d.ctx=t?t(n,e.props||{},(p,g,...h)=>{const c=h.length?h[0]:g;return d.ctx&&r(d.ctx[p],d.ctx[p]=c)&&(!d.skip_bound&&d.bound[p]&&d.bound[p](c),f&&We(n,p)),g}):[],d.update(),f=!0,U(d.before_update),d.fragment=s?s(d.ctx):!1,e.target){if(e.hydrate){const p=Ne(e.target);d.fragment&&d.fragment.l(p),p.forEach(K)}else d.fragment&&d.fragment.c();e.intro&&ie(n.$$.fragment),De(n,e.target,e.anchor),Ce()}q(y)}class Se{constructor(){ue(this,"$$"),ue(this,"$$set")}$destroy(){be(this,1),this.$destroy=te}$on(e,t){if(!J(t))return te;const s=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return s.push(t),()=>{const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}$set(e){this.$$set&&!Te(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const qe="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(qe);function Ke(n){let e,t,s,r=(n[1]||"标题")+"",a,o,u,y,d,f,p=(n[4]||"取消")+"",g,h,c,m=(n[5]||"确认")+"",D,C,v,b;const T=n[8].default,k=Me(T,n,n[7],null);return{c(){e=A("div"),t=A("div"),s=A("div"),a=_(r),o=z(),u=A("div"),k&&k.c(),y=z(),d=A("div"),f=A("button"),g=_(p),h=z(),c=A("button"),D=_(m),I(s,"class","model-title svelte-oivou"),I(u,"class","slot svelte-oivou"),I(f,"class","modal-btn svelte-oivou"),I(c,"class","modal-btn success svelte-oivou"),pe(c,"background-color",n[6]),I(d,"class","modal-footer svelte-oivou"),I(t,"class","modal-content svelte-oivou"),I(e,"class","modal-background modal-visible svelte-oivou")},m(L,M){ne(L,e,M),S(e,t),S(t,s),S(s,a),S(t,o),S(t,u),k&&k.m(u,null),S(t,y),S(t,d),S(d,f),S(f,g),S(d,h),S(d,c),S(c,D),C=!0,v||(b=[W(f,"click",function(){J(n[0])&&n[0].apply(this,arguments)}),W(c,"click",function(){J(n[2])&&n[2].apply(this,arguments)}),W(t,"click",Qe),W(e,"click",function(){J(n[3])&&n[3].apply(this,arguments)})],v=!0)},p(L,[M]){n=L,(!C||M&2)&&r!==(r=(n[1]||"标题")+"")&&G(a,r),k&&k.p&&(!C||M&128)&&Ge(k,T,n,n[7],C?He(T,n[7],M,null):je(n[7]),null),(!C||M&16)&&p!==(p=(n[4]||"取消")+"")&&G(g,p),(!C||M&32)&&m!==(m=(n[5]||"确认")+"")&&G(D,m),(!C||M&64)&&pe(c,"background-color",n[6])},i(L){C||(ie(k,L),C=!0)},o(L){we(k,L),C=!1},d(L){L&&K(e),k&&k.d(L),v=!1,U(b)}}}const Qe=n=>n.stopPropagation();function Xe(n,e,t){let{$$slots:s={},$$scope:r}=e,{onCancel:a}=e,{title:o}=e,{onOk:u}=e,{onClose:y}=e,{cancelText:d}=e,{okText:f}=e,{theme:p}=e;return n.$$set=g=>{"onCancel"in g&&t(0,a=g.onCancel),"title"in g&&t(1,o=g.title),"onOk"in g&&t(2,u=g.onOk),"onClose"in g&&t(3,y=g.onClose),"cancelText"in g&&t(4,d=g.cancelText),"okText"in g&&t(5,f=g.okText),"theme"in g&&t(6,p=g.theme),"$$scope"in g&&t(7,r=g.$$scope)},[a,o,u,y,d,f,p,r,s]}class Ye extends Se{constructor(e){super(),Be(this,e,Xe,Ke,ye,{onCancel:0,title:1,onOk:2,onClose:3,cancelText:4,okText:5,theme:6})}}function xe(n,e,t){const s=n.slice();return s[11]=e[t],s[13]=t,s}function $e(n){let e,t,s=n[11].CN+"",r,a,o,u=n[11].DevClass+"",y,d,f=n[11].sn+"",p,g,h,c,m,D;function C(){return n[10](n[13])}return{c(){e=A("div"),t=A("span"),r=_(s),a=z(),o=A("span"),y=_(u),d=_("("),p=_(f),g=_(")"),h=z(),I(t,"class","svelte-jtc2v4"),I(o,"class","svelte-jtc2v4"),I(e,"class",c=ge(`cert-item ${n[13]===0?"cert-item-first":""} ${n[13]===n[5]?"cert-item-selected":""}`)+" svelte-jtc2v4")},m(v,b){ne(v,e,b),S(e,t),S(t,r),S(e,a),S(e,o),S(o,y),S(o,d),S(o,p),S(o,g),S(e,h),m||(D=W(e,"click",C),m=!0)},p(v,b){n=v,b&1&&s!==(s=n[11].CN+"")&&G(r,s),b&1&&u!==(u=n[11].DevClass+"")&&G(y,u),b&1&&f!==(f=n[11].sn+"")&&G(p,f),b&32&&c!==(c=ge(`cert-item ${n[13]===0?"cert-item-first":""} ${n[13]===n[5]?"cert-item-selected":""}`)+" svelte-jtc2v4")&&I(e,"class",c)},d(v){v&&K(e),m=!1,D()}}}function et(n){let e,t=ke(n[0]),s=[];for(let r=0;r<t.length;r+=1)s[r]=$e(xe(n,t,r));return{c(){for(let r=0;r<s.length;r+=1)s[r].c();e=Oe()},m(r,a){for(let o=0;o<s.length;o+=1)s[o]&&s[o].m(r,a);ne(r,e,a)},p(r,a){if(a&33){t=ke(r[0]);let o;for(o=0;o<t.length;o+=1){const u=xe(r,t,o);s[o]?s[o].p(u,a):(s[o]=$e(u),s[o].c(),s[o].m(e.parentNode,e))}for(;o<s.length;o+=1)s[o].d(1);s.length=t.length}},d(r){r&&K(e),Fe(s,r)}}}function tt(n){let e,t;return e=new Ye({props:{onOk:n[7],onClose:n[1],onCancel:n[6],cancelText:n[2],okText:n[3],title:"选择证书",theme:n[4],$$slots:{default:[et]},$$scope:{ctx:n}}}),{c(){ze(e.$$.fragment)},m(s,r){De(e,s,r),t=!0},p(s,[r]){const a={};r&2&&(a.onClose=s[1]),r&4&&(a.cancelText=s[2]),r&8&&(a.okText=s[3]),r&16&&(a.theme=s[4]),r&16417&&(a.$$scope={dirty:r,ctx:s}),e.$set(a)},i(s){t||(ie(e.$$.fragment,s),t=!0)},o(s){we(e.$$.fragment,s),t=!1},d(s){be(e,s)}}}function nt(n,e,t){let{certList:s=[]}=e,{onCancel:r}=e,{onOk:a}=e,{onClose:o}=e,{cancelText:u=""}=e,{okText:y=""}=e,{theme:d="#409eff"}=e,f=0;const p=()=>{r("未选择证书"),o==null||o()},g=()=>{a==null||a(s[f]),o==null||o()},h=c=>t(5,f=c);return n.$$set=c=>{"certList"in c&&t(0,s=c.certList),"onCancel"in c&&t(8,r=c.onCancel),"onOk"in c&&t(9,a=c.onOk),"onClose"in c&&t(1,o=c.onClose),"cancelText"in c&&t(2,u=c.cancelText),"okText"in c&&t(3,y=c.okText),"theme"in c&&t(4,d=c.theme)},[s,o,u,y,d,f,p,g,r,a,h]}class st extends Se{constructor(e){super(),Be(this,e,nt,tt,ye,{certList:0,onCancel:8,onOk:9,onClose:1,cancelText:2,okText:3,theme:4})}}class rt{constructor(){i(this,"modalInstance",{current:null});i(this,"open",e=>new Promise((t,s)=>{this.modalInstance.current=new st({target:document.body,props:H($({},e),{onCancel:r=>{s({code:-1,msg:r})},onOk:r=>{t(r)},onClose:()=>{this.close()}})})}));i(this,"close",()=>{setTimeout(()=>{var e;(e=this.modalInstance.current)==null||e.$destroy()})})}}const at=new rt;class ot{constructor(e){i(this,"socketInstance",null);i(this,"eventBus",new Ae);i(this,"isRememberPin",!1);i(this,"socketEvent");i(this,"pinPolicy");i(this,"socketConfig",null);i(this,"getSocketReadyState",()=>{var e;return(e=this.socketInstance)==null?void 0:e.readyState});i(this,"destroy",()=>{var e;(e=this.socketInstance)==null||e.close()});i(this,"sendMessage",(e,t)=>new Promise((s,r)=>{var o,u;if(((o=this.socketInstance)==null?void 0:o.readyState)!==WebSocket.OPEN){console.log(e),r({errCode:-1,msg:"socket未连接"});return}const a={function:e,args:[t!=null?t:{}]};(u=this.socketInstance)==null||u.send(JSON.stringify(a)),this.eventBus.on(e,y=>{y.success?s(y.data):r(y)})}));i(this,"handleEventData",e=>l(this,null,function*(){var t,s,r,a,o,u;if(e.data instanceof Blob){const y=yield e.data.arrayBuffer(),f=new TextDecoder("gbk").decode(y),p=JSON.parse(f),g={data:p.data,success:(t=p.result)==null?void 0:t.success,msg:(s=p.result)==null?void 0:s.msg,errCode:(r=p.result)==null?void 0:r.errCode};this.eventBus.emit((a=p.result)==null?void 0:a.function,g),(u=(o=this.socketConfig)==null?void 0:o.onMessage)==null||u.call(o,g)}}));i(this,"base64Encode",e=>{const t=new TextEncoder().encode(e);return le.fromByteArray(t)});i(this,"base64Decode",e=>{const t=le.toByteArray(e);return new TextDecoder().decode(t)});i(this,"changeIsRememberPin",e=>l(this,null,function*(){this.isRememberPin=e}));i(this,"changePinPolicy",e=>l(this,null,function*(){this.pinPolicy=e}));i(this,"checkCertIsLogin",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_IsLogin",e)}));i(this,"addUkeyEvents",()=>l(this,null,function*(){this.sendMessage("GZCA_StartListen",{Type:Y}).then(e=>{var t,s;(s=(t=this.socketConfig)==null?void 0:t.onUkeyEvent)==null||s.call(t,e)})}));i(this,"certLogin",e=>l(this,null,function*(){const t=yield this.checkCertIsLogin({ContainerName:e});t!=null&&t[0].isLogin||(yield this.sendMessage("GZCA_Login",{ContainerName:e,IsLogin:"N",UserPin:"123456",PinPolicy:this.pinPolicy}))}));i(this,"getCert",(e,t)=>l(this,null,function*(){const s=t!=null?t:yield this.chooseCert(e);return yield this.certLogin(s.ContainerName),s}));i(this,"getCertList",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertList",e)}));i(this,"chooseCert",e=>l(this,null,function*(){var r;const t=yield this.getCertList(e);return(t==null?void 0:t.length)===1?t[0]:yield at.open({certList:t,theme:(r=this.socketConfig)==null?void 0:r.theme})}));i(this,"pkcs1Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignData",$({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));i(this,"pkcs1Base64Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",$({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));i(this,"pkcs1VerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySign",e)}));i(this,"pkcs1Base64VerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignEx",e)}));i(this,"getSealList",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_EnumSeals",$({IsLogin:this.getIsLogin()},e!=null?e:{}))}));i(this,"sm2SignPreprocess1",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep1",e)}));i(this,"sm2SignPreprocess2",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep2",e)}));i(this,"pkcs1HashSign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataForHash",$({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));i(this,"pkcs1HashVerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignForHash",e)}));i(this,"pkcs7Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7SignData",$({IsLogin:this.getIsLogin(),IsAuthAttr:"Y",PinPolicy:this.pinPolicy},e!=null?e:{}))}));i(this,"pkcs7VerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7VerifySign",e)}));i(this,"sm3Hash",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashData",e)}));i(this,"sm3HexHash",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashDataEx",e)}));i(this,"sm3FileHash",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashFile",e)}));i(this,"sm3HashEncryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HMac",e)}));i(this,"pkcs7Encryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7EncryptData",e)}));i(this,"pkcs7Decryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7DecryptData",$({IsLogin:this.getIsLogin()},e!=null?e:{}))}));i(this,"asymmetricEncryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_AsymEncryptData",e)}));i(this,"asymmetricDecryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_AsymDecryptData",$({IsLogin:this.getIsLogin()},e!=null?e:{}))}));i(this,"sm4Encryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_EncryptDataEx",e)}));i(this,"sm4Decryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_DecryptDataEx",e)}));i(this,"getCertInfo",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfo",e)}));i(this,"getCertInfoByOid",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfoByOid",e)}));var t,s;this.socketConfig=e,this.socketInstance=this.createSocket(e),this.isRememberPin=(t=e.isRememberPin)!=null?t:!1,this.pinPolicy=(s=e.pinPolicy)!=null?s:V.MIN}createSocket(e){const t=new WebSocket(e.url);return t.onerror=s=>{var r;(r=e.onError)==null||r.call(e,s)},t.onopen=s=>{var r;(r=e.onOpen)==null||r.call(e,s),this.addUkeyEvents()},t.onmessage=s=>{this.handleEventData(s)},t.onclose=s=>{var r;(r=e.onClose)==null||r.call(e,s)},t}getIsLogin(){return this.isRememberPin?"Y":"N"}}const Z=class Z{constructor(e){i(this,"coreInstance",null);i(this,"gwsConfig",{});i(this,"createGwsCore",e=>{this.gwsConfig=e!=null?e:{},this.coreInstance=new ot(H($({},e!=null?e:{}),{url:w}))});i(this,"appendCertBase64",(e,t=!0)=>l(this,null,function*(){if(e.CertB64)return e;const s=t?yield this.getSignatureCert():yield this.getEncryptionCert();return H($({},e!=null?e:{}),{CertB64:s==null?void 0:s.CertB64})}));i(this,"destroy",()=>{var e;(e=this.coreInstance)==null||e.destroy(),this.coreInstance=null});i(this,"restart",e=>{this.coreInstance&&this.destroy(),this.gwsConfig=e!=null?e:this.gwsConfig,this.createGwsCore(e)});i(this,"getSocketReadyState",()=>{var e;return(e=this.coreInstance)==null?void 0:e.getSocketReadyState()});i(this,"getSignatureCert",e=>l(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:x},e)}));i(this,"getEncryptionCert",e=>l(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:X},e)}));i(this,"base64Encode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Encode(e.Data)});i(this,"base64Decode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Decode(e.DataB64)});i(this,"changeIsRememberPin",e=>{var t;(t=this.coreInstance)==null||t.changeIsRememberPin(e)});i(this,"changePinPolicy",e=>{var t;(t=this.coreInstance)==null||t.changePinPolicy(e)});i(this,"pkcs1Sign",(e,t)=>l(this,null,function*(){var a,o,u;const s=yield this.getSignatureCert(t),r=yield(o=this.coreInstance)==null?void 0:o.pkcs1Sign(H($({},e!=null?e:{}),{ContainerName:(a=s==null?void 0:s.ContainerName)!=null?a:""}));return(u=r==null?void 0:r[0])==null?void 0:u.SignData}));i(this,"pkcs1VerifySignature",e=>l(this,null,function*(){var r;const t=yield this.appendCertBase64(e),s=yield(r=this.coreInstance)==null?void 0:r.pkcs1VerifySignature(t);return Array.isArray(s)}));i(this,"pkcs1Base64Sign",(e,t)=>l(this,null,function*(){var o,u,y,d,f;const s=yield this.getSignatureCert(t),r=(u=e.DataB64)!=null?u:this.base64Encode({Data:(o=e.Data)!=null?o:""}),a=yield(d=this.coreInstance)==null?void 0:d.pkcs1Base64Sign({ContainerName:(y=s==null?void 0:s.ContainerName)!=null?y:"",DataB64:r});return(f=a==null?void 0:a[0])==null?void 0:f.SignData}));i(this,"pkcs1Base64VerifySignature",e=>l(this,null,function*(){var a,o,u;const t=(o=e.DataB64)!=null?o:this.base64Encode({Data:(a=e.Data)!=null?a:""}),s=yield this.appendCertBase64(e);return!!(yield(u=this.coreInstance)==null?void 0:u.pkcs1Base64VerifySignature({CertB64:s.CertB64,DataB64:t,SignData:s.SignData}))}));i(this,"getSealList",()=>l(this,null,function*(){var s,r;const e=yield this.getSignatureCert(),t=yield(r=this.coreInstance)==null?void 0:r.getSealList({ContainerName:(s=e==null?void 0:e.ContainerName)!=null?s:""});return{cert:e,sealList:t}}));i(this,"sm2SignPreprocess1",e=>l(this,null,function*(){var r,a;const t=yield this.appendCertBase64(e),s=yield(r=this.coreInstance)==null?void 0:r.sm2SignPreprocess1(t);return(a=s==null?void 0:s[0])==null?void 0:a.Z}));i(this,"sm2SignPreprocess2",e=>l(this,null,function*(){var a,o;const t=this.base64Encode({Data:(a=e.Data)!=null?a:""}),s=yield this.appendCertBase64(e),r=yield(o=this.coreInstance)==null?void 0:o.sm2SignPreprocess2({CertB64:s.CertB64,DataB64:t});return r==null?void 0:r[0].H}));i(this,"pkcs1HashSign",(e,t)=>l(this,null,function*(){var a,o,u,y;const s=yield this.getSignatureCert(t),r=yield(u=this.coreInstance)==null?void 0:u.pkcs1HashSign({ContainerName:(a=s==null?void 0:s.ContainerName)!=null?a:"",DataB64:e.DataB64,HashAlg:(o=e.HashAlg)!=null?o:"sm3"});return(y=r==null?void 0:r[0])==null?void 0:y.SignData}));i(this,"pkcs1HashVerifySignature",e=>l(this,null,function*(){var r,a;const t=yield this.appendCertBase64(e);return!!(yield(a=this.coreInstance)==null?void 0:a.pkcs1HashVerifySignature(H($({},t),{HashAlg:(r=t.HashAlg)!=null?r:"sm3"})))}));i(this,"pkcs7Sign",(e,t)=>l(this,null,function*(){var o,u,y,d,f;const s=(u=e.DataB64)!=null?u:this.base64Encode({Data:(o=e.Data)!=null?o:""}),r=yield this.getSignatureCert(t),a=yield(d=this.coreInstance)==null?void 0:d.pkcs7Sign({IsDetached:e.IsDetached,ContainerName:(y=r==null?void 0:r.ContainerName)!=null?y:"",DataB64:s});return(f=a==null?void 0:a[0])==null?void 0:f.SignData}));i(this,"pkcs7VerifySignature",e=>l(this,null,function*(){var r,a,o;const t=(a=e.DataB64)!=null?a:this.base64Encode({Data:(r=e.Data)!=null?r:""});return!!(yield(o=this.coreInstance)==null?void 0:o.pkcs7VerifySignature({DataB64:t,SignData:e.SignData}))}));i(this,"sm3Hash",e=>l(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.sm3Hash(e);return(r=t==null?void 0:t[0])==null?void 0:r.HashB64}));i(this,"sm3HexHash",e=>l(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.sm3HexHash(e);return(r=t==null?void 0:t[0])==null?void 0:r.HashB64}));i(this,"sm3FileHash",e=>l(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.sm3FileHash(e);return(r=t==null?void 0:t[0])==null?void 0:r.HashB64}));i(this,"sm3HashEncryption",e=>l(this,null,function*(){var a,o,u,y,d,f;const t=(o=e.DataB64)!=null?o:this.base64Encode({Data:(a=e.Data)!=null?a:""}),s=(y=e.KeyB64)!=null?y:this.base64Encode({Data:(u=e.Key)!=null?u:""}),r=yield(d=this.coreInstance)==null?void 0:d.sm3HashEncryption({dataB64:t,keyB64:s,alg:"sm3"});return(f=r==null?void 0:r[0])==null?void 0:f.DataB64}));i(this,"pkcs7Encryption",e=>l(this,null,function*(){var r,a,o,u;if(!e.CertB64List){const y=yield this.getEncryptionCert();e.CertB64List=y==null?void 0:y.CertB64}const t=(a=e.DataB64)!=null?a:this.base64Encode({Data:(r=e.Data)!=null?r:""}),s=yield(o=this.coreInstance)==null?void 0:o.pkcs7Encryption({DataB64:t,CertB64List:e.CertB64List});return(u=s==null?void 0:s[0])==null?void 0:u.DataB64}));i(this,"pkcs7Decryption",e=>l(this,null,function*(){var a,o;const t=yield this.getEncryptionCert(),s=yield(a=this.coreInstance)==null?void 0:a.pkcs7Decryption({DataB64:e.DataB64,ContainerName:t==null?void 0:t.ContainerName}),r=(o=s==null?void 0:s[0])==null?void 0:o.DataB64;return e.shouldDecodeBase64?this.base64Decode({DataB64:r}):r}));i(this,"asymmetricEncryption",e=>l(this,null,function*(){var r,a;const t=yield this.appendCertBase64(e,!1),s=yield(r=this.coreInstance)==null?void 0:r.asymmetricEncryption(t);return(a=s==null?void 0:s[0])==null?void 0:a.Data}));i(this,"asymmetricDecryption",e=>l(this,null,function*(){var r,a;const t=yield this.getEncryptionCert(),s=yield(r=this.coreInstance)==null?void 0:r.asymmetricDecryption({Data:e.Data,ContainerName:t==null?void 0:t.ContainerName});return(a=s==null?void 0:s[0])==null?void 0:a.Data}));i(this,"sm4Encryption",e=>l(this,null,function*(){var s;const t=yield(s=this.coreInstance)==null?void 0:s.sm4Encryption(e);return t==null?void 0:t[0]}));i(this,"sm4Decryption",e=>l(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.sm4Decryption(e);return(r=t==null?void 0:t[0])==null?void 0:r.Data}));i(this,"getCertInfo",e=>l(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.getCertInfo(e);return $({},(r=t==null?void 0:t[0])!=null?r:{})}));i(this,"getCertInfoByOid",e=>l(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.getCertInfoByOid($({},e!=null?e:{}));return(r=t==null?void 0:t[0])==null?void 0:r.OidValue}));return Z.instance&&!(e!=null&&e.isCreateNew)?Z.instance:(this.createGwsCore(e),Z.instance=this,this)}};i(Z,"instance",null);let N=Z;function it(n){return new Promise((e,t)=>{if(N.instance&&!(n!=null&&n.isCreateNew))e(N.instance);else{const s=new N(H($({},n!=null?n:{}),{onOpen(r){var a;e(s),(a=n==null?void 0:n.onOpen)==null||a.call(n,r)},onClose(r){var a;t(r),(a=n==null?void 0:n.onClose)==null||a.call(n,r)}}))}})}B.GwsService=N,B.createService=it,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(B,w){typeof exports=="object"&&typeof module!="undefined"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(B=typeof globalThis!="undefined"?globalThis:B||self,w(B.GWS_CLIENT={}))})(this,function(B){"use strict";var ct=Object.defineProperty,lt=Object.defineProperties;var ut=Object.getOwnPropertyDescriptors;var $e=Object.getOwnPropertySymbols;var dt=Object.prototype.hasOwnProperty,ht=Object.prototype.propertyIsEnumerable;var ce=(B,w,x)=>w in B?ct(B,w,{enumerable:!0,configurable:!0,writable:!0,value:x}):B[w]=x,I=(B,w)=>{for(var x in w||(w={}))dt.call(w,x)&&ce(B,x,w[x]);if($e)for(var x of $e(w))ht.call(w,x)&&ce(B,x,w[x]);return B},H=(B,w)=>lt(B,ut(w));var i=(B,w,x)=>ce(B,typeof w!="symbol"?w+"":w,x);var l=(B,w,x)=>new Promise((Q,V)=>{var X=E=>{try{P(x.next(E))}catch(R){V(R)}},ee=E=>{try{P(x.throw(E))}catch(R){V(R)}},P=E=>E.done?Q(E.value):Promise.resolve(E.value).then(X,ee);P((x=x.apply(B,w)).next())});const w=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",x="1",Q="2";var V=(n=>(n[n.MIN=0]="MIN",n[n.LOW=1]="LOW",n[n.MIDDLE=2]="MIDDLE",n[n.HIGH=3]="HIGH",n))(V||{});const X="00000001";function ee(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var P={},E;function R(){if(E)return P;E=1,P.byteLength=u,P.toByteArray=d,P.fromByteArray=g;for(var n=[],e=[],t=typeof Uint8Array!="undefined"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,a=s.length;r<a;++r)n[r]=s[r],e[s.charCodeAt(r)]=r;e[45]=62,e[95]=63;function o(h){var c=h.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var m=h.indexOf("=");m===-1&&(m=c);var D=m===c?0:4-m%4;return[m,D]}function u(h){var c=o(h),m=c[0],D=c[1];return(m+D)*3/4-D}function y(h,c,m){return(c+m)*3/4-m}function d(h){var c,m=o(h),D=m[0],C=m[1],v=new t(y(h,D,C)),b=0,T=C>0?D-4:D,k;for(k=0;k<T;k+=4)c=e[h.charCodeAt(k)]<<18|e[h.charCodeAt(k+1)]<<12|e[h.charCodeAt(k+2)]<<6|e[h.charCodeAt(k+3)],v[b++]=c>>16&255,v[b++]=c>>8&255,v[b++]=c&255;return C===2&&(c=e[h.charCodeAt(k)]<<2|e[h.charCodeAt(k+1)]>>4,v[b++]=c&255),C===1&&(c=e[h.charCodeAt(k)]<<10|e[h.charCodeAt(k+1)]<<4|e[h.charCodeAt(k+2)]>>2,v[b++]=c>>8&255,v[b++]=c&255),v}function f(h){return n[h>>18&63]+n[h>>12&63]+n[h>>6&63]+n[h&63]}function p(h,c,m){for(var D,C=[],v=c;v<m;v+=3)D=(h[v]<<16&16711680)+(h[v+1]<<8&65280)+(h[v+2]&255),C.push(f(D));return C.join("")}function g(h){for(var c,m=h.length,D=m%3,C=[],v=16383,b=0,T=m-D;b<T;b+=v)C.push(p(h,b,b+v>T?T:b+v));return D===1?(c=h[m-1],C.push(n[c>>2]+n[c<<4&63]+"==")):D===2&&(c=(h[m-2]<<8)+h[m-1],C.push(n[c>>10]+n[c>>4&63]+n[c<<2&63]+"=")),C.join("")}return P}var Ee=R();const le=ee(Ee);class Ae{constructor(){i(this,"deps",new Map)}on(e,t){this.deps.set(e,t)}emit(e,t){const s=this.deps.get(e);s&&s(t)}}(function(){try{var n=document.createElement("style");n.appendChild(document.createTextNode("button.svelte-oivou{background-color:transparent;border:none;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;outline:none}.modal-background.svelte-oivou{display:none;position:fixed;z-index:10000;left:0;top:0;width:100%;height:100%;background-color:#00000080;align-items:center;justify-content:center}.modal-content.svelte-oivou{background-color:#fff;padding:1.42857rem;border-radius:.35714rem;width:40%}.model-title.svelte-oivou{color:#303133;font-size:1.28571rem;margin-bottom:1.14286rem}.modal-visible.svelte-oivou{display:flex}.modal-footer.svelte-oivou{display:flex;align-items:center;justify-content:flex-end;margin-top:1.14286rem}.modal-btn.svelte-oivou{padding:.57143rem 1.07143rem;border-radius:.28571rem;font-size:1rem;border:.07143rem solid #dcdfe6}.success.svelte-oivou{margin-left:.85714rem;color:#fff}.slot.svelte-oivou{max-height:14.28571rem;overflow-y:scroll}.slot.svelte-oivou::-webkit-scrollbar{display:none}.cert-item.svelte-jtc2v4.svelte-jtc2v4{padding:1.14286rem;display:flex;align-items:center;cursor:pointer;border-bottom:.07143rem solid #ebeef5;font-size:1rem}.cert-item-selected.svelte-jtc2v4.svelte-jtc2v4{background-color:#f1f1f1}.cert-item-first.svelte-jtc2v4.svelte-jtc2v4{border-top:.07143rem solid #ebeef5}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4{display:inline-block;color:#606266}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4:first-child{width:30%}.seal-wrapper.svelte-1w19fs3.svelte-1w19fs3{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.seal-item.svelte-1w19fs3.svelte-1w19fs3{width:12.85714rem;height:12.85714rem;display:flex;flex-direction:column;align-items:center;justify-content:center;border:.07143rem solid #ccc;margin-top:.71429rem;margin-right:.71429rem;border-radius:.28571rem}.seal-item.svelte-1w19fs3 img.svelte-1w19fs3{width:7.14286rem;height:7.14286rem}.seal-item-selected.svelte-1w19fs3.svelte-1w19fs3{background-color:#f1f1f1}.seal-name.svelte-1w19fs3.svelte-1w19fs3{margin-top:.71429rem;color:#333}")),document.head.appendChild(n)}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var Le=Object.defineProperty,_e=(n,e,t)=>e in n?Le(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ue=(n,e,t)=>_e(n,typeof e!="symbol"?e+"":e,t);function te(){}function Pe(n,e){for(const t in e)n[t]=e[t];return n}function de(n){return n()}function he(){return Object.create(null)}function U(n){n.forEach(de)}function J(n){return typeof n=="function"}function ye(n,e){return n!=n?e==e:n!==e||n&&typeof n=="object"||typeof n=="function"}function Te(n){return Object.keys(n).length===0}function Me(n,e,t,s){if(n){const r=fe(n,e,t,s);return n[0](r)}}function fe(n,e,t,s){return n[1]&&s?Pe(t.ctx.slice(),n[1](s(e))):t.ctx}function He(n,e,t,s){if(n[2]&&s){const r=n[2](s(t));if(e.dirty===void 0)return r;if(typeof r=="object"){const a=[],o=Math.max(e.dirty.length,r.length);for(let u=0;u<o;u+=1)a[u]=e.dirty[u]|r[u];return a}return e.dirty|r}return e.dirty}function Ge(n,e,t,s,r,a){if(r){const o=fe(e,t,s,a);n.p(o,r)}}function Ne(n){if(n.ctx.length>32){const e=[],t=n.ctx.length/32;for(let s=0;s<t;s++)e[s]=-1;return e}return-1}function ge(n){return n!=null?n:""}function S(n,e){n.appendChild(e)}function ne(n,e,t){n.insertBefore(e,t||null)}function q(n){n.parentNode&&n.parentNode.removeChild(n)}function je(n,e){for(let t=0;t<n.length;t+=1)n[t]&&n[t].d(e)}function A(n){return document.createElement(n)}function L(n){return document.createTextNode(n)}function z(){return L(" ")}function Fe(){return L("")}function W(n,e,t,s){return n.addEventListener(e,t,s),()=>n.removeEventListener(e,t,s)}function $(n,e,t){t==null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t)}function Oe(n){return Array.from(n.childNodes)}function G(n,e){e=""+e,n.data!==e&&(n.data=e)}function pe(n,e,t,s){t==null?n.style.removeProperty(e):n.style.setProperty(e,t,"")}let se;function Y(n){se=n}const N=[],me=[];let j=[];const ve=[],Ze=Promise.resolve();let re=!1;function Ve(){re||(re=!0,Ze.then(Ce))}function ae(n){j.push(n)}const oe=new Set;let F=0;function Ce(){if(F!==0)return;const n=se;do{try{for(;F<N.length;){const e=N[F];F++,Y(e),Re(e.$$)}}catch(e){throw N.length=0,F=0,e}for(Y(null),N.length=0,F=0;me.length;)me.pop()();for(let e=0;e<j.length;e+=1){const t=j[e];oe.has(t)||(oe.add(t),t())}j.length=0}while(N.length);for(;ve.length;)ve.pop()();re=!1,oe.clear(),Y(n)}function Re(n){if(n.fragment!==null){n.update(),U(n.before_update);const e=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,e),n.after_update.forEach(ae)}}function Ue(n){const e=[],t=[];j.forEach(s=>n.indexOf(s)===-1?e.push(s):t.push(s)),t.forEach(s=>s()),j=e}const K=new Set;let Je;function ie(n,e){n&&n.i&&(K.delete(n),n.i(e))}function we(n,e,t,s){if(n&&n.o){if(K.has(n))return;K.add(n),Je.c.push(()=>{K.delete(n)}),n.o(e)}}function ke(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function ze(n){n&&n.c()}function De(n,e,t){const{fragment:s,after_update:r}=n.$$;s&&s.m(e,t),ae(()=>{const a=n.$$.on_mount.map(de).filter(J);n.$$.on_destroy?n.$$.on_destroy.push(...a):U(a),n.$$.on_mount=[]}),r.forEach(ae)}function be(n,e){const t=n.$$;t.fragment!==null&&(Ue(t.after_update),U(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function We(n,e){n.$$.dirty[0]===-1&&(N.push(n),Ve(),n.$$.dirty.fill(0)),n.$$.dirty[e/31|0]|=1<<e%31}function Be(n,e,t,s,r,a,o=null,u=[-1]){const y=se;Y(n);const d=n.$$={fragment:null,ctx:[],props:a,update:te,not_equal:r,bound:he(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(y?y.$$.context:[])),callbacks:he(),dirty:u,skip_bound:!1,root:e.target||y.$$.root};o&&o(d.root);let f=!1;if(d.ctx=t?t(n,e.props||{},(p,g,...h)=>{const c=h.length?h[0]:g;return d.ctx&&r(d.ctx[p],d.ctx[p]=c)&&(!d.skip_bound&&d.bound[p]&&d.bound[p](c),f&&We(n,p)),g}):[],d.update(),f=!0,U(d.before_update),d.fragment=s?s(d.ctx):!1,e.target){if(e.hydrate){const p=Oe(e.target);d.fragment&&d.fragment.l(p),p.forEach(q)}else d.fragment&&d.fragment.c();e.intro&&ie(n.$$.fragment),De(n,e.target,e.anchor),Ce()}Y(y)}class Se{constructor(){ue(this,"$$"),ue(this,"$$set")}$destroy(){be(this,1),this.$destroy=te}$on(e,t){if(!J(t))return te;const s=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return s.push(t),()=>{const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}$set(e){this.$$set&&!Te(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ye="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Ye);function qe(n){let e,t,s,r=(n[1]||"标题")+"",a,o,u,y,d,f,p=(n[4]||"取消")+"",g,h,c,m=(n[5]||"确认")+"",D,C,v,b;const T=n[8].default,k=Me(T,n,n[7],null);return{c(){e=A("div"),t=A("div"),s=A("div"),a=L(r),o=z(),u=A("div"),k&&k.c(),y=z(),d=A("div"),f=A("button"),g=L(p),h=z(),c=A("button"),D=L(m),$(s,"class","model-title svelte-oivou"),$(u,"class","slot svelte-oivou"),$(f,"class","modal-btn svelte-oivou"),$(c,"class","modal-btn success svelte-oivou"),pe(c,"background-color",n[6]),$(d,"class","modal-footer svelte-oivou"),$(t,"class","modal-content svelte-oivou"),$(e,"class","modal-background modal-visible svelte-oivou")},m(_,M){ne(_,e,M),S(e,t),S(t,s),S(s,a),S(t,o),S(t,u),k&&k.m(u,null),S(t,y),S(t,d),S(d,f),S(f,g),S(d,h),S(d,c),S(c,D),C=!0,v||(b=[W(f,"click",function(){J(n[0])&&n[0].apply(this,arguments)}),W(c,"click",function(){J(n[2])&&n[2].apply(this,arguments)}),W(t,"click",Ke),W(e,"click",function(){J(n[3])&&n[3].apply(this,arguments)})],v=!0)},p(_,[M]){n=_,(!C||M&2)&&r!==(r=(n[1]||"标题")+"")&&G(a,r),k&&k.p&&(!C||M&128)&&Ge(k,T,n,n[7],C?He(T,n[7],M,null):Ne(n[7]),null),(!C||M&16)&&p!==(p=(n[4]||"取消")+"")&&G(g,p),(!C||M&32)&&m!==(m=(n[5]||"确认")+"")&&G(D,m),(!C||M&64)&&pe(c,"background-color",n[6])},i(_){C||(ie(k,_),C=!0)},o(_){we(k,_),C=!1},d(_){_&&q(e),k&&k.d(_),v=!1,U(b)}}}const Ke=n=>n.stopPropagation();function Qe(n,e,t){let{$$slots:s={},$$scope:r}=e,{onCancel:a}=e,{title:o}=e,{onOk:u}=e,{onClose:y}=e,{cancelText:d}=e,{okText:f}=e,{theme:p}=e;return n.$$set=g=>{"onCancel"in g&&t(0,a=g.onCancel),"title"in g&&t(1,o=g.title),"onOk"in g&&t(2,u=g.onOk),"onClose"in g&&t(3,y=g.onClose),"cancelText"in g&&t(4,d=g.cancelText),"okText"in g&&t(5,f=g.okText),"theme"in g&&t(6,p=g.theme),"$$scope"in g&&t(7,r=g.$$scope)},[a,o,u,y,d,f,p,r,s]}class Xe extends Se{constructor(e){super(),Be(this,e,Qe,qe,ye,{onCancel:0,title:1,onOk:2,onClose:3,cancelText:4,okText:5,theme:6})}}function xe(n,e,t){const s=n.slice();return s[11]=e[t],s[13]=t,s}function Ie(n){let e,t,s=n[11].CN+"",r,a,o,u=n[11].DevClass+"",y,d,f=n[11].sn+"",p,g,h,c,m,D;function C(){return n[10](n[13])}return{c(){e=A("div"),t=A("span"),r=L(s),a=z(),o=A("span"),y=L(u),d=L("("),p=L(f),g=L(")"),h=z(),$(t,"class","svelte-jtc2v4"),$(o,"class","svelte-jtc2v4"),$(e,"class",c=ge(`cert-item ${n[13]===0?"cert-item-first":""} ${n[13]===n[5]?"cert-item-selected":""}`)+" svelte-jtc2v4")},m(v,b){ne(v,e,b),S(e,t),S(t,r),S(e,a),S(e,o),S(o,y),S(o,d),S(o,p),S(o,g),S(e,h),m||(D=W(e,"click",C),m=!0)},p(v,b){n=v,b&1&&s!==(s=n[11].CN+"")&&G(r,s),b&1&&u!==(u=n[11].DevClass+"")&&G(y,u),b&1&&f!==(f=n[11].sn+"")&&G(p,f),b&32&&c!==(c=ge(`cert-item ${n[13]===0?"cert-item-first":""} ${n[13]===n[5]?"cert-item-selected":""}`)+" svelte-jtc2v4")&&$(e,"class",c)},d(v){v&&q(e),m=!1,D()}}}function et(n){let e,t=ke(n[0]),s=[];for(let r=0;r<t.length;r+=1)s[r]=Ie(xe(n,t,r));return{c(){for(let r=0;r<s.length;r+=1)s[r].c();e=Fe()},m(r,a){for(let o=0;o<s.length;o+=1)s[o]&&s[o].m(r,a);ne(r,e,a)},p(r,a){if(a&33){t=ke(r[0]);let o;for(o=0;o<t.length;o+=1){const u=xe(r,t,o);s[o]?s[o].p(u,a):(s[o]=Ie(u),s[o].c(),s[o].m(e.parentNode,e))}for(;o<s.length;o+=1)s[o].d(1);s.length=t.length}},d(r){r&&q(e),je(s,r)}}}function tt(n){let e,t;return e=new Xe({props:{onOk:n[7],onClose:n[1],onCancel:n[6],cancelText:n[2],okText:n[3],title:"选择证书",theme:n[4],$$slots:{default:[et]},$$scope:{ctx:n}}}),{c(){ze(e.$$.fragment)},m(s,r){De(e,s,r),t=!0},p(s,[r]){const a={};r&2&&(a.onClose=s[1]),r&4&&(a.cancelText=s[2]),r&8&&(a.okText=s[3]),r&16&&(a.theme=s[4]),r&16417&&(a.$$scope={dirty:r,ctx:s}),e.$set(a)},i(s){t||(ie(e.$$.fragment,s),t=!0)},o(s){we(e.$$.fragment,s),t=!1},d(s){be(e,s)}}}function nt(n,e,t){let{certList:s=[]}=e,{onCancel:r}=e,{onOk:a}=e,{onClose:o}=e,{cancelText:u=""}=e,{okText:y=""}=e,{theme:d="#409eff"}=e,f=0;const p=()=>{r("未选择证书"),o==null||o()},g=()=>{a==null||a(s[f]),o==null||o()},h=c=>t(5,f=c);return n.$$set=c=>{"certList"in c&&t(0,s=c.certList),"onCancel"in c&&t(8,r=c.onCancel),"onOk"in c&&t(9,a=c.onOk),"onClose"in c&&t(1,o=c.onClose),"cancelText"in c&&t(2,u=c.cancelText),"okText"in c&&t(3,y=c.okText),"theme"in c&&t(4,d=c.theme)},[s,o,u,y,d,f,p,g,r,a,h]}class st extends Se{constructor(e){super(),Be(this,e,nt,tt,ye,{certList:0,onCancel:8,onOk:9,onClose:1,cancelText:2,okText:3,theme:4})}}class rt{constructor(){i(this,"modalInstance",{current:null});i(this,"open",e=>new Promise((t,s)=>{this.modalInstance.current=new st({target:document.body,props:H(I({},e),{onCancel:r=>{s({code:-1,msg:r})},onOk:r=>{t(r)},onClose:()=>{this.close()}})})}));i(this,"close",()=>{setTimeout(()=>{var e;(e=this.modalInstance.current)==null||e.$destroy()})})}}const at=new rt;class ot{constructor(e){i(this,"socketInstance",null);i(this,"eventBus",new Ae);i(this,"isRememberPin",!1);i(this,"socketEvent");i(this,"pinPolicy");i(this,"socketConfig",null);i(this,"getSocketReadyState",()=>{var e;return(e=this.socketInstance)==null?void 0:e.readyState});i(this,"destroy",()=>{var e;(e=this.socketInstance)==null||e.close()});i(this,"sendMessage",(e,t)=>new Promise((s,r)=>{var o,u;if(((o=this.socketInstance)==null?void 0:o.readyState)!==WebSocket.OPEN){r({errCode:-1,msg:"socket未连接"});return}const a={function:e,args:[t!=null?t:{}]};(u=this.socketInstance)==null||u.send(JSON.stringify(a)),this.eventBus.on(e,y=>{y.success?s(y.data):r(y)})}));i(this,"handleEventData",e=>l(this,null,function*(){var t,s,r,a,o,u;if(e.data instanceof Blob){const y=yield e.data.arrayBuffer(),f=new TextDecoder("gbk").decode(y),p=JSON.parse(f),g={data:p.data,success:(t=p.result)==null?void 0:t.success,msg:(s=p.result)==null?void 0:s.msg,errCode:(r=p.result)==null?void 0:r.errCode};this.eventBus.emit((a=p.result)==null?void 0:a.function,g),(u=(o=this.socketConfig)==null?void 0:o.onMessage)==null||u.call(o,g)}}));i(this,"base64Encode",e=>{const t=new TextEncoder().encode(e);return le.fromByteArray(t)});i(this,"base64Decode",e=>{const t=le.toByteArray(e);return new TextDecoder().decode(t)});i(this,"changeIsRememberPin",e=>l(this,null,function*(){this.isRememberPin=e}));i(this,"changePinPolicy",e=>l(this,null,function*(){this.pinPolicy=e}));i(this,"checkCertIsLogin",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_IsLogin",e)}));i(this,"addUkeyEvents",()=>l(this,null,function*(){this.sendMessage("GZCA_StartListen",{Type:X}).then(e=>{var t,s;(s=(t=this.socketConfig)==null?void 0:t.onUkeyEvent)==null||s.call(t,e)})}));i(this,"certLogin",e=>l(this,null,function*(){const t=yield this.checkCertIsLogin({ContainerName:e});t!=null&&t[0].isLogin||(yield this.sendMessage("GZCA_Login",{ContainerName:e,IsLogin:"N",UserPin:"123456",PinPolicy:this.pinPolicy}))}));i(this,"getCert",(e,t)=>l(this,null,function*(){const s=t!=null?t:yield this.chooseCert(e);return yield this.certLogin(s.ContainerName),s}));i(this,"getCertList",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertList",e)}));i(this,"chooseCert",e=>l(this,null,function*(){var r;const t=yield this.getCertList(e);return(t==null?void 0:t.length)===1?t[0]:yield at.open({certList:t,theme:(r=this.socketConfig)==null?void 0:r.theme})}));i(this,"pkcs1Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignData",I({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));i(this,"pkcs1Base64Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",I({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));i(this,"pkcs1VerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySign",e)}));i(this,"pkcs1Base64VerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignEx",e)}));i(this,"getSealList",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_EnumSeals",I({IsLogin:this.getIsLogin()},e!=null?e:{}))}));i(this,"sm2SignPreprocess1",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep1",e)}));i(this,"sm2SignPreprocess2",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep2",e)}));i(this,"pkcs1HashSign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataForHash",I({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));i(this,"pkcs1HashVerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignForHash",e)}));i(this,"pkcs7Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7SignData",I({IsLogin:this.getIsLogin(),IsAuthAttr:"Y",PinPolicy:this.pinPolicy},e!=null?e:{}))}));i(this,"pkcs7VerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7VerifySign",e)}));i(this,"sm3Hash",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashData",e)}));i(this,"sm3HexHash",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashDataEx",e)}));i(this,"sm3FileHash",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashFile",e)}));i(this,"sm3HashEncryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HMac",e)}));i(this,"pkcs7Encryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7EncryptData",e)}));i(this,"pkcs7Decryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7DecryptData",I({IsLogin:this.getIsLogin()},e!=null?e:{}))}));i(this,"asymmetricEncryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_AsymEncryptData",e)}));i(this,"asymmetricDecryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_AsymDecryptData",I({IsLogin:this.getIsLogin()},e!=null?e:{}))}));i(this,"sm4Encryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_EncryptDataEx",e)}));i(this,"sm4Decryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_DecryptDataEx",e)}));i(this,"getCertInfo",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfo",e)}));i(this,"getCertInfoByOid",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfoByOid",e)}));var t,s;this.socketConfig=e,this.socketInstance=this.createSocket(e),this.isRememberPin=(t=e.isRememberPin)!=null?t:!1,this.pinPolicy=(s=e.pinPolicy)!=null?s:V.MIN}createSocket(e){const t=new WebSocket(e.url);return t.onerror=s=>{var r;(r=e.onError)==null||r.call(e,s)},t.onopen=s=>{var r;(r=e.onOpen)==null||r.call(e,s),this.addUkeyEvents()},t.onmessage=s=>{this.handleEventData(s)},t.onclose=s=>{var r;(r=e.onClose)==null||r.call(e,s)},t}getIsLogin(){return this.isRememberPin?"Y":"N"}}const Z=class Z{constructor(e){i(this,"coreInstance",null);i(this,"gwsConfig",{});i(this,"createGwsCore",e=>{this.gwsConfig=e!=null?e:{},this.coreInstance=new ot(H(I({},e!=null?e:{}),{url:w}))});i(this,"appendCertBase64",(e,t=!0)=>l(this,null,function*(){if(e.CertB64)return e;const s=t?yield this.getSignatureCert():yield this.getEncryptionCert();return H(I({},e!=null?e:{}),{CertB64:s==null?void 0:s.CertB64})}));i(this,"destroy",()=>{var e;(e=this.coreInstance)==null||e.destroy(),this.coreInstance=null});i(this,"restart",e=>{this.coreInstance&&this.destroy(),this.gwsConfig=e!=null?e:this.gwsConfig,this.createGwsCore(e)});i(this,"getSocketReadyState",()=>{var e;return(e=this.coreInstance)==null?void 0:e.getSocketReadyState()});i(this,"getSignatureCert",e=>l(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:x},e)}));i(this,"getEncryptionCert",e=>l(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:Q},e)}));i(this,"base64Encode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Encode(e.Data)});i(this,"base64Decode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Decode(e.DataB64)});i(this,"changeIsRememberPin",e=>{var t;(t=this.coreInstance)==null||t.changeIsRememberPin(e)});i(this,"changePinPolicy",e=>{var t;(t=this.coreInstance)==null||t.changePinPolicy(e)});i(this,"pkcs1Sign",(e,t)=>l(this,null,function*(){var a,o,u;const s=yield this.getSignatureCert(t),r=yield(o=this.coreInstance)==null?void 0:o.pkcs1Sign(H(I({},e!=null?e:{}),{ContainerName:(a=s==null?void 0:s.ContainerName)!=null?a:"",IsLogin:t?"Y":"N"}));return(u=r==null?void 0:r[0])==null?void 0:u.SignData}));i(this,"pkcs1VerifySignature",e=>l(this,null,function*(){var r;const t=yield this.appendCertBase64(e),s=yield(r=this.coreInstance)==null?void 0:r.pkcs1VerifySignature(t);return Array.isArray(s)}));i(this,"pkcs1Base64Sign",(e,t)=>l(this,null,function*(){var o,u,y,d,f;const s=yield this.getSignatureCert(t),r=(u=e.DataB64)!=null?u:this.base64Encode({Data:(o=e.Data)!=null?o:""}),a=yield(d=this.coreInstance)==null?void 0:d.pkcs1Base64Sign({ContainerName:(y=s==null?void 0:s.ContainerName)!=null?y:"",DataB64:r,IsLogin:t?"Y":"N"});return(f=a==null?void 0:a[0])==null?void 0:f.SignData}));i(this,"pkcs1Base64VerifySignature",e=>l(this,null,function*(){var a,o,u;const t=(o=e.DataB64)!=null?o:this.base64Encode({Data:(a=e.Data)!=null?a:""}),s=yield this.appendCertBase64(e);return!!(yield(u=this.coreInstance)==null?void 0:u.pkcs1Base64VerifySignature({CertB64:s.CertB64,DataB64:t,SignData:s.SignData}))}));i(this,"getSealList",e=>l(this,null,function*(){var r,a;const t=yield this.getSignatureCert(e),s=yield(a=this.coreInstance)==null?void 0:a.getSealList({ContainerName:(r=t==null?void 0:t.ContainerName)!=null?r:"",IsLogin:e?"Y":"N"});return{cert:t,sealList:s}}));i(this,"sm2SignPreprocess1",e=>l(this,null,function*(){var r,a;const t=yield this.appendCertBase64(e),s=yield(r=this.coreInstance)==null?void 0:r.sm2SignPreprocess1(t);return(a=s==null?void 0:s[0])==null?void 0:a.Z}));i(this,"sm2SignPreprocess2",e=>l(this,null,function*(){var a,o;const t=this.base64Encode({Data:(a=e.Data)!=null?a:""}),s=yield this.appendCertBase64(e),r=yield(o=this.coreInstance)==null?void 0:o.sm2SignPreprocess2({CertB64:s.CertB64,DataB64:t});return r==null?void 0:r[0].H}));i(this,"pkcs1HashSign",(e,t)=>l(this,null,function*(){var a,o,u,y;const s=yield this.getSignatureCert(t),r=yield(u=this.coreInstance)==null?void 0:u.pkcs1HashSign({ContainerName:(a=s==null?void 0:s.ContainerName)!=null?a:"",DataB64:e.DataB64,HashAlg:(o=e.HashAlg)!=null?o:"sm3",IsLogin:t?"Y":"N"});return(y=r==null?void 0:r[0])==null?void 0:y.SignData}));i(this,"pkcs1HashVerifySignature",e=>l(this,null,function*(){var r,a;const t=yield this.appendCertBase64(e);return!!(yield(a=this.coreInstance)==null?void 0:a.pkcs1HashVerifySignature(H(I({},t),{HashAlg:(r=t.HashAlg)!=null?r:"sm3"})))}));i(this,"pkcs7Sign",(e,t)=>l(this,null,function*(){var o,u,y,d,f;const s=(u=e.DataB64)!=null?u:this.base64Encode({Data:(o=e.Data)!=null?o:""}),r=yield this.getSignatureCert(t),a=yield(d=this.coreInstance)==null?void 0:d.pkcs7Sign({IsDetached:e.IsDetached,ContainerName:(y=r==null?void 0:r.ContainerName)!=null?y:"",DataB64:s,IsLogin:t?"Y":"N"});return(f=a==null?void 0:a[0])==null?void 0:f.SignData}));i(this,"pkcs7VerifySignature",e=>l(this,null,function*(){var r,a,o;const t=(a=e.DataB64)!=null?a:this.base64Encode({Data:(r=e.Data)!=null?r:""});return!!(yield(o=this.coreInstance)==null?void 0:o.pkcs7VerifySignature({DataB64:t,SignData:e.SignData}))}));i(this,"sm3Hash",e=>l(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.sm3Hash(e);return(r=t==null?void 0:t[0])==null?void 0:r.HashB64}));i(this,"sm3HexHash",e=>l(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.sm3HexHash(e);return(r=t==null?void 0:t[0])==null?void 0:r.HashB64}));i(this,"sm3FileHash",e=>l(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.sm3FileHash(e);return(r=t==null?void 0:t[0])==null?void 0:r.HashB64}));i(this,"sm3HashEncryption",e=>l(this,null,function*(){var a,o,u,y,d,f;const t=(o=e.DataB64)!=null?o:this.base64Encode({Data:(a=e.Data)!=null?a:""}),s=(y=e.KeyB64)!=null?y:this.base64Encode({Data:(u=e.Key)!=null?u:""}),r=yield(d=this.coreInstance)==null?void 0:d.sm3HashEncryption({dataB64:t,keyB64:s,alg:"sm3"});return(f=r==null?void 0:r[0])==null?void 0:f.DataB64}));i(this,"pkcs7Encryption",e=>l(this,null,function*(){var r,a,o,u;if(!e.CertB64List){const y=yield this.getEncryptionCert();e.CertB64List=y==null?void 0:y.CertB64}const t=(a=e.DataB64)!=null?a:this.base64Encode({Data:(r=e.Data)!=null?r:""}),s=yield(o=this.coreInstance)==null?void 0:o.pkcs7Encryption({DataB64:t,CertB64List:e.CertB64List});return(u=s==null?void 0:s[0])==null?void 0:u.DataB64}));i(this,"pkcs7Decryption",e=>l(this,null,function*(){var a,o;const t=yield this.getEncryptionCert(),s=yield(a=this.coreInstance)==null?void 0:a.pkcs7Decryption({DataB64:e.DataB64,ContainerName:t==null?void 0:t.ContainerName}),r=(o=s==null?void 0:s[0])==null?void 0:o.DataB64;return e.shouldDecodeBase64?this.base64Decode({DataB64:r}):r}));i(this,"asymmetricEncryption",e=>l(this,null,function*(){var r,a;const t=yield this.appendCertBase64(e,!1),s=yield(r=this.coreInstance)==null?void 0:r.asymmetricEncryption(t);return(a=s==null?void 0:s[0])==null?void 0:a.Data}));i(this,"asymmetricDecryption",(e,t)=>l(this,null,function*(){var a,o;const s=yield this.getEncryptionCert(t),r=yield(a=this.coreInstance)==null?void 0:a.asymmetricDecryption({Data:e.Data,ContainerName:s==null?void 0:s.ContainerName,IsLogin:t?"Y":"N"});return(o=r==null?void 0:r[0])==null?void 0:o.Data}));i(this,"sm4Encryption",e=>l(this,null,function*(){var s;const t=yield(s=this.coreInstance)==null?void 0:s.sm4Encryption(e);return t==null?void 0:t[0]}));i(this,"sm4Decryption",e=>l(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.sm4Decryption(e);return(r=t==null?void 0:t[0])==null?void 0:r.Data}));i(this,"getCertInfo",e=>l(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.getCertInfo(e);return I({},(r=t==null?void 0:t[0])!=null?r:{})}));i(this,"getCertInfoByOid",e=>l(this,null,function*(){var s,r;const t=yield(s=this.coreInstance)==null?void 0:s.getCertInfoByOid(I({},e!=null?e:{}));return(r=t==null?void 0:t[0])==null?void 0:r.OidValue}));return Z.instance&&!(e!=null&&e.isCreateNew)?Z.instance:(this.createGwsCore(e),Z.instance=this,this)}};i(Z,"instance",null);let O=Z;function it(n){return new Promise((e,t)=>{if(O.instance&&!(n!=null&&n.isCreateNew))e(O.instance);else{const s=new O(H(I({},n!=null?n:{}),{onOpen(r){var a;e(s),(a=n==null?void 0:n.onOpen)==null||a.call(n,r)},onClose(r){var a;t(r),(a=n==null?void 0:n.onClose)==null||a.call(n,r)}}))}})}B.GwsService=O,B.createService=it,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED