diff --git a/assets/index-OpgRCqNQ.js b/assets/index-SNRgOskI.js similarity index 99% rename from assets/index-OpgRCqNQ.js rename to assets/index-SNRgOskI.js index 468dfca..5ec9122 100644 --- a/assets/index-OpgRCqNQ.js +++ b/assets/index-SNRgOskI.js @@ -21,4 +21,4 @@ */let oo;const zs=e=>oo=e,lo=Symbol();function Cn(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Zt;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Zt||(Zt={}));function na(){const e=ri(!0),t=e.run(()=>G({}));let s=[],n=[];const r=Kn({install(i){zs(r),r._a=i,i.provide(lo,r),i.config.globalProperties.$pinia=r,n.forEach(o=>s.push(o)),n=[]},use(i){return!this._a&&!sa?n.push(i):s.push(i),this},_p:s,_a:null,_e:e,_s:new Map,state:t});return r}const co=()=>{};function $r(e,t,s,n=co){e.push(t);const r=()=>{const i=e.indexOf(t);i>-1&&(e.splice(i,1),n())};return!s&&ii()&&jo(r),r}function Ct(e,...t){e.slice().forEach(s=>{s(...t)})}const ra=e=>e(),Vr=Symbol(),dn=Symbol();function On(e,t){e instanceof Map&&t instanceof Map?t.forEach((s,n)=>e.set(n,s)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const s in t){if(!t.hasOwnProperty(s))continue;const n=t[s],r=e[s];Cn(r)&&Cn(n)&&e.hasOwnProperty(s)&&!ae(n)&&!it(n)?e[s]=On(r,n):e[s]=n}return e}const ia=Symbol();function oa(e){return!Cn(e)||!e.hasOwnProperty(ia)}const{assign:ct}=Object;function la(e){return!!(ae(e)&&e.effect)}function ca(e,t,s,n){const{state:r,actions:i,getters:o}=t,l=s.state.value[e];let c;function u(){l||(s.state.value[e]=r?r():{});const f=hl(s.state.value[e]);return ct(f,i,Object.keys(o||{}).reduce((h,_)=>(h[_]=Kn(Ks(()=>{zs(s);const y=s._s.get(e);return o[_].call(y,y)})),h),{}))}return c=ao(e,u,t,s,n,!0),c}function ao(e,t,s={},n,r,i){let o;const l=ct({actions:{}},s),c={deep:!0};let u,f,h=[],_=[],y;const S=n.state.value[e];!i&&!S&&(n.state.value[e]={}),G({});let I;function z(P){let A;u=f=!1,typeof P=="function"?(P(n.state.value[e]),A={type:Zt.patchFunction,storeId:e,events:y}):(On(n.state.value[e],P),A={type:Zt.patchObject,payload:P,storeId:e,events:y});const D=I=Symbol();Si().then(()=>{I===D&&(u=!0)}),f=!0,Ct(h,A,n.state.value[e])}const L=i?function(){const{state:A}=s,D=A?A():{};this.$patch(w=>{ct(w,D)})}:co;function O(){o.stop(),h=[],_=[],n._s.delete(e)}const $=(P,A="")=>{if(Vr in P)return P[dn]=A,P;const D=function(){zs(n);const w=Array.from(arguments),B=[],X=[];function fe(Y){B.push(Y)}function et(Y){X.push(Y)}Ct(_,{args:w,name:D[dn],store:J,after:fe,onError:et});let ue;try{ue=P.apply(this&&this.$id===e?this:J,w)}catch(Y){throw Ct(X,Y),Y}return ue instanceof Promise?ue.then(Y=>(Ct(B,Y),Y)).catch(Y=>(Ct(X,Y),Promise.reject(Y))):(Ct(B,ue),ue)};return D[Vr]=!0,D[dn]=A,D},k={_p:n,$id:e,$onAction:$r.bind(null,_),$patch:z,$reset:L,$subscribe(P,A={}){const D=$r(h,P,A.detached,()=>w()),w=o.run(()=>xe(()=>n.state.value[e],B=>{(A.flush==="sync"?f:u)&&P({storeId:e,type:Zt.direct,events:y},B)},ct({},c,A)));return D},$dispose:O},J=Hs(k);n._s.set(e,J);const q=(n._a&&n._a.runWithContext||ra)(()=>n._e.run(()=>(o=ri()).run(()=>t({action:$}))));for(const P in q){const A=q[P];if(ae(A)&&!la(A)||it(A))i||(S&&oa(A)&&(ae(A)?A.value=S[P]:On(A,S[P])),n.state.value[e][P]=A);else if(typeof A=="function"){const D=$(A,P);q[P]=D,l.actions[P]=A}}return ct(J,q),ct(ee(J),q),Object.defineProperty(J,"$state",{get:()=>n.state.value[e],set:P=>{z(A=>{ct(A,P)})}}),n._p.forEach(P=>{ct(J,o.run(()=>P({store:J,app:n._a,pinia:n,options:l})))}),S&&i&&s.hydrate&&s.hydrate(J.$state,S),u=!0,f=!0,J}/*! #__NO_SIDE_EFFECTS__ */function Ys(e,t,s){let n,r;const i=typeof t=="function";typeof e=="string"?(n=e,r=i?s:t):(r=e,n=e.id);function o(l,c){const u=zl();return l=l||(u?Xt(lo,null):null),l&&zs(l),l=oo,l._s.has(n)||(i?ao(n,t,r,l):ca(n,r,l)),l._s.get(n)}return o.$id=n,o}function je(e){{const t=ee(e),s={};for(const n in t){const r=t[n];r.effect?s[n]=Ks({get:()=>e[n],set(i){e[n]=i}}):(ae(r)||it(r))&&(s[n]=_l(e,n))}return s}}const aa="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M21.4%207.5C22.2%208.3%2022.2%209.6%2021.4%2010.3L18.6%2013.1L10.8%205.3L13.6%202.5C14.4%201.7%2015.7%201.7%2016.4%202.5L18.2%204.3L21.2%201.3L22.6%202.7L19.6%205.7L21.4%207.5M15.6%2013.3L14.2%2011.9L11.4%2014.7L9.3%2012.6L12.1%209.8L10.7%208.4L7.9%2011.2L6.4%209.8L3.6%2012.6C2.8%2013.4%202.8%2014.7%203.6%2015.4L5.4%2017.2L1.4%2021.2L2.8%2022.6L6.8%2018.6L8.6%2020.4C9.4%2021.2%2010.7%2021.2%2011.4%2020.4L14.2%2017.6L12.8%2016.2L15.6%2013.3Z'%20fill='%23f8f9fa'%20/%3e%3c/svg%3e",Js=Ys("setting",()=>{const e=G(!0);localStorage.getItem("autoDisplayImage")&&(e.value=JSON.parse(localStorage.getItem("autoDisplayImage"))),xe(e,()=>{localStorage.setItem("autoDisplayImage",JSON.stringify(e.value))});const t=G(!0);localStorage.getItem("directlyOpenLink")&&(t.value=JSON.parse(localStorage.getItem("directlyOpenLink"))),xe(t,()=>{localStorage.setItem("directlyOpenLink",JSON.stringify(t.value))});const s=G(10);localStorage.getItem("maxConnectionNumber")&&(s.value=JSON.parse(localStorage.getItem("maxConnectionNumber"))),xe(s,()=>{localStorage.setItem("maxConnectionNumber",JSON.stringify(s.value))});const n=G([{urls:"stun:stun.relay.metered.ca:80"},{urls:"turn:global.relay.metered.ca:80",username:"cf841207b56ebddc17948dde",credential:"0dGvvEm7eq2UaqlW"},{urls:"turn:global.relay.metered.ca:80?transport=tcp",username:"cf841207b56ebddc17948dde",credential:"0dGvvEm7eq2UaqlW"},{urls:"turn:global.relay.metered.ca:443",username:"cf841207b56ebddc17948dde",credential:"0dGvvEm7eq2UaqlW"},{urls:"turns:global.relay.metered.ca:443?transport=tcp",username:"cf841207b56ebddc17948dde",credential:"0dGvvEm7eq2UaqlW"}]);return localStorage.getItem("iceServers")&&(n.value=JSON.parse(localStorage.getItem("iceServers"))),xe(n,()=>{localStorage.setItem("iceServers",JSON.stringify(n.value))}),{autoDisplayImage:e,directlyOpenLink:t,maxConnectionNumber:s,iceServers:n}}),ua={class:"settings-cluster shadow"},fa={class:"setting-item"},da={class:"range-input"},ha={class:"switch-input blur shadow"},pa={class:"switch-input blur shadow"},ma={class:"setting-button"},_a=["disabled"],ga=De({__name:"SettingsModal",emits:["close"],setup(e,{emit:t}){const s=Js(),{maxConnectionNumber:n,iceServers:r,autoDisplayImage:i,directlyOpenLink:o}=je(s),l=t,c=()=>{l("close")},u=G(!0),f=G("Save"),h=G(null),_=G(null),y=G(null),S=G(null);Jn(()=>{h.value=n.value,_.value=r.value.map(L=>JSON.stringify(L)).join(` `),y.value=i.value,S.value=o.value});function I(){var O;n.value!==h.value&&(n.value=h.value);let L=JSON.parse(`[${(O=_.value)==null?void 0:O.split(` `).join(",")}]`);JSON.stringify(r.value)!==JSON.stringify(L)&&(r.value=L),i.value!==y.value&&(i.value=y.value),o.value!==S.value&&(o.value=S.value),c()}const z=()=>{var O;u.value=!1,f.value="Checking...",h.value!==null&&h.value<1&&(h.value=1);let L;try{L=JSON.parse(`[${(O=_.value)==null?void 0:O.split(` -`).join(",")}]`)}catch{u.value=!1,f.value="ICE Servers format incorrect";return}if(L.length===0){u.value=!1,f.value="ICE Servers cannot be empty";return}for(let $ of L)if(!$.urls){u.value=!1,f.value="ICE Servers must have urls property";return}u.value=!0,f.value="Save"};return(L,O)=>(U(),j("div",{class:"overlay blur",onClick:io(c,["self"])},[g("div",ua,[O[12]||(O[12]=g("h2",null,[g("span",{class:"mdi mdi-cog"}),Zn("Settings")],-1)),g("div",fa,[O[8]||(O[8]=g("label",{for:"max-connection-number"},"Max connection number",-1)),g("div",da,[$e(g("input",{type:"range",id:"max-connection-number",class:"blur shadow","onUpdate:modelValue":O[0]||(O[0]=$=>h.value=$),onInput:z,min:"0",max:"16",step:"1"},null,544),[[ks,h.value]]),O[5]||(O[5]=g("div",{class:"range-input-label"},[g("span",null,"0"),g("span",null,"4"),g("span",null,"8"),g("span",null,"12"),g("span",null,"16")],-1))]),O[9]||(O[9]=g("label",{for:"ice-servers"},"ICE Servers",-1)),$e(g("textarea",{id:"ice-servers",class:"blur shadow","onUpdate:modelValue":O[1]||(O[1]=$=>_.value=$),spellcheck:"false",onInput:z},null,544),[[ks,_.value]]),O[10]||(O[10]=g("label",{for:"enable-img-display"},"Auto display image",-1)),g("label",ha,[$e(g("input",{class:"blur shadow",type:"checkbox",id:"enable-img-display","onUpdate:modelValue":O[2]||(O[2]=$=>y.value=$)},null,512),[[Fr,y.value]]),O[6]||(O[6]=g("span",{class:"blur shadow"},null,-1))]),O[11]||(O[11]=g("label",{for:"enable-open-link"},"Directly open link",-1)),g("label",pa,[$e(g("input",{class:"blur shadow",type:"checkbox",id:"enable-open-link","onUpdate:modelValue":O[3]||(O[3]=$=>S.value=$)},null,512),[[Fr,S.value]]),O[7]||(O[7]=g("span",{class:"blur shadow"},null,-1))])]),g("div",ma,[g("button",{onClick:c,class:"cancel-button"},"Cancel"),g("button",{onClick:O[4]||(O[4]=$=>I()),class:ce(["save-button",{error:!u.value}]),disabled:!u.value},Ye(f.value),11,_a)])])]))}}),Re=(e,t)=>{const s=e.__vccOpts||e;for(const[n,r]of t)s[n]=r;return s},ya=Re(ga,[["__scopeId","data-v-e9e3660a"]]),va=De({__name:"HeaderModal",setup(e){const t=G(!1),s=()=>{t.value=!t.value},n="v3.1.9";return(r,i)=>(U(),j(be,null,[g("header",null,[g("div",{class:"header-cluster"},[g("div",{class:"logo-cluster"},[i[2]||(i[2]=g("img",{src:aa,alt:"EasyTransfer Logo"},null,-1)),g("div",{class:"logo-text"},[i[0]||(i[0]=g("h1",null,"EasyTransfer",-1)),g("span",null,Ye(n)),i[1]||(i[1]=g("p",null,"Share simply & stay anonymous.",-1))])]),g("div",{class:"link-cluster"},[g("a",{class:"link-item shadow",onClick:s},i[3]||(i[3]=[g("span",{class:"mdi mdi-cog"},null,-1),g("span",{class:"text"},"Settings",-1)])),i[4]||(i[4]=g("a",{href:"https://github.com/WCY-dt/EasyTransfer",class:"link-item shadow github"},[g("span",{class:"mdi mdi-github"}),g("span",{class:"text"},"Star on GitHub")],-1))])])]),t.value?(U(),qs(ya,{key:0,onClose:s})):me("",!0)],64))}}),ba=Re(va,[["__scopeId","data-v-217cddd7"]]),Ze=Object.create(null);Ze.open="0";Ze.close="1";Ze.ping="2";Ze.pong="3";Ze.message="4";Ze.upgrade="5";Ze.noop="6";const vs=Object.create(null);Object.keys(Ze).forEach(e=>{vs[Ze[e]]=e});const An={type:"error",data:"parser error"},uo=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",fo=typeof ArrayBuffer=="function",ho=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,tr=({type:e,data:t},s,n)=>uo&&t instanceof Blob?s?n(t):jr(t,n):fo&&(t instanceof ArrayBuffer||ho(t))?s?n(t):jr(new Blob([t]),n):n(Ze[e]+(t||"")),jr=(e,t)=>{const s=new FileReader;return s.onload=function(){const n=s.result.split(",")[1];t("b"+(n||""))},s.readAsDataURL(e)};function Wr(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let hn;function Ea(e,t){if(uo&&e.data instanceof Blob)return e.data.arrayBuffer().then(Wr).then(t);if(fo&&(e.data instanceof ArrayBuffer||ho(e.data)))return t(Wr(e.data));tr(e,!1,s=>{hn||(hn=new TextEncoder),t(hn.encode(s))})}const qr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",qt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,s=e.length,n,r=0,i,o,l,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),f=new Uint8Array(u);for(n=0;n>4,f[r++]=(o&15)<<4|l>>2,f[r++]=(l&3)<<6|c&63;return u},Ta=typeof ArrayBuffer=="function",sr=(e,t)=>{if(typeof e!="string")return{type:"message",data:po(e,t)};const s=e.charAt(0);return s==="b"?{type:"message",data:Sa(e.substring(1),t)}:vs[s]?e.length>1?{type:vs[s],data:e.substring(1)}:{type:vs[s]}:An},Sa=(e,t)=>{if(Ta){const s=wa(e);return po(s,t)}else return{base64:!0,data:e}},po=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},mo="",xa=(e,t)=>{const s=e.length,n=new Array(s);let r=0;e.forEach((i,o)=>{tr(i,!1,l=>{n[o]=l,++r===s&&t(n.join(mo))})})},Ra=(e,t)=>{const s=e.split(mo),n=[];for(let r=0;r{const n=s.length;let r;if(n<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,n);else if(n<65536){r=new Uint8Array(3);const i=new DataView(r.buffer);i.setUint8(0,126),i.setUint16(1,n)}else{r=new Uint8Array(9);const i=new DataView(r.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(n))}e.data&&typeof e.data!="string"&&(r[0]|=128),t.enqueue(r),t.enqueue(s)})}})}let pn;function hs(e){return e.reduce((t,s)=>t+s.length,0)}function ps(e,t){if(e[0].length===t)return e.shift();const s=new Uint8Array(t);let n=0;for(let r=0;rMath.pow(2,21)-1){l.enqueue(An);break}r=f*Math.pow(2,32)+u.getUint32(4),n=3}else{if(hs(s)e){l.enqueue(An);break}}}})}const _o=4;function he(e){if(e)return Aa(e)}function Aa(e){for(var t in he.prototype)e[t]=he.prototype[t];return e}he.prototype.on=he.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};he.prototype.once=function(e,t){function s(){this.off(e,s),t.apply(this,arguments)}return s.fn=t,this.on(e,s),this};he.prototype.off=he.prototype.removeListener=he.prototype.removeAllListeners=he.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+e];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var n,r=0;rPromise.resolve().then(t):(t,s)=>s(t,0),Be=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ia="arraybuffer";function go(e,...t){return t.reduce((s,n)=>(e.hasOwnProperty(n)&&(s[n]=e[n]),s),{})}const Na=Be.setTimeout,ka=Be.clearTimeout;function Qs(e,t){t.useNativeTimers?(e.setTimeoutFn=Na.bind(Be),e.clearTimeoutFn=ka.bind(Be)):(e.setTimeoutFn=Be.setTimeout.bind(Be),e.clearTimeoutFn=Be.clearTimeout.bind(Be))}const Pa=1.33;function La(e){return typeof e=="string"?Da(e):Math.ceil((e.byteLength||e.size)*Pa)}function Da(e){let t=0,s=0;for(let n=0,r=e.length;n=57344?s+=3:(n++,s+=4);return s}function yo(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Ba(e){let t="";for(let s in e)e.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(e[s]));return t}function Ma(e){let t={},s=e.split("&");for(let n=0,r=s.length;n{this.readyState="paused",t()};if(this._polling||!this.writable){let n=0;this._polling&&(n++,this.once("pollComplete",function(){--n||s()})),this.writable||(n++,this.once("drain",function(){--n||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const s=n=>{if(this.readyState==="opening"&&n.type==="open"&&this.onOpen(),n.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(n)};Ra(t,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,xa(t,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=yo()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(t,s)}}let vo=!1;try{vo=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Ha=vo;function $a(){}class Va extends Ua{constructor(t){if(super(t),typeof location<"u"){const s=location.protocol==="https:";let n=location.port;n||(n=s?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||n!==t.port}}doWrite(t,s){const n=this.request({method:"POST",data:t});n.on("success",s),n.on("error",(r,i)=>{this.onError("xhr post error",r,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(s,n)=>{this.onError("xhr poll error",s,n)}),this.pollXhr=t}}class Je extends he{constructor(t,s,n){super(),this.createRequest=t,Qs(this,n),this._opts=n,this._method=n.method||"GET",this._uri=s,this._data=n.data!==void 0?n.data:null,this._create()}_create(){var t;const s=go(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(s);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&n.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var r;n.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(n.getResponseHeader("set-cookie"))),n.readyState===4&&(n.status===200||n.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof n.status=="number"?n.status:0)},0))},n.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=Je.requestsCount++,Je.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=$a,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Je.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Je.requestsCount=0;Je.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Gr);else if(typeof addEventListener=="function"){const e="onpagehide"in Be?"pagehide":"unload";addEventListener(e,Gr,!1)}}function Gr(){for(let e in Je.requests)Je.requests.hasOwnProperty(e)&&Je.requests[e].abort()}const ja=function(){const e=bo({xdomain:!1});return e&&e.responseType!==null}();class Wa extends Va{constructor(t){super(t);const s=t&&t.forceBase64;this.supportsBinary=ja&&!s}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Je(bo,this.uri(),t)}}function bo(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Ha))return new XMLHttpRequest}catch{}if(!t)try{return new Be[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Eo=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class qa extends nr{get name(){return"websocket"}doOpen(){const t=this.uri(),s=this.opts.protocols,n=Eo?{}:go(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,s,n)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let s=0;s{try{this.doWrite(n,i)}catch{}r&&Xs(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=yo()),this.supportsBinary||(s.b64=1),this.createUri(t,s)}}const mn=Be.WebSocket||Be.MozWebSocket;class Ga extends qa{createSocket(t,s,n){return Eo?new mn(t,s,n):s?new mn(t,s):new mn(t)}doWrite(t,s){this.ws.send(s)}}class Ka extends nr{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const s=Oa(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=t.readable.pipeThrough(s).getReader(),r=Ca();r.readable.pipeTo(t.writable),this._writer=r.writable.getWriter();const i=()=>{n.read().then(({done:l,value:c})=>{l||(this.onPacket(c),i())}).catch(l=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let s=0;s{r&&Xs(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const za={websocket:Ga,webtransport:Ka,polling:Wa},Ya=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Ja=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function In(e){if(e.length>8e3)throw"URI too long";const t=e,s=e.indexOf("["),n=e.indexOf("]");s!=-1&&n!=-1&&(e=e.substring(0,s)+e.substring(s,n).replace(/:/g,";")+e.substring(n,e.length));let r=Ya.exec(e||""),i={},o=14;for(;o--;)i[Ja[o]]=r[o]||"";return s!=-1&&n!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Xa(i,i.path),i.queryKey=Qa(i,i.query),i}function Xa(e,t){const s=/\/{2,9}/g,n=t.replace(s,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&n.splice(0,1),t.slice(-1)=="/"&&n.splice(n.length-1,1),n}function Qa(e,t){const s={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,r,i){r&&(s[r]=i)}),s}const Nn=typeof addEventListener=="function"&&typeof removeEventListener=="function",bs=[];Nn&&addEventListener("offline",()=>{bs.forEach(e=>e())},!1);class dt extends he{constructor(t,s){if(super(),this.binaryType=Ia,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){const n=In(t);s.hostname=n.host,s.secure=n.protocol==="https"||n.protocol==="wss",s.port=n.port,n.query&&(s.query=n.query)}else s.host&&(s.hostname=In(s.host).host);Qs(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(n=>{const r=n.prototype.name;this.transports.push(r),this._transportsByName[r]=n}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Ma(this.opts.query)),Nn&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},bs.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const s=Object.assign({},this.opts.query);s.EIO=_o,s.transport=t,this.id&&(s.sid=this.id);const n=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&dt.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",dt.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let n=0;n0&&s>this._maxPayload)return this.writeBuffer.slice(0,n);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Xs(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,n){return this._sendPacket("message",t,s,n),this}send(t,s,n){return this._sendPacket("message",t,s,n),this}_sendPacket(t,s,n,r){if(typeof s=="function"&&(r=s,s=void 0),typeof n=="function"&&(r=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;const i={type:t,data:s,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},n=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():t()}):this.upgrading?n():t()),this}_onError(t){if(dt.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Nn&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const n=bs.indexOf(this._offlineEventListener);n!==-1&&bs.splice(n,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}dt.protocol=_o;class Za extends dt{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t{n||(s.send([{type:"ping",data:"probe"}]),s.once("packet",h=>{if(!n)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;dt.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{n||this.readyState!=="closed"&&(f(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const _=new Error("probe error");_.transport=s.name,this.emitReserved("upgradeError",_)}}))};function i(){n||(n=!0,f(),s.close(),s=null)}const o=h=>{const _=new Error("probe error: "+h);_.transport=s.name,i(),this.emitReserved("upgradeError",_)};function l(){o("transport closed")}function c(){o("socket closed")}function u(h){s&&h.name!==s.name&&i()}const f=()=>{s.removeListener("open",r),s.removeListener("error",o),s.removeListener("close",l),this.off("close",c),this.off("upgrading",u)};s.once("open",r),s.once("error",o),s.once("close",l),this.once("close",c),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{n||s.open()},200):s.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const s=[];for(let n=0;nza[r]).filter(r=>!!r)),super(t,n)}};function tu(e,t="",s){let n=e;s=s||typeof location<"u"&&location,e==null&&(e=s.protocol+"//"+s.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=s.protocol+e:e=s.host+e),/^(https?|wss?):\/\//.test(e)||(typeof s<"u"?e=s.protocol+"//"+e:e="https://"+e),n=In(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const i=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+i+":"+n.port+t,n.href=n.protocol+"://"+i+(s&&s.port===n.port?"":":"+n.port),n}const su=typeof ArrayBuffer=="function",nu=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,wo=Object.prototype.toString,ru=typeof Blob=="function"||typeof Blob<"u"&&wo.call(Blob)==="[object BlobConstructor]",iu=typeof File=="function"||typeof File<"u"&&wo.call(File)==="[object FileConstructor]";function rr(e){return su&&(e instanceof ArrayBuffer||nu(e))||ru&&e instanceof Blob||iu&&e instanceof File}function Es(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let s=0,n=e.length;s=0&&e.num{delete this.acks[t];for(let l=0;l{this.io.clearTimeoutFn(i),s.apply(this,l)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...s){return new Promise((n,r)=>{const i=(o,l)=>o?r(o):n(l);i.withError=!0,s.push(i),this.emit(t,...s)})}_addToQueue(t){let s;typeof t[t.length-1]=="function"&&(s=t.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((r,...i)=>n!==this._queue[0]?void 0:(r!==null?n.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(r)):(this._queue.shift(),s&&s(null,...i)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!t||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Q.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(n=>String(n.id)===t)){const n=this.acks[t];delete this.acks[t],n.withError&&n.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Q.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Q.EVENT:case Q.BINARY_EVENT:this.onevent(t);break;case Q.ACK:case Q.BINARY_ACK:this.onack(t);break;case Q.DISCONNECT:this.ondisconnect();break;case Q.CONNECT_ERROR:this.destroy();const n=new Error(t.data.message);n.data=t.data.data,this.emitReserved("connect_error",n);break}}onevent(t){const s=t.data||[];t.id!=null&&s.push(this.ack(t.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const n of s)n.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const s=this;let n=!1;return function(...r){n||(n=!0,s.packet({type:Q.ACK,id:t,data:r}))}}onack(t){const s=this.acks[t.id];typeof s=="function"&&(delete this.acks[t.id],s.withError&&t.data.unshift(null),s.apply(this,t.data))}onconnect(t,s){this.id=t,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Q.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const s=this._anyListeners;for(let n=0;n0&&e.jitter<=1?e.jitter:0,this.attempts=0}Lt.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+s:e-s}return Math.min(e,this.max)|0};Lt.prototype.reset=function(){this.attempts=0};Lt.prototype.setMin=function(e){this.ms=e};Lt.prototype.setMax=function(e){this.max=e};Lt.prototype.setJitter=function(e){this.jitter=e};class Ln extends he{constructor(t,s){var n;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(s=t,t=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Qs(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((n=s.randomizationFactor)!==null&&n!==void 0?n:.5),this.backoff=new Lt({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=t;const r=s.parser||du;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var s;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(s=this.backoff)===null||s===void 0||s.setMin(t),this)}randomizationFactor(t){var s;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(s=this.backoff)===null||s===void 0||s.setJitter(t),this)}reconnectionDelayMax(t){var s;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(s=this.backoff)===null||s===void 0||s.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new eu(this.uri,this.opts);const s=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=He(s,"open",function(){n.onopen(),t&&t()}),i=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},o=He(s,"error",i);if(this._timeout!==!1){const l=this._timeout,c=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),s.close()},l);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(r),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(He(t,"ping",this.onping.bind(this)),He(t,"data",this.ondata.bind(this)),He(t,"error",this.onerror.bind(this)),He(t,"close",this.onclose.bind(this)),He(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(s){this.onclose("parse error",s)}}ondecoded(t){Xs(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,s){let n=this.nsps[t];return n?this._autoConnect&&!n.active&&n.connect():(n=new To(this,t,s),this.nsps[t]=n),n}_destroy(t){const s=Object.keys(this.nsps);for(const n of s)if(this.nsps[n].active)return;this._close()}_packet(t){const s=this.encoder.encode(t);for(let n=0;nt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,s){var n;this.cleanup(),(n=this.engine)===null||n===void 0||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(r=>{r?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",r)):t.onreconnect()}))},s);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const jt={};function ws(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const s=tu(e,t.path||"/socket.io"),n=s.source,r=s.id,i=s.path,o=jt[r]&&i in jt[r].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let c;return l?c=new Ln(n,t):(jt[r]||(jt[r]=new Ln(n,t)),c=jt[r]),s.query&&!t.query&&(t.query=s.queryKey),c.socket(s.path,t)}Object.assign(ws,{Manager:Ln,Socket:To,io:ws,connect:ws});var pu={VITE_SIGNAL_SERVER_URL:"https://easy-transfer.glitch.me/",GITHUB_STATE:"/home/runner/work/_temp/_runner_file_commands/save_state_a0e520c6-0f67-40a2-a7e1-99168faa5e34",STATS_TRP:"true",DEPLOYMENT_BASEPATH:"/opt/runner",DOTNET_NOLOGO:"1",USER:"runner",npm_config_user_agent:"npm/10.9.2 node/v23.5.0 linux x64 workspaces/false ci/github-actions",CI:"true",RUNNER_ENVIRONMENT:"github-hosted",GITHUB_ENV:"/home/runner/work/_temp/_runner_file_commands/set_env_a0e520c6-0f67-40a2-a7e1-99168faa5e34",PIPX_HOME:"/opt/pipx",npm_node_execpath:"/opt/hostedtoolcache/node/23.5.0/x64/bin/node",JAVA_HOME_8_X64:"/usr/lib/jvm/temurin-8-jdk-amd64",SHLVL:"1",npm_config_noproxy:"",HOME:"/home/runner",OLDPWD:"/home/runner/work/EasyTransfer/EasyTransfer",RUNNER_TEMP:"/home/runner/work/_temp",GITHUB_EVENT_PATH:"/home/runner/work/_temp/_github_workflow/event.json",npm_package_json:"/home/runner/work/EasyTransfer/EasyTransfer/client/package.json",JAVA_HOME_11_X64:"/usr/lib/jvm/temurin-11-jdk-amd64",PIPX_BIN_DIR:"/opt/pipx_bin",GITHUB_REPOSITORY_OWNER:"WCY-dt",GRADLE_HOME:"/usr/share/gradle-8.11.1",ANDROID_NDK_LATEST_HOME:"/usr/local/lib/android/sdk/ndk/27.2.12479018",JAVA_HOME_21_X64:"/usr/lib/jvm/temurin-21-jdk-amd64",STATS_RDCL:"true",GITHUB_RETENTION_DAYS:"90",GITHUB_REPOSITORY_OWNER_ID:"55525165",POWERSHELL_DISTRIBUTION_CHANNEL:"GitHub-Actions-ubuntu24",AZURE_EXTENSION_DIR:"/opt/az/azcliextensions",GITHUB_HEAD_REF:"",npm_config_userconfig:"/home/runner/.npmrc",npm_config_local_prefix:"/home/runner/work/EasyTransfer/EasyTransfer/client",SYSTEMD_EXEC_PID:"830",GITHUB_GRAPHQL_URL:"https://api.github.com/graphql",COLOR:"0",NVM_DIR:"/home/runner/.nvm",DOTNET_SKIP_FIRST_TIME_EXPERIENCE:"1",GOROOT_1_21_X64:"/opt/hostedtoolcache/go/1.21.13/x64",JAVA_HOME_17_X64:"/usr/lib/jvm/temurin-17-jdk-amd64",ImageVersion:"20241215.1.0",RUNNER_OS:"Linux",GITHUB_API_URL:"https://api.github.com",GOROOT_1_22_X64:"/opt/hostedtoolcache/go/1.22.10/x64",SWIFT_PATH:"/usr/share/swift/usr/bin",RUNNER_USER:"runner",STATS_V3PS:"true",CHROMEWEBDRIVER:"/usr/local/share/chromedriver-linux64",GOROOT_1_23_X64:"/opt/hostedtoolcache/go/1.23.4/x64",JOURNAL_STREAM:"8:8411",GITHUB_WORKFLOW:"Deploy Client",_:"/opt/hostedtoolcache/node/23.5.0/x64/bin/npm",npm_config_prefix:"/opt/hostedtoolcache/node/23.5.0/x64",npm_config_npm_version:"10.9.2",MEMORY_PRESSURE_WATCH:"/sys/fs/cgroup/system.slice/runner-provisioner.service/memory.pressure",ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE:"/opt/actionarchivecache",STATS_D:"true",GITHUB_RUN_ID:"12464222081",STATS_VMFE:"true",npm_config_cache:"/home/runner/.npm",GITHUB_REF_TYPE:"branch",BOOTSTRAP_HASKELL_NONINTERACTIVE:"1",GITHUB_WORKFLOW_SHA:"dd6a4e300ff22b8db6943c992a529c0d0a4062c2",GITHUB_BASE_REF:"",ImageOS:"ubuntu24",GITHUB_WORKFLOW_REF:"WCY-dt/EasyTransfer/.github/workflows/deploy.yml@refs/heads/main",PERFLOG_LOCATION_SETTING:"RUNNER_PERFLOG",GITHUB_ACTION_REPOSITORY:"",npm_config_node_gyp:"/opt/hostedtoolcache/node/23.5.0/x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",PATH:"/home/runner/work/EasyTransfer/EasyTransfer/client/node_modules/.bin:/home/runner/work/EasyTransfer/EasyTransfer/node_modules/.bin:/home/runner/work/EasyTransfer/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/23.5.0/x64/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/opt/hostedtoolcache/node/23.5.0/x64/bin:/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",ANT_HOME:"/usr/share/ant",DOTNET_MULTILEVEL_LOOKUP:"0",RUNNER_TRACKING_ID:"github_26d83f12-c2b2-440f-a6e2-ffe00f8e1f62",INVOCATION_ID:"8e4b1770a0de4cf08f3add53e5b00f11",RUNNER_TOOL_CACHE:"/opt/hostedtoolcache",NODE:"/opt/hostedtoolcache/node/23.5.0/x64/bin/node",npm_package_name:"client",GITHUB_ACTION:"__run_2",GITHUB_RUN_NUMBER:"103",GITHUB_TRIGGERING_ACTOR:"WCY-dt",RUNNER_ARCH:"X64",XDG_RUNTIME_DIR:"/run/user/1001",AGENT_TOOLSDIRECTORY:"/opt/hostedtoolcache",LANG:"C.UTF-8",VCPKG_INSTALLATION_ROOT:"/usr/local/share/vcpkg",CONDA:"/usr/share/miniconda",RUNNER_NAME:"GitHub Actions 37",XDG_CONFIG_HOME:"/home/runner/.config",STATS_VMD:"true",GITHUB_REF_NAME:"main",GITHUB_REPOSITORY:"WCY-dt/EasyTransfer",STATS_D_D:"true",npm_lifecycle_script:"vite build",STATS_UE:"true",ANDROID_NDK_ROOT:"/usr/local/lib/android/sdk/ndk/27.2.12479018",GITHUB_ACTION_REF:"",DEBIAN_FRONTEND:"noninteractive",GITHUB_REPOSITORY_ID:"816812807",GITHUB_ACTIONS:"true",STATS_PIP:"false",npm_package_version:"3.1.9",npm_lifecycle_event:"build",GITHUB_REF_PROTECTED:"false",GITHUB_WORKSPACE:"/home/runner/work/EasyTransfer/EasyTransfer",ACCEPT_EULA:"Y",GITHUB_JOB:"build-and-deploy",RUNNER_PERFLOG:"/home/runner/perflog",GITHUB_SHA:"dd6a4e300ff22b8db6943c992a529c0d0a4062c2",GITHUB_RUN_ATTEMPT:"1",STATS_D_TC:"true",GITHUB_REF:"refs/heads/main",GITHUB_ACTOR:"WCY-dt",ANDROID_SDK_ROOT:"/usr/local/lib/android/sdk",npm_config_globalconfig:"/opt/hostedtoolcache/node/23.5.0/x64/etc/npmrc",npm_config_init_module:"/home/runner/.npm-init.js",GITHUB_PATH:"/home/runner/work/_temp/_runner_file_commands/add_path_a0e520c6-0f67-40a2-a7e1-99168faa5e34",JAVA_HOME:"/usr/lib/jvm/temurin-17-jdk-amd64",PWD:"/home/runner/work/EasyTransfer/EasyTransfer/client",GITHUB_ACTOR_ID:"55525165",RUNNER_WORKSPACE:"/home/runner/work/EasyTransfer",npm_execpath:"/opt/hostedtoolcache/node/23.5.0/x64/lib/node_modules/npm/bin/npm-cli.js",HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS:"3650",GITHUB_EVENT_NAME:"push",HOMEBREW_NO_AUTO_UPDATE:"1",ANDROID_HOME:"/usr/local/lib/android/sdk",GITHUB_SERVER_URL:"https://github.com",GECKOWEBDRIVER:"/usr/local/share/gecko_driver",GHCUP_INSTALL_BASE_PREFIX:"/usr/local",GITHUB_OUTPUT:"/home/runner/work/_temp/_runner_file_commands/set_output_a0e520c6-0f67-40a2-a7e1-99168faa5e34",npm_config_global_prefix:"/opt/hostedtoolcache/node/23.5.0/x64",EDGEWEBDRIVER:"/usr/local/share/edge_driver",STATS_EXT:"true",npm_command:"run-script",ANDROID_NDK:"/usr/local/lib/android/sdk/ndk/27.2.12479018",SGX_AESM_ADDR:"1",CHROME_BIN:"/usr/bin/google-chrome",SELENIUM_JAR_PATH:"/usr/share/java/selenium-server.jar",MEMORY_PRESSURE_WRITE:"c29tZSAyMDAwMDAgMjAwMDAwMAA=",STATS_EXTP:"https://provjobdprod.z13.web.core.windows.net/settings/provjobdsettings-latest/provjobd.data",ANDROID_NDK_HOME:"/usr/local/lib/android/sdk/ndk/27.2.12479018",GITHUB_STEP_SUMMARY:"/home/runner/work/_temp/_runner_file_commands/step_summary_a0e520c6-0f67-40a2-a7e1-99168faa5e34",INIT_CWD:"/home/runner/work/EasyTransfer/EasyTransfer/client",EDITOR:"vi",NODE_ENV:"production"};const xt=Ys("connect",()=>{const e=Js(),{maxConnectionNumber:t,iceServers:s}=je(e),n=pu.VITE_SIGNAL_SERVER_URL;let r=null;const i=G(null),o=G(!1),l=G("LOADING"),c=G("");let u=[];const f=G(!1),h=G([]),_=1024*16,y=10;function S(){h.value=[];const K={iceServers:s.value};r=ws(n),i.value=new RTCPeerConnection(K),O(),k()}async function I(){r==null||r.emit("register",t.value)}function z(){var K;(K=i.value)==null||K.createOffer().then(q=>{var P;return(P=i.value)==null?void 0:P.setLocalDescription(q)}).then(()=>{var q;r==null||r.emit("offer",(q=i.value)==null?void 0:q.localDescription,l.value,c.value)}),L()}function L(){i.value.onicecandidate=K=>{K.candidate&&(r==null||r.emit("candidate",K.candidate,c.value))}}function O(){r==null||r.on("success",K=>{l.value=K,o.value=!0}),r==null||r.on("disconnect",()=>{o.value=!1,window.location.reload()}),r==null||r.on("offer",(K,q,P)=>{var A;c.value=q,t.value=P,(A=i.value)==null||A.setRemoteDescription(new RTCSessionDescription(K)).then(()=>{var D;return(D=i.value)==null?void 0:D.createAnswer()}).then(D=>{var w;return(w=i.value)==null?void 0:w.setLocalDescription(D)}).then(()=>{var D;r==null||r.emit("answer",(D=i.value)==null?void 0:D.localDescription,l.value,c.value)}).then(()=>{$()}),L()}),r==null||r.on("answer",(K,q)=>{var P;c.value===q?(P=i.value)==null||P.setRemoteDescription(new RTCSessionDescription(K)).then(()=>{$()}):console.error(`[ERROR] Received answer from unexpected id: ${q}`)}),r==null||r.on("candidate",K=>{var q;(q=i.value)!=null&&q.remoteDescription?i.value.addIceCandidate(new RTCIceCandidate(K)):u.push(K)})}function $(){var K;for(;u.length;)(K=i.value)==null||K.addIceCandidate(new RTCIceCandidate(u.shift()))}function k(){var K;for(let q=0;q{f.value=!0},P.onerror=A=>{console.error(`[ERR] Data channel error: ${A}`),f.value=!1},P.onclose=()=>{f.value=!1},h.value.push(P))}}function J(){return h.value.map(q=>q.readyState).every(q=>q==="open")?"open":"pending"}return xe([s,t],async()=>{i.value&&(console.warn("[INFO] ===Reconnecting==="),await Promise.all(h.value.map(K=>K.close())),i.value.close(),r==null||r.disconnect(),window.location.reload())}),{peerConnection:i,isConnectSuccess:f,registered:o,clientId:l,targetId:c,sendChannels:h,maxBufferedAmount:_,initializeConnection:S,registerClient:I,connectTarget:z,getSendChannelState:J}}),mu={class:"id-cluster"},_u={class:"cover blur"},gu={key:0,class:"mdi mdi-check-bold"},yu={key:1,class:"mdi mdi-content-copy"},vu=["disabled"],bu={key:0,class:"mdi mdi-dots-horizontal"},Eu={key:1,class:"mdi mdi-connection"},wu=De({__name:"OperationId",setup(e){const t=xt();t.initializeConnection();const{isConnectSuccess:s,registered:n,clientId:r,targetId:i}=je(t),o=G(!1),l=G(!1),c=G(!1),u=Ks(()=>({disabled:!o.value&&!s.value||!n.value,ready:o.value&&!s.value&&n.value,success:!o.value&&s.value&&n.value}));xe(i,y=>{y!==y.toUpperCase()&&(i.value=y.toUpperCase()),f(y)}),xe(s,y=>{y&&(o.value=!1),l.value=!1});function f(y){o.value=y.length===4,s.value=!1}function h(){n.value&&(navigator.clipboard.writeText(r.value),c.value=!0,setTimeout(()=>{c.value=!1},1e3))}function _(){l.value=!0,i.value=i.value.toUpperCase(),t.connectTarget()}return Jn(async()=>{await t.registerClient()}),(y,S)=>(U(),j("div",mu,[g("div",{class:ce(["clientId-cluster",V(r)==="LOADING"?"disabled":"ready"]),onClick:h},[Zn(Ye(V(r))+" ",1),g("div",_u,[c.value?(U(),j("span",gu)):(U(),j("span",yu))])],2),g("div",{class:ce(["targetId-cluster shadow",u.value])},[S[1]||(S[1]=g("span",{class:"input-hint shadow"},"Enter the peer's code",-1)),$e(g("input",{type:"text",id:"targetIdInput",class:"targetId-input blur",placeholder:"code",maxlength:"4","onUpdate:modelValue":S[0]||(S[0]=I=>ae(i)?i.value=I:null)},null,512),[[ks,V(i)]]),g("button",{id:"connectButton",class:"connect-button",disabled:!o.value||!V(n),onClick:_},[l.value?(U(),j("span",bu)):(U(),j("span",Eu))],8,vu)],2)]))}}),Tu=Re(wu,[["__scopeId","data-v-1333dbcb"]]),Zs=Ys("send",()=>{const e=xt(),{sendChannels:t}=je(e),s=G([]);function n(w,B,X,fe,et){s.value.push({url:w,name:B,size:X,progress:fe,type:et}),s.value=[...s.value]}async function r(w,B){s.value[w].progress=B,s.value=[...s.value]}async function i(w,B){s.value[w].url=B,s.value=[...s.value]}async function o(w,B){s.value[w].success=B,s.value=[...s.value]}let l=-1,c=[];for(let w=0;w{await f()};async function u(w,B=!1){c.push(w),await f(B)}async function f(w){let B=null;if(w)B=t.value[0];else{const X=Math.floor(Math.random()*t.value.length);B=t.value[X]}for(;c.length>0&&B.bufferedAmount<=e.maxBufferedAmount;){let X=c.shift();!(X instanceof ArrayBuffer)&&!ArrayBuffer.isView(X)&&(X=new TextEncoder().encode(X)),B.send(new Uint8Array(X))}}let h="";const _=G("Drop file here or click to upload"),y=G(0),S=16384;let I=null;const z=G(0);async function L(w,B){const X=w.length;if(X===0){console.error("[ERR] No file selected");return}for(let fe=0;fenew Promise((ue,Y)=>{const te=new FileReader;te.onload=async Ce=>{var Oe,Dt,cs;const lt=new Uint8Array(2);lt[0]=(et&65280)>>8,lt[1]=et&255;const Fe=new Uint8Array(((Oe=Ce.target)==null?void 0:Oe.result).byteLength+2);Fe.set(lt,0),Fe.set(new Uint8Array((Dt=Ce.target)==null?void 0:Dt.result),2),await u(Fe),z.value=z.value+((cs=Ce.target)==null?void 0:cs.result).byteLength,z.value{Y(Ce)},te.readAsArrayBuffer(fe)}));await Promise.all(X)}async function K(){I=new FileReader,I.addEventListener("error",w=>{console.error(`[ERR] Error reading file: ${w}`)}),I.addEventListener("abort",w=>{console.log(`[INFO] File reading aborted: ${w}`)})}function q(w){return w===0?(console.error("[ERR] File is empty"),!1):e.getSendChannelState()!=="open"?(console.error("[ERR] Data channel is not open"),!1):!0}async function P(w){await A(w)}async function A(w){D(w)&&(await u("CONTENT_METAtTRANSFER_TYPE_TEXT",!0),await u("CONTENT_METAn"+w,!0),await u("CONTENT_METAs"+w.length,!0),n("javascript:void(0)",w,w.length,w.length,"TRANSFER_TYPE_TEXT"),l++,o(l,!0))}function D(w){return w===""?(console.error("[ERR] Text is empty"),!1):e.getSendChannelState()!=="open"?(console.error("[ERR] Data channel is not open"),!1):!0}return{uploadFileItems:s,sendFiles:L,sendText:P,processQueue:f}}),Su=["disabled"],xu=["disabled"],Ru={key:0,class:"upload-text-title"},Cu={key:1,class:"upload-text-title"},Ou=De({__name:"UploadText",setup(e){const t=xt(),{isConnectSuccess:s}=je(t),n=Zs(),r=G(""),i=G(!1);function o(){s.value&&(n.sendText(r.value),i.value=!0,setTimeout(()=>{i.value=!1,r.value=""},1e3))}return(l,c)=>(U(),j("div",{id:"text",class:ce(["upload-text-cluster",{disabled:!V(s),active:V(s)}])},[$e(g("textarea",{id:"textInput",class:"text-input blur",placeholder:"Send a short message...",disabled:!V(s),"onUpdate:modelValue":c[0]||(c[0]=u=>r.value=u),ref:"textInput.value"},null,8,Su),[[ks,r.value]]),g("button",{id:"sendButton",class:"send-button",disabled:!V(s),onClick:o},[g("span",{class:ce(["mdi",{"mdi-send":!i.value,"mdi-check-bold":i.value}])},null,2),i.value?(U(),j("p",Cu,"Succeed")):(U(),j("p",Ru,"Send Message"))],8,xu)],2))}}),Au=Re(Ou,[["__scopeId","data-v-c9d5339b"]]),Iu=["disabled"],Nu=De({__name:"UploadFile",setup(e){const t=xt(),{isConnectSuccess:s}=je(t),n=Zs(),r=G(null);async function i(){r.value&&r.value.files&&await n.sendFiles(r.value.files,"TRANSFER_TYPE_FILE")}async function o(c){s.value&&(c.preventDefault(),r.value&&(r.value.files=c.dataTransfer.files,await i()))}function l(){s.value&&r.value&&r.value.click()}return(c,u)=>(U(),j("div",{id:"dropzone",class:ce(["upload-file-cluster",{disabled:!V(s),active:V(s)}]),onDragover:u[0]||(u[0]=io(()=>{},["prevent"])),onDrop:o,onClick:l},[g("input",{type:"file",id:"fileInput",class:"file-input",title:"Choose a file to send",multiple:"",onChange:i,ref_key:"fileInput",ref:r,disabled:!V(s)},null,40,Iu),u[1]||(u[1]=g("span",{class:"mdi mdi-file-upload"},null,-1)),u[2]||(u[2]=g("p",{class:"file-input-title"},"File",-1))],34))}}),ku=Re(Nu,[["__scopeId","data-v-c6830b04"]]),Pu={id:"cameradisplay",class:"camera-display-cluster"},Lu=De({__name:"UploadPhoto",setup(e){const t=xt(),{isConnectSuccess:s}=je(t),n=Zs(),r=G(!1),i=G(!1),o=G(!1),l=G(null),c=G(null);function u(){s.value&&navigator.mediaDevices.getUserMedia({audio:!1,video:{facingMode:"environment"}}).then(S=>{window.stream=S,l.value&&(l.value.srcObject=S),i.value=!0,o.value=!0}).catch(S=>{console.error(`[ERR] GetUserMedia error: ${S}`),i.value=!1,o.value=!1,alert("Please allow camera access to use this feature")})}function f(){if(c.value&&l.value){c.value.width=l.value.videoWidth,c.value.height=l.value.videoHeight;const S=c.value.getContext("2d");S&&S.drawImage(l.value,0,0,c.value.width,c.value.height),window.stream.getTracks().forEach(I=>I.stop()),o.value=!1}}function h(){window.stream.getTracks().forEach(S=>S.stop()),i.value=!1,o.value=!1}async function _(){c.value&&c.value.toBlob(async function(S){if(S){const I=new Date().getTime(),z=new File([S],`image_${I}.png`,{type:"image/png"});await n.sendFiles([z],"TRANSFER_TYPE_FILE")}},"image/png")}async function y(){s.value&&(await _(),r.value=!0,setTimeout(()=>{r.value=!1,h()},1e3))}return(S,I)=>(U(),j(be,null,[$e(g("div",Pu,[g("button",{class:"close-button mdi mdi-close",onClick:h}),$e(g("video",{class:"stream-display",ref_key:"stream",ref:l,autoplay:"",playsinline:""},null,512),[[$t,o.value]]),$e(g("button",{class:"snapshot-button mdi mdi-camera",onClick:f},null,512),[[$t,o.value]]),$e(g("canvas",{class:"photo-display",ref_key:"photo",ref:c},null,512),[[$t,!o.value]]),$e(g("button",{class:ce(["send-button mdi",{"mdi-send":!r.value,"mdi-check-bold":r.value}]),onClick:y},null,2),[[$t,!o.value]])],512),[[$t,i.value]]),g("div",{id:"camera",class:ce(["upload-photo-cluster",{disabled:!V(s),active:V(s)}]),onClick:u},I[0]||(I[0]=[g("span",{class:"mdi mdi-camera"},null,-1),g("p",{class:"upload-photo-title"},"Photo",-1)]),2)],64))}}),Du=Re(Lu,[["__scopeId","data-v-34f1046f"]]),Bu={id:"upload",class:"upload-cluster"},Mu=De({__name:"UploadModal",setup(e){return(t,s)=>(U(),j("div",Bu,[de(ku),de(Du),de(Au)]))}}),Fu=Re(Mu,[["__scopeId","data-v-ce8de059"]]),Uu={class:"operation-cluster"},Hu=De({__name:"OperationModal",setup(e){return(t,s)=>(U(),j("div",Uu,[de(Tu),de(Fu)]))}}),$u=Re(Hu,[["__scopeId","data-v-af70de5b"]]);function Ps(e){return!!Vu.test(e)}function So(e){return Co.some(t=>e.toLowerCase().endsWith(t))}function xo(e){return Oo.some(t=>e.toLowerCase().endsWith(t))}function Ro(e){const t=e.toLowerCase();for(const[s,n]of Object.entries(ju))if(n.some(r=>t.endsWith(r)))return s;return"mdi-file-document"}const Vu=new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$","i"),Co=[".png",".jpg",".jpeg",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif",".heic",".raw"],Oo=[".mp4",".mkv",".avi",".mov",".wmv",".flv",".webm",".mpeg",".mpg",".m4v",".3gp",".3g2"],ju={"mdi-file-image":Co,"mdi-file-word":[".doc",".docx",".odt",".rtf",".txt",".wps",".wpd"],"mdi-file-table":[".xls",".xlsx",".ods",".csv",".tsv",".xlsm",".xlsb"],"mdi-file-powerpoint":[".ppt",".pptx",".odp",".pps",".ppsx",".pot",".potx"],"mdi-file-music":[".mp3",".wav",".flac",".ogg",".aac",".wma",".m4a",".aiff",".alac"],"mdi-file-video":Oo,"mdi-file-code":[".html",".css",".js",".ts",".jsx",".tsx",".json",".xml",".yaml",".yml",".md",".markdown",".cpp",".c",".h",".hpp",".java",".py",".rb",".php",".sql",".sh",".bat",".ps1",".psm1",".psd1",".ps1xml",".pssc",".psc1",".pssc",".pl",".perl",".go",".rs",".swift",".kt",".kts",".clj",".cljs",".scala",".groovy",".gradle",".dockerfile",".properties",".ini",".cfg",".conf",".toml",".yaml",".yml",".json",".xml",".csv",".tsv",".log",".r",".sas",".stata",".do",".m",".mat",".rmd",".ipynb"],"mdi-folder-zip":[".zip",".rar",".7z",".tar",".gz",".bz2",".xz",".lz",".lzma",".lzo",".zst",".z",".tar.gz",".tgz",".tar.bz2",".tbz2",".tar.xz",".txz",".tar.lz",".tlz",".tar.lzma",".tar.lzo",".tar.zst",".tzst"],"mdi-file-cad":[".dwg",".dxf",".dgn",".stl",".obj",".fbx",".3ds",".skp",".step",".stp",".igs",".iges",".x_t",".x_b",".sat",".sab",".3dm",".prt",".asm",".xas",".xpr"],"mdi-file-key":[".key",".pem",".pub",".asc",".gpg",".pgp",".p12",".pfx",".cer",".crt",".der",".keychain",".jks",".keystore",".bks",".pkcs12",".p7b",".p7c",".p7r",".p7s",".p8"]},Wu=["href","download"],qu={class:"upload-item-detail"},Gu={class:"upload-item-name"},Ku=["value","max"],zu=["src"],Yu=["src","controls"],Ju={class:"upload-item-detail"},Xu={class:"upload-item-content"},Qu={key:0,class:"mdi mdi-check-bold"},Zu={key:1,class:"mdi mdi-content-copy"},ef=["href"],tf={class:"upload-item-detail"},sf={class:"upload-item-content"},nf=De({__name:"SendItem",props:{url:{default:"javascript:void(0)"},name:{default:"No file to upload"},size:{default:1},progress:{default:0},type:{default:"TRANSFER_TYPE_FILE"},success:{type:Boolean,default:!1}},setup(e){const t=e,s=Js(),{autoDisplayImage:n,directlyOpenLink:r}=je(s),i=G(!1);function o(){navigator.clipboard.writeText(t.name),i.value=!0,setTimeout(()=>{i.value=!1},1e3)}const l=window.matchMedia("(hover: hover)").matches;return(c,u)=>(U(),j(be,null,[t.type==="TRANSFER_TYPE_FILE"?(U(),j("a",{key:0,ref:"uploadLink",href:t.url,class:ce(["upload-item file shadow",{success:t.success,loading:!t.success}]),download:t.name},[g("span",{class:ce(["mdi",V(Ro)(t.name)])},null,2),g("div",qu,[g("p",Gu,Ye(t.name),1),g("progress",{class:"upload-item-progress",value:t.progress,max:t.size},null,8,Ku),V(So)(t.name)&&t.success&&V(n)?(U(),j("img",{key:0,class:"upload-item-content",src:t.url,alt:"Photo"},null,8,zu)):me("",!0),V(xo)(t.name)&&t.success?(U(),j("video",{key:1,class:"download-item-content",src:t.url,controls:!V(l),muted:"",autoplay:"",loop:""},null,8,Yu)):me("",!0)]),t.success?(U(),j("div",{key:0,class:ce({"copy-cover blur":V(l),"none-hover":!V(l)})},u[0]||(u[0]=[g("span",{class:"mdi mdi-download"},null,-1)]),2)):me("",!0)],10,Wu)):me("",!0),t.type==="TRANSFER_TYPE_TEXT"&&(!V(Ps)(t.name)||!V(r))?(U(),j("div",{key:1,class:ce(["upload-item text shadow",{success:t.success,loading:!t.success}]),onClick:o},[u[1]||(u[1]=g("span",{class:"mdi mdi-message-text"},null,-1)),g("div",Ju,[g("p",Xu,Ye(t.name),1)]),t.success?(U(),j("div",{key:0,class:ce({"copy-cover blur":V(l),"none-hover":!V(l)})},[i.value?(U(),j("span",Qu)):(U(),j("span",Zu))],2)):me("",!0)],2)):me("",!0),t.type==="TRANSFER_TYPE_TEXT"&&V(Ps)(t.name)&&V(r)?(U(),j("a",{key:2,class:ce(["upload-item text shadow",{success:t.success,loading:!t.success}]),onClick:o,href:t.name,target:"_blank",rel:"noopener noreferrer"},[u[3]||(u[3]=g("span",{class:"mdi mdi-link-variant"},null,-1)),g("div",tf,[g("p",sf,Ye(t.name),1)]),t.success?(U(),j("div",{key:0,class:ce({"copy-cover blur":V(l),"none-hover":!V(l)})},u[2]||(u[2]=[g("span",{class:"mdi mdi-open-in-new"},null,-1)]),2)):me("",!0)],10,ef)):me("",!0)],64))}}),rf=Re(nf,[["__scopeId","data-v-22560d61"]]),of={class:"upload-cluster"},lf={key:0,class:"noting-to-upload-text"},cf=De({__name:"SendModal",setup(e){const t=Zs(),s=G([]);return xe(()=>t.uploadFileItems,n=>{s.value=n},{deep:!0}),(n,r)=>(U(),j("div",of,[r[0]||(r[0]=g("div",{class:"upload-cluster-title"},[g("span",{class:"mdi mdi-upload-network"}),g("p",{class:"upload-cluster-title-text"},"Upload")],-1)),s.value.length===0?(U(),j("p",lf," Nothing to upload ")):me("",!0),(U(!0),j(be,null,Pi(s.value,(i,o)=>(U(),qs(rf,{key:o,url:i.url,name:i.name,size:i.size,progress:i.progress,success:i.success,type:i.type},null,8,["url","name","size","progress","success","type"]))),128))]))}}),af=Re(cf,[["__scopeId","data-v-b5e41870"]]),uf=Ys("receive",()=>{const e=xt(),{peerConnection:t}=je(e),s=G([]);function n(A,D,w,B,X){s.value.push({url:A,name:D,size:w,progress:B,type:X}),s.value=[...s.value]}function r(A,D){s.value[A].progress=D,s.value=[...s.value]}function i(A,D){s.value[A].url=D,s.value=[...s.value]}function o(A,D){s.value[A].success=D,s.value=[...s.value]}let l=[],c=[],u="",f="",h=0,_=0,y="",S=[],I=[],z=[],L=-1;function O(){if(!t.value){console.error("[ERR] Peer connection not ready");return}t.value.ondatachannel=A=>{P();const D=A.channel;D.onopen=()=>{},D.onerror=w=>{console.error(`[ERR] Receive channel error: ${w}`)},D.onclose=()=>{window.location.reload()},D.onmessage=w=>{J(w)}}}const $="CONTENT_META",k=new TextEncoder().encode($);async function J(A){const D=new DataView(A.data);let w=!0;for(let B=0;B0&&(u=S.shift(),f=I.shift(),h=z.shift(),L++,console.log(`[INFO] ===Receiving file ${u} | ${f} | ${h}===`));const w=new DataView(A).getUint16(0,!1),B=A.slice(2);l[w]||(_+=B.byteLength),l[w]=B,r(L,_),_===h&&(c=l,y=URL.createObjectURL(new Blob(c)),f.endsWith(".svg")&&(y=URL.createObjectURL(new Blob(c,{type:"image/svg+xml"}))),i(L,y),o(L,!0),P())}function P(){l=[],c=[],u="",f="",h=0,_=0,y=""}return{downloadFileItems:s,receiveFiles:O}}),ff=["href","download"],df={class:"download-item-detail"},hf={class:"download-item-name"},pf=["value","max"],mf=["src"],_f=["src","controls"],gf={class:"download-item-detail"},yf={class:"download-item-content"},vf={key:0,class:"mdi mdi-check-bold"},bf={key:1,class:"mdi mdi-content-copy"},Ef=["href"],wf={class:"download-item-detail"},Tf={class:"download-item-content"},Sf=De({__name:"ReceiveItem",props:{url:{default:"javascript:void(0)"},name:{default:"No file to download"},size:{default:1},progress:{default:0},type:{default:"TRANSFER_TYPE_FILE"},success:{type:Boolean,default:!1}},setup(e){const t=e,s=Js(),{autoDisplayImage:n,directlyOpenLink:r}=je(s),i=G(!1);function o(){navigator.clipboard.writeText(t.name),i.value=!0,setTimeout(()=>{i.value=!1},1e3)}const l=window.matchMedia("(hover: hover)").matches;return(c,u)=>(U(),j(be,null,[t.type==="TRANSFER_TYPE_FILE"?(U(),j("a",{key:0,ref:"downloadLink",href:t.url,class:ce(["download-item file shadow",{success:t.success,loading:!t.success}]),download:t.name},[g("span",{class:ce(["mdi",V(Ro)(t.name)])},null,2),g("div",df,[g("p",hf,Ye(t.name),1),g("progress",{class:"download-item-progress",value:t.progress,max:t.size},null,8,pf),V(So)(t.name)&&t.success&&V(n)?(U(),j("img",{key:0,class:"download-item-content",src:t.url,alt:"Photo"},null,8,mf)):me("",!0),V(xo)(t.name)&&t.success?(U(),j("video",{key:1,class:"download-item-content",src:t.url,controls:!V(l),muted:"",autoplay:"",loop:""},null,8,_f)):me("",!0)]),t.success?(U(),j("div",{key:0,class:ce({"copy-cover blur":V(l),"none-hover":!V(l)})},u[0]||(u[0]=[g("span",{class:"mdi mdi-download"},null,-1)]),2)):me("",!0)],10,ff)):me("",!0),t.type==="TRANSFER_TYPE_TEXT"&&(!V(Ps)(t.name)||!V(r))?(U(),j("div",{key:1,class:ce(["download-item text shadow",{success:t.success,loading:!t.success}]),onClick:o},[u[1]||(u[1]=g("span",{class:"mdi mdi-message-text"},null,-1)),g("div",gf,[g("p",yf,Ye(t.name),1)]),t.success?(U(),j("div",{key:0,class:ce({"copy-cover blur":V(l),"none-hover":!V(l)})},[i.value?(U(),j("span",vf)):(U(),j("span",bf))],2)):me("",!0)],2)):me("",!0),t.type==="TRANSFER_TYPE_TEXT"&&V(Ps)(t.name)&&V(r)?(U(),j("a",{key:2,class:ce(["download-item text shadow",{success:t.success,loading:!t.success}]),onClick:o,href:t.name,target:"_blank",rel:"noopener noreferrer"},[u[3]||(u[3]=g("span",{class:"mdi mdi-link-variant"},null,-1)),g("div",wf,[g("p",Tf,Ye(t.name),1)]),t.success?(U(),j("div",{key:0,class:ce({"copy-cover blur":V(l),"none-hover":!V(l)})},u[2]||(u[2]=[g("span",{class:"mdi mdi-open-in-new"},null,-1)]),2)):me("",!0)],10,Ef)):me("",!0)],64))}}),xf=Re(Sf,[["__scopeId","data-v-5ed08d2f"]]),Rf={class:"download-cluster"},Cf={key:0,class:"noting-to-download-text"},Of=De({__name:"ReceiveModal",setup(e){const t=xt(),s=uf(),{isConnectSuccess:n}=je(t),r=G([]);return xe(n,i=>{i&&s.receiveFiles()}),xe(()=>s.downloadFileItems,i=>{r.value=i},{deep:!0}),(i,o)=>(U(),j("div",Rf,[o[0]||(o[0]=g("div",{class:"download-cluster-title"},[g("span",{class:"mdi mdi-download-network"}),g("p",{class:"download-cluster-title-text"},"Download")],-1)),r.value.length===0?(U(),j("p",Cf," Nothing to download ")):me("",!0),(U(!0),j(be,null,Pi(r.value,(l,c)=>(U(),qs(xf,{key:c,url:l.url,name:l.name,size:l.size,progress:l.progress,success:l.success,type:l.type},null,8,["url","name","size","progress","success","type"]))),128))]))}}),Af=Re(Of,[["__scopeId","data-v-2dba2b30"]]),If={};function Nf(e,t){return U(),j("footer",null,t[0]||(t[0]=[yc('

© 2024 EasyTransfer. All rights reserved.

About | Feedback | GitHub

',2)]))}const kf=Re(If,[["render",Nf],["__scopeId","data-v-cd00c0b7"]]),Pf={id:"app-content"},Lf={class:"app-cluster"},Df=De({__name:"App",setup(e){return(t,s)=>(U(),j(be,null,[de(ba),g("div",Pf,[g("div",Lf,[de($u),de(af),de(Af)])]),de(kf)],64))}}),Bf=Re(Df,[["__scopeId","data-v-e68b6bcc"]]),Ao=Zc(Bf);Ao.use(na());Ao.mount("#app"); +`).join(",")}]`)}catch{u.value=!1,f.value="ICE Servers format incorrect";return}if(L.length===0){u.value=!1,f.value="ICE Servers cannot be empty";return}for(let $ of L)if(!$.urls){u.value=!1,f.value="ICE Servers must have urls property";return}u.value=!0,f.value="Save"};return(L,O)=>(U(),j("div",{class:"overlay blur",onClick:io(c,["self"])},[g("div",ua,[O[12]||(O[12]=g("h2",null,[g("span",{class:"mdi mdi-cog"}),Zn("Settings")],-1)),g("div",fa,[O[8]||(O[8]=g("label",{for:"max-connection-number"},"Max connection number",-1)),g("div",da,[$e(g("input",{type:"range",id:"max-connection-number",class:"blur shadow","onUpdate:modelValue":O[0]||(O[0]=$=>h.value=$),onInput:z,min:"0",max:"16",step:"1"},null,544),[[ks,h.value]]),O[5]||(O[5]=g("div",{class:"range-input-label"},[g("span",null,"0"),g("span",null,"4"),g("span",null,"8"),g("span",null,"12"),g("span",null,"16")],-1))]),O[9]||(O[9]=g("label",{for:"ice-servers"},"ICE Servers",-1)),$e(g("textarea",{id:"ice-servers",class:"blur shadow","onUpdate:modelValue":O[1]||(O[1]=$=>_.value=$),spellcheck:"false",onInput:z},null,544),[[ks,_.value]]),O[10]||(O[10]=g("label",{for:"enable-img-display"},"Auto display image",-1)),g("label",ha,[$e(g("input",{class:"blur shadow",type:"checkbox",id:"enable-img-display","onUpdate:modelValue":O[2]||(O[2]=$=>y.value=$)},null,512),[[Fr,y.value]]),O[6]||(O[6]=g("span",{class:"blur shadow"},null,-1))]),O[11]||(O[11]=g("label",{for:"enable-open-link"},"Directly open link",-1)),g("label",pa,[$e(g("input",{class:"blur shadow",type:"checkbox",id:"enable-open-link","onUpdate:modelValue":O[3]||(O[3]=$=>S.value=$)},null,512),[[Fr,S.value]]),O[7]||(O[7]=g("span",{class:"blur shadow"},null,-1))])]),g("div",ma,[g("button",{onClick:c,class:"cancel-button"},"Cancel"),g("button",{onClick:O[4]||(O[4]=$=>I()),class:ce(["save-button",{error:!u.value}]),disabled:!u.value},Ye(f.value),11,_a)])])]))}}),Re=(e,t)=>{const s=e.__vccOpts||e;for(const[n,r]of t)s[n]=r;return s},ya=Re(ga,[["__scopeId","data-v-e9e3660a"]]),va=De({__name:"HeaderModal",setup(e){const t=G(!1),s=()=>{t.value=!t.value},n="v3.1.9";return(r,i)=>(U(),j(be,null,[g("header",null,[g("div",{class:"header-cluster"},[g("div",{class:"logo-cluster"},[i[2]||(i[2]=g("img",{src:aa,alt:"EasyTransfer Logo"},null,-1)),g("div",{class:"logo-text"},[i[0]||(i[0]=g("h1",null,"EasyTransfer",-1)),g("span",null,Ye(n)),i[1]||(i[1]=g("p",null,"Share simply & stay anonymous.",-1))])]),g("div",{class:"link-cluster"},[g("a",{class:"link-item shadow",onClick:s},i[3]||(i[3]=[g("span",{class:"mdi mdi-cog"},null,-1),g("span",{class:"text"},"Settings",-1)])),i[4]||(i[4]=g("a",{href:"https://github.com/WCY-dt/EasyTransfer",class:"link-item shadow github"},[g("span",{class:"mdi mdi-github"}),g("span",{class:"text"},"Star on GitHub")],-1))])])]),t.value?(U(),qs(ya,{key:0,onClose:s})):me("",!0)],64))}}),ba=Re(va,[["__scopeId","data-v-217cddd7"]]),Ze=Object.create(null);Ze.open="0";Ze.close="1";Ze.ping="2";Ze.pong="3";Ze.message="4";Ze.upgrade="5";Ze.noop="6";const vs=Object.create(null);Object.keys(Ze).forEach(e=>{vs[Ze[e]]=e});const An={type:"error",data:"parser error"},uo=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",fo=typeof ArrayBuffer=="function",ho=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,tr=({type:e,data:t},s,n)=>uo&&t instanceof Blob?s?n(t):jr(t,n):fo&&(t instanceof ArrayBuffer||ho(t))?s?n(t):jr(new Blob([t]),n):n(Ze[e]+(t||"")),jr=(e,t)=>{const s=new FileReader;return s.onload=function(){const n=s.result.split(",")[1];t("b"+(n||""))},s.readAsDataURL(e)};function Wr(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let hn;function Ea(e,t){if(uo&&e.data instanceof Blob)return e.data.arrayBuffer().then(Wr).then(t);if(fo&&(e.data instanceof ArrayBuffer||ho(e.data)))return t(Wr(e.data));tr(e,!1,s=>{hn||(hn=new TextEncoder),t(hn.encode(s))})}const qr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",qt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,s=e.length,n,r=0,i,o,l,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),f=new Uint8Array(u);for(n=0;n>4,f[r++]=(o&15)<<4|l>>2,f[r++]=(l&3)<<6|c&63;return u},Ta=typeof ArrayBuffer=="function",sr=(e,t)=>{if(typeof e!="string")return{type:"message",data:po(e,t)};const s=e.charAt(0);return s==="b"?{type:"message",data:Sa(e.substring(1),t)}:vs[s]?e.length>1?{type:vs[s],data:e.substring(1)}:{type:vs[s]}:An},Sa=(e,t)=>{if(Ta){const s=wa(e);return po(s,t)}else return{base64:!0,data:e}},po=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},mo="",xa=(e,t)=>{const s=e.length,n=new Array(s);let r=0;e.forEach((i,o)=>{tr(i,!1,l=>{n[o]=l,++r===s&&t(n.join(mo))})})},Ra=(e,t)=>{const s=e.split(mo),n=[];for(let r=0;r{const n=s.length;let r;if(n<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,n);else if(n<65536){r=new Uint8Array(3);const i=new DataView(r.buffer);i.setUint8(0,126),i.setUint16(1,n)}else{r=new Uint8Array(9);const i=new DataView(r.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(n))}e.data&&typeof e.data!="string"&&(r[0]|=128),t.enqueue(r),t.enqueue(s)})}})}let pn;function hs(e){return e.reduce((t,s)=>t+s.length,0)}function ps(e,t){if(e[0].length===t)return e.shift();const s=new Uint8Array(t);let n=0;for(let r=0;rMath.pow(2,21)-1){l.enqueue(An);break}r=f*Math.pow(2,32)+u.getUint32(4),n=3}else{if(hs(s)e){l.enqueue(An);break}}}})}const _o=4;function he(e){if(e)return Aa(e)}function Aa(e){for(var t in he.prototype)e[t]=he.prototype[t];return e}he.prototype.on=he.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};he.prototype.once=function(e,t){function s(){this.off(e,s),t.apply(this,arguments)}return s.fn=t,this.on(e,s),this};he.prototype.off=he.prototype.removeListener=he.prototype.removeAllListeners=he.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+e];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var n,r=0;rPromise.resolve().then(t):(t,s)=>s(t,0),Be=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ia="arraybuffer";function go(e,...t){return t.reduce((s,n)=>(e.hasOwnProperty(n)&&(s[n]=e[n]),s),{})}const Na=Be.setTimeout,ka=Be.clearTimeout;function Qs(e,t){t.useNativeTimers?(e.setTimeoutFn=Na.bind(Be),e.clearTimeoutFn=ka.bind(Be)):(e.setTimeoutFn=Be.setTimeout.bind(Be),e.clearTimeoutFn=Be.clearTimeout.bind(Be))}const Pa=1.33;function La(e){return typeof e=="string"?Da(e):Math.ceil((e.byteLength||e.size)*Pa)}function Da(e){let t=0,s=0;for(let n=0,r=e.length;n=57344?s+=3:(n++,s+=4);return s}function yo(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Ba(e){let t="";for(let s in e)e.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(e[s]));return t}function Ma(e){let t={},s=e.split("&");for(let n=0,r=s.length;n{this.readyState="paused",t()};if(this._polling||!this.writable){let n=0;this._polling&&(n++,this.once("pollComplete",function(){--n||s()})),this.writable||(n++,this.once("drain",function(){--n||s()}))}else s()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const s=n=>{if(this.readyState==="opening"&&n.type==="open"&&this.onOpen(),n.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(n)};Ra(t,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,xa(t,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=yo()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(t,s)}}let vo=!1;try{vo=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Ha=vo;function $a(){}class Va extends Ua{constructor(t){if(super(t),typeof location<"u"){const s=location.protocol==="https:";let n=location.port;n||(n=s?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||n!==t.port}}doWrite(t,s){const n=this.request({method:"POST",data:t});n.on("success",s),n.on("error",(r,i)=>{this.onError("xhr post error",r,i)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(s,n)=>{this.onError("xhr poll error",s,n)}),this.pollXhr=t}}class Je extends he{constructor(t,s,n){super(),this.createRequest=t,Qs(this,n),this._opts=n,this._method=n.method||"GET",this._uri=s,this._data=n.data!==void 0?n.data:null,this._create()}_create(){var t;const s=go(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(s);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&n.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var r;n.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(n.getResponseHeader("set-cookie"))),n.readyState===4&&(n.status===200||n.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof n.status=="number"?n.status:0)},0))},n.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=Je.requestsCount++,Je.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=$a,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Je.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Je.requestsCount=0;Je.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Gr);else if(typeof addEventListener=="function"){const e="onpagehide"in Be?"pagehide":"unload";addEventListener(e,Gr,!1)}}function Gr(){for(let e in Je.requests)Je.requests.hasOwnProperty(e)&&Je.requests[e].abort()}const ja=function(){const e=bo({xdomain:!1});return e&&e.responseType!==null}();class Wa extends Va{constructor(t){super(t);const s=t&&t.forceBase64;this.supportsBinary=ja&&!s}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Je(bo,this.uri(),t)}}function bo(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Ha))return new XMLHttpRequest}catch{}if(!t)try{return new Be[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Eo=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class qa extends nr{get name(){return"websocket"}doOpen(){const t=this.uri(),s=this.opts.protocols,n=Eo?{}:go(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,s,n)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let s=0;s{try{this.doWrite(n,i)}catch{}r&&Xs(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=yo()),this.supportsBinary||(s.b64=1),this.createUri(t,s)}}const mn=Be.WebSocket||Be.MozWebSocket;class Ga extends qa{createSocket(t,s,n){return Eo?new mn(t,s,n):s?new mn(t,s):new mn(t)}doWrite(t,s){this.ws.send(s)}}class Ka extends nr{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const s=Oa(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=t.readable.pipeThrough(s).getReader(),r=Ca();r.readable.pipeTo(t.writable),this._writer=r.writable.getWriter();const i=()=>{n.read().then(({done:l,value:c})=>{l||(this.onPacket(c),i())}).catch(l=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let s=0;s{r&&Xs(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const za={websocket:Ga,webtransport:Ka,polling:Wa},Ya=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Ja=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function In(e){if(e.length>8e3)throw"URI too long";const t=e,s=e.indexOf("["),n=e.indexOf("]");s!=-1&&n!=-1&&(e=e.substring(0,s)+e.substring(s,n).replace(/:/g,";")+e.substring(n,e.length));let r=Ya.exec(e||""),i={},o=14;for(;o--;)i[Ja[o]]=r[o]||"";return s!=-1&&n!=-1&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Xa(i,i.path),i.queryKey=Qa(i,i.query),i}function Xa(e,t){const s=/\/{2,9}/g,n=t.replace(s,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&n.splice(0,1),t.slice(-1)=="/"&&n.splice(n.length-1,1),n}function Qa(e,t){const s={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,r,i){r&&(s[r]=i)}),s}const Nn=typeof addEventListener=="function"&&typeof removeEventListener=="function",bs=[];Nn&&addEventListener("offline",()=>{bs.forEach(e=>e())},!1);class dt extends he{constructor(t,s){if(super(),this.binaryType=Ia,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(s=t,t=null),t){const n=In(t);s.hostname=n.host,s.secure=n.protocol==="https"||n.protocol==="wss",s.port=n.port,n.query&&(s.query=n.query)}else s.host&&(s.hostname=In(s.host).host);Qs(this,s),this.secure=s.secure!=null?s.secure:typeof location<"u"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=s.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(n=>{const r=n.prototype.name;this.transports.push(r),this._transportsByName[r]=n}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Ma(this.opts.query)),Nn&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},bs.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const s=Object.assign({},this.opts.query);s.EIO=_o,s.transport=t,this.id&&(s.sid=this.id);const n=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&dt.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const s=this.createTransport(t);s.open(),this.setTransport(s)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){this.readyState="open",dt.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const s=new Error("server error");s.code=t.data,this._onError(s);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let n=0;n0&&s>this._maxPayload)return this.writeBuffer.slice(0,n);s+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Xs(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,s,n){return this._sendPacket("message",t,s,n),this}send(t,s,n){return this._sendPacket("message",t,s,n),this}_sendPacket(t,s,n,r){if(typeof s=="function"&&(r=s,s=void 0),typeof n=="function"&&(r=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;const i={type:t,data:s,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),t()},n=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():t()}):this.upgrading?n():t()),this}_onError(t){if(dt.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Nn&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const n=bs.indexOf(this._offlineEventListener);n!==-1&&bs.splice(n,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,s),this.writeBuffer=[],this._prevBufferLen=0}}}dt.protocol=_o;class Za extends dt{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t{n||(s.send([{type:"ping",data:"probe"}]),s.once("packet",h=>{if(!n)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;dt.priorWebsocketSuccess=s.name==="websocket",this.transport.pause(()=>{n||this.readyState!=="closed"&&(f(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{const _=new Error("probe error");_.transport=s.name,this.emitReserved("upgradeError",_)}}))};function i(){n||(n=!0,f(),s.close(),s=null)}const o=h=>{const _=new Error("probe error: "+h);_.transport=s.name,i(),this.emitReserved("upgradeError",_)};function l(){o("transport closed")}function c(){o("socket closed")}function u(h){s&&h.name!==s.name&&i()}const f=()=>{s.removeListener("open",r),s.removeListener("error",o),s.removeListener("close",l),this.off("close",c),this.off("upgrading",u)};s.once("open",r),s.once("error",o),s.once("close",l),this.once("close",c),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{n||s.open()},200):s.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const s=[];for(let n=0;nza[r]).filter(r=>!!r)),super(t,n)}};function tu(e,t="",s){let n=e;s=s||typeof location<"u"&&location,e==null&&(e=s.protocol+"//"+s.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=s.protocol+e:e=s.host+e),/^(https?|wss?):\/\//.test(e)||(typeof s<"u"?e=s.protocol+"//"+e:e="https://"+e),n=In(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const i=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+i+":"+n.port+t,n.href=n.protocol+"://"+i+(s&&s.port===n.port?"":":"+n.port),n}const su=typeof ArrayBuffer=="function",nu=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,wo=Object.prototype.toString,ru=typeof Blob=="function"||typeof Blob<"u"&&wo.call(Blob)==="[object BlobConstructor]",iu=typeof File=="function"||typeof File<"u"&&wo.call(File)==="[object FileConstructor]";function rr(e){return su&&(e instanceof ArrayBuffer||nu(e))||ru&&e instanceof Blob||iu&&e instanceof File}function Es(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let s=0,n=e.length;s=0&&e.num{delete this.acks[t];for(let l=0;l{this.io.clearTimeoutFn(i),s.apply(this,l)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...s){return new Promise((n,r)=>{const i=(o,l)=>o?r(o):n(l);i.withError=!0,s.push(i),this.emit(t,...s)})}_addToQueue(t){let s;typeof t[t.length-1]=="function"&&(s=t.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((r,...i)=>n!==this._queue[0]?void 0:(r!==null?n.tryCount>this._opts.retries&&(this._queue.shift(),s&&s(r)):(this._queue.shift(),s&&s(null,...i)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const s=this._queue[0];s.pending&&!t||(s.pending=!0,s.tryCount++,this.flags=s.flags,this.emit.apply(this,s.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Q.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,s){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(n=>String(n.id)===t)){const n=this.acks[t];delete this.acks[t],n.withError&&n.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Q.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Q.EVENT:case Q.BINARY_EVENT:this.onevent(t);break;case Q.ACK:case Q.BINARY_ACK:this.onack(t);break;case Q.DISCONNECT:this.ondisconnect();break;case Q.CONNECT_ERROR:this.destroy();const n=new Error(t.data.message);n.data=t.data.data,this.emitReserved("connect_error",n);break}}onevent(t){const s=t.data||[];t.id!=null&&s.push(this.ack(t.id)),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const s=this._anyListeners.slice();for(const n of s)n.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const s=this;let n=!1;return function(...r){n||(n=!0,s.packet({type:Q.ACK,id:t,data:r}))}}onack(t){const s=this.acks[t.id];typeof s=="function"&&(delete this.acks[t.id],s.withError&&t.data.unshift(null),s.apply(this,t.data))}onconnect(t,s){this.id=t,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Q.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const s=this._anyListeners;for(let n=0;n0&&e.jitter<=1?e.jitter:0,this.attempts=0}Lt.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+s:e-s}return Math.min(e,this.max)|0};Lt.prototype.reset=function(){this.attempts=0};Lt.prototype.setMin=function(e){this.ms=e};Lt.prototype.setMax=function(e){this.max=e};Lt.prototype.setJitter=function(e){this.jitter=e};class Ln extends he{constructor(t,s){var n;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(s=t,t=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Qs(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((n=s.randomizationFactor)!==null&&n!==void 0?n:.5),this.backoff=new Lt({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=t;const r=s.parser||du;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var s;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(s=this.backoff)===null||s===void 0||s.setMin(t),this)}randomizationFactor(t){var s;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(s=this.backoff)===null||s===void 0||s.setJitter(t),this)}reconnectionDelayMax(t){var s;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(s=this.backoff)===null||s===void 0||s.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new eu(this.uri,this.opts);const s=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=He(s,"open",function(){n.onopen(),t&&t()}),i=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},o=He(s,"error",i);if(this._timeout!==!1){const l=this._timeout,c=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),s.close()},l);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(r),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(He(t,"ping",this.onping.bind(this)),He(t,"data",this.ondata.bind(this)),He(t,"error",this.onerror.bind(this)),He(t,"close",this.onclose.bind(this)),He(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(s){this.onclose("parse error",s)}}ondecoded(t){Xs(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,s){let n=this.nsps[t];return n?this._autoConnect&&!n.active&&n.connect():(n=new To(this,t,s),this.nsps[t]=n),n}_destroy(t){const s=Object.keys(this.nsps);for(const n of s)if(this.nsps[n].active)return;this._close()}_packet(t){const s=this.encoder.encode(t);for(let n=0;nt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,s){var n;this.cleanup(),(n=this.engine)===null||n===void 0||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const s=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(r=>{r?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",r)):t.onreconnect()}))},s);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const jt={};function ws(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const s=tu(e,t.path||"/socket.io"),n=s.source,r=s.id,i=s.path,o=jt[r]&&i in jt[r].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let c;return l?c=new Ln(n,t):(jt[r]||(jt[r]=new Ln(n,t)),c=jt[r]),s.query&&!t.query&&(t.query=s.queryKey),c.socket(s.path,t)}Object.assign(ws,{Manager:Ln,Socket:To,io:ws,connect:ws});var pu={VITE_SIGNAL_SERVER_URL:"https://easy-transfer.glitch.me/",GITHUB_STATE:"/home/runner/work/_temp/_runner_file_commands/save_state_f19fad45-c8b3-4368-8c5b-6813cf01b520",STATS_TRP:"true",DEPLOYMENT_BASEPATH:"/opt/runner",DOTNET_NOLOGO:"1",USER:"runner",npm_config_user_agent:"npm/10.9.2 node/v23.5.0 linux x64 workspaces/false ci/github-actions",CI:"true",RUNNER_ENVIRONMENT:"github-hosted",GITHUB_ENV:"/home/runner/work/_temp/_runner_file_commands/set_env_f19fad45-c8b3-4368-8c5b-6813cf01b520",PIPX_HOME:"/opt/pipx",npm_node_execpath:"/opt/hostedtoolcache/node/23.5.0/x64/bin/node",JAVA_HOME_8_X64:"/usr/lib/jvm/temurin-8-jdk-amd64",SHLVL:"1",npm_config_noproxy:"",HOME:"/home/runner",OLDPWD:"/home/runner/work/EasyTransfer/EasyTransfer",RUNNER_TEMP:"/home/runner/work/_temp",GITHUB_EVENT_PATH:"/home/runner/work/_temp/_github_workflow/event.json",npm_package_json:"/home/runner/work/EasyTransfer/EasyTransfer/client/package.json",JAVA_HOME_11_X64:"/usr/lib/jvm/temurin-11-jdk-amd64",PIPX_BIN_DIR:"/opt/pipx_bin",GITHUB_REPOSITORY_OWNER:"WCY-dt",GRADLE_HOME:"/usr/share/gradle-8.11.1",ANDROID_NDK_LATEST_HOME:"/usr/local/lib/android/sdk/ndk/27.2.12479018",JAVA_HOME_21_X64:"/usr/lib/jvm/temurin-21-jdk-amd64",STATS_RDCL:"true",GITHUB_RETENTION_DAYS:"90",GITHUB_REPOSITORY_OWNER_ID:"55525165",POWERSHELL_DISTRIBUTION_CHANNEL:"GitHub-Actions-ubuntu24",AZURE_EXTENSION_DIR:"/opt/az/azcliextensions",GITHUB_HEAD_REF:"",npm_config_userconfig:"/home/runner/.npmrc",npm_config_local_prefix:"/home/runner/work/EasyTransfer/EasyTransfer/client",SYSTEMD_EXEC_PID:"829",GITHUB_GRAPHQL_URL:"https://api.github.com/graphql",COLOR:"0",NVM_DIR:"/home/runner/.nvm",DOTNET_SKIP_FIRST_TIME_EXPERIENCE:"1",GOROOT_1_21_X64:"/opt/hostedtoolcache/go/1.21.13/x64",JAVA_HOME_17_X64:"/usr/lib/jvm/temurin-17-jdk-amd64",ImageVersion:"20241215.1.0",RUNNER_OS:"Linux",GITHUB_API_URL:"https://api.github.com",GOROOT_1_22_X64:"/opt/hostedtoolcache/go/1.22.10/x64",SWIFT_PATH:"/usr/share/swift/usr/bin",RUNNER_USER:"runner",STATS_V3PS:"true",CHROMEWEBDRIVER:"/usr/local/share/chromedriver-linux64",GOROOT_1_23_X64:"/opt/hostedtoolcache/go/1.23.4/x64",JOURNAL_STREAM:"8:7655",GITHUB_WORKFLOW:"Deploy Client",_:"/opt/hostedtoolcache/node/23.5.0/x64/bin/npm",npm_config_prefix:"/opt/hostedtoolcache/node/23.5.0/x64",npm_config_npm_version:"10.9.2",MEMORY_PRESSURE_WATCH:"/sys/fs/cgroup/system.slice/runner-provisioner.service/memory.pressure",ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE:"/opt/actionarchivecache",STATS_D:"true",GITHUB_RUN_ID:"12464319516",STATS_VMFE:"true",npm_config_cache:"/home/runner/.npm",GITHUB_REF_TYPE:"branch",BOOTSTRAP_HASKELL_NONINTERACTIVE:"1",GITHUB_WORKFLOW_SHA:"b8dbd038133a1d2fb957b09340fa641fb27a02d0",GITHUB_BASE_REF:"",ImageOS:"ubuntu24",GITHUB_WORKFLOW_REF:"WCY-dt/EasyTransfer/.github/workflows/deploy.yml@refs/heads/main",PERFLOG_LOCATION_SETTING:"RUNNER_PERFLOG",GITHUB_ACTION_REPOSITORY:"",npm_config_node_gyp:"/opt/hostedtoolcache/node/23.5.0/x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",PATH:"/home/runner/work/EasyTransfer/EasyTransfer/client/node_modules/.bin:/home/runner/work/EasyTransfer/EasyTransfer/node_modules/.bin:/home/runner/work/EasyTransfer/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/23.5.0/x64/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/opt/hostedtoolcache/node/23.5.0/x64/bin:/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",ANT_HOME:"/usr/share/ant",DOTNET_MULTILEVEL_LOOKUP:"0",RUNNER_TRACKING_ID:"github_c973c342-e7cc-41b6-bada-33a2ce1d68ca",INVOCATION_ID:"487b08b0e4e14735804b2ab0f15d525d",RUNNER_TOOL_CACHE:"/opt/hostedtoolcache",NODE:"/opt/hostedtoolcache/node/23.5.0/x64/bin/node",npm_package_name:"client",GITHUB_ACTION:"__run_2",GITHUB_RUN_NUMBER:"104",GITHUB_TRIGGERING_ACTOR:"WCY-dt",RUNNER_ARCH:"X64",XDG_RUNTIME_DIR:"/run/user/1001",AGENT_TOOLSDIRECTORY:"/opt/hostedtoolcache",LANG:"C.UTF-8",VCPKG_INSTALLATION_ROOT:"/usr/local/share/vcpkg",CONDA:"/usr/share/miniconda",RUNNER_NAME:"GitHub Actions 21",XDG_CONFIG_HOME:"/home/runner/.config",STATS_VMD:"true",GITHUB_REF_NAME:"main",GITHUB_REPOSITORY:"WCY-dt/EasyTransfer",STATS_D_D:"true",npm_lifecycle_script:"vite build",STATS_UE:"true",ANDROID_NDK_ROOT:"/usr/local/lib/android/sdk/ndk/27.2.12479018",GITHUB_ACTION_REF:"",DEBIAN_FRONTEND:"noninteractive",GITHUB_REPOSITORY_ID:"816812807",GITHUB_ACTIONS:"true",STATS_PIP:"false",npm_package_version:"3.1.9",npm_lifecycle_event:"build",GITHUB_REF_PROTECTED:"false",GITHUB_WORKSPACE:"/home/runner/work/EasyTransfer/EasyTransfer",ACCEPT_EULA:"Y",GITHUB_JOB:"build-and-deploy",RUNNER_PERFLOG:"/home/runner/perflog",GITHUB_SHA:"b8dbd038133a1d2fb957b09340fa641fb27a02d0",GITHUB_RUN_ATTEMPT:"1",STATS_D_TC:"true",GITHUB_REF:"refs/heads/main",GITHUB_ACTOR:"WCY-dt",ANDROID_SDK_ROOT:"/usr/local/lib/android/sdk",npm_config_globalconfig:"/opt/hostedtoolcache/node/23.5.0/x64/etc/npmrc",npm_config_init_module:"/home/runner/.npm-init.js",GITHUB_PATH:"/home/runner/work/_temp/_runner_file_commands/add_path_f19fad45-c8b3-4368-8c5b-6813cf01b520",JAVA_HOME:"/usr/lib/jvm/temurin-17-jdk-amd64",PWD:"/home/runner/work/EasyTransfer/EasyTransfer/client",GITHUB_ACTOR_ID:"55525165",RUNNER_WORKSPACE:"/home/runner/work/EasyTransfer",npm_execpath:"/opt/hostedtoolcache/node/23.5.0/x64/lib/node_modules/npm/bin/npm-cli.js",HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS:"3650",GITHUB_EVENT_NAME:"push",HOMEBREW_NO_AUTO_UPDATE:"1",ANDROID_HOME:"/usr/local/lib/android/sdk",GITHUB_SERVER_URL:"https://github.com",GECKOWEBDRIVER:"/usr/local/share/gecko_driver",GHCUP_INSTALL_BASE_PREFIX:"/usr/local",GITHUB_OUTPUT:"/home/runner/work/_temp/_runner_file_commands/set_output_f19fad45-c8b3-4368-8c5b-6813cf01b520",npm_config_global_prefix:"/opt/hostedtoolcache/node/23.5.0/x64",EDGEWEBDRIVER:"/usr/local/share/edge_driver",STATS_EXT:"true",npm_command:"run-script",ANDROID_NDK:"/usr/local/lib/android/sdk/ndk/27.2.12479018",SGX_AESM_ADDR:"1",CHROME_BIN:"/usr/bin/google-chrome",SELENIUM_JAR_PATH:"/usr/share/java/selenium-server.jar",MEMORY_PRESSURE_WRITE:"c29tZSAyMDAwMDAgMjAwMDAwMAA=",STATS_EXTP:"https://provjobdprod.z13.web.core.windows.net/settings/provjobdsettings-latest/provjobd.data",ANDROID_NDK_HOME:"/usr/local/lib/android/sdk/ndk/27.2.12479018",GITHUB_STEP_SUMMARY:"/home/runner/work/_temp/_runner_file_commands/step_summary_f19fad45-c8b3-4368-8c5b-6813cf01b520",INIT_CWD:"/home/runner/work/EasyTransfer/EasyTransfer/client",EDITOR:"vi",NODE_ENV:"production"};const xt=Ys("connect",()=>{const e=Js(),{maxConnectionNumber:t,iceServers:s}=je(e),n=pu.VITE_SIGNAL_SERVER_URL;let r=null;const i=G(null),o=G(!1),l=G("LOADING"),c=G("");let u=[];const f=G(!1),h=G([]),_=1024*16,y=10;function S(){h.value=[];const K={iceServers:s.value};r=ws(n),i.value=new RTCPeerConnection(K),O(),k()}async function I(){r==null||r.emit("register",t.value)}function z(){var K;(K=i.value)==null||K.createOffer().then(q=>{var P;return(P=i.value)==null?void 0:P.setLocalDescription(q)}).then(()=>{var q;r==null||r.emit("offer",(q=i.value)==null?void 0:q.localDescription,l.value,c.value)}),L()}function L(){i.value.onicecandidate=K=>{K.candidate&&(r==null||r.emit("candidate",K.candidate,c.value))}}function O(){r==null||r.on("success",K=>{l.value=K,o.value=!0}),r==null||r.on("disconnect",()=>{o.value=!1,window.location.reload()}),r==null||r.on("offer",(K,q,P)=>{var A;c.value=q,t.value=P,(A=i.value)==null||A.setRemoteDescription(new RTCSessionDescription(K)).then(()=>{var D;return(D=i.value)==null?void 0:D.createAnswer()}).then(D=>{var w;return(w=i.value)==null?void 0:w.setLocalDescription(D)}).then(()=>{var D;r==null||r.emit("answer",(D=i.value)==null?void 0:D.localDescription,l.value,c.value)}).then(()=>{$()}),L()}),r==null||r.on("answer",(K,q)=>{var P;c.value===q?(P=i.value)==null||P.setRemoteDescription(new RTCSessionDescription(K)).then(()=>{$()}):console.error(`[ERROR] Received answer from unexpected id: ${q}`)}),r==null||r.on("candidate",K=>{var q;(q=i.value)!=null&&q.remoteDescription?i.value.addIceCandidate(new RTCIceCandidate(K)):u.push(K)})}function $(){var K;for(;u.length;)(K=i.value)==null||K.addIceCandidate(new RTCIceCandidate(u.shift()))}function k(){var K;for(let q=0;q{f.value=!0},P.onerror=A=>{console.error(`[ERR] Data channel error: ${A}`),f.value=!1},P.onclose=()=>{f.value=!1},h.value.push(P))}}function J(){return h.value.map(q=>q.readyState).every(q=>q==="open")?"open":"pending"}return xe([s,t],async()=>{i.value&&(console.warn("[INFO] ===Reconnecting==="),await Promise.all(h.value.map(K=>K.close())),i.value.close(),r==null||r.disconnect(),window.location.reload())}),{peerConnection:i,isConnectSuccess:f,registered:o,clientId:l,targetId:c,sendChannels:h,maxBufferedAmount:_,initializeConnection:S,registerClient:I,connectTarget:z,getSendChannelState:J}}),mu={class:"id-cluster"},_u={class:"cover blur"},gu={key:0,class:"mdi mdi-check-bold"},yu={key:1,class:"mdi mdi-content-copy"},vu=["disabled"],bu={key:0,class:"mdi mdi-dots-horizontal"},Eu={key:1,class:"mdi mdi-connection"},wu=De({__name:"OperationId",setup(e){const t=xt();t.initializeConnection();const{isConnectSuccess:s,registered:n,clientId:r,targetId:i}=je(t),o=G(!1),l=G(!1),c=G(!1),u=Ks(()=>({disabled:!o.value&&!s.value||!n.value,ready:o.value&&!s.value&&n.value,success:!o.value&&s.value&&n.value}));xe(i,y=>{y!==y.toUpperCase()&&(i.value=y.toUpperCase()),f(y)}),xe(s,y=>{y&&(o.value=!1),l.value=!1});function f(y){o.value=y.length===4,s.value=!1}function h(){n.value&&(navigator.clipboard.writeText(r.value),c.value=!0,setTimeout(()=>{c.value=!1},1e3))}function _(){l.value=!0,i.value=i.value.toUpperCase(),t.connectTarget()}return Jn(async()=>{await t.registerClient()}),(y,S)=>(U(),j("div",mu,[g("div",{class:ce(["clientId-cluster",V(r)==="LOADING"?"disabled":"ready"]),onClick:h},[Zn(Ye(V(r))+" ",1),g("div",_u,[c.value?(U(),j("span",gu)):(U(),j("span",yu))])],2),g("div",{class:ce(["targetId-cluster shadow",u.value])},[S[1]||(S[1]=g("span",{class:"input-hint shadow"},"Enter the peer's code",-1)),$e(g("input",{type:"text",id:"targetIdInput",class:"targetId-input blur",placeholder:"code",maxlength:"4","onUpdate:modelValue":S[0]||(S[0]=I=>ae(i)?i.value=I:null)},null,512),[[ks,V(i)]]),g("button",{id:"connectButton",class:"connect-button",disabled:!o.value||!V(n),onClick:_},[l.value?(U(),j("span",bu)):(U(),j("span",Eu))],8,vu)],2)]))}}),Tu=Re(wu,[["__scopeId","data-v-1333dbcb"]]),Zs=Ys("send",()=>{const e=xt(),{sendChannels:t}=je(e),s=G([]);function n(w,B,X,fe,et){s.value.push({url:w,name:B,size:X,progress:fe,type:et}),s.value=[...s.value]}async function r(w,B){s.value[w].progress=B,s.value=[...s.value]}async function i(w,B){s.value[w].url=B,s.value=[...s.value]}async function o(w,B){s.value[w].success=B,s.value=[...s.value]}let l=-1,c=[];for(let w=0;w{await f()};async function u(w,B=!1){c.push(w),await f(B)}async function f(w){let B=null;if(w)B=t.value[0];else{const X=Math.floor(Math.random()*t.value.length);B=t.value[X]}for(;c.length>0&&B.bufferedAmount<=e.maxBufferedAmount;){let X=c.shift();!(X instanceof ArrayBuffer)&&!ArrayBuffer.isView(X)&&(X=new TextEncoder().encode(X)),B.send(new Uint8Array(X))}}let h="";const _=G("Drop file here or click to upload"),y=G(0),S=16384;let I=null;const z=G(0);async function L(w,B){const X=w.length;if(X===0){console.error("[ERR] No file selected");return}for(let fe=0;fenew Promise((ue,Y)=>{const te=new FileReader;te.onload=async Ce=>{var Oe,Dt,cs;const lt=new Uint8Array(2);lt[0]=(et&65280)>>8,lt[1]=et&255;const Fe=new Uint8Array(((Oe=Ce.target)==null?void 0:Oe.result).byteLength+2);Fe.set(lt,0),Fe.set(new Uint8Array((Dt=Ce.target)==null?void 0:Dt.result),2),await u(Fe),z.value=z.value+((cs=Ce.target)==null?void 0:cs.result).byteLength,z.value{Y(Ce)},te.readAsArrayBuffer(fe)}));await Promise.all(X)}async function K(){I=new FileReader,I.addEventListener("error",w=>{console.error(`[ERR] Error reading file: ${w}`)}),I.addEventListener("abort",w=>{console.log(`[INFO] File reading aborted: ${w}`)})}function q(w){return w===0?(console.error("[ERR] File is empty"),!1):e.getSendChannelState()!=="open"?(console.error("[ERR] Data channel is not open"),!1):!0}async function P(w){await A(w)}async function A(w){D(w)&&(await u("CONTENT_METAtTRANSFER_TYPE_TEXT",!0),await u("CONTENT_METAn"+w,!0),await u("CONTENT_METAs"+w.length,!0),n("javascript:void(0)",w,w.length,w.length,"TRANSFER_TYPE_TEXT"),l++,o(l,!0))}function D(w){return w===""?(console.error("[ERR] Text is empty"),!1):e.getSendChannelState()!=="open"?(console.error("[ERR] Data channel is not open"),!1):!0}return{uploadFileItems:s,sendFiles:L,sendText:P,processQueue:f}}),Su=["disabled"],xu=["disabled"],Ru={key:0,class:"upload-text-title"},Cu={key:1,class:"upload-text-title"},Ou=De({__name:"UploadText",setup(e){const t=xt(),{isConnectSuccess:s}=je(t),n=Zs(),r=G(""),i=G(!1);function o(){s.value&&(n.sendText(r.value),i.value=!0,setTimeout(()=>{i.value=!1,r.value=""},1e3))}return(l,c)=>(U(),j("div",{id:"text",class:ce(["upload-text-cluster",{disabled:!V(s),active:V(s)}])},[$e(g("textarea",{id:"textInput",class:"text-input blur",placeholder:"Send a short message...",disabled:!V(s),"onUpdate:modelValue":c[0]||(c[0]=u=>r.value=u),ref:"textInput.value"},null,8,Su),[[ks,r.value]]),g("button",{id:"sendButton",class:"send-button",disabled:!V(s),onClick:o},[g("span",{class:ce(["mdi",{"mdi-send":!i.value,"mdi-check-bold":i.value}])},null,2),i.value?(U(),j("p",Cu,"Succeed")):(U(),j("p",Ru,"Send Message"))],8,xu)],2))}}),Au=Re(Ou,[["__scopeId","data-v-c9d5339b"]]),Iu=["disabled"],Nu=De({__name:"UploadFile",setup(e){const t=xt(),{isConnectSuccess:s}=je(t),n=Zs(),r=G(null);async function i(){r.value&&r.value.files&&await n.sendFiles(r.value.files,"TRANSFER_TYPE_FILE")}async function o(c){s.value&&(c.preventDefault(),r.value&&(r.value.files=c.dataTransfer.files,await i()))}function l(){s.value&&r.value&&r.value.click()}return(c,u)=>(U(),j("div",{id:"dropzone",class:ce(["upload-file-cluster",{disabled:!V(s),active:V(s)}]),onDragover:u[0]||(u[0]=io(()=>{},["prevent"])),onDrop:o,onClick:l},[g("input",{type:"file",id:"fileInput",class:"file-input",title:"Choose a file to send",multiple:"",onChange:i,ref_key:"fileInput",ref:r,disabled:!V(s)},null,40,Iu),u[1]||(u[1]=g("span",{class:"mdi mdi-file-upload"},null,-1)),u[2]||(u[2]=g("p",{class:"file-input-title"},"File",-1))],34))}}),ku=Re(Nu,[["__scopeId","data-v-c6830b04"]]),Pu={id:"cameradisplay",class:"camera-display-cluster"},Lu=De({__name:"UploadPhoto",setup(e){const t=xt(),{isConnectSuccess:s}=je(t),n=Zs(),r=G(!1),i=G(!1),o=G(!1),l=G(null),c=G(null);function u(){s.value&&navigator.mediaDevices.getUserMedia({audio:!1,video:{facingMode:"environment"}}).then(S=>{window.stream=S,l.value&&(l.value.srcObject=S),i.value=!0,o.value=!0}).catch(S=>{console.error(`[ERR] GetUserMedia error: ${S}`),i.value=!1,o.value=!1,alert("Please allow camera access to use this feature")})}function f(){if(c.value&&l.value){c.value.width=l.value.videoWidth,c.value.height=l.value.videoHeight;const S=c.value.getContext("2d");S&&S.drawImage(l.value,0,0,c.value.width,c.value.height),window.stream.getTracks().forEach(I=>I.stop()),o.value=!1}}function h(){window.stream.getTracks().forEach(S=>S.stop()),i.value=!1,o.value=!1}async function _(){c.value&&c.value.toBlob(async function(S){if(S){const I=new Date().getTime(),z=new File([S],`image_${I}.png`,{type:"image/png"});await n.sendFiles([z],"TRANSFER_TYPE_FILE")}},"image/png")}async function y(){s.value&&(await _(),r.value=!0,setTimeout(()=>{r.value=!1,h()},1e3))}return(S,I)=>(U(),j(be,null,[$e(g("div",Pu,[g("button",{class:"close-button mdi mdi-close",onClick:h}),$e(g("video",{class:"stream-display",ref_key:"stream",ref:l,autoplay:"",playsinline:""},null,512),[[$t,o.value]]),$e(g("button",{class:"snapshot-button mdi mdi-camera",onClick:f},null,512),[[$t,o.value]]),$e(g("canvas",{class:"photo-display",ref_key:"photo",ref:c},null,512),[[$t,!o.value]]),$e(g("button",{class:ce(["send-button mdi",{"mdi-send":!r.value,"mdi-check-bold":r.value}]),onClick:y},null,2),[[$t,!o.value]])],512),[[$t,i.value]]),g("div",{id:"camera",class:ce(["upload-photo-cluster",{disabled:!V(s),active:V(s)}]),onClick:u},I[0]||(I[0]=[g("span",{class:"mdi mdi-camera"},null,-1),g("p",{class:"upload-photo-title"},"Photo",-1)]),2)],64))}}),Du=Re(Lu,[["__scopeId","data-v-34f1046f"]]),Bu={id:"upload",class:"upload-cluster"},Mu=De({__name:"UploadModal",setup(e){return(t,s)=>(U(),j("div",Bu,[de(ku),de(Du),de(Au)]))}}),Fu=Re(Mu,[["__scopeId","data-v-ce8de059"]]),Uu={class:"operation-cluster"},Hu=De({__name:"OperationModal",setup(e){return(t,s)=>(U(),j("div",Uu,[de(Tu),de(Fu)]))}}),$u=Re(Hu,[["__scopeId","data-v-af70de5b"]]);function Ps(e){return!!Vu.test(e)}function So(e){return Co.some(t=>e.toLowerCase().endsWith(t))}function xo(e){return Oo.some(t=>e.toLowerCase().endsWith(t))}function Ro(e){const t=e.toLowerCase();for(const[s,n]of Object.entries(ju))if(n.some(r=>t.endsWith(r)))return s;return"mdi-file-document"}const Vu=new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$","i"),Co=[".png",".jpg",".jpeg",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif",".heic",".raw"],Oo=[".mp4",".mkv",".avi",".mov",".wmv",".flv",".webm",".mpeg",".mpg",".m4v",".3gp",".3g2"],ju={"mdi-file-image":Co,"mdi-file-word":[".doc",".docx",".odt",".rtf",".txt",".wps",".wpd"],"mdi-file-table":[".xls",".xlsx",".ods",".csv",".tsv",".xlsm",".xlsb"],"mdi-file-powerpoint":[".ppt",".pptx",".odp",".pps",".ppsx",".pot",".potx"],"mdi-file-music":[".mp3",".wav",".flac",".ogg",".aac",".wma",".m4a",".aiff",".alac"],"mdi-file-video":Oo,"mdi-file-code":[".html",".css",".js",".ts",".jsx",".tsx",".json",".xml",".yaml",".yml",".md",".markdown",".cpp",".c",".h",".hpp",".java",".py",".rb",".php",".sql",".sh",".bat",".ps1",".psm1",".psd1",".ps1xml",".pssc",".psc1",".pssc",".pl",".perl",".go",".rs",".swift",".kt",".kts",".clj",".cljs",".scala",".groovy",".gradle",".dockerfile",".properties",".ini",".cfg",".conf",".toml",".yaml",".yml",".json",".xml",".csv",".tsv",".log",".r",".sas",".stata",".do",".m",".mat",".rmd",".ipynb"],"mdi-folder-zip":[".zip",".rar",".7z",".tar",".gz",".bz2",".xz",".lz",".lzma",".lzo",".zst",".z",".tar.gz",".tgz",".tar.bz2",".tbz2",".tar.xz",".txz",".tar.lz",".tlz",".tar.lzma",".tar.lzo",".tar.zst",".tzst"],"mdi-file-cad":[".dwg",".dxf",".dgn",".stl",".obj",".fbx",".3ds",".skp",".step",".stp",".igs",".iges",".x_t",".x_b",".sat",".sab",".3dm",".prt",".asm",".xas",".xpr"],"mdi-file-key":[".key",".pem",".pub",".asc",".gpg",".pgp",".p12",".pfx",".cer",".crt",".der",".keychain",".jks",".keystore",".bks",".pkcs12",".p7b",".p7c",".p7r",".p7s",".p8"]},Wu=["href","download"],qu={class:"upload-item-detail"},Gu={class:"upload-item-name"},Ku=["value","max"],zu=["src"],Yu=["src","controls"],Ju={class:"upload-item-detail"},Xu={class:"upload-item-content"},Qu={key:0,class:"mdi mdi-check-bold"},Zu={key:1,class:"mdi mdi-content-copy"},ef=["href"],tf={class:"upload-item-detail"},sf={class:"upload-item-content"},nf=De({__name:"SendItem",props:{url:{default:"javascript:void(0)"},name:{default:"No file to upload"},size:{default:1},progress:{default:0},type:{default:"TRANSFER_TYPE_FILE"},success:{type:Boolean,default:!1}},setup(e){const t=e,s=Js(),{autoDisplayImage:n,directlyOpenLink:r}=je(s),i=G(!1);function o(){navigator.clipboard.writeText(t.name),i.value=!0,setTimeout(()=>{i.value=!1},1e3)}const l=window.matchMedia("(hover: hover)").matches;return(c,u)=>(U(),j(be,null,[t.type==="TRANSFER_TYPE_FILE"?(U(),j("a",{key:0,ref:"uploadLink",href:t.url,class:ce(["upload-item file shadow",{success:t.success,loading:!t.success}]),download:t.name},[g("span",{class:ce(["mdi",V(Ro)(t.name)])},null,2),g("div",qu,[g("p",Gu,Ye(t.name),1),g("progress",{class:"upload-item-progress",value:t.progress,max:t.size},null,8,Ku),V(So)(t.name)&&t.success&&V(n)?(U(),j("img",{key:0,class:"upload-item-content",src:t.url,alt:"Photo"},null,8,zu)):me("",!0),V(xo)(t.name)&&t.success?(U(),j("video",{key:1,class:"download-item-content",src:t.url,controls:!V(l),muted:"",autoplay:"",loop:""},null,8,Yu)):me("",!0)]),t.success?(U(),j("div",{key:0,class:ce({"copy-cover blur":V(l),"none-hover":!V(l)})},u[0]||(u[0]=[g("span",{class:"mdi mdi-download"},null,-1)]),2)):me("",!0)],10,Wu)):me("",!0),t.type==="TRANSFER_TYPE_TEXT"&&(!V(Ps)(t.name)||!V(r))?(U(),j("div",{key:1,class:ce(["upload-item text shadow",{success:t.success,loading:!t.success}]),onClick:o},[u[1]||(u[1]=g("span",{class:"mdi mdi-message-text"},null,-1)),g("div",Ju,[g("p",Xu,Ye(t.name),1)]),t.success?(U(),j("div",{key:0,class:ce({"copy-cover blur":V(l),"none-hover":!V(l)})},[i.value?(U(),j("span",Qu)):(U(),j("span",Zu))],2)):me("",!0)],2)):me("",!0),t.type==="TRANSFER_TYPE_TEXT"&&V(Ps)(t.name)&&V(r)?(U(),j("a",{key:2,class:ce(["upload-item text shadow",{success:t.success,loading:!t.success}]),onClick:o,href:t.name,target:"_blank",rel:"noopener noreferrer"},[u[3]||(u[3]=g("span",{class:"mdi mdi-link-variant"},null,-1)),g("div",tf,[g("p",sf,Ye(t.name),1)]),t.success?(U(),j("div",{key:0,class:ce({"copy-cover blur":V(l),"none-hover":!V(l)})},u[2]||(u[2]=[g("span",{class:"mdi mdi-open-in-new"},null,-1)]),2)):me("",!0)],10,ef)):me("",!0)],64))}}),rf=Re(nf,[["__scopeId","data-v-22560d61"]]),of={class:"upload-cluster"},lf={key:0,class:"noting-to-upload-text"},cf=De({__name:"SendModal",setup(e){const t=Zs(),s=G([]);return xe(()=>t.uploadFileItems,n=>{s.value=n},{deep:!0}),(n,r)=>(U(),j("div",of,[r[0]||(r[0]=g("div",{class:"upload-cluster-title"},[g("span",{class:"mdi mdi-upload-network"}),g("p",{class:"upload-cluster-title-text"},"Upload")],-1)),s.value.length===0?(U(),j("p",lf," Nothing to upload ")):me("",!0),(U(!0),j(be,null,Pi(s.value,(i,o)=>(U(),qs(rf,{key:o,url:i.url,name:i.name,size:i.size,progress:i.progress,success:i.success,type:i.type},null,8,["url","name","size","progress","success","type"]))),128))]))}}),af=Re(cf,[["__scopeId","data-v-b5e41870"]]),uf=Ys("receive",()=>{const e=xt(),{peerConnection:t}=je(e),s=G([]);function n(A,D,w,B,X){s.value.push({url:A,name:D,size:w,progress:B,type:X}),s.value=[...s.value]}function r(A,D){s.value[A].progress=D,s.value=[...s.value]}function i(A,D){s.value[A].url=D,s.value=[...s.value]}function o(A,D){s.value[A].success=D,s.value=[...s.value]}let l=[],c=[],u="",f="",h=0,_=0,y="",S=[],I=[],z=[],L=-1;function O(){if(!t.value){console.error("[ERR] Peer connection not ready");return}t.value.ondatachannel=A=>{P();const D=A.channel;D.onopen=()=>{},D.onerror=w=>{console.error(`[ERR] Receive channel error: ${w}`)},D.onclose=()=>{window.location.reload()},D.onmessage=w=>{J(w)}}}const $="CONTENT_META",k=new TextEncoder().encode($);async function J(A){const D=new DataView(A.data);let w=!0;for(let B=0;B0&&(u=S.shift(),f=I.shift(),h=z.shift(),L++,console.log(`[INFO] ===Receiving file ${u} | ${f} | ${h}===`));const w=new DataView(A).getUint16(0,!1),B=A.slice(2);l[w]||(_+=B.byteLength),l[w]=B,r(L,_),_===h&&(c=l,y=URL.createObjectURL(new Blob(c)),f.endsWith(".svg")&&(y=URL.createObjectURL(new Blob(c,{type:"image/svg+xml"}))),i(L,y),o(L,!0),P())}function P(){l=[],c=[],u="",f="",h=0,_=0,y=""}return{downloadFileItems:s,receiveFiles:O}}),ff=["href","download"],df={class:"download-item-detail"},hf={class:"download-item-name"},pf=["value","max"],mf=["src"],_f=["src","controls"],gf={class:"download-item-detail"},yf={class:"download-item-content"},vf={key:0,class:"mdi mdi-check-bold"},bf={key:1,class:"mdi mdi-content-copy"},Ef=["href"],wf={class:"download-item-detail"},Tf={class:"download-item-content"},Sf=De({__name:"ReceiveItem",props:{url:{default:"javascript:void(0)"},name:{default:"No file to download"},size:{default:1},progress:{default:0},type:{default:"TRANSFER_TYPE_FILE"},success:{type:Boolean,default:!1}},setup(e){const t=e,s=Js(),{autoDisplayImage:n,directlyOpenLink:r}=je(s),i=G(!1);function o(){navigator.clipboard.writeText(t.name),i.value=!0,setTimeout(()=>{i.value=!1},1e3)}const l=window.matchMedia("(hover: hover)").matches;return(c,u)=>(U(),j(be,null,[t.type==="TRANSFER_TYPE_FILE"?(U(),j("a",{key:0,ref:"downloadLink",href:t.url,class:ce(["download-item file shadow",{success:t.success,loading:!t.success}]),download:t.name},[g("span",{class:ce(["mdi",V(Ro)(t.name)])},null,2),g("div",df,[g("p",hf,Ye(t.name),1),g("progress",{class:"download-item-progress",value:t.progress,max:t.size},null,8,pf),V(So)(t.name)&&t.success&&V(n)?(U(),j("img",{key:0,class:"download-item-content",src:t.url,alt:"Photo"},null,8,mf)):me("",!0),V(xo)(t.name)&&t.success?(U(),j("video",{key:1,class:"download-item-content",src:t.url,controls:!V(l),muted:"",autoplay:"",loop:""},null,8,_f)):me("",!0)]),t.success?(U(),j("div",{key:0,class:ce({"copy-cover blur":V(l),"none-hover":!V(l)})},u[0]||(u[0]=[g("span",{class:"mdi mdi-download"},null,-1)]),2)):me("",!0)],10,ff)):me("",!0),t.type==="TRANSFER_TYPE_TEXT"&&(!V(Ps)(t.name)||!V(r))?(U(),j("div",{key:1,class:ce(["download-item text shadow",{success:t.success,loading:!t.success}]),onClick:o},[u[1]||(u[1]=g("span",{class:"mdi mdi-message-text"},null,-1)),g("div",gf,[g("p",yf,Ye(t.name),1)]),t.success?(U(),j("div",{key:0,class:ce({"copy-cover blur":V(l),"none-hover":!V(l)})},[i.value?(U(),j("span",vf)):(U(),j("span",bf))],2)):me("",!0)],2)):me("",!0),t.type==="TRANSFER_TYPE_TEXT"&&V(Ps)(t.name)&&V(r)?(U(),j("a",{key:2,class:ce(["download-item text shadow",{success:t.success,loading:!t.success}]),onClick:o,href:t.name,target:"_blank",rel:"noopener noreferrer"},[u[3]||(u[3]=g("span",{class:"mdi mdi-link-variant"},null,-1)),g("div",wf,[g("p",Tf,Ye(t.name),1)]),t.success?(U(),j("div",{key:0,class:ce({"copy-cover blur":V(l),"none-hover":!V(l)})},u[2]||(u[2]=[g("span",{class:"mdi mdi-open-in-new"},null,-1)]),2)):me("",!0)],10,Ef)):me("",!0)],64))}}),xf=Re(Sf,[["__scopeId","data-v-5ed08d2f"]]),Rf={class:"download-cluster"},Cf={key:0,class:"noting-to-download-text"},Of=De({__name:"ReceiveModal",setup(e){const t=xt(),s=uf(),{isConnectSuccess:n}=je(t),r=G([]);return xe(n,i=>{i&&s.receiveFiles()}),xe(()=>s.downloadFileItems,i=>{r.value=i},{deep:!0}),(i,o)=>(U(),j("div",Rf,[o[0]||(o[0]=g("div",{class:"download-cluster-title"},[g("span",{class:"mdi mdi-download-network"}),g("p",{class:"download-cluster-title-text"},"Download")],-1)),r.value.length===0?(U(),j("p",Cf," Nothing to download ")):me("",!0),(U(!0),j(be,null,Pi(r.value,(l,c)=>(U(),qs(xf,{key:c,url:l.url,name:l.name,size:l.size,progress:l.progress,success:l.success,type:l.type},null,8,["url","name","size","progress","success","type"]))),128))]))}}),Af=Re(Of,[["__scopeId","data-v-2dba2b30"]]),If={};function Nf(e,t){return U(),j("footer",null,t[0]||(t[0]=[yc('

© 2024 EasyTransfer. All rights reserved.

About | Feedback | GitHub

',2)]))}const kf=Re(If,[["render",Nf],["__scopeId","data-v-cd00c0b7"]]),Pf={id:"app-content"},Lf={class:"app-cluster"},Df=De({__name:"App",setup(e){return(t,s)=>(U(),j(be,null,[de(ba),g("div",Pf,[g("div",Lf,[de($u),de(af),de(Af)])]),de(kf)],64))}}),Bf=Re(Df,[["__scopeId","data-v-e68b6bcc"]]),Ao=Zc(Bf);Ao.use(na());Ao.mount("#app"); diff --git a/index.html b/index.html index b7f6a20..857c1b2 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,7 @@ property="og:description" content="EasyTransfer is a free, anonymous, encrypted, and easy-to-use E2EE file transfer tool. You only need to visit a simple web page to connect to any device in any network using a device code." /> - +