@xenon-device-management/xenon 1.7.7 → 1.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/package.json +1 -1
- package/lib/public/assets/{ApiKeyGate-BVaB1Eg_.js → ApiKeyGate-DstjGHCV.js} +1 -1
- package/lib/public/assets/{BugReportButton-CioDV7QP.js → BugReportButton-CCFNeE8T.js} +1 -1
- package/lib/public/assets/DeviceMosaicView-CeSU4Cin.js +2 -0
- package/lib/public/assets/{EmptyState-UcJej2vi.js → EmptyState-BLKITXvX.js} +1 -1
- package/lib/public/assets/{FieldGroup-CYlyr34Q.js → FieldGroup-DnJ8AU1V.js} +1 -1
- package/lib/public/assets/{Modal-CjmzIR4Y.js → Modal-QVER5CZo.js} +1 -1
- package/lib/public/assets/{SegmentedControl-wRDvkYAQ.js → SegmentedControl-C2vcRRnn.js} +1 -1
- package/lib/public/assets/{SettingCard-BzjYlAYS.js → SettingCard-BCRyZfOg.js} +1 -1
- package/lib/public/assets/{Table-ta1UYEeC.js → Table-CEvMaA5P.js} +1 -1
- package/lib/public/assets/{activity-jltyhcrF.js → activity-C9XYmP_g.js} +1 -1
- package/lib/public/assets/{ai-settings-Dfjxb1SZ.js → ai-settings-CUkrWRb4.js} +1 -1
- package/lib/public/assets/{api-keys-cFOese97.js → api-keys-DOEqEyCC.js} +1 -1
- package/lib/public/assets/{apps-sHtZU8T_.js → apps-kS8notsd.js} +1 -1
- package/lib/public/assets/{arrow-left-DGZzN6Sl.js → arrow-left-USNjWr3g.js} +1 -1
- package/lib/public/assets/{arrow-up-right-DtZUe0YH.js → arrow-up-right-CA-0ObXb.js} +1 -1
- package/lib/public/assets/{auth-shell-D0eF5eyS.js → auth-shell-0GDuDM6t.js} +1 -1
- package/lib/public/assets/builds-page-B3hcVeUY.js +6 -0
- package/lib/public/assets/{button-3RkAu6xE.js → button-30pnTauc.js} +1 -1
- package/lib/public/assets/{check-D6DDcFwM.js → check-CVbtgHOC.js} +1 -1
- package/lib/public/assets/{chevron-right-BtA7DR8A.js → chevron-right-BpHMOuL1.js} +1 -1
- package/lib/public/assets/{circle-check-Bjgvpq5F.js → circle-check-BR3SeBx6.js} +1 -1
- package/lib/public/assets/{circle-x-_TOawobA.js → circle-x-BISG5iH-.js} +1 -1
- package/lib/public/assets/{clock-pm4LDp97.js → clock-BiZmZWEe.js} +1 -1
- package/lib/public/assets/{copy-x-UuUQkc.js → copy-E317aAW3.js} +1 -1
- package/lib/public/assets/{device-explorer-BDih8ZO9.js → device-explorer-DTj4kvcs.js} +8 -8
- package/lib/public/assets/{download-CuDjBGgs.js → download-Blklg-SX.js} +1 -1
- package/lib/public/assets/{forgot-password-lgHuL3gW.js → forgot-password-Bwo7pGp7.js} +1 -1
- package/lib/public/assets/{funnel-DQuWVevA.js → funnel-C8pl8r9F.js} +1 -1
- package/lib/public/assets/{index--TKsSVZp.js → index-Doq8HO3X.js} +14 -14
- package/lib/public/assets/index-TkL430dq.css +1 -0
- package/lib/public/assets/{layers-CdE4q4fN.js → layers-C2U3k-wh.js} +1 -1
- package/lib/public/assets/{lock-D2Vg6I6G.js → lock-pCxyVW83.js} +1 -1
- package/lib/public/assets/{login-C2dtnYcH.js → login-Cn6qENaF.js} +1 -1
- package/lib/public/assets/{maintenance-settings-Ck0suBTt.js → maintenance-settings-DybzeKfb.js} +1 -1
- package/lib/public/assets/{mouse-pointer-2-JuM7rDhC.js → mouse-pointer-2-cmVLOY6H.js} +1 -1
- package/lib/public/assets/overview-Dqw_olJm.js +11 -0
- package/lib/public/assets/{page-header-D5tpZwkI.js → page-header-Qk9pGEaH.js} +1 -1
- package/lib/public/assets/{plus-tcA3_CAo.js → plus-DkzZBN8d.js} +1 -1
- package/lib/public/assets/{profile-page-BuuLTEtS.js → profile-page-D_BlUsba.js} +1 -1
- package/lib/public/assets/{reset-password-ERq0WAyA.js → reset-password-vxmC3PEa.js} +1 -1
- package/lib/public/assets/{runbook-page-BubL06xm.js → runbook-page-rzVHVBte.js} +1 -1
- package/lib/public/assets/{selector-detail-page-DgL7bNdy.js → selector-detail-page-DUPHHW7E.js} +1 -1
- package/lib/public/assets/selector-health-C4Sv_nTk.css +1 -0
- package/lib/public/assets/{selector-health-B-V7vomq.js → selector-health-CS_wYWYA.js} +1 -1
- package/lib/public/assets/{selector-health-page-DWy7bTdU.js → selector-health-page-CQT_ghIj.js} +1 -1
- package/lib/public/assets/{session-detail-page-COgS5oAy.js → session-detail-page-Md2BJeDW.js} +1 -1
- package/lib/public/assets/{settings-D0fQ4JNR.js → settings-DcRs-Ksu.js} +1 -1
- package/lib/public/assets/{shield-DINNxWHp.js → shield-DKOl26Qj.js} +1 -1
- package/lib/public/assets/{shield-alert-DDDbE5ER.js → shield-alert-B6RlIJqv.js} +1 -1
- package/lib/public/assets/status-pill-outline-Df9QaRNJ.js +1 -0
- package/lib/public/assets/{tablet-DoE7LIzI.js → tablet-1xXXhpqC.js} +1 -1
- package/lib/public/assets/{teams-DpW-IUPC.js → teams-DnBnZECm.js} +1 -1
- package/lib/public/assets/{trash-2-Dvr08Dpq.js → trash-2-D-ONhY9W.js} +1 -1
- package/lib/public/assets/{useSocket-COssbQIj.js → useSocket-D9iZtppJ.js} +1 -1
- package/lib/public/assets/{users-DKmLh2WK.js → users-BFrjP_42.js} +1 -1
- package/lib/public/assets/{webhook-settings-nwtLvp2Q.js → webhook-settings-DgJKt5Wf.js} +1 -1
- package/lib/public/assets/{zap-CM2cWetx.js → zap-C8F21kM1.js} +1 -1
- package/lib/public/index.html +2 -2
- package/package.json +1 -1
- package/lib/public/assets/DeviceMosaicView-BtRxZTXc.js +0 -2
- package/lib/public/assets/builds-page-DxDwaq_t.js +0 -6
- package/lib/public/assets/index-BW3kENYH.css +0 -1
- package/lib/public/assets/overview-BBzmQBEl.js +0 -11
- package/lib/public/assets/selector-health-BwHGcem9.css +0 -1
- package/lib/public/assets/status-pill-outline-CFz5xaoF.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as A}from"./index--TKsSVZp.js";const y=Object.create(null);y.open="0";y.close="1";y.ping="2";y.pong="3";y.message="4";y.upgrade="5";y.noop="6";const O=Object.create(null);Object.keys(y).forEach(n=>{O[y[n]]=n});const I={type:"error",data:"parser error"},Z=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ee=typeof ArrayBuffer=="function",te=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,K=({type:n,data:e},t,s)=>Z&&e instanceof Blob?t?s(e):J(e,s):ee&&(e instanceof ArrayBuffer||te(e))?t?s(e):J(new Blob([e]),s):s(y[n]+(e||"")),J=(n,e)=>{const t=new FileReader;return t.onload=function(){const s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(n)};function X(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let L;function le(n,e){if(Z&&n.data instanceof Blob)return n.data.arrayBuffer().then(X).then(e);if(ee&&(n.data instanceof ArrayBuffer||te(n.data)))return e(X(n.data));K(n,!1,t=>{L||(L=new TextEncoder),e(L.encode(t))})}const Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",v=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<Q.length;n++)v[Q.charCodeAt(n)]=n;const pe=n=>{let e=n.length*.75,t=n.length,s,i=0,r,o,a,h;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const g=new ArrayBuffer(e),f=new Uint8Array(g);for(s=0;s<t;s+=4)r=v[n.charCodeAt(s)],o=v[n.charCodeAt(s+1)],a=v[n.charCodeAt(s+2)],h=v[n.charCodeAt(s+3)],f[i++]=r<<2|o>>4,f[i++]=(o&15)<<4|a>>2,f[i++]=(a&3)<<6|h&63;return g},de=typeof ArrayBuffer=="function",W=(n,e)=>{if(typeof n!="string")return{type:"message",data:se(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:ye(n.substring(1),e)}:O[t]?n.length>1?{type:O[t],data:n.substring(1)}:{type:O[t]}:I},ye=(n,e)=>{if(de){const t=pe(n);return se(t,e)}else return{base64:!0,data:n}},se=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},ne="",ge=(n,e)=>{const t=n.length,s=new Array(t);let i=0;n.forEach((r,o)=>{K(r,!1,a=>{s[o]=a,++i===t&&e(s.join(ne))})})},me=(n,e)=>{const t=n.split(ne),s=[];for(let i=0;i<t.length;i++){const r=W(t[i],e);if(s.push(r),r.type==="error")break}return s};function _e(){return new TransformStream({transform(n,e){le(n,t=>{const s=t.length;let i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);const r=new DataView(i.buffer);r.setUint8(0,126),r.setUint16(1,s)}else{i=new Uint8Array(9);const r=new DataView(i.buffer);r.setUint8(0,127),r.setBigUint64(1,BigInt(s))}n.data&&typeof n.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}let P;function T(n){return n.reduce((e,t)=>e+t.length,0)}function R(n,e){if(n[0].length===e)return n.shift();const t=new Uint8Array(e);let s=0;for(let i=0;i<e;i++)t[i]=n[0][s++],s===n[0].length&&(n.shift(),s=0);return n.length&&s<n[0].length&&(n[0]=n[0].slice(s)),t}function be(n,e){P||(P=new TextDecoder);const t=[];let s=0,i=-1,r=!1;return new TransformStream({transform(o,a){for(t.push(o);;){if(s===0){if(T(t)<1)break;const h=R(t,1);r=(h[0]&128)===128,i=h[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(T(t)<2)break;const h=R(t,2);i=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),s=3}else if(s===2){if(T(t)<8)break;const h=R(t,8),g=new DataView(h.buffer,h.byteOffset,h.length),f=g.getUint32(0);if(f>Math.pow(2,21)-1){a.enqueue(I);break}i=f*Math.pow(2,32)+g.getUint32(4),s=3}else{if(T(t)<i)break;const h=R(t,i);a.enqueue(W(r?h:P.decode(h),e)),s=0}if(i===0||i>n){a.enqueue(I);break}}}})}const ie=4;function u(n){if(n)return we(n)}function we(n){for(var e in u.prototype)n[e]=u.prototype[e];return n}u.prototype.on=u.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};u.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this};u.prototype.off=u.prototype.removeListener=u.prototype.removeAllListeners=u.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var s,i=0;i<t.length;i++)if(s=t[i],s===e||s.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+n],this};u.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,i=t.length;s<i;++s)t[s].apply(this,e)}return this};u.prototype.emitReserved=u.prototype.emit;u.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};u.prototype.hasListeners=function(n){return!!this.listeners(n).length};const x=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),l=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ee="arraybuffer";function re(n,...e){return e.reduce((t,s)=>(n.hasOwnProperty(s)&&(t[s]=n[s]),t),{})}const ve=l.setTimeout,ke=l.clearTimeout;function N(n,e){e.useNativeTimers?(n.setTimeoutFn=ve.bind(l),n.clearTimeoutFn=ke.bind(l)):(n.setTimeoutFn=l.setTimeout.bind(l),n.clearTimeoutFn=l.clearTimeout.bind(l))}const Ae=1.33;function Te(n){return typeof n=="string"?Re(n):Math.ceil((n.byteLength||n.size)*Ae)}function Re(n){let e=0,t=0;for(let s=0,i=n.length;s<i;s++)e=n.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function oe(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Oe(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function Se(n){let e={},t=n.split("&");for(let s=0,i=t.length;s<i;s++){let r=t[s].split("=");e[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return e}class Ce extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}}class $ extends u{constructor(e){super(),this.writable=!1,N(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new Ce(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=W(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=Oe(e);return t.length?"?"+t:""}}class Be extends ${constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};me(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,ge(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=oe()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let ce=!1;try{ce=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const xe=ce;function Ne(){}class Le extends Be{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){const s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(i,r)=>{this.onError("xhr post error",i,r)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}}class d extends u{constructor(e,t,s){super(),this.createRequest=e,N(this,s),this._opts=s,this._method=s.method||"GET",this._uri=t,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;const t=re(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(t);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&s.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var i;s.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=d.requestsCount++,d.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Ne,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete d.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}d.requestsCount=0;d.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",j);else if(typeof addEventListener=="function"){const n="onpagehide"in l?"pagehide":"unload";addEventListener(n,j,!1)}}function j(){for(let n in d.requests)d.requests.hasOwnProperty(n)&&d.requests[n].abort()}const Pe=function(){const n=ae({xdomain:!1});return n&&n.responseType!==null}();class qe extends Le{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Pe&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new d(ae,this.uri(),e)}}function ae(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||xe))return new XMLHttpRequest}catch{}if(!e)try{return new l[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const he=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class De extends ${get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,s=he?{}:re(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],i=t===e.length-1;K(s,this.supportsBinary,r=>{try{this.doWrite(s,r)}catch{}i&&x(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=oe()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const q=l.WebSocket||l.MozWebSocket;class Ie extends De{createSocket(e,t,s){return he?new q(e,t,s):t?new q(e,t):new q(e)}doWrite(e,t){this.ws.send(t)}}class Ue extends ${get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=be(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),i=_e();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const r=()=>{s.read().then(({done:a,value:h})=>{a||(this.onPacket(h),r())}).catch(a=>{})};r();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],i=t===e.length-1;this._writer.write(s).then(()=>{i&&x(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Fe={websocket:Ie,webtransport:Ue,polling:qe},Ve=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Me=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function U(n){if(n.length>8e3)throw"URI too long";const e=n,t=n.indexOf("["),s=n.indexOf("]");t!=-1&&s!=-1&&(n=n.substring(0,t)+n.substring(t,s).replace(/:/g,";")+n.substring(s,n.length));let i=Ve.exec(n||""),r={},o=14;for(;o--;)r[Me[o]]=i[o]||"";return t!=-1&&s!=-1&&(r.source=e,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=He(r,r.path),r.queryKey=Ke(r,r.query),r}function He(n,e){const t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function Ke(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,r){i&&(t[i]=r)}),t}const F=typeof addEventListener=="function"&&typeof removeEventListener=="function",S=[];F&&addEventListener("offline",()=>{S.forEach(n=>n())},!1);class _ extends u{constructor(e,t){if(super(),this.binaryType=Ee,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const s=U(e);t.hostname=s.host,t.secure=s.protocol==="https"||s.protocol==="wss",t.port=s.port,s.query&&(t.query=s.query)}else t.host&&(t.hostname=U(t.host).host);N(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(s=>{const i=s.prototype.name;this.transports.push(i),this._transportsByName[i]=s}),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},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Se(this.opts.query)),F&&(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"})},S.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=ie,t.transport=e,this.id&&(t.sid=this.id);const s=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&_.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",_.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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 e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let s=0;s<this.writeBuffer.length;s++){const i=this.writeBuffer[s].data;if(i&&(t+=Te(i)),s>0&&t>this._maxPayload)return this.writeBuffer.slice(0,s);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,x(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,s){return this._sendPacket("message",e,t,s),this}send(e,t,s){return this._sendPacket("message",e,t,s),this}_sendPacket(e,t,s,i){if(typeof t=="function"&&(i=t,t=void 0),typeof s=="function"&&(i=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const r={type:e,data:t,options:s};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},s=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(_.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){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(),F&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=S.indexOf(this._offlineEventListener);s!==-1&&S.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}_.protocol=ie;class We extends _{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;_.priorWebsocketSuccess=!1;const i=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",m=>{if(!s)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;_.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(f(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const w=new Error("probe error");w.transport=t.name,this.emitReserved("upgradeError",w)}}))};function r(){s||(s=!0,f(),t.close(),t=null)}const o=m=>{const w=new Error("probe error: "+m);w.transport=t.name,r(),this.emitReserved("upgradeError",w)};function a(){o("transport closed")}function h(){o("socket closed")}function g(m){t&&m.name!==t.name&&r()}const f=()=>{t.removeListener("open",i),t.removeListener("error",o),t.removeListener("close",a),this.off("close",h),this.off("upgrading",g)};t.once("open",i),t.once("error",o),t.once("close",a),this.once("close",h),this.once("upgrading",g),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}}let $e=class extends We{constructor(e,t={}){const s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>Fe[i]).filter(i=>!!i)),super(e,s)}};function Ye(n,e="",t){let s=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),s=U(n)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const r=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+r+":"+s.port+e,s.href=s.protocol+"://"+r+(t&&t.port===s.port?"":":"+s.port),s}const ze=typeof ArrayBuffer=="function",Je=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,ue=Object.prototype.toString,Xe=typeof Blob=="function"||typeof Blob<"u"&&ue.call(Blob)==="[object BlobConstructor]",Qe=typeof File=="function"||typeof File<"u"&&ue.call(File)==="[object FileConstructor]";function Y(n){return ze&&(n instanceof ArrayBuffer||Je(n))||Xe&&n instanceof Blob||Qe&&n instanceof File}function C(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,s=n.length;t<s;t++)if(C(n[t]))return!0;return!1}if(Y(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return C(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&C(n[t]))return!0;return!1}function je(n){const e=[],t=n.data,s=n;return s.data=V(t,e),s.attachments=e.length,{packet:s,buffers:e}}function V(n,e){if(!n)return n;if(Y(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let s=0;s<n.length;s++)t[s]=V(n[s],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=V(n[s],e));return t}return n}function Ge(n,e){return n.data=M(n.data,e),delete n.attachments,n}function M(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=M(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=M(n[t],e));return n}const Ze=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var c;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(c||(c={}));class et{constructor(e){this.replacer=e}encode(e){return(e.type===c.EVENT||e.type===c.ACK)&&C(e)?this.encodeAsBinary({type:e.type===c.EVENT?c.BINARY_EVENT:c.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===c.BINARY_EVENT||e.type===c.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=je(e),s=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(s),i}}class z extends u{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const s=t.type===c.BINARY_EVENT;s||t.type===c.BINARY_ACK?(t.type=s?c.EVENT:c.ACK,this.reconstructor=new tt(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Y(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const s={type:Number(e.charAt(0))};if(c[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===c.BINARY_EVENT||s.type===c.BINARY_ACK){const r=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const o=e.substring(r,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){const r=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(r,t)}else s.nsp="/";const i=e.charAt(t+1);if(i!==""&&Number(i)==i){const r=t+1;for(;++t;){const o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(z.isPayloadValid(s.type,r))s.data=r;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case c.CONNECT:return G(t);case c.DISCONNECT:return t===void 0;case c.CONNECT_ERROR:return typeof t=="string"||G(t);case c.EVENT:case c.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Ze.indexOf(t[0])===-1);case c.ACK:case c.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class tt{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Ge(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function G(n){return Object.prototype.toString.call(n)==="[object Object]"}const st=Object.freeze(Object.defineProperty({__proto__:null,Decoder:z,Encoder:et,get PacketType(){return c}},Symbol.toStringTag,{value:"Module"}));function p(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const nt=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class fe extends u{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[p(e,"open",this.onopen.bind(this)),p(e,"packet",this.onpacket.bind(this)),p(e,"error",this.onerror.bind(this)),p(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,i,r;if(nt.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:c.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const f=this.ids++,m=t.pop();this._registerAckCallback(f,m),o.id=f}const a=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,h=this.connected&&!(!((r=this.io.engine)===null||r===void 0)&&r._hasPingExpired());return this.flags.volatile&&!a||(h?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var s;const i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}const r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===e&&this.sendBuffer.splice(a,1);t.call(this,new Error("operation has timed out"))},i),o=(...a)=>{this.io.clearTimeoutFn(r),t.apply(this,a)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((s,i)=>{const r=(o,a)=>o?i(o):s(a);r.withError=!0,t.push(r),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...r)=>(this._queue[0],i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...r)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:c.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){const s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case c.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 c.EVENT:case c.BINARY_EVENT:this.onevent(e);break;case c.ACK:case c.BINARY_ACK:this.onack(e);break;case c.DISCONNECT:this.ondisconnect();break;case c.CONNECT_ERROR:this.destroy();const s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let s=!1;return function(...i){s||(s=!0,t.packet({type:c.ACK,id:e,data:i}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:c.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const s of t)s.apply(this,e.data)}}}function b(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}b.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=Math.floor(e*10)&1?n+t:n-t}return Math.min(n,this.max)|0};b.prototype.reset=function(){this.attempts=0};b.prototype.setMin=function(n){this.ms=n};b.prototype.setMax=function(n){this.max=n};b.prototype.setJitter=function(n){this.jitter=n};class H extends u{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,N(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new b({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const i=t.parser||st;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new $e(this.uri,this.opts);const t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const i=p(t,"open",function(){s.onopen(),e&&e()}),r=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=p(t,"error",r);if(this._timeout!==!1){const a=this._timeout,h=this.setTimeoutFn(()=>{i(),r(new Error("timeout")),t.close()},a);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(i),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(p(e,"ping",this.onping.bind(this)),p(e,"data",this.ondata.bind(this)),p(e,"error",this.onerror.bind(this)),p(e,"close",this.onclose.bind(this)),p(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){x(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new fe(this,e,t),this.nsps[e]=s),s}_destroy(e){const t=Object.keys(this.nsps);for(const s of t)if(this.nsps[s].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const E={};function B(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=Ye(n,e.path||"/socket.io"),s=t.source,i=t.id,r=t.path,o=E[i]&&r in E[i].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let h;return a?h=new H(s,e):(E[i]||(E[i]=new H(s,e)),h=E[i]),t.query&&!e.query&&(e.query=t.queryKey),h.socket(t.path,e)}Object.assign(B,{Manager:H,Socket:fe,io:B,connect:B});let D=null;const k=new Map;function it(n,e){const t=k.get(n);t&&Array.from(t).forEach(s=>s(e))}function rt(){if(D)return D;const n=B(window.location.origin,{path:"/socket.io",reconnection:!0,withCredentials:!0});return n.on("connect",()=>{console.log("[Socket] Connected to Hub"),n.emit("register_dashboard")}),n.on("disconnect",()=>{console.log("[Socket] Disconnected from Hub")}),n.onAny((e,t)=>it(e,t)),D=n,n}function ot(n,e){let t=k.get(n);return t||(t=new Set,k.set(n,t)),t.add(e),()=>{const s=k.get(n);s&&(s.delete(e),s.size===0&&k.delete(n))}}const ht=()=>{const[n]=A.useState(rt),[e,t]=A.useState(n.connected);A.useEffect(()=>{const i=()=>t(!0),r=()=>t(!1);return n.on("connect",i),n.on("disconnect",r),t(n.connected),()=>{n.off("connect",i),n.off("disconnect",r)}},[n]);const s=A.useCallback((i,r)=>ot(i,r),[]);return{socket:n,isConnected:e,on:s}};export{ht as u};
|
|
1
|
+
import{r as A}from"./index-Doq8HO3X.js";const y=Object.create(null);y.open="0";y.close="1";y.ping="2";y.pong="3";y.message="4";y.upgrade="5";y.noop="6";const O=Object.create(null);Object.keys(y).forEach(n=>{O[y[n]]=n});const I={type:"error",data:"parser error"},Z=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ee=typeof ArrayBuffer=="function",te=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,K=({type:n,data:e},t,s)=>Z&&e instanceof Blob?t?s(e):J(e,s):ee&&(e instanceof ArrayBuffer||te(e))?t?s(e):J(new Blob([e]),s):s(y[n]+(e||"")),J=(n,e)=>{const t=new FileReader;return t.onload=function(){const s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(n)};function X(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let L;function le(n,e){if(Z&&n.data instanceof Blob)return n.data.arrayBuffer().then(X).then(e);if(ee&&(n.data instanceof ArrayBuffer||te(n.data)))return e(X(n.data));K(n,!1,t=>{L||(L=new TextEncoder),e(L.encode(t))})}const Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",v=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<Q.length;n++)v[Q.charCodeAt(n)]=n;const pe=n=>{let e=n.length*.75,t=n.length,s,i=0,r,o,a,h;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const g=new ArrayBuffer(e),f=new Uint8Array(g);for(s=0;s<t;s+=4)r=v[n.charCodeAt(s)],o=v[n.charCodeAt(s+1)],a=v[n.charCodeAt(s+2)],h=v[n.charCodeAt(s+3)],f[i++]=r<<2|o>>4,f[i++]=(o&15)<<4|a>>2,f[i++]=(a&3)<<6|h&63;return g},de=typeof ArrayBuffer=="function",W=(n,e)=>{if(typeof n!="string")return{type:"message",data:se(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:ye(n.substring(1),e)}:O[t]?n.length>1?{type:O[t],data:n.substring(1)}:{type:O[t]}:I},ye=(n,e)=>{if(de){const t=pe(n);return se(t,e)}else return{base64:!0,data:n}},se=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},ne="",ge=(n,e)=>{const t=n.length,s=new Array(t);let i=0;n.forEach((r,o)=>{K(r,!1,a=>{s[o]=a,++i===t&&e(s.join(ne))})})},me=(n,e)=>{const t=n.split(ne),s=[];for(let i=0;i<t.length;i++){const r=W(t[i],e);if(s.push(r),r.type==="error")break}return s};function _e(){return new TransformStream({transform(n,e){le(n,t=>{const s=t.length;let i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);const r=new DataView(i.buffer);r.setUint8(0,126),r.setUint16(1,s)}else{i=new Uint8Array(9);const r=new DataView(i.buffer);r.setUint8(0,127),r.setBigUint64(1,BigInt(s))}n.data&&typeof n.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}let P;function T(n){return n.reduce((e,t)=>e+t.length,0)}function R(n,e){if(n[0].length===e)return n.shift();const t=new Uint8Array(e);let s=0;for(let i=0;i<e;i++)t[i]=n[0][s++],s===n[0].length&&(n.shift(),s=0);return n.length&&s<n[0].length&&(n[0]=n[0].slice(s)),t}function be(n,e){P||(P=new TextDecoder);const t=[];let s=0,i=-1,r=!1;return new TransformStream({transform(o,a){for(t.push(o);;){if(s===0){if(T(t)<1)break;const h=R(t,1);r=(h[0]&128)===128,i=h[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(T(t)<2)break;const h=R(t,2);i=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),s=3}else if(s===2){if(T(t)<8)break;const h=R(t,8),g=new DataView(h.buffer,h.byteOffset,h.length),f=g.getUint32(0);if(f>Math.pow(2,21)-1){a.enqueue(I);break}i=f*Math.pow(2,32)+g.getUint32(4),s=3}else{if(T(t)<i)break;const h=R(t,i);a.enqueue(W(r?h:P.decode(h),e)),s=0}if(i===0||i>n){a.enqueue(I);break}}}})}const ie=4;function u(n){if(n)return we(n)}function we(n){for(var e in u.prototype)n[e]=u.prototype[e];return n}u.prototype.on=u.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};u.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this};u.prototype.off=u.prototype.removeListener=u.prototype.removeAllListeners=u.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var s,i=0;i<t.length;i++)if(s=t[i],s===e||s.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+n],this};u.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,i=t.length;s<i;++s)t[s].apply(this,e)}return this};u.prototype.emitReserved=u.prototype.emit;u.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};u.prototype.hasListeners=function(n){return!!this.listeners(n).length};const x=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),l=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ee="arraybuffer";function re(n,...e){return e.reduce((t,s)=>(n.hasOwnProperty(s)&&(t[s]=n[s]),t),{})}const ve=l.setTimeout,ke=l.clearTimeout;function N(n,e){e.useNativeTimers?(n.setTimeoutFn=ve.bind(l),n.clearTimeoutFn=ke.bind(l)):(n.setTimeoutFn=l.setTimeout.bind(l),n.clearTimeoutFn=l.clearTimeout.bind(l))}const Ae=1.33;function Te(n){return typeof n=="string"?Re(n):Math.ceil((n.byteLength||n.size)*Ae)}function Re(n){let e=0,t=0;for(let s=0,i=n.length;s<i;s++)e=n.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function oe(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Oe(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function Se(n){let e={},t=n.split("&");for(let s=0,i=t.length;s<i;s++){let r=t[s].split("=");e[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return e}class Ce extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}}class $ extends u{constructor(e){super(),this.writable=!1,N(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new Ce(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=W(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=Oe(e);return t.length?"?"+t:""}}class Be extends ${constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};me(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,ge(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=oe()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let ce=!1;try{ce=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const xe=ce;function Ne(){}class Le extends Be{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){const s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(i,r)=>{this.onError("xhr post error",i,r)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}}class d extends u{constructor(e,t,s){super(),this.createRequest=e,N(this,s),this._opts=s,this._method=s.method||"GET",this._uri=t,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;const t=re(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(t);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&s.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var i;s.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=d.requestsCount++,d.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Ne,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete d.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}d.requestsCount=0;d.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",j);else if(typeof addEventListener=="function"){const n="onpagehide"in l?"pagehide":"unload";addEventListener(n,j,!1)}}function j(){for(let n in d.requests)d.requests.hasOwnProperty(n)&&d.requests[n].abort()}const Pe=function(){const n=ae({xdomain:!1});return n&&n.responseType!==null}();class qe extends Le{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=Pe&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new d(ae,this.uri(),e)}}function ae(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||xe))return new XMLHttpRequest}catch{}if(!e)try{return new l[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const he=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class De extends ${get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,s=he?{}:re(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],i=t===e.length-1;K(s,this.supportsBinary,r=>{try{this.doWrite(s,r)}catch{}i&&x(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=oe()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const q=l.WebSocket||l.MozWebSocket;class Ie extends De{createSocket(e,t,s){return he?new q(e,t,s):t?new q(e,t):new q(e)}doWrite(e,t){this.ws.send(t)}}class Ue extends ${get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=be(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),i=_e();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const r=()=>{s.read().then(({done:a,value:h})=>{a||(this.onPacket(h),r())}).catch(a=>{})};r();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],i=t===e.length-1;this._writer.write(s).then(()=>{i&&x(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Fe={websocket:Ie,webtransport:Ue,polling:qe},Ve=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Me=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function U(n){if(n.length>8e3)throw"URI too long";const e=n,t=n.indexOf("["),s=n.indexOf("]");t!=-1&&s!=-1&&(n=n.substring(0,t)+n.substring(t,s).replace(/:/g,";")+n.substring(s,n.length));let i=Ve.exec(n||""),r={},o=14;for(;o--;)r[Me[o]]=i[o]||"";return t!=-1&&s!=-1&&(r.source=e,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=He(r,r.path),r.queryKey=Ke(r,r.query),r}function He(n,e){const t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function Ke(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,r){i&&(t[i]=r)}),t}const F=typeof addEventListener=="function"&&typeof removeEventListener=="function",S=[];F&&addEventListener("offline",()=>{S.forEach(n=>n())},!1);class _ extends u{constructor(e,t){if(super(),this.binaryType=Ee,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const s=U(e);t.hostname=s.host,t.secure=s.protocol==="https"||s.protocol==="wss",t.port=s.port,s.query&&(t.query=s.query)}else t.host&&(t.hostname=U(t.host).host);N(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(s=>{const i=s.prototype.name;this.transports.push(i),this._transportsByName[i]=s}),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},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Se(this.opts.query)),F&&(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"})},S.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=ie,t.transport=e,this.id&&(t.sid=this.id);const s=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&_.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",_.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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 e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let s=0;s<this.writeBuffer.length;s++){const i=this.writeBuffer[s].data;if(i&&(t+=Te(i)),s>0&&t>this._maxPayload)return this.writeBuffer.slice(0,s);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,x(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,s){return this._sendPacket("message",e,t,s),this}send(e,t,s){return this._sendPacket("message",e,t,s),this}_sendPacket(e,t,s,i){if(typeof t=="function"&&(i=t,t=void 0),typeof s=="function"&&(i=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const r={type:e,data:t,options:s};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},s=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(_.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){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(),F&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=S.indexOf(this._offlineEventListener);s!==-1&&S.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}_.protocol=ie;class We extends _{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;_.priorWebsocketSuccess=!1;const i=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",m=>{if(!s)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;_.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(f(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const w=new Error("probe error");w.transport=t.name,this.emitReserved("upgradeError",w)}}))};function r(){s||(s=!0,f(),t.close(),t=null)}const o=m=>{const w=new Error("probe error: "+m);w.transport=t.name,r(),this.emitReserved("upgradeError",w)};function a(){o("transport closed")}function h(){o("socket closed")}function g(m){t&&m.name!==t.name&&r()}const f=()=>{t.removeListener("open",i),t.removeListener("error",o),t.removeListener("close",a),this.off("close",h),this.off("upgrading",g)};t.once("open",i),t.once("error",o),t.once("close",a),this.once("close",h),this.once("upgrading",g),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}}let $e=class extends We{constructor(e,t={}){const s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>Fe[i]).filter(i=>!!i)),super(e,s)}};function Ye(n,e="",t){let s=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),s=U(n)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const r=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+r+":"+s.port+e,s.href=s.protocol+"://"+r+(t&&t.port===s.port?"":":"+s.port),s}const ze=typeof ArrayBuffer=="function",Je=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,ue=Object.prototype.toString,Xe=typeof Blob=="function"||typeof Blob<"u"&&ue.call(Blob)==="[object BlobConstructor]",Qe=typeof File=="function"||typeof File<"u"&&ue.call(File)==="[object FileConstructor]";function Y(n){return ze&&(n instanceof ArrayBuffer||Je(n))||Xe&&n instanceof Blob||Qe&&n instanceof File}function C(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,s=n.length;t<s;t++)if(C(n[t]))return!0;return!1}if(Y(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return C(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&C(n[t]))return!0;return!1}function je(n){const e=[],t=n.data,s=n;return s.data=V(t,e),s.attachments=e.length,{packet:s,buffers:e}}function V(n,e){if(!n)return n;if(Y(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let s=0;s<n.length;s++)t[s]=V(n[s],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=V(n[s],e));return t}return n}function Ge(n,e){return n.data=M(n.data,e),delete n.attachments,n}function M(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=M(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=M(n[t],e));return n}const Ze=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var c;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(c||(c={}));class et{constructor(e){this.replacer=e}encode(e){return(e.type===c.EVENT||e.type===c.ACK)&&C(e)?this.encodeAsBinary({type:e.type===c.EVENT?c.BINARY_EVENT:c.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===c.BINARY_EVENT||e.type===c.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=je(e),s=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(s),i}}class z extends u{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const s=t.type===c.BINARY_EVENT;s||t.type===c.BINARY_ACK?(t.type=s?c.EVENT:c.ACK,this.reconstructor=new tt(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Y(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const s={type:Number(e.charAt(0))};if(c[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===c.BINARY_EVENT||s.type===c.BINARY_ACK){const r=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const o=e.substring(r,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){const r=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(r,t)}else s.nsp="/";const i=e.charAt(t+1);if(i!==""&&Number(i)==i){const r=t+1;for(;++t;){const o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(z.isPayloadValid(s.type,r))s.data=r;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case c.CONNECT:return G(t);case c.DISCONNECT:return t===void 0;case c.CONNECT_ERROR:return typeof t=="string"||G(t);case c.EVENT:case c.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Ze.indexOf(t[0])===-1);case c.ACK:case c.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class tt{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Ge(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function G(n){return Object.prototype.toString.call(n)==="[object Object]"}const st=Object.freeze(Object.defineProperty({__proto__:null,Decoder:z,Encoder:et,get PacketType(){return c}},Symbol.toStringTag,{value:"Module"}));function p(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const nt=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class fe extends u{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[p(e,"open",this.onopen.bind(this)),p(e,"packet",this.onpacket.bind(this)),p(e,"error",this.onerror.bind(this)),p(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,i,r;if(nt.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:c.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const f=this.ids++,m=t.pop();this._registerAckCallback(f,m),o.id=f}const a=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,h=this.connected&&!(!((r=this.io.engine)===null||r===void 0)&&r._hasPingExpired());return this.flags.volatile&&!a||(h?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var s;const i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}const r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===e&&this.sendBuffer.splice(a,1);t.call(this,new Error("operation has timed out"))},i),o=(...a)=>{this.io.clearTimeoutFn(r),t.apply(this,a)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((s,i)=>{const r=(o,a)=>o?i(o):s(a);r.withError=!0,t.push(r),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...r)=>(this._queue[0],i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...r)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:c.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){const s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case c.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 c.EVENT:case c.BINARY_EVENT:this.onevent(e);break;case c.ACK:case c.BINARY_ACK:this.onack(e);break;case c.DISCONNECT:this.ondisconnect();break;case c.CONNECT_ERROR:this.destroy();const s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let s=!1;return function(...i){s||(s=!0,t.packet({type:c.ACK,id:e,data:i}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:c.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const s of t)s.apply(this,e.data)}}}function b(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}b.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=Math.floor(e*10)&1?n+t:n-t}return Math.min(n,this.max)|0};b.prototype.reset=function(){this.attempts=0};b.prototype.setMin=function(n){this.ms=n};b.prototype.setMax=function(n){this.max=n};b.prototype.setJitter=function(n){this.jitter=n};class H extends u{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,N(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new b({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const i=t.parser||st;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new $e(this.uri,this.opts);const t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const i=p(t,"open",function(){s.onopen(),e&&e()}),r=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=p(t,"error",r);if(this._timeout!==!1){const a=this._timeout,h=this.setTimeoutFn(()=>{i(),r(new Error("timeout")),t.close()},a);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(i),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(p(e,"ping",this.onping.bind(this)),p(e,"data",this.ondata.bind(this)),p(e,"error",this.onerror.bind(this)),p(e,"close",this.onclose.bind(this)),p(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){x(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new fe(this,e,t),this.nsps[e]=s),s}_destroy(e){const t=Object.keys(this.nsps);for(const s of t)if(this.nsps[s].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const E={};function B(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=Ye(n,e.path||"/socket.io"),s=t.source,i=t.id,r=t.path,o=E[i]&&r in E[i].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let h;return a?h=new H(s,e):(E[i]||(E[i]=new H(s,e)),h=E[i]),t.query&&!e.query&&(e.query=t.queryKey),h.socket(t.path,e)}Object.assign(B,{Manager:H,Socket:fe,io:B,connect:B});let D=null;const k=new Map;function it(n,e){const t=k.get(n);t&&Array.from(t).forEach(s=>s(e))}function rt(){if(D)return D;const n=B(window.location.origin,{path:"/socket.io",reconnection:!0,withCredentials:!0});return n.on("connect",()=>{console.log("[Socket] Connected to Hub"),n.emit("register_dashboard")}),n.on("disconnect",()=>{console.log("[Socket] Disconnected from Hub")}),n.onAny((e,t)=>it(e,t)),D=n,n}function ot(n,e){let t=k.get(n);return t||(t=new Set,k.set(n,t)),t.add(e),()=>{const s=k.get(n);s&&(s.delete(e),s.size===0&&k.delete(n))}}const ht=()=>{const[n]=A.useState(rt),[e,t]=A.useState(n.connected);A.useEffect(()=>{const i=()=>t(!0),r=()=>t(!1);return n.on("connect",i),n.on("disconnect",r),t(n.connected),()=>{n.off("connect",i),n.off("disconnect",r)}},[n]);const s=A.useCallback((i,r)=>ot(i,r),[]);return{socket:n,isConnected:e,on:s}};export{ht as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g,b as w,r as s,j as e,z as S,f as E}from"./index
|
|
1
|
+
import{g,b as w,r as s,j as e,z as S,f as E}from"./index-Doq8HO3X.js";import{l as k,d as M,c as C,u as R}from"./users-cwrwUhwo.js";import{f as A}from"./time-B8FIgwPE.js";import{P as I}from"./page-header-Qk9pGEaH.js";import{P}from"./plus-DkzZBN8d.js";import{T as D}from"./trash-2-D-ONhY9W.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as P,r,X as c,j as e,x as u,v as b,C as U,H as D}from"./index
|
|
1
|
+
import{m as P,r,X as c,j as e,x as u,v as b,C as U,H as D}from"./index-Doq8HO3X.js";/* empty css */import{F as S}from"./FieldGroup-DnJ8AU1V.js";import{P as H}from"./page-header-Qk9pGEaH.js";import{T as O}from"./trash-2-D-ONhY9W.js";import{P as x}from"./plus-DkzZBN8d.js";import{C as V}from"./circle-x-BISG5iH-.js";import{C as B}from"./circle-check-BR3SeBx6.js";import{Z as I}from"./zap-C8F21kM1.js";import{A as X}from"./activity-C9XYmP_g.js";const C=[{id:"device_offline",label:"Device Offline",icon:U,tone:"red"},{id:"device_new",label:"New Device",icon:x,tone:"green"},{id:"session_failed",label:"Session Failed",icon:V,tone:"amber"},{id:"selector_health_digest",label:"Selector Health Digest",icon:D,tone:"green"}],J=["udid","host","name","sessionId","failureReason","eventType","platform"],ae=()=>{const{toast:o}=P(),[g,T]=r.useState([]),[A,w]=r.useState(!0),[l,j]=r.useState(""),[d,k]=r.useState(["device_offline","session_failed"]),[h,f]=r.useState(!1),[v,N]=r.useState(!1),[n,_]=r.useState(!1),[y,m]=r.useState("");r.useEffect(()=>{p()},[]);const p=async()=>{w(!0);try{const s=await c.getWebhookConfigs();T(s||[])}catch(s){console.error("Failed to load webhook configs",s),o("Failed to load webhooks.","error")}finally{w(!1)}},z=async()=>{if(!l.trim()){o("Webhook URL is required.","error");return}if(d.length===0){o("Select at least one trigger event.","error");return}f(!0);try{await c.addWebhookConfig(l.trim(),d,"slack",y||void 0),j(""),m(""),_(!1),k(["device_offline","session_failed"]),await p(),o("Webhook saved.","success")}catch(s){console.error("Failed to add webhook",s),o(`Failed to add webhook: ${s.message||"unknown error"}`,"error")}finally{f(!1)}},E=async(s,t)=>{if(window.confirm(`Remove webhook for "${t}"?`))try{await c.deleteWebhookConfig(s),await p(),o("Webhook removed.","success")}catch(a){console.error("Failed to delete webhook",a),o(`Failed to delete: ${a.message||"unknown error"}`,"error")}},L=async()=>{if(l.trim()){N(!0);try{await c.testWebhook(l.trim(),"slack"),o("Test payload delivered.","success")}catch(s){o(`Test failed: ${s.message||"check the URL"}`,"error")}finally{N(!1)}}},$=s=>{k(t=>t.includes(s)?t.filter(a=>a!==s):[...t,s])},F=s=>{m(t=>t+`{{${s}}} `)};return e.jsxs("div",{className:"settings-container",children:[e.jsx(H,{icon:u,title:"Notifications",subtitle:"Configure Slack or generic webhooks to receive alerts for critical infrastructure events."}),e.jsxs("div",{className:"settings-content",children:[A?e.jsxs("div",{className:"settings-loading",style:{height:200},children:[e.jsx(b,{className:"animate-spin",size:28}),e.jsx("span",{children:"Loading webhooks…"})]}):g.length===0?e.jsxs("div",{className:"empty-state",children:[e.jsx("div",{className:"empty-state__icon",children:e.jsx(u,{size:28})}),e.jsx("h3",{className:"empty-state__title",children:"No webhooks configured"}),e.jsx("p",{className:"empty-state__copy",children:"Wire up a Slack incoming webhook or any HTTPS endpoint to receive alerts when devices go offline, new devices register, or sessions fail. Configure your first webhook below."})]}):e.jsx("div",{className:"webhook-list-grid",children:g.map(s=>{const t=(()=>{try{return JSON.parse(s.events)}catch{return[]}})();return e.jsxs("div",{className:"webhook-row-card",children:[e.jsxs("div",{className:"webhook-row-card__header",children:[e.jsx("span",{className:`pill-chip ${s.payloadTemplate?"pill-chip--admin":"pill-chip--scope"}`,children:s.payloadTemplate?"CUSTOM":"SLACK"}),e.jsx("span",{className:"webhook-row-card__url",title:s.url,children:s.url}),e.jsxs("button",{type:"button",className:"row-action row-action--danger",onClick:()=>E(s.id,s.url),"aria-label":`Remove webhook for ${s.url}`,children:[e.jsx(O,{size:13}),e.jsx("span",{children:"Remove"})]})]}),e.jsx("div",{className:"webhook-row-card__events",children:t.length===0?e.jsx("span",{className:"webhook-row-card__no-events",children:"No triggers"}):t.map(a=>{const i=C.find(W=>W.id===a),R=(i==null?void 0:i.icon)??u;return e.jsxs("span",{className:`event-pill event-pill--${(i==null?void 0:i.tone)||"gray"}`,children:[e.jsx(R,{size:11}),(i==null?void 0:i.label)||a]},a)})})]},s.id)})}),e.jsxs("div",{className:"add-webhook-card",children:[e.jsxs("div",{className:"add-webhook-card__header",children:[e.jsx(x,{size:14}),e.jsx("span",{children:"Add a new webhook"})]}),e.jsxs("div",{className:"add-webhook-card__body",children:[e.jsx(S,{label:"Webhook URL",description:"The endpoint we POST webhook events to.",htmlFor:"webhook-url",children:e.jsx("div",{className:"setting-input-wrapper",children:e.jsx("input",{id:"webhook-url",type:"url",placeholder:"https://hooks.slack.com/services/...",value:l,onChange:s=>j(s.target.value)})})}),e.jsx(S,{label:"Trigger Events",children:e.jsx("div",{className:"event-toggle-grid",children:C.map(s=>{const t=d.includes(s.id),a=s.icon;return e.jsxs("button",{type:"button",role:"checkbox","aria-checked":t,className:`event-toggle event-toggle--${s.tone} ${t?"is-selected":""}`,onClick:()=>$(s.id),children:[e.jsx(a,{size:14,className:"event-toggle__lead"}),e.jsx("span",{children:s.label}),t&&e.jsx(B,{size:14,className:"event-toggle__check"})]},s.id)})})}),e.jsxs("div",{className:"template-section",children:[e.jsxs("button",{type:"button",className:"template-section__toggle",onClick:()=>_(!n),"aria-expanded":n,children:[e.jsx(I,{size:14,className:n?"tone-amber":"tone-dim"}),e.jsx("span",{children:"Use custom payload (optional)"}),e.jsx("span",{className:"template-section__indicator",children:n?"−":"+"})]}),n&&e.jsxs("div",{className:"template-editor",children:[e.jsx("p",{className:"template-editor__hint",children:"Define a JSON or text template. Click a variable below to insert it."}),e.jsx("div",{className:"template-editor__chips",children:J.map(s=>e.jsx("button",{type:"button",className:"template-editor__chip",onClick:()=>F(s),children:`{{${s}}}`},s))}),e.jsx("textarea",{className:"template-editor__textarea",placeholder:'Example: { "text": "Alert: Device {{udid}} is offline!" }',value:y,onChange:s=>m(s.target.value),rows:4})]})]})]}),e.jsxs("div",{className:"add-webhook-card__footer",children:[e.jsxs("button",{type:"button",className:"page-header-action page-header-action--ghost",onClick:L,disabled:!l.trim()||v,children:[v?e.jsx(b,{size:14,className:"animate-spin"}):e.jsx(X,{size:14}),e.jsx("span",{children:"Test payload"})]}),e.jsxs("button",{type:"button",className:"page-header-action",onClick:z,disabled:h||!l.trim(),children:[h?e.jsx(b,{size:14,className:"animate-spin"}):e.jsx(x,{size:14}),e.jsx("span",{children:h?"Saving…":"Save webhook"})]})]})]})]})]})};export{ae as WebhookSettings};
|
package/lib/public/index.html
CHANGED
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
Learn how to configure a non-root public URL by running `npm run build`.
|
|
25
25
|
-->
|
|
26
26
|
<title>Xenon</title>
|
|
27
|
-
<script type="module" crossorigin src="/xenon/assets/index
|
|
28
|
-
<link rel="stylesheet" crossorigin href="/xenon/assets/index-
|
|
27
|
+
<script type="module" crossorigin src="/xenon/assets/index-Doq8HO3X.js"></script>
|
|
28
|
+
<link rel="stylesheet" crossorigin href="/xenon/assets/index-TkL430dq.css">
|
|
29
29
|
</head>
|
|
30
30
|
|
|
31
31
|
<body>
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as u,j as t,X as E}from"./index--TKsSVZp.js";import{A as X,I as ge}from"./keycodes-bIEJfQzr.js";function be(e,r){return e!=="auto"?e:r<=1?"1":r===2?"2x1":r<=4?"2x2":"3x2"}const ve={selected:new Set,layout:"2x2",tiles:[],groupId:null,recording:!1,startedAt:null,annotateMode:!1,shape:"RECT",color:"#ff3333",errorBanner:null};function ye(e,r){switch(r.type){case"SET_LAYOUT":return{...e,layout:r.layout};case"TOGGLE_SELECTED":{const n=new Set(e.selected);return n.has(r.udid)?n.delete(r.udid):n.add(r.udid),{...e,selected:n}}case"CLEAR_SELECTED":return{...e,selected:new Set};case"SET_TILES":return{...e,tiles:r.tiles};case"ADD_TILE":return e.tiles.some(n=>n.udid===r.tile.udid)?e:{...e,tiles:[...e.tiles,r.tile]};case"REMOVE_TILE":return{...e,tiles:e.tiles.filter(n=>n.udid!==r.udid)};case"BIND_RECORDING_IDS":{const n=e.tiles.map(d=>({...d,recordingId:r.map[d.udid]??d.recordingId}));return{...e,tiles:n}}case"START_RECORDING":{const n=e.tiles.map(d=>({...d,recordingId:r.tileIds[d.udid]??d.recordingId}));return{...e,groupId:r.groupId,recording:!0,startedAt:r.startedAt,tiles:n}}case"STOP_RECORDING":{const n=e.tiles.map(d=>({...d,recordingId:void 0}));return{...e,recording:!1,tiles:n}}case"SET_ANNOTATE_MODE":return{...e,annotateMode:r.enabled};case"SET_SHAPE":return{...e,shape:r.shape};case"SET_COLOR":return{...e,color:r.color};case"SET_ERROR_BANNER":return{...e,errorBanner:r.message};default:return e}}const re=u.createContext(null);function we(){const e=u.useContext(re);if(!e)throw new Error("useMosaic must be used inside <MosaicContext.Provider>");return e}function Ne(){return u.useReducer(ye,ve)}function Re(e){switch(e){case"automation":return"In automation";case"manual_other":return"Manual control by another user";case"manual_self":return"In your mosaic";case"recording_other_group":return"Recording in another group";default:return e?"Busy":null}}const q=[{id:"ios",label:"iOS",match:e=>e==="ios"},{id:"android",label:"Android",match:e=>e==="android"},{id:"tvos",label:"tvOS",match:e=>e==="tvos"},{id:"androidtv",label:"Android TV",match:e=>e==="androidtv"||e==="android-tv"},{id:"other",label:"Other",match:()=>!0}];function je(e){return e?e==="androidtv"||e==="android-tv"?"ANDROID TV":e.toUpperCase():""}function Ee({devices:e,inMosaic:r,onToggle:n}){const[d,b]=u.useState(""),[m,y]=u.useState({}),w=u.useMemo(()=>{const f=d.trim().toLowerCase();return f?e.filter(g=>g.udid.toLowerCase().includes(f)||(g.name??"").toLowerCase().includes(f)||(g.platform??"").toLowerCase().includes(f)):e},[e,d]),v=u.useMemo(()=>{const f=q.map(o=>({id:o.id,label:o.label,rows:[]})),g=o=>f.find((c,s)=>q[s].match(o))??f[f.length-1];for(const o of w)g((o.platform??"").toLowerCase()).rows.push(o);return f.filter(o=>o.rows.length>0)},[w]);return e.length===0?t.jsx("div",{className:"text-xs text-[var(--text-dim)] p-3",children:"No devices online."}):t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"relative",children:[t.jsx("span",{"aria-hidden":!0,className:"absolute left-2 top-1/2 -translate-y-1/2 text-[var(--text-dim)] text-xs",children:"⌕"}),t.jsx("input",{type:"text",value:d,placeholder:"Filter devices...",onChange:f=>b(f.target.value),className:"w-full pl-7 pr-2 py-1.5 text-xs rounded border border-[var(--border)] bg-transparent placeholder:text-[var(--text-dim)] focus:outline-none focus:border-[var(--accent,#3b82f6)]"})]}),v.map(f=>{const g=m[f.id];return t.jsxs("section",{className:"flex flex-col gap-1",children:[t.jsxs("button",{type:"button",onClick:()=>y(o=>({...o,[f.id]:!o[f.id]})),className:"flex items-center justify-between w-full text-[10px] uppercase tracking-wider text-[var(--text-dim)] hover:text-white px-1 py-0.5",children:[t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx("span",{"aria-hidden":!0,className:`inline-block transition-transform ${g?"-rotate-90":"rotate-0"}`,children:"▾"}),f.label]}),t.jsx("span",{children:f.rows.length})]}),!g&&t.jsx("ul",{className:"flex flex-col gap-1 text-sm",children:f.rows.map(o=>{const c=o.busyReason==="manual_self",s=r.has(o.udid),x=!!o.busy&&!c&&!s||!!o.offline,j=o.offline?"Offline":Re(o.busyReason),i=!x;return t.jsx("li",{children:t.jsxs("button",{type:"button",disabled:x,draggable:!x,onDragStart:l=>{l.dataTransfer.effectAllowed="copy",l.dataTransfer.setData("application/x-xenon-udid",o.udid),l.dataTransfer.setData("text/plain",o.udid)},onClick:()=>n(o.udid),className:`w-full flex items-center gap-2 px-2 py-1.5 rounded text-left border transition-colors ${x?"opacity-60 cursor-not-allowed border-transparent":s?"border-emerald-500/40 bg-emerald-500/5 hover:bg-emerald-500/10":"border-transparent hover:border-[var(--border)] hover:bg-[var(--surface-2,rgba(255,255,255,0.04))]"}`,title:x?`${j} — release first`:s?"Click to remove from mosaic (or drag to a cell)":"Click to add to mosaic (or drag to a cell)",children:[t.jsx("span",{"aria-hidden":!0,className:`inline-flex items-center justify-center w-4 h-4 text-xs ${s?"text-emerald-400":"text-[var(--text-dim)]"}`,children:s?"●":"○"}),t.jsx("span",{"aria-hidden":!0,className:`inline-block w-1.5 h-1.5 rounded-full ${o.offline?"bg-zinc-600":i?"bg-emerald-400 shadow-[0_0_4px_rgba(52,211,153,0.7)]":"bg-yellow-500"}`}),t.jsx("span",{className:"font-medium flex-1 truncate text-[13px]",children:o.name??o.udid}),o.platform&&t.jsx("span",{className:"text-[9px] uppercase tracking-wider px-1.5 py-0.5 rounded bg-[var(--surface-2,rgba(255,255,255,0.06))] text-[var(--text-dim)]",children:je(o.platform)})]})},o.udid)})})]},f.id)}),d&&v.length===0&&t.jsxs("div",{className:"text-xs text-[var(--text-dim)] px-1 py-2",children:['No devices match "',d,'".']}),t.jsxs("div",{className:"text-[10px] text-[var(--text-dim)] px-1 pt-2 flex items-center gap-3",children:[t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-400 inline-block"})," available"]}),t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-yellow-500 inline-block"})," in use"]}),t.jsxs("span",{className:"inline-flex items-center gap-1",children:[t.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-zinc-600 inline-block"})," offline"]})]})]})}const Te=[{id:"1",label:"1",icon:t.jsx(Ce,{})},{id:"2x1",label:"2×1",icon:t.jsx(ke,{})},{id:"2x2",label:"2×2",icon:t.jsx(Ie,{})},{id:"3x2",label:"3×2",icon:t.jsx(_e,{})},{id:"auto",label:"Auto",icon:t.jsx(De,{})}];function Se({value:e,onChange:r}){return t.jsx("div",{role:"tablist",className:"inline-flex border border-[var(--border)] rounded-md overflow-hidden text-xs bg-[var(--surface-1,rgba(255,255,255,0.02))]",children:Te.map(n=>{const d=e===n.id;return t.jsxs("button",{role:"tab","aria-selected":d,onClick:()=>r(n.id),className:`flex items-center gap-1.5 px-2.5 py-1.5 border-r border-[var(--border)] last:border-r-0 transition-colors ${d?"bg-[var(--surface-2,#2a2a2a)] text-white":"text-[var(--text-dim)] hover:bg-[var(--surface-2,rgba(255,255,255,0.04))] hover:text-white"}`,title:`Layout: ${n.label}`,children:[t.jsx("span",{className:"w-3.5 h-3.5 inline-flex items-center justify-center",children:n.icon}),t.jsx("span",{children:n.label})]},n.id)})})}function k(e){return t.jsx("rect",{rx:1.2,ry:1.2,fill:"currentColor",...e})}function Ce(){return t.jsx("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:k({x:2,y:2,width:10,height:10})})}function ke(){return t.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:[k({x:1.5,y:3,width:5,height:8}),k({x:7.5,y:3,width:5,height:8})]})}function Ie(){return t.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:[k({x:1.5,y:1.5,width:5,height:5}),k({x:7.5,y:1.5,width:5,height:5}),k({x:1.5,y:7.5,width:5,height:5}),k({x:7.5,y:7.5,width:5,height:5})]})}function _e(){return t.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",children:[k({x:1,y:1.5,width:3.3,height:5}),k({x:5.35,y:1.5,width:3.3,height:5}),k({x:9.7,y:1.5,width:3.3,height:5}),k({x:1,y:7.5,width:3.3,height:5}),k({x:5.35,y:7.5,width:3.3,height:5}),k({x:9.7,y:7.5,width:3.3,height:5})]})}function De(){return t.jsxs("svg",{viewBox:"0 0 14 14",className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",children:[t.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"1.5"}),t.jsx("circle",{cx:"7",cy:"7",r:"1.5",fill:"currentColor",stroke:"none"})]})}function Ae({enabled:e,shape:r,color:n,onCommit:d}){const b=u.useRef(null),[m,y]=u.useState(null);u.useEffect(()=>{const c=b.current;if(!c)return;const s=()=>{c.width=c.clientWidth,c.height=c.clientHeight,w()};s();const x=new ResizeObserver(s);return x.observe(c),()=>x.disconnect()},[]);const w=u.useCallback(()=>{const c=b.current;if(!c)return;const s=c.getContext("2d");if(s&&(s.clearRect(0,0,c.width,c.height),!!m)){if(s.strokeStyle=n,s.lineWidth=3,r==="RECT"||r==="ARROW"||r==="FREEHAND")s.strokeRect(Math.min(m.startX,m.curX),Math.min(m.startY,m.curY),Math.abs(m.curX-m.startX),Math.abs(m.curY-m.startY));else if(r==="CIRCLE"){const x=Math.hypot(m.curX-m.startX,m.curY-m.startY);s.beginPath(),s.arc(m.startX,m.startY,x,0,Math.PI*2),s.stroke()}}},[m,n,r]);u.useEffect(()=>{w()},[m,w]);const v=c=>{const x=b.current.getBoundingClientRect();return{px:c.clientX-x.left,py:c.clientY-x.top,w:x.width,h:x.height}},f=c=>{if(!e)return;const s=v(c);y({startX:s.px,startY:s.py,curX:s.px,curY:s.py})},g=c=>{if(!m)return;const s=v(c);y({...m,curX:s.px,curY:s.py})},o=c=>{if(!m||!e)return;const s=v(c),x=Math.min(m.startX,s.px)/s.w,j=Math.min(m.startY,s.py)/s.h,i=Math.abs(s.px-m.startX)/s.w,l=Math.abs(s.py-m.startY)/s.h;i>.005&&l>.005&&d({shape:r,color:n,geometry:{x,y:j,w:i,h:l}}),y(null)};return t.jsx("canvas",{ref:b,style:{position:"absolute",inset:0,pointerEvents:e?"auto":"none",cursor:e?"crosshair":"default"},onMouseDown:f,onMouseMove:g,onMouseUp:o,onMouseLeave:()=>y(null)})}const Me=3,Oe=45e3,Z=[2e3,5e3,1e4];function $e(e){const r=Math.max(0,Math.min(e,Z.length-1));return Z[r]}function Le(e){return e<Me}function Q(e){const r=(e.lastError||"").toLowerCase();return/did not find test app|not installed|webdriveragentrunner|applicationverification/.test(r)?"WebDriverAgent is not installed on this device. Install and trust WDA, then retry.":/unsupported ios version|manualpairingtunnelstart/.test(r)?"This device’s iOS version is not supported for live streaming on this host.":/econnrefused|econnreset|connection reset|tunnel/.test(r)?"Lost the connection to the device tunnel. Reconnect the device, then retry.":e.lastError&&e.lastError.trim()?e.lastError.trim():"We couldn’t start the live stream for this device."}const Be=10,Pe=500;function Ue({udid:e,name:r,recordingId:n,annotateMode:d,shape:b,color:m,aspect:y="9 / 16",screenWidth:w,screenHeight:v,platform:f,onAnnotation:g,onRemove:o}){const[c,s]=u.useState("connecting"),[x,j]=u.useState(0),i=u.useRef(0),l=u.useRef(null),[p,R]=u.useState(""),[O,M]=u.useState([]),[N,T]=u.useState(!1),S=u.useRef(null),L=u.useRef(null),B=f==="android"||f==="androidtv"||f==="android-tv",oe=f==="ios"||f==="tvos",U=!d&&!!w&&!!v,G=(a,h,C)=>{const D=w,_=v,A=Math.min(1,Math.max(0,(a-C.left)/C.width)),I=Math.min(1,Math.max(0,(h-C.top)/C.height));return{x:Math.round(A*D),y:Math.round(I*_)}},ae=(a,h,C)=>{const D=Date.now()+Math.random(),_=a-C.left,A=h-C.top;M(I=>[...I,{id:D,x:_,y:A}]),window.setTimeout(()=>{M(I=>I.filter(W=>W.id!==D))},500)},ie=a=>{if(!U||c!=="live"||a.button!==0)return;const h=a.currentTarget;h.setPointerCapture(a.pointerId),L.current={startX:a.clientX,startY:a.clientY,startTime:Date.now(),rect:h.getBoundingClientRect()},ae(a.clientX,a.clientY,L.current.rect),h.focus()},ce=async a=>{var V,J;const h=L.current;if(L.current=null,!h||!U)return;try{a.currentTarget.releasePointerCapture(a.pointerId)}catch{}const C=a.clientX-h.startX,D=a.clientY-h.startY,_=Math.hypot(C,D),A=Date.now()-h.startTime,I=G(h.startX,h.startY,h.rect),W=_<Be;try{if(W&&A<Pe)await E.tap(e,I.x,I.y);else if(W)await((J=(V=E).touchAndHold)==null?void 0:J.call(V,e,I.x,I.y,A));else{const Y=G(a.clientX,a.clientY,h.rect);await E.swipe(e,I.x,I.y,Y.x,Y.y)}}catch(Y){console.error(`[DeviceTile] gesture failed for ${e}`,Y)}},le=()=>{L.current=null},de=async a=>{if(!U||c!=="live"||a.metaKey||a.ctrlKey||a.altKey)return;const h=a.key;try{if(h.length===1){a.preventDefault(),await E.typeText(e,h);return}if(h==="Backspace"){a.preventDefault(),B?await E.pressKey(e,67):await E.typeText(e,"\b");return}if(h==="Enter"){a.preventDefault(),B?await E.pressKey(e,66):await E.typeText(e,`
|
|
2
|
-
`);return}if(h==="Tab"){a.preventDefault(),await E.typeText(e," ");return}h==="Escape"&&B&&(a.preventDefault(),await E.pressKey(e,X.BACK))}catch(C){console.error(`[DeviceTile] keystroke "${h}" failed for ${e}`,C)}},ue=()=>E.pressKey(e,B?X.HOME:ge.HOME).catch(a=>console.error(`[DeviceTile] home failed for ${e}`,a)),fe=()=>E.pressKey(e,X.BACK).catch(a=>console.error(`[DeviceTile] back failed for ${e}`,a)),me=()=>E.pressKey(e,X.APP_SWITCH).catch(a=>console.error(`[DeviceTile] app-switch failed for ${e}`,a)),xe=async()=>{try{const a=await E.getScreenshot(e),h=(a==null?void 0:a.screenshot)??(a==null?void 0:a.value)??a;if(!h)return;const C=await fetch(`data:image/png;base64,${h}`).then(A=>A.blob()),D=URL.createObjectURL(C),_=document.createElement("a");_.href=D,_.download=`${r||e}-${Date.now()}.png`,document.body.appendChild(_),_.click(),_.remove(),setTimeout(()=>URL.revokeObjectURL(D),1e3)}catch(a){console.error(`[DeviceTile] screenshot failed for ${e}`,a)}};u.useEffect(()=>{console.log(`[DeviceTile] Rendering ${e} in state: ${c}`)},[e,c]);const he=`/xenon/api/control/${encodeURIComponent(e)}/stream?t=${x}`,z=u.useCallback(async()=>{try{const a=await fetch(`/xenon/api/control/${encodeURIComponent(e)}/stream/status`);if(!a.ok)throw new Error(String(a.status));const h=await a.json();R(Q({lastError:h==null?void 0:h.lastError,status:h==null?void 0:h.status}))}catch{R(Q({}))}},[e]),H=u.useCallback(()=>{const a=i.current;Le(a)?(i.current=a+1,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{s("connecting"),j(Date.now())},$e(a))):(s("unavailable"),z())},[z]);u.useEffect(()=>{if(c!=="connecting")return;const a=setTimeout(H,Oe);return()=>clearTimeout(a)},[c,x,H]),u.useEffect(()=>()=>{l.current&&clearTimeout(l.current)},[]);const pe=()=>{l.current&&clearTimeout(l.current),i.current=0,R(""),s("connecting"),j(Date.now())},P=!!n,K=r||e.slice(0,16)+"…";return t.jsxs("div",{className:"flex items-stretch justify-center w-full h-full min-h-0 min-w-0 gap-2",children:[t.jsxs("div",{className:"relative bg-[#000] rounded-lg overflow-hidden border border-[var(--border)] group max-h-full max-w-full self-center",style:{aspectRatio:y,height:"100%"},children:[c==="connecting"&&t.jsxs("div",{className:"flex flex-col items-center justify-center bg-neutral-900 text-neutral-400 absolute inset-0 z-20",children:[t.jsxs("div",{className:"relative flex items-center justify-center",children:[t.jsx("div",{className:"w-12 h-12 border-4 border-neutral-800 border-t-red-500 rounded-full animate-spin"}),t.jsx("div",{className:"absolute text-[10px] text-red-500 font-bold",children:"WDA"})]}),t.jsx("div",{className:"mt-4 font-bold text-neutral-200",children:"Starting Stream…"}),t.jsx("div",{className:"text-[10px] mt-1 text-neutral-500 opacity-60 font-mono",children:e}),t.jsx("div",{className:"text-[10px] mt-4 text-neutral-400 bg-white/5 px-2 py-1 rounded",children:"Waiting for device connection..."})]}),c==="unavailable"&&t.jsx("div",{className:"flex items-center justify-center bg-black text-neutral-400 absolute inset-0 z-20",children:t.jsxs("div",{className:"text-center p-6",children:[t.jsx("div",{className:"text-5xl mb-4 opacity-20",children:"📵"}),t.jsx("div",{className:"font-bold text-white text-lg",children:"Connection Failed"}),t.jsx("p",{className:"text-xs mt-2 text-neutral-500 leading-relaxed max-w-[240px] mx-auto",children:p||"We couldn’t start the live stream for this device."}),t.jsx("button",{className:"mt-6 text-sm font-semibold px-6 py-2.5 rounded-full bg-red-600 hover:bg-red-500 text-white transition-all shadow-[0_0_20px_rgba(220,38,38,0.3)] active:scale-95",onClick:pe,children:"Retry Connection"})]})}),t.jsx("img",{src:he,alt:K,className:"absolute inset-0 w-full h-full object-contain bg-black select-none pointer-events-none",draggable:!1,style:{opacity:c==="live"?1:0,transition:"opacity 0.3s ease-in-out"},onLoad:()=>{console.log(`[DeviceTile] Image LOADED for ${e}`),i.current=0,l.current&&clearTimeout(l.current),s("live")},onError:a=>{console.error(`[DeviceTile] Image ERROR for ${e}`,a),H()}},x),U&&c==="live"&&t.jsx("div",{ref:S,className:`absolute inset-0 z-10 touch-none outline-none ${N?"ring-2 ring-emerald-400/60 ring-inset rounded-lg":""}`,tabIndex:0,onPointerDown:ie,onPointerUp:ce,onPointerCancel:le,onKeyDown:de,onFocus:()=>T(!0),onBlur:()=>T(!1)}),t.jsx("div",{className:"absolute inset-0 z-20 pointer-events-none overflow-hidden",children:O.map(a=>t.jsx("span",{className:"absolute block w-10 h-10 rounded-full border-2 border-emerald-300/80 animate-ping",style:{left:a.x-20,top:a.y-20}},a.id))}),P&&d&&t.jsx(Ae,{enabled:!0,shape:b,color:m,onCommit:a=>g(n,a)}),P&&t.jsx("div",{className:"absolute top-3 left-3 z-30 pointer-events-none",children:t.jsx("span",{className:"px-2 py-0.5 rounded-sm bg-red-600 text-white text-[9px] font-black shadow-lg",children:"REC"})}),t.jsxs("div",{className:"absolute top-3 left-3 z-30 flex flex-col gap-1.5 pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:[c==="live"&&!P&&t.jsx("span",{className:"px-2 py-0.5 rounded-sm bg-emerald-500 text-black text-[9px] font-black shadow-lg w-fit",children:"LIVE"}),t.jsx("span",{className:"px-2 py-1 rounded bg-black/80 text-white text-[11px] font-medium backdrop-blur-md border border-white/10 shadow-xl truncate max-w-[180px]",children:K})]})]}),t.jsx(We,{streamState:c,recording:P,isIOS:oe,isAndroid:B,platform:f,onClose:!P&&o?()=>o(e):void 0,sendHome:ue,sendBack:fe,sendAppSwitch:me,captureScreenshot:xe,displayName:K})]})}function We({streamState:e,recording:r,isIOS:n,isAndroid:d,platform:b,onClose:m,sendHome:y,sendBack:w,sendAppSwitch:v,captureScreenshot:f,displayName:g}){const o=e==="live";return!m&&!o?null:t.jsxs("div",{className:"self-stretch w-9 flex flex-col items-center justify-between gap-1 py-2 rounded-lg bg-black/40 border border-white/10 backdrop-blur-md text-white",children:[t.jsx("div",{className:"flex flex-col items-center gap-1",children:m&&t.jsx("button",{type:"button","aria-label":`Remove ${g} from mosaic`,title:"Remove from mosaic",onClick:m,className:"w-7 h-7 flex items-center justify-center rounded-md hover:bg-red-600/70 transition-colors text-base leading-none",children:"×"})}),o&&t.jsxs("div",{className:"flex flex-col items-center gap-1.5 my-auto",children:[(d||n)&&t.jsx("button",{type:"button",title:`Home${b?` (${b})`:""}`,onClick:y,className:"w-7 h-7 flex items-center justify-center rounded-md hover:bg-white/15 transition-colors text-sm",children:"⌂"}),d&&t.jsx("button",{type:"button",title:"Back",onClick:w,className:"w-7 h-7 flex items-center justify-center rounded-md hover:bg-white/15 transition-colors text-sm",children:"‹"}),d&&t.jsx("button",{type:"button",title:"Recent apps",onClick:v,className:"w-7 h-7 flex items-center justify-center rounded-md hover:bg-white/15 transition-colors text-sm",children:"▢"})]}),o&&t.jsx("div",{className:"flex flex-col items-center gap-1",children:t.jsx("button",{type:"button",title:"Screenshot",onClick:f,className:"w-7 h-7 flex items-center justify-center rounded-md hover:bg-white/15 transition-colors text-sm",children:"⎙"})})]})}const Ye={1:"1fr","2x1":"1fr 1fr","2x2":"1fr 1fr","3x2":"1fr 1fr 1fr"},Xe={1:"1fr","2x1":"1fr","2x2":"1fr 1fr","3x2":"1fr 1fr"},Fe={1:1,"2x1":2,"2x2":4,"3x2":6};function He({layout:e,tiles:r,annotateMode:n,shape:d,color:b,onAnnotation:m,onRemove:y,onDropDevice:w}){const v=be(e,r.length),f=Fe[v];r.length;const g=r.length,o=e==="auto"?Math.max(g,1):f,c=Math.max(0,o-g);return t.jsxs("div",{style:{display:"grid",gap:8,gridTemplateColumns:Ye[v],gridTemplateRows:Xe[v]},className:"h-full",children:[r.map(s=>t.jsx(Ue,{udid:s.udid,name:s.name,mjpegPort:s.mjpegPort,recordingId:s.recordingId,aspect:s.aspect,screenWidth:s.screenWidth,screenHeight:s.screenHeight,platform:s.platform,annotateMode:n,shape:d,color:b,onAnnotation:m,onRemove:y},s.udid)),Array.from({length:c},(s,x)=>t.jsx(Ke,{onDropDevice:w},`empty-${x}`))]})}function Ke({onDropDevice:e}){const[r,n]=u.useState(!1);return t.jsxs("div",{onDragOver:d=>{e&&(d.preventDefault(),d.dataTransfer.dropEffect="copy",r||n(!0))},onDragLeave:()=>n(!1),onDrop:d=>{if(n(!1),!e)return;d.preventDefault();const b=d.dataTransfer.getData("application/x-xenon-udid")||d.dataTransfer.getData("text/plain");b&&e(b)},className:`flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed transition-colors ${r?"border-emerald-500/60 bg-emerald-500/5":"border-[var(--border)] bg-[var(--surface-1,rgba(255,255,255,0.02))]"} text-[var(--text-dim)] min-h-[120px]`,children:[t.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-xl ${r?"bg-emerald-500/15 text-emerald-300":"bg-white/5 text-white/60"}`,children:"+"}),t.jsx("div",{className:"text-xs font-medium",children:"Drag device here"}),t.jsx("div",{className:"text-[10px] opacity-70",children:"or click one in the panel"})]})}const $="/xenon/api/recordings";class ne extends Error{constructor(r){super(r.message??r.error),this.body=r}}async function F(e,r){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:r?JSON.stringify(r):void 0});if(n.status===409)throw new ne(await n.json());if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json()}function Ge(e,r){return F($,{udids:e,...r})}function ze(e){return F(`${$}/${encodeURIComponent(e)}/stop`)}function se(e,r,n,d,b){return F(`${$}/${encodeURIComponent(e)}/bookmark`,{recordingId:r,timecodeMs:n,label:d,note:b})}function Ve(e,r){return F(`${$}/${encodeURIComponent(e)}/annotation`,r)}function Je(e){return`${$}/${encodeURIComponent(e)}/bundle.zip`}function qe(e){return`${$}/${encodeURIComponent(e)}/composite.mp4`}function Ze({selectedUdids:e}){const{state:r,dispatch:n}=we(),d=async()=>{if(!(r.recording||e.length===0))try{const o=await Ge(e),c={};for(const s of o.recordings)c[s.udid]=s.id;n({type:"START_RECORDING",groupId:o.groupId,startedAt:Date.now(),tileIds:c}),n({type:"SET_ERROR_BANNER",message:null})}catch(o){if(o instanceof ne)if(o.body.error==="device_busy"){const c=(o.body.busyDevices??[]).map(s=>`${s.udid} (${s.reason})`).join(", ");n({type:"SET_ERROR_BANNER",message:`Cannot start — these devices are busy: ${c}`})}else n({type:"SET_ERROR_BANNER",message:`Server-wide recording cap reached (${o.body.active}/${o.body.limit}).`});else n({type:"SET_ERROR_BANNER",message:`Recording failed: ${o.message}`})}},b=async()=>{if(r.groupId)try{await ze(r.groupId)}catch(o){n({type:"SET_ERROR_BANNER",message:`Stop failed: ${o.message}`})}finally{n({type:"STOP_RECORDING"})}},m=async()=>{var x;if(!r.groupId||!r.recording)return;const o=window.prompt("Bookmark label?");if(!o)return;const c=r.startedAt?Date.now()-r.startedAt:0,s=(x=r.tiles.find(j=>j.recordingId))==null?void 0:x.recordingId;if(s)try{await se(r.groupId,s,c,o)}catch(j){n({type:"SET_ERROR_BANNER",message:`Bookmark failed: ${j.message}`})}},y=()=>n({type:"SET_ANNOTATE_MODE",enabled:!r.annotateMode}),w=!r.recording&&e.length>0,v=r.recording,f=r.groupId&&!r.recording,g=f&&r.tiles.length>=2;return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:d,disabled:!w,className:"px-3 py-1.5 text-sm rounded bg-red-600 text-white disabled:opacity-40 disabled:cursor-not-allowed",children:["● ",e.length>1?"Record All":"Record"]}),t.jsx("button",{onClick:b,disabled:!v,className:"px-3 py-1.5 text-sm rounded border border-[var(--border)] disabled:opacity-40 disabled:cursor-not-allowed",children:"⏹ Stop"}),t.jsx("button",{onClick:m,disabled:!v,className:"px-3 py-1.5 text-sm rounded border border-[var(--border)] disabled:opacity-40 disabled:cursor-not-allowed",children:"🔖 Bookmark"}),t.jsx("button",{onClick:y,disabled:!r.recording,className:`px-3 py-1.5 text-sm rounded border ${r.annotateMode?"bg-[var(--accent,#3b82f6)] text-white border-transparent":"border-[var(--border)]"} disabled:opacity-40 disabled:cursor-not-allowed`,children:"✎ Annotate"}),g&&t.jsx("a",{href:qe(r.groupId),className:"ml-2 px-3 py-1.5 text-sm rounded border border-[var(--border)] hover:bg-[var(--surface-2,#1a1a1a)]",download:`mosaic-${r.groupId}.mp4`,children:"⤓ Composite mp4"}),f&&t.jsx("a",{href:Je(r.groupId),className:`${g?"ml-1":"ml-2"} px-3 py-1.5 text-sm rounded border border-[var(--border)] hover:bg-[var(--surface-2,#1a1a1a)]`,download:!0,children:"⤓ Proof bundle"})]})}function Qe({remainingSec:e,onContinue:r,onReleaseNow:n}){return t.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"idle-warning-title",className:"fixed inset-0 z-40 bg-black/60 flex items-center justify-center",children:t.jsxs("div",{className:"bg-[var(--bg)] border border-[var(--border)] rounded-lg w-full max-w-md p-6",children:[t.jsx("h3",{id:"idle-warning-title",className:"text-base font-semibold mb-2",children:"Are you still there?"}),t.jsxs("p",{className:"text-sm text-[var(--text-dim)] mb-4",children:["Your devices will be released in"," ",t.jsxs("span",{className:"text-[var(--text)] font-mono font-semibold",children:[e,"s"]})," due to inactivity. Click ",t.jsx("strong",{children:"Continue Session"})," to keep them locked."]}),t.jsxs("div",{className:"flex justify-end gap-2",children:[t.jsx("button",{type:"button",onClick:n,className:"h-9 px-3 rounded-md border border-[var(--border)] text-sm text-[var(--text-dim)] hover:text-[var(--text)]",children:"Release now"}),t.jsx("button",{type:"button",autoFocus:!0,onClick:r,className:"h-9 px-4 rounded-md bg-[var(--green)] text-black text-sm font-medium",children:"Continue Session"})]})]})})}const ee=["mousemove","mousedown","keydown","touchstart","wheel"];function et({idleAfterMs:e,warningSec:r,onWarning:n,onTimeout:d,enabled:b}){const[m,y]=u.useState(!1),[w,v]=u.useState(null),f=u.useRef(null),g=u.useRef(null),o=u.useRef(!1),c=u.useRef(n),s=u.useRef(d);c.current=n,s.current=d;function x(){f.current&&(clearTimeout(f.current),f.current=null),g.current&&(clearInterval(g.current),g.current=null)}function j(){o.current=!0,y(!0),v(r),c.current(r);let p=r;g.current=setInterval(()=>{p-=1,p<=0?(x(),o.current=!1,y(!1),v(null),s.current()):v(p)},1e3)}function i(){x(),o.current=!1,y(!1),v(null);const p=e-r*1e3;f.current=setTimeout(j,Math.max(0,p))}function l(){b&&i()}return u.useEffect(()=>{if(!b){x(),o.current=!1,y(!1),v(null);return}function p(){o.current||i()}return ee.forEach(R=>window.addEventListener(R,p,{passive:!0})),i(),()=>{ee.forEach(R=>window.removeEventListener(R,p)),x()}},[b,e,r]),{warning:m,remainingSec:w,reset:l}}const tt=5*60*1e3,rt=30;function te(e){if(!e)return"9 / 16";const r=Number(e.screenWidth),n=Number(e.screenHeight);if(Number.isFinite(r)&&Number.isFinite(n)&&r>0&&n>0)return`${r} / ${n}`;const d=(e.platform||"").toLowerCase();return d==="tvos"||d==="androidtv"||d==="android-tv"?"16 / 9":"9 / 16"}function nt(e,r,n){return n?e===`manual_${n}_${r}`:!1}function st(e,r){if(e.busy)return e.session_id?e.session_id.startsWith("manual_")?nt(e.session_id,e.udid,r)?"manual_self":"manual_other":"automation":"unknown"}function ot(e,r){return{udid:e.udid,name:e.name,platform:e.platform,busy:e.busy,busyReason:st(e,r),mjpegServerPort:e.mjpegServerPort,offline:!!e.offline}}function ct(){const[e,r]=Ne(),[n,d]=u.useState([]),[b,m]=u.useState(0),[y,w]=u.useState(null);u.useEffect(()=>{let i=!1;return fetch("/xenon/api/auth/me",{credentials:"include"}).then(l=>l.ok?l.json():null).then(l=>{!i&&(l!=null&&l.userId)&&w(l.userId)}).catch(()=>{}),()=>{i=!0}},[]),u.useEffect(()=>{let i=!1;const l=async()=>{try{const R=await E.getDevices();i||d(Array.isArray(R)?R:[])}catch{}};l();const p=window.setInterval(l,5e3);return()=>{i=!0,window.clearInterval(p)}},[b]),u.useEffect(()=>{let i=!1;return(async()=>{try{const l=await E.getDevices(),p=(Array.isArray(l)?l:[]).filter(N=>{var T;return N.busy&&((T=N.session_id)==null?void 0:T.startsWith("manual_"))});if(p.length===0)return;const O=(await Promise.all(p.map(async N=>{try{const T=await fetch(`/xenon/api/control/${encodeURIComponent(N.udid)}/stream/status`);if(!T.ok)return null;const S=await T.json();return(S==null?void 0:S.status)==="running"?N:null}catch{return null}}))).filter(N=>N!==null);if(i||O.length===0)return;const M=O.map(N=>{const T=Number(N.screenWidth),S=Number(N.screenHeight);return{udid:N.udid,name:N.name,mjpegPort:0,aspect:te(N),screenWidth:Number.isFinite(T)&&T>0?T:void 0,screenHeight:Number.isFinite(S)&&S>0?S:void 0,platform:N.platform}});r({type:"SET_TILES",tiles:M})}catch{}})(),()=>{i=!0}},[]),u.useEffect(()=>{const i=async l=>{var N,T;if(l.key!=="b"&&l.key!=="B")return;const p=(N=l.target)==null?void 0:N.tagName;if(p==="INPUT"||p==="TEXTAREA"||p==="SELECT"||!e.recording||!e.groupId)return;const R=window.prompt("Bookmark label?");if(!R)return;const O=e.startedAt?Date.now()-e.startedAt:0,M=(T=e.tiles.find(S=>S.recordingId))==null?void 0:T.recordingId;if(M)try{await se(e.groupId,M,O,R)}catch(S){r({type:"SET_ERROR_BANNER",message:`Bookmark failed: ${S.message}`})}};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[e.recording,e.groupId,e.startedAt,e.tiles,r]);const v=u.useMemo(()=>new Set(e.tiles.map(i=>i.udid)),[e.tiles]),f=u.useMemo(()=>n.map(i=>ot(i,y)),[n,y]),g=i=>{const l=Number(i.screenWidth),p=Number(i.screenHeight);return{udid:i.udid,name:i.name,mjpegPort:0,aspect:te(i),screenWidth:Number.isFinite(l)&&l>0?l:void 0,screenHeight:Number.isFinite(p)&&p>0?p:void 0,platform:i.platform}},o=async i=>{if(e.tiles.some(R=>R.udid===i)){await c(i);return}if(e.recording){r({type:"SET_ERROR_BANNER",message:"Stop recording before changing the mosaic layout."});return}const p=n.find(R=>R.udid===i);p&&(r({type:"ADD_TILE",tile:g(p)}),fetch(`/xenon/api/control/${encodeURIComponent(i)}/stream/start`,{method:"POST"}).catch(()=>{}))},c=async i=>{r({type:"REMOVE_TILE",udid:i});try{await fetch(`/xenon/api/control/${encodeURIComponent(i)}/stream/stop`,{method:"POST"})}catch{}m(l=>l+1)},s=async(i,l)=>{if(e.groupId)try{await Ve(e.groupId,{recordingId:i,timecodeMs:e.startedAt?Date.now()-e.startedAt:0,shape:l.shape,geometry:JSON.stringify(l.geometry),color:l.color,text:l.text})}catch(p){r({type:"SET_ERROR_BANNER",message:`Annotation failed: ${p.message}`})}},x=()=>{for(const i of e.tiles){const l=`/xenon/api/control/${encodeURIComponent(i.udid)}/stream/stop`;try{navigator.sendBeacon?navigator.sendBeacon(l):fetch(l,{method:"POST",keepalive:!0}).catch(()=>{})}catch{}}e.tiles.forEach(i=>r({type:"REMOVE_TILE",udid:i.udid}))},j=et({idleAfterMs:tt,warningSec:rt,enabled:e.tiles.length>0,onWarning:()=>{},onTimeout:()=>{x()}});return t.jsxs(re.Provider,{value:{state:e,dispatch:r},children:[t.jsxs("div",{className:"flex flex-col h-full p-4 gap-3",children:[t.jsxs("header",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("h1",{className:"text-base font-semibold",children:"Live Devices"}),t.jsx(Se,{value:e.layout,onChange:i=>r({type:"SET_LAYOUT",layout:i})})]}),t.jsx(Ze,{selectedUdids:e.tiles.map(i=>i.udid)})]}),e.errorBanner&&t.jsxs("div",{role:"alert",className:"text-sm rounded border border-red-500/40 bg-red-500/10 text-red-100 px-3 py-2 flex items-center gap-2",children:[t.jsx("span",{className:"flex-1",children:e.errorBanner}),t.jsx("button",{className:"text-xs opacity-80 hover:opacity-100",onClick:()=>r({type:"SET_ERROR_BANNER",message:null}),children:"Dismiss"})]}),t.jsxs("div",{className:"grid grid-cols-[260px_1fr] gap-3 flex-1 min-h-0",children:[t.jsxs("aside",{className:"flex flex-col gap-2 border border-[var(--border)] rounded p-3 overflow-y-auto min-h-0",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-xs uppercase tracking-wide text-[var(--text-dim)]",children:"Devices"}),t.jsx("button",{className:"text-xs underline opacity-70 hover:opacity-100",onClick:()=>m(i=>i+1),children:"Refresh"})]}),t.jsx(Ee,{devices:f,inMosaic:v,onToggle:o}),t.jsx("p",{className:"mt-2 text-[11px] text-[var(--text-dim)] leading-relaxed",children:"Click a device to add it to the mosaic. Click again (or use the × on the tile) to remove it."})]}),t.jsx("main",{className:"border border-[var(--border)] rounded p-2 overflow-y-auto h-full min-h-0",children:t.jsx(He,{layout:e.layout,tiles:e.tiles,annotateMode:e.annotateMode,shape:e.shape,color:e.color,onAnnotation:s,onRemove:c,onDropDevice:o})})]})]}),j.warning&&j.remainingSec!==null&&t.jsx(Qe,{remainingSec:j.remainingSec,onContinue:j.reset,onReleaseNow:x})]})}export{ct as default};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{g as _,j as e,o as B,k as w,T as F,S as M,r as b,u as O,c as z,m as G,M as H,X}from"./index--TKsSVZp.js";import{f as E,s as R,b as $,d as q,p as Q,o as V,S as J,h as K,a as W,u as Y}from"./status-pill-outline-CFz5xaoF.js";import{A as Z}from"./activity-jltyhcrF.js";import{C as ee}from"./circle-x-_TOawobA.js";import{C as te}from"./circle-check-Bjgvpq5F.js";import{C as se}from"./clock-pm4LDp97.js";import{D as re}from"./download-CuDjBGgs.js";import{C as ae}from"./chevron-right-BtA7DR8A.js";import{T as ne,M as le}from"./tablet-DoE7LIzI.js";import{P as oe}from"./page-header-D5tpZwkI.js";import"./useSocket-COssbQIj.js";import"./time-B8FIgwPE.js";/**
|
|
2
|
-
* @license lucide-react v0.555.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const ie=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],de=_("refresh-ccw",ie),ce={neutral:"bg-[var(--surface-2)] text-[var(--text-muted)] border-[var(--border)]",green:"bg-[var(--green)]/15 text-[var(--green)] border-[var(--green)]/30",red:"bg-[var(--red)]/15 text-[var(--red)] border-[var(--red)]/30",amber:"bg-[var(--amber)]/15 text-[var(--amber)] border-[var(--amber)]/30"},C=({value:t,tone:a="neutral",label:r})=>e.jsx("span",{title:r,"aria-label":r,className:`inline-flex items-center justify-center min-w-[18px] h-[18px] px-1.5 rounded-full border text-[10px] font-mono font-medium ${ce[a]}`,children:t}),xe={passed:{Icon:te,label:"PASSED",tint:"text-[var(--green)]"},failed:{Icon:ee,label:"FAILED",tint:"text-[var(--red)]"},running:{Icon:Z,label:"RUNNING",tint:"text-[var(--amber)]"}},S=({kind:t,value:a})=>{const{Icon:r,label:l,tint:d}=xe[t];return e.jsxs("div",{className:"flex-1 flex flex-col items-center gap-1 py-2 rounded-md border border-[var(--border)] bg-[var(--bg)]",children:[e.jsx(r,{className:`h-3.5 w-3.5 ${d}`}),e.jsx("span",{className:`text-[9px] font-mono font-semibold tracking-wider ${d}`,children:l}),e.jsx("span",{className:"text-sm font-semibold text-[var(--text)] tabular-nums",children:a})]})},I={all:"All time","24h":"Last 24 hours","7d":"Last 7 days","30d":"Last 30 days"},ue=({builds:t,selectedBuildId:a,onSelect:r,search:l,onSearchChange:d,timeFilter:c,onTimeFilterChange:u})=>{const o=t.filter(s=>{const n=(s.name??"")+" "+s.id;if(l&&!n.toLowerCase().includes(l.toLowerCase()))return!1;if(c!=="all"){const p={"24h":864e5,"7d":6048e5,"30d":2592e6},g=Date.parse(String(s.createdAt));if(!Number.isFinite(g)||Date.now()-g>p[c])return!1}return!0}),i=l.trim().length>0||c!=="all",f=o.reduce((s,n)=>(s.passed+=n.passedCount||0,s.failed+=n.failedCount||0,s.running+=n.runningCount||0,s),{passed:0,failed:0,running:0});return e.jsxs("aside",{className:"w-[280px] shrink-0 border-r border-[var(--border)] bg-[var(--surface)] flex flex-col",children:[e.jsxs("div",{className:"p-3 space-y-2 border-b border-[var(--border)]",children:[e.jsxs("div",{className:"relative",children:[e.jsx(B,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-[var(--text-dim)]"}),e.jsx("input",{type:"text",value:l,onChange:s=>d(s.target.value),placeholder:"Find builds…",className:"w-full h-8 pl-8 pr-2 rounded-md bg-[var(--bg)] border border-[var(--border)] text-xs text-[var(--text)] placeholder:text-[var(--text-dim)] focus:outline-none focus:border-[var(--border-strong)]"})]}),e.jsx("select",{value:c,onChange:s=>u(s.target.value),className:"w-full h-8 px-2 rounded-md bg-[var(--bg)] border border-[var(--border)] text-xs text-[var(--text-muted)]",children:Object.keys(I).map(s=>e.jsx("option",{value:s,children:I[s]},s))})]}),e.jsxs("div",{className:"p-3 flex items-stretch gap-2 border-b border-[var(--border)]",children:[e.jsx(S,{kind:"passed",value:f.passed}),e.jsx(S,{kind:"failed",value:f.failed}),e.jsx(S,{kind:"running",value:f.running})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[o.length===0&&e.jsx("div",{className:"px-4 py-8 text-center text-xs text-[var(--text-dim)]",children:i?"No builds match.":"No builds yet — sessions will appear here after your first test run."}),o.map(s=>{const n=s.id===a;return e.jsxs("button",{type:"button",onClick:()=>r(s.id),className:`w-full text-left relative px-4 py-3 border-b border-[var(--border)] transition-colors ${n?"bg-[var(--surface-2)]":"hover:bg-[var(--surface-2)]/60"}`,children:[n&&e.jsx("span",{className:"absolute left-0 top-2 bottom-2 w-[3px] rounded-r bg-[var(--green)]"}),e.jsx("div",{className:"text-xs font-semibold text-[var(--text)] truncate",children:s.name||"Unnamed build"}),e.jsxs("div",{className:"mt-1 flex items-center gap-1 font-mono text-[9px] text-[var(--text-dim)]",children:[e.jsx(se,{className:"h-3 w-3"}),E(s.createdAt)]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[s.passedCount>0&&e.jsx(C,{value:s.passedCount,tone:"green",label:`${s.passedCount} passed`}),s.failedCount>0&&e.jsx(C,{value:s.failedCount,tone:"red",label:`${s.failedCount} failed`}),s.runningCount>0&&e.jsx(C,{value:s.runningCount,tone:"amber",label:`${s.runningCount} running`}),s.sessionCount===0&&e.jsx("span",{className:"text-[10px] font-mono text-[var(--text-dim)]",children:"empty"})]}),e.jsx("div",{className:"mt-1 font-mono text-[9px] text-[var(--text-dim)] truncate",children:R(s.id,10,4)})]},s.id)})]})]})},me={neutral:"bg-[var(--text-dim)]",green:"bg-[var(--green)]",red:"bg-[var(--red)]",amber:"bg-[var(--amber)]",blue:"bg-[var(--blue)]"},y=({label:t,count:a,active:r,onClick:l,tone:d="neutral",bullet:c=!0})=>e.jsxs("button",{type:"button",onClick:l,"aria-pressed":r,className:`inline-flex items-center gap-2 h-8 px-3 rounded-md border text-[11px] font-semibold uppercase tracking-wider transition-colors cursor-pointer ${r?"bg-[var(--surface-2)] border-[var(--border-strong)] text-[var(--text)]":"bg-transparent border-transparent text-[var(--text-muted)] hover:text-[var(--text)] hover:bg-[var(--surface-2)]/50"}`,children:[c&&d!=="neutral"&&e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${me[d]}`}),e.jsx("span",{children:t}),typeof a=="number"&&e.jsx("span",{className:"font-mono text-[10px] text-[var(--text-dim)]",children:a})]}),pe=({sessions:t,active:a,onChange:r,search:l,onSearchChange:d,totalMatching:c,totalUnfiltered:u})=>{const o=$(t);return e.jsxs("div",{className:"bg-[var(--surface)]",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-4 pt-3 pb-2",children:[e.jsx(y,{label:"ALL",count:o.all,active:a==="all",onClick:()=>r("all"),tone:"neutral",bullet:!1}),e.jsx(y,{label:"PASSED",count:o.passed,active:a==="passed",onClick:()=>r("passed"),tone:"green"}),e.jsx(y,{label:"FAILED",count:o.failed,active:a==="failed",onClick:()=>r("failed"),tone:"red"}),e.jsx(y,{label:"RUNNING",count:o.running,active:a==="running",onClick:()=>r("running"),tone:"amber"})]}),e.jsxs("div",{className:"flex items-center gap-4 px-4 pb-3 border-b border-[var(--border)]",children:[e.jsxs("div",{className:"relative flex-1 max-w-xl",children:[e.jsx(B,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-[var(--text-dim)]"}),e.jsx("input",{type:"text",value:l,onChange:i=>d(i.target.value),placeholder:"Search sessions by ID, name, or device…",className:"w-full h-8 pl-8 pr-2 rounded-md bg-[var(--bg)] border border-[var(--border)] text-xs text-[var(--text)] placeholder:text-[var(--text-dim)] focus:outline-none focus:border-[var(--border-strong)]"})]}),e.jsxs("span",{className:"text-[10px] font-mono text-[var(--text-dim)] whitespace-nowrap",children:[c," of ",u," sessions"]})]})]})};function fe(t){return(t.split("-")[0]||t).slice(0,8).toUpperCase()}const he=({build:t,failedCount:a,selectedCount:r,onRetryFailed:l,onExport:d})=>{const c=a>0||r>0,[u,o]=w.useState(!1),i=w.useRef(null);w.useEffect(()=>{const s=n=>{i.current&&!i.current.contains(n.target)&&o(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);const f=c?`Retry ${r||a} session${(r||a)===1?"":"s"}`:"No failed sessions to retry";return e.jsxs("header",{className:"flex items-start justify-between gap-4 px-4 py-3 border-b border-[var(--border)] bg-[var(--surface)]",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-widest text-[var(--text-dim)]",children:[e.jsx("span",{children:"Build"}),e.jsxs("span",{className:"font-mono text-[var(--green)]",title:t.id,children:["#",fe(t.id)]})]}),e.jsx("h1",{className:"mt-0.5 text-sm font-semibold text-[var(--text)]",children:t.name||"Unnamed build"})]}),e.jsxs("div",{className:"flex items-center gap-2",ref:i,children:[e.jsxs("button",{type:"button",onClick:l,disabled:!c,title:f,className:"inline-flex items-center gap-1.5 h-8 px-3 rounded-md border border-[var(--border)] text-xs text-[var(--text)] hover:border-[var(--border-strong)] hover:bg-[var(--surface-2)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(de,{className:"h-3.5 w-3.5"}),"Retry failed"]}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>o(s=>!s),className:"inline-flex items-center gap-1.5 h-8 px-3 rounded-md border border-[var(--border)] text-xs text-[var(--text)] hover:border-[var(--border-strong)] hover:bg-[var(--surface-2)] transition-colors",children:[e.jsx(re,{className:"h-3.5 w-3.5"}),"Export"]}),u&&e.jsxs("div",{className:"absolute top-full right-0 mt-1 w-40 rounded-md border border-[var(--border)] bg-[var(--surface)] shadow-lg overflow-hidden z-20",children:[e.jsx("button",{type:"button",onClick:()=>{o(!1),d("json")},className:"w-full text-left px-3 py-2 text-xs text-[var(--text)] hover:bg-[var(--surface-2)]",children:"Export as JSON"}),e.jsx("button",{type:"button",onClick:()=>{o(!1),d("csv")},className:"w-full text-left px-3 py-2 text-xs text-[var(--text)] hover:bg-[var(--surface-2)]",children:"Export as CSV"})]})]})]})]})};function ve({platform:t}){const a=(t||"").toLowerCase();return a.includes("tv")?e.jsx(F,{className:"h-3.5 w-3.5"}):a.includes("pad")||a.includes("tablet")?e.jsx(ne,{className:"h-3.5 w-3.5"}):a.includes("android")||a.includes("ios")?e.jsx(M,{className:"h-3.5 w-3.5"}):e.jsx(le,{className:"h-3.5 w-3.5"})}function be(t){return t==="running"?{label:"RUNNING",tone:"running"}:t==="failed"?{label:"FAILED",tone:"failed"}:t==="ended"||t==="passed"?{label:"PASSED",tone:"passed"}:{label:t.toUpperCase(),tone:"offline"}}const ge=({session:t,selected:a,onToggleSelect:r,onOpen:l})=>{const d=t.status==="failed",c=be(t.status),u=q(t),o=d&&t.failure_reason?t.failure_reason:t.name??"";return e.jsxs("tr",{onClick:l,className:"group border-b border-[var(--border)] hover:bg-[var(--surface-2)] cursor-pointer transition-colors align-top",children:[e.jsx("td",{className:"px-3 py-3",onClick:i=>i.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:a,onChange:r,"aria-label":`Select session ${t.id}`})}),e.jsxs("td",{className:"px-3 py-3",children:[e.jsxs("div",{className:"font-mono text-xs text-[var(--green)]",title:t.id,children:["#",R(t.id,14,4)]}),o&&e.jsx("div",{className:"mt-0.5 text-[11px] text-[var(--text-muted)] truncate max-w-[420px]",title:o,children:o})]}),e.jsxs("td",{className:"px-3 py-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-[var(--text)]",children:[e.jsx(ve,{platform:t.device_platform}),e.jsx("span",{className:"truncate max-w-[160px]",children:u})]}),t.node_id&&e.jsxs("div",{className:"mt-0.5 font-mono text-[10px] text-[var(--text-dim)]",children:["node-",t.node_id]})]}),e.jsxs("td",{className:"px-3 py-3",children:[e.jsx("div",{className:"text-xs text-[var(--text)]",children:Q(t)}),t.device_version&&e.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-[var(--text-dim)]",children:V(t)})]}),e.jsx("td",{className:"px-3 py-3",children:e.jsx(J,{label:c.label,tone:c.tone})}),e.jsx("td",{className:"px-3 py-3 font-mono text-[11px] text-[var(--text-muted)] whitespace-nowrap",children:E(t.startTime)}),e.jsx("td",{className:"px-3 py-3 font-mono text-[11px] text-[var(--text-muted)] whitespace-nowrap text-right",children:K(W(t))}),e.jsx("td",{className:"px-3 py-3 text-right",children:e.jsx(ae,{className:"inline h-4 w-4 text-[var(--text-dim)] group-hover:text-[var(--text)]"})})]})};function je(t,a){return a==="all"?!0:a==="passed"?t.status==="ended"||t.status==="passed":a==="failed"?t.status==="failed":a==="running"?t.status==="running":!0}const Ne=({sessions:t,statusFilter:a,searchQuery:r,selectedIds:l,onToggleSelect:d,onToggleSelectAll:c,onOpenRow:u,buildHasNoSessions:o})=>{const i=b.useMemo(()=>{const n=r.trim().toLowerCase();return t.filter(p=>!(!je(p,a)||n&&!(p.id+" "+(p.name??"")+" "+(p.device_name??"")+" "+(p.device_platform??"")+" "+(p.device_version??"")+" "+(p.node_id??"")).toLowerCase().includes(n)))},[t,a,r]);if(o)return e.jsx("div",{className:"px-4 py-12 text-center text-xs text-[var(--text-dim)]",children:"No sessions in this build yet. Trigger one from your test runner."});if(i.length===0)return e.jsx("div",{className:"px-4 py-12 text-center text-xs text-[var(--text-dim)]",children:"No sessions match the current filters."});const f=i.length>0&&i.every(n=>l.has(n.id)),s=i.some(n=>l.has(n.id));return e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs("table",{className:"w-full text-left table-fixed",children:[e.jsx("thead",{className:"sticky top-0 bg-[var(--surface)] border-b border-[var(--border)] z-10",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 w-[36px]",children:e.jsx("input",{type:"checkbox","aria-label":"Select all visible",checked:f,ref:n=>{n&&(n.indeterminate=s&&!f)},onChange:()=>c(i.map(n=>n.id))})}),e.jsx("th",{className:"px-3 py-2 text-[10px] uppercase tracking-wider text-[var(--text-dim)] font-medium",children:"Session"}),e.jsx("th",{className:"px-3 py-2 text-[10px] uppercase tracking-wider text-[var(--text-dim)] font-medium",children:"Device · Node"}),e.jsx("th",{className:"px-3 py-2 text-[10px] uppercase tracking-wider text-[var(--text-dim)] font-medium w-[108px]",children:"Platform"}),e.jsx("th",{className:"px-3 py-2 text-[10px] uppercase tracking-wider text-[var(--text-dim)] font-medium w-[104px]",children:"Status"}),e.jsx("th",{className:"px-3 py-2 text-[10px] uppercase tracking-wider text-[var(--text-dim)] font-medium w-[160px]",children:"Start Time"}),e.jsx("th",{className:"px-3 py-2 text-[10px] uppercase tracking-wider text-[var(--text-dim)] font-medium text-right w-[92px]",children:"Duration"}),e.jsx("th",{className:"px-3 py-2 w-[32px]"})]})}),e.jsx("tbody",{children:i.map(n=>e.jsx(ge,{session:n,selected:l.has(n.id),onToggleSelect:()=>d(n.id),onOpen:()=>u(n)},n.id))})]})})},Te=()=>{const t=O(),{buildId:a}=z(),r=Y(),{toast:l}=G(),[d,c]=b.useState("all"),[u,o]=b.useState("all"),[i,f]=b.useState(""),[s,n]=b.useState(new Set);w.useEffect(()=>{a&&a!==r.selectedBuildId&&(r.selectBuild(a),n(new Set))},[a,r]);const p=x=>t(`/builds/${x}`),g=x=>t(`/builds/${r.selectedBuildId}/sessions/${x.id}`),A=b.useCallback(x=>{n(m=>{const h=new Set(m);return h.has(x)?h.delete(x):h.add(x),h})},[]),T=b.useCallback(x=>{n(m=>{const h=x.length>0&&x.every(v=>m.has(v)),j=new Set(m);return h?x.forEach(v=>j.delete(v)):x.forEach(v=>j.add(v)),j})},[]),k=r.builds.find(x=>x.id===r.selectedBuildId)||null,D=$(r.sessions),P=()=>{l("Bulk retry lands in a future release.","info")},U=async x=>{if(r.selectedBuildId)try{const m=s.size>0?Array.from(s):void 0,{blob:h,filename:j}=await X.exportBuild(r.selectedBuildId,x,m),v=URL.createObjectURL(h),N=document.createElement("a");N.href=v,N.download=j,document.body.appendChild(N),N.click(),document.body.removeChild(N),URL.revokeObjectURL(v);const L=m?m.length:"all";l(`Exported ${L} session${L===1?"":"s"} as ${x.toUpperCase()}.`,"success")}catch(m){const h=m instanceof Error?m.message:String(m);l(`Export failed: ${h}`,"error")}};return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx(oe,{icon:H,title:"Sessions",subtitle:"Builds and the test sessions recorded against them."}),e.jsxs("div",{className:"flex flex-1 min-h-0",children:[e.jsx(ue,{builds:r.builds,selectedBuildId:r.selectedBuildId,onSelect:p,search:r.searchQuery,onSearchChange:r.setSearchQuery,timeFilter:d,onTimeFilterChange:c}),e.jsx("section",{className:"flex-1 flex flex-col min-w-0",children:k?e.jsxs(e.Fragment,{children:[e.jsx(he,{build:k,failedCount:D.failed,selectedCount:s.size,onRetryFailed:P,onExport:U}),e.jsx(pe,{sessions:r.sessions,active:u,onChange:o,search:i,onSearchChange:f,totalMatching:r.sessions.length,totalUnfiltered:r.sessions.length}),e.jsx(Ne,{sessions:r.sessions,statusFilter:u,searchQuery:i,selectedIds:s,onToggleSelect:A,onToggleSelectAll:T,onOpenRow:g,buildHasNoSessions:r.sessions.length===0})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-xs text-[var(--text-dim)]",children:"Select a build from the left to see its sessions."})})]})]})};export{Te as BuildsPage,Te as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap";:root{--bg: #0a0d0c;--surface: #111514;--surface-2: #161b1a;--border: #1f2624;--border-strong: #2a3331;--text: #e6ebe9;--text-muted: #8a938f;--text-dim: #5b6460;--green: #22c55e;--green-dim: #16a34a;--amber: #f59e0b;--red: #ef4444;--blue: #3b82f6;--accent-subtle: rgba(34, 197, 94, .1);--accent-border: rgba(34, 197, 94, .3);--status-ready-fg: var(--green);--status-busy-fg: var(--amber);--status-reserved-fg: var(--blue);--status-error-fg: var(--red);--status-offline-fg: var(--text-muted);--status-ready-bg: rgba(34, 197, 94, .1);--status-busy-bg: rgba(245, 158, 11, .1);--status-reserved-bg: rgba(59, 130, 246, .1);--status-error-bg: rgba(239, 68, 68, .1);--status-offline-bg: rgba(138, 147, 143, .08);--status-ready-border: rgba(34, 197, 94, .3);--status-busy-border: rgba(245, 158, 11, .3);--status-reserved-border: rgba(59, 130, 246, .3);--status-error-border: rgba(239, 68, 68, .3);--status-offline-border: rgba(138, 147, 143, .25);--space-1: 4px;--space-2: 8px;--space-3: 12px;--space-4: 16px;--space-5: 20px;--space-6: 24px;--space-8: 32px;--space-12: 48px;--radius-sm: 4px;--radius-md: 6px;--radius-lg: 8px;--shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);--shadow-md: 0 4px 12px rgba(0, 0, 0, .35);--shadow-lg: 0 12px 32px rgba(0, 0, 0, .45);--motion-fast: .15s cubic-bezier(.2, 0, 0, 1);--motion-slow: .25s cubic-bezier(.2, 0, 0, 1)}.scanline,.header-container:after{display:none!important}.animate-pulse-success,.animate-pulse-running{animation:none!important}.text-glow{text-shadow:none!important}@media (prefers-reduced-motion: reduce){*{transition:none!important;animation:none!important}}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:Inter,system-ui,-apple-system,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,ui-monospace,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{top:0;bottom:0}.-top-12{top:-3rem}.bottom-0{bottom:0}.bottom-1{bottom:.25rem}.bottom-2{bottom:.5rem}.bottom-4{bottom:1rem}.left-0{left:0}.left-1\/2{left:50%}.left-14{left:3.5rem}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-full{left:100%}.right-0{right:0}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-3{top:.75rem}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-auto{margin-top:auto;margin-bottom:auto}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-video{aspect-ratio:16 / 9}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[18px\]{height:18px}.h-\[2px\]{height:2px}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-64{max-height:16rem}.max-h-96{max-height:24rem}.max-h-full{max-height:100%}.min-h-0{min-height:0px}.min-h-\[120px\]{min-height:120px}.min-h-\[280px\]{min-height:280px}.min-h-screen{min-height:100vh}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-2{width:.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-40{width:10rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[104px\]{width:104px}.w-\[108px\]{width:108px}.w-\[160px\]{width:160px}.w-\[18px\]{width:18px}.w-\[280px\]{width:280px}.w-\[2px\]{width:2px}.w-\[32px\]{width:32px}.w-\[36px\]{width:36px}.w-\[3px\]{width:3px}.w-\[64px\]{width:64px}.w-\[92px\]{width:92px}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[18px\]{min-width:18px}.max-w-3xl{max-width:48rem}.max-w-7xl{max-width:80rem}.max-w-\[160px\]{max-width:160px}.max-w-\[180px\]{max-width:180px}.max-w-\[240px\]{max-width:240px}.max-w-\[420px\]{max-width:420px}.max-w-\[45\%\]{max-width:45%}.max-w-full{max-width:100%}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.table-fixed{table-layout:fixed}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-0{--tw-rotate: 0deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;user-select:none}.resize{resize:both}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-\[260px_1fr\]{grid-template-columns:260px 1fr}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-\[var\(--border\)\]>:not([hidden])~:not([hidden]){border-color:var(--border)}.self-center{align-self:center}.self-stretch{align-self:stretch}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-sm{border-radius:.125rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.border{border-width:1px}.border-2{border-width:2px}.border-4{border-width:4px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[var\(--border\)\]{border-color:var(--border)}.border-\[var\(--border-strong\)\]{border-color:var(--border-strong)}.border-\[var\(--green\)\]{border-color:var(--green)}.border-\[var\(--red\,\#dc2626\)\]{border-color:var(--red,#dc2626)}.border-emerald-300\/80{border-color:#6ee7b7cc}.border-emerald-500\/40{border-color:#10b98166}.border-emerald-500\/60{border-color:#10b98199}.border-neutral-800{--tw-border-opacity: 1;border-color:rgb(38 38 38 / var(--tw-border-opacity, 1))}.border-red-500\/40{border-color:#ef444466}.border-transparent{border-color:transparent}.border-white\/10{border-color:#ffffff1a}.border-t-red-500{--tw-border-opacity: 1;border-top-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.bg-\[\#000\]{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-\[var\(--accent\,\#3b82f6\)\]{background-color:var(--accent,#3b82f6)}.bg-\[var\(--amber\)\]{background-color:var(--amber)}.bg-\[var\(--bg\)\]{background-color:var(--bg)}.bg-\[var\(--blue\)\]{background-color:var(--blue)}.bg-\[var\(--border\)\]{background-color:var(--border)}.bg-\[var\(--border-strong\)\]{background-color:var(--border-strong)}.bg-\[var\(--green\)\]{background-color:var(--green)}.bg-\[var\(--green-dim\)\]{background-color:var(--green-dim)}.bg-\[var\(--red\)\]{background-color:var(--red)}.bg-\[var\(--red-soft\,rgba\(220\,38\,38\,0\.08\)\)\]{background-color:var(--red-soft,rgba(220,38,38,.08))}.bg-\[var\(--surface\)\]{background-color:var(--surface)}.bg-\[var\(--surface-1\,rgba\(255\,255\,255\,0\.02\)\)\]{background-color:var(--surface-1,rgba(255,255,255,.02))}.bg-\[var\(--surface-2\)\]{background-color:var(--surface-2)}.bg-\[var\(--surface-2\,\#2a2a2a\)\]{background-color:var(--surface-2,#2a2a2a)}.bg-\[var\(--surface-2\,rgba\(255\,255\,255\,0\.06\)\)\]{background-color:var(--surface-2,rgba(255,255,255,.06))}.bg-\[var\(--surface-2\,var\(--surface\)\)\]{background-color:var(--surface-2,var(--surface))}.bg-\[var\(--text-dim\)\]{background-color:var(--text-dim)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/80{background-color:#000c}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/15{background-color:#10b98126}.bg-emerald-500\/5{background-color:#10b9810d}.bg-neutral-900{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white\/5{background-color:#ffffff0d}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-zinc-600{--tw-bg-opacity: 1;background-color:rgb(82 82 91 / var(--tw-bg-opacity, 1))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.from-\[\#0a0e1a\]{--tw-gradient-from: #0a0e1a var(--tw-gradient-from-position);--tw-gradient-to: rgb(10 14 26 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-\[\#131a2e\]{--tw-gradient-to: rgb(19 26 46 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #131a2e var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-\[\#1a2548\]{--tw-gradient-to: #1a2548 var(--tw-gradient-to-position)}.object-contain{object-fit:contain}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-12{padding-left:3rem;padding-right:3rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-3\.5{padding-left:.875rem;padding-right:.875rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-8{padding-bottom:2rem}.pl-1\.5{padding-left:.375rem}.pl-14{padding-left:3.5rem}.pl-7{padding-left:1.75rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-14{padding-right:3.5rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pt-14{padding-top:3.5rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:JetBrains Mono,ui-monospace,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-5xl{font-size:3rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-10{line-height:2.5rem}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[var\(--amber\)\]{color:var(--amber)}.text-\[var\(--blue\)\]{color:var(--blue)}.text-\[var\(--green\)\]{color:var(--green)}.text-\[var\(--red\)\]{color:var(--red)}.text-\[var\(--red\,\#dc2626\)\]{color:var(--red,#dc2626)}.text-\[var\(--text\)\]{color:var(--text)}.text-\[var\(--text-dim\)\]{color:var(--text-dim)}.text-\[var\(--text-muted\)\]{color:var(--text-muted)}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-neutral-200{--tw-text-opacity: 1;color:rgb(229 229 229 / var(--tw-text-opacity, 1))}.text-neutral-400{--tw-text-opacity: 1;color:rgb(163 163 163 / var(--tw-text-opacity, 1))}.text-neutral-500{--tw-text-opacity: 1;color:rgb(115 115 115 / var(--tw-text-opacity, 1))}.text-red-100{--tw-text-opacity: 1;color:rgb(254 226 226 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-white\/60{color:#fff9}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.shadow-\[0_0_20px_rgba\(220\,38\,38\,0\.3\)\]{--tw-shadow: 0 0 20px rgba(220,38,38,.3);--tw-shadow-colored: 0 0 20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_4px_rgba\(52\,211\,153\,0\.7\)\]{--tw-shadow: 0 0 4px rgba(52,211,153,.7);--tw-shadow-colored: 0 0 4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-inset{--tw-ring-inset: inset}.ring-emerald-400\/60{--tw-ring-color: rgb(52 211 153 / .6)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow{--tw-drop-shadow: drop-shadow(0 1px 2px rgb(0 0 0 / .1)) drop-shadow(0 1px 1px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-150{transition-duration:.15s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}*{box-sizing:border-box}html,body,#root{height:100%;margin:0;padding:0;background:var(--bg);color:var(--text);font-family:Inter,system-ui,-apple-system,sans-serif;font-feature-settings:"cv11","ss01";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:1.5}body{overflow:hidden}h1,h2,h3,h4,h5,h6,.brand-font{font-family:Inter,sans-serif;font-weight:700;letter-spacing:-.02em;color:var(--text)}.font-mono,code,.code-font{font-family:JetBrains Mono,ui-monospace,Menlo,Monaco,Consolas,monospace}code,.code-font{font-size:.9em;background:var(--surface-2);padding:2px 6px;border-radius:var(--radius-sm);color:var(--green)}button{font-family:inherit;cursor:pointer;transition:background var(--motion-fast),border-color var(--motion-fast),color var(--motion-fast)}a{color:var(--blue);text-decoration:none;transition:color var(--motion-fast)}a:hover{color:#79b8ff}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:var(--border);border-radius:var(--radius-md)}::-webkit-scrollbar-thumb:hover{background:var(--border-strong)}input[type=checkbox]{-moz-appearance:none;appearance:none;-webkit-appearance:none;width:16px;height:16px;background:var(--bg);border:1px solid var(--border-strong);border-radius:var(--radius-sm);cursor:pointer;position:relative;transition:background var(--motion-fast),border-color var(--motion-fast);display:inline-flex;align-items:center;justify-content:center}input[type=checkbox]:hover{border-color:var(--green)}input[type=checkbox]:checked{background:var(--green);border-color:var(--green)}input[type=checkbox]:checked:after{content:"✓";color:var(--bg);font-size:11px;font-weight:700}input[type=checkbox]:focus{outline:none;box-shadow:0 0 0 2px #22c55e40}.bg-grid{background-image:linear-gradient(to right,rgba(255,255,255,.02) 1px,transparent 1px),linear-gradient(to bottom,rgba(255,255,255,.02) 1px,transparent 1px);background-size:32px 32px}@keyframes pulse-dot{0%,to{opacity:1;transform:scale(1)}50%{opacity:.5;transform:scale(.85)}}.pulse-dot{animation:pulse-dot 2s ease-in-out infinite}.fade-in{animation:fadeIn .2s ease-out forwards}@keyframes fadeIn{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.placeholder\:text-\[var\(--text-dim\)\]::placeholder{color:var(--text-dim)}.last\:border-b-0:last-child{border-bottom-width:0px}.last\:border-r-0:last-child{border-right-width:0px}.hover\:border-\[var\(--border\)\]:hover{border-color:var(--border)}.hover\:border-\[var\(--border-strong\)\]:hover{border-color:var(--border-strong)}.hover\:bg-\[var\(--bg\)\]:hover{background-color:var(--bg)}.hover\:bg-\[var\(--green-dim\)\]:hover{background-color:var(--green-dim)}.hover\:bg-\[var\(--surface\)\]:hover{background-color:var(--surface)}.hover\:bg-\[var\(--surface-2\)\]:hover{background-color:var(--surface-2)}.hover\:bg-\[var\(--surface-2\,\#1a1a1a\)\]:hover{background-color:var(--surface-2,#1a1a1a)}.hover\:bg-\[var\(--surface-2\,rgba\(255\,255\,255\,0\.04\)\)\]:hover{background-color:var(--surface-2,rgba(255,255,255,.04))}.hover\:bg-\[var\(--surface-raised\)\]:hover{background-color:var(--surface-raised)}.hover\:bg-emerald-500\/10:hover{background-color:#10b9811a}.hover\:bg-red-500:hover{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.hover\:bg-red-600\/70:hover{background-color:#dc2626b3}.hover\:bg-white\/15:hover{background-color:#ffffff26}.hover\:text-\[var\(--green\)\]:hover{color:var(--green)}.hover\:text-\[var\(--text\)\]:hover{color:var(--text)}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.focus\:border-\[var\(--accent\,\#3b82f6\)\]:focus{border-color:var(--accent,#3b82f6)}.focus\:border-\[var\(--border-strong\)\]:focus{border-color:var(--border-strong)}.focus\:border-\[var\(--green\)\]:focus{border-color:var(--green)}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.group:hover .group-hover\:bg-\[var\(--green\)\]{background-color:var(--green)}.group:hover .group-hover\:text-\[var\(--text\)\]{color:var(--text)}.group:hover .group-hover\:opacity-100{opacity:1}@media (min-width: 640px){.sm\:inline-block{display:inline-block}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}}@media (min-width: 768px){.md\:block{display:block}.md\:inline{display:inline}.md\:flex{display:flex}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:divide-x>:not([hidden])~:not([hidden]){--tw-divide-x-reverse: 0;border-right-width:calc(1px * var(--tw-divide-x-reverse));border-left-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}.md\:divide-y-0>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(0px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(0px * var(--tw-divide-y-reverse))}}@media (min-width: 1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:block{display:block}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-\[1fr_340px\]{grid-template-columns:1fr 340px}}.surface-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg)}.toast-container{position:fixed;bottom:32px;right:32px;display:flex;flex-direction:column;gap:16px;z-index:10000;pointer-events:none}.toast-item{pointer-events:auto;min-width:320px;max-width:480px;padding:16px 20px;border-radius:6px;display:flex;align-items:center;gap:16px;background:var(--surface);-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);border:1px solid var(--border);box-shadow:0 20px 40px #0006;color:var(--text);font-size:13px;font-weight:600;font-family:JetBrains Mono,monospace;transition:all .3s cubic-bezier(.16,1,.3,1);position:relative;overflow:hidden}.toast-item:after{content:"";position:absolute;top:0;left:0;width:100%;height:2px;background:currentColor;opacity:.3}.toast-message{flex:1;text-transform:uppercase;letter-spacing:.02em}.toast-icon{display:flex;align-items:center;justify-content:center;flex-shrink:0}.toast-close{background:transparent;border:none;color:var(--text-dim);cursor:pointer;padding:4px;border-radius:6px;display:flex;align-items:center;justify-content:center;transition:all .2s}.toast-close:hover{background:#ffffff0d;color:var(--text)}.toast-success{border-color:#00ff884d;color:var(--green)}.toast-success .toast-icon{color:var(--green)}.toast-error{border-color:#ff4d4d4d;color:#ff4d4d}.toast-error .toast-icon{color:#ff4d4d}.toast-info{border-color:#00bfff4d;color:#00bfff}.toast-info .toast-icon{color:#00bfff}.toast-loading{border-color:var(--text-muted);color:var(--text-dim)}.toast-loading .toast-icon{color:var(--text-dim)}@keyframes slide-in{0%{transform:translate(100%) scale(.95);opacity:0}to{transform:translate(0) scale(1);opacity:1}}.animate-slide-in{animation:slide-in .4s cubic-bezier(.16,1,.3,1) forwards}.cp-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#0009;z-index:9000;display:flex;justify-content:center;align-items:flex-start;padding-top:12vh;font-family:Inter,sans-serif}.cp{width:560px;max-width:90vw;background:var(--surface);border:1px solid var(--border-strong);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);overflow:hidden;display:flex;flex-direction:column}.cp-input-row{display:flex;align-items:center;gap:10px;padding:12px 14px;border-bottom:1px solid var(--border);color:var(--text-muted)}.cp-input{flex:1;background:transparent;border:none;outline:none;color:var(--text);font-family:Inter,sans-serif;font-size:14px}.cp-input::placeholder{color:var(--text-dim)}.cp-esc{font-family:JetBrains Mono,monospace;font-size:10px;color:var(--text-muted);background:var(--surface-2);border:1px solid var(--border);padding:2px 6px;border-radius:var(--radius-sm)}.cp-results{max-height:56vh;overflow-y:auto;padding:8px}.cp-empty{padding:20px;text-align:center;color:var(--text-muted);font-size:12px}.cp-group{padding:4px 0}.cp-group-head{font-family:JetBrains Mono,monospace;font-size:9px;letter-spacing:.12em;color:var(--text-dim);padding:6px 8px;text-transform:uppercase}.cp-item{display:flex;width:100%;align-items:center;gap:10px;padding:8px 10px;border-radius:var(--radius-sm);background:transparent;border:none;cursor:pointer;text-align:left;font-family:Inter,sans-serif}.cp-item-active,.cp-item:hover{background:var(--surface-2)}.cp-item-label{color:var(--text);font-size:13px;font-weight:500}.cp-item-sub{margin-left:auto;color:var(--text-dim);font-family:JetBrains Mono,monospace;font-size:10px}
|