PageSourceSearch

https://10088.ai/assets/ws-recall-43c2448f.js

js 10088.ai collected 2026-10-05 11:48:04 UTC 2,685 bytes, 1 lines download raw bytes

1import{d as I,F as b,D as B,a6 as J,o as O,ax as V,c as $,G as u,H as w,I as k,J as m,a5 as T,U,T as C,K as r,M as d,N as x,Q as N,c9 as z,$ as D}from"./app-e1fab618.js";function E(c,t){const i=new WebSocket(c);i.onopen=function(o){var e;(e=t==null?void 0:t.open)==null||e.call(t,o,i)},i.onmessage=function(o){var e;(e=t==null?void 0:t.msg)==null||e.call(t,o)},i.onclose=function(o){var e;(e=t==null?void 0:t.close)==null||e.call(t,o)},i.onerror=function(o){var e;(e=t==null?void 0:t.error)==null||e.call(t,o)}}const H={class:"cursor-pointer"},M={class:"text-xs"},R={key:0,class:"text-xs"},G=I({__name:"ws-recall",props:{url:{type:String,default:""}},emits:["input-submit"],setup(c,{expose:t,emit:i}){const o=c,e=b({status:0,ws:null,time:0,err:null,timer:null,meClose:!0});B();const S=J();O(()=>{p()});function p(){e.status=3,e.err=null,e.time=0,e.meClose=!1,V(()=>{E(o.url,{open:(s,n)=>{var a,l;e.status=1,e.ws=n,e.err=null,e.time=0,(l=e.ws)==null||l.send(JSON.stringify({type:"init",content:(a=S.auth)==null?void 0:a.token}))},close:s=>{e.err==null&&(e.status=0,e.meClose||_())},error:s=>{console.error("ws connect error",s),e.status=2,e.err=s!=null?s:"unknown",_()},msg:s=>{const n=JSON.parse(s.data||"");n&&n.type==="send"&&i("input-submit",n.content,!0,a=>{var l;a&&(console.error(a),(l=e.ws)==null||l.send(JSON.stringify({type:"error",content:a})))},n.prefix)}})})}function _(s=10){e.timer&&(clearInterval(e.timer),e.timer=null),e.time=s,e.timer=setInterval(()=>{e.time<=0?(clearInterval(e.timer),e.timer=null,p()):e.time--},1e3)}function h(){e.timer&&(clearInterval(e.timer),e.timer=null),p()}const v=()=>{var s;e.meClose=!0,(s=e.ws)==null||s.close(),e.status=0},y=$(()=>{switch(e.status){case 0:return{name:"未连接",color:"gray"};case 1:return{name:"已连接",color:"green"};case 2:return{name:"连接失败",color:"red"};case 3:return{name:"连接中...",color:"blue"};default:return{name:"未知状态(".concat(e.status,")"),color:"gray"}}});return t({call:s=>{var n;(n=e.ws)==null||n.send(JSON.stringify({type:s.isErr?"error":"ok",content:s.res}))}}),(s,n)=>{const a=z,l=D;return u(),w("div",H,[k(T,{placement:"top"},{tip:m(()=>[U("span",M,C("WS状态:".concat(r(y).name)),1),r(e).status!=1&&r(e).status!=3&&r(e).time?(u(),w("span",R,","+C(r(e).time)+"秒后重试",1)):d("",!0),r(e).status!=1&&r(e).status!=3?(u(),x(l,{key:1,size:"tiny",type:"primary",class:"ml-2",onClick:h},{default:m(()=>[N(" 立即连接 ")]),_:1})):d("",!0),r(e).status==1?(u(),x(l,{key:2,size:"tiny",type:"error",class:"ml-2",onClick:v},{default:m(()=>[N("断开")]),_:1})):d("",!0)]),default:m(()=>[k(a,{show:"",dot:"",color:r(y).color},null,8,["color"])]),_:1})])}}});export{G as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.