gws-client 1.3.1 → 1.3.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 +1 -1
- package/dist/index.es.js +97 -103
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
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,Oe=Object.prototype.propertyIsEnumerable;var Y=(i,e,t)=>e in i?Ne(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,S=(i,e)=>{for(var t in e||(e={}))Te.call(e,t)&&Y(i,t,e[t]);if(re)for(var t of re(e))Oe.call(e,t)&&Y(i,t,e[t]);return i},v=(i,e)=>xe(i,$e(e));var a=(i,e,t)=>Y(i,typeof e!="symbol"?e+"":e,t);var c=(i,e,t)=>new Promise((n,s)=>{var r=h=>{try{l(t.next(h))}catch(u){s(u)}},o=h=>{try{l(t.throw(h))}catch(u){s(u)}},l=h=>h.done?n(h.value):Promise.resolve(h.value).then(r,o);l((t=t.apply(i,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Me=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",oe="1",ae="2",Ge="1",Fe="2",Ve="3";var ke=(i=>(i.MIN="0",i.LOW="1",i.MIDDLE="2",i.HIGH="3",i))(ke||{});const L={LEVEL_1:1,LEVEL_2:2,LEVEL_3:4},Ze={OPEN:L.LEVEL_1,INTERNAL:L.LEVEL_2|L.LEVEL_1,OMP:L.LEVEL_3|L.LEVEL_2|L.LEVEL_1},He="00000001",q="NO_SEAL_AVAILABLE",Ue="CERTIFICATE_NOT_FOUND",je="CLIENT_CONNECTION_FAILED",Re="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 Ke(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var G={},le;function ze(){if(le)return G;le=1,G.byteLength=l,G.toByteArray=u,G.fromByteArray=C;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(y){var f=y.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=y.indexOf("=");E===-1&&(E=f);var w=E===f?0:4-E%4;return[E,w]}function l(y){var f=o(y),E=f[0],w=f[1];return(E+w)*3/4-w}function h(y,f,E){return(f+E)*3/4-E}function u(y){var f,E=o(y),w=E[0],m=E[1],I=new t(h(y,w,m)),_=0,B=m>0?w-4:w,k;for(k=0;k<B;k+=4)f=e[y.charCodeAt(k)]<<18|e[y.charCodeAt(k+1)]<<12|e[y.charCodeAt(k+2)]<<6|e[y.charCodeAt(k+3)],I[_++]=f>>16&255,I[_++]=f>>8&255,I[_++]=f&255;return m===2&&(f=e[y.charCodeAt(k)]<<2|e[y.charCodeAt(k+1)]>>4,I[_++]=f&255),m===1&&(f=e[y.charCodeAt(k)]<<10|e[y.charCodeAt(k+1)]<<4|e[y.charCodeAt(k+2)]>>2,I[_++]=f>>8&255,I[_++]=f&255),I}function g(y){return i[y>>18&63]+i[y>>12&63]+i[y>>6&63]+i[y&63]}function d(y,f,E){for(var w,m=[],I=f;I<E;I+=3)w=(y[I]<<16&16711680)+(y[I+1]<<8&65280)+(y[I+2]&255),m.push(g(w));return m.join("")}function C(y){for(var f,E=y.length,w=E%3,m=[],I=16383,_=0,B=E-w;_<B;_+=I)m.push(d(y,_,_+I>B?B:_+I));return w===1?(f=y[E-1],m.push(i[f>>2]+i[f<<4&63]+"==")):w===2&&(f=(y[E-2]<<8)+y[E-1],m.push(i[f>>10]+i[f>>4&63]+i[f<<2&63]+"=")),m.join("")}return G}var Je=ze();const ue=Ke(Je);class We{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 Qe=Object.defineProperty,Ye=(i,e,t)=>e in i?Qe(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,he=(i,e,t)=>Ye(i,typeof e!="symbol"?e+"":e,t);function ee(){}function qe(i,e){for(const t in e)i[t]=e[t];return i}function Ie(i){return i()}function de(){return Object.create(null)}function U(i){i.forEach(Ie)}function Z(i){return typeof i=="function"}function ve(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Xe(i){return Object.keys(i).length===0}function et(i,e,t,n){if(i){const s=Le(i,e,t,n);return i[0](s)}}function Le(i,e,t,n){return i[1]&&n?qe(t.ctx.slice(),i[1](n(e))):t.ctx}function tt(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 nt(i,e,t,n,s,r){if(s){const o=Le(e,t,n,r);i.p(o,s)}}function st(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 ge(i){return i==null?"":i}function p(i,e){i.appendChild(e)}function Q(i,e,t){i.insertBefore(e,t||null)}function j(i){i.parentNode&&i.parentNode.removeChild(i)}function _e(i,e){for(let t=0;t<i.length;t+=1)i[t]&&i[t].d(e)}function P(i){return document.createElement(i)}function T(i){return document.createTextNode(i)}function R(){return T(" ")}function it(){return T("")}function F(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function A(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function rt(i){return Array.from(i.childNodes)}function K(i,e){e=""+e,i.data!==e&&(i.data=e)}function J(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,"")}let se;function H(i){se=i}const x=[],ye=[];let O=[];const Ce=[],ot=Promise.resolve();let te=!1;function at(){te||(te=!0,ot.then(pe))}function ne(i){O.push(i)}const X=new Set;let N=0;function pe(){if(N!==0)return;const i=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<O.length;e+=1){const t=O[e];X.has(t)||(X.add(t),t())}O.length=0}while(x.length);for(;Ce.length;)Ce.pop()();te=!1,X.clear(),H(i)}function ct(i){if(i.fragment!==null){i.update(),U(i.before_update);const e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(ne)}}function lt(i){const e=[],t=[];O.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),O=e}const z=new Set;let ut;function ie(i,e){i&&i.i&&(z.delete(i),i.i(e))}function De(i,e,t,n){if(i&&i.o){if(z.has(i))return;z.add(i),ut.c.push(()=>{z.delete(i)}),i.o(e)}}function W(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function ht(i){i&&i.c()}function Ae(i,e,t){const{fragment:n,after_update:s}=i.$$;n&&n.m(e,t),ne(()=>{const r=i.$$.on_mount.map(Ie).filter(Z);i.$$.on_destroy?i.$$.on_destroy.push(...r):U(r),i.$$.on_mount=[]}),s.forEach(ne)}function Be(i,e){const t=i.$$;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 dt(i,e){i.$$.dirty[0]===-1&&(x.push(i),at(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function Pe(i,e,t,n,s,r,o=null,l=[-1]){const h=se;H(i);const u=i.$$={fragment:null,ctx:[],props:r,update:ee,not_equal:s,bound:de(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(h?h.$$.context:[])),callbacks:de(),dirty:l,skip_bound:!1,root:e.target||h.$$.root};o&&o(u.root);let g=!1;if(u.ctx=t?t(i,e.props||{},(d,C,...y)=>{const f=y.length?y[0]:C;return u.ctx&&s(u.ctx[d],u.ctx[d]=f)&&(!u.skip_bound&&u.bound[d]&&u.bound[d](f),g&&dt(i,d)),C}):[],u.update(),g=!0,U(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const d=rt(e.target);u.fragment&&u.fragment.l(d),d.forEach(j)}else u.fragment&&u.fragment.c();e.intro&&ie(i.$$.fragment),Ae(i,e.target,e.anchor),pe()}H(h)}class be{constructor(){he(this,"$$"),he(this,"$$set")}$destroy(){Be(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 s=n.indexOf(t);s!==-1&&n.splice(s,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(i){let e,t,n,s=(i[1]||"标题")+"",r,o,l,h,u,g,d=(i[4]||"取消")+"",C,y,f,E=(i[5]||"确认")+"",w,m,I,_;const B=i[8].default,k=et(B,i,i[7],null);return{c(){e=P("div"),t=P("div"),n=P("div"),r=T(s),o=R(),l=P("div"),k&&k.c(),h=R(),u=P("div"),g=P("button"),C=T(d),y=R(),f=P("button"),w=T(E),A(n,"class","model-title svelte-16iv9d0"),A(l,"class","slot svelte-16iv9d0"),A(g,"class","modal-btn svelte-16iv9d0"),A(f,"class","modal-btn success svelte-16iv9d0"),J(f,"background-color",i[6]),A(u,"class","modal-footer svelte-16iv9d0"),A(t,"class","modal-content svelte-16iv9d0"),A(e,"class","modal-background modal-visible svelte-16iv9d0")},m(D,b){Q(D,e,b),p(e,t),p(t,n),p(n,r),p(t,o),p(t,l),k&&k.m(l,null),p(t,h),p(t,u),p(u,g),p(g,C),p(u,y),p(u,f),p(f,w),m=!0,I||(_=[F(g,"click",function(){Z(i[0])&&i[0].apply(this,arguments)}),F(f,"click",function(){Z(i[2])&&i[2].apply(this,arguments)}),F(t,"click",Ct),F(e,"click",function(){Z(i[3])&&i[3].apply(this,arguments)})],I=!0)},p(D,[b]){i=D,(!m||b&2)&&s!==(s=(i[1]||"标题")+"")&&K(r,s),k&&k.p&&(!m||b&128)&&nt(k,B,i,i[7],m?tt(B,i[7],b,null):st(i[7]),null),(!m||b&16)&&d!==(d=(i[4]||"取消")+"")&&K(C,d),(!m||b&32)&&E!==(E=(i[5]||"确认")+"")&&K(w,E),(!m||b&64)&&J(f,"background-color",i[6])},i(D){m||(ie(k,D),m=!0)},o(D){De(k,D),m=!1},d(D){D&&j(e),k&&k.d(D),I=!1,U(_)}}}const Ct=i=>i.stopPropagation();function ft(i,e,t){let{$$slots:n={},$$scope:s}=e,{onCancel:r}=e,{title:o}=e,{onOk:l}=e,{onClose:h}=e,{cancelText:u}=e,{okText:g}=e,{theme:d}=e;return i.$$set=C=>{"onCancel"in C&&t(0,r=C.onCancel),"title"in C&&t(1,o=C.title),"onOk"in C&&t(2,l=C.onOk),"onClose"in C&&t(3,h=C.onClose),"cancelText"in C&&t(4,u=C.cancelText),"okText"in C&&t(5,g=C.okText),"theme"in C&&t(6,d=C.theme),"$$scope"in C&&t(7,s=C.$$scope)},[r,o,l,h,u,g,d,s,n]}class wt extends be{constructor(e){super(),Pe(this,e,ft,yt,ve,{onCancel:0,title:1,onOk:2,onClose:3,cancelText:4,okText:5,theme:6})}}function fe(i,e,t){const n=i.slice();return n[13]=e[t],n[15]=t,n}function we(i,e,t){const n=i.slice();return n[16]=e[t],n}function Se(i){let e,t=(i[16].format?i[16].format(i[13]):i[13][i[16].key])+"",n;return{c(){e=P("div"),n=T(t),A(e,"class","svelte-1kh75ag"),J(e,"width",`${100/i[1].length}%`)},m(s,r){Q(s,e,r),p(e,n)},p(s,r){r&3&&t!==(t=(s[16].format?s[16].format(s[13]):s[13][s[16].key])+"")&&K(n,t),r&2&&J(e,"width",`${100/s[1].length}%`)},d(s){s&&j(e)}}}function Ee(i){let e,t,n,s,r,o=W(i[1]),l=[];for(let u=0;u<o.length;u+=1)l[u]=Se(we(i,o,u));function h(){return i[12](i[15])}return{c(){e=P("div");for(let u=0;u<l.length;u+=1)l[u].c();t=R(),A(e,"class",n=ge(`cert-item ${i[15]===0?"cert-item-first":""} ${i[15]===i[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")},m(u,g){Q(u,e,g);for(let d=0;d<l.length;d+=1)l[d]&&l[d].m(e,null);p(e,t),s||(r=F(e,"click",h),s=!0)},p(u,g){if(i=u,g&3){o=W(i[1]);let d;for(d=0;d<o.length;d+=1){const C=we(i,o,d);l[d]?l[d].p(C,g):(l[d]=Se(C),l[d].c(),l[d].m(e,t))}for(;d<l.length;d+=1)l[d].d(1);l.length=o.length}g&128&&n!==(n=ge(`cert-item ${i[15]===0?"cert-item-first":""} ${i[15]===i[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")&&A(e,"class",n)},d(u){u&&j(e),_e(l,u),s=!1,r()}}}function St(i){let e,t=W(i[0]),n=[];for(let s=0;s<t.length;s+=1)n[s]=Ee(fe(i,t,s));return{c(){for(let s=0;s<n.length;s+=1)n[s].c();e=it()},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=W(s[0]);let o;for(o=0;o<t.length;o+=1){const l=fe(s,t,o);n[o]?n[o].p(l,r):(n[o]=Ee(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&&j(e),_e(n,s)}}}function Et(i){let e,t;return e=new wt({props:{onOk:i[9],onClose:i[2],onCancel:i[8],cancelText:i[3],okText:i[4],title:i[6],theme:i[5],$$slots:{default:[St]},$$scope:{ctx:i}}}),{c(){ht(e.$$.fragment)},m(n,s){Ae(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||(ie(e.$$.fragment,n),t=!0)},o(n){De(e.$$.fragment,n),t=!1},d(n){Be(e,n)}}}function mt(i,e,t){let{data:n=[]}=e,{columns:s=[]}=e,{onCancel:r}=e,{onOk:o}=e,{onClose:l}=e,{cancelText:h=""}=e,{okText:u=""}=e,{theme:g="#409eff"}=e,{title:d=""}=e,C=0;const y=()=>{r(`${d}失败`),l==null||l()},f=()=>{o==null||o(n[C]),l==null||l()},E=w=>t(7,C=w);return i.$$set=w=>{"data"in w&&t(0,n=w.data),"columns"in w&&t(1,s=w.columns),"onCancel"in w&&t(10,r=w.onCancel),"onOk"in w&&t(11,o=w.onOk),"onClose"in w&&t(2,l=w.onClose),"cancelText"in w&&t(3,h=w.cancelText),"okText"in w&&t(4,u=w.okText),"theme"in w&&t(5,g=w.theme),"title"in w&&t(6,d=w.title)},[n,s,l,h,u,g,d,C,y,f,r,o,E]}class kt extends be{constructor(e){super(),Pe(this,e,mt,Et,ve,{data:0,columns:1,onCancel:10,onOk:11,onClose:2,cancelText:3,okText:4,theme:5,title:6})}}class It{constructor(){a(this,"modalInstance",{current:null});a(this,"open",e=>new Promise((t,n)=>{this.modalInstance.current=new kt({target:document.body,props:v(S({},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 V=new It;function vt(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("")}function Lt(i){const e=new Uint8Array(i),t=new TextDecoder("gbk"),n=new TextDecoder("latin1").decode(e);try{const s=JSON.parse(n),r=o=>{if(typeof o=="string"){const l=new Uint8Array(o.length);for(let h=0;h<o.length;h++)l[h]=o.charCodeAt(h)&255;return t.decode(l)}if(Array.isArray(o))return o.map(r);if(o!==null&&typeof o=="object"){const l={},h=o;for(const u in o)if(Object.prototype.hasOwnProperty.call(h,u)){const g=r(u);l[g]=r(h[u])}return l}return o};return r(s)}catch(s){throw console.error("GBK JSON 修复流程失败:",s),s}}const _t=[{key:"CN"},{format:i=>`${i.DevClass}(${i.sn})`}],pt=[{key:"SealId"},{key:"Vid"},{format:i=>`${i.FileName}(${i.FileSize}B)`}],me=[{key:"SealId"}],Dt=[{key:"manu"},{key:"sn"}];class At{constructor(e){a(this,"socketInstance",null);a(this,"eventBus",new We);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 d,C;if(((d=this.socketInstance)==null?void 0:d.readyState)!==WebSocket.OPEN){r({errCode:je,msg:"数字证书客户端连接失败"});return}const h=vt(),u=y=>{y.success?s(y.data):r(y)},g={function:e,args:t?[t]:[],msgid:h};(C=this.socketInstance)==null||C.send(JSON.stringify(g)),this.eventBus.on(e,u),this.eventBus.on(h,u)};if(n&&(this.scene&n)!==n){r({errCode:Re,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,h,u;if(e.data instanceof Blob){const g=yield e.data.arrayBuffer(),C=navigator.userAgent.includes("Windows")?Lt(g):JSON.parse(new TextDecoder().decode(g)),y={success:(t=C.result)==null?void 0:t.success,msg:(n=C.result)==null?void 0:n.msg,errCode:(s=C.result)==null?void 0:s.errCode,data:C.data,type:(r=C.result)==null?void 0:r.event},f=(o=C.result)==null?void 0:o.function,E=(l=C.result)==null?void 0:l.msgid;E?this.eventBus.emit(E,y):this.eventBus.emit(f,y),(u=(h=this.socketConfig)==null?void 0:h.onMessage)==null||u.call(h,y)}}));a(this,"base64Encode",e=>{const t=new TextEncoder().encode(e);return ue.fromByteArray(t)});a(this,"base64Decode",e=>{const t=ue.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:He}),this.eventBus.on("GZCA_OnDeviceChange",e=>{var t,n,s;(s=(t=this.socketConfig)==null?void 0:t.onUkeyChange)==null||s.call(t,v(S({},e),{data:(n=e.data)==null?void 0:n[0]}))})}));a(this,"ensureCertLogin",e=>c(this,null,function*(){const t=yield this.checkCertIsLogin({ContainerName:e.ContainerName});t!=null&&t[0].isLogin||(yield this.sendMessage("GZCA_Login",{ContainerName:e.ContainerName,IsLogin:"N",UserPin:"123456",PinPolicy:this.pinPolicy}))}));a(this,"verifyPin",e=>c(this,null,function*(){var t;console.log("params2",e),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.ensureCertLogin({ContainerName: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 V.open({title:"选择证书",data:t,columns:_t,theme:(s=this.socketConfig)==null?void 0:s.theme}):Promise.reject({errCode:Ue,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",S({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"pkcs1Base64Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",S({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"batchPkcs1Base64Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_BatchPkcs1SignDataEx",S({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",S({IsLogin:this.getIsLogin()},e!=null?e:{}),L.LEVEL_2)}));a(this,"writeSeal",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_WriteSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}),L.LEVEL_2)}));a(this,"deleteSeal",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_DeleteSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}),L.LEVEL_2)}));a(this,"getSealInfo",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ReadSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}),L.LEVEL_2)}));a(this,"getTPSealList",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetSealPicList",S({IsLogin:this.getIsLogin()},e!=null?e:{}),L.LEVEL_2)}));a(this,"getTPSealPic",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetSealPicData",S({IsLogin:this.getIsLogin()},e!=null?e:{}),L.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",S({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",S({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",S({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",S({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",S({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,L.LEVEL_2)}));a(this,"deleteAllSealByVendor",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ClearSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}),L.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},L.LEVEL_3)}));a(this,"resetPin",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_UnblockUserPin",S({},e!=null?e:{}),L.LEVEL_3)}));a(this,"getUKeyList",()=>c(this,null,function*(){return yield this.sendMessage("GetUKeyList",void 0,L.LEVEL_3)}));a(this,"getUKeyInfo",e=>c(this,null,function*(){return yield this.sendMessage("GetUKeyID",e!=null?e:{},L.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:Ze.OPEN,this.pinPolicy=(s=e.pinPolicy)!=null?s:ke.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 $=class ${constructor(e){a(this,"coreInstance",null);a(this,"gwsConfig",{});a(this,"createGwsCore",e=>{this.gwsConfig=e!=null?e:{},this.coreInstance=new At(v(S({},e!=null?e:{}),{url:Me}))});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 v(S({},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,"ensureCertLogin",e=>c(this,null,function*(){var s,r;const t=yield this.getSignatureCert(e);return yield(r=this.coreInstance)==null?void 0:r.ensureCertLogin({ContainerName:(s=t==null?void 0:t.ContainerName)!=null?s:""})}));a(this,"getSignatureCert",(e,t=!0)=>c(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:oe},e,t)}));a(this,"getSignatureCertList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:oe})}));a(this,"getEncryptionCert",(e,t=!0)=>c(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:ae},e,t)}));a(this,"getEncryptionCertList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:ae})}));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(v(S({},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,h,u,g;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(v(S({},e!=null?e:{}),{ContainerName:(h=n==null?void 0:n.ContainerName)!=null?h:"",DataB64:s}));return(g=r==null?void 0:r[0])==null?void 0:g.SignData}));a(this,"batchPkcs1Base64Sign",(e,t)=>c(this,null,function*(){var g,d,C,y,f,E;const n="|",s=(d=e.DataB64)!=null?d:(g=e.Data)==null?void 0:g.map(w=>this.base64Encode({Data:w})),r=yield this.getSignatureCert(t);let o="";o=Array.isArray(s)?s==null?void 0:s.map((w,m)=>`${m}:${w}`).join(n):"";const l=yield(y=this.coreInstance)==null?void 0:y.batchPkcs1Base64Sign({ContainerName:(C=r==null?void 0:r.ContainerName)!=null?C:"",DataB64:o}),h=(E=(f=l==null?void 0:l[0])==null?void 0:f.SignData)==null?void 0:E.split(n),u=[];return h.forEach(w=>{const m=w.split(":"),I=Number(m[0]),_=m[1];u[I]=_}),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(v(S({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));a(this,"deleteSeal",(e,t)=>c(this,null,function*(){var h,u,g;const n=yield this.getSignatureCert(t),s=yield this.getSealList(e,n);if(!(s!=null&&s.length))return Promise.reject({errCode:q,msg:"暂无印章"});const r=yield V.open({title:"删除印章",data:s,columns:me,okText:"删除"}),o=(h=r==null?void 0:r.SealId)!=null?h:"";return!!(yield(g=this.coreInstance)==null?void 0:g.deleteSeal(S({ContainerName:(u=n==null?void 0:n.ContainerName)!=null?u:"",SealId:o},e!=null?e:{})))}));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(v(S({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));a(this,"getSealList",(e,t)=>c(this,null,function*(){var r,o;const n=yield this.getSignatureCert(t);return yield(o=this.coreInstance)==null?void 0:o.getSealList(S({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""},e!=null?e:{}))}));a(this,"getSealInfo",(e,t)=>c(this,null,function*(){var l,h,u,g;const n=yield this.getSignatureCert(t),s=yield this.getSealList(e,n);if(!(s!=null&&s.length))return Promise.reject({errCode:q,msg:"暂无印章"});const r=(s==null?void 0:s.length)>1?yield V.open({title:"选择印章",data:s,columns:me,theme:(l=this.gwsConfig)==null?void 0:l.theme}):s==null?void 0:s[0],o=yield(g=this.coreInstance)==null?void 0:g.getSealInfo({ContainerName:(h=n==null?void 0:n.ContainerName)!=null?h:"",SealId:(u=r==null?void 0:r.SealId)!=null?u:""});return o==null?void 0:o[0]}));a(this,"getTPSealList",(e,t)=>c(this,null,function*(){var r,o;const n=yield this.getSignatureCert(t);return yield(o=this.coreInstance)==null?void 0:o.getTPSealList(S({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""},e!=null?e:{}))}));a(this,"getTPSeal",(e,t)=>c(this,null,function*(){var r;const n=yield this.getTPSealList(e,t);return n!=null&&n.length?(n==null?void 0:n.length)===1?n==null?void 0:n[0]:yield V.open({title:"选择印章",data:n,columns:pt,theme:(r=this.gwsConfig)==null?void 0:r.theme}):Promise.reject({errCode:q,msg:"暂无印章"})}));a(this,"getTPSealPic",(e,t,n)=>c(this,null,function*(){var l,h;const s=yield this.getSignatureCert(t),r=n||(yield this.getTPSeal(e,t)),o=yield(h=this.coreInstance)==null?void 0:h.getTPSealPic(v(S(S({ContainerName:(l=s==null?void 0:s.ContainerName)!=null?l:""},r!=null?r:{}),e!=null?e:{}),{FileSize:String(r==null?void 0:r.FileSize)}));return o==null?void 0:o[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,h;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(h=s==null?void 0:s[0])==null?void 0:h.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(v(S({},t),{HashAlg:(s=t.HashAlg)!=null?s:"sm3"})))}));a(this,"pkcs7Sign",(e,t)=>c(this,null,function*(){var o,l,h,u,g;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(v(S({},e!=null?e:{}),{ContainerName:(h=s==null?void 0:s.ContainerName)!=null?h:"",DataB64:n}));return(g=r==null?void 0:r[0])==null?void 0:g.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,h,u,g;const t=(o=e.DataB64)!=null?o:this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=(h=e.KeyB64)!=null?h: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(g=s==null?void 0:s[0])==null?void 0:g.DataB64}));a(this,"pkcs7Encryption",e=>c(this,null,function*(){var s,r,o,l;if(!e.CertB64List){const h=yield this.getEncryptionCert();e.CertB64List=h==null?void 0:h.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(v(S({},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(v(S({},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,h;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<ce.length;u++){const g=ce[u];try{const d=yield(o=this.coreInstance)==null?void 0:o.getCertInfoByOid({Oid:g.oid,CertB64:e.CertB64});n[g.key]=(h=(l=d==null?void 0:d[0])==null?void 0:l.OidValue)==null?void 0:h.replace(/\./g,"")}catch(d){n[g.key]=null}}return n!=null&&n.idCardNo?n!=null&&n.CertSubject.includes("O=")||n.orgCode?n.certCate=Fe:n.certCate=Ge:n.certCate=Ve,n}));a(this,"getCertInfoByOid",e=>c(this,null,function*(){var n,s;const t=yield(n=this.coreInstance)==null?void 0:n.getCertInfoByOid(S({},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(v(S({},e!=null?e:{}),{ContainerName:n==null?void 0:n.ContainerName}));return s==null?void 0:s[0]}));a(this,"getUKey",e=>c(this,null,function*(){var s,r;if(e)return e;const t=yield(s=this.coreInstance)==null?void 0:s.getUKeyList();return yield V.open({title:"选择介质",data:t,columns:Dt,theme:(r=this.gwsConfig)==null?void 0:r.theme})}));a(this,"getUKeyList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getUKeyList()}));a(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]}));a(this,"applyCert",(e,t)=>c(this,null,function*(){var o;const n=yield this.getUKey(t),s=yield this.getUKeyInfo(n);return yield(o=this.coreInstance)==null?void 0:o.applyCert(v(S({},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(v(S({},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)}};a($,"instance",null);let M=$;function Bt(i){return new Promise((e,t)=>{if(M.instance&&!(i!=null&&i.isCreateNew))e(M.instance);else{const n=new M(v(S({},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)}}))}})}exports.GwsService=M;exports.createService=Bt;
|
|
1
|
+
"use strict";var Ne=Object.defineProperty,xe=Object.defineProperties;var $e=Object.getOwnPropertyDescriptors;var re=Object.getOwnPropertySymbols;var Te=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable;var Y=(i,e,t)=>e in i?Ne(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,S=(i,e)=>{for(var t in e||(e={}))Te.call(e,t)&&Y(i,t,e[t]);if(re)for(var t of re(e))Oe.call(e,t)&&Y(i,t,e[t]);return i},v=(i,e)=>xe(i,$e(e));var a=(i,e,t)=>Y(i,typeof e!="symbol"?e+"":e,t);var c=(i,e,t)=>new Promise((n,s)=>{var r=h=>{try{l(t.next(h))}catch(u){s(u)}},o=h=>{try{l(t.throw(h))}catch(u){s(u)}},l=h=>h.done?n(h.value):Promise.resolve(h.value).then(r,o);l((t=t.apply(i,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Me=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",oe="1",ae="2",Ge="1",Fe="2",Ve="3";var ke=(i=>(i.MIN="0",i.LOW="1",i.MIDDLE="2",i.HIGH="3",i))(ke||{});const L={LEVEL_1:1,LEVEL_2:2,LEVEL_3:4},Ze={OPEN:L.LEVEL_1,INTERNAL:L.LEVEL_2|L.LEVEL_1,OMP:L.LEVEL_3|L.LEVEL_2|L.LEVEL_1},He="00000001",q="NO_SEAL_AVAILABLE",Ue="CERTIFICATE_NOT_FOUND",je="CLIENT_CONNECTION_FAILED",Re="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 Ke(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var G={},le;function ze(){if(le)return G;le=1,G.byteLength=l,G.toByteArray=u,G.fromByteArray=C;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(y){var f=y.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=y.indexOf("=");E===-1&&(E=f);var w=E===f?0:4-E%4;return[E,w]}function l(y){var f=o(y),E=f[0],w=f[1];return(E+w)*3/4-w}function h(y,f,E){return(f+E)*3/4-E}function u(y){var f,E=o(y),w=E[0],m=E[1],I=new t(h(y,w,m)),_=0,B=m>0?w-4:w,k;for(k=0;k<B;k+=4)f=e[y.charCodeAt(k)]<<18|e[y.charCodeAt(k+1)]<<12|e[y.charCodeAt(k+2)]<<6|e[y.charCodeAt(k+3)],I[_++]=f>>16&255,I[_++]=f>>8&255,I[_++]=f&255;return m===2&&(f=e[y.charCodeAt(k)]<<2|e[y.charCodeAt(k+1)]>>4,I[_++]=f&255),m===1&&(f=e[y.charCodeAt(k)]<<10|e[y.charCodeAt(k+1)]<<4|e[y.charCodeAt(k+2)]>>2,I[_++]=f>>8&255,I[_++]=f&255),I}function g(y){return i[y>>18&63]+i[y>>12&63]+i[y>>6&63]+i[y&63]}function d(y,f,E){for(var w,m=[],I=f;I<E;I+=3)w=(y[I]<<16&16711680)+(y[I+1]<<8&65280)+(y[I+2]&255),m.push(g(w));return m.join("")}function C(y){for(var f,E=y.length,w=E%3,m=[],I=16383,_=0,B=E-w;_<B;_+=I)m.push(d(y,_,_+I>B?B:_+I));return w===1?(f=y[E-1],m.push(i[f>>2]+i[f<<4&63]+"==")):w===2&&(f=(y[E-2]<<8)+y[E-1],m.push(i[f>>10]+i[f>>4&63]+i[f<<2&63]+"=")),m.join("")}return G}var Je=ze();const ue=Ke(Je);class We{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 Qe=Object.defineProperty,Ye=(i,e,t)=>e in i?Qe(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,he=(i,e,t)=>Ye(i,typeof e!="symbol"?e+"":e,t);function ee(){}function qe(i,e){for(const t in e)i[t]=e[t];return i}function Ie(i){return i()}function de(){return Object.create(null)}function Z(i){i.forEach(Ie)}function z(i){return typeof i=="function"}function ve(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Xe(i){return Object.keys(i).length===0}function et(i,e,t,n){if(i){const s=Le(i,e,t,n);return i[0](s)}}function Le(i,e,t,n){return i[1]&&n?qe(t.ctx.slice(),i[1](n(e))):t.ctx}function tt(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 nt(i,e,t,n,s,r){if(s){const o=Le(e,t,n,r);i.p(o,s)}}function st(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 ge(i){return i==null?"":i}function D(i,e){i.appendChild(e)}function Q(i,e,t){i.insertBefore(e,t||null)}function H(i){i.parentNode&&i.parentNode.removeChild(i)}function _e(i,e){for(let t=0;t<i.length;t+=1)i[t]&&i[t].d(e)}function P(i){return document.createElement(i)}function T(i){return document.createTextNode(i)}function U(){return T(" ")}function it(){return T("")}function j(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function A(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function rt(i){return Array.from(i.childNodes)}function R(i,e){e=""+e,i.data!==e&&(i.data=e)}function J(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,"")}let se;function V(i){se=i}const x=[],ye=[];let O=[];const Ce=[],ot=Promise.resolve();let te=!1;function at(){te||(te=!0,ot.then(De))}function ne(i){O.push(i)}const X=new Set;let N=0;function De(){if(N!==0)return;const i=se;do{try{for(;N<x.length;){const e=x[N];N++,V(e),ct(e.$$)}}catch(e){throw x.length=0,N=0,e}for(V(null),x.length=0,N=0;ye.length;)ye.pop()();for(let e=0;e<O.length;e+=1){const t=O[e];X.has(t)||(X.add(t),t())}O.length=0}while(x.length);for(;Ce.length;)Ce.pop()();te=!1,X.clear(),V(i)}function ct(i){if(i.fragment!==null){i.update(),Z(i.before_update);const e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(ne)}}function lt(i){const e=[],t=[];O.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),O=e}const K=new Set;let ut;function ie(i,e){i&&i.i&&(K.delete(i),i.i(e))}function pe(i,e,t,n){if(i&&i.o){if(K.has(i))return;K.add(i),ut.c.push(()=>{K.delete(i)}),i.o(e)}}function W(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function ht(i){i&&i.c()}function Ae(i,e,t){const{fragment:n,after_update:s}=i.$$;n&&n.m(e,t),ne(()=>{const r=i.$$.on_mount.map(Ie).filter(z);i.$$.on_destroy?i.$$.on_destroy.push(...r):Z(r),i.$$.on_mount=[]}),s.forEach(ne)}function Be(i,e){const t=i.$$;t.fragment!==null&&(lt(t.after_update),Z(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function dt(i,e){i.$$.dirty[0]===-1&&(x.push(i),at(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function Pe(i,e,t,n,s,r,o=null,l=[-1]){const h=se;V(i);const u=i.$$={fragment:null,ctx:[],props:r,update:ee,not_equal:s,bound:de(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(h?h.$$.context:[])),callbacks:de(),dirty:l,skip_bound:!1,root:e.target||h.$$.root};o&&o(u.root);let g=!1;if(u.ctx=t?t(i,e.props||{},(d,C,...y)=>{const f=y.length?y[0]:C;return u.ctx&&s(u.ctx[d],u.ctx[d]=f)&&(!u.skip_bound&&u.bound[d]&&u.bound[d](f),g&&dt(i,d)),C}):[],u.update(),g=!0,Z(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const d=rt(e.target);u.fragment&&u.fragment.l(d),d.forEach(H)}else u.fragment&&u.fragment.c();e.intro&&ie(i.$$.fragment),Ae(i,e.target,e.anchor),De()}V(h)}class be{constructor(){he(this,"$$"),he(this,"$$set")}$destroy(){Be(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 s=n.indexOf(t);s!==-1&&n.splice(s,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(i){let e,t,n,s=(i[1]||"标题")+"",r,o,l,h,u,g,d=(i[3]||"取消")+"",C,y,f,E=(i[4]||"确认")+"",w,m,I,_;const B=i[8].default,k=et(B,i,i[7],null);return{c(){e=P("div"),t=P("div"),n=P("div"),r=T(s),o=U(),l=P("div"),k&&k.c(),h=U(),u=P("div"),g=P("button"),C=T(d),y=U(),f=P("button"),w=T(E),A(n,"class","model-title svelte-16iv9d0"),A(l,"class","slot svelte-16iv9d0"),A(g,"class","modal-btn svelte-16iv9d0"),A(f,"class","modal-btn success svelte-16iv9d0"),J(f,"background-color",i[5]),A(u,"class","modal-footer svelte-16iv9d0"),A(t,"class","modal-content svelte-16iv9d0"),A(e,"class","modal-background modal-visible svelte-16iv9d0")},m(p,b){Q(p,e,b),D(e,t),D(t,n),D(n,r),D(t,o),D(t,l),k&&k.m(l,null),D(t,h),D(t,u),D(u,g),D(g,C),D(u,y),D(u,f),D(f,w),m=!0,I||(_=[j(g,"click",function(){z(i[0])&&i[0].apply(this,arguments)}),j(f,"click",function(){z(i[2])&&i[2].apply(this,arguments)}),j(t,"click",Ct)],I=!0)},p(p,[b]){i=p,(!m||b&2)&&s!==(s=(i[1]||"标题")+"")&&R(r,s),k&&k.p&&(!m||b&128)&&nt(k,B,i,i[7],m?tt(B,i[7],b,null):st(i[7]),null),(!m||b&8)&&d!==(d=(i[3]||"取消")+"")&&R(C,d),(!m||b&16)&&E!==(E=(i[4]||"确认")+"")&&R(w,E),(!m||b&32)&&J(f,"background-color",i[5])},i(p){m||(ie(k,p),m=!0)},o(p){pe(k,p),m=!1},d(p){p&&H(e),k&&k.d(p),I=!1,Z(_)}}}const Ct=i=>i.stopPropagation();function ft(i,e,t){let{$$slots:n={},$$scope:s}=e,{onCancel:r}=e,{title:o}=e,{onOk:l}=e,{onClose:h}=e,{cancelText:u}=e,{okText:g}=e,{theme:d}=e;return i.$$set=C=>{"onCancel"in C&&t(0,r=C.onCancel),"title"in C&&t(1,o=C.title),"onOk"in C&&t(2,l=C.onOk),"onClose"in C&&t(6,h=C.onClose),"cancelText"in C&&t(3,u=C.cancelText),"okText"in C&&t(4,g=C.okText),"theme"in C&&t(5,d=C.theme),"$$scope"in C&&t(7,s=C.$$scope)},[r,o,l,u,g,d,h,s,n]}class wt extends be{constructor(e){super(),Pe(this,e,ft,yt,ve,{onCancel:0,title:1,onOk:2,onClose:6,cancelText:3,okText:4,theme:5})}}function fe(i,e,t){const n=i.slice();return n[13]=e[t],n[15]=t,n}function we(i,e,t){const n=i.slice();return n[16]=e[t],n}function Se(i){let e,t=(i[16].format?i[16].format(i[13]):i[13][i[16].key])+"",n;return{c(){e=P("div"),n=T(t),A(e,"class","svelte-1kh75ag"),J(e,"width",`${100/i[1].length}%`)},m(s,r){Q(s,e,r),D(e,n)},p(s,r){r&3&&t!==(t=(s[16].format?s[16].format(s[13]):s[13][s[16].key])+"")&&R(n,t),r&2&&J(e,"width",`${100/s[1].length}%`)},d(s){s&&H(e)}}}function Ee(i){let e,t,n,s,r,o=W(i[1]),l=[];for(let u=0;u<o.length;u+=1)l[u]=Se(we(i,o,u));function h(){return i[12](i[15])}return{c(){e=P("div");for(let u=0;u<l.length;u+=1)l[u].c();t=U(),A(e,"class",n=ge(`cert-item ${i[15]===0?"cert-item-first":""} ${i[15]===i[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")},m(u,g){Q(u,e,g);for(let d=0;d<l.length;d+=1)l[d]&&l[d].m(e,null);D(e,t),s||(r=j(e,"click",h),s=!0)},p(u,g){if(i=u,g&3){o=W(i[1]);let d;for(d=0;d<o.length;d+=1){const C=we(i,o,d);l[d]?l[d].p(C,g):(l[d]=Se(C),l[d].c(),l[d].m(e,t))}for(;d<l.length;d+=1)l[d].d(1);l.length=o.length}g&128&&n!==(n=ge(`cert-item ${i[15]===0?"cert-item-first":""} ${i[15]===i[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")&&A(e,"class",n)},d(u){u&&H(e),_e(l,u),s=!1,r()}}}function St(i){let e,t=W(i[0]),n=[];for(let s=0;s<t.length;s+=1)n[s]=Ee(fe(i,t,s));return{c(){for(let s=0;s<n.length;s+=1)n[s].c();e=it()},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=W(s[0]);let o;for(o=0;o<t.length;o+=1){const l=fe(s,t,o);n[o]?n[o].p(l,r):(n[o]=Ee(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&&H(e),_e(n,s)}}}function Et(i){let e,t;return e=new wt({props:{onOk:i[9],onClose:i[2],onCancel:i[8],cancelText:i[3],okText:i[4],title:i[6],theme:i[5],$$slots:{default:[St]},$$scope:{ctx:i}}}),{c(){ht(e.$$.fragment)},m(n,s){Ae(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||(ie(e.$$.fragment,n),t=!0)},o(n){pe(e.$$.fragment,n),t=!1},d(n){Be(e,n)}}}function mt(i,e,t){let{data:n=[]}=e,{columns:s=[]}=e,{onCancel:r}=e,{onOk:o}=e,{onClose:l}=e,{cancelText:h=""}=e,{okText:u=""}=e,{theme:g="#409eff"}=e,{title:d=""}=e,C=0;const y=()=>{r(`${d}失败`),l==null||l()},f=()=>{o==null||o(n[C]),l==null||l()},E=w=>t(7,C=w);return i.$$set=w=>{"data"in w&&t(0,n=w.data),"columns"in w&&t(1,s=w.columns),"onCancel"in w&&t(10,r=w.onCancel),"onOk"in w&&t(11,o=w.onOk),"onClose"in w&&t(2,l=w.onClose),"cancelText"in w&&t(3,h=w.cancelText),"okText"in w&&t(4,u=w.okText),"theme"in w&&t(5,g=w.theme),"title"in w&&t(6,d=w.title)},[n,s,l,h,u,g,d,C,y,f,r,o,E]}class kt extends be{constructor(e){super(),Pe(this,e,mt,Et,ve,{data:0,columns:1,onCancel:10,onOk:11,onClose:2,cancelText:3,okText:4,theme:5,title:6})}}class It{constructor(){a(this,"modalInstance",{current:null});a(this,"open",e=>new Promise((t,n)=>{this.modalInstance.current=new kt({target:document.body,props:v(S({},e),{onCancel:s=>{n({code:"ON_CANCEL",msg:s})},onOk:s=>{t(s)},onClose:()=>{this.close()}})})}));a(this,"close",()=>{setTimeout(()=>{var e;(e=this.modalInstance.current)==null||e.$destroy()})})}}const F=new It;function vt(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("")}function Lt(i){const e=new Uint8Array(i),t=new TextDecoder("gbk"),n=new TextDecoder("latin1").decode(e);try{const s=JSON.parse(n),r=o=>{if(typeof o=="string"){const l=new Uint8Array(o.length);for(let h=0;h<o.length;h++)l[h]=o.charCodeAt(h)&255;return t.decode(l)}if(Array.isArray(o))return o.map(r);if(o!==null&&typeof o=="object"){const l={},h=o;for(const u in o)if(Object.prototype.hasOwnProperty.call(h,u)){const g=r(u);l[g]=r(h[u])}return l}return o};return r(s)}catch(s){throw console.error("GBK JSON 修复流程失败:",s),s}}const _t=[{key:"CN"},{format:i=>`${i.DevClass}(${i.sn})`}],Dt=[{key:"SealId"},{key:"Vid"},{format:i=>`${i.FileName}(${i.FileSize}B)`}],me=[{key:"SealId"}],pt=[{key:"manu"},{key:"sn"}];class At{constructor(e){a(this,"socketInstance",null);a(this,"eventBus",new We);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 d,C;if(((d=this.socketInstance)==null?void 0:d.readyState)!==WebSocket.OPEN){r({errCode:je,msg:"数字证书客户端连接失败"});return}const h=vt(),u=y=>{y.success?s(y.data):r(y)},g={function:e,args:t?[t]:[],msgid:h};(C=this.socketInstance)==null||C.send(JSON.stringify(g)),this.eventBus.on(e,u),this.eventBus.on(h,u)};if(n&&(this.scene&n)!==n){r({errCode:Re,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,h,u;if(e.data instanceof Blob){const g=yield e.data.arrayBuffer(),C=navigator.userAgent.includes("Windows")?Lt(g):JSON.parse(new TextDecoder().decode(g)),y={success:(t=C.result)==null?void 0:t.success,msg:(n=C.result)==null?void 0:n.msg,errCode:(s=C.result)==null?void 0:s.errCode,data:C.data,type:(r=C.result)==null?void 0:r.event},f=(o=C.result)==null?void 0:o.function,E=(l=C.result)==null?void 0:l.msgid;E?this.eventBus.emit(E,y):this.eventBus.emit(f,y),(u=(h=this.socketConfig)==null?void 0:h.onMessage)==null||u.call(h,y)}}));a(this,"base64Encode",e=>{const t=new TextEncoder().encode(e);return ue.fromByteArray(t)});a(this,"base64Decode",e=>{const t=ue.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:He}),this.eventBus.on("GZCA_OnDeviceChange",e=>{var t,n,s;(s=(t=this.socketConfig)==null?void 0:t.onUkeyChange)==null||s.call(t,v(S({},e),{data:(n=e.data)==null?void 0:n[0]}))})}));a(this,"ensureCertLogin",e=>c(this,null,function*(){const t=yield this.checkCertIsLogin({ContainerName:e.ContainerName});t!=null&&t[0].isLogin||(yield this.sendMessage("GZCA_Login",{ContainerName:e.ContainerName,IsLogin:"N",UserPin:"123456",PinPolicy:this.pinPolicy}))}));a(this,"verifyPin",e=>c(this,null,function*(){var t;console.log("params2",e),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.ensureCertLogin({ContainerName: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 F.open({title:"选择证书",data:t,columns:_t,theme:(s=this.socketConfig)==null?void 0:s.theme}):Promise.reject({errCode:Ue,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",S({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"pkcs1Base64Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",S({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"batchPkcs1Base64Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_BatchPkcs1SignDataEx",S({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",S({IsLogin:this.getIsLogin()},e!=null?e:{}),L.LEVEL_2)}));a(this,"writeSeal",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_WriteSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}),L.LEVEL_2)}));a(this,"deleteSeal",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_DeleteSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}),L.LEVEL_2)}));a(this,"getSealInfo",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ReadSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}),L.LEVEL_2)}));a(this,"getTPSealList",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetSealPicList",S({IsLogin:this.getIsLogin()},e!=null?e:{}),L.LEVEL_2)}));a(this,"getTPSealPic",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetSealPicData",S({IsLogin:this.getIsLogin()},e!=null?e:{}),L.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",S({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",S({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",S({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",S({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",S({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,L.LEVEL_2)}));a(this,"deleteAllSealByVendor",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ClearSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}),L.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},L.LEVEL_3)}));a(this,"resetPin",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_UnblockUserPin",S({},e!=null?e:{}),L.LEVEL_3)}));a(this,"getUKeyList",()=>c(this,null,function*(){return yield this.sendMessage("GetUKeyList",void 0,L.LEVEL_3)}));a(this,"getUKeyInfo",e=>c(this,null,function*(){return yield this.sendMessage("GetUKeyID",e!=null?e:{},L.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:Ze.OPEN,this.pinPolicy=(s=e.pinPolicy)!=null?s:ke.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 $=class ${constructor(e){a(this,"coreInstance",null);a(this,"gwsConfig",{});a(this,"createGwsCore",e=>{this.gwsConfig=e!=null?e:{},this.coreInstance=new At(v(S({},e!=null?e:{}),{url:Me}))});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 v(S({},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,"ensureCertLogin",e=>c(this,null,function*(){var s,r;const t=yield this.getSignatureCert(e);return yield(r=this.coreInstance)==null?void 0:r.ensureCertLogin({ContainerName:(s=t==null?void 0:t.ContainerName)!=null?s:""})}));a(this,"getSignatureCert",(e,t=!0)=>c(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:oe},e,t)}));a(this,"getSignatureCertList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:oe})}));a(this,"getEncryptionCert",(e,t=!0)=>c(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:ae},e,t)}));a(this,"getEncryptionCertList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:ae})}));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(v(S({},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,h,u,g;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(v(S({},e!=null?e:{}),{ContainerName:(h=n==null?void 0:n.ContainerName)!=null?h:"",DataB64:s}));return(g=r==null?void 0:r[0])==null?void 0:g.SignData}));a(this,"batchPkcs1Base64Sign",(e,t)=>c(this,null,function*(){var g,d,C,y,f,E;const n="|",s=(d=e.DataB64)!=null?d:(g=e.Data)==null?void 0:g.map(w=>this.base64Encode({Data:w})),r=yield this.getSignatureCert(t);let o="";o=Array.isArray(s)?s==null?void 0:s.map((w,m)=>`${m}:${w}`).join(n):"";const l=yield(y=this.coreInstance)==null?void 0:y.batchPkcs1Base64Sign({ContainerName:(C=r==null?void 0:r.ContainerName)!=null?C:"",DataB64:o}),h=(E=(f=l==null?void 0:l[0])==null?void 0:f.SignData)==null?void 0:E.split(n),u=[];return h.forEach(w=>{const m=w.split(":"),I=Number(m[0]),_=m[1];u[I]=_}),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(v(S({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));a(this,"deleteSeal",(e,t)=>c(this,null,function*(){var h,u,g;const n=yield this.getSignatureCert(t),s=yield this.getSealList(e,n);if(!(s!=null&&s.length))return Promise.reject({errCode:q,msg:"暂无印章"});const r=yield F.open({title:"删除印章",data:s,columns:me,okText:"删除"}),o=(h=r==null?void 0:r.SealId)!=null?h:"";return!!(yield(g=this.coreInstance)==null?void 0:g.deleteSeal(S({ContainerName:(u=n==null?void 0:n.ContainerName)!=null?u:"",SealId:o},e!=null?e:{})))}));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(v(S({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));a(this,"getSealList",(e,t)=>c(this,null,function*(){var r,o;const n=yield this.getSignatureCert(t);return yield(o=this.coreInstance)==null?void 0:o.getSealList(S({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""},e!=null?e:{}))}));a(this,"getSealInfo",(e,t)=>c(this,null,function*(){var l,h,u,g;const n=yield this.getSignatureCert(t),s=yield this.getSealList(e,n);if(!(s!=null&&s.length))return Promise.reject({errCode:q,msg:"暂无印章"});const r=(s==null?void 0:s.length)>1?yield F.open({title:"选择印章",data:s,columns:me,theme:(l=this.gwsConfig)==null?void 0:l.theme}):s==null?void 0:s[0],o=yield(g=this.coreInstance)==null?void 0:g.getSealInfo({ContainerName:(h=n==null?void 0:n.ContainerName)!=null?h:"",SealId:(u=r==null?void 0:r.SealId)!=null?u:""});return o==null?void 0:o[0]}));a(this,"getTPSealList",(e,t)=>c(this,null,function*(){var r,o;const n=yield this.getSignatureCert(t);return yield(o=this.coreInstance)==null?void 0:o.getTPSealList(S({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""},e!=null?e:{}))}));a(this,"getTPSeal",(e,t)=>c(this,null,function*(){var r;const n=yield this.getTPSealList(e,t);return n!=null&&n.length?(n==null?void 0:n.length)===1?n==null?void 0:n[0]:yield F.open({title:"选择印章",data:n,columns:Dt,theme:(r=this.gwsConfig)==null?void 0:r.theme}):Promise.reject({errCode:q,msg:"暂无印章"})}));a(this,"getTPSealPic",(e,t,n)=>c(this,null,function*(){var l,h;const s=yield this.getSignatureCert(t),r=n||(yield this.getTPSeal(e,t)),o=yield(h=this.coreInstance)==null?void 0:h.getTPSealPic(v(S(S({ContainerName:(l=s==null?void 0:s.ContainerName)!=null?l:""},r!=null?r:{}),e!=null?e:{}),{FileSize:String(r==null?void 0:r.FileSize)}));return o==null?void 0:o[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,h;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(h=s==null?void 0:s[0])==null?void 0:h.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(v(S({},t),{HashAlg:(s=t.HashAlg)!=null?s:"sm3"})))}));a(this,"pkcs7Sign",(e,t)=>c(this,null,function*(){var o,l,h,u,g;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(v(S({},e!=null?e:{}),{ContainerName:(h=s==null?void 0:s.ContainerName)!=null?h:"",DataB64:n}));return(g=r==null?void 0:r[0])==null?void 0:g.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,h,u,g;const t=(o=e.DataB64)!=null?o:this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=(h=e.KeyB64)!=null?h: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(g=s==null?void 0:s[0])==null?void 0:g.DataB64}));a(this,"pkcs7Encryption",e=>c(this,null,function*(){var s,r,o,l;if(!e.CertB64List){const h=yield this.getEncryptionCert();e.CertB64List=h==null?void 0:h.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(v(S({},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(v(S({},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,h;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<ce.length;u++){const g=ce[u];try{const d=yield(o=this.coreInstance)==null?void 0:o.getCertInfoByOid({Oid:g.oid,CertB64:e.CertB64});n[g.key]=(h=(l=d==null?void 0:d[0])==null?void 0:l.OidValue)==null?void 0:h.replace(/\./g,"")}catch(d){n[g.key]=null}}return n!=null&&n.idCardNo?n!=null&&n.CertSubject.includes("O=")||n.orgCode?n.certCate=Fe:n.certCate=Ge:n.certCate=Ve,n}));a(this,"getCertInfoByOid",e=>c(this,null,function*(){var n,s;const t=yield(n=this.coreInstance)==null?void 0:n.getCertInfoByOid(S({},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(v(S({},e!=null?e:{}),{ContainerName:n==null?void 0:n.ContainerName}));return s==null?void 0:s[0]}));a(this,"getUKey",e=>c(this,null,function*(){var s,r;if(e)return e;const t=yield(s=this.coreInstance)==null?void 0:s.getUKeyList();return yield F.open({title:"选择介质",data:t,columns:pt,theme:(r=this.gwsConfig)==null?void 0:r.theme})}));a(this,"getUKeyList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getUKeyList()}));a(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]}));a(this,"applyCert",(e,t)=>c(this,null,function*(){var o;const n=yield this.getUKey(t),s=yield this.getUKeyInfo(n);return yield(o=this.coreInstance)==null?void 0:o.applyCert(v(S({},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(v(S({},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)}};a($,"instance",null);let M=$;function Bt(i){return new Promise((e,t)=>{if(M.instance&&!(i!=null&&i.isCreateNew))e(M.instance);else{const n=new M(v(S({},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)}}))}})}exports.GwsService=M;exports.createService=Bt;
|
package/dist/index.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
1
|
+
var be = Object.defineProperty, xe = Object.defineProperties;
|
|
2
2
|
var $e = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var re = Object.getOwnPropertySymbols;
|
|
4
4
|
var Te = Object.prototype.hasOwnProperty, Oe = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var Y = (i, e, t) => e in i ?
|
|
5
|
+
var Y = (i, e, t) => e in i ? be(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, S = (i, e) => {
|
|
6
6
|
for (var t in e || (e = {}))
|
|
7
7
|
Te.call(e, t) && Y(i, t, e[t]);
|
|
8
8
|
if (re)
|
|
@@ -140,10 +140,10 @@ function Ie(i) {
|
|
|
140
140
|
function de() {
|
|
141
141
|
return /* @__PURE__ */ Object.create(null);
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function Z(i) {
|
|
144
144
|
i.forEach(Ie);
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function z(i) {
|
|
147
147
|
return typeof i == "function";
|
|
148
148
|
}
|
|
149
149
|
function ve(i, e) {
|
|
@@ -194,13 +194,13 @@ function st(i) {
|
|
|
194
194
|
function ge(i) {
|
|
195
195
|
return i == null ? "" : i;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function D(i, e) {
|
|
198
198
|
i.appendChild(e);
|
|
199
199
|
}
|
|
200
200
|
function Q(i, e, t) {
|
|
201
201
|
i.insertBefore(e, t || null);
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function H(i) {
|
|
204
204
|
i.parentNode && i.parentNode.removeChild(i);
|
|
205
205
|
}
|
|
206
206
|
function _e(i, e) {
|
|
@@ -213,13 +213,13 @@ function P(i) {
|
|
|
213
213
|
function T(i) {
|
|
214
214
|
return document.createTextNode(i);
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function U() {
|
|
217
217
|
return T(" ");
|
|
218
218
|
}
|
|
219
219
|
function it() {
|
|
220
220
|
return T("");
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function j(i, e, t, n) {
|
|
223
223
|
return i.addEventListener(e, t, n), () => i.removeEventListener(e, t, n);
|
|
224
224
|
}
|
|
225
225
|
function A(i, e, t) {
|
|
@@ -228,7 +228,7 @@ function A(i, e, t) {
|
|
|
228
228
|
function rt(i) {
|
|
229
229
|
return Array.from(i.childNodes);
|
|
230
230
|
}
|
|
231
|
-
function
|
|
231
|
+
function R(i, e) {
|
|
232
232
|
e = "" + e, i.data !== e && (i.data = /** @type {string} */
|
|
233
233
|
e);
|
|
234
234
|
}
|
|
@@ -236,7 +236,7 @@ function J(i, e, t, n) {
|
|
|
236
236
|
t == null ? i.style.removeProperty(e) : i.style.setProperty(e, t, "");
|
|
237
237
|
}
|
|
238
238
|
let se;
|
|
239
|
-
function
|
|
239
|
+
function F(i) {
|
|
240
240
|
se = i;
|
|
241
241
|
}
|
|
242
242
|
const x = [], ye = [];
|
|
@@ -244,27 +244,27 @@ let O = [];
|
|
|
244
244
|
const Ce = [], ot = /* @__PURE__ */ Promise.resolve();
|
|
245
245
|
let te = !1;
|
|
246
246
|
function at() {
|
|
247
|
-
te || (te = !0, ot.then(
|
|
247
|
+
te || (te = !0, ot.then(De));
|
|
248
248
|
}
|
|
249
249
|
function ne(i) {
|
|
250
250
|
O.push(i);
|
|
251
251
|
}
|
|
252
252
|
const X = /* @__PURE__ */ new Set();
|
|
253
|
-
let
|
|
254
|
-
function
|
|
255
|
-
if (
|
|
253
|
+
let b = 0;
|
|
254
|
+
function De() {
|
|
255
|
+
if (b !== 0)
|
|
256
256
|
return;
|
|
257
257
|
const i = se;
|
|
258
258
|
do {
|
|
259
259
|
try {
|
|
260
|
-
for (;
|
|
261
|
-
const e = x[
|
|
262
|
-
|
|
260
|
+
for (; b < x.length; ) {
|
|
261
|
+
const e = x[b];
|
|
262
|
+
b++, F(e), ct(e.$$);
|
|
263
263
|
}
|
|
264
264
|
} catch (e) {
|
|
265
|
-
throw x.length = 0,
|
|
265
|
+
throw x.length = 0, b = 0, e;
|
|
266
266
|
}
|
|
267
|
-
for (
|
|
267
|
+
for (F(null), x.length = 0, b = 0; ye.length; ) ye.pop()();
|
|
268
268
|
for (let e = 0; e < O.length; e += 1) {
|
|
269
269
|
const t = O[e];
|
|
270
270
|
X.has(t) || (X.add(t), t());
|
|
@@ -273,11 +273,11 @@ function pe() {
|
|
|
273
273
|
} while (x.length);
|
|
274
274
|
for (; Ce.length; )
|
|
275
275
|
Ce.pop()();
|
|
276
|
-
te = !1, X.clear(),
|
|
276
|
+
te = !1, X.clear(), F(i);
|
|
277
277
|
}
|
|
278
278
|
function ct(i) {
|
|
279
279
|
if (i.fragment !== null) {
|
|
280
|
-
i.update(),
|
|
280
|
+
i.update(), Z(i.before_update);
|
|
281
281
|
const e = i.dirty;
|
|
282
282
|
i.dirty = [-1], i.fragment && i.fragment.p(i.ctx, e), i.after_update.forEach(ne);
|
|
283
283
|
}
|
|
@@ -286,16 +286,16 @@ function lt(i) {
|
|
|
286
286
|
const e = [], t = [];
|
|
287
287
|
O.forEach((n) => i.indexOf(n) === -1 ? e.push(n) : t.push(n)), t.forEach((n) => n()), O = e;
|
|
288
288
|
}
|
|
289
|
-
const
|
|
289
|
+
const K = /* @__PURE__ */ new Set();
|
|
290
290
|
let ut;
|
|
291
291
|
function ie(i, e) {
|
|
292
|
-
i && i.i && (
|
|
292
|
+
i && i.i && (K.delete(i), i.i(e));
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function pe(i, e, t, n) {
|
|
295
295
|
if (i && i.o) {
|
|
296
|
-
if (
|
|
297
|
-
|
|
298
|
-
|
|
296
|
+
if (K.has(i)) return;
|
|
297
|
+
K.add(i), ut.c.push(() => {
|
|
298
|
+
K.delete(i);
|
|
299
299
|
}), i.o(e);
|
|
300
300
|
}
|
|
301
301
|
}
|
|
@@ -308,20 +308,20 @@ function ht(i) {
|
|
|
308
308
|
function Ae(i, e, t) {
|
|
309
309
|
const { fragment: n, after_update: s } = i.$$;
|
|
310
310
|
n && n.m(e, t), ne(() => {
|
|
311
|
-
const r = i.$$.on_mount.map(Ie).filter(
|
|
312
|
-
i.$$.on_destroy ? i.$$.on_destroy.push(...r) :
|
|
311
|
+
const r = i.$$.on_mount.map(Ie).filter(z);
|
|
312
|
+
i.$$.on_destroy ? i.$$.on_destroy.push(...r) : Z(r), i.$$.on_mount = [];
|
|
313
313
|
}), s.forEach(ne);
|
|
314
314
|
}
|
|
315
315
|
function Be(i, e) {
|
|
316
316
|
const t = i.$$;
|
|
317
|
-
t.fragment !== null && (lt(t.after_update),
|
|
317
|
+
t.fragment !== null && (lt(t.after_update), Z(t.on_destroy), t.fragment && t.fragment.d(e), t.on_destroy = t.fragment = null, t.ctx = []);
|
|
318
318
|
}
|
|
319
319
|
function dt(i, e) {
|
|
320
320
|
i.$$.dirty[0] === -1 && (x.push(i), at(), i.$$.dirty.fill(0)), i.$$.dirty[e / 31 | 0] |= 1 << e % 31;
|
|
321
321
|
}
|
|
322
322
|
function Pe(i, e, t, n, s, r, o = null, l = [-1]) {
|
|
323
323
|
const h = se;
|
|
324
|
-
|
|
324
|
+
F(i);
|
|
325
325
|
const u = i.$$ = {
|
|
326
326
|
fragment: null,
|
|
327
327
|
ctx: [],
|
|
@@ -348,17 +348,17 @@ function Pe(i, e, t, n, s, r, o = null, l = [-1]) {
|
|
|
348
348
|
if (u.ctx = t ? t(i, e.props || {}, (d, C, ...y) => {
|
|
349
349
|
const f = y.length ? y[0] : C;
|
|
350
350
|
return u.ctx && s(u.ctx[d], u.ctx[d] = f) && (!u.skip_bound && u.bound[d] && u.bound[d](f), g && dt(i, d)), C;
|
|
351
|
-
}) : [], u.update(), g = !0,
|
|
351
|
+
}) : [], u.update(), g = !0, Z(u.before_update), u.fragment = n ? n(u.ctx) : !1, e.target) {
|
|
352
352
|
if (e.hydrate) {
|
|
353
353
|
const d = rt(e.target);
|
|
354
|
-
u.fragment && u.fragment.l(d), d.forEach(
|
|
354
|
+
u.fragment && u.fragment.l(d), d.forEach(H);
|
|
355
355
|
} else
|
|
356
356
|
u.fragment && u.fragment.c();
|
|
357
|
-
e.intro && ie(i.$$.fragment), Ae(i, e.target, e.anchor),
|
|
357
|
+
e.intro && ie(i.$$.fragment), Ae(i, e.target, e.anchor), De();
|
|
358
358
|
}
|
|
359
|
-
|
|
359
|
+
F(h);
|
|
360
360
|
}
|
|
361
|
-
class
|
|
361
|
+
class Ne {
|
|
362
362
|
constructor() {
|
|
363
363
|
he(this, "$$"), he(this, "$$set");
|
|
364
364
|
}
|
|
@@ -373,7 +373,7 @@ class be {
|
|
|
373
373
|
* @returns {() => void}
|
|
374
374
|
*/
|
|
375
375
|
$on(e, t) {
|
|
376
|
-
if (!
|
|
376
|
+
if (!z(t))
|
|
377
377
|
return ee;
|
|
378
378
|
const n = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
|
|
379
379
|
return n.push(t), () => {
|
|
@@ -397,10 +397,10 @@ function yt(i) {
|
|
|
397
397
|
(i[1] || "标题") + ""
|
|
398
398
|
), r, o, l, h, u, g, d = (
|
|
399
399
|
/*cancelText*/
|
|
400
|
-
(i[
|
|
400
|
+
(i[3] || "取消") + ""
|
|
401
401
|
), C, y, f, E = (
|
|
402
402
|
/*okText*/
|
|
403
|
-
(i[
|
|
403
|
+
(i[4] || "确认") + ""
|
|
404
404
|
), w, m, I, _;
|
|
405
405
|
const B = (
|
|
406
406
|
/*#slots*/
|
|
@@ -414,40 +414,34 @@ function yt(i) {
|
|
|
414
414
|
);
|
|
415
415
|
return {
|
|
416
416
|
c() {
|
|
417
|
-
e = P("div"), t = P("div"), n = P("div"), r = T(s), o =
|
|
417
|
+
e = P("div"), t = P("div"), n = P("div"), r = T(s), o = U(), l = P("div"), k && k.c(), h = U(), u = P("div"), g = P("button"), C = T(d), y = U(), f = P("button"), w = T(E), A(n, "class", "model-title svelte-16iv9d0"), A(l, "class", "slot svelte-16iv9d0"), A(g, "class", "modal-btn svelte-16iv9d0"), A(f, "class", "modal-btn success svelte-16iv9d0"), J(
|
|
418
418
|
f,
|
|
419
419
|
"background-color",
|
|
420
420
|
/*theme*/
|
|
421
|
-
i[
|
|
421
|
+
i[5]
|
|
422
422
|
), A(u, "class", "modal-footer svelte-16iv9d0"), A(t, "class", "modal-content svelte-16iv9d0"), A(e, "class", "modal-background modal-visible svelte-16iv9d0");
|
|
423
423
|
},
|
|
424
|
-
m(
|
|
425
|
-
Q(
|
|
426
|
-
|
|
427
|
-
|
|
424
|
+
m(p, N) {
|
|
425
|
+
Q(p, e, N), D(e, t), D(t, n), D(n, r), D(t, o), D(t, l), k && k.m(l, null), D(t, h), D(t, u), D(u, g), D(g, C), D(u, y), D(u, f), D(f, w), m = !0, I || (_ = [
|
|
426
|
+
j(g, "click", function() {
|
|
427
|
+
z(
|
|
428
428
|
/*onCancel*/
|
|
429
429
|
i[0]
|
|
430
430
|
) && i[0].apply(this, arguments);
|
|
431
431
|
}),
|
|
432
|
-
|
|
433
|
-
|
|
432
|
+
j(f, "click", function() {
|
|
433
|
+
z(
|
|
434
434
|
/*onOk*/
|
|
435
435
|
i[2]
|
|
436
436
|
) && i[2].apply(this, arguments);
|
|
437
437
|
}),
|
|
438
|
-
|
|
439
|
-
G(e, "click", function() {
|
|
440
|
-
V(
|
|
441
|
-
/*onClose*/
|
|
442
|
-
i[3]
|
|
443
|
-
) && i[3].apply(this, arguments);
|
|
444
|
-
})
|
|
438
|
+
j(t, "click", Ct)
|
|
445
439
|
], I = !0);
|
|
446
440
|
},
|
|
447
|
-
p(
|
|
448
|
-
i =
|
|
441
|
+
p(p, [N]) {
|
|
442
|
+
i = p, (!m || N & /*title*/
|
|
449
443
|
2) && s !== (s = /*title*/
|
|
450
|
-
(i[1] || "标题") + "") &&
|
|
444
|
+
(i[1] || "标题") + "") && R(r, s), k && k.p && (!m || N & /*$$scope*/
|
|
451
445
|
128) && nt(
|
|
452
446
|
k,
|
|
453
447
|
B,
|
|
@@ -458,33 +452,33 @@ function yt(i) {
|
|
|
458
452
|
B,
|
|
459
453
|
/*$$scope*/
|
|
460
454
|
i[7],
|
|
461
|
-
|
|
455
|
+
N,
|
|
462
456
|
null
|
|
463
457
|
) : st(
|
|
464
458
|
/*$$scope*/
|
|
465
459
|
i[7]
|
|
466
460
|
),
|
|
467
461
|
null
|
|
468
|
-
), (!m ||
|
|
469
|
-
|
|
470
|
-
(i[
|
|
471
|
-
|
|
472
|
-
(i[
|
|
473
|
-
|
|
462
|
+
), (!m || N & /*cancelText*/
|
|
463
|
+
8) && d !== (d = /*cancelText*/
|
|
464
|
+
(i[3] || "取消") + "") && R(C, d), (!m || N & /*okText*/
|
|
465
|
+
16) && E !== (E = /*okText*/
|
|
466
|
+
(i[4] || "确认") + "") && R(w, E), (!m || N & /*theme*/
|
|
467
|
+
32) && J(
|
|
474
468
|
f,
|
|
475
469
|
"background-color",
|
|
476
470
|
/*theme*/
|
|
477
|
-
i[
|
|
471
|
+
i[5]
|
|
478
472
|
);
|
|
479
473
|
},
|
|
480
|
-
i(
|
|
481
|
-
m || (ie(k,
|
|
474
|
+
i(p) {
|
|
475
|
+
m || (ie(k, p), m = !0);
|
|
482
476
|
},
|
|
483
|
-
o(
|
|
484
|
-
|
|
477
|
+
o(p) {
|
|
478
|
+
pe(k, p), m = !1;
|
|
485
479
|
},
|
|
486
|
-
d(
|
|
487
|
-
|
|
480
|
+
d(p) {
|
|
481
|
+
p && H(e), k && k.d(p), I = !1, Z(_);
|
|
488
482
|
}
|
|
489
483
|
};
|
|
490
484
|
}
|
|
@@ -492,19 +486,19 @@ const Ct = (i) => i.stopPropagation();
|
|
|
492
486
|
function ft(i, e, t) {
|
|
493
487
|
let { $$slots: n = {}, $$scope: s } = e, { onCancel: r } = e, { title: o } = e, { onOk: l } = e, { onClose: h } = e, { cancelText: u } = e, { okText: g } = e, { theme: d } = e;
|
|
494
488
|
return i.$$set = (C) => {
|
|
495
|
-
"onCancel" in C && t(0, r = C.onCancel), "title" in C && t(1, o = C.title), "onOk" in C && t(2, l = C.onOk), "onClose" in C && t(
|
|
496
|
-
}, [r, o, l,
|
|
489
|
+
"onCancel" in C && t(0, r = C.onCancel), "title" in C && t(1, o = C.title), "onOk" in C && t(2, l = C.onOk), "onClose" in C && t(6, h = C.onClose), "cancelText" in C && t(3, u = C.cancelText), "okText" in C && t(4, g = C.okText), "theme" in C && t(5, d = C.theme), "$$scope" in C && t(7, s = C.$$scope);
|
|
490
|
+
}, [r, o, l, u, g, d, h, s, n];
|
|
497
491
|
}
|
|
498
|
-
class wt extends
|
|
492
|
+
class wt extends Ne {
|
|
499
493
|
constructor(e) {
|
|
500
494
|
super(), Pe(this, e, ft, yt, ve, {
|
|
501
495
|
onCancel: 0,
|
|
502
496
|
title: 1,
|
|
503
497
|
onOk: 2,
|
|
504
|
-
onClose:
|
|
505
|
-
cancelText:
|
|
506
|
-
okText:
|
|
507
|
-
theme:
|
|
498
|
+
onClose: 6,
|
|
499
|
+
cancelText: 3,
|
|
500
|
+
okText: 4,
|
|
501
|
+
theme: 5
|
|
508
502
|
});
|
|
509
503
|
}
|
|
510
504
|
}
|
|
@@ -539,7 +533,7 @@ function Se(i) {
|
|
|
539
533
|
i[1].length}%`);
|
|
540
534
|
},
|
|
541
535
|
m(s, r) {
|
|
542
|
-
Q(s, e, r),
|
|
536
|
+
Q(s, e, r), D(e, n);
|
|
543
537
|
},
|
|
544
538
|
p(s, r) {
|
|
545
539
|
r & /*columns, data*/
|
|
@@ -556,12 +550,12 @@ function Se(i) {
|
|
|
556
550
|
/*col*/
|
|
557
551
|
s[16].key
|
|
558
552
|
]
|
|
559
|
-
)) + "") &&
|
|
553
|
+
)) + "") && R(n, t), r & /*columns*/
|
|
560
554
|
2 && J(e, "width", `${100 / /*columns*/
|
|
561
555
|
s[1].length}%`);
|
|
562
556
|
},
|
|
563
557
|
d(s) {
|
|
564
|
-
s &&
|
|
558
|
+
s && H(e);
|
|
565
559
|
}
|
|
566
560
|
};
|
|
567
561
|
}
|
|
@@ -586,7 +580,7 @@ function Ee(i) {
|
|
|
586
580
|
e = P("div");
|
|
587
581
|
for (let u = 0; u < l.length; u += 1)
|
|
588
582
|
l[u].c();
|
|
589
|
-
t =
|
|
583
|
+
t = U(), A(e, "class", n = ge(`cert-item ${/*index*/
|
|
590
584
|
i[15] === 0 ? "cert-item-first" : ""} ${/*index*/
|
|
591
585
|
i[15] === /*selectedIndex*/
|
|
592
586
|
i[7] ? "cert-item-selected" : ""}`) + " svelte-1kh75ag");
|
|
@@ -595,7 +589,7 @@ function Ee(i) {
|
|
|
595
589
|
Q(u, e, g);
|
|
596
590
|
for (let d = 0; d < l.length; d += 1)
|
|
597
591
|
l[d] && l[d].m(e, null);
|
|
598
|
-
|
|
592
|
+
D(e, t), s || (r = j(e, "click", h), s = !0);
|
|
599
593
|
},
|
|
600
594
|
p(u, g) {
|
|
601
595
|
if (i = u, g & /*columns, data*/
|
|
@@ -620,7 +614,7 @@ function Ee(i) {
|
|
|
620
614
|
i[7] ? "cert-item-selected" : ""}`) + " svelte-1kh75ag") && A(e, "class", n);
|
|
621
615
|
},
|
|
622
616
|
d(u) {
|
|
623
|
-
u &&
|
|
617
|
+
u && H(e), _e(l, u), s = !1, r();
|
|
624
618
|
}
|
|
625
619
|
};
|
|
626
620
|
}
|
|
@@ -660,7 +654,7 @@ function St(i) {
|
|
|
660
654
|
}
|
|
661
655
|
},
|
|
662
656
|
d(s) {
|
|
663
|
-
s &&
|
|
657
|
+
s && H(e), _e(n, s);
|
|
664
658
|
}
|
|
665
659
|
};
|
|
666
660
|
}
|
|
@@ -725,7 +719,7 @@ function Et(i) {
|
|
|
725
719
|
t || (ie(e.$$.fragment, n), t = !0);
|
|
726
720
|
},
|
|
727
721
|
o(n) {
|
|
728
|
-
|
|
722
|
+
pe(e.$$.fragment, n), t = !1;
|
|
729
723
|
},
|
|
730
724
|
d(n) {
|
|
731
725
|
Be(e, n);
|
|
@@ -757,7 +751,7 @@ function mt(i, e, t) {
|
|
|
757
751
|
E
|
|
758
752
|
];
|
|
759
753
|
}
|
|
760
|
-
class kt extends
|
|
754
|
+
class kt extends Ne {
|
|
761
755
|
constructor(e) {
|
|
762
756
|
super(), Pe(this, e, mt, Et, ve, {
|
|
763
757
|
data: 0,
|
|
@@ -781,7 +775,7 @@ class It {
|
|
|
781
775
|
props: v(S({}, e), {
|
|
782
776
|
onCancel: (s) => {
|
|
783
777
|
n({
|
|
784
|
-
code:
|
|
778
|
+
code: "ON_CANCEL",
|
|
785
779
|
msg: s
|
|
786
780
|
});
|
|
787
781
|
},
|
|
@@ -802,7 +796,7 @@ class It {
|
|
|
802
796
|
});
|
|
803
797
|
}
|
|
804
798
|
}
|
|
805
|
-
const
|
|
799
|
+
const G = new It();
|
|
806
800
|
function vt(i = 32, e = !0, t = 0) {
|
|
807
801
|
const n = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""), s = [];
|
|
808
802
|
if (t = t || n.length, i)
|
|
@@ -850,7 +844,7 @@ const _t = [
|
|
|
850
844
|
{
|
|
851
845
|
format: (i) => `${i.DevClass}(${i.sn})`
|
|
852
846
|
}
|
|
853
|
-
],
|
|
847
|
+
], Dt = [
|
|
854
848
|
{
|
|
855
849
|
key: "SealId"
|
|
856
850
|
},
|
|
@@ -864,7 +858,7 @@ const _t = [
|
|
|
864
858
|
{
|
|
865
859
|
key: "SealId"
|
|
866
860
|
}
|
|
867
|
-
],
|
|
861
|
+
], pt = [
|
|
868
862
|
{
|
|
869
863
|
key: "manu"
|
|
870
864
|
},
|
|
@@ -999,7 +993,7 @@ class At {
|
|
|
999
993
|
a(this, "chooseCert", (e) => c(this, null, function* () {
|
|
1000
994
|
var s;
|
|
1001
995
|
const t = yield this.getCertList(e);
|
|
1002
|
-
return t != null && t.length ? (t == null ? void 0 : t.length) === 1 ? t[0] : yield
|
|
996
|
+
return t != null && t.length ? (t == null ? void 0 : t.length) === 1 ? t[0] : yield G.open({
|
|
1003
997
|
title: "选择证书",
|
|
1004
998
|
data: t,
|
|
1005
999
|
columns: _t,
|
|
@@ -1381,7 +1375,7 @@ const $ = class $ {
|
|
|
1381
1375
|
errCode: q,
|
|
1382
1376
|
msg: "暂无印章"
|
|
1383
1377
|
});
|
|
1384
|
-
const r = yield
|
|
1378
|
+
const r = yield G.open({
|
|
1385
1379
|
title: "删除印章",
|
|
1386
1380
|
data: s,
|
|
1387
1381
|
columns: me,
|
|
@@ -1414,7 +1408,7 @@ const $ = class $ {
|
|
|
1414
1408
|
errCode: q,
|
|
1415
1409
|
msg: "暂无印章"
|
|
1416
1410
|
});
|
|
1417
|
-
const r = (s == null ? void 0 : s.length) > 1 ? yield
|
|
1411
|
+
const r = (s == null ? void 0 : s.length) > 1 ? yield G.open({
|
|
1418
1412
|
title: "选择印章",
|
|
1419
1413
|
data: s,
|
|
1420
1414
|
columns: me,
|
|
@@ -1435,10 +1429,10 @@ const $ = class $ {
|
|
|
1435
1429
|
a(this, "getTPSeal", (e, t) => c(this, null, function* () {
|
|
1436
1430
|
var r;
|
|
1437
1431
|
const n = yield this.getTPSealList(e, t);
|
|
1438
|
-
return n != null && n.length ? (n == null ? void 0 : n.length) === 1 ? n == null ? void 0 : n[0] : yield
|
|
1432
|
+
return n != null && n.length ? (n == null ? void 0 : n.length) === 1 ? n == null ? void 0 : n[0] : yield G.open({
|
|
1439
1433
|
title: "选择印章",
|
|
1440
1434
|
data: n,
|
|
1441
|
-
columns:
|
|
1435
|
+
columns: Dt,
|
|
1442
1436
|
theme: (r = this.gwsConfig) == null ? void 0 : r.theme
|
|
1443
1437
|
}) : Promise.reject({
|
|
1444
1438
|
errCode: q,
|
|
@@ -1618,10 +1612,10 @@ const $ = class $ {
|
|
|
1618
1612
|
var s, r;
|
|
1619
1613
|
if (e) return e;
|
|
1620
1614
|
const t = yield (s = this.coreInstance) == null ? void 0 : s.getUKeyList();
|
|
1621
|
-
return yield
|
|
1615
|
+
return yield G.open({
|
|
1622
1616
|
title: "选择介质",
|
|
1623
1617
|
data: t,
|
|
1624
|
-
columns:
|
|
1618
|
+
columns: pt,
|
|
1625
1619
|
theme: (r = this.gwsConfig) == null ? void 0 : r.theme
|
|
1626
1620
|
});
|
|
1627
1621
|
}));
|
|
@@ -1659,13 +1653,13 @@ const $ = class $ {
|
|
|
1659
1653
|
}
|
|
1660
1654
|
};
|
|
1661
1655
|
a($, "instance", null);
|
|
1662
|
-
let
|
|
1656
|
+
let V = $;
|
|
1663
1657
|
function Pt(i) {
|
|
1664
1658
|
return new Promise((e, t) => {
|
|
1665
|
-
if (
|
|
1666
|
-
e(
|
|
1659
|
+
if (V.instance && !(i != null && i.isCreateNew))
|
|
1660
|
+
e(V.instance);
|
|
1667
1661
|
else {
|
|
1668
|
-
const n = new
|
|
1662
|
+
const n = new V(v(S({}, i != null ? i : {}), {
|
|
1669
1663
|
onOpen(s) {
|
|
1670
1664
|
var r;
|
|
1671
1665
|
e(n), (r = i == null ? void 0 : i.onOpen) == null || r.call(i, s);
|
|
@@ -1679,6 +1673,6 @@ function Pt(i) {
|
|
|
1679
1673
|
});
|
|
1680
1674
|
}
|
|
1681
1675
|
export {
|
|
1682
|
-
|
|
1676
|
+
V as GwsService,
|
|
1683
1677
|
Pt as createService
|
|
1684
1678
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_,I){typeof exports=="object"&&typeof module!="undefined"?I(exports):typeof define=="function"&&define.amd?define(["exports"],I):(_=typeof globalThis!="undefined"?globalThis:_||self,I(_.GWS_CLIENT={}))})(this,function(_){"use strict";var pt=Object.defineProperty,Dt=Object.defineProperties;var At=Object.getOwnPropertyDescriptors;var Me=Object.getOwnPropertySymbols;var Bt=Object.prototype.hasOwnProperty,Pt=Object.prototype.propertyIsEnumerable;var ge=(_,I,p)=>I in _?pt(_,I,{enumerable:!0,configurable:!0,writable:!0,value:p}):_[I]=p,S=(_,I)=>{for(var p in I||(I={}))Bt.call(I,p)&&ge(_,p,I[p]);if(Me)for(var p of Me(I))Pt.call(I,p)&&ge(_,p,I[p]);return _},D=(_,I)=>Dt(_,At(I));var a=(_,I,p)=>ge(_,typeof I!="symbol"?I+"":I,p);var c=(_,I,p)=>new Promise((Q,Y)=>{var ie=k=>{try{T(p.next(k))}catch(H){Y(H)}},re=k=>{try{T(p.throw(k))}catch(H){Y(H)}},T=k=>k.done?Q(k.value):Promise.resolve(k.value).then(ie,re);T((p=p.apply(_,I)).next())});const I=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",p="1",Q="2",Y="1",ie="2",re="3";var T=(i=>(i.MIN="0",i.LOW="1",i.MIDDLE="2",i.HIGH="3",i))(T||{});const k={LEVEL_1:1,LEVEL_2:2,LEVEL_3:4},H={OPEN:k.LEVEL_1,INTERNAL:k.LEVEL_2|k.LEVEL_1,OMP:k.LEVEL_3|k.LEVEL_2|k.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={},Ce;function Ue(){if(Ce)return U;Ce=1,U.byteLength=l,U.toByteArray=u,U.fromByteArray=C;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(y){var f=y.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var m=y.indexOf("=");m===-1&&(m=f);var w=m===f?0:4-m%4;return[m,w]}function l(y){var f=o(y),m=f[0],w=f[1];return(m+w)*3/4-w}function h(y,f,m){return(f+m)*3/4-m}function u(y){var f,m=o(y),w=m[0],E=m[1],L=new t(h(y,w,E)),A=0,x=E>0?w-4:w,v;for(v=0;v<x;v+=4)f=e[y.charCodeAt(v)]<<18|e[y.charCodeAt(v+1)]<<12|e[y.charCodeAt(v+2)]<<6|e[y.charCodeAt(v+3)],L[A++]=f>>16&255,L[A++]=f>>8&255,L[A++]=f&255;return E===2&&(f=e[y.charCodeAt(v)]<<2|e[y.charCodeAt(v+1)]>>4,L[A++]=f&255),E===1&&(f=e[y.charCodeAt(v)]<<10|e[y.charCodeAt(v+1)]<<4|e[y.charCodeAt(v+2)]>>2,L[A++]=f>>8&255,L[A++]=f&255),L}function g(y){return i[y>>18&63]+i[y>>12&63]+i[y>>6&63]+i[y&63]}function d(y,f,m){for(var w,E=[],L=f;L<m;L+=3)w=(y[L]<<16&16711680)+(y[L+1]<<8&65280)+(y[L+2]&255),E.push(g(w));return E.join("")}function C(y){for(var f,m=y.length,w=m%3,E=[],L=16383,A=0,x=m-w;A<x;A+=L)E.push(d(y,A,A+L>x?x:A+L));return w===1?(f=y[m-1],E.push(i[f>>2]+i[f<<4&63]+"==")):w===2&&(f=(y[m-2]<<8)+y[m-1],E.push(i[f>>10]+i[f>>4&63]+i[f<<2&63]+"=")),E.join("")}return U}var je=Ue();const fe=He(je);class Re{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 Ke=Object.defineProperty,We=(i,e,t)=>e in i?Ke(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,we=(i,e,t)=>We(i,typeof e!="symbol"?e+"":e,t);function ae(){}function ze(i,e){for(const t in e)i[t]=e[t];return i}function Se(i){return i()}function me(){return Object.create(null)}function j(i){i.forEach(Se)}function R(i){return typeof i=="function"}function Ee(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Je(i){return Object.keys(i).length===0}function Qe(i,e,t,n){if(i){const s=ke(i,e,t,n);return i[0](s)}}function ke(i,e,t,n){return i[1]&&n?ze(t.ctx.slice(),i[1](n(e))):t.ctx}function Ye(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=ke(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 Ie(i){return i==null?"":i}function B(i,e){i.appendChild(e)}function q(i,e,t){i.insertBefore(e,t||null)}function K(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 O(i){return document.createTextNode(i)}function X(){return O(" ")}function et(){return O("")}function W(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function P(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 z(i){ce=i}const M=[],Le=[];let G=[];const _e=[],nt=Promise.resolve();let le=!1;function st(){le||(le=!0,nt.then(pe))}function ue(i){G.push(i)}const he=new Set;let F=0;function pe(){if(F!==0)return;const i=ce;do{try{for(;F<M.length;){const e=M[F];F++,z(e),it(e.$$)}}catch(e){throw M.length=0,F=0,e}for(z(null),M.length=0,F=0;Le.length;)Le.pop()();for(let e=0;e<G.length;e+=1){const t=G[e];he.has(t)||(he.add(t),t())}G.length=0}while(M.length);for(;_e.length;)_e.pop()();le=!1,he.clear(),z(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 de(i,e){i&&i.i&&(ne.delete(i),i.i(e))}function De(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 Ae(i,e,t){const{fragment:n,after_update:s}=i.$$;n&&n.m(e,t),ue(()=>{const r=i.$$.on_mount.map(Se).filter(R);i.$$.on_destroy?i.$$.on_destroy.push(...r):j(r),i.$$.on_mount=[]}),s.forEach(ue)}function Be(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&&(M.push(i),st(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function Pe(i,e,t,n,s,r,o=null,l=[-1]){const h=ce;z(i);const u=i.$$={fragment:null,ctx:[],props:r,update:ae,not_equal:s,bound:me(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(h?h.$$.context:[])),callbacks:me(),dirty:l,skip_bound:!1,root:e.target||h.$$.root};o&&o(u.root);let g=!1;if(u.ctx=t?t(i,e.props||{},(d,C,...y)=>{const f=y.length?y[0]:C;return u.ctx&&s(u.ctx[d],u.ctx[d]=f)&&(!u.skip_bound&&u.bound[d]&&u.bound[d](f),g&&ct(i,d)),C}):[],u.update(),g=!0,j(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const d=tt(e.target);u.fragment&&u.fragment.l(d),d.forEach(K)}else u.fragment&&u.fragment.c();e.intro&&de(i.$$.fragment),Ae(i,e.target,e.anchor),pe()}z(h)}class be{constructor(){we(this,"$$"),we(this,"$$set")}$destroy(){Be(this,1),this.$destroy=ae}$on(e,t){if(!R(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&&!Je(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,h,u,g,d=(i[4]||"取消")+"",C,y,f,m=(i[5]||"确认")+"",w,E,L,A;const x=i[8].default,v=Qe(x,i,i[7],null);return{c(){e=N("div"),t=N("div"),n=N("div"),r=O(s),o=X(),l=N("div"),v&&v.c(),h=X(),u=N("div"),g=N("button"),C=O(d),y=X(),f=N("button"),w=O(m),P(n,"class","model-title svelte-16iv9d0"),P(l,"class","slot svelte-16iv9d0"),P(g,"class","modal-btn svelte-16iv9d0"),P(f,"class","modal-btn success svelte-16iv9d0"),te(f,"background-color",i[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,$){q(b,e,$),B(e,t),B(t,n),B(n,r),B(t,o),B(t,l),v&&v.m(l,null),B(t,h),B(t,u),B(u,g),B(g,C),B(u,y),B(u,f),B(f,w),E=!0,L||(A=[W(g,"click",function(){R(i[0])&&i[0].apply(this,arguments)}),W(f,"click",function(){R(i[2])&&i[2].apply(this,arguments)}),W(t,"click",ht),W(e,"click",function(){R(i[3])&&i[3].apply(this,arguments)})],L=!0)},p(b,[$]){i=b,(!E||$&2)&&s!==(s=(i[1]||"标题")+"")&&ee(r,s),v&&v.p&&(!E||$&128)&&qe(v,x,i,i[7],E?Ye(x,i[7],$,null):Xe(i[7]),null),(!E||$&16)&&d!==(d=(i[4]||"取消")+"")&&ee(C,d),(!E||$&32)&&m!==(m=(i[5]||"确认")+"")&&ee(w,m),(!E||$&64)&&te(f,"background-color",i[6])},i(b){E||(de(v,b),E=!0)},o(b){De(v,b),E=!1},d(b){b&&K(e),v&&v.d(b),L=!1,j(A)}}}const ht=i=>i.stopPropagation();function dt(i,e,t){let{$$slots:n={},$$scope:s}=e,{onCancel:r}=e,{title:o}=e,{onOk:l}=e,{onClose:h}=e,{cancelText:u}=e,{okText:g}=e,{theme:d}=e;return i.$$set=C=>{"onCancel"in C&&t(0,r=C.onCancel),"title"in C&&t(1,o=C.title),"onOk"in C&&t(2,l=C.onOk),"onClose"in C&&t(3,h=C.onClose),"cancelText"in C&&t(4,u=C.cancelText),"okText"in C&&t(5,g=C.okText),"theme"in C&&t(6,d=C.theme),"$$scope"in C&&t(7,s=C.$$scope)},[r,o,l,h,u,g,d,s,n]}class gt extends be{constructor(e){super(),Pe(this,e,dt,ut,Ee,{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=O(t),P(e,"class","svelte-1kh75ag"),te(e,"width",`${100/i[1].length}%`)},m(s,r){q(s,e,r),B(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&&K(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 h(){return i[12](i[15])}return{c(){e=N("div");for(let u=0;u<l.length;u+=1)l[u].c();t=X(),P(e,"class",n=Ie(`cert-item ${i[15]===0?"cert-item-first":""} ${i[15]===i[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")},m(u,g){q(u,e,g);for(let d=0;d<l.length;d+=1)l[d]&&l[d].m(e,null);B(e,t),s||(r=W(e,"click",h),s=!0)},p(u,g){if(i=u,g&3){o=se(i[1]);let d;for(d=0;d<o.length;d+=1){const C=xe(i,o,d);l[d]?l[d].p(C,g):(l[d]=$e(C),l[d].c(),l[d].m(e,t))}for(;d<l.length;d+=1)l[d].d(1);l.length=o.length}g&128&&n!==(n=Ie(`cert-item ${i[15]===0?"cert-item-first":""} ${i[15]===i[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")&&P(e,"class",n)},d(u){u&&K(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&&K(e),ve(n,s)}}}function Ct(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){Ae(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||(de(e.$$.fragment,n),t=!0)},o(n){De(e.$$.fragment,n),t=!1},d(n){Be(e,n)}}}function ft(i,e,t){let{data:n=[]}=e,{columns:s=[]}=e,{onCancel:r}=e,{onOk:o}=e,{onClose:l}=e,{cancelText:h=""}=e,{okText:u=""}=e,{theme:g="#409eff"}=e,{title:d=""}=e,C=0;const y=()=>{r(`${d}失败`),l==null||l()},f=()=>{o==null||o(n[C]),l==null||l()},m=w=>t(7,C=w);return i.$$set=w=>{"data"in w&&t(0,n=w.data),"columns"in w&&t(1,s=w.columns),"onCancel"in w&&t(10,r=w.onCancel),"onOk"in w&&t(11,o=w.onOk),"onClose"in w&&t(2,l=w.onClose),"cancelText"in w&&t(3,h=w.cancelText),"okText"in w&&t(4,u=w.okText),"theme"in w&&t(5,g=w.theme),"title"in w&&t(6,d=w.title)},[n,s,l,h,u,g,d,C,y,f,r,o,m]}class wt extends be{constructor(e){super(),Pe(this,e,ft,Ct,Ee,{data:0,columns:1,onCancel:10,onOk:11,onClose:2,cancelText:3,okText:4,theme:5,title:6})}}class St{constructor(){a(this,"modalInstance",{current:null});a(this,"open",e=>new Promise((t,n)=>{this.modalInstance.current=new wt({target:document.body,props:D(S({},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 J=new St;function mt(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("")}function Et(i){const e=new Uint8Array(i),t=new TextDecoder("gbk"),n=new TextDecoder("latin1").decode(e);try{const s=JSON.parse(n),r=o=>{if(typeof o=="string"){const l=new Uint8Array(o.length);for(let h=0;h<o.length;h++)l[h]=o.charCodeAt(h)&255;return t.decode(l)}if(Array.isArray(o))return o.map(r);if(o!==null&&typeof o=="object"){const l={},h=o;for(const u in o)if(Object.prototype.hasOwnProperty.call(h,u)){const g=r(u);l[g]=r(h[u])}return l}return o};return r(s)}catch(s){throw console.error("GBK JSON 修复流程失败:",s),s}}const kt=[{key:"CN"},{format:i=>`${i.DevClass}(${i.sn})`}],It=[{key:"SealId"},{key:"Vid"},{format:i=>`${i.FileName}(${i.FileSize}B)`}],Oe=[{key:"SealId"}],vt=[{key:"manu"},{key:"sn"}];class Lt{constructor(e){a(this,"socketInstance",null);a(this,"eventBus",new Re);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 d,C;if(((d=this.socketInstance)==null?void 0:d.readyState)!==WebSocket.OPEN){r({errCode:Ve,msg:"数字证书客户端连接失败"});return}const h=mt(),u=y=>{y.success?s(y.data):r(y)},g={function:e,args:t?[t]:[],msgid:h};(C=this.socketInstance)==null||C.send(JSON.stringify(g)),this.eventBus.on(e,u),this.eventBus.on(h,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,h,u;if(e.data instanceof Blob){const g=yield e.data.arrayBuffer(),C=navigator.userAgent.includes("Windows")?Et(g):JSON.parse(new TextDecoder().decode(g)),y={success:(t=C.result)==null?void 0:t.success,msg:(n=C.result)==null?void 0:n.msg,errCode:(s=C.result)==null?void 0:s.errCode,data:C.data,type:(r=C.result)==null?void 0:r.event},f=(o=C.result)==null?void 0:o.function,m=(l=C.result)==null?void 0:l.msgid;m?this.eventBus.emit(m,y):this.eventBus.emit(f,y),(u=(h=this.socketConfig)==null?void 0:h.onMessage)==null||u.call(h,y)}}));a(this,"base64Encode",e=>{const t=new TextEncoder().encode(e);return fe.fromByteArray(t)});a(this,"base64Decode",e=>{const t=fe.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,D(S({},e),{data:(n=e.data)==null?void 0:n[0]}))})}));a(this,"ensureCertLogin",e=>c(this,null,function*(){const t=yield this.checkCertIsLogin({ContainerName:e.ContainerName});t!=null&&t[0].isLogin||(yield this.sendMessage("GZCA_Login",{ContainerName:e.ContainerName,IsLogin:"N",UserPin:"123456",PinPolicy:this.pinPolicy}))}));a(this,"verifyPin",e=>c(this,null,function*(){var t;console.log("params2",e),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.ensureCertLogin({ContainerName: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 J.open({title:"选择证书",data:t,columns:kt,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",S({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"pkcs1Base64Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",S({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"batchPkcs1Base64Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_BatchPkcs1SignDataEx",S({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",S({IsLogin:this.getIsLogin()},e!=null?e:{}),k.LEVEL_2)}));a(this,"writeSeal",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_WriteSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}),k.LEVEL_2)}));a(this,"deleteSeal",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_DeleteSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}),k.LEVEL_2)}));a(this,"getSealInfo",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ReadSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}),k.LEVEL_2)}));a(this,"getTPSealList",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetSealPicList",S({IsLogin:this.getIsLogin()},e!=null?e:{}),k.LEVEL_2)}));a(this,"getTPSealPic",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetSealPicData",S({IsLogin:this.getIsLogin()},e!=null?e:{}),k.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",S({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",S({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",S({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",S({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",S({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,k.LEVEL_2)}));a(this,"deleteAllSealByVendor",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ClearSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}),k.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},k.LEVEL_3)}));a(this,"resetPin",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_UnblockUserPin",S({},e!=null?e:{}),k.LEVEL_3)}));a(this,"getUKeyList",()=>c(this,null,function*(){return yield this.sendMessage("GetUKeyList",void 0,k.LEVEL_3)}));a(this,"getUKeyInfo",e=>c(this,null,function*(){return yield this.sendMessage("GetUKeyID",e!=null?e:{},k.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 Lt(D(S({},e!=null?e:{}),{url:I}))});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 D(S({},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,"ensureCertLogin",e=>c(this,null,function*(){var s,r;const t=yield this.getSignatureCert(e);return yield(r=this.coreInstance)==null?void 0:r.ensureCertLogin({ContainerName:(s=t==null?void 0:t.ContainerName)!=null?s:""})}));a(this,"getSignatureCert",(e,t=!0)=>c(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:p},e,t)}));a(this,"getSignatureCertList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:p})}));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(D(S({},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,h,u,g;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(D(S({},e!=null?e:{}),{ContainerName:(h=n==null?void 0:n.ContainerName)!=null?h:"",DataB64:s}));return(g=r==null?void 0:r[0])==null?void 0:g.SignData}));a(this,"batchPkcs1Base64Sign",(e,t)=>c(this,null,function*(){var g,d,C,y,f,m;const n="|",s=(d=e.DataB64)!=null?d:(g=e.Data)==null?void 0:g.map(w=>this.base64Encode({Data:w})),r=yield this.getSignatureCert(t);let o="";o=Array.isArray(s)?s==null?void 0:s.map((w,E)=>`${E}:${w}`).join(n):"";const l=yield(y=this.coreInstance)==null?void 0:y.batchPkcs1Base64Sign({ContainerName:(C=r==null?void 0:r.ContainerName)!=null?C:"",DataB64:o}),h=(m=(f=l==null?void 0:l[0])==null?void 0:f.SignData)==null?void 0:m.split(n),u=[];return h.forEach(w=>{const E=w.split(":"),L=Number(E[0]),A=E[1];u[L]=A}),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(D(S({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));a(this,"deleteSeal",(e,t)=>c(this,null,function*(){var h,u,g;const n=yield this.getSignatureCert(t),s=yield this.getSealList(e,n);if(!(s!=null&&s.length))return Promise.reject({errCode:oe,msg:"暂无印章"});const r=yield J.open({title:"删除印章",data:s,columns:Oe,okText:"删除"}),o=(h=r==null?void 0:r.SealId)!=null?h:"";return!!(yield(g=this.coreInstance)==null?void 0:g.deleteSeal(S({ContainerName:(u=n==null?void 0:n.ContainerName)!=null?u:"",SealId:o},e!=null?e:{})))}));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(D(S({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));a(this,"getSealList",(e,t)=>c(this,null,function*(){var r,o;const n=yield this.getSignatureCert(t);return yield(o=this.coreInstance)==null?void 0:o.getSealList(S({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""},e!=null?e:{}))}));a(this,"getSealInfo",(e,t)=>c(this,null,function*(){var l,h,u,g;const n=yield this.getSignatureCert(t),s=yield this.getSealList(e,n);if(!(s!=null&&s.length))return Promise.reject({errCode:oe,msg:"暂无印章"});const r=(s==null?void 0:s.length)>1?yield J.open({title:"选择印章",data:s,columns:Oe,theme:(l=this.gwsConfig)==null?void 0:l.theme}):s==null?void 0:s[0],o=yield(g=this.coreInstance)==null?void 0:g.getSealInfo({ContainerName:(h=n==null?void 0:n.ContainerName)!=null?h:"",SealId:(u=r==null?void 0:r.SealId)!=null?u:""});return o==null?void 0:o[0]}));a(this,"getTPSealList",(e,t)=>c(this,null,function*(){var r,o;const n=yield this.getSignatureCert(t);return yield(o=this.coreInstance)==null?void 0:o.getTPSealList(S({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""},e!=null?e:{}))}));a(this,"getTPSeal",(e,t)=>c(this,null,function*(){var r;const n=yield this.getTPSealList(e,t);return n!=null&&n.length?(n==null?void 0:n.length)===1?n==null?void 0:n[0]:yield J.open({title:"选择印章",data:n,columns:It,theme:(r=this.gwsConfig)==null?void 0:r.theme}):Promise.reject({errCode:oe,msg:"暂无印章"})}));a(this,"getTPSealPic",(e,t,n)=>c(this,null,function*(){var l,h;const s=yield this.getSignatureCert(t),r=n||(yield this.getTPSeal(e,t)),o=yield(h=this.coreInstance)==null?void 0:h.getTPSealPic(D(S(S({ContainerName:(l=s==null?void 0:s.ContainerName)!=null?l:""},r!=null?r:{}),e!=null?e:{}),{FileSize:String(r==null?void 0:r.FileSize)}));return o==null?void 0:o[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,h;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(h=s==null?void 0:s[0])==null?void 0:h.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(D(S({},t),{HashAlg:(s=t.HashAlg)!=null?s:"sm3"})))}));a(this,"pkcs7Sign",(e,t)=>c(this,null,function*(){var o,l,h,u,g;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(D(S({},e!=null?e:{}),{ContainerName:(h=s==null?void 0:s.ContainerName)!=null?h:"",DataB64:n}));return(g=r==null?void 0:r[0])==null?void 0:g.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,h,u,g;const t=(o=e.DataB64)!=null?o:this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=(h=e.KeyB64)!=null?h: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(g=s==null?void 0:s[0])==null?void 0:g.DataB64}));a(this,"pkcs7Encryption",e=>c(this,null,function*(){var s,r,o,l;if(!e.CertB64List){const h=yield this.getEncryptionCert();e.CertB64List=h==null?void 0:h.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(D(S({},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(D(S({},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,h;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 g=ye[u];try{const d=yield(o=this.coreInstance)==null?void 0:o.getCertInfoByOid({Oid:g.oid,CertB64:e.CertB64});n[g.key]=(h=(l=d==null?void 0:d[0])==null?void 0:l.OidValue)==null?void 0:h.replace(/\./g,"")}catch(d){n[g.key]=null}}return n!=null&&n.idCardNo?n!=null&&n.CertSubject.includes("O=")||n.orgCode?n.certCate=ie:n.certCate=Y: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(S({},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(D(S({},e!=null?e:{}),{ContainerName:n==null?void 0:n.ContainerName}));return s==null?void 0:s[0]}));a(this,"getUKey",e=>c(this,null,function*(){var s,r;if(e)return e;const t=yield(s=this.coreInstance)==null?void 0:s.getUKeyList();return yield J.open({title:"选择介质",data:t,columns:vt,theme:(r=this.gwsConfig)==null?void 0:r.theme})}));a(this,"getUKeyList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getUKeyList()}));a(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]}));a(this,"applyCert",(e,t)=>c(this,null,function*(){var o;const n=yield this.getUKey(t),s=yield this.getUKeyInfo(n);return yield(o=this.coreInstance)==null?void 0:o.applyCert(D(S({},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(D(S({},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 _t(i){return new Promise((e,t)=>{if(V.instance&&!(i!=null&&i.isCreateNew))e(V.instance);else{const n=new V(D(S({},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=_t,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(_,I){typeof exports=="object"&&typeof module!="undefined"?I(exports):typeof define=="function"&&define.amd?define(["exports"],I):(_=typeof globalThis!="undefined"?globalThis:_||self,I(_.GWS_CLIENT={}))})(this,function(_){"use strict";var pt=Object.defineProperty,Dt=Object.defineProperties;var At=Object.getOwnPropertyDescriptors;var Me=Object.getOwnPropertySymbols;var Bt=Object.prototype.hasOwnProperty,Pt=Object.prototype.propertyIsEnumerable;var ge=(_,I,p)=>I in _?pt(_,I,{enumerable:!0,configurable:!0,writable:!0,value:p}):_[I]=p,S=(_,I)=>{for(var p in I||(I={}))Bt.call(I,p)&&ge(_,p,I[p]);if(Me)for(var p of Me(I))Pt.call(I,p)&&ge(_,p,I[p]);return _},D=(_,I)=>Dt(_,At(I));var a=(_,I,p)=>ge(_,typeof I!="symbol"?I+"":I,p);var c=(_,I,p)=>new Promise((z,J)=>{var ie=k=>{try{T(p.next(k))}catch(H){J(H)}},re=k=>{try{T(p.throw(k))}catch(H){J(H)}},T=k=>k.done?z(k.value):Promise.resolve(k.value).then(ie,re);T((p=p.apply(_,I)).next())});const I=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",p="1",z="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 k={LEVEL_1:1,LEVEL_2:2,LEVEL_3:4},H={OPEN:k.LEVEL_1,INTERNAL:k.LEVEL_2|k.LEVEL_1,OMP:k.LEVEL_3|k.LEVEL_2|k.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={},Ce;function Ue(){if(Ce)return U;Ce=1,U.byteLength=l,U.toByteArray=u,U.fromByteArray=C;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(y){var f=y.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=y.indexOf("=");E===-1&&(E=f);var w=E===f?0:4-E%4;return[E,w]}function l(y){var f=o(y),E=f[0],w=f[1];return(E+w)*3/4-w}function h(y,f,E){return(f+E)*3/4-E}function u(y){var f,E=o(y),w=E[0],m=E[1],L=new t(h(y,w,m)),A=0,x=m>0?w-4:w,v;for(v=0;v<x;v+=4)f=e[y.charCodeAt(v)]<<18|e[y.charCodeAt(v+1)]<<12|e[y.charCodeAt(v+2)]<<6|e[y.charCodeAt(v+3)],L[A++]=f>>16&255,L[A++]=f>>8&255,L[A++]=f&255;return m===2&&(f=e[y.charCodeAt(v)]<<2|e[y.charCodeAt(v+1)]>>4,L[A++]=f&255),m===1&&(f=e[y.charCodeAt(v)]<<10|e[y.charCodeAt(v+1)]<<4|e[y.charCodeAt(v+2)]>>2,L[A++]=f>>8&255,L[A++]=f&255),L}function g(y){return i[y>>18&63]+i[y>>12&63]+i[y>>6&63]+i[y&63]}function d(y,f,E){for(var w,m=[],L=f;L<E;L+=3)w=(y[L]<<16&16711680)+(y[L+1]<<8&65280)+(y[L+2]&255),m.push(g(w));return m.join("")}function C(y){for(var f,E=y.length,w=E%3,m=[],L=16383,A=0,x=E-w;A<x;A+=L)m.push(d(y,A,A+L>x?x:A+L));return w===1?(f=y[E-1],m.push(i[f>>2]+i[f<<4&63]+"==")):w===2&&(f=(y[E-2]<<8)+y[E-1],m.push(i[f>>10]+i[f>>4&63]+i[f<<2&63]+"=")),m.join("")}return U}var je=Ue();const fe=He(je);class Re{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 Ke=Object.defineProperty,We=(i,e,t)=>e in i?Ke(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,we=(i,e,t)=>We(i,typeof e!="symbol"?e+"":e,t);function ae(){}function ze(i,e){for(const t in e)i[t]=e[t];return i}function Se(i){return i()}function Ee(){return Object.create(null)}function j(i){i.forEach(Se)}function Q(i){return typeof i=="function"}function me(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}function Je(i){return Object.keys(i).length===0}function Qe(i,e,t,n){if(i){const s=ke(i,e,t,n);return i[0](s)}}function ke(i,e,t,n){return i[1]&&n?ze(t.ctx.slice(),i[1](n(e))):t.ctx}function Ye(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=ke(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 Ie(i){return i==null?"":i}function B(i,e){i.appendChild(e)}function Y(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 O(i){return document.createTextNode(i)}function q(){return O(" ")}function et(){return O("")}function X(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function P(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 K(i){ce=i}const M=[],Le=[];let G=[];const _e=[],nt=Promise.resolve();let le=!1;function st(){le||(le=!0,nt.then(pe))}function ue(i){G.push(i)}const he=new Set;let F=0;function pe(){if(F!==0)return;const i=ce;do{try{for(;F<M.length;){const e=M[F];F++,K(e),it(e.$$)}}catch(e){throw M.length=0,F=0,e}for(K(null),M.length=0,F=0;Le.length;)Le.pop()();for(let e=0;e<G.length;e+=1){const t=G[e];he.has(t)||(he.add(t),t())}G.length=0}while(M.length);for(;_e.length;)_e.pop()();le=!1,he.clear(),K(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 de(i,e){i&&i.i&&(ne.delete(i),i.i(e))}function De(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 Ae(i,e,t){const{fragment:n,after_update:s}=i.$$;n&&n.m(e,t),ue(()=>{const r=i.$$.on_mount.map(Se).filter(Q);i.$$.on_destroy?i.$$.on_destroy.push(...r):j(r),i.$$.on_mount=[]}),s.forEach(ue)}function Be(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&&(M.push(i),st(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function Pe(i,e,t,n,s,r,o=null,l=[-1]){const h=ce;K(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||(h?h.$$.context:[])),callbacks:Ee(),dirty:l,skip_bound:!1,root:e.target||h.$$.root};o&&o(u.root);let g=!1;if(u.ctx=t?t(i,e.props||{},(d,C,...y)=>{const f=y.length?y[0]:C;return u.ctx&&s(u.ctx[d],u.ctx[d]=f)&&(!u.skip_bound&&u.bound[d]&&u.bound[d](f),g&&ct(i,d)),C}):[],u.update(),g=!0,j(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const d=tt(e.target);u.fragment&&u.fragment.l(d),d.forEach(R)}else u.fragment&&u.fragment.c();e.intro&&de(i.$$.fragment),Ae(i,e.target,e.anchor),pe()}K(h)}class be{constructor(){we(this,"$$"),we(this,"$$set")}$destroy(){Be(this,1),this.$destroy=ae}$on(e,t){if(!Q(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&&!Je(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,h,u,g,d=(i[3]||"取消")+"",C,y,f,E=(i[4]||"确认")+"",w,m,L,A;const x=i[8].default,v=Qe(x,i,i[7],null);return{c(){e=N("div"),t=N("div"),n=N("div"),r=O(s),o=q(),l=N("div"),v&&v.c(),h=q(),u=N("div"),g=N("button"),C=O(d),y=q(),f=N("button"),w=O(E),P(n,"class","model-title svelte-16iv9d0"),P(l,"class","slot svelte-16iv9d0"),P(g,"class","modal-btn svelte-16iv9d0"),P(f,"class","modal-btn success svelte-16iv9d0"),te(f,"background-color",i[5]),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,$){Y(b,e,$),B(e,t),B(t,n),B(n,r),B(t,o),B(t,l),v&&v.m(l,null),B(t,h),B(t,u),B(u,g),B(g,C),B(u,y),B(u,f),B(f,w),m=!0,L||(A=[X(g,"click",function(){Q(i[0])&&i[0].apply(this,arguments)}),X(f,"click",function(){Q(i[2])&&i[2].apply(this,arguments)}),X(t,"click",ht)],L=!0)},p(b,[$]){i=b,(!m||$&2)&&s!==(s=(i[1]||"标题")+"")&&ee(r,s),v&&v.p&&(!m||$&128)&&qe(v,x,i,i[7],m?Ye(x,i[7],$,null):Xe(i[7]),null),(!m||$&8)&&d!==(d=(i[3]||"取消")+"")&&ee(C,d),(!m||$&16)&&E!==(E=(i[4]||"确认")+"")&&ee(w,E),(!m||$&32)&&te(f,"background-color",i[5])},i(b){m||(de(v,b),m=!0)},o(b){De(v,b),m=!1},d(b){b&&R(e),v&&v.d(b),L=!1,j(A)}}}const ht=i=>i.stopPropagation();function dt(i,e,t){let{$$slots:n={},$$scope:s}=e,{onCancel:r}=e,{title:o}=e,{onOk:l}=e,{onClose:h}=e,{cancelText:u}=e,{okText:g}=e,{theme:d}=e;return i.$$set=C=>{"onCancel"in C&&t(0,r=C.onCancel),"title"in C&&t(1,o=C.title),"onOk"in C&&t(2,l=C.onOk),"onClose"in C&&t(6,h=C.onClose),"cancelText"in C&&t(3,u=C.cancelText),"okText"in C&&t(4,g=C.okText),"theme"in C&&t(5,d=C.theme),"$$scope"in C&&t(7,s=C.$$scope)},[r,o,l,u,g,d,h,s,n]}class gt extends be{constructor(e){super(),Pe(this,e,dt,ut,me,{onCancel:0,title:1,onOk:2,onClose:6,cancelText:3,okText:4,theme:5})}}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=O(t),P(e,"class","svelte-1kh75ag"),te(e,"width",`${100/i[1].length}%`)},m(s,r){Y(s,e,r),B(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 h(){return i[12](i[15])}return{c(){e=N("div");for(let u=0;u<l.length;u+=1)l[u].c();t=q(),P(e,"class",n=Ie(`cert-item ${i[15]===0?"cert-item-first":""} ${i[15]===i[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")},m(u,g){Y(u,e,g);for(let d=0;d<l.length;d+=1)l[d]&&l[d].m(e,null);B(e,t),s||(r=X(e,"click",h),s=!0)},p(u,g){if(i=u,g&3){o=se(i[1]);let d;for(d=0;d<o.length;d+=1){const C=xe(i,o,d);l[d]?l[d].p(C,g):(l[d]=$e(C),l[d].c(),l[d].m(e,t))}for(;d<l.length;d+=1)l[d].d(1);l.length=o.length}g&128&&n!==(n=Ie(`cert-item ${i[15]===0?"cert-item-first":""} ${i[15]===i[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")&&P(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);Y(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 Ct(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){Ae(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||(de(e.$$.fragment,n),t=!0)},o(n){De(e.$$.fragment,n),t=!1},d(n){Be(e,n)}}}function ft(i,e,t){let{data:n=[]}=e,{columns:s=[]}=e,{onCancel:r}=e,{onOk:o}=e,{onClose:l}=e,{cancelText:h=""}=e,{okText:u=""}=e,{theme:g="#409eff"}=e,{title:d=""}=e,C=0;const y=()=>{r(`${d}失败`),l==null||l()},f=()=>{o==null||o(n[C]),l==null||l()},E=w=>t(7,C=w);return i.$$set=w=>{"data"in w&&t(0,n=w.data),"columns"in w&&t(1,s=w.columns),"onCancel"in w&&t(10,r=w.onCancel),"onOk"in w&&t(11,o=w.onOk),"onClose"in w&&t(2,l=w.onClose),"cancelText"in w&&t(3,h=w.cancelText),"okText"in w&&t(4,u=w.okText),"theme"in w&&t(5,g=w.theme),"title"in w&&t(6,d=w.title)},[n,s,l,h,u,g,d,C,y,f,r,o,E]}class wt extends be{constructor(e){super(),Pe(this,e,ft,Ct,me,{data:0,columns:1,onCancel:10,onOk:11,onClose:2,cancelText:3,okText:4,theme:5,title:6})}}class St{constructor(){a(this,"modalInstance",{current:null});a(this,"open",e=>new Promise((t,n)=>{this.modalInstance.current=new wt({target:document.body,props:D(S({},e),{onCancel:s=>{n({code:"ON_CANCEL",msg:s})},onOk:s=>{t(s)},onClose:()=>{this.close()}})})}));a(this,"close",()=>{setTimeout(()=>{var e;(e=this.modalInstance.current)==null||e.$destroy()})})}}const W=new St;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("")}function mt(i){const e=new Uint8Array(i),t=new TextDecoder("gbk"),n=new TextDecoder("latin1").decode(e);try{const s=JSON.parse(n),r=o=>{if(typeof o=="string"){const l=new Uint8Array(o.length);for(let h=0;h<o.length;h++)l[h]=o.charCodeAt(h)&255;return t.decode(l)}if(Array.isArray(o))return o.map(r);if(o!==null&&typeof o=="object"){const l={},h=o;for(const u in o)if(Object.prototype.hasOwnProperty.call(h,u)){const g=r(u);l[g]=r(h[u])}return l}return o};return r(s)}catch(s){throw console.error("GBK JSON 修复流程失败:",s),s}}const kt=[{key:"CN"},{format:i=>`${i.DevClass}(${i.sn})`}],It=[{key:"SealId"},{key:"Vid"},{format:i=>`${i.FileName}(${i.FileSize}B)`}],Oe=[{key:"SealId"}],vt=[{key:"manu"},{key:"sn"}];class Lt{constructor(e){a(this,"socketInstance",null);a(this,"eventBus",new Re);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 d,C;if(((d=this.socketInstance)==null?void 0:d.readyState)!==WebSocket.OPEN){r({errCode:Ve,msg:"数字证书客户端连接失败"});return}const h=Et(),u=y=>{y.success?s(y.data):r(y)},g={function:e,args:t?[t]:[],msgid:h};(C=this.socketInstance)==null||C.send(JSON.stringify(g)),this.eventBus.on(e,u),this.eventBus.on(h,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,h,u;if(e.data instanceof Blob){const g=yield e.data.arrayBuffer(),C=navigator.userAgent.includes("Windows")?mt(g):JSON.parse(new TextDecoder().decode(g)),y={success:(t=C.result)==null?void 0:t.success,msg:(n=C.result)==null?void 0:n.msg,errCode:(s=C.result)==null?void 0:s.errCode,data:C.data,type:(r=C.result)==null?void 0:r.event},f=(o=C.result)==null?void 0:o.function,E=(l=C.result)==null?void 0:l.msgid;E?this.eventBus.emit(E,y):this.eventBus.emit(f,y),(u=(h=this.socketConfig)==null?void 0:h.onMessage)==null||u.call(h,y)}}));a(this,"base64Encode",e=>{const t=new TextEncoder().encode(e);return fe.fromByteArray(t)});a(this,"base64Decode",e=>{const t=fe.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,D(S({},e),{data:(n=e.data)==null?void 0:n[0]}))})}));a(this,"ensureCertLogin",e=>c(this,null,function*(){const t=yield this.checkCertIsLogin({ContainerName:e.ContainerName});t!=null&&t[0].isLogin||(yield this.sendMessage("GZCA_Login",{ContainerName:e.ContainerName,IsLogin:"N",UserPin:"123456",PinPolicy:this.pinPolicy}))}));a(this,"verifyPin",e=>c(this,null,function*(){var t;console.log("params2",e),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.ensureCertLogin({ContainerName: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 W.open({title:"选择证书",data:t,columns:kt,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",S({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"pkcs1Base64Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",S({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"batchPkcs1Base64Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_BatchPkcs1SignDataEx",S({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",S({IsLogin:this.getIsLogin()},e!=null?e:{}),k.LEVEL_2)}));a(this,"writeSeal",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_WriteSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}),k.LEVEL_2)}));a(this,"deleteSeal",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_DeleteSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}),k.LEVEL_2)}));a(this,"getSealInfo",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ReadSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}),k.LEVEL_2)}));a(this,"getTPSealList",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetSealPicList",S({IsLogin:this.getIsLogin()},e!=null?e:{}),k.LEVEL_2)}));a(this,"getTPSealPic",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetSealPicData",S({IsLogin:this.getIsLogin()},e!=null?e:{}),k.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",S({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",S({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",S({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",S({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",S({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,k.LEVEL_2)}));a(this,"deleteAllSealByVendor",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ClearSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}),k.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},k.LEVEL_3)}));a(this,"resetPin",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_UnblockUserPin",S({},e!=null?e:{}),k.LEVEL_3)}));a(this,"getUKeyList",()=>c(this,null,function*(){return yield this.sendMessage("GetUKeyList",void 0,k.LEVEL_3)}));a(this,"getUKeyInfo",e=>c(this,null,function*(){return yield this.sendMessage("GetUKeyID",e!=null?e:{},k.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 Lt(D(S({},e!=null?e:{}),{url:I}))});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 D(S({},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,"ensureCertLogin",e=>c(this,null,function*(){var s,r;const t=yield this.getSignatureCert(e);return yield(r=this.coreInstance)==null?void 0:r.ensureCertLogin({ContainerName:(s=t==null?void 0:t.ContainerName)!=null?s:""})}));a(this,"getSignatureCert",(e,t=!0)=>c(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:p},e,t)}));a(this,"getSignatureCertList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:p})}));a(this,"getEncryptionCert",(e,t=!0)=>c(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:z},e,t)}));a(this,"getEncryptionCertList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:z})}));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(D(S({},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,h,u,g;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(D(S({},e!=null?e:{}),{ContainerName:(h=n==null?void 0:n.ContainerName)!=null?h:"",DataB64:s}));return(g=r==null?void 0:r[0])==null?void 0:g.SignData}));a(this,"batchPkcs1Base64Sign",(e,t)=>c(this,null,function*(){var g,d,C,y,f,E;const n="|",s=(d=e.DataB64)!=null?d:(g=e.Data)==null?void 0:g.map(w=>this.base64Encode({Data:w})),r=yield this.getSignatureCert(t);let o="";o=Array.isArray(s)?s==null?void 0:s.map((w,m)=>`${m}:${w}`).join(n):"";const l=yield(y=this.coreInstance)==null?void 0:y.batchPkcs1Base64Sign({ContainerName:(C=r==null?void 0:r.ContainerName)!=null?C:"",DataB64:o}),h=(E=(f=l==null?void 0:l[0])==null?void 0:f.SignData)==null?void 0:E.split(n),u=[];return h.forEach(w=>{const m=w.split(":"),L=Number(m[0]),A=m[1];u[L]=A}),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(D(S({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));a(this,"deleteSeal",(e,t)=>c(this,null,function*(){var h,u,g;const n=yield this.getSignatureCert(t),s=yield this.getSealList(e,n);if(!(s!=null&&s.length))return Promise.reject({errCode:oe,msg:"暂无印章"});const r=yield W.open({title:"删除印章",data:s,columns:Oe,okText:"删除"}),o=(h=r==null?void 0:r.SealId)!=null?h:"";return!!(yield(g=this.coreInstance)==null?void 0:g.deleteSeal(S({ContainerName:(u=n==null?void 0:n.ContainerName)!=null?u:"",SealId:o},e!=null?e:{})))}));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(D(S({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));a(this,"getSealList",(e,t)=>c(this,null,function*(){var r,o;const n=yield this.getSignatureCert(t);return yield(o=this.coreInstance)==null?void 0:o.getSealList(S({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""},e!=null?e:{}))}));a(this,"getSealInfo",(e,t)=>c(this,null,function*(){var l,h,u,g;const n=yield this.getSignatureCert(t),s=yield this.getSealList(e,n);if(!(s!=null&&s.length))return Promise.reject({errCode:oe,msg:"暂无印章"});const r=(s==null?void 0:s.length)>1?yield W.open({title:"选择印章",data:s,columns:Oe,theme:(l=this.gwsConfig)==null?void 0:l.theme}):s==null?void 0:s[0],o=yield(g=this.coreInstance)==null?void 0:g.getSealInfo({ContainerName:(h=n==null?void 0:n.ContainerName)!=null?h:"",SealId:(u=r==null?void 0:r.SealId)!=null?u:""});return o==null?void 0:o[0]}));a(this,"getTPSealList",(e,t)=>c(this,null,function*(){var r,o;const n=yield this.getSignatureCert(t);return yield(o=this.coreInstance)==null?void 0:o.getTPSealList(S({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""},e!=null?e:{}))}));a(this,"getTPSeal",(e,t)=>c(this,null,function*(){var r;const n=yield this.getTPSealList(e,t);return n!=null&&n.length?(n==null?void 0:n.length)===1?n==null?void 0:n[0]:yield W.open({title:"选择印章",data:n,columns:It,theme:(r=this.gwsConfig)==null?void 0:r.theme}):Promise.reject({errCode:oe,msg:"暂无印章"})}));a(this,"getTPSealPic",(e,t,n)=>c(this,null,function*(){var l,h;const s=yield this.getSignatureCert(t),r=n||(yield this.getTPSeal(e,t)),o=yield(h=this.coreInstance)==null?void 0:h.getTPSealPic(D(S(S({ContainerName:(l=s==null?void 0:s.ContainerName)!=null?l:""},r!=null?r:{}),e!=null?e:{}),{FileSize:String(r==null?void 0:r.FileSize)}));return o==null?void 0:o[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,h;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(h=s==null?void 0:s[0])==null?void 0:h.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(D(S({},t),{HashAlg:(s=t.HashAlg)!=null?s:"sm3"})))}));a(this,"pkcs7Sign",(e,t)=>c(this,null,function*(){var o,l,h,u,g;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(D(S({},e!=null?e:{}),{ContainerName:(h=s==null?void 0:s.ContainerName)!=null?h:"",DataB64:n}));return(g=r==null?void 0:r[0])==null?void 0:g.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,h,u,g;const t=(o=e.DataB64)!=null?o:this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=(h=e.KeyB64)!=null?h: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(g=s==null?void 0:s[0])==null?void 0:g.DataB64}));a(this,"pkcs7Encryption",e=>c(this,null,function*(){var s,r,o,l;if(!e.CertB64List){const h=yield this.getEncryptionCert();e.CertB64List=h==null?void 0:h.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(D(S({},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(D(S({},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,h;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 g=ye[u];try{const d=yield(o=this.coreInstance)==null?void 0:o.getCertInfoByOid({Oid:g.oid,CertB64:e.CertB64});n[g.key]=(h=(l=d==null?void 0:d[0])==null?void 0:l.OidValue)==null?void 0:h.replace(/\./g,"")}catch(d){n[g.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(S({},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(D(S({},e!=null?e:{}),{ContainerName:n==null?void 0:n.ContainerName}));return s==null?void 0:s[0]}));a(this,"getUKey",e=>c(this,null,function*(){var s,r;if(e)return e;const t=yield(s=this.coreInstance)==null?void 0:s.getUKeyList();return yield W.open({title:"选择介质",data:t,columns:vt,theme:(r=this.gwsConfig)==null?void 0:r.theme})}));a(this,"getUKeyList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getUKeyList()}));a(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]}));a(this,"applyCert",(e,t)=>c(this,null,function*(){var o;const n=yield this.getUKey(t),s=yield this.getUKeyInfo(n);return yield(o=this.coreInstance)==null?void 0:o.applyCert(D(S({},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(D(S({},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 _t(i){return new Promise((e,t)=>{if(V.instance&&!(i!=null&&i.isCreateNew))e(V.instance);else{const n=new V(D(S({},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=_t,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|