gws-client 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";var Ne=Object.defineProperty,xe=Object.defineProperties;var $e=Object.getOwnPropertyDescriptors;var re=Object.getOwnPropertySymbols;var Te=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable;var J=(s,e,t)=>e in s?Ne(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,m=(s,e)=>{for(var t in e||(e={}))Te.call(e,t)&&J(s,t,e[t]);if(re)for(var t of re(e))Me.call(e,t)&&J(s,t,e[t]);return s},v=(s,e)=>xe(s,$e(e));var o=(s,e,t)=>J(s,typeof e!="symbol"?e+"":e,t);var l=(s,e,t)=>new Promise((n,i)=>{var r=d=>{try{c(t.next(d))}catch(u){i(u)}},a=d=>{try{c(t.throw(d))}catch(u){i(u)}},c=d=>d.done?n(d.value):Promise.resolve(d.value).then(r,a);c((t=t.apply(s,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Oe=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",ae="1",oe="2",Fe="1",Ge="2",Ve="3";var Ie=(s=>(s.MIN="0",s.LOW="1",s.MIDDLE="2",s.HIGH="3",s))(Ie||{});const _={LEVEL_1:1,LEVEL_2:2,LEVEL_3:4},Ze={OPEN:_.LEVEL_1,INTERNAL:_.LEVEL_2|_.LEVEL_1,OMP:_.LEVEL_3|_.LEVEL_2|_.LEVEL_1},He="00000001",q="NO_SEAL_AVAILABLE",Ue="CERTIFICATE_NOT_FOUND",je="CLIENT_CONNECTION_FAILED",Ke="ACCESS_DENIED",ce=[{oid:"1.2.86.21.1.3",key:"trustServiceNo"},{oid:"1.2.156.10260.4.1.1",key:"idCardNo"},{oid:"1.2.156.10260.4.1.4",key:"orgCode"}];function Re(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var F={},le;function ze(){if(le)return F;le=1,F.byteLength=c,F.toByteArray=u,F.fromByteArray=w;for(var s=[],e=[],t=typeof Uint8Array!="undefined"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,r=n.length;i<r;++i)s[i]=n[i],e[n.charCodeAt(i)]=i;e[45]=62,e[95]=63;function a(g){var f=g.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=g.indexOf("=");E===-1&&(E=f);var y=E===f?0:4-E%4;return[E,y]}function c(g){var f=a(g),E=f[0],y=f[1];return(E+y)*3/4-y}function d(g,f,E){return(f+E)*3/4-E}function u(g){var f,E=a(g),y=E[0],S=E[1],k=new t(d(g,y,S)),p=0,A=S>0?y-4:y,I;for(I=0;I<A;I+=4)f=e[g.charCodeAt(I)]<<18|e[g.charCodeAt(I+1)]<<12|e[g.charCodeAt(I+2)]<<6|e[g.charCodeAt(I+3)],k[p++]=f>>16&255,k[p++]=f>>8&255,k[p++]=f&255;return S===2&&(f=e[g.charCodeAt(I)]<<2|e[g.charCodeAt(I+1)]>>4,k[p++]=f&255),S===1&&(f=e[g.charCodeAt(I)]<<10|e[g.charCodeAt(I+1)]<<4|e[g.charCodeAt(I+2)]>>2,k[p++]=f>>8&255,k[p++]=f&255),k}function C(g){return s[g>>18&63]+s[g>>12&63]+s[g>>6&63]+s[g&63]}function h(g,f,E){for(var y,S=[],k=f;k<E;k+=3)y=(g[k]<<16&16711680)+(g[k+1]<<8&65280)+(g[k+2]&255),S.push(C(y));return S.join("")}function w(g){for(var f,E=g.length,y=E%3,S=[],k=16383,p=0,A=E-y;p<A;p+=k)S.push(h(g,p,p+k>A?A:p+k));return y===1?(f=g[E-1],S.push(s[f>>2]+s[f<<4&63]+"==")):y===2&&(f=(g[E-2]<<8)+g[E-1],S.push(s[f>>10]+s[f>>4&63]+s[f<<2&63]+"=")),S.join("")}return F}var Ye=ze();const ue=Re(Ye);class Qe{constructor(){o(this,"deps",new Map)}on(e,t){this.deps.set(e,t)}emit(e,t){const n=this.deps.get(e);n==null||n(t)}}(function(){try{var s=document.createElement("style");s.appendChild(document.createTextNode("button.svelte-16iv9d0{background-color:transparent;border:none;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;outline:none}.modal-background.svelte-16iv9d0{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-16iv9d0{background-color:#fff;padding:1.25rem;border-radius:.3125rem;width:40%}.model-title.svelte-16iv9d0{color:#303133;font-size:1.125rem;margin-bottom:1.125rem}.modal-visible.svelte-16iv9d0{display:flex}.modal-footer.svelte-16iv9d0{display:flex;align-items:center;justify-content:flex-end;margin-top:1rem}.modal-btn.svelte-16iv9d0{padding:.5rem .9375rem;border-radius:.25rem;font-size:.875rem;border:.0625rem solid #dcdfe6}.success.svelte-16iv9d0{margin-left:.75rem;color:#fff}.slot.svelte-16iv9d0{max-height:12.5rem;overflow-y:scroll}.slot.svelte-16iv9d0::-webkit-scrollbar{display:none}.seal-wrapper.svelte-1w19fs3.svelte-1w19fs3{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.seal-item.svelte-1w19fs3.svelte-1w19fs3{width:11.25rem;height:11.25rem;display:flex;flex-direction:column;align-items:center;justify-content:center;border:.0625rem solid #ccc;margin-top:.625rem;margin-right:.625rem;border-radius:.25rem}.seal-item.svelte-1w19fs3 img.svelte-1w19fs3{width:6.25rem;height:6.25rem}.seal-item-selected.svelte-1w19fs3.svelte-1w19fs3{background-color:#f1f1f1}.seal-name.svelte-1w19fs3.svelte-1w19fs3{margin-top:.625rem;color:#333}.cert-item.svelte-1kh75ag.svelte-1kh75ag{padding:1rem;display:flex;align-items:center;cursor:pointer;border-bottom:.0625rem solid #ebeef5;font-size:1rem}.cert-item.svelte-1kh75ag>div.svelte-1kh75ag{word-break:break-all;color:#373a40}.cert-item.svelte-1kh75ag>div.svelte-1kh75ag:nth-child(1){padding-right:.5rem}.cert-item-selected.svelte-1kh75ag.svelte-1kh75ag{background-color:#f1f1f1}.cert-item-first.svelte-1kh75ag.svelte-1kh75ag{border-top:.0625rem solid #ebeef5}")),document.head.appendChild(s)}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var We=Object.defineProperty,Je=(s,e,t)=>e in s?We(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,de=(s,e,t)=>Je(s,typeof e!="symbol"?e+"":e,t);function ee(){}function qe(s,e){for(const t in e)s[t]=e[t];return s}function ke(s){return s()}function he(){return Object.create(null)}function U(s){s.forEach(ke)}function Z(s){return typeof s=="function"}function ve(s,e){return s!=s?e==e:s!==e||s&&typeof s=="object"||typeof s=="function"}function Xe(s){return Object.keys(s).length===0}function et(s,e,t,n){if(s){const i=_e(s,e,t,n);return s[0](i)}}function _e(s,e,t,n){return s[1]&&n?qe(t.ctx.slice(),s[1](n(e))):t.ctx}function tt(s,e,t,n){if(s[2]&&n){const i=s[2](n(t));if(e.dirty===void 0)return i;if(typeof i=="object"){const r=[],a=Math.max(e.dirty.length,i.length);for(let c=0;c<a;c+=1)r[c]=e.dirty[c]|i[c];return r}return e.dirty|i}return e.dirty}function nt(s,e,t,n,i,r){if(i){const a=_e(e,t,n,r);s.p(a,i)}}function st(s){if(s.ctx.length>32){const e=[],t=s.ctx.length/32;for(let n=0;n<t;n++)e[n]=-1;return e}return-1}function ge(s){return s==null?"":s}function L(s,e){s.appendChild(e)}function W(s,e,t){s.insertBefore(e,t||null)}function j(s){s.parentNode&&s.parentNode.removeChild(s)}function pe(s,e){for(let t=0;t<s.length;t+=1)s[t]&&s[t].d(e)}function D(s){return document.createElement(s)}function T(s){return document.createTextNode(s)}function K(){return T(" ")}function it(){return T("")}function G(s,e,t,n){return s.addEventListener(e,t,n),()=>s.removeEventListener(e,t,n)}function P(s,e,t){t==null?s.removeAttribute(e):s.getAttribute(e)!==t&&s.setAttribute(e,t)}function rt(s){return Array.from(s.childNodes)}function R(s,e){e=""+e,s.data!==e&&(s.data=e)}function Y(s,e,t,n){t==null?s.style.removeProperty(e):s.style.setProperty(e,t,"")}let se;function H(s){se=s}const x=[],ye=[];let M=[];const Ce=[],at=Promise.resolve();let te=!1;function ot(){te||(te=!0,at.then(Le))}function ne(s){M.push(s)}const X=new Set;let N=0;function Le(){if(N!==0)return;const s=se;do{try{for(;N<x.length;){const e=x[N];N++,H(e),ct(e.$$)}}catch(e){throw x.length=0,N=0,e}for(H(null),x.length=0,N=0;ye.length;)ye.pop()();for(let e=0;e<M.length;e+=1){const t=M[e];X.has(t)||(X.add(t),t())}M.length=0}while(x.length);for(;Ce.length;)Ce.pop()();te=!1,X.clear(),H(s)}function ct(s){if(s.fragment!==null){s.update(),U(s.before_update);const e=s.dirty;s.dirty=[-1],s.fragment&&s.fragment.p(s.ctx,e),s.after_update.forEach(ne)}}function lt(s){const e=[],t=[];M.forEach(n=>s.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),M=e}const z=new Set;let ut;function ie(s,e){s&&s.i&&(z.delete(s),s.i(e))}function Be(s,e,t,n){if(s&&s.o){if(z.has(s))return;z.add(s),ut.c.push(()=>{z.delete(s)}),s.o(e)}}function Q(s){return(s==null?void 0:s.length)!==void 0?s:Array.from(s)}function dt(s){s&&s.c()}function Pe(s,e,t){const{fragment:n,after_update:i}=s.$$;n&&n.m(e,t),ne(()=>{const r=s.$$.on_mount.map(ke).filter(Z);s.$$.on_destroy?s.$$.on_destroy.push(...r):U(r),s.$$.on_mount=[]}),i.forEach(ne)}function Ae(s,e){const t=s.$$;t.fragment!==null&&(lt(t.after_update),U(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function ht(s,e){s.$$.dirty[0]===-1&&(x.push(s),ot(),s.$$.dirty.fill(0)),s.$$.dirty[e/31|0]|=1<<e%31}function De(s,e,t,n,i,r,a=null,c=[-1]){const d=se;H(s);const u=s.$$={fragment:null,ctx:[],props:r,update:ee,not_equal:i,bound:he(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(d?d.$$.context:[])),callbacks:he(),dirty:c,skip_bound:!1,root:e.target||d.$$.root};a&&a(u.root);let C=!1;if(u.ctx=t?t(s,e.props||{},(h,w,...g)=>{const f=g.length?g[0]:w;return u.ctx&&i(u.ctx[h],u.ctx[h]=f)&&(!u.skip_bound&&u.bound[h]&&u.bound[h](f),C&&ht(s,h)),w}):[],u.update(),C=!0,U(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const h=rt(e.target);u.fragment&&u.fragment.l(h),h.forEach(j)}else u.fragment&&u.fragment.c();e.intro&&ie(s.$$.fragment),Pe(s,e.target,e.anchor),Le()}H(d)}class be{constructor(){de(this,"$$"),de(this,"$$set")}$destroy(){Ae(this,1),this.$destroy=ee}$on(e,t){if(!Z(t))return ee;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const i=n.indexOf(t);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!Xe(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const gt="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(gt);function yt(s){let e,t,n,i=(s[1]||"标题")+"",r,a,c,d,u,C,h=(s[4]||"取消")+"",w,g,f,E=(s[5]||"确认")+"",y,S,k,p;const A=s[8].default,I=et(A,s,s[7],null);return{c(){e=D("div"),t=D("div"),n=D("div"),r=T(i),a=K(),c=D("div"),I&&I.c(),d=K(),u=D("div"),C=D("button"),w=T(h),g=K(),f=D("button"),y=T(E),P(n,"class","model-title svelte-16iv9d0"),P(c,"class","slot svelte-16iv9d0"),P(C,"class","modal-btn svelte-16iv9d0"),P(f,"class","modal-btn success svelte-16iv9d0"),Y(f,"background-color",s[6]),P(u,"class","modal-footer svelte-16iv9d0"),P(t,"class","modal-content svelte-16iv9d0"),P(e,"class","modal-background modal-visible svelte-16iv9d0")},m(B,b){W(B,e,b),L(e,t),L(t,n),L(n,r),L(t,a),L(t,c),I&&I.m(c,null),L(t,d),L(t,u),L(u,C),L(C,w),L(u,g),L(u,f),L(f,y),S=!0,k||(p=[G(C,"click",function(){Z(s[0])&&s[0].apply(this,arguments)}),G(f,"click",function(){Z(s[2])&&s[2].apply(this,arguments)}),G(t,"click",Ct),G(e,"click",function(){Z(s[3])&&s[3].apply(this,arguments)})],k=!0)},p(B,[b]){s=B,(!S||b&2)&&i!==(i=(s[1]||"标题")+"")&&R(r,i),I&&I.p&&(!S||b&128)&&nt(I,A,s,s[7],S?tt(A,s[7],b,null):st(s[7]),null),(!S||b&16)&&h!==(h=(s[4]||"取消")+"")&&R(w,h),(!S||b&32)&&E!==(E=(s[5]||"确认")+"")&&R(y,E),(!S||b&64)&&Y(f,"background-color",s[6])},i(B){S||(ie(I,B),S=!0)},o(B){Be(I,B),S=!1},d(B){B&&j(e),I&&I.d(B),k=!1,U(p)}}}const Ct=s=>s.stopPropagation();function ft(s,e,t){let{$$slots:n={},$$scope:i}=e,{onCancel:r}=e,{title:a}=e,{onOk:c}=e,{onClose:d}=e,{cancelText:u}=e,{okText:C}=e,{theme:h}=e;return s.$$set=w=>{"onCancel"in w&&t(0,r=w.onCancel),"title"in w&&t(1,a=w.title),"onOk"in w&&t(2,c=w.onOk),"onClose"in w&&t(3,d=w.onClose),"cancelText"in w&&t(4,u=w.cancelText),"okText"in w&&t(5,C=w.okText),"theme"in w&&t(6,h=w.theme),"$$scope"in w&&t(7,i=w.$$scope)},[r,a,c,d,u,C,h,i,n]}class wt extends be{constructor(e){super(),De(this,e,ft,yt,ve,{onCancel:0,title:1,onOk:2,onClose:3,cancelText:4,okText:5,theme:6})}}function fe(s,e,t){const n=s.slice();return n[13]=e[t],n[15]=t,n}function we(s,e,t){const n=s.slice();return n[16]=e[t],n}function me(s){let e,t=(s[16].format?s[16].format(s[13]):s[13][s[16].key])+"",n;return{c(){e=D("div"),n=T(t),P(e,"class","svelte-1kh75ag"),Y(e,"width",`${100/s[1].length}%`)},m(i,r){W(i,e,r),L(e,n)},p(i,r){r&3&&t!==(t=(i[16].format?i[16].format(i[13]):i[13][i[16].key])+"")&&R(n,t),r&2&&Y(e,"width",`${100/i[1].length}%`)},d(i){i&&j(e)}}}function Ee(s){let e,t,n,i,r,a=Q(s[1]),c=[];for(let u=0;u<a.length;u+=1)c[u]=me(we(s,a,u));function d(){return s[12](s[15])}return{c(){e=D("div");for(let u=0;u<c.length;u+=1)c[u].c();t=K(),P(e,"class",n=ge(`cert-item ${s[15]===0?"cert-item-first":""} ${s[15]===s[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")},m(u,C){W(u,e,C);for(let h=0;h<c.length;h+=1)c[h]&&c[h].m(e,null);L(e,t),i||(r=G(e,"click",d),i=!0)},p(u,C){if(s=u,C&3){a=Q(s[1]);let h;for(h=0;h<a.length;h+=1){const w=we(s,a,h);c[h]?c[h].p(w,C):(c[h]=me(w),c[h].c(),c[h].m(e,t))}for(;h<c.length;h+=1)c[h].d(1);c.length=a.length}C&128&&n!==(n=ge(`cert-item ${s[15]===0?"cert-item-first":""} ${s[15]===s[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")&&P(e,"class",n)},d(u){u&&j(e),pe(c,u),i=!1,r()}}}function mt(s){let e,t=Q(s[0]),n=[];for(let i=0;i<t.length;i+=1)n[i]=Ee(fe(s,t,i));return{c(){for(let i=0;i<n.length;i+=1)n[i].c();e=it()},m(i,r){for(let a=0;a<n.length;a+=1)n[a]&&n[a].m(i,r);W(i,e,r)},p(i,r){if(r&131){t=Q(i[0]);let a;for(a=0;a<t.length;a+=1){const c=fe(i,t,a);n[a]?n[a].p(c,r):(n[a]=Ee(c),n[a].c(),n[a].m(e.parentNode,e))}for(;a<n.length;a+=1)n[a].d(1);n.length=t.length}},d(i){i&&j(e),pe(n,i)}}}function Et(s){let e,t;return e=new wt({props:{onOk:s[9],onClose:s[2],onCancel:s[8],cancelText:s[3],okText:s[4],title:s[6],theme:s[5],$$slots:{default:[mt]},$$scope:{ctx:s}}}),{c(){dt(e.$$.fragment)},m(n,i){Pe(e,n,i),t=!0},p(n,[i]){const r={};i&4&&(r.onClose=n[2]),i&8&&(r.cancelText=n[3]),i&16&&(r.okText=n[4]),i&64&&(r.title=n[6]),i&32&&(r.theme=n[5]),i&524419&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){t||(ie(e.$$.fragment,n),t=!0)},o(n){Be(e.$$.fragment,n),t=!1},d(n){Ae(e,n)}}}function St(s,e,t){let{data:n=[]}=e,{columns:i=[]}=e,{onCancel:r}=e,{onOk:a}=e,{onClose:c}=e,{cancelText:d=""}=e,{okText:u=""}=e,{theme:C="#409eff"}=e,{title:h=""}=e,w=0;const g=()=>{r(`${h}失败`),c==null||c()},f=()=>{a==null||a(n[w]),c==null||c()},E=y=>t(7,w=y);return s.$$set=y=>{"data"in y&&t(0,n=y.data),"columns"in y&&t(1,i=y.columns),"onCancel"in y&&t(10,r=y.onCancel),"onOk"in y&&t(11,a=y.onOk),"onClose"in y&&t(2,c=y.onClose),"cancelText"in y&&t(3,d=y.cancelText),"okText"in y&&t(4,u=y.okText),"theme"in y&&t(5,C=y.theme),"title"in y&&t(6,h=y.title)},[n,i,c,d,u,C,h,w,g,f,r,a,E]}class It extends be{constructor(e){super(),De(this,e,St,Et,ve,{data:0,columns:1,onCancel:10,onOk:11,onClose:2,cancelText:3,okText:4,theme:5,title:6})}}class kt{constructor(){o(this,"modalInstance",{current:null});o(this,"open",e=>new Promise((t,n)=>{this.modalInstance.current=new It({target:document.body,props:v(m({},e),{onCancel:i=>{n({code:-1,msg:i})},onOk:i=>{t(i)},onClose:()=>{this.close()}})})}));o(this,"close",()=>{setTimeout(()=>{var e;(e=this.modalInstance.current)==null||e.$destroy()})})}}const V=new kt;function vt(s=32,e=!0,t=0){const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=[];if(t=t||n.length,s)for(let r=0;r<s;r++)i[r]=n[0|Math.random()*t];else{let r;i[8]=i[13]=i[18]=i[23]="-",i[14]="4";for(let a=0;a<36;a++)i[a]||(r=0|Math.random()*16,i[a]=n[a===19?r&3|8:r])}return e?(i.shift(),`u${i.join("")}`):i.join("")}const _t=[{key:"CN"},{format:s=>`${s.DevClass}(${s.sn})`}],pt=[{key:"SealId"},{key:"Vid"},{format:s=>`${s.FileName}(${s.FileSize}B)`}],Se=[{key:"SealId"}],Lt=[{key:"manu"},{key:"sn"}];class Bt{constructor(e){o(this,"socketInstance",null);o(this,"eventBus",new Qe);o(this,"scene");o(this,"isRememberPin",!1);o(this,"pinPolicy");o(this,"socketConfig",null);o(this,"isConnecting",!1);o(this,"messageQueue",[]);o(this,"getSocketReadyState",()=>{var e;return(e=this.socketInstance)==null?void 0:e.readyState});o(this,"destroy",()=>{var e;(e=this.socketInstance)==null||e.close()});o(this,"sendMessage",(e,t,n)=>new Promise((i,r)=>{var c;const a=()=>{var h,w;if(((h=this.socketInstance)==null?void 0:h.readyState)!==WebSocket.OPEN){r({errCode:je,msg:"数字证书客户端连接失败"});return}const d=vt(),u=g=>{g.success?i(g.data):r(g)},C={function:e,args:t?[t]:[],msgid:d};(w=this.socketInstance)==null||w.send(JSON.stringify(C)),this.eventBus.on(e,u),this.eventBus.on(d,u)};if(n&&(this.scene&n)!==n){r({errCode:Ke,msg:"无权限执行此操作"});return}if(((c=this.socketInstance)==null?void 0:c.readyState)===WebSocket.OPEN){a();return}this.messageQueue.push(a),this.isConnecting||this.initSocket(this.socketConfig)}));o(this,"flushMsgQueue",()=>{var e;(e=this.messageQueue)==null||e.forEach(t=>t()),this.messageQueue=[]});o(this,"handleEventData",e=>l(this,null,function*(){var t,n,i,r,a,c,d,u;if(e.data instanceof Blob){const C=yield e.data.arrayBuffer(),w=new TextDecoder(navigator.userAgent.includes("Windows")?"gbk":"utf-8").decode(C),g=JSON.parse(w),f={success:(t=g.result)==null?void 0:t.success,msg:(n=g.result)==null?void 0:n.msg,errCode:(i=g.result)==null?void 0:i.errCode,data:g.data,type:(r=g.result)==null?void 0:r.event},E=(a=g.result)==null?void 0:a.function,y=(c=g.result)==null?void 0:c.msgid;y?this.eventBus.emit(y,f):this.eventBus.emit(E,f),(u=(d=this.socketConfig)==null?void 0:d.onMessage)==null||u.call(d,f)}}));o(this,"base64Encode",e=>{const t=new TextEncoder().encode(e);return ue.fromByteArray(t)});o(this,"base64Decode",e=>{const t=ue.toByteArray(e);return new TextDecoder().decode(t)});o(this,"changeIsRememberPin",e=>l(this,null,function*(){this.isRememberPin=e}));o(this,"changePinPolicy",e=>l(this,null,function*(){this.pinPolicy=e}));o(this,"checkCertIsLogin",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_IsLogin",e)}));o(this,"addUkeyEvents",()=>l(this,null,function*(){this.sendMessage("GZCA_WaitForDevEvent",{Type:He}),this.eventBus.on("GZCA_OnDeviceChange",e=>{var t,n,i;(i=(t=this.socketConfig)==null?void 0:t.onUkeyChange)==null||i.call(t,v(m({},e),{data:(n=e.data)==null?void 0:n[0]}))})}));o(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}))}));o(this,"verifyPin",e=>l(this,null,function*(){var t;yield this.sendMessage("GZCA_Login",{ContainerName:e.ContainerName,IsLogin:e.UserPin?"Y":"N",UserPin:(t=e.UserPin)!=null?t:"123456",PinPolicy:this.pinPolicy})}));o(this,"getCert",(e,t,n)=>l(this,null,function*(){const i=t!=null?t:yield this.chooseCert(e);return this.isRememberPin&&n&&(yield this.certLogin(i.ContainerName)),i}));o(this,"chooseCert",e=>l(this,null,function*(){var i;const t=yield this.getCertList(e);return t!=null&&t.length?(t==null?void 0:t.length)===1?t[0]:yield V.open({title:"选择证书",data:t,columns:_t,theme:(i=this.socketConfig)==null?void 0:i.theme}):Promise.reject({errCode:Ue,msg:"暂无证书"})}));o(this,"getCertList",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertList",e)}));o(this,"pkcs1Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignData",m({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"pkcs1Base64Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",m({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"batchPkcs1Base64Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_BatchPkcs1SignDataEx",m({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"pkcs1VerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySign",e)}));o(this,"pkcs1Base64VerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignEx",e)}));o(this,"getSealList",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_EnumSeals",m({IsLogin:this.getIsLogin()},e!=null?e:{}),_.LEVEL_2)}));o(this,"writeSeal",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_WriteSeal",m({IsLogin:this.getIsLogin()},e!=null?e:{}),_.LEVEL_2)}));o(this,"deleteSeal",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_DeleteSeal",m({IsLogin:this.getIsLogin()},e!=null?e:{}),_.LEVEL_2)}));o(this,"getSealInfo",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_ReadSeal",m({IsLogin:this.getIsLogin()},e!=null?e:{}),_.LEVEL_2)}));o(this,"getTPSealList",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetSealPicList",m({IsLogin:this.getIsLogin()},e!=null?e:{}),_.LEVEL_2)}));o(this,"getTPSealPic",e=>l(this,null,function*(){var n;return yield this.sendMessage("GZCA_GetSealPicData",m({IsLogin:(n=e.IsLogin)!=null?n:this.getIsLogin()},e!=null?e:{}),_.LEVEL_2)}));o(this,"sm2SignPreprocess1",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep1",e)}));o(this,"sm2SignPreprocess2",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep2",e)}));o(this,"pkcs1HashSign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataForHash",m({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"pkcs1HashVerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignForHash",e)}));o(this,"pkcs7Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7SignData",m({IsLogin:this.getIsLogin(),IsAuthAttr:"Y",PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"pkcs7VerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7VerifySign",e)}));o(this,"sm3Hash",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashData",e)}));o(this,"sm3HexHash",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashDataEx",e)}));o(this,"sm3FileHash",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashFile",e)}));o(this,"sm3HashEncryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HMac",e)}));o(this,"pkcs7Encryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7EncryptData",e)}));o(this,"pkcs7Decryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7DecryptData",m({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"pkcs7FileEncryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_EnvelopeSealFileEx_qyzc",e)}));o(this,"pkcs7FileDecryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_EnvelopeOpenFileEx_qyzc",m({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"asymmetricEncryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_AsymEncryptData",e)}));o(this,"asymmetricDecryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_AsymDecryptData",m({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"sm4Encryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_EncryptDataEx",e)}));o(this,"sm4Decryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_DecryptDataEx",e)}));o(this,"getCertInfo",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfo",e)}));o(this,"getCertInfoByOid",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfoByOid",e)}));o(this,"getSealVendor",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetSealIssuer",e,_.LEVEL_2)}));o(this,"deleteAllSealByVendor",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_ClearSeal",m({IsLogin:this.getIsLogin()},e!=null?e:{}),_.LEVEL_2)}));o(this,"applyCert",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_ApplyCert",{manu:e.manu,sn:e.sn,keyid:e.ContainerName,type:e.type,url:e.url},_.LEVEL_3)}));o(this,"resetPin",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_UnblockUserPin",m({},e!=null?e:{}),_.LEVEL_3)}));o(this,"getUKeyList",()=>l(this,null,function*(){return yield this.sendMessage("GetUKeyList",void 0,_.LEVEL_3)}));o(this,"getUKeyInfo",e=>l(this,null,function*(){return yield this.sendMessage("GetUKeyID",e!=null?e:{},_.LEVEL_3)}));var t,n,i;this.socketConfig=e,this.initSocket(e),this.isRememberPin=(t=e.isRememberPin)!=null?t:!1,this.scene=(n=e.scene)!=null?n:Ze.OPEN,this.pinPolicy=(i=e.pinPolicy)!=null?i:Ie.MIN}initSocket(e){this.isConnecting=!0;const t=new WebSocket(e.url);t.onerror=n=>{var i;this.isConnecting=!1,(i=e.onError)==null||i.call(e,n),this.flushMsgQueue()},t.onopen=n=>{var i;this.isConnecting=!1,(i=e.onOpen)==null||i.call(e,n),e.onUkeyChange&&this.addUkeyEvents(),this.flushMsgQueue()},t.onmessage=n=>{this.handleEventData(n)},t.onclose=n=>{var i;this.isConnecting=!1,(i=e.onClose)==null||i.call(e,n)},this.socketInstance=t}getIsLogin(){return this.isRememberPin?"Y":"N"}}const $=class ${constructor(e){o(this,"coreInstance",null);o(this,"gwsConfig",{});o(this,"createGwsCore",e=>{this.gwsConfig=e!=null?e:{},this.coreInstance=new Bt(v(m({},e!=null?e:{}),{url:Oe}))});o(this,"appendCertBase64",(e,t=!0)=>l(this,null,function*(){if(e.CertB64)return e;const n=t?yield this.getSignatureCert():yield this.getEncryptionCert();return v(m({},e!=null?e:{}),{CertB64:n==null?void 0:n.CertB64})}));o(this,"destroy",()=>{var e;(e=this.coreInstance)==null||e.destroy(),this.coreInstance=null});o(this,"restart",e=>{this.coreInstance&&this.destroy(),this.gwsConfig=e!=null?e:this.gwsConfig,this.createGwsCore(e)});o(this,"getSocketReadyState",()=>{var e;return(e=this.coreInstance)==null?void 0:e.getSocketReadyState()});o(this,"verifyPin",(e,t)=>l(this,null,function*(){var i,r;const n=yield this.getSignatureCert(t);return(r=this.coreInstance)==null?void 0:r.verifyPin({ContainerName:(i=n==null?void 0:n.ContainerName)!=null?i:"",UserPin:e==null?void 0:e.UserPin})}));o(this,"getSignatureCert",(e,t=!0)=>l(this,null,function*(){var i;return yield(i=this.coreInstance)==null?void 0:i.getCert({CertType:ae},e,t)}));o(this,"getSignatureCertList",()=>l(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:ae})}));o(this,"getEncryptionCert",(e,t=!0)=>l(this,null,function*(){var i;return yield(i=this.coreInstance)==null?void 0:i.getCert({CertType:oe},e,t)}));o(this,"getEncryptionCertList",()=>l(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:oe})}));o(this,"base64Encode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Encode(e.Data)});o(this,"base64Decode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Decode(e.DataB64)});o(this,"changeIsRememberPin",e=>{var t;(t=this.coreInstance)==null||t.changeIsRememberPin(e)});o(this,"changePinPolicy",e=>{var t;(t=this.coreInstance)==null||t.changePinPolicy(e)});o(this,"pkcs1Sign",(e,t)=>l(this,null,function*(){var r,a,c;const n=yield this.getSignatureCert(t),i=yield(a=this.coreInstance)==null?void 0:a.pkcs1Sign(v(m({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""}));return(c=i==null?void 0:i[0])==null?void 0:c.SignData}));o(this,"pkcs1VerifySignature",e=>l(this,null,function*(){var i;const t=yield this.appendCertBase64(e),n=yield(i=this.coreInstance)==null?void 0:i.pkcs1VerifySignature(t);return Array.isArray(n)}));o(this,"pkcs1Base64Sign",(e,t)=>l(this,null,function*(){var a,c,d,u,C;const n=yield this.getSignatureCert(t),i=(c=e.DataB64)!=null?c:this.base64Encode({Data:(a=e.Data)!=null?a:""}),r=yield(u=this.coreInstance)==null?void 0:u.pkcs1Base64Sign(v(m({},e!=null?e:{}),{ContainerName:(d=n==null?void 0:n.ContainerName)!=null?d:"",DataB64:i}));return(C=r==null?void 0:r[0])==null?void 0:C.SignData}));o(this,"batchPkcs1Base64Sign",(e,t)=>l(this,null,function*(){var C,h,w,g,f,E;const n="|",i=(h=e.DataB64)!=null?h:(C=e.Data)==null?void 0:C.map(y=>this.base64Encode({Data:y})),r=yield this.getSignatureCert(t);let a="";a=Array.isArray(i)?i==null?void 0:i.map((y,S)=>`${S}:${y}`).join(n):"";const c=yield(g=this.coreInstance)==null?void 0:g.batchPkcs1Base64Sign({ContainerName:(w=r==null?void 0:r.ContainerName)!=null?w:"",DataB64:a}),d=(E=(f=c==null?void 0:c[0])==null?void 0:f.SignData)==null?void 0:E.split(n),u=[];return d.forEach(y=>{const S=y.split(":"),k=Number(S[0]),p=S[1];u[k]=p}),u}));o(this,"pkcs1Base64VerifySignature",e=>l(this,null,function*(){var r,a,c;const t=(a=e.DataB64)!=null?a:this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=yield this.appendCertBase64(e);return!!(yield(c=this.coreInstance)==null?void 0:c.pkcs1Base64VerifySignature({CertB64:n.CertB64,DataB64:t,SignData:n.SignData}))}));o(this,"writeSeal",(e,t)=>l(this,null,function*(){var r,a;const n=yield this.getSignatureCert(t);return!!(yield(a=this.coreInstance)==null?void 0:a.writeSeal(v(m({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));o(this,"deleteSeal",e=>l(this,null,function*(){var a,c,d,u,C;const t=yield this.getSealList(e);if(!((a=t==null?void 0:t.data)!=null&&a.length))return Promise.reject({errCode:q,msg:"暂无印章"});const n=yield V.open({title:"删除印章",data:t==null?void 0:t.data,columns:Se,okText:"删除"}),i=(c=n==null?void 0:n.SealId)!=null?c:"";return!!(yield(C=this.coreInstance)==null?void 0:C.deleteSeal({ContainerName:(u=(d=t==null?void 0:t.cert)==null?void 0:d.ContainerName)!=null?u:"",SealId:i}))}));o(this,"deleteSealById",(e,t)=>l(this,null,function*(){var r,a;const n=yield this.getSignatureCert(t);return!!(yield(a=this.coreInstance)==null?void 0:a.deleteSeal(v(m({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));o(this,"getSealList",e=>l(this,null,function*(){var i,r;const t=yield this.getSignatureCert(e),n=yield(r=this.coreInstance)==null?void 0:r.getSealList({ContainerName:(i=t==null?void 0:t.ContainerName)!=null?i:"",IsLogin:"Y"});return{cert:t,data:n}}));o(this,"getSealInfo",e=>l(this,null,function*(){var r,a,c,d,u,C,h;const t=yield this.getSealList(e);if(!((r=t==null?void 0:t.data)!=null&&r.length))return Promise.reject({errCode:q,msg:"暂无印章"});const n=((a=t==null?void 0:t.data)==null?void 0:a.length)>1?yield V.open({title:"选择印章",data:t==null?void 0:t.data,columns:Se,theme:(c=this.gwsConfig)==null?void 0:c.theme}):t==null?void 0:t.data[0],i=yield(h=this.coreInstance)==null?void 0:h.getSealInfo({ContainerName:(u=(d=t==null?void 0:t.cert)==null?void 0:d.ContainerName)!=null?u:"",SealId:(C=n==null?void 0:n.SealId)!=null?C:""});return i==null?void 0:i[0]}));o(this,"getTPSealList",(e,t)=>l(this,null,function*(){var r,a;const n=yield this.getSignatureCert(t),i=yield(a=this.coreInstance)==null?void 0:a.getTPSealList({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:"",Vid:e==null?void 0:e.Vid});return{cert:n,data:i}}));o(this,"getTPSeal",(e,t)=>l(this,null,function*(){var r,a,c;const n=yield this.getTPSealList(e,t);if(!((r=n==null?void 0:n.data)!=null&&r.length))return Promise.reject({errCode:q,msg:"暂无印章"});const i=((a=n==null?void 0:n.data)==null?void 0:a.length)===1?n==null?void 0:n.data[0]:yield V.open({title:"选择印章",data:n==null?void 0:n.data,columns:pt,theme:(c=this.gwsConfig)==null?void 0:c.theme});return{cert:n==null?void 0:n.cert,data:i}}));o(this,"getTPSealPic",(e,t)=>l(this,null,function*(){var r,a,c,d,u;const n=yield this.getTPSeal(e,t),i=yield(u=this.coreInstance)==null?void 0:u.getTPSealPic(v(m({ContainerName:(a=(r=n==null?void 0:n.cert)==null?void 0:r.ContainerName)!=null?a:""},(c=n==null?void 0:n.data)!=null?c:{}),{FileSize:String((d=n==null?void 0:n.data)==null?void 0:d.FileSize)}));return i==null?void 0:i[0]}));o(this,"sm2SignPreprocess1",e=>l(this,null,function*(){var i,r;const t=yield this.appendCertBase64(e),n=yield(i=this.coreInstance)==null?void 0:i.sm2SignPreprocess1(t);return(r=n==null?void 0:n[0])==null?void 0:r.Z}));o(this,"sm2SignPreprocess2",e=>l(this,null,function*(){var r,a;const t=this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=yield this.appendCertBase64(e),i=yield(a=this.coreInstance)==null?void 0:a.sm2SignPreprocess2({CertB64:n.CertB64,DataB64:t});return i==null?void 0:i[0].H}));o(this,"pkcs1HashSign",(e,t)=>l(this,null,function*(){var r,a,c,d;const n=yield this.getSignatureCert(t),i=yield(c=this.coreInstance)==null?void 0:c.pkcs1HashSign({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:"",DataB64:e.DataB64,HashAlg:(a=e.HashAlg)!=null?a:"sm3"});return(d=i==null?void 0:i[0])==null?void 0:d.SignData}));o(this,"pkcs1HashVerifySignature",e=>l(this,null,function*(){var i,r;const t=yield this.appendCertBase64(e);return!!(yield(r=this.coreInstance)==null?void 0:r.pkcs1HashVerifySignature(v(m({},t),{HashAlg:(i=t.HashAlg)!=null?i:"sm3"})))}));o(this,"pkcs7Sign",(e,t)=>l(this,null,function*(){var a,c,d,u,C;const n=(c=e.DataB64)!=null?c:this.base64Encode({Data:(a=e.Data)!=null?a:""}),i=yield this.getSignatureCert(t),r=yield(u=this.coreInstance)==null?void 0:u.pkcs7Sign(v(m({},e!=null?e:{}),{ContainerName:(d=i==null?void 0:i.ContainerName)!=null?d:"",DataB64:n}));return(C=r==null?void 0:r[0])==null?void 0:C.SignData}));o(this,"pkcs7VerifySignature",e=>l(this,null,function*(){var i,r,a;const t=(r=e.DataB64)!=null?r:this.base64Encode({Data:(i=e.Data)!=null?i:""});return!!(yield(a=this.coreInstance)==null?void 0:a.pkcs7VerifySignature({DataB64:t,SignData:e.SignData}))}));o(this,"sm3Hash",e=>l(this,null,function*(){var n,i;const t=yield(n=this.coreInstance)==null?void 0:n.sm3Hash(e);return(i=t==null?void 0:t[0])==null?void 0:i.HashB64}));o(this,"sm3HexHash",e=>l(this,null,function*(){var n,i;const t=yield(n=this.coreInstance)==null?void 0:n.sm3HexHash(e);return(i=t==null?void 0:t[0])==null?void 0:i.HashB64}));o(this,"sm3FileHash",e=>l(this,null,function*(){var n,i;const t=yield(n=this.coreInstance)==null?void 0:n.sm3FileHash(e);return(i=t==null?void 0:t[0])==null?void 0:i.HashB64}));o(this,"sm3HashEncryption",e=>l(this,null,function*(){var r,a,c,d,u,C;const t=(a=e.DataB64)!=null?a:this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=(d=e.KeyB64)!=null?d:this.base64Encode({Data:(c=e.Key)!=null?c:""}),i=yield(u=this.coreInstance)==null?void 0:u.sm3HashEncryption({dataB64:t,keyB64:n,alg:"sm3"});return(C=i==null?void 0:i[0])==null?void 0:C.DataB64}));o(this,"pkcs7Encryption",e=>l(this,null,function*(){var i,r,a,c;if(!e.CertB64List){const d=yield this.getEncryptionCert();e.CertB64List=d==null?void 0:d.CertB64}const t=(r=e.DataB64)!=null?r:this.base64Encode({Data:(i=e.Data)!=null?i:""}),n=yield(a=this.coreInstance)==null?void 0:a.pkcs7Encryption({DataB64:t,CertB64List:e.CertB64List});return(c=n==null?void 0:n[0])==null?void 0:c.DataB64}));o(this,"pkcs7Decryption",e=>l(this,null,function*(){var r,a;const t=yield this.getEncryptionCert(),n=yield(r=this.coreInstance)==null?void 0:r.pkcs7Decryption(v(m({},e!=null?e:{}),{ContainerName:t==null?void 0:t.ContainerName})),i=(a=n==null?void 0:n[0])==null?void 0:a.DataB64;return e.shouldDecodeBase64?this.base64Decode({DataB64:i}):i}));o(this,"pkcs7FileEncryption",e=>l(this,null,function*(){var i,r;const t=yield this.appendCertBase64(e,!1),n=yield(i=this.coreInstance)==null?void 0:i.pkcs7FileEncryption(t);return(r=n==null?void 0:n[0])==null?void 0:r.DataB64}));o(this,"pkcs7FileDecryption",e=>l(this,null,function*(){var i,r,a;const t=yield this.getEncryptionCert(),n=yield(r=this.coreInstance)==null?void 0:r.pkcs7FileDecryption({SrcFile:e.SrcFile,DstFile:(i=e.DstFile)!=null?i:e.SrcFile.slice(0,-4),ContainerName:t==null?void 0:t.ContainerName});return(a=n==null?void 0:n[0])==null?void 0:a.DataB64}));o(this,"asymmetricEncryption",e=>l(this,null,function*(){var i,r;const t=yield this.appendCertBase64(e,!1),n=yield(i=this.coreInstance)==null?void 0:i.asymmetricEncryption(t);return(r=n==null?void 0:n[0])==null?void 0:r.Data}));o(this,"asymmetricDecryption",(e,t)=>l(this,null,function*(){var r,a;const n=yield this.getEncryptionCert(t),i=yield(r=this.coreInstance)==null?void 0:r.asymmetricDecryption(v(m({},e!=null?e:{}),{ContainerName:n==null?void 0:n.ContainerName}));return(a=i==null?void 0:i[0])==null?void 0:a.Data}));o(this,"sm4Encryption",e=>l(this,null,function*(){var n;const t=yield(n=this.coreInstance)==null?void 0:n.sm4Encryption(e);return t==null?void 0:t[0]}));o(this,"sm4Decryption",e=>l(this,null,function*(){var n,i;const t=yield(n=this.coreInstance)==null?void 0:n.sm4Decryption(e);return(i=t==null?void 0:t[0])==null?void 0:i.Data}));o(this,"getCertInfo",e=>l(this,null,function*(){var i,r,a,c,d;const t=yield(i=this.coreInstance)==null?void 0:i.getCertInfo(e),n=(r=t==null?void 0:t[0])!=null?r:{};for(let u=0;u<ce.length;u++){const C=ce[u];try{const h=yield(a=this.coreInstance)==null?void 0:a.getCertInfoByOid({Oid:C.oid,CertB64:e.CertB64});n[C.key]=(d=(c=h==null?void 0:h[0])==null?void 0:c.OidValue)==null?void 0:d.slice(2)}catch(h){n[C.key]=null}}return n!=null&&n.idCardNo?n!=null&&n.CertSubject.includes("O")||n.orgCode?n.certCate=Ge:n.certCate=Fe:n.certCate=Ve,n}));o(this,"getCertInfoByOid",e=>l(this,null,function*(){var n,i;const t=yield(n=this.coreInstance)==null?void 0:n.getCertInfoByOid(m({},e!=null?e:{}));return(i=t==null?void 0:t[0])==null?void 0:i.OidValue}));o(this,"getSealVendor",e=>l(this,null,function*(){var i;const t=yield this.getSignatureCert(e),n=yield(i=this.coreInstance)==null?void 0:i.getSealVendor({ContainerName:t==null?void 0:t.ContainerName});return n==null?void 0:n[0]}));o(this,"deleteAllSealByVendor",(e,t)=>l(this,null,function*(){var r;const n=yield this.getSignatureCert(t),i=yield(r=this.coreInstance)==null?void 0:r.deleteAllSealByVendor(v(m({},e!=null?e:{}),{ContainerName:n==null?void 0:n.ContainerName}));return i==null?void 0:i[0]}));o(this,"getUKeyList",e=>l(this,null,function*(){var i;if(e)return e;const t=yield(i=this.coreInstance)==null?void 0:i.getUKeyList();return yield V.open({title:"选择介质",data:t,columns:Lt})}));o(this,"getUKeyInfo",e=>l(this,null,function*(){var i;const t=yield this.getUKeyList(e),n=yield(i=this.coreInstance)==null?void 0:i.getUKeyInfo({manu:t==null?void 0:t.manu,sn:t==null?void 0:t.sn});return n==null?void 0:n[0]}));o(this,"applyCert",(e,t)=>l(this,null,function*(){var a;const n=yield this.getUKeyList(t),i=yield this.getUKeyInfo(n);return yield(a=this.coreInstance)==null?void 0:a.applyCert(v(m({},e!=null?e:{}),{manu:i==null?void 0:i.manu,sn:i==null?void 0:i.sn,ContainerName:i==null?void 0:i.keyid}))}));o(this,"resetPin",(e,t)=>l(this,null,function*(){var r;const n=yield this.getSignatureCert(t);return yield(r=this.coreInstance)==null?void 0:r.resetPin(v(m({},e!=null?e:{}),{manu:n==null?void 0:n.manu,sn:n==null?void 0:n.sn,ContainerName:n==null?void 0:n.ContainerName}))}));return $.instance&&!(e!=null&&e.isCreateNew)?$.instance:(this.createGwsCore(e),$.instance=this,this)}};o($,"instance",null);let O=$;function Pt(s){return new Promise((e,t)=>{if(O.instance&&!(s!=null&&s.isCreateNew))e(O.instance);else{const n=new O(v(m({},s!=null?s:{}),{onOpen(i){var r;e(n),(r=s==null?void 0:s.onOpen)==null||r.call(s,i)},onClose(i){var r;t(i),(r=s==null?void 0:s.onClose)==null||r.call(s,i)}}))}})}exports.GwsService=O;exports.createService=Pt;
1
+ "use strict";var Ne=Object.defineProperty,xe=Object.defineProperties;var $e=Object.getOwnPropertyDescriptors;var re=Object.getOwnPropertySymbols;var Te=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable;var J=(s,e,t)=>e in s?Ne(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,E=(s,e)=>{for(var t in e||(e={}))Te.call(e,t)&&J(s,t,e[t]);if(re)for(var t of re(e))Me.call(e,t)&&J(s,t,e[t]);return s},v=(s,e)=>xe(s,$e(e));var o=(s,e,t)=>J(s,typeof e!="symbol"?e+"":e,t);var l=(s,e,t)=>new Promise((n,i)=>{var r=d=>{try{c(t.next(d))}catch(u){i(u)}},a=d=>{try{c(t.throw(d))}catch(u){i(u)}},c=d=>d.done?n(d.value):Promise.resolve(d.value).then(r,a);c((t=t.apply(s,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Oe=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",ae="1",oe="2",Fe="1",Ge="2",Ve="3";var Ie=(s=>(s.MIN="0",s.LOW="1",s.MIDDLE="2",s.HIGH="3",s))(Ie||{});const p={LEVEL_1:1,LEVEL_2:2,LEVEL_3:4},Ze={OPEN:p.LEVEL_1,INTERNAL:p.LEVEL_2|p.LEVEL_1,OMP:p.LEVEL_3|p.LEVEL_2|p.LEVEL_1},He="00000001",q="NO_SEAL_AVAILABLE",Ue="CERTIFICATE_NOT_FOUND",je="CLIENT_CONNECTION_FAILED",Ke="ACCESS_DENIED",ce=[{oid:"1.2.86.21.1.3",key:"trustServiceNo"},{oid:"1.2.156.10260.4.1.1",key:"idCardNo"},{oid:"1.2.156.10260.4.1.4",key:"orgCode"}];function ze(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var F={},le;function Re(){if(le)return F;le=1,F.byteLength=c,F.toByteArray=u,F.fromByteArray=w;for(var s=[],e=[],t=typeof Uint8Array!="undefined"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,r=n.length;i<r;++i)s[i]=n[i],e[n.charCodeAt(i)]=i;e[45]=62,e[95]=63;function a(y){var g=y.length;if(g%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var m=y.indexOf("=");m===-1&&(m=g);var f=m===g?0:4-m%4;return[m,f]}function c(y){var g=a(y),m=g[0],f=g[1];return(m+f)*3/4-f}function d(y,g,m){return(g+m)*3/4-m}function u(y){var g,m=a(y),f=m[0],S=m[1],k=new t(d(y,f,S)),_=0,A=S>0?f-4:f,I;for(I=0;I<A;I+=4)g=e[y.charCodeAt(I)]<<18|e[y.charCodeAt(I+1)]<<12|e[y.charCodeAt(I+2)]<<6|e[y.charCodeAt(I+3)],k[_++]=g>>16&255,k[_++]=g>>8&255,k[_++]=g&255;return S===2&&(g=e[y.charCodeAt(I)]<<2|e[y.charCodeAt(I+1)]>>4,k[_++]=g&255),S===1&&(g=e[y.charCodeAt(I)]<<10|e[y.charCodeAt(I+1)]<<4|e[y.charCodeAt(I+2)]>>2,k[_++]=g>>8&255,k[_++]=g&255),k}function C(y){return s[y>>18&63]+s[y>>12&63]+s[y>>6&63]+s[y&63]}function h(y,g,m){for(var f,S=[],k=g;k<m;k+=3)f=(y[k]<<16&16711680)+(y[k+1]<<8&65280)+(y[k+2]&255),S.push(C(f));return S.join("")}function w(y){for(var g,m=y.length,f=m%3,S=[],k=16383,_=0,A=m-f;_<A;_+=k)S.push(h(y,_,_+k>A?A:_+k));return f===1?(g=y[m-1],S.push(s[g>>2]+s[g<<4&63]+"==")):f===2&&(g=(y[m-2]<<8)+y[m-1],S.push(s[g>>10]+s[g>>4&63]+s[g<<2&63]+"=")),S.join("")}return F}var Ye=Re();const ue=ze(Ye);class Qe{constructor(){o(this,"deps",new Map)}on(e,t){this.deps.set(e,t)}emit(e,t){const n=this.deps.get(e);n==null||n(t)}}(function(){try{var s=document.createElement("style");s.appendChild(document.createTextNode("button.svelte-16iv9d0{background-color:transparent;border:none;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;outline:none}.modal-background.svelte-16iv9d0{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-16iv9d0{background-color:#fff;padding:1.25rem;border-radius:.3125rem;width:40%}.model-title.svelte-16iv9d0{color:#303133;font-size:1.125rem;margin-bottom:1.125rem}.modal-visible.svelte-16iv9d0{display:flex}.modal-footer.svelte-16iv9d0{display:flex;align-items:center;justify-content:flex-end;margin-top:1rem}.modal-btn.svelte-16iv9d0{padding:.5rem .9375rem;border-radius:.25rem;font-size:.875rem;border:.0625rem solid #dcdfe6}.success.svelte-16iv9d0{margin-left:.75rem;color:#fff}.slot.svelte-16iv9d0{max-height:12.5rem;overflow-y:scroll}.slot.svelte-16iv9d0::-webkit-scrollbar{display:none}.seal-wrapper.svelte-1w19fs3.svelte-1w19fs3{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.seal-item.svelte-1w19fs3.svelte-1w19fs3{width:11.25rem;height:11.25rem;display:flex;flex-direction:column;align-items:center;justify-content:center;border:.0625rem solid #ccc;margin-top:.625rem;margin-right:.625rem;border-radius:.25rem}.seal-item.svelte-1w19fs3 img.svelte-1w19fs3{width:6.25rem;height:6.25rem}.seal-item-selected.svelte-1w19fs3.svelte-1w19fs3{background-color:#f1f1f1}.seal-name.svelte-1w19fs3.svelte-1w19fs3{margin-top:.625rem;color:#333}.cert-item.svelte-1kh75ag.svelte-1kh75ag{padding:1rem;display:flex;align-items:center;cursor:pointer;border-bottom:.0625rem solid #ebeef5;font-size:1rem}.cert-item.svelte-1kh75ag>div.svelte-1kh75ag{word-break:break-all;color:#373a40}.cert-item.svelte-1kh75ag>div.svelte-1kh75ag:nth-child(1){padding-right:.5rem}.cert-item-selected.svelte-1kh75ag.svelte-1kh75ag{background-color:#f1f1f1}.cert-item-first.svelte-1kh75ag.svelte-1kh75ag{border-top:.0625rem solid #ebeef5}")),document.head.appendChild(s)}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var We=Object.defineProperty,Je=(s,e,t)=>e in s?We(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,de=(s,e,t)=>Je(s,typeof e!="symbol"?e+"":e,t);function ee(){}function qe(s,e){for(const t in e)s[t]=e[t];return s}function ke(s){return s()}function he(){return Object.create(null)}function U(s){s.forEach(ke)}function Z(s){return typeof s=="function"}function ve(s,e){return s!=s?e==e:s!==e||s&&typeof s=="object"||typeof s=="function"}function Xe(s){return Object.keys(s).length===0}function et(s,e,t,n){if(s){const i=pe(s,e,t,n);return s[0](i)}}function pe(s,e,t,n){return s[1]&&n?qe(t.ctx.slice(),s[1](n(e))):t.ctx}function tt(s,e,t,n){if(s[2]&&n){const i=s[2](n(t));if(e.dirty===void 0)return i;if(typeof i=="object"){const r=[],a=Math.max(e.dirty.length,i.length);for(let c=0;c<a;c+=1)r[c]=e.dirty[c]|i[c];return r}return e.dirty|i}return e.dirty}function nt(s,e,t,n,i,r){if(i){const a=pe(e,t,n,r);s.p(a,i)}}function st(s){if(s.ctx.length>32){const e=[],t=s.ctx.length/32;for(let n=0;n<t;n++)e[n]=-1;return e}return-1}function ge(s){return s==null?"":s}function L(s,e){s.appendChild(e)}function W(s,e,t){s.insertBefore(e,t||null)}function j(s){s.parentNode&&s.parentNode.removeChild(s)}function _e(s,e){for(let t=0;t<s.length;t+=1)s[t]&&s[t].d(e)}function D(s){return document.createElement(s)}function T(s){return document.createTextNode(s)}function K(){return T(" ")}function it(){return T("")}function G(s,e,t,n){return s.addEventListener(e,t,n),()=>s.removeEventListener(e,t,n)}function P(s,e,t){t==null?s.removeAttribute(e):s.getAttribute(e)!==t&&s.setAttribute(e,t)}function rt(s){return Array.from(s.childNodes)}function z(s,e){e=""+e,s.data!==e&&(s.data=e)}function Y(s,e,t,n){t==null?s.style.removeProperty(e):s.style.setProperty(e,t,"")}let se;function H(s){se=s}const x=[],ye=[];let M=[];const Ce=[],at=Promise.resolve();let te=!1;function ot(){te||(te=!0,at.then(Le))}function ne(s){M.push(s)}const X=new Set;let N=0;function Le(){if(N!==0)return;const s=se;do{try{for(;N<x.length;){const e=x[N];N++,H(e),ct(e.$$)}}catch(e){throw x.length=0,N=0,e}for(H(null),x.length=0,N=0;ye.length;)ye.pop()();for(let e=0;e<M.length;e+=1){const t=M[e];X.has(t)||(X.add(t),t())}M.length=0}while(x.length);for(;Ce.length;)Ce.pop()();te=!1,X.clear(),H(s)}function ct(s){if(s.fragment!==null){s.update(),U(s.before_update);const e=s.dirty;s.dirty=[-1],s.fragment&&s.fragment.p(s.ctx,e),s.after_update.forEach(ne)}}function lt(s){const e=[],t=[];M.forEach(n=>s.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),M=e}const R=new Set;let ut;function ie(s,e){s&&s.i&&(R.delete(s),s.i(e))}function Be(s,e,t,n){if(s&&s.o){if(R.has(s))return;R.add(s),ut.c.push(()=>{R.delete(s)}),s.o(e)}}function Q(s){return(s==null?void 0:s.length)!==void 0?s:Array.from(s)}function dt(s){s&&s.c()}function Pe(s,e,t){const{fragment:n,after_update:i}=s.$$;n&&n.m(e,t),ne(()=>{const r=s.$$.on_mount.map(ke).filter(Z);s.$$.on_destroy?s.$$.on_destroy.push(...r):U(r),s.$$.on_mount=[]}),i.forEach(ne)}function Ae(s,e){const t=s.$$;t.fragment!==null&&(lt(t.after_update),U(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function ht(s,e){s.$$.dirty[0]===-1&&(x.push(s),ot(),s.$$.dirty.fill(0)),s.$$.dirty[e/31|0]|=1<<e%31}function De(s,e,t,n,i,r,a=null,c=[-1]){const d=se;H(s);const u=s.$$={fragment:null,ctx:[],props:r,update:ee,not_equal:i,bound:he(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(d?d.$$.context:[])),callbacks:he(),dirty:c,skip_bound:!1,root:e.target||d.$$.root};a&&a(u.root);let C=!1;if(u.ctx=t?t(s,e.props||{},(h,w,...y)=>{const g=y.length?y[0]:w;return u.ctx&&i(u.ctx[h],u.ctx[h]=g)&&(!u.skip_bound&&u.bound[h]&&u.bound[h](g),C&&ht(s,h)),w}):[],u.update(),C=!0,U(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const h=rt(e.target);u.fragment&&u.fragment.l(h),h.forEach(j)}else u.fragment&&u.fragment.c();e.intro&&ie(s.$$.fragment),Pe(s,e.target,e.anchor),Le()}H(d)}class be{constructor(){de(this,"$$"),de(this,"$$set")}$destroy(){Ae(this,1),this.$destroy=ee}$on(e,t){if(!Z(t))return ee;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const i=n.indexOf(t);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!Xe(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const gt="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(gt);function yt(s){let e,t,n,i=(s[1]||"标题")+"",r,a,c,d,u,C,h=(s[4]||"取消")+"",w,y,g,m=(s[5]||"确认")+"",f,S,k,_;const A=s[8].default,I=et(A,s,s[7],null);return{c(){e=D("div"),t=D("div"),n=D("div"),r=T(i),a=K(),c=D("div"),I&&I.c(),d=K(),u=D("div"),C=D("button"),w=T(h),y=K(),g=D("button"),f=T(m),P(n,"class","model-title svelte-16iv9d0"),P(c,"class","slot svelte-16iv9d0"),P(C,"class","modal-btn svelte-16iv9d0"),P(g,"class","modal-btn success svelte-16iv9d0"),Y(g,"background-color",s[6]),P(u,"class","modal-footer svelte-16iv9d0"),P(t,"class","modal-content svelte-16iv9d0"),P(e,"class","modal-background modal-visible svelte-16iv9d0")},m(B,b){W(B,e,b),L(e,t),L(t,n),L(n,r),L(t,a),L(t,c),I&&I.m(c,null),L(t,d),L(t,u),L(u,C),L(C,w),L(u,y),L(u,g),L(g,f),S=!0,k||(_=[G(C,"click",function(){Z(s[0])&&s[0].apply(this,arguments)}),G(g,"click",function(){Z(s[2])&&s[2].apply(this,arguments)}),G(t,"click",Ct),G(e,"click",function(){Z(s[3])&&s[3].apply(this,arguments)})],k=!0)},p(B,[b]){s=B,(!S||b&2)&&i!==(i=(s[1]||"标题")+"")&&z(r,i),I&&I.p&&(!S||b&128)&&nt(I,A,s,s[7],S?tt(A,s[7],b,null):st(s[7]),null),(!S||b&16)&&h!==(h=(s[4]||"取消")+"")&&z(w,h),(!S||b&32)&&m!==(m=(s[5]||"确认")+"")&&z(f,m),(!S||b&64)&&Y(g,"background-color",s[6])},i(B){S||(ie(I,B),S=!0)},o(B){Be(I,B),S=!1},d(B){B&&j(e),I&&I.d(B),k=!1,U(_)}}}const Ct=s=>s.stopPropagation();function ft(s,e,t){let{$$slots:n={},$$scope:i}=e,{onCancel:r}=e,{title:a}=e,{onOk:c}=e,{onClose:d}=e,{cancelText:u}=e,{okText:C}=e,{theme:h}=e;return s.$$set=w=>{"onCancel"in w&&t(0,r=w.onCancel),"title"in w&&t(1,a=w.title),"onOk"in w&&t(2,c=w.onOk),"onClose"in w&&t(3,d=w.onClose),"cancelText"in w&&t(4,u=w.cancelText),"okText"in w&&t(5,C=w.okText),"theme"in w&&t(6,h=w.theme),"$$scope"in w&&t(7,i=w.$$scope)},[r,a,c,d,u,C,h,i,n]}class wt extends be{constructor(e){super(),De(this,e,ft,yt,ve,{onCancel:0,title:1,onOk:2,onClose:3,cancelText:4,okText:5,theme:6})}}function fe(s,e,t){const n=s.slice();return n[13]=e[t],n[15]=t,n}function we(s,e,t){const n=s.slice();return n[16]=e[t],n}function me(s){let e,t=(s[16].format?s[16].format(s[13]):s[13][s[16].key])+"",n;return{c(){e=D("div"),n=T(t),P(e,"class","svelte-1kh75ag"),Y(e,"width",`${100/s[1].length}%`)},m(i,r){W(i,e,r),L(e,n)},p(i,r){r&3&&t!==(t=(i[16].format?i[16].format(i[13]):i[13][i[16].key])+"")&&z(n,t),r&2&&Y(e,"width",`${100/i[1].length}%`)},d(i){i&&j(e)}}}function Ee(s){let e,t,n,i,r,a=Q(s[1]),c=[];for(let u=0;u<a.length;u+=1)c[u]=me(we(s,a,u));function d(){return s[12](s[15])}return{c(){e=D("div");for(let u=0;u<c.length;u+=1)c[u].c();t=K(),P(e,"class",n=ge(`cert-item ${s[15]===0?"cert-item-first":""} ${s[15]===s[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")},m(u,C){W(u,e,C);for(let h=0;h<c.length;h+=1)c[h]&&c[h].m(e,null);L(e,t),i||(r=G(e,"click",d),i=!0)},p(u,C){if(s=u,C&3){a=Q(s[1]);let h;for(h=0;h<a.length;h+=1){const w=we(s,a,h);c[h]?c[h].p(w,C):(c[h]=me(w),c[h].c(),c[h].m(e,t))}for(;h<c.length;h+=1)c[h].d(1);c.length=a.length}C&128&&n!==(n=ge(`cert-item ${s[15]===0?"cert-item-first":""} ${s[15]===s[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")&&P(e,"class",n)},d(u){u&&j(e),_e(c,u),i=!1,r()}}}function mt(s){let e,t=Q(s[0]),n=[];for(let i=0;i<t.length;i+=1)n[i]=Ee(fe(s,t,i));return{c(){for(let i=0;i<n.length;i+=1)n[i].c();e=it()},m(i,r){for(let a=0;a<n.length;a+=1)n[a]&&n[a].m(i,r);W(i,e,r)},p(i,r){if(r&131){t=Q(i[0]);let a;for(a=0;a<t.length;a+=1){const c=fe(i,t,a);n[a]?n[a].p(c,r):(n[a]=Ee(c),n[a].c(),n[a].m(e.parentNode,e))}for(;a<n.length;a+=1)n[a].d(1);n.length=t.length}},d(i){i&&j(e),_e(n,i)}}}function Et(s){let e,t;return e=new wt({props:{onOk:s[9],onClose:s[2],onCancel:s[8],cancelText:s[3],okText:s[4],title:s[6],theme:s[5],$$slots:{default:[mt]},$$scope:{ctx:s}}}),{c(){dt(e.$$.fragment)},m(n,i){Pe(e,n,i),t=!0},p(n,[i]){const r={};i&4&&(r.onClose=n[2]),i&8&&(r.cancelText=n[3]),i&16&&(r.okText=n[4]),i&64&&(r.title=n[6]),i&32&&(r.theme=n[5]),i&524419&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){t||(ie(e.$$.fragment,n),t=!0)},o(n){Be(e.$$.fragment,n),t=!1},d(n){Ae(e,n)}}}function St(s,e,t){let{data:n=[]}=e,{columns:i=[]}=e,{onCancel:r}=e,{onOk:a}=e,{onClose:c}=e,{cancelText:d=""}=e,{okText:u=""}=e,{theme:C="#409eff"}=e,{title:h=""}=e,w=0;const y=()=>{r(`${h}失败`),c==null||c()},g=()=>{a==null||a(n[w]),c==null||c()},m=f=>t(7,w=f);return s.$$set=f=>{"data"in f&&t(0,n=f.data),"columns"in f&&t(1,i=f.columns),"onCancel"in f&&t(10,r=f.onCancel),"onOk"in f&&t(11,a=f.onOk),"onClose"in f&&t(2,c=f.onClose),"cancelText"in f&&t(3,d=f.cancelText),"okText"in f&&t(4,u=f.okText),"theme"in f&&t(5,C=f.theme),"title"in f&&t(6,h=f.title)},[n,i,c,d,u,C,h,w,y,g,r,a,m]}class It extends be{constructor(e){super(),De(this,e,St,Et,ve,{data:0,columns:1,onCancel:10,onOk:11,onClose:2,cancelText:3,okText:4,theme:5,title:6})}}class kt{constructor(){o(this,"modalInstance",{current:null});o(this,"open",e=>new Promise((t,n)=>{this.modalInstance.current=new It({target:document.body,props:v(E({},e),{onCancel:i=>{n({code:-1,msg:i})},onOk:i=>{t(i)},onClose:()=>{this.close()}})})}));o(this,"close",()=>{setTimeout(()=>{var e;(e=this.modalInstance.current)==null||e.$destroy()})})}}const V=new kt;function vt(s=32,e=!0,t=0){const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=[];if(t=t||n.length,s)for(let r=0;r<s;r++)i[r]=n[0|Math.random()*t];else{let r;i[8]=i[13]=i[18]=i[23]="-",i[14]="4";for(let a=0;a<36;a++)i[a]||(r=0|Math.random()*16,i[a]=n[a===19?r&3|8:r])}return e?(i.shift(),`u${i.join("")}`):i.join("")}const pt=[{key:"CN"},{format:s=>`${s.DevClass}(${s.sn})`}],_t=[{key:"SealId"},{key:"Vid"},{format:s=>`${s.FileName}(${s.FileSize}B)`}],Se=[{key:"SealId"}],Lt=[{key:"manu"},{key:"sn"}];class Bt{constructor(e){o(this,"socketInstance",null);o(this,"eventBus",new Qe);o(this,"scene");o(this,"isRememberPin",!1);o(this,"pinPolicy");o(this,"socketConfig",null);o(this,"isConnecting",!1);o(this,"messageQueue",[]);o(this,"getSocketReadyState",()=>{var e;return(e=this.socketInstance)==null?void 0:e.readyState});o(this,"destroy",()=>{var e;(e=this.socketInstance)==null||e.close()});o(this,"sendMessage",(e,t,n)=>new Promise((i,r)=>{var c;const a=()=>{var h,w;if(((h=this.socketInstance)==null?void 0:h.readyState)!==WebSocket.OPEN){r({errCode:je,msg:"数字证书客户端连接失败"});return}const d=vt(),u=y=>{y.success?i(y.data):r(y)},C={function:e,args:t?[t]:[],msgid:d};(w=this.socketInstance)==null||w.send(JSON.stringify(C)),this.eventBus.on(e,u),this.eventBus.on(d,u)};if(n&&(this.scene&n)!==n){r({errCode:Ke,msg:"无权限执行此操作"});return}if(((c=this.socketInstance)==null?void 0:c.readyState)===WebSocket.OPEN){a();return}this.messageQueue.push(a),this.isConnecting||this.initSocket(this.socketConfig)}));o(this,"flushMsgQueue",()=>{var e;(e=this.messageQueue)==null||e.forEach(t=>t()),this.messageQueue=[]});o(this,"handleEventData",e=>l(this,null,function*(){var t,n,i,r,a,c,d,u;if(e.data instanceof Blob){const C=yield e.data.arrayBuffer(),y=new TextDecoder(navigator.userAgent.includes("Windows")?"gbk":"utf-8").decode(C).replace(/\\(?!(["\\\/bfnrtu]))/g,""),g=JSON.parse(y),m={success:(t=g.result)==null?void 0:t.success,msg:(n=g.result)==null?void 0:n.msg,errCode:(i=g.result)==null?void 0:i.errCode,data:g.data,type:(r=g.result)==null?void 0:r.event},f=(a=g.result)==null?void 0:a.function,S=(c=g.result)==null?void 0:c.msgid;S?this.eventBus.emit(S,m):this.eventBus.emit(f,m),(u=(d=this.socketConfig)==null?void 0:d.onMessage)==null||u.call(d,m)}}));o(this,"base64Encode",e=>{const t=new TextEncoder().encode(e);return ue.fromByteArray(t)});o(this,"base64Decode",e=>{const t=ue.toByteArray(e);return new TextDecoder().decode(t)});o(this,"changeIsRememberPin",e=>l(this,null,function*(){this.isRememberPin=e}));o(this,"changePinPolicy",e=>l(this,null,function*(){this.pinPolicy=e}));o(this,"checkCertIsLogin",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_IsLogin",e)}));o(this,"addUkeyEvents",()=>l(this,null,function*(){this.sendMessage("GZCA_WaitForDevEvent",{Type:He}),this.eventBus.on("GZCA_OnDeviceChange",e=>{var t,n,i;(i=(t=this.socketConfig)==null?void 0:t.onUkeyChange)==null||i.call(t,v(E({},e),{data:(n=e.data)==null?void 0:n[0]}))})}));o(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}))}));o(this,"verifyPin",e=>l(this,null,function*(){var t;yield this.sendMessage("GZCA_Login",{ContainerName:e.ContainerName,IsLogin:e.UserPin?"Y":"N",UserPin:(t=e.UserPin)!=null?t:"123456",PinPolicy:this.pinPolicy})}));o(this,"getCert",(e,t,n)=>l(this,null,function*(){const i=t!=null?t:yield this.chooseCert(e);return this.isRememberPin&&n&&(yield this.certLogin(i.ContainerName)),i}));o(this,"chooseCert",e=>l(this,null,function*(){var i;const t=yield this.getCertList(e);return t!=null&&t.length?(t==null?void 0:t.length)===1?t[0]:yield V.open({title:"选择证书",data:t,columns:pt,theme:(i=this.socketConfig)==null?void 0:i.theme}):Promise.reject({errCode:Ue,msg:"暂无证书"})}));o(this,"getCertList",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertList",e)}));o(this,"pkcs1Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignData",E({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"pkcs1Base64Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",E({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"batchPkcs1Base64Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_BatchPkcs1SignDataEx",E({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"pkcs1VerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySign",e)}));o(this,"pkcs1Base64VerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignEx",e)}));o(this,"getSealList",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_EnumSeals",E({IsLogin:this.getIsLogin()},e!=null?e:{}),p.LEVEL_2)}));o(this,"writeSeal",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_WriteSeal",E({IsLogin:this.getIsLogin()},e!=null?e:{}),p.LEVEL_2)}));o(this,"deleteSeal",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_DeleteSeal",E({IsLogin:this.getIsLogin()},e!=null?e:{}),p.LEVEL_2)}));o(this,"getSealInfo",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_ReadSeal",E({IsLogin:this.getIsLogin()},e!=null?e:{}),p.LEVEL_2)}));o(this,"getTPSealList",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetSealPicList",E({IsLogin:this.getIsLogin()},e!=null?e:{}),p.LEVEL_2)}));o(this,"getTPSealPic",e=>l(this,null,function*(){var n;return yield this.sendMessage("GZCA_GetSealPicData",E({IsLogin:(n=e.IsLogin)!=null?n:this.getIsLogin()},e!=null?e:{}),p.LEVEL_2)}));o(this,"sm2SignPreprocess1",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep1",e)}));o(this,"sm2SignPreprocess2",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep2",e)}));o(this,"pkcs1HashSign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataForHash",E({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"pkcs1HashVerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignForHash",e)}));o(this,"pkcs7Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7SignData",E({IsLogin:this.getIsLogin(),IsAuthAttr:"Y",PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"pkcs7VerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7VerifySign",e)}));o(this,"sm3Hash",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashData",e)}));o(this,"sm3HexHash",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashDataEx",e)}));o(this,"sm3FileHash",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashFile",e)}));o(this,"sm3HashEncryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HMac",e)}));o(this,"pkcs7Encryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7EncryptData",e)}));o(this,"pkcs7Decryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7DecryptData",E({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"pkcs7FileEncryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_EnvelopeSealFileEx_qyzc",e)}));o(this,"pkcs7FileDecryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_EnvelopeOpenFileEx_qyzc",E({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"asymmetricEncryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_AsymEncryptData",e)}));o(this,"asymmetricDecryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_AsymDecryptData",E({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"sm4Encryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_EncryptDataEx",e)}));o(this,"sm4Decryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_DecryptDataEx",e)}));o(this,"getCertInfo",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfo",e)}));o(this,"getCertInfoByOid",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfoByOid",e)}));o(this,"getSealVendor",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetSealIssuer",e,p.LEVEL_2)}));o(this,"deleteAllSealByVendor",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_ClearSeal",E({IsLogin:this.getIsLogin()},e!=null?e:{}),p.LEVEL_2)}));o(this,"applyCert",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_ApplyCert",{manu:e.manu,sn:e.sn,keyid:e.ContainerName,type:e.type,url:e.url},p.LEVEL_3)}));o(this,"resetPin",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_UnblockUserPin",E({},e!=null?e:{}),p.LEVEL_3)}));o(this,"getUKeyList",()=>l(this,null,function*(){return yield this.sendMessage("GetUKeyList",void 0,p.LEVEL_3)}));o(this,"getUKeyInfo",e=>l(this,null,function*(){return yield this.sendMessage("GetUKeyID",e!=null?e:{},p.LEVEL_3)}));var t,n,i;this.socketConfig=e,this.initSocket(e),this.isRememberPin=(t=e.isRememberPin)!=null?t:!1,this.scene=(n=e.scene)!=null?n:Ze.OPEN,this.pinPolicy=(i=e.pinPolicy)!=null?i:Ie.MIN}initSocket(e){this.isConnecting=!0;const t=new WebSocket(e.url);t.onerror=n=>{var i;this.isConnecting=!1,(i=e.onError)==null||i.call(e,n),this.flushMsgQueue()},t.onopen=n=>{var i;this.isConnecting=!1,(i=e.onOpen)==null||i.call(e,n),e.onUkeyChange&&this.addUkeyEvents(),this.flushMsgQueue()},t.onmessage=n=>{this.handleEventData(n)},t.onclose=n=>{var i;this.isConnecting=!1,(i=e.onClose)==null||i.call(e,n)},this.socketInstance=t}getIsLogin(){return this.isRememberPin?"Y":"N"}}const $=class ${constructor(e){o(this,"coreInstance",null);o(this,"gwsConfig",{});o(this,"createGwsCore",e=>{this.gwsConfig=e!=null?e:{},this.coreInstance=new Bt(v(E({},e!=null?e:{}),{url:Oe}))});o(this,"appendCertBase64",(e,t=!0)=>l(this,null,function*(){if(e.CertB64)return e;const n=t?yield this.getSignatureCert():yield this.getEncryptionCert();return v(E({},e!=null?e:{}),{CertB64:n==null?void 0:n.CertB64})}));o(this,"destroy",()=>{var e;(e=this.coreInstance)==null||e.destroy(),this.coreInstance=null});o(this,"restart",e=>{this.coreInstance&&this.destroy(),this.gwsConfig=e!=null?e:this.gwsConfig,this.createGwsCore(e)});o(this,"getSocketReadyState",()=>{var e;return(e=this.coreInstance)==null?void 0:e.getSocketReadyState()});o(this,"verifyPin",(e,t)=>l(this,null,function*(){var i,r;const n=yield this.getSignatureCert(t);return(r=this.coreInstance)==null?void 0:r.verifyPin({ContainerName:(i=n==null?void 0:n.ContainerName)!=null?i:"",UserPin:e==null?void 0:e.UserPin})}));o(this,"getSignatureCert",(e,t=!0)=>l(this,null,function*(){var i;return yield(i=this.coreInstance)==null?void 0:i.getCert({CertType:ae},e,t)}));o(this,"getSignatureCertList",()=>l(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:ae})}));o(this,"getEncryptionCert",(e,t=!0)=>l(this,null,function*(){var i;return yield(i=this.coreInstance)==null?void 0:i.getCert({CertType:oe},e,t)}));o(this,"getEncryptionCertList",()=>l(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:oe})}));o(this,"base64Encode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Encode(e.Data)});o(this,"base64Decode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Decode(e.DataB64)});o(this,"changeIsRememberPin",e=>{var t;(t=this.coreInstance)==null||t.changeIsRememberPin(e)});o(this,"changePinPolicy",e=>{var t;(t=this.coreInstance)==null||t.changePinPolicy(e)});o(this,"pkcs1Sign",(e,t)=>l(this,null,function*(){var r,a,c;const n=yield this.getSignatureCert(t),i=yield(a=this.coreInstance)==null?void 0:a.pkcs1Sign(v(E({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""}));return(c=i==null?void 0:i[0])==null?void 0:c.SignData}));o(this,"pkcs1VerifySignature",e=>l(this,null,function*(){var i;const t=yield this.appendCertBase64(e),n=yield(i=this.coreInstance)==null?void 0:i.pkcs1VerifySignature(t);return Array.isArray(n)}));o(this,"pkcs1Base64Sign",(e,t)=>l(this,null,function*(){var a,c,d,u,C;const n=yield this.getSignatureCert(t),i=(c=e.DataB64)!=null?c:this.base64Encode({Data:(a=e.Data)!=null?a:""}),r=yield(u=this.coreInstance)==null?void 0:u.pkcs1Base64Sign(v(E({},e!=null?e:{}),{ContainerName:(d=n==null?void 0:n.ContainerName)!=null?d:"",DataB64:i}));return(C=r==null?void 0:r[0])==null?void 0:C.SignData}));o(this,"batchPkcs1Base64Sign",(e,t)=>l(this,null,function*(){var C,h,w,y,g,m;const n="|",i=(h=e.DataB64)!=null?h:(C=e.Data)==null?void 0:C.map(f=>this.base64Encode({Data:f})),r=yield this.getSignatureCert(t);let a="";a=Array.isArray(i)?i==null?void 0:i.map((f,S)=>`${S}:${f}`).join(n):"";const c=yield(y=this.coreInstance)==null?void 0:y.batchPkcs1Base64Sign({ContainerName:(w=r==null?void 0:r.ContainerName)!=null?w:"",DataB64:a}),d=(m=(g=c==null?void 0:c[0])==null?void 0:g.SignData)==null?void 0:m.split(n),u=[];return d.forEach(f=>{const S=f.split(":"),k=Number(S[0]),_=S[1];u[k]=_}),u}));o(this,"pkcs1Base64VerifySignature",e=>l(this,null,function*(){var r,a,c;const t=(a=e.DataB64)!=null?a:this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=yield this.appendCertBase64(e);return!!(yield(c=this.coreInstance)==null?void 0:c.pkcs1Base64VerifySignature({CertB64:n.CertB64,DataB64:t,SignData:n.SignData}))}));o(this,"writeSeal",(e,t)=>l(this,null,function*(){var r,a;const n=yield this.getSignatureCert(t);return!!(yield(a=this.coreInstance)==null?void 0:a.writeSeal(v(E({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));o(this,"deleteSeal",e=>l(this,null,function*(){var a,c,d,u,C;const t=yield this.getSealList(e);if(!((a=t==null?void 0:t.data)!=null&&a.length))return Promise.reject({errCode:q,msg:"暂无印章"});const n=yield V.open({title:"删除印章",data:t==null?void 0:t.data,columns:Se,okText:"删除"}),i=(c=n==null?void 0:n.SealId)!=null?c:"";return!!(yield(C=this.coreInstance)==null?void 0:C.deleteSeal({ContainerName:(u=(d=t==null?void 0:t.cert)==null?void 0:d.ContainerName)!=null?u:"",SealId:i}))}));o(this,"deleteSealById",(e,t)=>l(this,null,function*(){var r,a;const n=yield this.getSignatureCert(t);return!!(yield(a=this.coreInstance)==null?void 0:a.deleteSeal(v(E({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));o(this,"getSealList",e=>l(this,null,function*(){var i,r;const t=yield this.getSignatureCert(e),n=yield(r=this.coreInstance)==null?void 0:r.getSealList({ContainerName:(i=t==null?void 0:t.ContainerName)!=null?i:"",IsLogin:"Y"});return{cert:t,data:n}}));o(this,"getSealInfo",e=>l(this,null,function*(){var r,a,c,d,u,C,h;const t=yield this.getSealList(e);if(!((r=t==null?void 0:t.data)!=null&&r.length))return Promise.reject({errCode:q,msg:"暂无印章"});const n=((a=t==null?void 0:t.data)==null?void 0:a.length)>1?yield V.open({title:"选择印章",data:t==null?void 0:t.data,columns:Se,theme:(c=this.gwsConfig)==null?void 0:c.theme}):t==null?void 0:t.data[0],i=yield(h=this.coreInstance)==null?void 0:h.getSealInfo({ContainerName:(u=(d=t==null?void 0:t.cert)==null?void 0:d.ContainerName)!=null?u:"",SealId:(C=n==null?void 0:n.SealId)!=null?C:""});return i==null?void 0:i[0]}));o(this,"getTPSealList",(e,t)=>l(this,null,function*(){var r,a;const n=yield this.getSignatureCert(t),i=yield(a=this.coreInstance)==null?void 0:a.getTPSealList({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:"",Vid:e==null?void 0:e.Vid});return{cert:n,data:i}}));o(this,"getTPSeal",(e,t)=>l(this,null,function*(){var r,a,c;const n=yield this.getTPSealList(e,t);if(!((r=n==null?void 0:n.data)!=null&&r.length))return Promise.reject({errCode:q,msg:"暂无印章"});const i=((a=n==null?void 0:n.data)==null?void 0:a.length)===1?n==null?void 0:n.data[0]:yield V.open({title:"选择印章",data:n==null?void 0:n.data,columns:_t,theme:(c=this.gwsConfig)==null?void 0:c.theme});return{cert:n==null?void 0:n.cert,data:i}}));o(this,"getTPSealPic",(e,t)=>l(this,null,function*(){var r,a,c,d,u;const n=yield this.getTPSeal(e,t),i=yield(u=this.coreInstance)==null?void 0:u.getTPSealPic(v(E({ContainerName:(a=(r=n==null?void 0:n.cert)==null?void 0:r.ContainerName)!=null?a:""},(c=n==null?void 0:n.data)!=null?c:{}),{FileSize:String((d=n==null?void 0:n.data)==null?void 0:d.FileSize)}));return i==null?void 0:i[0]}));o(this,"sm2SignPreprocess1",e=>l(this,null,function*(){var i,r;const t=yield this.appendCertBase64(e),n=yield(i=this.coreInstance)==null?void 0:i.sm2SignPreprocess1(t);return(r=n==null?void 0:n[0])==null?void 0:r.Z}));o(this,"sm2SignPreprocess2",e=>l(this,null,function*(){var r,a;const t=this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=yield this.appendCertBase64(e),i=yield(a=this.coreInstance)==null?void 0:a.sm2SignPreprocess2({CertB64:n.CertB64,DataB64:t});return i==null?void 0:i[0].H}));o(this,"pkcs1HashSign",(e,t)=>l(this,null,function*(){var r,a,c,d;const n=yield this.getSignatureCert(t),i=yield(c=this.coreInstance)==null?void 0:c.pkcs1HashSign({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:"",DataB64:e.DataB64,HashAlg:(a=e.HashAlg)!=null?a:"sm3"});return(d=i==null?void 0:i[0])==null?void 0:d.SignData}));o(this,"pkcs1HashVerifySignature",e=>l(this,null,function*(){var i,r;const t=yield this.appendCertBase64(e);return!!(yield(r=this.coreInstance)==null?void 0:r.pkcs1HashVerifySignature(v(E({},t),{HashAlg:(i=t.HashAlg)!=null?i:"sm3"})))}));o(this,"pkcs7Sign",(e,t)=>l(this,null,function*(){var a,c,d,u,C;const n=(c=e.DataB64)!=null?c:this.base64Encode({Data:(a=e.Data)!=null?a:""}),i=yield this.getSignatureCert(t),r=yield(u=this.coreInstance)==null?void 0:u.pkcs7Sign(v(E({},e!=null?e:{}),{ContainerName:(d=i==null?void 0:i.ContainerName)!=null?d:"",DataB64:n}));return(C=r==null?void 0:r[0])==null?void 0:C.SignData}));o(this,"pkcs7VerifySignature",e=>l(this,null,function*(){var i,r,a;const t=(r=e.DataB64)!=null?r:this.base64Encode({Data:(i=e.Data)!=null?i:""});return!!(yield(a=this.coreInstance)==null?void 0:a.pkcs7VerifySignature({DataB64:t,SignData:e.SignData}))}));o(this,"sm3Hash",e=>l(this,null,function*(){var n,i;const t=yield(n=this.coreInstance)==null?void 0:n.sm3Hash(e);return(i=t==null?void 0:t[0])==null?void 0:i.HashB64}));o(this,"sm3HexHash",e=>l(this,null,function*(){var n,i;const t=yield(n=this.coreInstance)==null?void 0:n.sm3HexHash(e);return(i=t==null?void 0:t[0])==null?void 0:i.HashB64}));o(this,"sm3FileHash",e=>l(this,null,function*(){var n,i;const t=yield(n=this.coreInstance)==null?void 0:n.sm3FileHash(e);return(i=t==null?void 0:t[0])==null?void 0:i.HashB64}));o(this,"sm3HashEncryption",e=>l(this,null,function*(){var r,a,c,d,u,C;const t=(a=e.DataB64)!=null?a:this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=(d=e.KeyB64)!=null?d:this.base64Encode({Data:(c=e.Key)!=null?c:""}),i=yield(u=this.coreInstance)==null?void 0:u.sm3HashEncryption({dataB64:t,keyB64:n,alg:"sm3"});return(C=i==null?void 0:i[0])==null?void 0:C.DataB64}));o(this,"pkcs7Encryption",e=>l(this,null,function*(){var i,r,a,c;if(!e.CertB64List){const d=yield this.getEncryptionCert();e.CertB64List=d==null?void 0:d.CertB64}const t=(r=e.DataB64)!=null?r:this.base64Encode({Data:(i=e.Data)!=null?i:""}),n=yield(a=this.coreInstance)==null?void 0:a.pkcs7Encryption({DataB64:t,CertB64List:e.CertB64List});return(c=n==null?void 0:n[0])==null?void 0:c.DataB64}));o(this,"pkcs7Decryption",e=>l(this,null,function*(){var r,a;const t=yield this.getEncryptionCert(),n=yield(r=this.coreInstance)==null?void 0:r.pkcs7Decryption(v(E({},e!=null?e:{}),{ContainerName:t==null?void 0:t.ContainerName})),i=(a=n==null?void 0:n[0])==null?void 0:a.DataB64;return e.shouldDecodeBase64?this.base64Decode({DataB64:i}):i}));o(this,"pkcs7FileEncryption",e=>l(this,null,function*(){var i,r;const t=yield this.appendCertBase64(e,!1),n=yield(i=this.coreInstance)==null?void 0:i.pkcs7FileEncryption(t);return(r=n==null?void 0:n[0])==null?void 0:r.DataB64}));o(this,"pkcs7FileDecryption",e=>l(this,null,function*(){var i,r,a;const t=yield this.getEncryptionCert(),n=yield(r=this.coreInstance)==null?void 0:r.pkcs7FileDecryption({SrcFile:e.SrcFile,DstFile:(i=e.DstFile)!=null?i:e.SrcFile.slice(0,-4),ContainerName:t==null?void 0:t.ContainerName});return(a=n==null?void 0:n[0])==null?void 0:a.DataB64}));o(this,"asymmetricEncryption",e=>l(this,null,function*(){var i,r;const t=yield this.appendCertBase64(e,!1),n=yield(i=this.coreInstance)==null?void 0:i.asymmetricEncryption(t);return(r=n==null?void 0:n[0])==null?void 0:r.Data}));o(this,"asymmetricDecryption",(e,t)=>l(this,null,function*(){var r,a;const n=yield this.getEncryptionCert(t),i=yield(r=this.coreInstance)==null?void 0:r.asymmetricDecryption(v(E({},e!=null?e:{}),{ContainerName:n==null?void 0:n.ContainerName}));return(a=i==null?void 0:i[0])==null?void 0:a.Data}));o(this,"sm4Encryption",e=>l(this,null,function*(){var n;const t=yield(n=this.coreInstance)==null?void 0:n.sm4Encryption(e);return t==null?void 0:t[0]}));o(this,"sm4Decryption",e=>l(this,null,function*(){var n,i;const t=yield(n=this.coreInstance)==null?void 0:n.sm4Decryption(e);return(i=t==null?void 0:t[0])==null?void 0:i.Data}));o(this,"getCertInfo",e=>l(this,null,function*(){var i,r,a,c,d;const t=yield(i=this.coreInstance)==null?void 0:i.getCertInfo(e),n=(r=t==null?void 0:t[0])!=null?r:{};for(let u=0;u<ce.length;u++){const C=ce[u];try{const h=yield(a=this.coreInstance)==null?void 0:a.getCertInfoByOid({Oid:C.oid,CertB64:e.CertB64});n[C.key]=(d=(c=h==null?void 0:h[0])==null?void 0:c.OidValue)==null?void 0:d.replace(".","")}catch(h){n[C.key]=null}}return n!=null&&n.idCardNo?n!=null&&n.CertSubject.includes("O=")||n.orgCode?n.certCate=Ge:n.certCate=Fe:n.certCate=Ve,n}));o(this,"getCertInfoByOid",e=>l(this,null,function*(){var n,i;const t=yield(n=this.coreInstance)==null?void 0:n.getCertInfoByOid(E({},e!=null?e:{}));return(i=t==null?void 0:t[0])==null?void 0:i.OidValue}));o(this,"getSealVendor",e=>l(this,null,function*(){var i;const t=yield this.getSignatureCert(e),n=yield(i=this.coreInstance)==null?void 0:i.getSealVendor({ContainerName:t==null?void 0:t.ContainerName});return n==null?void 0:n[0]}));o(this,"deleteAllSealByVendor",(e,t)=>l(this,null,function*(){var r;const n=yield this.getSignatureCert(t),i=yield(r=this.coreInstance)==null?void 0:r.deleteAllSealByVendor(v(E({},e!=null?e:{}),{ContainerName:n==null?void 0:n.ContainerName}));return i==null?void 0:i[0]}));o(this,"getUKey",e=>l(this,null,function*(){var i;if(e)return e;const t=yield(i=this.coreInstance)==null?void 0:i.getUKeyList();return yield V.open({title:"选择介质",data:t,columns:Lt})}));o(this,"getUKeyInfo",e=>l(this,null,function*(){var i;const t=yield this.getUKey(e),n=yield(i=this.coreInstance)==null?void 0:i.getUKeyInfo({manu:t==null?void 0:t.manu,sn:t==null?void 0:t.sn});return n==null?void 0:n[0]}));o(this,"applyCert",(e,t)=>l(this,null,function*(){var a;const n=yield this.getUKey(t),i=yield this.getUKeyInfo(n);return yield(a=this.coreInstance)==null?void 0:a.applyCert(v(E({},e!=null?e:{}),{manu:i==null?void 0:i.manu,sn:i==null?void 0:i.sn,ContainerName:i==null?void 0:i.keyid}))}));o(this,"resetPin",(e,t)=>l(this,null,function*(){var r;const n=yield this.getSignatureCert(t);return yield(r=this.coreInstance)==null?void 0:r.resetPin(v(E({},e!=null?e:{}),{manu:n==null?void 0:n.manu,sn:n==null?void 0:n.sn,ContainerName:n==null?void 0:n.ContainerName}))}));return $.instance&&!(e!=null&&e.isCreateNew)?$.instance:(this.createGwsCore(e),$.instance=this,this)}};o($,"instance",null);let O=$;function Pt(s){return new Promise((e,t)=>{if(O.instance&&!(s!=null&&s.isCreateNew))e(O.instance);else{const n=new O(v(E({},s!=null?s:{}),{onOpen(i){var r;e(n),(r=s==null?void 0:s.onOpen)==null||r.call(s,i)},onClose(i){var r;t(i),(r=s==null?void 0:s.onClose)==null||r.call(s,i)}}))}})}exports.GwsService=O;exports.createService=Pt;
package/dist/index.d.ts CHANGED
@@ -190,7 +190,7 @@ export declare class GwsService {
190
190
  deleteAllSealByVendor: (params: {
191
191
  SealIssuer: string;
192
192
  }, curCert?: CertType) => Promise<any>;
193
- getUKeyList: (curUkey?: UkeyType) => Promise<UkeyType>;
193
+ getUKey: (curUkey?: UkeyType) => Promise<UkeyType>;
194
194
  getUKeyInfo: (curUkey?: UkeyType) => Promise<any>;
195
195
  applyCert: (params: {
196
196
  type: string;
package/dist/index.es.js CHANGED
@@ -2,7 +2,7 @@ var Ne = Object.defineProperty, xe = Object.defineProperties;
2
2
  var $e = Object.getOwnPropertyDescriptors;
3
3
  var re = Object.getOwnPropertySymbols;
4
4
  var Te = Object.prototype.hasOwnProperty, Me = Object.prototype.propertyIsEnumerable;
5
- var J = (s, e, t) => e in s ? Ne(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, m = (s, e) => {
5
+ var J = (s, e, t) => e in s ? Ne(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, E = (s, e) => {
6
6
  for (var t in e || (e = {}))
7
7
  Te.call(e, t) && J(s, t, e[t]);
8
8
  if (re)
@@ -29,14 +29,14 @@ var l = (s, e, t) => new Promise((n, i) => {
29
29
  });
30
30
  const Oe = window.location.href.includes("https") ? "wss://localhost:19528" : "ws://localhost:9527", ae = "1", oe = "2", Fe = "1", Ge = "2", Ve = "3";
31
31
  var Ie = /* @__PURE__ */ ((s) => (s.MIN = "0", s.LOW = "1", s.MIDDLE = "2", s.HIGH = "3", s))(Ie || {});
32
- const _ = {
32
+ const p = {
33
33
  LEVEL_1: 1,
34
34
  LEVEL_2: 2,
35
35
  LEVEL_3: 4
36
36
  }, Ze = {
37
- OPEN: _.LEVEL_1,
38
- INTERNAL: _.LEVEL_2 | _.LEVEL_1,
39
- OMP: _.LEVEL_3 | _.LEVEL_2 | _.LEVEL_1
37
+ OPEN: p.LEVEL_1,
38
+ INTERNAL: p.LEVEL_2 | p.LEVEL_1,
39
+ OMP: p.LEVEL_3 | p.LEVEL_2 | p.LEVEL_1
40
40
  }, He = "00000001", q = "NO_SEAL_AVAILABLE", Ue = "CERTIFICATE_NOT_FOUND", je = "CLIENT_CONNECTION_FAILED", Ke = "ACCESS_DENIED", ce = [
41
41
  {
42
42
  oid: "1.2.86.21.1.3",
@@ -51,59 +51,59 @@ const _ = {
51
51
  key: "orgCode"
52
52
  }
53
53
  ];
54
- function Re(s) {
54
+ function ze(s) {
55
55
  return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
56
56
  }
57
57
  var O = {}, le;
58
- function ze() {
58
+ function Re() {
59
59
  if (le) return O;
60
60
  le = 1, O.byteLength = c, O.toByteArray = u, O.fromByteArray = w;
61
61
  for (var s = [], e = [], t = typeof Uint8Array != "undefined" ? Uint8Array : Array, n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i = 0, r = n.length; i < r; ++i)
62
62
  s[i] = n[i], e[n.charCodeAt(i)] = i;
63
63
  e[45] = 62, e[95] = 63;
64
- function a(g) {
65
- var f = g.length;
66
- if (f % 4 > 0)
64
+ function a(y) {
65
+ var g = y.length;
66
+ if (g % 4 > 0)
67
67
  throw new Error("Invalid string. Length must be a multiple of 4");
68
- var E = g.indexOf("=");
69
- E === -1 && (E = f);
70
- var y = E === f ? 0 : 4 - E % 4;
71
- return [E, y];
68
+ var m = y.indexOf("=");
69
+ m === -1 && (m = g);
70
+ var f = m === g ? 0 : 4 - m % 4;
71
+ return [m, f];
72
72
  }
73
- function c(g) {
74
- var f = a(g), E = f[0], y = f[1];
75
- return (E + y) * 3 / 4 - y;
73
+ function c(y) {
74
+ var g = a(y), m = g[0], f = g[1];
75
+ return (m + f) * 3 / 4 - f;
76
76
  }
77
- function d(g, f, E) {
78
- return (f + E) * 3 / 4 - E;
77
+ function d(y, g, m) {
78
+ return (g + m) * 3 / 4 - m;
79
79
  }
80
- function u(g) {
81
- var f, E = a(g), y = E[0], S = E[1], k = new t(d(g, y, S)), p = 0, A = S > 0 ? y - 4 : y, I;
80
+ function u(y) {
81
+ var g, m = a(y), f = m[0], S = m[1], k = new t(d(y, f, S)), _ = 0, A = S > 0 ? f - 4 : f, I;
82
82
  for (I = 0; I < A; I += 4)
83
- f = e[g.charCodeAt(I)] << 18 | e[g.charCodeAt(I + 1)] << 12 | e[g.charCodeAt(I + 2)] << 6 | e[g.charCodeAt(I + 3)], k[p++] = f >> 16 & 255, k[p++] = f >> 8 & 255, k[p++] = f & 255;
84
- return S === 2 && (f = e[g.charCodeAt(I)] << 2 | e[g.charCodeAt(I + 1)] >> 4, k[p++] = f & 255), S === 1 && (f = e[g.charCodeAt(I)] << 10 | e[g.charCodeAt(I + 1)] << 4 | e[g.charCodeAt(I + 2)] >> 2, k[p++] = f >> 8 & 255, k[p++] = f & 255), k;
83
+ g = e[y.charCodeAt(I)] << 18 | e[y.charCodeAt(I + 1)] << 12 | e[y.charCodeAt(I + 2)] << 6 | e[y.charCodeAt(I + 3)], k[_++] = g >> 16 & 255, k[_++] = g >> 8 & 255, k[_++] = g & 255;
84
+ return S === 2 && (g = e[y.charCodeAt(I)] << 2 | e[y.charCodeAt(I + 1)] >> 4, k[_++] = g & 255), S === 1 && (g = e[y.charCodeAt(I)] << 10 | e[y.charCodeAt(I + 1)] << 4 | e[y.charCodeAt(I + 2)] >> 2, k[_++] = g >> 8 & 255, k[_++] = g & 255), k;
85
85
  }
86
- function C(g) {
87
- return s[g >> 18 & 63] + s[g >> 12 & 63] + s[g >> 6 & 63] + s[g & 63];
86
+ function C(y) {
87
+ return s[y >> 18 & 63] + s[y >> 12 & 63] + s[y >> 6 & 63] + s[y & 63];
88
88
  }
89
- function h(g, f, E) {
90
- for (var y, S = [], k = f; k < E; k += 3)
91
- y = (g[k] << 16 & 16711680) + (g[k + 1] << 8 & 65280) + (g[k + 2] & 255), S.push(C(y));
89
+ function h(y, g, m) {
90
+ for (var f, S = [], k = g; k < m; k += 3)
91
+ f = (y[k] << 16 & 16711680) + (y[k + 1] << 8 & 65280) + (y[k + 2] & 255), S.push(C(f));
92
92
  return S.join("");
93
93
  }
94
- function w(g) {
95
- for (var f, E = g.length, y = E % 3, S = [], k = 16383, p = 0, A = E - y; p < A; p += k)
96
- S.push(h(g, p, p + k > A ? A : p + k));
97
- return y === 1 ? (f = g[E - 1], S.push(
98
- s[f >> 2] + s[f << 4 & 63] + "=="
99
- )) : y === 2 && (f = (g[E - 2] << 8) + g[E - 1], S.push(
100
- s[f >> 10] + s[f >> 4 & 63] + s[f << 2 & 63] + "="
94
+ function w(y) {
95
+ for (var g, m = y.length, f = m % 3, S = [], k = 16383, _ = 0, A = m - f; _ < A; _ += k)
96
+ S.push(h(y, _, _ + k > A ? A : _ + k));
97
+ return f === 1 ? (g = y[m - 1], S.push(
98
+ s[g >> 2] + s[g << 4 & 63] + "=="
99
+ )) : f === 2 && (g = (y[m - 2] << 8) + y[m - 1], S.push(
100
+ s[g >> 10] + s[g >> 4 & 63] + s[g << 2 & 63] + "="
101
101
  )), S.join("");
102
102
  }
103
103
  return O;
104
104
  }
105
- var Ye = ze();
106
- const ue = /* @__PURE__ */ Re(Ye);
105
+ var Ye = Re();
106
+ const ue = /* @__PURE__ */ ze(Ye);
107
107
  class Qe {
108
108
  constructor() {
109
109
  o(this, "deps", /* @__PURE__ */ new Map());
@@ -154,11 +154,11 @@ function Xe(s) {
154
154
  }
155
155
  function et(s, e, t, n) {
156
156
  if (s) {
157
- const i = _e(s, e, t, n);
157
+ const i = pe(s, e, t, n);
158
158
  return s[0](i);
159
159
  }
160
160
  }
161
- function _e(s, e, t, n) {
161
+ function pe(s, e, t, n) {
162
162
  return s[1] && n ? qe(t.ctx.slice(), s[1](n(e))) : t.ctx;
163
163
  }
164
164
  function tt(s, e, t, n) {
@@ -178,7 +178,7 @@ function tt(s, e, t, n) {
178
178
  }
179
179
  function nt(s, e, t, n, i, r) {
180
180
  if (i) {
181
- const a = _e(e, t, n, r);
181
+ const a = pe(e, t, n, r);
182
182
  s.p(a, i);
183
183
  }
184
184
  }
@@ -203,7 +203,7 @@ function W(s, e, t) {
203
203
  function j(s) {
204
204
  s.parentNode && s.parentNode.removeChild(s);
205
205
  }
206
- function pe(s, e) {
206
+ function _e(s, e) {
207
207
  for (let t = 0; t < s.length; t += 1)
208
208
  s[t] && s[t].d(e);
209
209
  }
@@ -228,7 +228,7 @@ function P(s, e, t) {
228
228
  function rt(s) {
229
229
  return Array.from(s.childNodes);
230
230
  }
231
- function R(s, e) {
231
+ function z(s, e) {
232
232
  e = "" + e, s.data !== e && (s.data = /** @type {string} */
233
233
  e);
234
234
  }
@@ -286,16 +286,16 @@ function lt(s) {
286
286
  const e = [], t = [];
287
287
  M.forEach((n) => s.indexOf(n) === -1 ? e.push(n) : t.push(n)), t.forEach((n) => n()), M = e;
288
288
  }
289
- const z = /* @__PURE__ */ new Set();
289
+ const R = /* @__PURE__ */ new Set();
290
290
  let ut;
291
291
  function ie(s, e) {
292
- s && s.i && (z.delete(s), s.i(e));
292
+ s && s.i && (R.delete(s), s.i(e));
293
293
  }
294
294
  function Be(s, e, t, n) {
295
295
  if (s && s.o) {
296
- if (z.has(s)) return;
297
- z.add(s), ut.c.push(() => {
298
- z.delete(s);
296
+ if (R.has(s)) return;
297
+ R.add(s), ut.c.push(() => {
298
+ R.delete(s);
299
299
  }), s.o(e);
300
300
  }
301
301
  }
@@ -345,9 +345,9 @@ function De(s, e, t, n, i, r, a = null, c = [-1]) {
345
345
  };
346
346
  a && a(u.root);
347
347
  let C = !1;
348
- if (u.ctx = t ? t(s, e.props || {}, (h, w, ...g) => {
349
- const f = g.length ? g[0] : w;
350
- return u.ctx && i(u.ctx[h], u.ctx[h] = f) && (!u.skip_bound && u.bound[h] && u.bound[h](f), C && ht(s, h)), w;
348
+ if (u.ctx = t ? t(s, e.props || {}, (h, w, ...y) => {
349
+ const g = y.length ? y[0] : w;
350
+ return u.ctx && i(u.ctx[h], u.ctx[h] = g) && (!u.skip_bound && u.bound[h] && u.bound[h](g), C && ht(s, h)), w;
351
351
  }) : [], u.update(), C = !0, U(u.before_update), u.fragment = n ? n(u.ctx) : !1, e.target) {
352
352
  if (e.hydrate) {
353
353
  const h = rt(e.target);
@@ -398,10 +398,10 @@ function yt(s) {
398
398
  ), r, a, c, d, u, C, h = (
399
399
  /*cancelText*/
400
400
  (s[4] || "取消") + ""
401
- ), w, g, f, E = (
401
+ ), w, y, g, m = (
402
402
  /*okText*/
403
403
  (s[5] || "确认") + ""
404
- ), y, S, k, p;
404
+ ), f, S, k, _;
405
405
  const A = (
406
406
  /*#slots*/
407
407
  s[8].default
@@ -414,22 +414,22 @@ function yt(s) {
414
414
  );
415
415
  return {
416
416
  c() {
417
- e = D("div"), t = D("div"), n = D("div"), r = T(i), a = K(), c = D("div"), I && I.c(), d = K(), u = D("div"), C = D("button"), w = T(h), g = K(), f = D("button"), y = T(E), P(n, "class", "model-title svelte-16iv9d0"), P(c, "class", "slot svelte-16iv9d0"), P(C, "class", "modal-btn svelte-16iv9d0"), P(f, "class", "modal-btn success svelte-16iv9d0"), Y(
418
- f,
417
+ e = D("div"), t = D("div"), n = D("div"), r = T(i), a = K(), c = D("div"), I && I.c(), d = K(), u = D("div"), C = D("button"), w = T(h), y = K(), g = D("button"), f = T(m), P(n, "class", "model-title svelte-16iv9d0"), P(c, "class", "slot svelte-16iv9d0"), P(C, "class", "modal-btn svelte-16iv9d0"), P(g, "class", "modal-btn success svelte-16iv9d0"), Y(
418
+ g,
419
419
  "background-color",
420
420
  /*theme*/
421
421
  s[6]
422
422
  ), P(u, "class", "modal-footer svelte-16iv9d0"), P(t, "class", "modal-content svelte-16iv9d0"), P(e, "class", "modal-background modal-visible svelte-16iv9d0");
423
423
  },
424
424
  m(B, b) {
425
- W(B, e, b), L(e, t), L(t, n), L(n, r), L(t, a), L(t, c), I && I.m(c, null), L(t, d), L(t, u), L(u, C), L(C, w), L(u, g), L(u, f), L(f, y), S = !0, k || (p = [
425
+ W(B, e, b), L(e, t), L(t, n), L(n, r), L(t, a), L(t, c), I && I.m(c, null), L(t, d), L(t, u), L(u, C), L(C, w), L(u, y), L(u, g), L(g, f), S = !0, k || (_ = [
426
426
  F(C, "click", function() {
427
427
  V(
428
428
  /*onCancel*/
429
429
  s[0]
430
430
  ) && s[0].apply(this, arguments);
431
431
  }),
432
- F(f, "click", function() {
432
+ F(g, "click", function() {
433
433
  V(
434
434
  /*onOk*/
435
435
  s[2]
@@ -447,7 +447,7 @@ function yt(s) {
447
447
  p(B, [b]) {
448
448
  s = B, (!S || b & /*title*/
449
449
  2) && i !== (i = /*title*/
450
- (s[1] || "标题") + "") && R(r, i), I && I.p && (!S || b & /*$$scope*/
450
+ (s[1] || "标题") + "") && z(r, i), I && I.p && (!S || b & /*$$scope*/
451
451
  128) && nt(
452
452
  I,
453
453
  A,
@@ -467,11 +467,11 @@ function yt(s) {
467
467
  null
468
468
  ), (!S || b & /*cancelText*/
469
469
  16) && h !== (h = /*cancelText*/
470
- (s[4] || "取消") + "") && R(w, h), (!S || b & /*okText*/
471
- 32) && E !== (E = /*okText*/
472
- (s[5] || "确认") + "") && R(y, E), (!S || b & /*theme*/
470
+ (s[4] || "取消") + "") && z(w, h), (!S || b & /*okText*/
471
+ 32) && m !== (m = /*okText*/
472
+ (s[5] || "确认") + "") && z(f, m), (!S || b & /*theme*/
473
473
  64) && Y(
474
- f,
474
+ g,
475
475
  "background-color",
476
476
  /*theme*/
477
477
  s[6]
@@ -484,7 +484,7 @@ function yt(s) {
484
484
  Be(I, B), S = !1;
485
485
  },
486
486
  d(B) {
487
- B && j(e), I && I.d(B), k = !1, U(p);
487
+ B && j(e), I && I.d(B), k = !1, U(_);
488
488
  }
489
489
  };
490
490
  }
@@ -556,7 +556,7 @@ function me(s) {
556
556
  /*col*/
557
557
  i[16].key
558
558
  ]
559
- )) + "") && R(n, t), r & /*columns*/
559
+ )) + "") && z(n, t), r & /*columns*/
560
560
  2 && Y(e, "width", `${100 / /*columns*/
561
561
  i[1].length}%`);
562
562
  },
@@ -620,7 +620,7 @@ function Ee(s) {
620
620
  s[7] ? "cert-item-selected" : ""}`) + " svelte-1kh75ag") && P(e, "class", n);
621
621
  },
622
622
  d(u) {
623
- u && j(e), pe(c, u), i = !1, r();
623
+ u && j(e), _e(c, u), i = !1, r();
624
624
  }
625
625
  };
626
626
  }
@@ -660,7 +660,7 @@ function mt(s) {
660
660
  }
661
661
  },
662
662
  d(i) {
663
- i && j(e), pe(n, i);
663
+ i && j(e), _e(n, i);
664
664
  }
665
665
  };
666
666
  }
@@ -734,13 +734,13 @@ function Et(s) {
734
734
  }
735
735
  function St(s, e, t) {
736
736
  let { data: n = [] } = e, { columns: i = [] } = e, { onCancel: r } = e, { onOk: a } = e, { onClose: c } = e, { cancelText: d = "" } = e, { okText: u = "" } = e, { theme: C = "#409eff" } = e, { title: h = "" } = e, w = 0;
737
- const g = () => {
737
+ const y = () => {
738
738
  r(`${h}失败`), c == null || c();
739
- }, f = () => {
739
+ }, g = () => {
740
740
  a == null || a(n[w]), c == null || c();
741
- }, E = (y) => t(7, w = y);
742
- return s.$$set = (y) => {
743
- "data" in y && t(0, n = y.data), "columns" in y && t(1, i = y.columns), "onCancel" in y && t(10, r = y.onCancel), "onOk" in y && t(11, a = y.onOk), "onClose" in y && t(2, c = y.onClose), "cancelText" in y && t(3, d = y.cancelText), "okText" in y && t(4, u = y.okText), "theme" in y && t(5, C = y.theme), "title" in y && t(6, h = y.title);
741
+ }, m = (f) => t(7, w = f);
742
+ return s.$$set = (f) => {
743
+ "data" in f && t(0, n = f.data), "columns" in f && t(1, i = f.columns), "onCancel" in f && t(10, r = f.onCancel), "onOk" in f && t(11, a = f.onOk), "onClose" in f && t(2, c = f.onClose), "cancelText" in f && t(3, d = f.cancelText), "okText" in f && t(4, u = f.okText), "theme" in f && t(5, C = f.theme), "title" in f && t(6, h = f.title);
744
744
  }, [
745
745
  n,
746
746
  i,
@@ -750,11 +750,11 @@ function St(s, e, t) {
750
750
  C,
751
751
  h,
752
752
  w,
753
+ y,
753
754
  g,
754
- f,
755
755
  r,
756
756
  a,
757
- E
757
+ m
758
758
  ];
759
759
  }
760
760
  class It extends be {
@@ -778,7 +778,7 @@ class kt {
778
778
  o(this, "open", (e) => new Promise((t, n) => {
779
779
  this.modalInstance.current = new It({
780
780
  target: document.body,
781
- props: v(m({}, e), {
781
+ props: v(E({}, e), {
782
782
  onCancel: (i) => {
783
783
  n({
784
784
  code: -1,
@@ -815,14 +815,14 @@ function vt(s = 32, e = !0, t = 0) {
815
815
  }
816
816
  return e ? (i.shift(), `u${i.join("")}`) : i.join("");
817
817
  }
818
- const _t = [
818
+ const pt = [
819
819
  {
820
820
  key: "CN"
821
821
  },
822
822
  {
823
823
  format: (s) => `${s.DevClass}(${s.sn})`
824
824
  }
825
- ], pt = [
825
+ ], _t = [
826
826
  {
827
827
  key: "SealId"
828
828
  },
@@ -873,8 +873,8 @@ class Bt {
873
873
  });
874
874
  return;
875
875
  }
876
- const d = vt(), u = (g) => {
877
- g.success ? i(g.data) : r(g);
876
+ const d = vt(), u = (y) => {
877
+ y.success ? i(y.data) : r(y);
878
878
  }, C = {
879
879
  function: e,
880
880
  args: t ? [t] : [],
@@ -902,16 +902,16 @@ class Bt {
902
902
  o(this, "handleEventData", (e) => l(this, null, function* () {
903
903
  var t, n, i, r, a, c, d, u;
904
904
  if (e.data instanceof Blob) {
905
- const C = yield e.data.arrayBuffer(), w = new TextDecoder(
905
+ const C = yield e.data.arrayBuffer(), y = new TextDecoder(
906
906
  navigator.userAgent.includes("Windows") ? "gbk" : "utf-8"
907
- ).decode(C), g = JSON.parse(w), f = {
907
+ ).decode(C).replace(/\\(?!(["\\\/bfnrtu]))/g, ""), g = JSON.parse(y), m = {
908
908
  success: (t = g.result) == null ? void 0 : t.success,
909
909
  msg: (n = g.result) == null ? void 0 : n.msg,
910
910
  errCode: (i = g.result) == null ? void 0 : i.errCode,
911
911
  data: g.data,
912
912
  type: (r = g.result) == null ? void 0 : r.event
913
- }, E = (a = g.result) == null ? void 0 : a.function, y = (c = g.result) == null ? void 0 : c.msgid;
914
- y ? this.eventBus.emit(y, f) : this.eventBus.emit(E, f), (u = (d = this.socketConfig) == null ? void 0 : d.onMessage) == null || u.call(d, f);
913
+ }, f = (a = g.result) == null ? void 0 : a.function, S = (c = g.result) == null ? void 0 : c.msgid;
914
+ S ? this.eventBus.emit(S, m) : this.eventBus.emit(f, m), (u = (d = this.socketConfig) == null ? void 0 : d.onMessage) == null || u.call(d, m);
915
915
  }
916
916
  }));
917
917
  o(this, "base64Encode", (e) => {
@@ -938,7 +938,7 @@ class Bt {
938
938
  "GZCA_OnDeviceChange",
939
939
  (e) => {
940
940
  var t, n, i;
941
- (i = (t = this.socketConfig) == null ? void 0 : t.onUkeyChange) == null || i.call(t, v(m({}, e), {
941
+ (i = (t = this.socketConfig) == null ? void 0 : t.onUkeyChange) == null || i.call(t, v(E({}, e), {
942
942
  data: (n = e.data) == null ? void 0 : n[0]
943
943
  }));
944
944
  }
@@ -974,7 +974,7 @@ class Bt {
974
974
  return t != null && t.length ? (t == null ? void 0 : t.length) === 1 ? t[0] : yield G.open({
975
975
  title: "选择证书",
976
976
  data: t,
977
- columns: _t,
977
+ columns: pt,
978
978
  theme: (i = this.socketConfig) == null ? void 0 : i.theme
979
979
  }) : Promise.reject({
980
980
  errCode: Ue,
@@ -988,19 +988,19 @@ class Bt {
988
988
  );
989
989
  }));
990
990
  o(this, "pkcs1Sign", (e) => l(this, null, function* () {
991
- return yield this.sendMessage("GZCA_Pkcs1SignData", m({
991
+ return yield this.sendMessage("GZCA_Pkcs1SignData", E({
992
992
  IsLogin: this.getIsLogin(),
993
993
  PinPolicy: this.pinPolicy
994
994
  }, e != null ? e : {}));
995
995
  }));
996
996
  o(this, "pkcs1Base64Sign", (e) => l(this, null, function* () {
997
- return yield this.sendMessage("GZCA_Pkcs1SignDataEx", m({
997
+ return yield this.sendMessage("GZCA_Pkcs1SignDataEx", E({
998
998
  IsLogin: this.getIsLogin(),
999
999
  PinPolicy: this.pinPolicy
1000
1000
  }, e != null ? e : {}));
1001
1001
  }));
1002
1002
  o(this, "batchPkcs1Base64Sign", (e) => l(this, null, function* () {
1003
- return yield this.sendMessage("GZCA_BatchPkcs1SignDataEx", m({
1003
+ return yield this.sendMessage("GZCA_BatchPkcs1SignDataEx", E({
1004
1004
  IsLogin: this.getIsLogin(),
1005
1005
  PinPolicy: this.pinPolicy
1006
1006
  }, e != null ? e : {}));
@@ -1014,56 +1014,56 @@ class Bt {
1014
1014
  o(this, "getSealList", (e) => l(this, null, function* () {
1015
1015
  return yield this.sendMessage(
1016
1016
  "GZCA_EnumSeals",
1017
- m({
1017
+ E({
1018
1018
  IsLogin: this.getIsLogin()
1019
1019
  }, e != null ? e : {}),
1020
- _.LEVEL_2
1020
+ p.LEVEL_2
1021
1021
  );
1022
1022
  }));
1023
1023
  o(this, "writeSeal", (e) => l(this, null, function* () {
1024
1024
  return yield this.sendMessage(
1025
1025
  "GZCA_WriteSeal",
1026
- m({
1026
+ E({
1027
1027
  IsLogin: this.getIsLogin()
1028
1028
  }, e != null ? e : {}),
1029
- _.LEVEL_2
1029
+ p.LEVEL_2
1030
1030
  );
1031
1031
  }));
1032
1032
  o(this, "deleteSeal", (e) => l(this, null, function* () {
1033
1033
  return yield this.sendMessage(
1034
1034
  "GZCA_DeleteSeal",
1035
- m({
1035
+ E({
1036
1036
  IsLogin: this.getIsLogin()
1037
1037
  }, e != null ? e : {}),
1038
- _.LEVEL_2
1038
+ p.LEVEL_2
1039
1039
  );
1040
1040
  }));
1041
1041
  o(this, "getSealInfo", (e) => l(this, null, function* () {
1042
1042
  return yield this.sendMessage(
1043
1043
  "GZCA_ReadSeal",
1044
- m({
1044
+ E({
1045
1045
  IsLogin: this.getIsLogin()
1046
1046
  }, e != null ? e : {}),
1047
- _.LEVEL_2
1047
+ p.LEVEL_2
1048
1048
  );
1049
1049
  }));
1050
1050
  o(this, "getTPSealList", (e) => l(this, null, function* () {
1051
1051
  return yield this.sendMessage(
1052
1052
  "GZCA_GetSealPicList",
1053
- m({
1053
+ E({
1054
1054
  IsLogin: this.getIsLogin()
1055
1055
  }, e != null ? e : {}),
1056
- _.LEVEL_2
1056
+ p.LEVEL_2
1057
1057
  );
1058
1058
  }));
1059
1059
  o(this, "getTPSealPic", (e) => l(this, null, function* () {
1060
1060
  var n;
1061
1061
  return yield this.sendMessage(
1062
1062
  "GZCA_GetSealPicData",
1063
- m({
1063
+ E({
1064
1064
  IsLogin: (n = e.IsLogin) != null ? n : this.getIsLogin()
1065
1065
  }, e != null ? e : {}),
1066
- _.LEVEL_2
1066
+ p.LEVEL_2
1067
1067
  );
1068
1068
  }));
1069
1069
  o(this, "sm2SignPreprocess1", (e) => l(this, null, function* () {
@@ -1073,7 +1073,7 @@ class Bt {
1073
1073
  return yield this.sendMessage("GZCA_PrepareSm2SignStep2", e);
1074
1074
  }));
1075
1075
  o(this, "pkcs1HashSign", (e) => l(this, null, function* () {
1076
- return yield this.sendMessage("GZCA_Pkcs1SignDataForHash", m({
1076
+ return yield this.sendMessage("GZCA_Pkcs1SignDataForHash", E({
1077
1077
  IsLogin: this.getIsLogin(),
1078
1078
  PinPolicy: this.pinPolicy
1079
1079
  }, e != null ? e : {}));
@@ -1082,7 +1082,7 @@ class Bt {
1082
1082
  return yield this.sendMessage("GZCA_Pkcs1VerifySignForHash", e);
1083
1083
  }));
1084
1084
  o(this, "pkcs7Sign", (e) => l(this, null, function* () {
1085
- return yield this.sendMessage("GZCA_Pkcs7SignData", m({
1085
+ return yield this.sendMessage("GZCA_Pkcs7SignData", E({
1086
1086
  IsLogin: this.getIsLogin(),
1087
1087
  IsAuthAttr: "Y",
1088
1088
  PinPolicy: this.pinPolicy
@@ -1107,7 +1107,7 @@ class Bt {
1107
1107
  return yield this.sendMessage("GZCA_Pkcs7EncryptData", e);
1108
1108
  }));
1109
1109
  o(this, "pkcs7Decryption", (e) => l(this, null, function* () {
1110
- return yield this.sendMessage("GZCA_Pkcs7DecryptData", m({
1110
+ return yield this.sendMessage("GZCA_Pkcs7DecryptData", E({
1111
1111
  IsLogin: this.getIsLogin()
1112
1112
  }, e != null ? e : {}));
1113
1113
  }));
@@ -1115,7 +1115,7 @@ class Bt {
1115
1115
  return yield this.sendMessage("GZCA_EnvelopeSealFileEx_qyzc", e);
1116
1116
  }));
1117
1117
  o(this, "pkcs7FileDecryption", (e) => l(this, null, function* () {
1118
- return yield this.sendMessage("GZCA_EnvelopeOpenFileEx_qyzc", m({
1118
+ return yield this.sendMessage("GZCA_EnvelopeOpenFileEx_qyzc", E({
1119
1119
  IsLogin: this.getIsLogin()
1120
1120
  }, e != null ? e : {}));
1121
1121
  }));
@@ -1123,7 +1123,7 @@ class Bt {
1123
1123
  return yield this.sendMessage("GZCA_AsymEncryptData", e);
1124
1124
  }));
1125
1125
  o(this, "asymmetricDecryption", (e) => l(this, null, function* () {
1126
- return yield this.sendMessage("GZCA_AsymDecryptData", m({
1126
+ return yield this.sendMessage("GZCA_AsymDecryptData", E({
1127
1127
  IsLogin: this.getIsLogin()
1128
1128
  }, e != null ? e : {}));
1129
1129
  }));
@@ -1143,16 +1143,16 @@ class Bt {
1143
1143
  return yield this.sendMessage(
1144
1144
  "GZCA_GetSealIssuer",
1145
1145
  e,
1146
- _.LEVEL_2
1146
+ p.LEVEL_2
1147
1147
  );
1148
1148
  }));
1149
1149
  o(this, "deleteAllSealByVendor", (e) => l(this, null, function* () {
1150
1150
  return yield this.sendMessage(
1151
1151
  "GZCA_ClearSeal",
1152
- m({
1152
+ E({
1153
1153
  IsLogin: this.getIsLogin()
1154
1154
  }, e != null ? e : {}),
1155
- _.LEVEL_2
1155
+ p.LEVEL_2
1156
1156
  );
1157
1157
  }));
1158
1158
  o(this, "applyCert", (e) => l(this, null, function* () {
@@ -1165,28 +1165,28 @@ class Bt {
1165
1165
  type: e.type,
1166
1166
  url: e.url
1167
1167
  },
1168
- _.LEVEL_3
1168
+ p.LEVEL_3
1169
1169
  );
1170
1170
  }));
1171
1171
  o(this, "resetPin", (e) => l(this, null, function* () {
1172
1172
  return yield this.sendMessage(
1173
1173
  "GZCA_UnblockUserPin",
1174
- m({}, e != null ? e : {}),
1175
- _.LEVEL_3
1174
+ E({}, e != null ? e : {}),
1175
+ p.LEVEL_3
1176
1176
  );
1177
1177
  }));
1178
1178
  o(this, "getUKeyList", () => l(this, null, function* () {
1179
1179
  return yield this.sendMessage(
1180
1180
  "GetUKeyList",
1181
1181
  void 0,
1182
- _.LEVEL_3
1182
+ p.LEVEL_3
1183
1183
  );
1184
1184
  }));
1185
1185
  o(this, "getUKeyInfo", (e) => l(this, null, function* () {
1186
1186
  return yield this.sendMessage(
1187
1187
  "GetUKeyID",
1188
1188
  e != null ? e : {},
1189
- _.LEVEL_3
1189
+ p.LEVEL_3
1190
1190
  );
1191
1191
  }));
1192
1192
  var t, n, i;
@@ -1217,14 +1217,14 @@ const $ = class $ {
1217
1217
  o(this, "coreInstance", null);
1218
1218
  o(this, "gwsConfig", {});
1219
1219
  o(this, "createGwsCore", (e) => {
1220
- this.gwsConfig = e != null ? e : {}, this.coreInstance = new Bt(v(m({}, e != null ? e : {}), {
1220
+ this.gwsConfig = e != null ? e : {}, this.coreInstance = new Bt(v(E({}, e != null ? e : {}), {
1221
1221
  url: Oe
1222
1222
  }));
1223
1223
  });
1224
1224
  o(this, "appendCertBase64", (e, t = !0) => l(this, null, function* () {
1225
1225
  if (e.CertB64) return e;
1226
1226
  const n = t ? yield this.getSignatureCert() : yield this.getEncryptionCert();
1227
- return v(m({}, e != null ? e : {}), { CertB64: n == null ? void 0 : n.CertB64 });
1227
+ return v(E({}, e != null ? e : {}), { CertB64: n == null ? void 0 : n.CertB64 });
1228
1228
  }));
1229
1229
  o(this, "destroy", () => {
1230
1230
  var e;
@@ -1291,7 +1291,7 @@ const $ = class $ {
1291
1291
  });
1292
1292
  o(this, "pkcs1Sign", (e, t) => l(this, null, function* () {
1293
1293
  var r, a, c;
1294
- const n = yield this.getSignatureCert(t), i = yield (a = this.coreInstance) == null ? void 0 : a.pkcs1Sign(v(m({}, e != null ? e : {}), {
1294
+ const n = yield this.getSignatureCert(t), i = yield (a = this.coreInstance) == null ? void 0 : a.pkcs1Sign(v(E({}, e != null ? e : {}), {
1295
1295
  ContainerName: (r = n == null ? void 0 : n.ContainerName) != null ? r : ""
1296
1296
  }));
1297
1297
  return (c = i == null ? void 0 : i[0]) == null ? void 0 : c.SignData;
@@ -1303,24 +1303,24 @@ const $ = class $ {
1303
1303
  }));
1304
1304
  o(this, "pkcs1Base64Sign", (e, t) => l(this, null, function* () {
1305
1305
  var a, c, d, u, C;
1306
- const n = yield this.getSignatureCert(t), i = (c = e.DataB64) != null ? c : this.base64Encode({ Data: (a = e.Data) != null ? a : "" }), r = yield (u = this.coreInstance) == null ? void 0 : u.pkcs1Base64Sign(v(m({}, e != null ? e : {}), {
1306
+ const n = yield this.getSignatureCert(t), i = (c = e.DataB64) != null ? c : this.base64Encode({ Data: (a = e.Data) != null ? a : "" }), r = yield (u = this.coreInstance) == null ? void 0 : u.pkcs1Base64Sign(v(E({}, e != null ? e : {}), {
1307
1307
  ContainerName: (d = n == null ? void 0 : n.ContainerName) != null ? d : "",
1308
1308
  DataB64: i
1309
1309
  }));
1310
1310
  return (C = r == null ? void 0 : r[0]) == null ? void 0 : C.SignData;
1311
1311
  }));
1312
1312
  o(this, "batchPkcs1Base64Sign", (e, t) => l(this, null, function* () {
1313
- var C, h, w, g, f, E;
1314
- const n = "|", i = (h = e.DataB64) != null ? h : (C = e.Data) == null ? void 0 : C.map((y) => this.base64Encode({ Data: y })), r = yield this.getSignatureCert(t);
1313
+ var C, h, w, y, g, m;
1314
+ const n = "|", i = (h = e.DataB64) != null ? h : (C = e.Data) == null ? void 0 : C.map((f) => this.base64Encode({ Data: f })), r = yield this.getSignatureCert(t);
1315
1315
  let a = "";
1316
- a = Array.isArray(i) ? i == null ? void 0 : i.map((y, S) => `${S}:${y}`).join(n) : "";
1317
- const c = yield (g = this.coreInstance) == null ? void 0 : g.batchPkcs1Base64Sign({
1316
+ a = Array.isArray(i) ? i == null ? void 0 : i.map((f, S) => `${S}:${f}`).join(n) : "";
1317
+ const c = yield (y = this.coreInstance) == null ? void 0 : y.batchPkcs1Base64Sign({
1318
1318
  ContainerName: (w = r == null ? void 0 : r.ContainerName) != null ? w : "",
1319
1319
  DataB64: a
1320
- }), d = (E = (f = c == null ? void 0 : c[0]) == null ? void 0 : f.SignData) == null ? void 0 : E.split(n), u = [];
1321
- return d.forEach((y) => {
1322
- const S = y.split(":"), k = Number(S[0]), p = S[1];
1323
- u[k] = p;
1320
+ }), d = (m = (g = c == null ? void 0 : c[0]) == null ? void 0 : g.SignData) == null ? void 0 : m.split(n), u = [];
1321
+ return d.forEach((f) => {
1322
+ const S = f.split(":"), k = Number(S[0]), _ = S[1];
1323
+ u[k] = _;
1324
1324
  }), u;
1325
1325
  }));
1326
1326
  o(this, "pkcs1Base64VerifySignature", (e) => l(this, null, function* () {
@@ -1335,7 +1335,7 @@ const $ = class $ {
1335
1335
  o(this, "writeSeal", (e, t) => l(this, null, function* () {
1336
1336
  var r, a;
1337
1337
  const n = yield this.getSignatureCert(t);
1338
- return !!(yield (a = this.coreInstance) == null ? void 0 : a.writeSeal(v(m({}, e != null ? e : {}), {
1338
+ return !!(yield (a = this.coreInstance) == null ? void 0 : a.writeSeal(v(E({}, e != null ? e : {}), {
1339
1339
  ContainerName: (r = n == null ? void 0 : n.ContainerName) != null ? r : ""
1340
1340
  })));
1341
1341
  }));
@@ -1361,7 +1361,7 @@ const $ = class $ {
1361
1361
  o(this, "deleteSealById", (e, t) => l(this, null, function* () {
1362
1362
  var r, a;
1363
1363
  const n = yield this.getSignatureCert(t);
1364
- return !!(yield (a = this.coreInstance) == null ? void 0 : a.deleteSeal(v(m({}, e != null ? e : {}), {
1364
+ return !!(yield (a = this.coreInstance) == null ? void 0 : a.deleteSeal(v(E({}, e != null ? e : {}), {
1365
1365
  ContainerName: (r = n == null ? void 0 : n.ContainerName) != null ? r : ""
1366
1366
  })));
1367
1367
  }));
@@ -1417,7 +1417,7 @@ const $ = class $ {
1417
1417
  const i = ((a = n == null ? void 0 : n.data) == null ? void 0 : a.length) === 1 ? n == null ? void 0 : n.data[0] : yield G.open({
1418
1418
  title: "选择印章",
1419
1419
  data: n == null ? void 0 : n.data,
1420
- columns: pt,
1420
+ columns: _t,
1421
1421
  theme: (c = this.gwsConfig) == null ? void 0 : c.theme
1422
1422
  });
1423
1423
  return {
@@ -1427,7 +1427,7 @@ const $ = class $ {
1427
1427
  }));
1428
1428
  o(this, "getTPSealPic", (e, t) => l(this, null, function* () {
1429
1429
  var r, a, c, d, u;
1430
- const n = yield this.getTPSeal(e, t), i = yield (u = this.coreInstance) == null ? void 0 : u.getTPSealPic(v(m({
1430
+ const n = yield this.getTPSeal(e, t), i = yield (u = this.coreInstance) == null ? void 0 : u.getTPSealPic(v(E({
1431
1431
  ContainerName: (a = (r = n == null ? void 0 : n.cert) == null ? void 0 : r.ContainerName) != null ? a : ""
1432
1432
  }, (c = n == null ? void 0 : n.data) != null ? c : {}), {
1433
1433
  FileSize: String((d = n == null ? void 0 : n.data) == null ? void 0 : d.FileSize)
@@ -1459,13 +1459,13 @@ const $ = class $ {
1459
1459
  o(this, "pkcs1HashVerifySignature", (e) => l(this, null, function* () {
1460
1460
  var i, r;
1461
1461
  const t = yield this.appendCertBase64(e);
1462
- return !!(yield (r = this.coreInstance) == null ? void 0 : r.pkcs1HashVerifySignature(v(m({}, t), {
1462
+ return !!(yield (r = this.coreInstance) == null ? void 0 : r.pkcs1HashVerifySignature(v(E({}, t), {
1463
1463
  HashAlg: (i = t.HashAlg) != null ? i : "sm3"
1464
1464
  })));
1465
1465
  }));
1466
1466
  o(this, "pkcs7Sign", (e, t) => l(this, null, function* () {
1467
1467
  var a, c, d, u, C;
1468
- const n = (c = e.DataB64) != null ? c : this.base64Encode({ Data: (a = e.Data) != null ? a : "" }), i = yield this.getSignatureCert(t), r = yield (u = this.coreInstance) == null ? void 0 : u.pkcs7Sign(v(m({}, e != null ? e : {}), {
1468
+ const n = (c = e.DataB64) != null ? c : this.base64Encode({ Data: (a = e.Data) != null ? a : "" }), i = yield this.getSignatureCert(t), r = yield (u = this.coreInstance) == null ? void 0 : u.pkcs7Sign(v(E({}, e != null ? e : {}), {
1469
1469
  ContainerName: (d = i == null ? void 0 : i.ContainerName) != null ? d : "",
1470
1470
  DataB64: n
1471
1471
  }));
@@ -1517,7 +1517,7 @@ const $ = class $ {
1517
1517
  }));
1518
1518
  o(this, "pkcs7Decryption", (e) => l(this, null, function* () {
1519
1519
  var r, a;
1520
- const t = yield this.getEncryptionCert(), n = yield (r = this.coreInstance) == null ? void 0 : r.pkcs7Decryption(v(m({}, e != null ? e : {}), {
1520
+ const t = yield this.getEncryptionCert(), n = yield (r = this.coreInstance) == null ? void 0 : r.pkcs7Decryption(v(E({}, e != null ? e : {}), {
1521
1521
  ContainerName: t == null ? void 0 : t.ContainerName
1522
1522
  })), i = (a = n == null ? void 0 : n[0]) == null ? void 0 : a.DataB64;
1523
1523
  return e.shouldDecodeBase64 ? this.base64Decode({ DataB64: i }) : i;
@@ -1543,7 +1543,7 @@ const $ = class $ {
1543
1543
  }));
1544
1544
  o(this, "asymmetricDecryption", (e, t) => l(this, null, function* () {
1545
1545
  var r, a;
1546
- const n = yield this.getEncryptionCert(t), i = yield (r = this.coreInstance) == null ? void 0 : r.asymmetricDecryption(v(m({}, e != null ? e : {}), {
1546
+ const n = yield this.getEncryptionCert(t), i = yield (r = this.coreInstance) == null ? void 0 : r.asymmetricDecryption(v(E({}, e != null ? e : {}), {
1547
1547
  ContainerName: n == null ? void 0 : n.ContainerName
1548
1548
  }));
1549
1549
  return (a = i == null ? void 0 : i[0]) == null ? void 0 : a.Data;
@@ -1568,16 +1568,16 @@ const $ = class $ {
1568
1568
  Oid: C.oid,
1569
1569
  CertB64: e.CertB64
1570
1570
  });
1571
- n[C.key] = (d = (c = h == null ? void 0 : h[0]) == null ? void 0 : c.OidValue) == null ? void 0 : d.slice(2);
1571
+ n[C.key] = (d = (c = h == null ? void 0 : h[0]) == null ? void 0 : c.OidValue) == null ? void 0 : d.replace(".", "");
1572
1572
  } catch (h) {
1573
1573
  n[C.key] = null;
1574
1574
  }
1575
1575
  }
1576
- return n != null && n.idCardNo ? n != null && n.CertSubject.includes("O") || n.orgCode ? n.certCate = Ge : n.certCate = Fe : n.certCate = Ve, n;
1576
+ return n != null && n.idCardNo ? n != null && n.CertSubject.includes("O=") || n.orgCode ? n.certCate = Ge : n.certCate = Fe : n.certCate = Ve, n;
1577
1577
  }));
1578
1578
  o(this, "getCertInfoByOid", (e) => l(this, null, function* () {
1579
1579
  var n, i;
1580
- const t = yield (n = this.coreInstance) == null ? void 0 : n.getCertInfoByOid(m({}, e != null ? e : {}));
1580
+ const t = yield (n = this.coreInstance) == null ? void 0 : n.getCertInfoByOid(E({}, e != null ? e : {}));
1581
1581
  return (i = t == null ? void 0 : t[0]) == null ? void 0 : i.OidValue;
1582
1582
  }));
1583
1583
  o(this, "getSealVendor", (e) => l(this, null, function* () {
@@ -1589,12 +1589,12 @@ const $ = class $ {
1589
1589
  }));
1590
1590
  o(this, "deleteAllSealByVendor", (e, t) => l(this, null, function* () {
1591
1591
  var r;
1592
- const n = yield this.getSignatureCert(t), i = yield (r = this.coreInstance) == null ? void 0 : r.deleteAllSealByVendor(v(m({}, e != null ? e : {}), {
1592
+ const n = yield this.getSignatureCert(t), i = yield (r = this.coreInstance) == null ? void 0 : r.deleteAllSealByVendor(v(E({}, e != null ? e : {}), {
1593
1593
  ContainerName: n == null ? void 0 : n.ContainerName
1594
1594
  }));
1595
1595
  return i == null ? void 0 : i[0];
1596
1596
  }));
1597
- o(this, "getUKeyList", (e) => l(this, null, function* () {
1597
+ o(this, "getUKey", (e) => l(this, null, function* () {
1598
1598
  var i;
1599
1599
  if (e) return e;
1600
1600
  const t = yield (i = this.coreInstance) == null ? void 0 : i.getUKeyList();
@@ -1606,7 +1606,7 @@ const $ = class $ {
1606
1606
  }));
1607
1607
  o(this, "getUKeyInfo", (e) => l(this, null, function* () {
1608
1608
  var i;
1609
- const t = yield this.getUKeyList(e), n = yield (i = this.coreInstance) == null ? void 0 : i.getUKeyInfo({
1609
+ const t = yield this.getUKey(e), n = yield (i = this.coreInstance) == null ? void 0 : i.getUKeyInfo({
1610
1610
  manu: t == null ? void 0 : t.manu,
1611
1611
  sn: t == null ? void 0 : t.sn
1612
1612
  });
@@ -1614,8 +1614,8 @@ const $ = class $ {
1614
1614
  }));
1615
1615
  o(this, "applyCert", (e, t) => l(this, null, function* () {
1616
1616
  var a;
1617
- const n = yield this.getUKeyList(t), i = yield this.getUKeyInfo(n);
1618
- return yield (a = this.coreInstance) == null ? void 0 : a.applyCert(v(m({}, e != null ? e : {}), {
1617
+ const n = yield this.getUKey(t), i = yield this.getUKeyInfo(n);
1618
+ return yield (a = this.coreInstance) == null ? void 0 : a.applyCert(v(E({}, e != null ? e : {}), {
1619
1619
  manu: i == null ? void 0 : i.manu,
1620
1620
  sn: i == null ? void 0 : i.sn,
1621
1621
  ContainerName: i == null ? void 0 : i.keyid
@@ -1624,7 +1624,7 @@ const $ = class $ {
1624
1624
  o(this, "resetPin", (e, t) => l(this, null, function* () {
1625
1625
  var r;
1626
1626
  const n = yield this.getSignatureCert(t);
1627
- return yield (r = this.coreInstance) == null ? void 0 : r.resetPin(v(m({}, e != null ? e : {}), {
1627
+ return yield (r = this.coreInstance) == null ? void 0 : r.resetPin(v(E({}, e != null ? e : {}), {
1628
1628
  manu: n == null ? void 0 : n.manu,
1629
1629
  sn: n == null ? void 0 : n.sn,
1630
1630
  ContainerName: n == null ? void 0 : n.ContainerName
@@ -1640,7 +1640,7 @@ function At(s) {
1640
1640
  if (H.instance && !(s != null && s.isCreateNew))
1641
1641
  e(H.instance);
1642
1642
  else {
1643
- const n = new H(v(m({}, s != null ? s : {}), {
1643
+ const n = new H(v(E({}, s != null ? s : {}), {
1644
1644
  onOpen(i) {
1645
1645
  var r;
1646
1646
  e(n), (r = s == null ? void 0 : s.onOpen) == null || r.call(s, i);
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(_,k){typeof exports=="object"&&typeof module!="undefined"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(_=typeof globalThis!="undefined"?globalThis:_||self,k(_.GWS_CLIENT={}))})(this,function(_){"use strict";var _t=Object.defineProperty,Lt=Object.defineProperties;var Bt=Object.getOwnPropertyDescriptors;var Oe=Object.getOwnPropertySymbols;var Pt=Object.prototype.hasOwnProperty,At=Object.prototype.propertyIsEnumerable;var ge=(_,k,L)=>k in _?_t(_,k,{enumerable:!0,configurable:!0,writable:!0,value:L}):_[k]=L,m=(_,k)=>{for(var L in k||(k={}))Pt.call(k,L)&&ge(_,L,k[L]);if(Oe)for(var L of Oe(k))At.call(k,L)&&ge(_,L,k[L]);return _},B=(_,k)=>Lt(_,Bt(k));var a=(_,k,L)=>ge(_,typeof k!="symbol"?k+"":k,L);var c=(_,k,L)=>new Promise((Q,J)=>{var ie=I=>{try{T(L.next(I))}catch(H){J(H)}},re=I=>{try{T(L.throw(I))}catch(H){J(H)}},T=I=>I.done?Q(I.value):Promise.resolve(I.value).then(ie,re);T((L=L.apply(_,k)).next())});const k=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",L="1",Q="2",J="1",ie="2",re="3";var T=(i=>(i.MIN="0",i.LOW="1",i.MIDDLE="2",i.HIGH="3",i))(T||{});const I={LEVEL_1:1,LEVEL_2:2,LEVEL_3:4},H={OPEN:I.LEVEL_1,INTERNAL:I.LEVEL_2|I.LEVEL_1,OMP:I.LEVEL_3|I.LEVEL_2|I.LEVEL_1},Ge="00000001",oe="NO_SEAL_AVAILABLE",Fe="CERTIFICATE_NOT_FOUND",Ve="CLIENT_CONNECTION_FAILED",Ze="ACCESS_DENIED",ye=[{oid:"1.2.86.21.1.3",key:"trustServiceNo"},{oid:"1.2.156.10260.4.1.1",key:"idCardNo"},{oid:"1.2.156.10260.4.1.4",key:"orgCode"}];function He(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var U={},fe;function Ue(){if(fe)return U;fe=1,U.byteLength=l,U.toByteArray=u,U.fromByteArray=w;for(var i=[],e=[],t=typeof Uint8Array!="undefined"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,r=n.length;s<r;++s)i[s]=n[s],e[n.charCodeAt(s)]=s;e[45]=62,e[95]=63;function o(g){var C=g.length;if(C%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=g.indexOf("=");E===-1&&(E=C);var y=E===C?0:4-E%4;return[E,y]}function l(g){var C=o(g),E=C[0],y=C[1];return(E+y)*3/4-y}function d(g,C,E){return(C+E)*3/4-E}function u(g){var C,E=o(g),y=E[0],S=E[1],p=new t(d(g,y,S)),P=0,x=S>0?y-4:y,v;for(v=0;v<x;v+=4)C=e[g.charCodeAt(v)]<<18|e[g.charCodeAt(v+1)]<<12|e[g.charCodeAt(v+2)]<<6|e[g.charCodeAt(v+3)],p[P++]=C>>16&255,p[P++]=C>>8&255,p[P++]=C&255;return S===2&&(C=e[g.charCodeAt(v)]<<2|e[g.charCodeAt(v+1)]>>4,p[P++]=C&255),S===1&&(C=e[g.charCodeAt(v)]<<10|e[g.charCodeAt(v+1)]<<4|e[g.charCodeAt(v+2)]>>2,p[P++]=C>>8&255,p[P++]=C&255),p}function f(g){return i[g>>18&63]+i[g>>12&63]+i[g>>6&63]+i[g&63]}function h(g,C,E){for(var y,S=[],p=C;p<E;p+=3)y=(g[p]<<16&16711680)+(g[p+1]<<8&65280)+(g[p+2]&255),S.push(f(y));return S.join("")}function w(g){for(var C,E=g.length,y=E%3,S=[],p=16383,P=0,x=E-y;P<x;P+=p)S.push(h(g,P,P+p>x?x:P+p));return y===1?(C=g[E-1],S.push(i[C>>2]+i[C<<4&63]+"==")):y===2&&(C=(g[E-2]<<8)+g[E-1],S.push(i[C>>10]+i[C>>4&63]+i[C<<2&63]+"=")),S.join("")}return U}var je=Ue();const Ce=He(je);class Ke{constructor(){a(this,"deps",new Map)}on(e,t){this.deps.set(e,t)}emit(e,t){const n=this.deps.get(e);n==null||n(t)}}(function(){try{var i=document.createElement("style");i.appendChild(document.createTextNode("button.svelte-16iv9d0{background-color:transparent;border:none;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;outline:none}.modal-background.svelte-16iv9d0{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-16iv9d0{background-color:#fff;padding:1.25rem;border-radius:.3125rem;width:40%}.model-title.svelte-16iv9d0{color:#303133;font-size:1.125rem;margin-bottom:1.125rem}.modal-visible.svelte-16iv9d0{display:flex}.modal-footer.svelte-16iv9d0{display:flex;align-items:center;justify-content:flex-end;margin-top:1rem}.modal-btn.svelte-16iv9d0{padding:.5rem .9375rem;border-radius:.25rem;font-size:.875rem;border:.0625rem solid #dcdfe6}.success.svelte-16iv9d0{margin-left:.75rem;color:#fff}.slot.svelte-16iv9d0{max-height:12.5rem;overflow-y:scroll}.slot.svelte-16iv9d0::-webkit-scrollbar{display:none}.seal-wrapper.svelte-1w19fs3.svelte-1w19fs3{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.seal-item.svelte-1w19fs3.svelte-1w19fs3{width:11.25rem;height:11.25rem;display:flex;flex-direction:column;align-items:center;justify-content:center;border:.0625rem solid #ccc;margin-top:.625rem;margin-right:.625rem;border-radius:.25rem}.seal-item.svelte-1w19fs3 img.svelte-1w19fs3{width:6.25rem;height:6.25rem}.seal-item-selected.svelte-1w19fs3.svelte-1w19fs3{background-color:#f1f1f1}.seal-name.svelte-1w19fs3.svelte-1w19fs3{margin-top:.625rem;color:#333}.cert-item.svelte-1kh75ag.svelte-1kh75ag{padding:1rem;display:flex;align-items:center;cursor:pointer;border-bottom:.0625rem solid #ebeef5;font-size:1rem}.cert-item.svelte-1kh75ag>div.svelte-1kh75ag{word-break:break-all;color:#373a40}.cert-item.svelte-1kh75ag>div.svelte-1kh75ag:nth-child(1){padding-right:.5rem}.cert-item-selected.svelte-1kh75ag.svelte-1kh75ag{background-color:#f1f1f1}.cert-item-first.svelte-1kh75ag.svelte-1kh75ag{border-top:.0625rem solid #ebeef5}")),document.head.appendChild(i)}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var Re=Object.defineProperty,ze=(i,e,t)=>e in i?Re(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,we=(i,e,t)=>ze(i,typeof e!="symbol"?e+"":e,t);function ae(){}function We(i,e){for(const t in e)i[t]=e[t];return i}function me(i){return i()}function Ee(){return Object.create(null)}function j(i){i.forEach(me)}function K(i){return typeof i=="function"}function Se(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Ye(i){return Object.keys(i).length===0}function Qe(i,e,t,n){if(i){const s=Ie(i,e,t,n);return i[0](s)}}function Ie(i,e,t,n){return i[1]&&n?We(t.ctx.slice(),i[1](n(e))):t.ctx}function Je(i,e,t,n){if(i[2]&&n){const s=i[2](n(t));if(e.dirty===void 0)return s;if(typeof s=="object"){const r=[],o=Math.max(e.dirty.length,s.length);for(let l=0;l<o;l+=1)r[l]=e.dirty[l]|s[l];return r}return e.dirty|s}return e.dirty}function qe(i,e,t,n,s,r){if(s){const o=Ie(e,t,n,r);i.p(o,s)}}function Xe(i){if(i.ctx.length>32){const e=[],t=i.ctx.length/32;for(let n=0;n<t;n++)e[n]=-1;return e}return-1}function ke(i){return i==null?"":i}function A(i,e){i.appendChild(e)}function q(i,e,t){i.insertBefore(e,t||null)}function R(i){i.parentNode&&i.parentNode.removeChild(i)}function ve(i,e){for(let t=0;t<i.length;t+=1)i[t]&&i[t].d(e)}function N(i){return document.createElement(i)}function M(i){return document.createTextNode(i)}function X(){return M(" ")}function et(){return M("")}function z(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function D(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function tt(i){return Array.from(i.childNodes)}function ee(i,e){e=""+e,i.data!==e&&(i.data=e)}function te(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,"")}let ce;function W(i){ce=i}const O=[],pe=[];let G=[];const _e=[],nt=Promise.resolve();let le=!1;function st(){le||(le=!0,nt.then(Le))}function ue(i){G.push(i)}const de=new Set;let F=0;function Le(){if(F!==0)return;const i=ce;do{try{for(;F<O.length;){const e=O[F];F++,W(e),it(e.$$)}}catch(e){throw O.length=0,F=0,e}for(W(null),O.length=0,F=0;pe.length;)pe.pop()();for(let e=0;e<G.length;e+=1){const t=G[e];de.has(t)||(de.add(t),t())}G.length=0}while(O.length);for(;_e.length;)_e.pop()();le=!1,de.clear(),W(i)}function it(i){if(i.fragment!==null){i.update(),j(i.before_update);const e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(ue)}}function rt(i){const e=[],t=[];G.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),G=e}const ne=new Set;let ot;function he(i,e){i&&i.i&&(ne.delete(i),i.i(e))}function Be(i,e,t,n){if(i&&i.o){if(ne.has(i))return;ne.add(i),ot.c.push(()=>{ne.delete(i)}),i.o(e)}}function se(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function at(i){i&&i.c()}function Pe(i,e,t){const{fragment:n,after_update:s}=i.$$;n&&n.m(e,t),ue(()=>{const r=i.$$.on_mount.map(me).filter(K);i.$$.on_destroy?i.$$.on_destroy.push(...r):j(r),i.$$.on_mount=[]}),s.forEach(ue)}function Ae(i,e){const t=i.$$;t.fragment!==null&&(rt(t.after_update),j(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function ct(i,e){i.$$.dirty[0]===-1&&(O.push(i),st(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function De(i,e,t,n,s,r,o=null,l=[-1]){const d=ce;W(i);const u=i.$$={fragment:null,ctx:[],props:r,update:ae,not_equal:s,bound:Ee(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(d?d.$$.context:[])),callbacks:Ee(),dirty:l,skip_bound:!1,root:e.target||d.$$.root};o&&o(u.root);let f=!1;if(u.ctx=t?t(i,e.props||{},(h,w,...g)=>{const C=g.length?g[0]:w;return u.ctx&&s(u.ctx[h],u.ctx[h]=C)&&(!u.skip_bound&&u.bound[h]&&u.bound[h](C),f&&ct(i,h)),w}):[],u.update(),f=!0,j(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const h=tt(e.target);u.fragment&&u.fragment.l(h),h.forEach(R)}else u.fragment&&u.fragment.c();e.intro&&he(i.$$.fragment),Pe(i,e.target,e.anchor),Le()}W(d)}class be{constructor(){we(this,"$$"),we(this,"$$set")}$destroy(){Ae(this,1),this.$destroy=ae}$on(e,t){if(!K(t))return ae;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const s=n.indexOf(t);s!==-1&&n.splice(s,1)}}$set(e){this.$$set&&!Ye(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const lt="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(lt);function ut(i){let e,t,n,s=(i[1]||"标题")+"",r,o,l,d,u,f,h=(i[4]||"取消")+"",w,g,C,E=(i[5]||"确认")+"",y,S,p,P;const x=i[8].default,v=Qe(x,i,i[7],null);return{c(){e=N("div"),t=N("div"),n=N("div"),r=M(s),o=X(),l=N("div"),v&&v.c(),d=X(),u=N("div"),f=N("button"),w=M(h),g=X(),C=N("button"),y=M(E),D(n,"class","model-title svelte-16iv9d0"),D(l,"class","slot svelte-16iv9d0"),D(f,"class","modal-btn svelte-16iv9d0"),D(C,"class","modal-btn success svelte-16iv9d0"),te(C,"background-color",i[6]),D(u,"class","modal-footer svelte-16iv9d0"),D(t,"class","modal-content svelte-16iv9d0"),D(e,"class","modal-background modal-visible svelte-16iv9d0")},m(b,$){q(b,e,$),A(e,t),A(t,n),A(n,r),A(t,o),A(t,l),v&&v.m(l,null),A(t,d),A(t,u),A(u,f),A(f,w),A(u,g),A(u,C),A(C,y),S=!0,p||(P=[z(f,"click",function(){K(i[0])&&i[0].apply(this,arguments)}),z(C,"click",function(){K(i[2])&&i[2].apply(this,arguments)}),z(t,"click",dt),z(e,"click",function(){K(i[3])&&i[3].apply(this,arguments)})],p=!0)},p(b,[$]){i=b,(!S||$&2)&&s!==(s=(i[1]||"标题")+"")&&ee(r,s),v&&v.p&&(!S||$&128)&&qe(v,x,i,i[7],S?Je(x,i[7],$,null):Xe(i[7]),null),(!S||$&16)&&h!==(h=(i[4]||"取消")+"")&&ee(w,h),(!S||$&32)&&E!==(E=(i[5]||"确认")+"")&&ee(y,E),(!S||$&64)&&te(C,"background-color",i[6])},i(b){S||(he(v,b),S=!0)},o(b){Be(v,b),S=!1},d(b){b&&R(e),v&&v.d(b),p=!1,j(P)}}}const dt=i=>i.stopPropagation();function ht(i,e,t){let{$$slots:n={},$$scope:s}=e,{onCancel:r}=e,{title:o}=e,{onOk:l}=e,{onClose:d}=e,{cancelText:u}=e,{okText:f}=e,{theme:h}=e;return i.$$set=w=>{"onCancel"in w&&t(0,r=w.onCancel),"title"in w&&t(1,o=w.title),"onOk"in w&&t(2,l=w.onOk),"onClose"in w&&t(3,d=w.onClose),"cancelText"in w&&t(4,u=w.cancelText),"okText"in w&&t(5,f=w.okText),"theme"in w&&t(6,h=w.theme),"$$scope"in w&&t(7,s=w.$$scope)},[r,o,l,d,u,f,h,s,n]}class gt extends be{constructor(e){super(),De(this,e,ht,ut,Se,{onCancel:0,title:1,onOk:2,onClose:3,cancelText:4,okText:5,theme:6})}}function Ne(i,e,t){const n=i.slice();return n[13]=e[t],n[15]=t,n}function xe(i,e,t){const n=i.slice();return n[16]=e[t],n}function $e(i){let e,t=(i[16].format?i[16].format(i[13]):i[13][i[16].key])+"",n;return{c(){e=N("div"),n=M(t),D(e,"class","svelte-1kh75ag"),te(e,"width",`${100/i[1].length}%`)},m(s,r){q(s,e,r),A(e,n)},p(s,r){r&3&&t!==(t=(s[16].format?s[16].format(s[13]):s[13][s[16].key])+"")&&ee(n,t),r&2&&te(e,"width",`${100/s[1].length}%`)},d(s){s&&R(e)}}}function Te(i){let e,t,n,s,r,o=se(i[1]),l=[];for(let u=0;u<o.length;u+=1)l[u]=$e(xe(i,o,u));function d(){return i[12](i[15])}return{c(){e=N("div");for(let u=0;u<l.length;u+=1)l[u].c();t=X(),D(e,"class",n=ke(`cert-item ${i[15]===0?"cert-item-first":""} ${i[15]===i[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")},m(u,f){q(u,e,f);for(let h=0;h<l.length;h+=1)l[h]&&l[h].m(e,null);A(e,t),s||(r=z(e,"click",d),s=!0)},p(u,f){if(i=u,f&3){o=se(i[1]);let h;for(h=0;h<o.length;h+=1){const w=xe(i,o,h);l[h]?l[h].p(w,f):(l[h]=$e(w),l[h].c(),l[h].m(e,t))}for(;h<l.length;h+=1)l[h].d(1);l.length=o.length}f&128&&n!==(n=ke(`cert-item ${i[15]===0?"cert-item-first":""} ${i[15]===i[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")&&D(e,"class",n)},d(u){u&&R(e),ve(l,u),s=!1,r()}}}function yt(i){let e,t=se(i[0]),n=[];for(let s=0;s<t.length;s+=1)n[s]=Te(Ne(i,t,s));return{c(){for(let s=0;s<n.length;s+=1)n[s].c();e=et()},m(s,r){for(let o=0;o<n.length;o+=1)n[o]&&n[o].m(s,r);q(s,e,r)},p(s,r){if(r&131){t=se(s[0]);let o;for(o=0;o<t.length;o+=1){const l=Ne(s,t,o);n[o]?n[o].p(l,r):(n[o]=Te(l),n[o].c(),n[o].m(e.parentNode,e))}for(;o<n.length;o+=1)n[o].d(1);n.length=t.length}},d(s){s&&R(e),ve(n,s)}}}function ft(i){let e,t;return e=new gt({props:{onOk:i[9],onClose:i[2],onCancel:i[8],cancelText:i[3],okText:i[4],title:i[6],theme:i[5],$$slots:{default:[yt]},$$scope:{ctx:i}}}),{c(){at(e.$$.fragment)},m(n,s){Pe(e,n,s),t=!0},p(n,[s]){const r={};s&4&&(r.onClose=n[2]),s&8&&(r.cancelText=n[3]),s&16&&(r.okText=n[4]),s&64&&(r.title=n[6]),s&32&&(r.theme=n[5]),s&524419&&(r.$$scope={dirty:s,ctx:n}),e.$set(r)},i(n){t||(he(e.$$.fragment,n),t=!0)},o(n){Be(e.$$.fragment,n),t=!1},d(n){Ae(e,n)}}}function Ct(i,e,t){let{data:n=[]}=e,{columns:s=[]}=e,{onCancel:r}=e,{onOk:o}=e,{onClose:l}=e,{cancelText:d=""}=e,{okText:u=""}=e,{theme:f="#409eff"}=e,{title:h=""}=e,w=0;const g=()=>{r(`${h}失败`),l==null||l()},C=()=>{o==null||o(n[w]),l==null||l()},E=y=>t(7,w=y);return i.$$set=y=>{"data"in y&&t(0,n=y.data),"columns"in y&&t(1,s=y.columns),"onCancel"in y&&t(10,r=y.onCancel),"onOk"in y&&t(11,o=y.onOk),"onClose"in y&&t(2,l=y.onClose),"cancelText"in y&&t(3,d=y.cancelText),"okText"in y&&t(4,u=y.okText),"theme"in y&&t(5,f=y.theme),"title"in y&&t(6,h=y.title)},[n,s,l,d,u,f,h,w,g,C,r,o,E]}class wt extends be{constructor(e){super(),De(this,e,Ct,ft,Se,{data:0,columns:1,onCancel:10,onOk:11,onClose:2,cancelText:3,okText:4,theme:5,title:6})}}class mt{constructor(){a(this,"modalInstance",{current:null});a(this,"open",e=>new Promise((t,n)=>{this.modalInstance.current=new wt({target:document.body,props:B(m({},e),{onCancel:s=>{n({code:-1,msg:s})},onOk:s=>{t(s)},onClose:()=>{this.close()}})})}));a(this,"close",()=>{setTimeout(()=>{var e;(e=this.modalInstance.current)==null||e.$destroy()})})}}const Y=new mt;function Et(i=32,e=!0,t=0){const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),s=[];if(t=t||n.length,i)for(let r=0;r<i;r++)s[r]=n[0|Math.random()*t];else{let r;s[8]=s[13]=s[18]=s[23]="-",s[14]="4";for(let o=0;o<36;o++)s[o]||(r=0|Math.random()*16,s[o]=n[o===19?r&3|8:r])}return e?(s.shift(),`u${s.join("")}`):s.join("")}const St=[{key:"CN"},{format:i=>`${i.DevClass}(${i.sn})`}],It=[{key:"SealId"},{key:"Vid"},{format:i=>`${i.FileName}(${i.FileSize}B)`}],Me=[{key:"SealId"}],kt=[{key:"manu"},{key:"sn"}];class vt{constructor(e){a(this,"socketInstance",null);a(this,"eventBus",new Ke);a(this,"scene");a(this,"isRememberPin",!1);a(this,"pinPolicy");a(this,"socketConfig",null);a(this,"isConnecting",!1);a(this,"messageQueue",[]);a(this,"getSocketReadyState",()=>{var e;return(e=this.socketInstance)==null?void 0:e.readyState});a(this,"destroy",()=>{var e;(e=this.socketInstance)==null||e.close()});a(this,"sendMessage",(e,t,n)=>new Promise((s,r)=>{var l;const o=()=>{var h,w;if(((h=this.socketInstance)==null?void 0:h.readyState)!==WebSocket.OPEN){r({errCode:Ve,msg:"数字证书客户端连接失败"});return}const d=Et(),u=g=>{g.success?s(g.data):r(g)},f={function:e,args:t?[t]:[],msgid:d};(w=this.socketInstance)==null||w.send(JSON.stringify(f)),this.eventBus.on(e,u),this.eventBus.on(d,u)};if(n&&(this.scene&n)!==n){r({errCode:Ze,msg:"无权限执行此操作"});return}if(((l=this.socketInstance)==null?void 0:l.readyState)===WebSocket.OPEN){o();return}this.messageQueue.push(o),this.isConnecting||this.initSocket(this.socketConfig)}));a(this,"flushMsgQueue",()=>{var e;(e=this.messageQueue)==null||e.forEach(t=>t()),this.messageQueue=[]});a(this,"handleEventData",e=>c(this,null,function*(){var t,n,s,r,o,l,d,u;if(e.data instanceof Blob){const f=yield e.data.arrayBuffer(),w=new TextDecoder(navigator.userAgent.includes("Windows")?"gbk":"utf-8").decode(f),g=JSON.parse(w),C={success:(t=g.result)==null?void 0:t.success,msg:(n=g.result)==null?void 0:n.msg,errCode:(s=g.result)==null?void 0:s.errCode,data:g.data,type:(r=g.result)==null?void 0:r.event},E=(o=g.result)==null?void 0:o.function,y=(l=g.result)==null?void 0:l.msgid;y?this.eventBus.emit(y,C):this.eventBus.emit(E,C),(u=(d=this.socketConfig)==null?void 0:d.onMessage)==null||u.call(d,C)}}));a(this,"base64Encode",e=>{const t=new TextEncoder().encode(e);return Ce.fromByteArray(t)});a(this,"base64Decode",e=>{const t=Ce.toByteArray(e);return new TextDecoder().decode(t)});a(this,"changeIsRememberPin",e=>c(this,null,function*(){this.isRememberPin=e}));a(this,"changePinPolicy",e=>c(this,null,function*(){this.pinPolicy=e}));a(this,"checkCertIsLogin",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_IsLogin",e)}));a(this,"addUkeyEvents",()=>c(this,null,function*(){this.sendMessage("GZCA_WaitForDevEvent",{Type:Ge}),this.eventBus.on("GZCA_OnDeviceChange",e=>{var t,n,s;(s=(t=this.socketConfig)==null?void 0:t.onUkeyChange)==null||s.call(t,B(m({},e),{data:(n=e.data)==null?void 0:n[0]}))})}));a(this,"certLogin",e=>c(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}))}));a(this,"verifyPin",e=>c(this,null,function*(){var t;yield this.sendMessage("GZCA_Login",{ContainerName:e.ContainerName,IsLogin:e.UserPin?"Y":"N",UserPin:(t=e.UserPin)!=null?t:"123456",PinPolicy:this.pinPolicy})}));a(this,"getCert",(e,t,n)=>c(this,null,function*(){const s=t!=null?t:yield this.chooseCert(e);return this.isRememberPin&&n&&(yield this.certLogin(s.ContainerName)),s}));a(this,"chooseCert",e=>c(this,null,function*(){var s;const t=yield this.getCertList(e);return t!=null&&t.length?(t==null?void 0:t.length)===1?t[0]:yield Y.open({title:"选择证书",data:t,columns:St,theme:(s=this.socketConfig)==null?void 0:s.theme}):Promise.reject({errCode:Fe,msg:"暂无证书"})}));a(this,"getCertList",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetCertList",e)}));a(this,"pkcs1Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignData",m({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"pkcs1Base64Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",m({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"batchPkcs1Base64Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_BatchPkcs1SignDataEx",m({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"pkcs1VerifySignature",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySign",e)}));a(this,"pkcs1Base64VerifySignature",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignEx",e)}));a(this,"getSealList",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_EnumSeals",m({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));a(this,"writeSeal",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_WriteSeal",m({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));a(this,"deleteSeal",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_DeleteSeal",m({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));a(this,"getSealInfo",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ReadSeal",m({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));a(this,"getTPSealList",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetSealPicList",m({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));a(this,"getTPSealPic",e=>c(this,null,function*(){var n;return yield this.sendMessage("GZCA_GetSealPicData",m({IsLogin:(n=e.IsLogin)!=null?n:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));a(this,"sm2SignPreprocess1",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep1",e)}));a(this,"sm2SignPreprocess2",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep2",e)}));a(this,"pkcs1HashSign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataForHash",m({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"pkcs1HashVerifySignature",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignForHash",e)}));a(this,"pkcs7Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7SignData",m({IsLogin:this.getIsLogin(),IsAuthAttr:"Y",PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"pkcs7VerifySignature",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7VerifySign",e)}));a(this,"sm3Hash",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_HashData",e)}));a(this,"sm3HexHash",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_HashDataEx",e)}));a(this,"sm3FileHash",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_HashFile",e)}));a(this,"sm3HashEncryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_HMac",e)}));a(this,"pkcs7Encryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7EncryptData",e)}));a(this,"pkcs7Decryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7DecryptData",m({IsLogin:this.getIsLogin()},e!=null?e:{}))}));a(this,"pkcs7FileEncryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_EnvelopeSealFileEx_qyzc",e)}));a(this,"pkcs7FileDecryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_EnvelopeOpenFileEx_qyzc",m({IsLogin:this.getIsLogin()},e!=null?e:{}))}));a(this,"asymmetricEncryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_AsymEncryptData",e)}));a(this,"asymmetricDecryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_AsymDecryptData",m({IsLogin:this.getIsLogin()},e!=null?e:{}))}));a(this,"sm4Encryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_EncryptDataEx",e)}));a(this,"sm4Decryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_DecryptDataEx",e)}));a(this,"getCertInfo",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfo",e)}));a(this,"getCertInfoByOid",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfoByOid",e)}));a(this,"getSealVendor",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetSealIssuer",e,I.LEVEL_2)}));a(this,"deleteAllSealByVendor",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ClearSeal",m({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));a(this,"applyCert",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ApplyCert",{manu:e.manu,sn:e.sn,keyid:e.ContainerName,type:e.type,url:e.url},I.LEVEL_3)}));a(this,"resetPin",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_UnblockUserPin",m({},e!=null?e:{}),I.LEVEL_3)}));a(this,"getUKeyList",()=>c(this,null,function*(){return yield this.sendMessage("GetUKeyList",void 0,I.LEVEL_3)}));a(this,"getUKeyInfo",e=>c(this,null,function*(){return yield this.sendMessage("GetUKeyID",e!=null?e:{},I.LEVEL_3)}));var t,n,s;this.socketConfig=e,this.initSocket(e),this.isRememberPin=(t=e.isRememberPin)!=null?t:!1,this.scene=(n=e.scene)!=null?n:H.OPEN,this.pinPolicy=(s=e.pinPolicy)!=null?s:T.MIN}initSocket(e){this.isConnecting=!0;const t=new WebSocket(e.url);t.onerror=n=>{var s;this.isConnecting=!1,(s=e.onError)==null||s.call(e,n),this.flushMsgQueue()},t.onopen=n=>{var s;this.isConnecting=!1,(s=e.onOpen)==null||s.call(e,n),e.onUkeyChange&&this.addUkeyEvents(),this.flushMsgQueue()},t.onmessage=n=>{this.handleEventData(n)},t.onclose=n=>{var s;this.isConnecting=!1,(s=e.onClose)==null||s.call(e,n)},this.socketInstance=t}getIsLogin(){return this.isRememberPin?"Y":"N"}}const Z=class Z{constructor(e){a(this,"coreInstance",null);a(this,"gwsConfig",{});a(this,"createGwsCore",e=>{this.gwsConfig=e!=null?e:{},this.coreInstance=new vt(B(m({},e!=null?e:{}),{url:k}))});a(this,"appendCertBase64",(e,t=!0)=>c(this,null,function*(){if(e.CertB64)return e;const n=t?yield this.getSignatureCert():yield this.getEncryptionCert();return B(m({},e!=null?e:{}),{CertB64:n==null?void 0:n.CertB64})}));a(this,"destroy",()=>{var e;(e=this.coreInstance)==null||e.destroy(),this.coreInstance=null});a(this,"restart",e=>{this.coreInstance&&this.destroy(),this.gwsConfig=e!=null?e:this.gwsConfig,this.createGwsCore(e)});a(this,"getSocketReadyState",()=>{var e;return(e=this.coreInstance)==null?void 0:e.getSocketReadyState()});a(this,"verifyPin",(e,t)=>c(this,null,function*(){var s,r;const n=yield this.getSignatureCert(t);return(r=this.coreInstance)==null?void 0:r.verifyPin({ContainerName:(s=n==null?void 0:n.ContainerName)!=null?s:"",UserPin:e==null?void 0:e.UserPin})}));a(this,"getSignatureCert",(e,t=!0)=>c(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:L},e,t)}));a(this,"getSignatureCertList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:L})}));a(this,"getEncryptionCert",(e,t=!0)=>c(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:Q},e,t)}));a(this,"getEncryptionCertList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:Q})}));a(this,"base64Encode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Encode(e.Data)});a(this,"base64Decode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Decode(e.DataB64)});a(this,"changeIsRememberPin",e=>{var t;(t=this.coreInstance)==null||t.changeIsRememberPin(e)});a(this,"changePinPolicy",e=>{var t;(t=this.coreInstance)==null||t.changePinPolicy(e)});a(this,"pkcs1Sign",(e,t)=>c(this,null,function*(){var r,o,l;const n=yield this.getSignatureCert(t),s=yield(o=this.coreInstance)==null?void 0:o.pkcs1Sign(B(m({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""}));return(l=s==null?void 0:s[0])==null?void 0:l.SignData}));a(this,"pkcs1VerifySignature",e=>c(this,null,function*(){var s;const t=yield this.appendCertBase64(e),n=yield(s=this.coreInstance)==null?void 0:s.pkcs1VerifySignature(t);return Array.isArray(n)}));a(this,"pkcs1Base64Sign",(e,t)=>c(this,null,function*(){var o,l,d,u,f;const n=yield this.getSignatureCert(t),s=(l=e.DataB64)!=null?l:this.base64Encode({Data:(o=e.Data)!=null?o:""}),r=yield(u=this.coreInstance)==null?void 0:u.pkcs1Base64Sign(B(m({},e!=null?e:{}),{ContainerName:(d=n==null?void 0:n.ContainerName)!=null?d:"",DataB64:s}));return(f=r==null?void 0:r[0])==null?void 0:f.SignData}));a(this,"batchPkcs1Base64Sign",(e,t)=>c(this,null,function*(){var f,h,w,g,C,E;const n="|",s=(h=e.DataB64)!=null?h:(f=e.Data)==null?void 0:f.map(y=>this.base64Encode({Data:y})),r=yield this.getSignatureCert(t);let o="";o=Array.isArray(s)?s==null?void 0:s.map((y,S)=>`${S}:${y}`).join(n):"";const l=yield(g=this.coreInstance)==null?void 0:g.batchPkcs1Base64Sign({ContainerName:(w=r==null?void 0:r.ContainerName)!=null?w:"",DataB64:o}),d=(E=(C=l==null?void 0:l[0])==null?void 0:C.SignData)==null?void 0:E.split(n),u=[];return d.forEach(y=>{const S=y.split(":"),p=Number(S[0]),P=S[1];u[p]=P}),u}));a(this,"pkcs1Base64VerifySignature",e=>c(this,null,function*(){var r,o,l;const t=(o=e.DataB64)!=null?o:this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=yield this.appendCertBase64(e);return!!(yield(l=this.coreInstance)==null?void 0:l.pkcs1Base64VerifySignature({CertB64:n.CertB64,DataB64:t,SignData:n.SignData}))}));a(this,"writeSeal",(e,t)=>c(this,null,function*(){var r,o;const n=yield this.getSignatureCert(t);return!!(yield(o=this.coreInstance)==null?void 0:o.writeSeal(B(m({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));a(this,"deleteSeal",e=>c(this,null,function*(){var o,l,d,u,f;const t=yield this.getSealList(e);if(!((o=t==null?void 0:t.data)!=null&&o.length))return Promise.reject({errCode:oe,msg:"暂无印章"});const n=yield Y.open({title:"删除印章",data:t==null?void 0:t.data,columns:Me,okText:"删除"}),s=(l=n==null?void 0:n.SealId)!=null?l:"";return!!(yield(f=this.coreInstance)==null?void 0:f.deleteSeal({ContainerName:(u=(d=t==null?void 0:t.cert)==null?void 0:d.ContainerName)!=null?u:"",SealId:s}))}));a(this,"deleteSealById",(e,t)=>c(this,null,function*(){var r,o;const n=yield this.getSignatureCert(t);return!!(yield(o=this.coreInstance)==null?void 0:o.deleteSeal(B(m({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));a(this,"getSealList",e=>c(this,null,function*(){var s,r;const t=yield this.getSignatureCert(e),n=yield(r=this.coreInstance)==null?void 0:r.getSealList({ContainerName:(s=t==null?void 0:t.ContainerName)!=null?s:"",IsLogin:"Y"});return{cert:t,data:n}}));a(this,"getSealInfo",e=>c(this,null,function*(){var r,o,l,d,u,f,h;const t=yield this.getSealList(e);if(!((r=t==null?void 0:t.data)!=null&&r.length))return Promise.reject({errCode:oe,msg:"暂无印章"});const n=((o=t==null?void 0:t.data)==null?void 0:o.length)>1?yield Y.open({title:"选择印章",data:t==null?void 0:t.data,columns:Me,theme:(l=this.gwsConfig)==null?void 0:l.theme}):t==null?void 0:t.data[0],s=yield(h=this.coreInstance)==null?void 0:h.getSealInfo({ContainerName:(u=(d=t==null?void 0:t.cert)==null?void 0:d.ContainerName)!=null?u:"",SealId:(f=n==null?void 0:n.SealId)!=null?f:""});return s==null?void 0:s[0]}));a(this,"getTPSealList",(e,t)=>c(this,null,function*(){var r,o;const n=yield this.getSignatureCert(t),s=yield(o=this.coreInstance)==null?void 0:o.getTPSealList({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:"",Vid:e==null?void 0:e.Vid});return{cert:n,data:s}}));a(this,"getTPSeal",(e,t)=>c(this,null,function*(){var r,o,l;const n=yield this.getTPSealList(e,t);if(!((r=n==null?void 0:n.data)!=null&&r.length))return Promise.reject({errCode:oe,msg:"暂无印章"});const s=((o=n==null?void 0:n.data)==null?void 0:o.length)===1?n==null?void 0:n.data[0]:yield Y.open({title:"选择印章",data:n==null?void 0:n.data,columns:It,theme:(l=this.gwsConfig)==null?void 0:l.theme});return{cert:n==null?void 0:n.cert,data:s}}));a(this,"getTPSealPic",(e,t)=>c(this,null,function*(){var r,o,l,d,u;const n=yield this.getTPSeal(e,t),s=yield(u=this.coreInstance)==null?void 0:u.getTPSealPic(B(m({ContainerName:(o=(r=n==null?void 0:n.cert)==null?void 0:r.ContainerName)!=null?o:""},(l=n==null?void 0:n.data)!=null?l:{}),{FileSize:String((d=n==null?void 0:n.data)==null?void 0:d.FileSize)}));return s==null?void 0:s[0]}));a(this,"sm2SignPreprocess1",e=>c(this,null,function*(){var s,r;const t=yield this.appendCertBase64(e),n=yield(s=this.coreInstance)==null?void 0:s.sm2SignPreprocess1(t);return(r=n==null?void 0:n[0])==null?void 0:r.Z}));a(this,"sm2SignPreprocess2",e=>c(this,null,function*(){var r,o;const t=this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=yield this.appendCertBase64(e),s=yield(o=this.coreInstance)==null?void 0:o.sm2SignPreprocess2({CertB64:n.CertB64,DataB64:t});return s==null?void 0:s[0].H}));a(this,"pkcs1HashSign",(e,t)=>c(this,null,function*(){var r,o,l,d;const n=yield this.getSignatureCert(t),s=yield(l=this.coreInstance)==null?void 0:l.pkcs1HashSign({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:"",DataB64:e.DataB64,HashAlg:(o=e.HashAlg)!=null?o:"sm3"});return(d=s==null?void 0:s[0])==null?void 0:d.SignData}));a(this,"pkcs1HashVerifySignature",e=>c(this,null,function*(){var s,r;const t=yield this.appendCertBase64(e);return!!(yield(r=this.coreInstance)==null?void 0:r.pkcs1HashVerifySignature(B(m({},t),{HashAlg:(s=t.HashAlg)!=null?s:"sm3"})))}));a(this,"pkcs7Sign",(e,t)=>c(this,null,function*(){var o,l,d,u,f;const n=(l=e.DataB64)!=null?l:this.base64Encode({Data:(o=e.Data)!=null?o:""}),s=yield this.getSignatureCert(t),r=yield(u=this.coreInstance)==null?void 0:u.pkcs7Sign(B(m({},e!=null?e:{}),{ContainerName:(d=s==null?void 0:s.ContainerName)!=null?d:"",DataB64:n}));return(f=r==null?void 0:r[0])==null?void 0:f.SignData}));a(this,"pkcs7VerifySignature",e=>c(this,null,function*(){var s,r,o;const t=(r=e.DataB64)!=null?r:this.base64Encode({Data:(s=e.Data)!=null?s:""});return!!(yield(o=this.coreInstance)==null?void 0:o.pkcs7VerifySignature({DataB64:t,SignData:e.SignData}))}));a(this,"sm3Hash",e=>c(this,null,function*(){var n,s;const t=yield(n=this.coreInstance)==null?void 0:n.sm3Hash(e);return(s=t==null?void 0:t[0])==null?void 0:s.HashB64}));a(this,"sm3HexHash",e=>c(this,null,function*(){var n,s;const t=yield(n=this.coreInstance)==null?void 0:n.sm3HexHash(e);return(s=t==null?void 0:t[0])==null?void 0:s.HashB64}));a(this,"sm3FileHash",e=>c(this,null,function*(){var n,s;const t=yield(n=this.coreInstance)==null?void 0:n.sm3FileHash(e);return(s=t==null?void 0:t[0])==null?void 0:s.HashB64}));a(this,"sm3HashEncryption",e=>c(this,null,function*(){var r,o,l,d,u,f;const t=(o=e.DataB64)!=null?o:this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=(d=e.KeyB64)!=null?d:this.base64Encode({Data:(l=e.Key)!=null?l:""}),s=yield(u=this.coreInstance)==null?void 0:u.sm3HashEncryption({dataB64:t,keyB64:n,alg:"sm3"});return(f=s==null?void 0:s[0])==null?void 0:f.DataB64}));a(this,"pkcs7Encryption",e=>c(this,null,function*(){var s,r,o,l;if(!e.CertB64List){const d=yield this.getEncryptionCert();e.CertB64List=d==null?void 0:d.CertB64}const t=(r=e.DataB64)!=null?r:this.base64Encode({Data:(s=e.Data)!=null?s:""}),n=yield(o=this.coreInstance)==null?void 0:o.pkcs7Encryption({DataB64:t,CertB64List:e.CertB64List});return(l=n==null?void 0:n[0])==null?void 0:l.DataB64}));a(this,"pkcs7Decryption",e=>c(this,null,function*(){var r,o;const t=yield this.getEncryptionCert(),n=yield(r=this.coreInstance)==null?void 0:r.pkcs7Decryption(B(m({},e!=null?e:{}),{ContainerName:t==null?void 0:t.ContainerName})),s=(o=n==null?void 0:n[0])==null?void 0:o.DataB64;return e.shouldDecodeBase64?this.base64Decode({DataB64:s}):s}));a(this,"pkcs7FileEncryption",e=>c(this,null,function*(){var s,r;const t=yield this.appendCertBase64(e,!1),n=yield(s=this.coreInstance)==null?void 0:s.pkcs7FileEncryption(t);return(r=n==null?void 0:n[0])==null?void 0:r.DataB64}));a(this,"pkcs7FileDecryption",e=>c(this,null,function*(){var s,r,o;const t=yield this.getEncryptionCert(),n=yield(r=this.coreInstance)==null?void 0:r.pkcs7FileDecryption({SrcFile:e.SrcFile,DstFile:(s=e.DstFile)!=null?s:e.SrcFile.slice(0,-4),ContainerName:t==null?void 0:t.ContainerName});return(o=n==null?void 0:n[0])==null?void 0:o.DataB64}));a(this,"asymmetricEncryption",e=>c(this,null,function*(){var s,r;const t=yield this.appendCertBase64(e,!1),n=yield(s=this.coreInstance)==null?void 0:s.asymmetricEncryption(t);return(r=n==null?void 0:n[0])==null?void 0:r.Data}));a(this,"asymmetricDecryption",(e,t)=>c(this,null,function*(){var r,o;const n=yield this.getEncryptionCert(t),s=yield(r=this.coreInstance)==null?void 0:r.asymmetricDecryption(B(m({},e!=null?e:{}),{ContainerName:n==null?void 0:n.ContainerName}));return(o=s==null?void 0:s[0])==null?void 0:o.Data}));a(this,"sm4Encryption",e=>c(this,null,function*(){var n;const t=yield(n=this.coreInstance)==null?void 0:n.sm4Encryption(e);return t==null?void 0:t[0]}));a(this,"sm4Decryption",e=>c(this,null,function*(){var n,s;const t=yield(n=this.coreInstance)==null?void 0:n.sm4Decryption(e);return(s=t==null?void 0:t[0])==null?void 0:s.Data}));a(this,"getCertInfo",e=>c(this,null,function*(){var s,r,o,l,d;const t=yield(s=this.coreInstance)==null?void 0:s.getCertInfo(e),n=(r=t==null?void 0:t[0])!=null?r:{};for(let u=0;u<ye.length;u++){const f=ye[u];try{const h=yield(o=this.coreInstance)==null?void 0:o.getCertInfoByOid({Oid:f.oid,CertB64:e.CertB64});n[f.key]=(d=(l=h==null?void 0:h[0])==null?void 0:l.OidValue)==null?void 0:d.slice(2)}catch(h){n[f.key]=null}}return n!=null&&n.idCardNo?n!=null&&n.CertSubject.includes("O")||n.orgCode?n.certCate=ie:n.certCate=J:n.certCate=re,n}));a(this,"getCertInfoByOid",e=>c(this,null,function*(){var n,s;const t=yield(n=this.coreInstance)==null?void 0:n.getCertInfoByOid(m({},e!=null?e:{}));return(s=t==null?void 0:t[0])==null?void 0:s.OidValue}));a(this,"getSealVendor",e=>c(this,null,function*(){var s;const t=yield this.getSignatureCert(e),n=yield(s=this.coreInstance)==null?void 0:s.getSealVendor({ContainerName:t==null?void 0:t.ContainerName});return n==null?void 0:n[0]}));a(this,"deleteAllSealByVendor",(e,t)=>c(this,null,function*(){var r;const n=yield this.getSignatureCert(t),s=yield(r=this.coreInstance)==null?void 0:r.deleteAllSealByVendor(B(m({},e!=null?e:{}),{ContainerName:n==null?void 0:n.ContainerName}));return s==null?void 0:s[0]}));a(this,"getUKeyList",e=>c(this,null,function*(){var s;if(e)return e;const t=yield(s=this.coreInstance)==null?void 0:s.getUKeyList();return yield Y.open({title:"选择介质",data:t,columns:kt})}));a(this,"getUKeyInfo",e=>c(this,null,function*(){var s;const t=yield this.getUKeyList(e),n=yield(s=this.coreInstance)==null?void 0:s.getUKeyInfo({manu:t==null?void 0:t.manu,sn:t==null?void 0:t.sn});return n==null?void 0:n[0]}));a(this,"applyCert",(e,t)=>c(this,null,function*(){var o;const n=yield this.getUKeyList(t),s=yield this.getUKeyInfo(n);return yield(o=this.coreInstance)==null?void 0:o.applyCert(B(m({},e!=null?e:{}),{manu:s==null?void 0:s.manu,sn:s==null?void 0:s.sn,ContainerName:s==null?void 0:s.keyid}))}));a(this,"resetPin",(e,t)=>c(this,null,function*(){var r;const n=yield this.getSignatureCert(t);return yield(r=this.coreInstance)==null?void 0:r.resetPin(B(m({},e!=null?e:{}),{manu:n==null?void 0:n.manu,sn:n==null?void 0:n.sn,ContainerName:n==null?void 0:n.ContainerName}))}));return Z.instance&&!(e!=null&&e.isCreateNew)?Z.instance:(this.createGwsCore(e),Z.instance=this,this)}};a(Z,"instance",null);let V=Z;function pt(i){return new Promise((e,t)=>{if(V.instance&&!(i!=null&&i.isCreateNew))e(V.instance);else{const n=new V(B(m({},i!=null?i:{}),{onOpen(s){var r;e(n),(r=i==null?void 0:i.onOpen)==null||r.call(i,s)},onClose(s){var r;t(s),(r=i==null?void 0:i.onClose)==null||r.call(i,s)}}))}})}_.GwsService=V,_.createService=pt,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
1
+ (function(_,k){typeof exports=="object"&&typeof module!="undefined"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(_=typeof globalThis!="undefined"?globalThis:_||self,k(_.GWS_CLIENT={}))})(this,function(_){"use strict";var _t=Object.defineProperty,Lt=Object.defineProperties;var Bt=Object.getOwnPropertyDescriptors;var Oe=Object.getOwnPropertySymbols;var Pt=Object.prototype.hasOwnProperty,At=Object.prototype.propertyIsEnumerable;var ge=(_,k,L)=>k in _?_t(_,k,{enumerable:!0,configurable:!0,writable:!0,value:L}):_[k]=L,E=(_,k)=>{for(var L in k||(k={}))Pt.call(k,L)&&ge(_,L,k[L]);if(Oe)for(var L of Oe(k))At.call(k,L)&&ge(_,L,k[L]);return _},B=(_,k)=>Lt(_,Bt(k));var o=(_,k,L)=>ge(_,typeof k!="symbol"?k+"":k,L);var c=(_,k,L)=>new Promise((Q,J)=>{var ie=I=>{try{T(L.next(I))}catch(H){J(H)}},re=I=>{try{T(L.throw(I))}catch(H){J(H)}},T=I=>I.done?Q(I.value):Promise.resolve(I.value).then(ie,re);T((L=L.apply(_,k)).next())});const k=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",L="1",Q="2",J="1",ie="2",re="3";var T=(i=>(i.MIN="0",i.LOW="1",i.MIDDLE="2",i.HIGH="3",i))(T||{});const I={LEVEL_1:1,LEVEL_2:2,LEVEL_3:4},H={OPEN:I.LEVEL_1,INTERNAL:I.LEVEL_2|I.LEVEL_1,OMP:I.LEVEL_3|I.LEVEL_2|I.LEVEL_1},Ge="00000001",ae="NO_SEAL_AVAILABLE",Fe="CERTIFICATE_NOT_FOUND",Ve="CLIENT_CONNECTION_FAILED",Ze="ACCESS_DENIED",ye=[{oid:"1.2.86.21.1.3",key:"trustServiceNo"},{oid:"1.2.156.10260.4.1.1",key:"idCardNo"},{oid:"1.2.156.10260.4.1.4",key:"orgCode"}];function He(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var U={},fe;function Ue(){if(fe)return U;fe=1,U.byteLength=l,U.toByteArray=u,U.fromByteArray=w;for(var i=[],e=[],t=typeof Uint8Array!="undefined"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,r=n.length;s<r;++s)i[s]=n[s],e[n.charCodeAt(s)]=s;e[45]=62,e[95]=63;function a(y){var g=y.length;if(g%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var m=y.indexOf("=");m===-1&&(m=g);var C=m===g?0:4-m%4;return[m,C]}function l(y){var g=a(y),m=g[0],C=g[1];return(m+C)*3/4-C}function d(y,g,m){return(g+m)*3/4-m}function u(y){var g,m=a(y),C=m[0],S=m[1],p=new t(d(y,C,S)),P=0,x=S>0?C-4:C,v;for(v=0;v<x;v+=4)g=e[y.charCodeAt(v)]<<18|e[y.charCodeAt(v+1)]<<12|e[y.charCodeAt(v+2)]<<6|e[y.charCodeAt(v+3)],p[P++]=g>>16&255,p[P++]=g>>8&255,p[P++]=g&255;return S===2&&(g=e[y.charCodeAt(v)]<<2|e[y.charCodeAt(v+1)]>>4,p[P++]=g&255),S===1&&(g=e[y.charCodeAt(v)]<<10|e[y.charCodeAt(v+1)]<<4|e[y.charCodeAt(v+2)]>>2,p[P++]=g>>8&255,p[P++]=g&255),p}function f(y){return i[y>>18&63]+i[y>>12&63]+i[y>>6&63]+i[y&63]}function h(y,g,m){for(var C,S=[],p=g;p<m;p+=3)C=(y[p]<<16&16711680)+(y[p+1]<<8&65280)+(y[p+2]&255),S.push(f(C));return S.join("")}function w(y){for(var g,m=y.length,C=m%3,S=[],p=16383,P=0,x=m-C;P<x;P+=p)S.push(h(y,P,P+p>x?x:P+p));return C===1?(g=y[m-1],S.push(i[g>>2]+i[g<<4&63]+"==")):C===2&&(g=(y[m-2]<<8)+y[m-1],S.push(i[g>>10]+i[g>>4&63]+i[g<<2&63]+"=")),S.join("")}return U}var je=Ue();const Ce=He(je);class Ke{constructor(){o(this,"deps",new Map)}on(e,t){this.deps.set(e,t)}emit(e,t){const n=this.deps.get(e);n==null||n(t)}}(function(){try{var i=document.createElement("style");i.appendChild(document.createTextNode("button.svelte-16iv9d0{background-color:transparent;border:none;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;outline:none}.modal-background.svelte-16iv9d0{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-16iv9d0{background-color:#fff;padding:1.25rem;border-radius:.3125rem;width:40%}.model-title.svelte-16iv9d0{color:#303133;font-size:1.125rem;margin-bottom:1.125rem}.modal-visible.svelte-16iv9d0{display:flex}.modal-footer.svelte-16iv9d0{display:flex;align-items:center;justify-content:flex-end;margin-top:1rem}.modal-btn.svelte-16iv9d0{padding:.5rem .9375rem;border-radius:.25rem;font-size:.875rem;border:.0625rem solid #dcdfe6}.success.svelte-16iv9d0{margin-left:.75rem;color:#fff}.slot.svelte-16iv9d0{max-height:12.5rem;overflow-y:scroll}.slot.svelte-16iv9d0::-webkit-scrollbar{display:none}.seal-wrapper.svelte-1w19fs3.svelte-1w19fs3{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.seal-item.svelte-1w19fs3.svelte-1w19fs3{width:11.25rem;height:11.25rem;display:flex;flex-direction:column;align-items:center;justify-content:center;border:.0625rem solid #ccc;margin-top:.625rem;margin-right:.625rem;border-radius:.25rem}.seal-item.svelte-1w19fs3 img.svelte-1w19fs3{width:6.25rem;height:6.25rem}.seal-item-selected.svelte-1w19fs3.svelte-1w19fs3{background-color:#f1f1f1}.seal-name.svelte-1w19fs3.svelte-1w19fs3{margin-top:.625rem;color:#333}.cert-item.svelte-1kh75ag.svelte-1kh75ag{padding:1rem;display:flex;align-items:center;cursor:pointer;border-bottom:.0625rem solid #ebeef5;font-size:1rem}.cert-item.svelte-1kh75ag>div.svelte-1kh75ag{word-break:break-all;color:#373a40}.cert-item.svelte-1kh75ag>div.svelte-1kh75ag:nth-child(1){padding-right:.5rem}.cert-item-selected.svelte-1kh75ag.svelte-1kh75ag{background-color:#f1f1f1}.cert-item-first.svelte-1kh75ag.svelte-1kh75ag{border-top:.0625rem solid #ebeef5}")),document.head.appendChild(i)}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var ze=Object.defineProperty,Re=(i,e,t)=>e in i?ze(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,we=(i,e,t)=>Re(i,typeof e!="symbol"?e+"":e,t);function oe(){}function We(i,e){for(const t in e)i[t]=e[t];return i}function me(i){return i()}function Ee(){return Object.create(null)}function j(i){i.forEach(me)}function K(i){return typeof i=="function"}function Se(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Ye(i){return Object.keys(i).length===0}function Qe(i,e,t,n){if(i){const s=Ie(i,e,t,n);return i[0](s)}}function Ie(i,e,t,n){return i[1]&&n?We(t.ctx.slice(),i[1](n(e))):t.ctx}function Je(i,e,t,n){if(i[2]&&n){const s=i[2](n(t));if(e.dirty===void 0)return s;if(typeof s=="object"){const r=[],a=Math.max(e.dirty.length,s.length);for(let l=0;l<a;l+=1)r[l]=e.dirty[l]|s[l];return r}return e.dirty|s}return e.dirty}function qe(i,e,t,n,s,r){if(s){const a=Ie(e,t,n,r);i.p(a,s)}}function Xe(i){if(i.ctx.length>32){const e=[],t=i.ctx.length/32;for(let n=0;n<t;n++)e[n]=-1;return e}return-1}function ke(i){return i==null?"":i}function A(i,e){i.appendChild(e)}function q(i,e,t){i.insertBefore(e,t||null)}function z(i){i.parentNode&&i.parentNode.removeChild(i)}function ve(i,e){for(let t=0;t<i.length;t+=1)i[t]&&i[t].d(e)}function N(i){return document.createElement(i)}function M(i){return document.createTextNode(i)}function X(){return M(" ")}function et(){return M("")}function R(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function D(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function tt(i){return Array.from(i.childNodes)}function ee(i,e){e=""+e,i.data!==e&&(i.data=e)}function te(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,"")}let ce;function W(i){ce=i}const O=[],pe=[];let G=[];const _e=[],nt=Promise.resolve();let le=!1;function st(){le||(le=!0,nt.then(Le))}function ue(i){G.push(i)}const de=new Set;let F=0;function Le(){if(F!==0)return;const i=ce;do{try{for(;F<O.length;){const e=O[F];F++,W(e),it(e.$$)}}catch(e){throw O.length=0,F=0,e}for(W(null),O.length=0,F=0;pe.length;)pe.pop()();for(let e=0;e<G.length;e+=1){const t=G[e];de.has(t)||(de.add(t),t())}G.length=0}while(O.length);for(;_e.length;)_e.pop()();le=!1,de.clear(),W(i)}function it(i){if(i.fragment!==null){i.update(),j(i.before_update);const e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(ue)}}function rt(i){const e=[],t=[];G.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),G=e}const ne=new Set;let at;function he(i,e){i&&i.i&&(ne.delete(i),i.i(e))}function Be(i,e,t,n){if(i&&i.o){if(ne.has(i))return;ne.add(i),at.c.push(()=>{ne.delete(i)}),i.o(e)}}function se(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function ot(i){i&&i.c()}function Pe(i,e,t){const{fragment:n,after_update:s}=i.$$;n&&n.m(e,t),ue(()=>{const r=i.$$.on_mount.map(me).filter(K);i.$$.on_destroy?i.$$.on_destroy.push(...r):j(r),i.$$.on_mount=[]}),s.forEach(ue)}function Ae(i,e){const t=i.$$;t.fragment!==null&&(rt(t.after_update),j(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function ct(i,e){i.$$.dirty[0]===-1&&(O.push(i),st(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function De(i,e,t,n,s,r,a=null,l=[-1]){const d=ce;W(i);const u=i.$$={fragment:null,ctx:[],props:r,update:oe,not_equal:s,bound:Ee(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(d?d.$$.context:[])),callbacks:Ee(),dirty:l,skip_bound:!1,root:e.target||d.$$.root};a&&a(u.root);let f=!1;if(u.ctx=t?t(i,e.props||{},(h,w,...y)=>{const g=y.length?y[0]:w;return u.ctx&&s(u.ctx[h],u.ctx[h]=g)&&(!u.skip_bound&&u.bound[h]&&u.bound[h](g),f&&ct(i,h)),w}):[],u.update(),f=!0,j(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const h=tt(e.target);u.fragment&&u.fragment.l(h),h.forEach(z)}else u.fragment&&u.fragment.c();e.intro&&he(i.$$.fragment),Pe(i,e.target,e.anchor),Le()}W(d)}class be{constructor(){we(this,"$$"),we(this,"$$set")}$destroy(){Ae(this,1),this.$destroy=oe}$on(e,t){if(!K(t))return oe;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const s=n.indexOf(t);s!==-1&&n.splice(s,1)}}$set(e){this.$$set&&!Ye(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const lt="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(lt);function ut(i){let e,t,n,s=(i[1]||"标题")+"",r,a,l,d,u,f,h=(i[4]||"取消")+"",w,y,g,m=(i[5]||"确认")+"",C,S,p,P;const x=i[8].default,v=Qe(x,i,i[7],null);return{c(){e=N("div"),t=N("div"),n=N("div"),r=M(s),a=X(),l=N("div"),v&&v.c(),d=X(),u=N("div"),f=N("button"),w=M(h),y=X(),g=N("button"),C=M(m),D(n,"class","model-title svelte-16iv9d0"),D(l,"class","slot svelte-16iv9d0"),D(f,"class","modal-btn svelte-16iv9d0"),D(g,"class","modal-btn success svelte-16iv9d0"),te(g,"background-color",i[6]),D(u,"class","modal-footer svelte-16iv9d0"),D(t,"class","modal-content svelte-16iv9d0"),D(e,"class","modal-background modal-visible svelte-16iv9d0")},m(b,$){q(b,e,$),A(e,t),A(t,n),A(n,r),A(t,a),A(t,l),v&&v.m(l,null),A(t,d),A(t,u),A(u,f),A(f,w),A(u,y),A(u,g),A(g,C),S=!0,p||(P=[R(f,"click",function(){K(i[0])&&i[0].apply(this,arguments)}),R(g,"click",function(){K(i[2])&&i[2].apply(this,arguments)}),R(t,"click",dt),R(e,"click",function(){K(i[3])&&i[3].apply(this,arguments)})],p=!0)},p(b,[$]){i=b,(!S||$&2)&&s!==(s=(i[1]||"标题")+"")&&ee(r,s),v&&v.p&&(!S||$&128)&&qe(v,x,i,i[7],S?Je(x,i[7],$,null):Xe(i[7]),null),(!S||$&16)&&h!==(h=(i[4]||"取消")+"")&&ee(w,h),(!S||$&32)&&m!==(m=(i[5]||"确认")+"")&&ee(C,m),(!S||$&64)&&te(g,"background-color",i[6])},i(b){S||(he(v,b),S=!0)},o(b){Be(v,b),S=!1},d(b){b&&z(e),v&&v.d(b),p=!1,j(P)}}}const dt=i=>i.stopPropagation();function ht(i,e,t){let{$$slots:n={},$$scope:s}=e,{onCancel:r}=e,{title:a}=e,{onOk:l}=e,{onClose:d}=e,{cancelText:u}=e,{okText:f}=e,{theme:h}=e;return i.$$set=w=>{"onCancel"in w&&t(0,r=w.onCancel),"title"in w&&t(1,a=w.title),"onOk"in w&&t(2,l=w.onOk),"onClose"in w&&t(3,d=w.onClose),"cancelText"in w&&t(4,u=w.cancelText),"okText"in w&&t(5,f=w.okText),"theme"in w&&t(6,h=w.theme),"$$scope"in w&&t(7,s=w.$$scope)},[r,a,l,d,u,f,h,s,n]}class gt extends be{constructor(e){super(),De(this,e,ht,ut,Se,{onCancel:0,title:1,onOk:2,onClose:3,cancelText:4,okText:5,theme:6})}}function Ne(i,e,t){const n=i.slice();return n[13]=e[t],n[15]=t,n}function xe(i,e,t){const n=i.slice();return n[16]=e[t],n}function $e(i){let e,t=(i[16].format?i[16].format(i[13]):i[13][i[16].key])+"",n;return{c(){e=N("div"),n=M(t),D(e,"class","svelte-1kh75ag"),te(e,"width",`${100/i[1].length}%`)},m(s,r){q(s,e,r),A(e,n)},p(s,r){r&3&&t!==(t=(s[16].format?s[16].format(s[13]):s[13][s[16].key])+"")&&ee(n,t),r&2&&te(e,"width",`${100/s[1].length}%`)},d(s){s&&z(e)}}}function Te(i){let e,t,n,s,r,a=se(i[1]),l=[];for(let u=0;u<a.length;u+=1)l[u]=$e(xe(i,a,u));function d(){return i[12](i[15])}return{c(){e=N("div");for(let u=0;u<l.length;u+=1)l[u].c();t=X(),D(e,"class",n=ke(`cert-item ${i[15]===0?"cert-item-first":""} ${i[15]===i[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")},m(u,f){q(u,e,f);for(let h=0;h<l.length;h+=1)l[h]&&l[h].m(e,null);A(e,t),s||(r=R(e,"click",d),s=!0)},p(u,f){if(i=u,f&3){a=se(i[1]);let h;for(h=0;h<a.length;h+=1){const w=xe(i,a,h);l[h]?l[h].p(w,f):(l[h]=$e(w),l[h].c(),l[h].m(e,t))}for(;h<l.length;h+=1)l[h].d(1);l.length=a.length}f&128&&n!==(n=ke(`cert-item ${i[15]===0?"cert-item-first":""} ${i[15]===i[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")&&D(e,"class",n)},d(u){u&&z(e),ve(l,u),s=!1,r()}}}function yt(i){let e,t=se(i[0]),n=[];for(let s=0;s<t.length;s+=1)n[s]=Te(Ne(i,t,s));return{c(){for(let s=0;s<n.length;s+=1)n[s].c();e=et()},m(s,r){for(let a=0;a<n.length;a+=1)n[a]&&n[a].m(s,r);q(s,e,r)},p(s,r){if(r&131){t=se(s[0]);let a;for(a=0;a<t.length;a+=1){const l=Ne(s,t,a);n[a]?n[a].p(l,r):(n[a]=Te(l),n[a].c(),n[a].m(e.parentNode,e))}for(;a<n.length;a+=1)n[a].d(1);n.length=t.length}},d(s){s&&z(e),ve(n,s)}}}function ft(i){let e,t;return e=new gt({props:{onOk:i[9],onClose:i[2],onCancel:i[8],cancelText:i[3],okText:i[4],title:i[6],theme:i[5],$$slots:{default:[yt]},$$scope:{ctx:i}}}),{c(){ot(e.$$.fragment)},m(n,s){Pe(e,n,s),t=!0},p(n,[s]){const r={};s&4&&(r.onClose=n[2]),s&8&&(r.cancelText=n[3]),s&16&&(r.okText=n[4]),s&64&&(r.title=n[6]),s&32&&(r.theme=n[5]),s&524419&&(r.$$scope={dirty:s,ctx:n}),e.$set(r)},i(n){t||(he(e.$$.fragment,n),t=!0)},o(n){Be(e.$$.fragment,n),t=!1},d(n){Ae(e,n)}}}function Ct(i,e,t){let{data:n=[]}=e,{columns:s=[]}=e,{onCancel:r}=e,{onOk:a}=e,{onClose:l}=e,{cancelText:d=""}=e,{okText:u=""}=e,{theme:f="#409eff"}=e,{title:h=""}=e,w=0;const y=()=>{r(`${h}失败`),l==null||l()},g=()=>{a==null||a(n[w]),l==null||l()},m=C=>t(7,w=C);return i.$$set=C=>{"data"in C&&t(0,n=C.data),"columns"in C&&t(1,s=C.columns),"onCancel"in C&&t(10,r=C.onCancel),"onOk"in C&&t(11,a=C.onOk),"onClose"in C&&t(2,l=C.onClose),"cancelText"in C&&t(3,d=C.cancelText),"okText"in C&&t(4,u=C.okText),"theme"in C&&t(5,f=C.theme),"title"in C&&t(6,h=C.title)},[n,s,l,d,u,f,h,w,y,g,r,a,m]}class wt extends be{constructor(e){super(),De(this,e,Ct,ft,Se,{data:0,columns:1,onCancel:10,onOk:11,onClose:2,cancelText:3,okText:4,theme:5,title:6})}}class mt{constructor(){o(this,"modalInstance",{current:null});o(this,"open",e=>new Promise((t,n)=>{this.modalInstance.current=new wt({target:document.body,props:B(E({},e),{onCancel:s=>{n({code:-1,msg:s})},onOk:s=>{t(s)},onClose:()=>{this.close()}})})}));o(this,"close",()=>{setTimeout(()=>{var e;(e=this.modalInstance.current)==null||e.$destroy()})})}}const Y=new mt;function Et(i=32,e=!0,t=0){const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),s=[];if(t=t||n.length,i)for(let r=0;r<i;r++)s[r]=n[0|Math.random()*t];else{let r;s[8]=s[13]=s[18]=s[23]="-",s[14]="4";for(let a=0;a<36;a++)s[a]||(r=0|Math.random()*16,s[a]=n[a===19?r&3|8:r])}return e?(s.shift(),`u${s.join("")}`):s.join("")}const St=[{key:"CN"},{format:i=>`${i.DevClass}(${i.sn})`}],It=[{key:"SealId"},{key:"Vid"},{format:i=>`${i.FileName}(${i.FileSize}B)`}],Me=[{key:"SealId"}],kt=[{key:"manu"},{key:"sn"}];class vt{constructor(e){o(this,"socketInstance",null);o(this,"eventBus",new Ke);o(this,"scene");o(this,"isRememberPin",!1);o(this,"pinPolicy");o(this,"socketConfig",null);o(this,"isConnecting",!1);o(this,"messageQueue",[]);o(this,"getSocketReadyState",()=>{var e;return(e=this.socketInstance)==null?void 0:e.readyState});o(this,"destroy",()=>{var e;(e=this.socketInstance)==null||e.close()});o(this,"sendMessage",(e,t,n)=>new Promise((s,r)=>{var l;const a=()=>{var h,w;if(((h=this.socketInstance)==null?void 0:h.readyState)!==WebSocket.OPEN){r({errCode:Ve,msg:"数字证书客户端连接失败"});return}const d=Et(),u=y=>{y.success?s(y.data):r(y)},f={function:e,args:t?[t]:[],msgid:d};(w=this.socketInstance)==null||w.send(JSON.stringify(f)),this.eventBus.on(e,u),this.eventBus.on(d,u)};if(n&&(this.scene&n)!==n){r({errCode:Ze,msg:"无权限执行此操作"});return}if(((l=this.socketInstance)==null?void 0:l.readyState)===WebSocket.OPEN){a();return}this.messageQueue.push(a),this.isConnecting||this.initSocket(this.socketConfig)}));o(this,"flushMsgQueue",()=>{var e;(e=this.messageQueue)==null||e.forEach(t=>t()),this.messageQueue=[]});o(this,"handleEventData",e=>c(this,null,function*(){var t,n,s,r,a,l,d,u;if(e.data instanceof Blob){const f=yield e.data.arrayBuffer(),y=new TextDecoder(navigator.userAgent.includes("Windows")?"gbk":"utf-8").decode(f).replace(/\\(?!(["\\\/bfnrtu]))/g,""),g=JSON.parse(y),m={success:(t=g.result)==null?void 0:t.success,msg:(n=g.result)==null?void 0:n.msg,errCode:(s=g.result)==null?void 0:s.errCode,data:g.data,type:(r=g.result)==null?void 0:r.event},C=(a=g.result)==null?void 0:a.function,S=(l=g.result)==null?void 0:l.msgid;S?this.eventBus.emit(S,m):this.eventBus.emit(C,m),(u=(d=this.socketConfig)==null?void 0:d.onMessage)==null||u.call(d,m)}}));o(this,"base64Encode",e=>{const t=new TextEncoder().encode(e);return Ce.fromByteArray(t)});o(this,"base64Decode",e=>{const t=Ce.toByteArray(e);return new TextDecoder().decode(t)});o(this,"changeIsRememberPin",e=>c(this,null,function*(){this.isRememberPin=e}));o(this,"changePinPolicy",e=>c(this,null,function*(){this.pinPolicy=e}));o(this,"checkCertIsLogin",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_IsLogin",e)}));o(this,"addUkeyEvents",()=>c(this,null,function*(){this.sendMessage("GZCA_WaitForDevEvent",{Type:Ge}),this.eventBus.on("GZCA_OnDeviceChange",e=>{var t,n,s;(s=(t=this.socketConfig)==null?void 0:t.onUkeyChange)==null||s.call(t,B(E({},e),{data:(n=e.data)==null?void 0:n[0]}))})}));o(this,"certLogin",e=>c(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}))}));o(this,"verifyPin",e=>c(this,null,function*(){var t;yield this.sendMessage("GZCA_Login",{ContainerName:e.ContainerName,IsLogin:e.UserPin?"Y":"N",UserPin:(t=e.UserPin)!=null?t:"123456",PinPolicy:this.pinPolicy})}));o(this,"getCert",(e,t,n)=>c(this,null,function*(){const s=t!=null?t:yield this.chooseCert(e);return this.isRememberPin&&n&&(yield this.certLogin(s.ContainerName)),s}));o(this,"chooseCert",e=>c(this,null,function*(){var s;const t=yield this.getCertList(e);return t!=null&&t.length?(t==null?void 0:t.length)===1?t[0]:yield Y.open({title:"选择证书",data:t,columns:St,theme:(s=this.socketConfig)==null?void 0:s.theme}):Promise.reject({errCode:Fe,msg:"暂无证书"})}));o(this,"getCertList",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetCertList",e)}));o(this,"pkcs1Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignData",E({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"pkcs1Base64Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",E({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"batchPkcs1Base64Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_BatchPkcs1SignDataEx",E({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"pkcs1VerifySignature",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySign",e)}));o(this,"pkcs1Base64VerifySignature",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignEx",e)}));o(this,"getSealList",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_EnumSeals",E({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));o(this,"writeSeal",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_WriteSeal",E({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));o(this,"deleteSeal",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_DeleteSeal",E({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));o(this,"getSealInfo",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ReadSeal",E({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));o(this,"getTPSealList",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetSealPicList",E({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));o(this,"getTPSealPic",e=>c(this,null,function*(){var n;return yield this.sendMessage("GZCA_GetSealPicData",E({IsLogin:(n=e.IsLogin)!=null?n:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));o(this,"sm2SignPreprocess1",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep1",e)}));o(this,"sm2SignPreprocess2",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep2",e)}));o(this,"pkcs1HashSign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataForHash",E({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"pkcs1HashVerifySignature",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignForHash",e)}));o(this,"pkcs7Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7SignData",E({IsLogin:this.getIsLogin(),IsAuthAttr:"Y",PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"pkcs7VerifySignature",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7VerifySign",e)}));o(this,"sm3Hash",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_HashData",e)}));o(this,"sm3HexHash",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_HashDataEx",e)}));o(this,"sm3FileHash",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_HashFile",e)}));o(this,"sm3HashEncryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_HMac",e)}));o(this,"pkcs7Encryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7EncryptData",e)}));o(this,"pkcs7Decryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7DecryptData",E({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"pkcs7FileEncryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_EnvelopeSealFileEx_qyzc",e)}));o(this,"pkcs7FileDecryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_EnvelopeOpenFileEx_qyzc",E({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"asymmetricEncryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_AsymEncryptData",e)}));o(this,"asymmetricDecryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_AsymDecryptData",E({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"sm4Encryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_EncryptDataEx",e)}));o(this,"sm4Decryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_DecryptDataEx",e)}));o(this,"getCertInfo",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfo",e)}));o(this,"getCertInfoByOid",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfoByOid",e)}));o(this,"getSealVendor",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetSealIssuer",e,I.LEVEL_2)}));o(this,"deleteAllSealByVendor",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ClearSeal",E({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));o(this,"applyCert",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ApplyCert",{manu:e.manu,sn:e.sn,keyid:e.ContainerName,type:e.type,url:e.url},I.LEVEL_3)}));o(this,"resetPin",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_UnblockUserPin",E({},e!=null?e:{}),I.LEVEL_3)}));o(this,"getUKeyList",()=>c(this,null,function*(){return yield this.sendMessage("GetUKeyList",void 0,I.LEVEL_3)}));o(this,"getUKeyInfo",e=>c(this,null,function*(){return yield this.sendMessage("GetUKeyID",e!=null?e:{},I.LEVEL_3)}));var t,n,s;this.socketConfig=e,this.initSocket(e),this.isRememberPin=(t=e.isRememberPin)!=null?t:!1,this.scene=(n=e.scene)!=null?n:H.OPEN,this.pinPolicy=(s=e.pinPolicy)!=null?s:T.MIN}initSocket(e){this.isConnecting=!0;const t=new WebSocket(e.url);t.onerror=n=>{var s;this.isConnecting=!1,(s=e.onError)==null||s.call(e,n),this.flushMsgQueue()},t.onopen=n=>{var s;this.isConnecting=!1,(s=e.onOpen)==null||s.call(e,n),e.onUkeyChange&&this.addUkeyEvents(),this.flushMsgQueue()},t.onmessage=n=>{this.handleEventData(n)},t.onclose=n=>{var s;this.isConnecting=!1,(s=e.onClose)==null||s.call(e,n)},this.socketInstance=t}getIsLogin(){return this.isRememberPin?"Y":"N"}}const Z=class Z{constructor(e){o(this,"coreInstance",null);o(this,"gwsConfig",{});o(this,"createGwsCore",e=>{this.gwsConfig=e!=null?e:{},this.coreInstance=new vt(B(E({},e!=null?e:{}),{url:k}))});o(this,"appendCertBase64",(e,t=!0)=>c(this,null,function*(){if(e.CertB64)return e;const n=t?yield this.getSignatureCert():yield this.getEncryptionCert();return B(E({},e!=null?e:{}),{CertB64:n==null?void 0:n.CertB64})}));o(this,"destroy",()=>{var e;(e=this.coreInstance)==null||e.destroy(),this.coreInstance=null});o(this,"restart",e=>{this.coreInstance&&this.destroy(),this.gwsConfig=e!=null?e:this.gwsConfig,this.createGwsCore(e)});o(this,"getSocketReadyState",()=>{var e;return(e=this.coreInstance)==null?void 0:e.getSocketReadyState()});o(this,"verifyPin",(e,t)=>c(this,null,function*(){var s,r;const n=yield this.getSignatureCert(t);return(r=this.coreInstance)==null?void 0:r.verifyPin({ContainerName:(s=n==null?void 0:n.ContainerName)!=null?s:"",UserPin:e==null?void 0:e.UserPin})}));o(this,"getSignatureCert",(e,t=!0)=>c(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:L},e,t)}));o(this,"getSignatureCertList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:L})}));o(this,"getEncryptionCert",(e,t=!0)=>c(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:Q},e,t)}));o(this,"getEncryptionCertList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:Q})}));o(this,"base64Encode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Encode(e.Data)});o(this,"base64Decode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Decode(e.DataB64)});o(this,"changeIsRememberPin",e=>{var t;(t=this.coreInstance)==null||t.changeIsRememberPin(e)});o(this,"changePinPolicy",e=>{var t;(t=this.coreInstance)==null||t.changePinPolicy(e)});o(this,"pkcs1Sign",(e,t)=>c(this,null,function*(){var r,a,l;const n=yield this.getSignatureCert(t),s=yield(a=this.coreInstance)==null?void 0:a.pkcs1Sign(B(E({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""}));return(l=s==null?void 0:s[0])==null?void 0:l.SignData}));o(this,"pkcs1VerifySignature",e=>c(this,null,function*(){var s;const t=yield this.appendCertBase64(e),n=yield(s=this.coreInstance)==null?void 0:s.pkcs1VerifySignature(t);return Array.isArray(n)}));o(this,"pkcs1Base64Sign",(e,t)=>c(this,null,function*(){var a,l,d,u,f;const n=yield this.getSignatureCert(t),s=(l=e.DataB64)!=null?l:this.base64Encode({Data:(a=e.Data)!=null?a:""}),r=yield(u=this.coreInstance)==null?void 0:u.pkcs1Base64Sign(B(E({},e!=null?e:{}),{ContainerName:(d=n==null?void 0:n.ContainerName)!=null?d:"",DataB64:s}));return(f=r==null?void 0:r[0])==null?void 0:f.SignData}));o(this,"batchPkcs1Base64Sign",(e,t)=>c(this,null,function*(){var f,h,w,y,g,m;const n="|",s=(h=e.DataB64)!=null?h:(f=e.Data)==null?void 0:f.map(C=>this.base64Encode({Data:C})),r=yield this.getSignatureCert(t);let a="";a=Array.isArray(s)?s==null?void 0:s.map((C,S)=>`${S}:${C}`).join(n):"";const l=yield(y=this.coreInstance)==null?void 0:y.batchPkcs1Base64Sign({ContainerName:(w=r==null?void 0:r.ContainerName)!=null?w:"",DataB64:a}),d=(m=(g=l==null?void 0:l[0])==null?void 0:g.SignData)==null?void 0:m.split(n),u=[];return d.forEach(C=>{const S=C.split(":"),p=Number(S[0]),P=S[1];u[p]=P}),u}));o(this,"pkcs1Base64VerifySignature",e=>c(this,null,function*(){var r,a,l;const t=(a=e.DataB64)!=null?a:this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=yield this.appendCertBase64(e);return!!(yield(l=this.coreInstance)==null?void 0:l.pkcs1Base64VerifySignature({CertB64:n.CertB64,DataB64:t,SignData:n.SignData}))}));o(this,"writeSeal",(e,t)=>c(this,null,function*(){var r,a;const n=yield this.getSignatureCert(t);return!!(yield(a=this.coreInstance)==null?void 0:a.writeSeal(B(E({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));o(this,"deleteSeal",e=>c(this,null,function*(){var a,l,d,u,f;const t=yield this.getSealList(e);if(!((a=t==null?void 0:t.data)!=null&&a.length))return Promise.reject({errCode:ae,msg:"暂无印章"});const n=yield Y.open({title:"删除印章",data:t==null?void 0:t.data,columns:Me,okText:"删除"}),s=(l=n==null?void 0:n.SealId)!=null?l:"";return!!(yield(f=this.coreInstance)==null?void 0:f.deleteSeal({ContainerName:(u=(d=t==null?void 0:t.cert)==null?void 0:d.ContainerName)!=null?u:"",SealId:s}))}));o(this,"deleteSealById",(e,t)=>c(this,null,function*(){var r,a;const n=yield this.getSignatureCert(t);return!!(yield(a=this.coreInstance)==null?void 0:a.deleteSeal(B(E({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));o(this,"getSealList",e=>c(this,null,function*(){var s,r;const t=yield this.getSignatureCert(e),n=yield(r=this.coreInstance)==null?void 0:r.getSealList({ContainerName:(s=t==null?void 0:t.ContainerName)!=null?s:"",IsLogin:"Y"});return{cert:t,data:n}}));o(this,"getSealInfo",e=>c(this,null,function*(){var r,a,l,d,u,f,h;const t=yield this.getSealList(e);if(!((r=t==null?void 0:t.data)!=null&&r.length))return Promise.reject({errCode:ae,msg:"暂无印章"});const n=((a=t==null?void 0:t.data)==null?void 0:a.length)>1?yield Y.open({title:"选择印章",data:t==null?void 0:t.data,columns:Me,theme:(l=this.gwsConfig)==null?void 0:l.theme}):t==null?void 0:t.data[0],s=yield(h=this.coreInstance)==null?void 0:h.getSealInfo({ContainerName:(u=(d=t==null?void 0:t.cert)==null?void 0:d.ContainerName)!=null?u:"",SealId:(f=n==null?void 0:n.SealId)!=null?f:""});return s==null?void 0:s[0]}));o(this,"getTPSealList",(e,t)=>c(this,null,function*(){var r,a;const n=yield this.getSignatureCert(t),s=yield(a=this.coreInstance)==null?void 0:a.getTPSealList({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:"",Vid:e==null?void 0:e.Vid});return{cert:n,data:s}}));o(this,"getTPSeal",(e,t)=>c(this,null,function*(){var r,a,l;const n=yield this.getTPSealList(e,t);if(!((r=n==null?void 0:n.data)!=null&&r.length))return Promise.reject({errCode:ae,msg:"暂无印章"});const s=((a=n==null?void 0:n.data)==null?void 0:a.length)===1?n==null?void 0:n.data[0]:yield Y.open({title:"选择印章",data:n==null?void 0:n.data,columns:It,theme:(l=this.gwsConfig)==null?void 0:l.theme});return{cert:n==null?void 0:n.cert,data:s}}));o(this,"getTPSealPic",(e,t)=>c(this,null,function*(){var r,a,l,d,u;const n=yield this.getTPSeal(e,t),s=yield(u=this.coreInstance)==null?void 0:u.getTPSealPic(B(E({ContainerName:(a=(r=n==null?void 0:n.cert)==null?void 0:r.ContainerName)!=null?a:""},(l=n==null?void 0:n.data)!=null?l:{}),{FileSize:String((d=n==null?void 0:n.data)==null?void 0:d.FileSize)}));return s==null?void 0:s[0]}));o(this,"sm2SignPreprocess1",e=>c(this,null,function*(){var s,r;const t=yield this.appendCertBase64(e),n=yield(s=this.coreInstance)==null?void 0:s.sm2SignPreprocess1(t);return(r=n==null?void 0:n[0])==null?void 0:r.Z}));o(this,"sm2SignPreprocess2",e=>c(this,null,function*(){var r,a;const t=this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=yield this.appendCertBase64(e),s=yield(a=this.coreInstance)==null?void 0:a.sm2SignPreprocess2({CertB64:n.CertB64,DataB64:t});return s==null?void 0:s[0].H}));o(this,"pkcs1HashSign",(e,t)=>c(this,null,function*(){var r,a,l,d;const n=yield this.getSignatureCert(t),s=yield(l=this.coreInstance)==null?void 0:l.pkcs1HashSign({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:"",DataB64:e.DataB64,HashAlg:(a=e.HashAlg)!=null?a:"sm3"});return(d=s==null?void 0:s[0])==null?void 0:d.SignData}));o(this,"pkcs1HashVerifySignature",e=>c(this,null,function*(){var s,r;const t=yield this.appendCertBase64(e);return!!(yield(r=this.coreInstance)==null?void 0:r.pkcs1HashVerifySignature(B(E({},t),{HashAlg:(s=t.HashAlg)!=null?s:"sm3"})))}));o(this,"pkcs7Sign",(e,t)=>c(this,null,function*(){var a,l,d,u,f;const n=(l=e.DataB64)!=null?l:this.base64Encode({Data:(a=e.Data)!=null?a:""}),s=yield this.getSignatureCert(t),r=yield(u=this.coreInstance)==null?void 0:u.pkcs7Sign(B(E({},e!=null?e:{}),{ContainerName:(d=s==null?void 0:s.ContainerName)!=null?d:"",DataB64:n}));return(f=r==null?void 0:r[0])==null?void 0:f.SignData}));o(this,"pkcs7VerifySignature",e=>c(this,null,function*(){var s,r,a;const t=(r=e.DataB64)!=null?r:this.base64Encode({Data:(s=e.Data)!=null?s:""});return!!(yield(a=this.coreInstance)==null?void 0:a.pkcs7VerifySignature({DataB64:t,SignData:e.SignData}))}));o(this,"sm3Hash",e=>c(this,null,function*(){var n,s;const t=yield(n=this.coreInstance)==null?void 0:n.sm3Hash(e);return(s=t==null?void 0:t[0])==null?void 0:s.HashB64}));o(this,"sm3HexHash",e=>c(this,null,function*(){var n,s;const t=yield(n=this.coreInstance)==null?void 0:n.sm3HexHash(e);return(s=t==null?void 0:t[0])==null?void 0:s.HashB64}));o(this,"sm3FileHash",e=>c(this,null,function*(){var n,s;const t=yield(n=this.coreInstance)==null?void 0:n.sm3FileHash(e);return(s=t==null?void 0:t[0])==null?void 0:s.HashB64}));o(this,"sm3HashEncryption",e=>c(this,null,function*(){var r,a,l,d,u,f;const t=(a=e.DataB64)!=null?a:this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=(d=e.KeyB64)!=null?d:this.base64Encode({Data:(l=e.Key)!=null?l:""}),s=yield(u=this.coreInstance)==null?void 0:u.sm3HashEncryption({dataB64:t,keyB64:n,alg:"sm3"});return(f=s==null?void 0:s[0])==null?void 0:f.DataB64}));o(this,"pkcs7Encryption",e=>c(this,null,function*(){var s,r,a,l;if(!e.CertB64List){const d=yield this.getEncryptionCert();e.CertB64List=d==null?void 0:d.CertB64}const t=(r=e.DataB64)!=null?r:this.base64Encode({Data:(s=e.Data)!=null?s:""}),n=yield(a=this.coreInstance)==null?void 0:a.pkcs7Encryption({DataB64:t,CertB64List:e.CertB64List});return(l=n==null?void 0:n[0])==null?void 0:l.DataB64}));o(this,"pkcs7Decryption",e=>c(this,null,function*(){var r,a;const t=yield this.getEncryptionCert(),n=yield(r=this.coreInstance)==null?void 0:r.pkcs7Decryption(B(E({},e!=null?e:{}),{ContainerName:t==null?void 0:t.ContainerName})),s=(a=n==null?void 0:n[0])==null?void 0:a.DataB64;return e.shouldDecodeBase64?this.base64Decode({DataB64:s}):s}));o(this,"pkcs7FileEncryption",e=>c(this,null,function*(){var s,r;const t=yield this.appendCertBase64(e,!1),n=yield(s=this.coreInstance)==null?void 0:s.pkcs7FileEncryption(t);return(r=n==null?void 0:n[0])==null?void 0:r.DataB64}));o(this,"pkcs7FileDecryption",e=>c(this,null,function*(){var s,r,a;const t=yield this.getEncryptionCert(),n=yield(r=this.coreInstance)==null?void 0:r.pkcs7FileDecryption({SrcFile:e.SrcFile,DstFile:(s=e.DstFile)!=null?s:e.SrcFile.slice(0,-4),ContainerName:t==null?void 0:t.ContainerName});return(a=n==null?void 0:n[0])==null?void 0:a.DataB64}));o(this,"asymmetricEncryption",e=>c(this,null,function*(){var s,r;const t=yield this.appendCertBase64(e,!1),n=yield(s=this.coreInstance)==null?void 0:s.asymmetricEncryption(t);return(r=n==null?void 0:n[0])==null?void 0:r.Data}));o(this,"asymmetricDecryption",(e,t)=>c(this,null,function*(){var r,a;const n=yield this.getEncryptionCert(t),s=yield(r=this.coreInstance)==null?void 0:r.asymmetricDecryption(B(E({},e!=null?e:{}),{ContainerName:n==null?void 0:n.ContainerName}));return(a=s==null?void 0:s[0])==null?void 0:a.Data}));o(this,"sm4Encryption",e=>c(this,null,function*(){var n;const t=yield(n=this.coreInstance)==null?void 0:n.sm4Encryption(e);return t==null?void 0:t[0]}));o(this,"sm4Decryption",e=>c(this,null,function*(){var n,s;const t=yield(n=this.coreInstance)==null?void 0:n.sm4Decryption(e);return(s=t==null?void 0:t[0])==null?void 0:s.Data}));o(this,"getCertInfo",e=>c(this,null,function*(){var s,r,a,l,d;const t=yield(s=this.coreInstance)==null?void 0:s.getCertInfo(e),n=(r=t==null?void 0:t[0])!=null?r:{};for(let u=0;u<ye.length;u++){const f=ye[u];try{const h=yield(a=this.coreInstance)==null?void 0:a.getCertInfoByOid({Oid:f.oid,CertB64:e.CertB64});n[f.key]=(d=(l=h==null?void 0:h[0])==null?void 0:l.OidValue)==null?void 0:d.replace(".","")}catch(h){n[f.key]=null}}return n!=null&&n.idCardNo?n!=null&&n.CertSubject.includes("O=")||n.orgCode?n.certCate=ie:n.certCate=J:n.certCate=re,n}));o(this,"getCertInfoByOid",e=>c(this,null,function*(){var n,s;const t=yield(n=this.coreInstance)==null?void 0:n.getCertInfoByOid(E({},e!=null?e:{}));return(s=t==null?void 0:t[0])==null?void 0:s.OidValue}));o(this,"getSealVendor",e=>c(this,null,function*(){var s;const t=yield this.getSignatureCert(e),n=yield(s=this.coreInstance)==null?void 0:s.getSealVendor({ContainerName:t==null?void 0:t.ContainerName});return n==null?void 0:n[0]}));o(this,"deleteAllSealByVendor",(e,t)=>c(this,null,function*(){var r;const n=yield this.getSignatureCert(t),s=yield(r=this.coreInstance)==null?void 0:r.deleteAllSealByVendor(B(E({},e!=null?e:{}),{ContainerName:n==null?void 0:n.ContainerName}));return s==null?void 0:s[0]}));o(this,"getUKey",e=>c(this,null,function*(){var s;if(e)return e;const t=yield(s=this.coreInstance)==null?void 0:s.getUKeyList();return yield Y.open({title:"选择介质",data:t,columns:kt})}));o(this,"getUKeyInfo",e=>c(this,null,function*(){var s;const t=yield this.getUKey(e),n=yield(s=this.coreInstance)==null?void 0:s.getUKeyInfo({manu:t==null?void 0:t.manu,sn:t==null?void 0:t.sn});return n==null?void 0:n[0]}));o(this,"applyCert",(e,t)=>c(this,null,function*(){var a;const n=yield this.getUKey(t),s=yield this.getUKeyInfo(n);return yield(a=this.coreInstance)==null?void 0:a.applyCert(B(E({},e!=null?e:{}),{manu:s==null?void 0:s.manu,sn:s==null?void 0:s.sn,ContainerName:s==null?void 0:s.keyid}))}));o(this,"resetPin",(e,t)=>c(this,null,function*(){var r;const n=yield this.getSignatureCert(t);return yield(r=this.coreInstance)==null?void 0:r.resetPin(B(E({},e!=null?e:{}),{manu:n==null?void 0:n.manu,sn:n==null?void 0:n.sn,ContainerName:n==null?void 0:n.ContainerName}))}));return Z.instance&&!(e!=null&&e.isCreateNew)?Z.instance:(this.createGwsCore(e),Z.instance=this,this)}};o(Z,"instance",null);let V=Z;function pt(i){return new Promise((e,t)=>{if(V.instance&&!(i!=null&&i.isCreateNew))e(V.instance);else{const n=new V(B(E({},i!=null?i:{}),{onOpen(s){var r;e(n),(r=i==null?void 0:i.onOpen)==null||r.call(i,s)},onClose(s){var r;t(s),(r=i==null?void 0:i.onClose)==null||r.call(i,s)}}))}})}_.GwsService=V,_.createService=pt,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gws-client",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "type": "module",
5
5
  "module": "dist/index.es.js",
6
6
  "main": "dist/index.cjs.js",