UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 108 kB
import{n as e,r as t}from"./rolldown-runtime-CNOWq4Kh.js";import{Oa as n,Qt as r,Xt as i,Zt as a,au as o,fi as s,ka as c,lo as l,lu as u,uu as d,vi as f,wa as p,xa as m}from"./control-ui-connection-Bfj9beF_.js";import{AO as h,BA as g,CC as _,Ej as v,Nj as y,Nv as b,QA as x,QE as S,QT as C,SC as w,UT as T,ZA as E,ZE as ee,Zj as te,_j as D,bC as ne,dO as O,dj as k,hj as re,jA as A,jv as ie,kO as ae,mj as j,pj as M,tM as oe,uO as se,vj as ce,yC as le,zA as N}from"./control-ui-boot-shared-DFTSUQQ0.js";import{B as P,C as F,F as I,H as ue,I as L,J as R,O as z,Rt as de,S as fe,U as B,a as pe,b as me,d as V,f as H,g as U,gt as W,j as G,l as K,m as q,o as he,p as ge,s as _e,u as J,x as Y,yt as ve}from"./solid-runtime-C416s-HC.js";import{An as ye,Dn as be,En as xe,H as Se,On as Ce,V as we,jn as Te,kn as Ee}from"./deferred-ui-support-D-VedBtc.js";import{a as De,n as Oe,o as ke,t as X}from"./panel-icon-button-DX4j8yic.js";import{n as Ae,t as je}from"./dock-panel-styles-Bkh4EWSh.js";import{n as Me}from"./gateway-websocket-url-CJHx62jw.js";import{n as Ne,t as Pe}from"./panel-empty-state-D5H9zOzY.js";import{n as Fe,t as Ie}from"./desktop-focus-window-7owLMleH.js";function Le(e,t){let[n,r]=P(!1),[a,o]=P(),s,c,u=()=>!!(s&&e.fullscreenElement===s),d=()=>e.fullscreenEnabled&&typeof Element.prototype.requestFullscreen==`function`,f=e=>{throw Error(p(`desktop.errors.fullscreenFailed`,{error:i(e)}))};return W(()=>{let i=l(e,`fullscreenchange`,()=>{let e=n(),i=u();if(r(i),t(),e&&!i&&c){let e=c;c=void 0,queueMicrotask(()=>e.isConnected&&e.focus())}});return()=>{i(),c=void 0,u()&&e.exitFullscreen().catch(()=>{})}}),{active:n,outcome:a,ownsFullscreen:u,supported:d,sectionRef:e=>{s=e},toggle(t){let n=(async()=>{if(u())await e.exitFullscreen().catch(f);else if(!s||!d())throw Error(p(`desktop.fullscreenUnavailable`));else{c=t;try{await s.requestFullscreen()}catch(e){c=void 0,f(e)}}})();return o({result:n}),n.catch(()=>{}),n}}}function Re(){return(Re=e((()=>{B(),m(),r()})))()}function ze(e){let[t,n]=P(),[r,i]=L(!1),a;W(()=>()=>{a?.retire(),a=void 0});let o=()=>{a?.retire(),a=void 0,n(void 0)},s=ve(function*(e,t){i(!0),yield Promise.race([e,t])});return{launchingApp:()=>r()?a?.app??null:null,outcome:t,clear:o,launch:t=>{let{client:r,source:i,presented:o,state:c,apps:l}=e();if(!r||!o||i?.kind!==`environment`||c!==`connecting`&&c!==`connected`||!l.includes(t)||a?.app===t)return;let u=Promise.withResolvers(),d={app:t,retire:()=>u.resolve()};a?.retire(),a=d;let f=s(r.request(`desktop.launch`,{source:i,app:t}),u.promise);n({result:f}),f.catch(()=>{}).finally(()=>{a===d&&(a=void 0)})}}}function Be(){return(Be=e((()=>{B()})))()}var Ve,Z;function Q(){return(Q=e((()=>{c(),Ve={desktop:{title:n.desktop.title,openWindow:n.desktop.openWindow,unavailable:n.desktop.unavailable,toggle:n.desktop.toggle,hide:`Hide desktop panel`,resize:`Resize desktop panel`,dockBottom:`Dock to bottom`,dockRight:`Dock to right`,enterFullscreen:`Enter fullscreen`,exitFullscreen:`Exit fullscreen`,fullscreenUnavailable:`Fullscreen is unavailable in this browser`,enterPictureInPicture:`Open desktop in Picture-in-Picture`,exitPictureInPicture:`Close Picture-in-Picture`,pictureInPictureTitle:`Desktop — view-only Picture-in-Picture`,pictureInPictureUnavailable:`Picture-in-Picture requires a supported browser and a secure connection`,pickerTitle:`Desktop sources`,availableDesktops:`Available desktops`,thisMachine:`This machine`,refresh:`Refresh`,refreshing:`Refreshing…`,loading:`Loading desktop sources…`,empty:`No desktop-capable sources are available.`,sourceUnavailable:`The requested desktop is unavailable. Retry when the machine is ready.`,hostDesktopOff:`Desktop access is not enabled on the Gateway host. This panel shares the Gateway host's screen, not the screen of the device running this browser.`,hostDesktopEnableHint:`Enable desktop access to view and control the Gateway host in OpenClaw.`,hostScreenSharingSetupHint:`On the Gateway host Mac, open System Settings → General → Sharing. Turn on Screen Sharing, or allow the Gateway host account to Observe and Control in Remote Management, then check again.`,hostDesktopServerSetupHint:`Set up a password-protected VNC server on the Gateway host, or configure a managed desktop on Linux, then check again.`,hostScreenSharingAccount:`Screen Sharing signs in with a macOS user account on the Gateway host. A sign-in prompt follows after you enable access.`,hostDesktopServerAccount:`The desktop server on the Gateway host uses its own password. A sign-in prompt may follow after you enable access.`,screenSharingNetwork:`Screen Sharing may also be reachable from other devices on your network.`,desktopServerNetwork:`The desktop server may be reachable from other devices on your network.`,macLocked:`This Mac is locked. Sign in through Screen Sharing or on the Mac to use computer control.`,macLockStateUnknown:`This Mac’s lock state is unknown. Check the desktop before using computer control; Screen Sharing remains available for sign-in.`,connect:`Connect`,connecting:n.desktop.connecting,starting:`Starting your machine…`,preparing:`Preparing the desktop…`,takeControl:`Take control`,clickToTakeControl:`Click to take control`,takingControl:`Taking control…`,switchingToViewing:`Switching to view only…`,controlling:`Controlling`,connectionLost:`Connection lost`,connectionError:`Could not connect`,inventoryError:`Could not load desktops`,credentialsTitle:`Connect to desktop`,emptyTitle:`No desktop available`,backToViewing:`Back to viewing`,connected:`Connected`,gatewayHost:`Gateway host`,moreActions:`Desktop actions`,expandPanel:`Expand panel`,collapsePanel:`Collapse panel`,switchToViewOnly:`Switch to view only`,viewOnly:`View only`,control:`Control`,audio:{unavailable:`Audio unavailable`,setupUnavailable:`Desktop audio setup is unavailable. Ask the operator to check that pulseaudio and pulseaudio-utils are installed, then restart the managed desktop.`,reconnect:`Reconnect desktop for audio`,connecting:`Connecting desktop audio…`,unmute:`Unmute desktop audio`,mute:`Mute desktop audio`,blocked:`Audio playback was blocked. Allow sound for this site, then click Unmute desktop audio again.`,unsupported:`Desktop audio requires a browser with Web Audio support. Try a current browser.`,failed:`Desktop audio disconnected or could not start. Reconnect the desktop to try again.`},keyboard:`Keyboard`,keyboardInput:`Remote desktop keyboard input`,touchControls:`Remote desktop controls`,fit:`Fit`,fitHeight:`Fit height`,fitWidth:`Fit width`,actual:`Actual`,actualSizeLabel:`Actual size`,match:`Match`,sizing:`Desktop size`,matchRequirement:`Match requires a VNC server that supports desktop resizing.`,fitScreen:`Fit screen`,actualSize:`Use actual size`,back:`Back`,disconnect:`Disconnect`,reconnect:n.desktop.reconnect,passwordPrompt:`Enter the VNC password for this machine.`,passwordLabel:`VNC password`,accountPrompt:`Enter a macOS account allowed in System Settings → General → Sharing. Remote Management also requires Observe/Control permissions.`,usernameLabel:`macOS username`,accountPasswordLabel:`macOS password`,controlTaken:`Another operator took control`,controlTakenBy:`{operator} took control`,disconnected:`Desktop disconnected: {reason}`,disconnectedClean:`Desktop disconnected`,closeCode:`connection closed with code {code}`,unknownReason:`unknown reason`,errors:{pictureInPictureFailed:`Could not open or update Picture-in-Picture. Check browser permissions and try again from the desktop viewer.`,listFailed:`Could not load desktop sources: {error}`,fullscreenFailed:`Could not change fullscreen mode: {error}`,securityFailed:`Desktop security negotiation failed: {reason}`,connectionFailed:`Reconnect. If it fails again, check the browser console and desktop service logs.`}}},Z=Object.assign(()=>Object.assign(n.desktop,Ve.desktop),{catalog:Ve})})))()}function He(e){let t=()=>e.state===`playing`||e.state===`starting`,n=()=>[`unavailable`,`setup-unavailable`,`unsupported`,`error`].includes(e.state),r=()=>e.state===`setup-unavailable`,i=()=>!e.connected||n()||e.state===`connecting`,a=()=>j(e.state===`retired`?`desktop.audio.reconnect`:e.state===`unavailable`||r()?`desktop.audio.unavailable`:e.state===`unsupported`?`desktop.audio.unsupported`:e.state===`error`?`desktop.audio.failed`:e.state===`connecting`?`desktop.audio.connecting`:t()?`desktop.audio.mute`:`desktop.audio.unmute`),o=()=>(()=>{var o=Ge(),s=o.firstChild;return o._$$click=()=>{i()||e.onToggle()},V(o,G(se,{get children(){return[We(),H(()=>H(()=>!!t())()?Ke():qe())]}}),s),V(s,()=>j(e.state===`retired`?`desktop.audio.reconnect`:n()?`desktop.audio.unavailable`:t()?`desktop.audio.mute`:`desktop.audio.unmute`)),K(()=>({e:ge([e.documentMode?`desktop-touch-action`:`desktop-toolbar-action`,`desktop-audio-button`]),t:r()?void 0:a(),a:a(),o:t()?`true`:`false`,i:e.state===`starting`||e.state===`connecting`?`true`:`false`,n:r()?`true`:void 0,s:i()&&!r()}),({e,t,a:n,o:r,i,n:a,s},c)=>{he(o,e,c?.e),t!==c?.t&&U(o,`title`,t),n!==c?.a&&U(o,`aria-label`,n),r!==c?.o&&U(o,`aria-pressed`,r),i!==c?.i&&U(o,`aria-busy`,i),a!==c?.n&&U(o,`aria-disabled`,a),s!==c?.s&&U(o,`disabled`,s)}),o})();return H(()=>H(()=>!!r())()?(()=>{var e=Je();return e._$owner=de(),V(e,o),K(()=>j(`desktop.audio.setupUnavailable`),t=>{e.content=t}),e})():o())}function Ue(e){let t=()=>e.state===`blocked`?j(`desktop.audio.blocked`):e.state===`unsupported`?j(`desktop.audio.unsupported`):e.state===`error`?j(`desktop.audio.failed`):null;return H(()=>H(()=>!!t())()?(()=>{var e=Ye();return V(e,t),e})():t())}var We,Ge,Ke,qe,Je,Ye;function Xe(){return(Xe=e((()=>{J(),Q(),k(),O(),A(),We=Y(`<svg><polygon points="11 5 6 9 3 9 3 15 6 15 11 19 11 5"></svg>`,2),Ge=Y(`<button type=button><span class=desktop-audio-label>`),Ke=Y(`<svg><path d="M15.5 8.5a5 5 0 0 1 0 7m3-10a9 9 0 0 1 0 13"></svg>`,2),qe=Y(`<svg><path d="m17 9 6 6m0-6-6 6"></svg>`,2),Je=Y(`<openclaw-tooltip open-on-click>`,1),Ye=Y(`<div class="desktop-note desktop-note--error"role=alert>`),M(Z),_e([`click`])})))()}function Ze(e,t){let n=`unavailable`,r,i=ce(()=>n,{read:e=>e(),subscribe:(e,t)=>(r=t,()=>{r=void 0}),equality:Object.is}),a=null,o=null,s=null,c=null,u=0,d=0,f=0,p=!1,m=!1,h=()=>!e.ownerDocument.hidden&&(!e.embedded||e.presented);W(()=>{let t=l(e.ownerDocument,`visibilitychange`,()=>{e.ownerDocument.hidden&&y()});return()=>{t(),r=void 0,b()}});function g(){n===`playing`||n===`starting`?x(`muted`):n===`retired`?t().reconnect():t().connected&&h()&&v()}function _(e,t){b();let r=e.audio;if(!r){e.audioUnavailableReason===`setup-unavailable`&&w(`setup-unavailable`);return}if(!h()){y(!0);return}if(typeof AudioContext!=`function`){w(`unsupported`);return}let i=u;f=0;try{let e=new WebSocket(Me(r.wsPath,t));a=e,e.binaryType=`arraybuffer`;let d=()=>i===u&&a===e,f=()=>{d()&&w(`muted`)},p=e=>{if(d()){if(typeof e.data==`string`)C(e.data);else if(e.data instanceof ArrayBuffer&&n===`playing`){if(s?.state!==`running`){x(`blocked`);return}try{c?.play(new Uint8Array(e.data))}catch{x(`error`)}}}},m=()=>{d()&&(b(),w(`error`))},h=[l(e,`open`,f),l(e,`message`,p),l(e,`error`,m),l(e,`close`,m)];o=()=>h.forEach(e=>e()),w(`connecting`)}catch{b(),w(`error`)}}function v(){let e=a;if(!e||e.readyState!==WebSocket.OPEN||n===`starting`||n===`playing`)return;let t=u,r=++d;try{let e=new AudioContext({latencyHint:`interactive`,sampleRate:Qe});s=e;let n=e.resume();w(`starting`),n.then(()=>{t===u&&r===d&&s===e&&(e.state===`running`?(p=!0,S()):x(`blocked`))},()=>{t===u&&r===d&&x(`blocked`)})}catch{x(`blocked`)}}function y(e=n!==`unavailable`&&n!==`setup-unavailable`){let t=n===`setup-unavailable`;b(),t&&!e&&w(`setup-unavailable`),e&&w(`retired`)}function b(){++u,x(`unavailable`);let e=a;a=null,o?.(),o=null,e?.close()}function x(e){++d,p=!1,m=!1,c?.stop(),c=null;let t=s;if(s=null,t&&t.close().catch(()=>void 0),a?.readyState===WebSocket.OPEN)try{f+=1,a.send(JSON.stringify({action:`stop`}))}catch{}w(e)}function S(){let e=a;if(!(!e||!p||f>0)){p=!1,m=!0;try{e.send(JSON.stringify({action:`start`}))}catch{x(`error`)}}}function C(e){let t;try{t=JSON.parse(e)}catch{return}if(typeof t==`object`&&t&&`state`in t){if(f>0)t.state===`stopped`&&(--f,S());else if(t.state===`started`&&n===`starting`&&m){if(m=!1,s?.state!==`running`){x(`blocked`);return}c=new nt(s),w(`playing`)}else(n===`starting`||n===`playing`)&&(t.state===`error`||t.state===`stopped`)&&x(`error`)}}function w(t){n=t,e.isConnected&&r?.()}return{state:i.read,toggle:g,connect:_,retire:y,close:b}}var Qe,$e,et,tt,nt;function rt(){return(rt=e((()=>{B(),re(),Qe=48e3,$e=4,et=Qe/4,tt=32,nt=class{constructor(e){this.context=e,this.remainder=new Uint8Array,this.playhead=0,this.sources=new Map}play(e){let t=this.remainder.length+e.length,n=t-t%$e,r=t=>t<this.remainder.length?this.remainder[t]:e[t-this.remainder.length],i=new Uint8Array(t-n);for(let e=0;e<i.length;e+=1)i[e]=r(n+e);let a=Math.min(n/$e,et);if(a===0){this.remainder=i;return}let o=new Uint8Array(a*$e),s=n-o.length;for(let e=0;e<o.length;e+=1)o[e]=r(s+e);this.remainder=i;let c=this.context.currentTime,u=a/Qe;(Math.max(c,this.playhead)+u-c>.25||this.sources.size>=tt)&&this.clearSources();let d=this.context.createBuffer(2,a,Qe),f=new DataView(o.buffer);for(let e=0;e<2;e+=1){let t=d.getChannelData(e);for(let n=0;n<a;n+=1)t[n]=f.getInt16(n*$e+e*2,!0)/32768}let p=this.context.createBufferSource(),m=l(p,`ended`,()=>{this.sources.delete(p),m(),p.disconnect()});this.sources.set(p,m),p.buffer=d,p.connect(this.context.destination);let h=Math.max(c,this.playhead);p.start(h),this.playhead=h+u}stop(){this.remainder=new Uint8Array,this.clearSources()}clearSources(){let e=[...this.sources];this.sources.clear(),this.playhead=this.context.currentTime;for(let[t,n]of e){n();try{t.stop()}catch{}t.disconnect()}}}})))()}function it(e){return e?.querySelector(`canvas`)??null}function at(e){let t=e.ownerDocument.createElement(`div`);t.style.cssText=`width:100%;height:100%;overflow:hidden`;let n=e.ownerDocument.createElement(`div`);n.style.cssText=`width:100%;height:100%`,t.append(n),e.append(t);let r=`fit`,i,a,o=()=>{let e=it(n);if(!e?.width||!e.height)return;let i=t.getBoundingClientRect(),a=r===`fit-height`?i.height*e.width>i.width*e.height:i.width*e.height>i.height*e.width;t.style.overflowX=r===`fit-height`&&a?`scroll`:`hidden`,t.style.overflowY=r===`fit-width`&&a?`scroll`:`hidden`;let o=t.clientWidth,s=t.clientHeight;o&&s&&(n.style.width=`${r===`fit-height`?Math.max(o,s*e.width/e.height):o}px`,n.style.height=`${r===`fit-width`?Math.max(s,o*e.height/e.width):s}px`)},s=()=>{i?.disconnect(),a?.disconnect(),i=void 0,a=void 0};return{target:n,setMode(e){e!==r&&(r=e,r===`fit-height`||r===`fit-width`?(i||(i=new ResizeObserver(o),i.observe(t),a=new MutationObserver(o),a.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`width`,`height`]})),o()):(s(),t.style.overflow=`hidden`,n.style.width=`100%`,n.style.height=`100%`,t.scrollLeft=0,t.scrollTop=0))},dispose(){s(),t.remove()}}}var ot,st;function ct(){return(ct=e((()=>{te(),d(),ot=async()=>(await u(()=>import(`./novnc-fIT9cznB.js`),[],import.meta.url)).default,st=class{async connect(e){let t=await ot(),n=Me(e.wsUrl,e.gatewayUrl);if(!e.isCurrent())throw new DOMException(`Desktop connection is no longer current`,`AbortError`);let r=new WebSocket(n),i,a=l(r,`close`,e=>{i={code:e.code,reason:e.reason}},{once:!0}),o=at(e.target),s;try{s=new t(o.target,r,e.credentials?{credentials:e.credentials}:void 0)}catch(e){throw o.dispose(),e}s.background=e.background??getComputedStyle(e.target).backgroundColor,s.viewOnly=e.viewOnly,s.resizeSession=!1;let c=!1,u=!1,d=!0,f=!1,p=e.sizingMode??`fit`,m=t=>{it(e.target)?.dispatchEvent(t)},h=(e,t=e.type)=>new KeyboardEvent(t,{key:e.key,code:e.code,location:e.location,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,repeat:e.repeat,isComposing:e.isComposing,bubbles:!0,cancelable:!0}),g=new Map,_=new Set,v=e=>{let t=e.code||e.key;!s.viewOnly&&!c&&t!==`Unidentified`&&!(t===`CapsLock`&&oe())&&g.set(t,e)},y=e=>g.delete(e.code||e.key),b=()=>g.clear(),x=()=>{for(let e of g.values())m(h(e,`keyup`));g.clear()},S=e=>_.add(e.pointerId),C=e=>_.delete(e.pointerId),w=[l(e.target,`keydown`,v,!0),l(e.target,`keyup`,y,!0),l(e.target,`pointerdown`,S,!0),l(window,`pointerup`,C,!0),l(window,`pointercancel`,C,!0),l(window,`blur`,b)],T=()=>{w.forEach(e=>e()),g.clear(),_.clear()},E=()=>{x(),u=!0,s.resizeSession=!1,s.viewOnly=!0},ee=()=>{s.resizeSession=!1,!c&&e.isCurrent()&&(o.setMode(p),s.scaleViewport=p!==`actual`,s.resizeSession=d&&f&&!s.viewOnly&&e.canResize===!0&&p===`match`)};ee();let te=[l(s,`connect`,()=>{c||!e.isCurrent()?E():(f=!0,e.onConnect?.(),ee())}),l(s,`disconnect`,t=>{c=!0,E(),T(),a(),te.forEach(e=>e()),o.dispose();let{clean:n}=t.detail;e.onDisconnect?.({...i,clean:n})}),l(s,`securityfailure`,t=>{E();let n=t.detail??{};e.onSecurityFailure?.(n)})];return{disconnect:()=>{c||(c=!0,E(),T(),s.disconnect(),o.dispose())},disableInput:E,setPresented:t=>(d=t,c||u||!e.isCurrent()||!d&&_.size>0?!1:(d||x(),s.resizeSession=!1,s.viewOnly=!d||e.viewOnly,ee(),!0)),setSizingMode:e=>{p=e,ee()},sendKeyboardEvent:e=>m(h(e)),sendText:e=>{let t=e.replace(/\r\n?/g,`
`);for(let e of t)e.length===2?s.sendKey(16777216|e.codePointAt(0),null):m(new KeyboardEvent(`keydown`,{key:e===`
`?`Enter`:e,code:`Unidentified`,bubbles:!0,cancelable:!0}))},sendBackspace:()=>s.sendKey(65288,`Backspace`)}}}})))()}function lt(e){return G(se,{"stroke-width":`1.65`,"aria-hidden":`true`,get children(){return G(F,{get each(){return Nt[e.name]},children:e=>(()=>{var t=ht();return U(t,`d`,e),t})()})}})}function ut(e){let t=()=>(()=>{var t=gt(),n=de();return V(t,G(N,{name:`externalLink`})),K(()=>({e:e.href,t:j(`desktop.openWindow`),a:j(`desktop.openWindow`)}),({e,t:r,a:i},a)=>{e!==a?.e&&U(t,`href`,e),r!==a?.t&&U(t,`title`,r),i!==a?.a&&U(t,`aria-label`,i),pe(t,n)}),t})();return G(z,{get when(){return e.inline},get fallback(){var e=_t();return V(e,t),e},get children(){return t()}})}function dt(e){let t=ue(),n=I(()=>e.options.platform===`mobile`),r=()=>n()?[]:[{mode:`fit-height`,label:j(`desktop.fitHeight`)},{mode:`fit-width`,label:j(`desktop.fitWidth`)}],i=pt(()=>({...e.sizing,additionalModes:r(),icons:!n()})),a,o,[s,c]=P(!1),l=()=>{c(getComputedStyle(o).display===`none`)};w(()=>!e.recovery||n()?[a]:[],l),W(()=>{(!e.recovery||n())&&l()});let u=()=>(()=>{var t=vt(),r=t.firstChild;return t._$$click=t=>e.options.onFullscreen(t.currentTarget),V(t,(()=>{var t=H(()=>!!n());return()=>t()?G(N,{get name(){return e.options.fullscreen?`minimize`:`maximize`}}):G(lt,{get name(){return e.options.fullscreen?`exit-fullscreen`:`fullscreen`}})})(),r),V(r,()=>j(e.options.fullscreen?`desktop.exitFullscreen`:`desktop.enterFullscreen`)),K(()=>({e:j(e.options.fullscreen?`desktop.exitFullscreen`:`desktop.enterFullscreen`),t:j(e.options.fullscreen?`desktop.exitFullscreen`:`desktop.enterFullscreen`),a:!e.options.fullscreenSupported}),({e,t:n,a:r},i)=>{e!==i?.e&&U(t,`title`,e),n!==i?.t&&U(t,`aria-label`,n),r!==i?.a&&U(t,`disabled`,r)}),t})(),d=()=>!n()&&!e.options.fullscreen&&e.options.onToggleExpanded&&(()=>{var t=vt(),n=t.firstChild;return t._$$click=()=>e.options.onToggleExpanded?.(),V(t,G(N,{get name(){return e.options.expanded?`sessionPanelRestore`:`sessionPanelExpand`}}),n),V(n,()=>j(e.options.expanded?`desktop.collapsePanel`:`desktop.expandPanel`)),K(()=>({e:j(e.options.expanded?`desktop.collapsePanel`:`desktop.expandPanel`),t:j(e.options.expanded?`desktop.collapsePanel`:`desktop.expandPanel`)}),({e,t:n},r)=>{e!==r?.e&&U(t,`title`,e),n!==r?.t&&U(t,`aria-label`,n)}),t})(),f=()=>{let t=[{kind:`group`,id:`tools`,class:n()?`desktop-rail__overflow-tools`:void 0,items:[{kind:`content`,id:`media`,content:[H(()=>e.options.audioControl()),H(()=>e.options.pictureInPictureControl())]}]},...n()?[]:[{kind:`group`,id:`sizing`,class:`desktop-rail__menu-section`,items:i.items()}]];return s()&&t.push({kind:`content`,id:`window`,content:(()=>{var e=yt(),t=e.firstChild,n=t.nextSibling;return V(e,d,t),V(e,u,n),e})()}),[...t,...e.showApps?e.desktopApps.map(t=>({id:t,label:j(t===`browser`?`browser.title`:`terminal.title`),icon:G(N,{get name(){return t===`browser`?n()?`chrome`:`externalLink`:`terminal`}}),disabled:e.state!==`connected`||e.launchingApp===t})):[],...n()&&e.options.openWindowHref?[{id:`open-window-link`,label:j(`desktop.openWindow`),href:e.options.openWindowHref,attributes:{target:`_blank`,rel:`noopener`},icon:G(N,{name:`externalLink`})}]:e.options.onOpenWindow?[{id:`open-window`,label:j(`desktop.openWindow`),icon:G(N,{name:`externalLink`})}]:[],{id:`disconnect`,label:j(`desktop.disconnect`),icon:n()?G(N,{name:`x`}):G(lt,{name:`disconnect`}),class:n()?void 0:`desktop-rail__disconnect`,disabled:e.state===`disconnected`||e.state===`inventory-error`}]};var p=St(),m=p.firstChild,h=m.firstChild,g=h.nextSibling,_=g.firstChild,v=_.nextSibling,y=m.nextSibling;return q(()=>e=>{a=e},p),V(p,(()=>{var t=H(()=>!!(!n()&&e.options.fullscreen&&e.options.takeoverText));return()=>t()?(()=>{var t=Ct();return V(t,()=>e.options.takeoverText),t})():!n()&&e.options.fullscreen&&e.options.takeoverText})(),m),V(g,G(ft,{get name(){return e.options.machine?.name??``}}),_),V(g,(()=>{var t=H(()=>!!n());return()=>t()?(()=>{var t=wt();return V(t,()=>j(e.state===`connected`?e.controlling?`desktop.controlling`:`desktop.viewOnly`:e.state===`connecting`?`desktop.connecting`:`desktop.disconnectedClean`)),t})():H(()=>!!e.options.machine?.host)()?(()=>{var e=wt();return V(e,()=>j(`desktop.gatewayHost`)),e})():e.options.machine?.host})(),v),V(p,G(z,{get when(){return!e.recovery||n()},get fallback(){var t=Tt(),n=t.firstChild,r=n.nextSibling;return V(t,(()=>{var t=H(()=>!!e.options.fullscreen);return()=>t()?u():e.options.fullscreen})(),n),V(t,(()=>{var t=H(()=>!!e.options.openWindowHref);return()=>t()?G(ut,{get href(){return e.options.openWindowHref}}):e.options.openWindowHref})(),r),t},get children(){var a=xt(),s=a.firstChild,c=s.firstChild,l=c.firstChild,p=l.nextSibling,m=s.nextSibling,h=m.nextSibling,g=h.nextSibling;return c._$$click=()=>e.controlling?e.onControlToggle():e.onTakeControl(),V(c,(()=>{var t=H(()=>!n());return()=>t()&&(e.controlling?G(N,{name:`eye`}):Et())})(),l),V(c,()=>j(e.controlling?n()?`desktop.viewOnly`:`desktop.backToViewing`:`desktop.takeControl`),p),V(a,(()=>{var t=H(()=>!!n());return()=>t()?(()=>{var t=Dt();return V(t,G(mt,R(()=>e.sizing,{presentation:`menu`,get additionalModes(){return r()},get placement(){return e.options.fullscreen?`top-end`:`bottom-end`}}))),t})():n()})(),m),V(a,G(ie,{id:`desktop-actions-${t}`,get class(){return n()?void 0:`desktop-rail__pill`},get label(){return j(`desktop.moreActions`)},get trigger(){return G(N,{name:`moreHorizontal`})},triggerClass:`desktop-toolbar-action desktop-rail__more`,get panelClass(){return[`desktop-rail__menu`,{"desktop-rail__menu--desktop":!n()}]},get placement(){return e.options.fullscreen?`top-end`:`bottom-end`},get items(){return f()},onSelect:t=>{if(!i.select(t)){if(t.id===`disconnect`)e.onDisconnect();else if(t.id===`open-window`)e.options.onOpenWindow?.();else{let n=e.desktopApps.find(e=>e===t.id);n&&e.state===`connected`&&e.onLaunch(n)}}}}),h),V(a,G(z,{get when(){return n()},get fallback(){var t=Ot(),n=t.firstChild,r=n.firstChild,i=r.nextSibling;return q(()=>e=>{o=e},n),V(n,d,r),V(n,u,i),V(t,(()=>{var t=H(()=>!!e.options.openWindowHref);return()=>t()?G(ut,{get href(){return e.options.openWindowHref},inline:!0}):e.options.openWindowHref})(),null),t},get children(){var e=bt(),t=e.firstChild,n=t.nextSibling;return q(()=>e=>{o=e},e),V(e,d,t),V(e,u,n),e}}),g),K(()=>e.state!==`connected`,e=>{U(c,`disabled`,e)}),a}}),y),K(()=>({e:!!n(),t:!n(),a:n()?void 0:`desktop`,o:e.state===`connected`,i:!(e.state!==`disconnected`||e.options.failureKind!==`lost`&&(n()||e.options.failureKind!==`closed`)),n:j(e.state===`connected`?`desktop.connected`:e.state===`connecting`?`desktop.connecting`:`desktop.disconnectedClean`)}),({e,t,a:n,o:r,i,n:a},o)=>{e!==o?.e&&p.classList.toggle(`desktop-connection-rail--mobile`,e),t!==o?.t&&p.classList.toggle(`session-panel-rail`,t),n!==o?.a&&U(p,`data-presentation`,n),r!==o?.o&&h.classList.toggle(`is-connected`,r),i!==o?.i&&h.classList.toggle(`is-disconnected`,i),a!==o?.n&&U(h,`aria-label`,a)}),p}function ft(e){let t,[n,r]=P(!1);le(()=>e.name,()=>{let e=t.scrollWidth>t.clientWidth;return()=>r(e)},{targets:()=>[t]});var i=kt();return q(()=>e=>{t=e},i),V(i,()=>e.name),K(()=>({e:!!n(),t:e.name}),({e,t},n)=>{e!==n?.e&&i.classList.toggle(`is-overflowing`,e),t!==n?.t&&U(i,`title`,t)}),i}function pt(e){let t=()=>{let t=e();return[{mode:`fit`,label:j(`desktop.fit`)},{mode:`actual`,label:j(`desktop.actualSizeLabel`)},...t.additionalModes??[],...t.canResize||t.mode===`match`?[{mode:`match`,label:j(`desktop.match`)}]:[]]};return{label:()=>t().find(t=>t.mode===e().mode)?.label??j(`desktop.sizing`),items:()=>t().map(t=>({id:`sizing-${t.mode}`,label:t.label,icon:e().icons?G(lt,{get name(){return t.mode}}):void 0,type:`radio`,checked:e().mode===t.mode,disabled:t.mode===`match`&&!e().canResize,attributes:t.mode===`match`?{title:j(`desktop.matchRequirement`)}:void 0})),select(n){let r=t().find(e=>`sizing-${e.mode}`===n.id);if(!r)return!1;let i=e();return(r.mode!==`match`||i.canResize)&&i.onChange(r.mode),!0}}}function mt(e){let t=ue(),n=pt(()=>e);return G(z,{get when(){return e.presentation===`menu`},get fallback(){var t=At(),n=t.firstChild,r=n.nextSibling;return t.addEventListener(`change`,t=>{let n=t.currentTarget.value;(n===`fit`||n===`actual`||n===`match`&&e.canResize)&&e.onChange(n)}),V(n,()=>j(`desktop.fit`)),V(r,()=>j(`desktop.actual`)),V(t,(()=>{var t=H(()=>!!(e.canResize||e.mode===`match`));return()=>t()?(()=>{var t=jt();return V(t,()=>j(`desktop.match`)),K(()=>({e:e.mode===`match`,t:!e.canResize}),({e,t:n},r)=>{t.selected=e,n!==r?.t&&U(t,`disabled`,n)}),t})():e.canResize||e.mode===`match`})(),null),K(()=>({e:j(`desktop.sizing`),t:j(`desktop.matchRequirement`),a:e.mode===`fit`,o:e.mode===`actual`}),({e,t:i,a,o},s)=>{e!==s?.e&&U(t,`aria-label`,e),i!==s?.t&&U(t,`title`,i),n.selected=a,r.selected=o}),t},get children(){return G(ie,{id:`desktop-sizing-${t}`,get label(){return j(`desktop.sizing`)},class:`desktop-sizing-menu`,triggerClass:`desktop-toolbar-action desktop-sizing-menu__trigger`,get placement(){return e.placement??`bottom-end`},get trigger(){var e=Mt(),t=e.firstChild,r=t.nextSibling,i=r.nextSibling;return V(e,G(N,{name:`maximize`,class:`desktop-sizing-menu__icon`}),t),V(e,()=>n.label(),r),V(e,G(N,{name:`chevronDown`}),i),e},get items(){return n.items()},onSelect:e=>n.select(e)})}})}var ht,gt,_t,vt,yt,bt,xt,St,Ct,wt,Tt,Et,Dt,Ot,kt,At,jt,Mt,Nt;function Pt(){return(Pt=e((()=>{J(),B(),Q(),k(),ne(),_(),g(),b(),O(),ht=Y(`<svg><path></svg>`,2),gt=Y(`<a class="session-panel-rail__button desktop-open-window"target=_blank rel=noopener>`),_t=Y(`<div class=session-panel-rail__group>`),vt=Y(`<button type=button class=desktop-toolbar-action><span class=desktop-rail__action-label>`),yt=Y(`<div class=desktop-rail__overflow-window><!><!>`),bt=Y(`<div class="desktop-rail__pill desktop-rail__window"><!><!>`),xt=Y(`<div class=desktop-rail__actions><div class=desktop-rail__pill><button type=button class="desktop-toolbar-action desktop-rail__control"><!><!></button></div><!><!><!>`),St=Y(`<div class=desktop-connection-rail><div class=desktop-rail__identity><span class=desktop-rail__dot role=img></span><div class=desktop-rail__machine><!><!></div></div><!>`),Ct=Y(`<div class="desktop-takeover desktop-takeover--fullscreen"role=status>`),wt=Y(`<span class=desktop-rail__host>`),Tt=Y(`<div class=desktop-rail__actions><!><!>`),Et=Y(`<svg class=desktop-rail__cursor viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linejoin=round aria-hidden=true><path d="m4 3 7 18 2-8 8-2Z">`),Dt=Y(`<div class="desktop-rail__pill desktop-rail__tools">`),Ot=Y(`<div class="desktop-rail__pill desktop-rail__window-group"><div class=desktop-rail__window><!><!>`),kt=Y(`<span class=desktop-rail__name>`),At=Y(`<select class=desktop-sizing><option value=fit></option><option value=actual>`),jt=Y(`<option value=match>`),Mt=Y(`<span class=desktop-sizing-menu__value><!><!><!>`),M(Z),Nt={fullscreen:[`M8 3H5a2 2 0 0 0-2 2v3m13-5h3a2 2 0 0 1 2 2v3M3 16v3a2 2 0 0 0 2 2h3m8 0h3a2 2 0 0 0 2-2v-3`],"exit-fullscreen":[`M8 3v3a2 2 0 0 1-2 2H3m13-5v3a2 2 0 0 0 2 2h3M3 16h3a2 2 0 0 1 2 2v3m8 0v-3a2 2 0 0 1 2-2h3`],fit:[`M8 3H5a2 2 0 0 0-2 2v3m13-5h3a2 2 0 0 1 2 2v3M3 16v3a2 2 0 0 0 2 2h3m8 0h3a2 2 0 0 0 2-2v-3`],actual:[`M4 5h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2Z`,`M6 9h.01M18 15h.01`],"fit-height":[`m8 6 4-4 4 4M12 2v20m-4-4 4 4 4-4`],"fit-width":[`m6 8-4 4 4 4M2 12h20m-4-4 4 4-4 4`],match:[`M12 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v6M12 17v4M8 21h4`,`M19 14v-1m0 9v-1m-4-4h-1m9 0h-1m-5.8-2.8-.7-.7m7 7-.7-.7m-5.6 0-.7.7m7-7-.7.7`,`M21 17a2 2 0 1 0-4 0 2 2 0 0 0 4 0`],disconnect:[`m19 5 3-3M2 22l3-3M6.3 20.3l-2.6-2.6a1 1 0 0 1 0-1.4l3.6-3.6a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-3.6 3.6a1 1 0 0 1-1.4 0ZM17.7 3.7l2.6 2.6a1 1 0 0 1 0 1.4l-3.6 3.6a1 1 0 0 1-1.4 0l-2.6-2.6a1 1 0 0 1 0-1.4l3.6-3.6a1 1 0 0 1 1.4 0ZM9 11l2-2m2 6 2-2`]},_e([`click`])})))()}function Ft(e){let t=()=>(()=>{var t=Lt(),n=t.firstChild,r=n.nextSibling;return V(t,G(N,{name:`monitor`}),n),V(t,(()=>{var t=H(()=>!!e.pending);return()=>t()?G(N,{name:`loader`,class:`desktop-status-surface__spinner`}):e.pending})(),r),t})();return G(z,{get when(){return e.overlay},get fallback(){var n=zt();return V(n,G(Pe,{presentation:`desktop`,get icon(){return t()},get heading(){return e.heading},get description(){return e.description??``},get action(){return e.action}})),n},get children(){var n=Rt(),r=n.firstChild,i=r.nextSibling,a=i.nextSibling;return V(n,t,r),V(r,()=>e.heading),V(n,(()=>{var t=H(()=>!!e.description);return()=>t()?(()=>{var t=Bt();return V(t,()=>e.description),t})():e.description})(),i),V(n,(()=>{var t=H(()=>!!e.action);return()=>t()?(()=>{var t=Vt();return V(t,()=>e.action),t})():e.action})(),a),K(()=>!!e.overlay,e=>{n.classList.toggle(`desktop-status-surface--overlay`,e)}),n}})}function It(e){let t,n=I(()=>e.active&&e.fullscreen),[r,i]=P(()=>(n(),null)),a=I(()=>{let t=r();return e.fullscreen&&t?{left:`${t.x}px`,top:`${t.y}px`}:void 0});W(()=>{let r=e.stage(),a=()=>{i(null)},o=l(r,`pointermove`,e=>{if(!n())return;let o=it(r);if(!o){a();return}let s=o.getBoundingClientRect(),c=r.getBoundingClientRect(),l=Math.max(s.left,c.left),u=Math.min(s.right,c.right),d=Math.max(s.top,c.top),f=Math.min(s.bottom,c.bottom);e.clientX<l||e.clientX>u||e.clientY<d||e.clientY>f?a():i({x:Math.max(l+8,Math.min(e.clientX+16,u-t.offsetWidth-8))-c.left,y:Math.max(d+8,Math.min(e.clientY+18,f-t.offsetHeight-8))-c.top})}),s=l(r,`pointerleave`,a);return()=>{o(),s()}});var o=Ht();return q(()=>e=>t=e,o),V(o,()=>j(`desktop.clickToTakeControl`)),K(()=>({e:e.active?`true`:`false`,t:e.fullscreen?`true`:`false`,a:r()?`true`:`false`,o:ge(a())}),({e,t,a:n,o:r},i)=>{e!==i?.e&&U(o,`data-active`,e),t!==i?.t&&U(o,`data-fullscreen`,t),n!==i?.a&&U(o,`data-positioned`,n),me(o,r,i?.o)}),o}var Lt,Rt,zt,Bt,Vt,Ht;function Ut(){return(Ut=e((()=>{J(),B(),k(),g(),Ne(),ct(),Lt=Y(`<span class=desktop-status-surface__icon aria-hidden=true><!><!>`),Rt=Y(`<div class=desktop-status-surface role=status><strong></strong><!><!>`),zt=Y(`<div class="desktop-status-surface desktop-status-surface--anchored">`),Bt=Y(`<p>`),Vt=Y(`<div class=desktop-status-surface__action>`),Ht=Y(`<span class=desktop-viewer-hint aria-hidden=true>`)})))()}var Wt,Gt;function Kt(){return(Kt=e((()=>{c(),Wt={systems:{title:`Systems`,inventory:`Machines`,search:`Find a machine…`,filterSort:`Filter & sort machines`,sortBy:`Sort by`,alphabetical:`Alphabetical`,onlineFirst:`Online first`,offlineFirst:`Offline first`,all:`All`,select:`Select a machine`,selectHint:`Choose a host, worker, or paired node to see its status and desktop.`,refresh:`Refresh machines`,loading:`Loading machines…`,empty:`No machines are available to this account.`,noMatches:`No machines match your search or filters.`,offlineGateway:`Gateway disconnected. Reconnect to refresh machines or open a desktop.`,offlineTitle:`This machine is offline`,offlineHint:`Its last reported information is shown. Reconnect the machine to open its desktop.`,noDesktopTitle:`No desktop available`,noDesktopHint:`This machine has not reported a desktop. Its other capabilities remain available.`,noHostDesktopHint:`Refresh machines to check screen-sharing availability on this Gateway.`,screenSharingDetected:`Screen Sharing is available`,desktopDetected:`A desktop is available`,managedDesktopConfigured:`A managed desktop is configured`,screenSharingNeeded:`Turn on Screen Sharing`,desktopServerNeeded:`Set up a desktop server`,desktopSetupAttention:`Screen sharing needs attention`,desktopSetupEnableHint:`Enable desktop access to view and control this machine in OpenClaw.`,screenSharingSetupHint:`On this Mac, open System Settings → General → Sharing. Turn on Screen Sharing, or allow this account to Observe and Control in Remote Management, then check again.`,desktopServerSetupHint:`Set up a password-protected VNC server on this machine, or configure a managed desktop on Linux, then check again.`,enableDesktopAccess:`Enable desktop access in OpenClaw`,desktopSetupEnabling:`Enabling desktop access…`,desktopSetupEnabled:`Desktop access is enabled`,desktopSetupConnecting:`Waiting for desktop access to become available.`,desktopSetupApplyHint:`Applies without restarting the Gateway.`,desktopSetupAdminHint:`A Gateway administrator can enable desktop access.`,desktopSetupCheckAgain:`Check again`,desktopSetupFailed:`Desktop access could not be enabled. Refresh machines and try again.`,accessTitle:`Desktop access unavailable`,accessHint:`Desktop viewing requires an advertised desktop service and administrator access.`,missingTitle:`This machine is no longer listed`,missingHint:`Refresh the inventory or choose another machine. Your selection has not been changed.`,details:`Machine details`,closeDetails:`Close details`,stats:`Show statistics`,hideStats:`Hide statistics`,online:`Online`,offline:`Offline`,unknown:`Unknown`,unavailable:`Unavailable`,desktop:`Desktop`,host:`Gateway host`,worker:`Worker`,node:`Paired node`,workers:`Workers`,nodes:`Paired nodes`,status:`Status`,platform:`Platform`,identifier:`Identifier`,capabilities:`Capabilities`,telemetry:`Reported statistics`,load:`Load (1 min)`,cpuCount:`{count} cores`,memory:`Memory used`,disk:`Disk available`,sampled:`Sampled {time}`,collectingHistory:`Collecting history…`,lastKnown:`Last reported {time}`,noTelemetry:`This machine has not reported resource statistics.`,attachedSessions:`Attached sessions`,attachedHint:`Attachment does not mean a session is currently executing on this machine.`,relatedSessions:`Related sessions`,relatedHint:`Bindings from the loaded session list. A binding is not proof that a turn executed here.`,noRelatedSessions:`No related sessions in the loaded list.`,relations:{placement:`Placed here`,"retained-placement":`Retained placement`,runner:`Runner`,"exec-binding":`Configured exec target`,gateway:`Local session context`},statuses:{starting:`Starting`,stopping:`Stopping`,error:`Error`},errors:`Some machine information could not be refreshed.`,backups:{title:`Backups`,loading:`Loading backups…`,readAccessRequired:`Operator read access is required to view backups.`,empty:`No backups recorded —`,ok:`OK`,failed:`Failed`,pushFailed:`Push failed`,lastSuccess:`Last success: {age}`,lastLocalSuccess:`Last local success: {age}`,never:`Never recorded`,nextRun:`Next run: {time}`,namespace:`Namespace: {name}`,scheduled:`Scheduled: {target}.`,failureHint:`Check the backup job logs and try again.`,pushFailureHint:`Local backup succeeded, but pushing to the Git remote failed. Check the remote and retry.`,locations:`Storage locations`,check:`Check`,checkLocation:`Check {name}`,checking:`Checking…`,free:`{size} free`,kinds:{archive:`Archive`,"sqlite-snapshot":`SQLite snapshot`,git:`Git`,external:`External`},probe:{ok:`Available`,unavailable:`Unavailable`,uninitialized:`Not initialized`,"wrong-key":`Wrong encryption key`,error:`Check failed`}}}},Gt=Object.assign(()=>Object.assign(n,Wt),{catalog:Wt})})))()}function qt(e,t,n){let r=e===`ready`||e===`managed`;return{title:n?`systems.desktopSetupEnabled`:[[`managed`,`systems.managedDesktopConfigured`],[`ready`,t?`systems.screenSharingDetected`:`systems.desktopDetected`],[`needs-server`,t?`systems.screenSharingNeeded`:`systems.desktopServerNeeded`]].find(([t])=>t===e)?.[1]??`systems.desktopSetupAttention`,hint:n?`systems.desktopSetupConnecting`:r?`systems.desktopSetupEnableHint`:t&&e===`needs-server`?`systems.screenSharingSetupHint`:`systems.desktopServerSetupHint`}}async function Jt(e,t,n){try{return await e.ensureLoaded(),n()?await e.patch({raw:{desktop:{host:{enabled:!0}}},note:t,canDispatch:n})?null:e.state.lastError??j(`systems.desktopSetupFailed`):void 0}catch(e){return i(e)}}function Yt(e,t,n){let r=null,i=!1,a=null,o=0;async function s(){let r=e.runtimeConfig;if(!r||r.canPatch!==!0||i)return;let s=o,c=()=>s===o&&e.runtimeConfig===r;i=!0,a=null,t();let l=await Jt(r,`desktop: enable host desktop`,c);c()&&(i=!1,a=typeof l==`string`?l:null,t(),l===null&&n())}return{set(e){r=e},clear(){o+=1,r=null,i=!1,a=null},view(){return r?{environment:r,canEnable:e.runtimeConfig?.canPatch===!0,busy:i,error:a,onEnable:()=>void s(),onCheckAgain:n}:null}}}function Xt(){return(Xt=e((()=>{Kt(),r(),k(),M(Gt)})))()}function Zt(e){let t=()=>e.connection.rail&&(e.connection.rail.machine||e.connection.rail.openWindowHref)&&G(dt,R(()=>e.connection,{recovery:!0,get state(){return e.content.state},get options(){return e.connection.rail}}));var n=cn(),r=n.firstChild,i=r.nextSibling,a=i.nextSibling;return q(()=>t=>e.sectionRef(t),n),V(n,(()=>{var t=H(()=>!e.embedded);return()=>t()&&e.renderResizer()})(),r),V(n,(()=>{var t=H(()=>!e.embedded);return()=>t()&&(()=>{var t=ln(),n=t.firstChild,r=n.nextSibling,i=r.firstChild,a=i.nextSibling,o=a.nextSibling,s=o.nextSibling,c=s.nextSibling;return V(n,()=>j(`desktop.title`)),V(r,G(X,{get class(){return[`rail-header__action bp-icon`,{"is-active":e.dock===`bottom`}]},get label(){return j(`desktop.dockBottom`)},get icon(){return G(N,{name:`panelBottomOpen`})},onClick:()=>e.onDock(`bottom`)}),i),V(r,G(X,{get class(){return[`rail-header__action bp-icon`,{"is-active":e.dock===`right`}]},get label(){return j(`desktop.dockRight`)},get icon(){return G(N,{name:`panelRightOpen`})},onClick:()=>e.onDock(`right`)}),a),V(r,G(X,{class:`rail-header__action bp-icon bp-open-window`,get label(){return j(`desktop.openWindow`)},get icon(){return G(N,{name:`externalLink`})},get onClick(){return e.onOpenWindow}}),o),V(r,()=>e.renderFullscreenControl(),s),V(r,G(X,{class:`rail-header__action bp-icon`,get label(){return j(`desktop.hide`)},get icon(){return G(N,{name:`x`})},get onClick(){return e.onClose}}),c),t})()})(),i),V(n,G(Qt,R(()=>e.content,{credentials:()=>[H(()=>H(()=>!!e.desktopPresentation)()?t():e.desktopPresentation),H(()=>e.content.credentials())],recovery:()=>[H(t),H(()=>e.content.recovery())],connection:()=>G(rn,R(()=>e.connection,{get state(){return e.content.state},get presentationControls(){return H(()=>!!e.workspaceControls)()?[G(X,{class:`desktop-toolbar-action`,get label(){return j(`desktop.openWindow`)},get icon(){return G(N,{name:`externalLink`})},get onClick(){return e.onOpenWindow}}),H(()=>e.renderFullscreenControl())]:e.workspaceControls}}))})),a),K(()=>({e:[`bp`,`bp--${e.embedded?`embedded`:e.dock}`,{"desktop-presentation--desktop":e.desktopPresentation,"desktop-presentation--mobile":e.mobilePresentation,"desktop-presentation--fullscreen":e.desktopPresentation&&e.fullscreen}],t:ge(e.embedded||e.fullscreen?``:e.dock===`bottom`?`height:${e.height}px`:`width:${e.width}px`),a:j(`desktop.title`)}),({e,t,a:r},i)=>{he(n,e,i?.e),me(n,t,i?.t),r!==i?.a&&U(n,`aria-label`,r)}),n}function Qt(e){let t=()=>e.notice();var n=un(),r=n.firstChild,i=r.nextSibling,a=i.nextSibling,o=a.nextSibling,s=o.nextSibling;return V(n,G(t,{}),r),V(n,G(z,{get when(){return e.state===`picker`},children:t=>t()&&e.picker()}),i),V(n,G(z,{get when(){return e.state===`inventory-error`||e.state===`disconnected`},children:t=>t()&&e.recovery()}),a),V(n,G(z,{get when(){return e.state===`credentials`},children:t=>t()&&e.credentials()}),o),V(n,G(z,{get when(){return e.state===`connecting`||e.state===`connected`},children:t=>t()&&e.connection()}),s),n}function $t(e){let t=()=>e.setup.environment.desktopSetup?.state,n=()=>t()===`ready`||t()===`managed`,r=()=>e.setup.environment.platform===`darwin`,i=()=>qt(t(),r(),!1);var a=dn(),o=a.firstChild,s=o.nextSibling,c=s.nextSibling,l=c.nextSibling,u=l.nextSibling,d=u.nextSibling,f=d.nextSibling,p=f.nextSibling,m=p.nextSibling;return V(o,()=>j(`desktop.hostDesktopOff`)),V(s,()=>j(i().title)),V(c,()=>j(Vn[i().hint]??i().hint)),V(a,(()=>{var e=H(()=>t()===`needs-server`||t()===`ready`);return()=>e()?(()=>{var e=$();return V(e,()=>j(r()?`desktop.screenSharingNetwork`:`desktop.desktopServerNetwork`)),e})():null})(),l),V(a,(()=>{var e=H(()=>t()===`ready`);return()=>e()?(()=>{var e=$();return V(e,()=>j(r()?`desktop.hostScreenSharingAccount`:`desktop.hostDesktopServerAccount`)),e})():null})(),u),V(a,(()=>{var n=H(()=>!!(t()===`unsupported`&&e.setup.environment.desktopSetup?.detail));return()=>n()?(()=>{var t=$();return V(t,()=>e.setup.environment.desktopSetup.detail),t})():null})(),d),V(a,(()=>{var t=H(()=>!!e.setup.error);return()=>t()?(()=>{var t=fn();return V(t,()=>e.setup.error),t})():null})(),f),V(a,(()=>{var t=H(()=>!!n());return()=>t()?[(()=>{var t=pn();return t._$$click=()=>e.setup.onEnable(),V(t,()=>j(e.setup.busy?`systems.desktopSetupEnabling`:`systems.enableDesktopAccess`)),K(()=>!e.setup.canEnable||e.setup.busy,e=>{U(t,`disabled`,e)}),t})(),(()=>{var t=$();return V(t,()=>j(e.setup.canEnable?`systems.desktopSetupApplyHint`:`systems.desktopSetupAdminHint`)),t})()]:null})(),p),V(a,(()=>{var t=H(()=>!(n()&&e.setup.canEnable));return()=>t()?(()=>{var t=mn();return t._$$click=()=>e.setup.onCheckAgain(),V(t,()=>j(e.loading?`desktop.refreshing`:`systems.desktopSetupCheckAgain`)),K(()=>e.loading,e=>{U(t,`disabled`,e)}),t})():null})(),m),a}function en(e){return H(()=>H(()=>!!e.automatic)()?[H(()=>H(()=>!!e.openWindowHref)()?(()=>{var t=_n();return t.firstChild,V(t,G(ut,{get href(){return e.openWindowHref}}),null),t})():e.openWindowHref),H(()=>H(()=>!!e.hostSetup)()?G($t,{get setup(){return e.hostSetup},get loading(){return e.loading}}):(()=>{var t=vn(),n=t.firstChild;return n._$$click=()=>e.onRefresh(),V(n,()=>j(`common.retry`)),t})())]:[(()=>{var t=hn(),n=t.firstChild,r=n.nextSibling.nextSibling,i=r.firstChild,a=i.nextSibling;return V(n,()=>j(e.presentation===`mobile`?`desktop.availableDesktops`:`desktop.pickerTitle`)),r._$$click=()=>e.onRefresh(),V(r,(()=>{var t=H(()=>e.presentation===`mobile`);return()=>t()&&G(N,{name:`refresh`})})(),i),V(r,(()=>{var t=H(()=>!!e.loading);return()=>t()?j(`desktop.refreshing`):j(`desktop.refresh`)})(),a),V(t,(()=>{var t=H(()=>!!e.openWindowHref);return()=>t()?G(ut,{get href(){return e.openWindowHref}}):e.openWindowHref})(),null),K(()=>({e:e.presentation===`desktop`,t:e.presentation===`desktop`?`desktop`:void 0,a:ge(e.presentation===`desktop`?`session-panel-rail__button session-panel-rail__button--labelled`:`desktop-button`),o:e.loading}),({e,t:n,a:i,o:a},o)=>{e!==o?.e&&t.classList.toggle(`session-panel-rail`,e),n!==o?.t&&U(t,`data-presentation`,n),he(r,i,o?.a),a!==o?.o&&U(r,`disabled`,a)}),t})(),(()=>{var t=gn();return V(t,(()=>{var t=H(()=>!!(e.loading&&e.environments.length===0));return()=>t()?H(()=>e.presentation===`desktop`)()?G(Ft,{get heading(){return j(`desktop.loading`)},pending:!0}):G(ye,{variant:`desktop`,get label(){return j(`desktop.loading`)}}):H(()=>e.environments.length===0)()?H(()=>!!(e.presentation&&e.genuineEmpty))()?G(Pe,{get presentation(){return e.presentation},get icon(){return G(N,{name:`monitor`})},get heading(){return j(`desktop.emptyTitle`)},get description(){return j(`desktop.empty`)}}):(()=>{var e=yn();return V(e,()=>j(`desktop.empty`)),e})():G(F,{get each(){return e.environments},keyed:e=>e.id,children:t=>G(tn,{get environment(){return t()},get onConnect(){return e.onConnect},get useLabel(){return e.presentation===`desktop`}})})})()),t})()])}function tn(e){var t=bn(),n=t.firstChild,r=n.firstChild,i=r.nextSibling.firstChild,a=n.nextSibling;return V(r,(()=>{var t=H(()=>!!(e.useLabel&&e.environment.label));return()=>t()?e.environment.label:H(()=>xe(e.environment).kind===`host`)()?j(`desktop.thisMachine`):e.environment.id})()),V(i,()=>e.environment.worker?.state??e.environment.status),V(n,(()=>{var t=H(()=>!!e.environment.worker?.attachedSessionIds.length);return()=>t()?(()=>{var t=xn();return V(t,G(F,{get each(){return e.environment.worker?.attachedSessionIds},keyed:e=>e,children:e=>(()=>{var t=Sn();return V(t,e),t})()})),t})():!!e.environment.worker?.attachedSessionIds.length})(),null),a._$$click=()=>e.onConnect(e.environment.id),V(a,()=>j(`desktop.connect`)),t}function nn(e){return[H(()=>H(()=>e.presentation===`mobile`)()&&(()=>{var t=wn(),n=t.firstChild;return V(t,(()=>{var t=H(()=>!!e.onBack);return()=>t()?G(X,{class:`desktop-toolbar-action`,get label(){return j(`desktop.back`)},get icon(){return G(N,{name:`chevronLeft`})},get onClick(){return e.onBack}}):e.onBack})(),n),V(n,()=>e.machineName),K(()=>e.machineName,e=>{U(n,`title`,e)}),t})()),(()=>{var t=Cn(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=i.firstChild,o=i.nextSibling;return n.addEventListener(`submit`,t=>e.onSubmit(t)),V(n,(()=>{var t=H(()=>e.presentation===`desktop`);return()=>t()&&[G(N,{name:`lock`,class:`desktop-credentials__icon`}),(()=>{var e=Tn();return V(e,()=>j(`desktop.credentialsTitle`)),e})()]})(),r),V(r,()=>j(e.ardAccount?`desktop.accountPrompt`:`desktop.passwordPrompt`)),V(n,(()=>{var t=H(()=>!!e.ardAccount);return()=>t()?(()=>{var t=En(),n=t.firstChild;return V(t,()=>j(`desktop.usernameLabel`),n),K(()=>e.username,e=>{n.value=e??``}),t})():e.ardAccount})(),i),V(i,()=>j(e.ardAccount?`desktop.accountPasswordLabel`:`desktop.passwordLabel`),a),V(o,()=>j(`desktop.connect`)),t})()]}function rn(e){let t,n=I(()=>e.rail!==void 0),r=I(()=>e.rail?.platform===`desktop`);return[H(()=>H(()=>!!n())()?G(dt,R(e,{get options(){return e.rail}})):(()=>{var t=On(),n=t.firstChild,r=n.nextSibling,i=r.nextSibling,a=i.nextSibling,o=a.nextSibling,s=o.nextSibling;return V(t,(()=>{var t=H(()=>!!(e.showApps&&e.desktopApps.length>0));return()=>t()?(()=>{var t=kn();return V(t,G(F,{get each(){return e.desktopApps},keyed:e=>e,children:t=>(()=>{var n=An(),r=n.firstChild,i=r.nextSibling;return n._$$click=()=>e.onLaunch(t()),V(r,G(N,{get name(){return t()===`browser`?`chrome`:`terminal`}})),V(i,()=>j(t()===`browser`?`browser.title`:`terminal.title`)),K(()=>({e:j(t()===`browser`?`browser.title`:`terminal.title`),t:j(t()===`browser`?`browser.title`:`terminal.title`),a:e.launchingApp===t()?`true`:`false`,o:e.launchingApp===t(),i:e.launchingApp===t()}),({e,t,a:i,o:a,i:o},s)=>{e!==s?.e&&U(n,`title`,e),t!==s?.t&&U(n,`aria-label`,t),i!==s?.a&&U(n,`aria-busy`,i),a!==s?.o&&U(n,`disabled`,a),o!==s?.i&&r.classList.toggle(`desktop-app-button__icon--launching`,o)}),n})()})),t})():e.showApps&&e.desktopApps.length>0})(),n),V(t,(()=>{var t=H(()=>!!e.controlling);return()=>t()?(()=>{var t=jn();return t._$$click=()=>e.onControlToggle(),V(t,()=>j(`desktop.control`)),K(()=>({e:j(`desktop.switchToViewOnly`),t:e.state!==`connected`}),({e,t:n},r)=>{e!==r?.e&&U(t,`aria-label`,e),n!==r?.t&&U(t,`disabled`,n)}),t})():H(()=>e.state===`connected`)()&&(()=>{var e=Mn();return V(e,()=>j(`desktop.viewOnly`)),e})()})(),r),V(t,G(mt,R(()=>e.sizing)),i),V(t,()=>e.audioControl,a),V(t,()=>e.pictureInPictureControl,o),V(t,()=>e.presentationControls,s),s._$$click=()=>e.onDisconnect(),V(s,()=>j(`desktop.disconnect`)),K(()=>({e:j(`desktop.disconnect`),t:j(`desktop.disconnect`)}),({e,t},n)=>{e!==n?.e&&U(s,`title`,e),t!==n?.t&&U(s,`aria-label`,t)}),t})()),H(()=>H(()=>!!(r()&&e.rail?.takeoverText&&!e.rail.fullscreen))()?(()=>{var t=Nn();return V(t,()=>e.rail.takeoverText),t})():r()&&e.rail?.takeoverText&&!e.rail.fullscreen),(()=>{var n=Dn(),i=n.firstChild,a=i.nextSibling,o=a.nextSibling,s=o.nextSibling;return q(()=>e=>{t=e},n),V(n,G(sn,{get bind(){return e.surfaceRef}}),i),V(n,(()=>{var t=H(()=>!e.controlling);return()=>t()&&(()=>{var t=Pn();return t._$$click=()=>e.onTakeControl(),K(()=>({e:r()?void 0:j(`desktop.takeControl`),t:j(`desktop.takeControl`),a:e.state!==`connected`}),({e,t:n,a:r},i)=>{e!==i?.e&&U(t,`title`,e),n!==i?.t&&U(t,`aria-label`,n),r!==i?.a&&U(t,`disabled`,r)}),t})()})(),a),V(n,(()=>{var n=H(()=>!!r());return()=>n()?G(It,{stage:()=>t,get active(){return H(()=>e.state===`connected`)()&&!e.controlling},get fullscreen(){return e.rail?.fullscreen??!1}}):r()})(),o),V(n,(()=>{var t=H(()=>e.state===`connecting`);return()=>t()&&(r()?e.rail?.controlTransition?(()=>{var t=Fn(),n=t.firstChild;return V(t,G(N,{name:`loader`}),n),V(n,()=>e.rail.pendingLabel),t})():G(Ft,{get heading(){return e.rail?.pendingLabel??j(`desktop.connecting`)},pending:!0,overlay:!0}):G(ye,{variant:`desktop`,get label(){return j(`desktop.connecting`)},overlay:!0}))})(),s),n})()]}function an(e){return[H(()=>H(()=>!!e.errorText)()?(()=>{var t=In();return V(t,()=>e.errorText),t})():H(()=>!!e.noticeText)()?(()=>{var t=Ln();return V(t,()=>e.noticeText),t})():e.noticeText),H(()=>H(()=>e.availability?.state===`locked`)()?(()=>{var e=Ln();return V(e,()=>j(`desktop.macLocked`)),e})():H(()=>e.availability?.state===`unknown`)()&&(()=>{var e=Ln();return V(e,()=>j(`desktop.macLockStateUnknown`)),e})())]}function on(e){let t=()=>(()=>{var t=Rn(),n=t.firstChild,r=n.nextSibling;return t._$$click=()=>e.onRetry(),V(t,G(N,{name:`refresh`}),n),V(t,()=>j(e.inventoryError?`common.retry`:`desktop.reconnect`),r),t})();return G(z,{get when(){return e.presentation===`desktop`},get fallback(){var t=zn(),n=t.firstChild;return V(t,(()=>{var t=H(()=>!e.inventoryError);return()=>t()&&(()=>{var t=$();return V(t,(()=>{var t=H(()=>!!e.reason);return()=>t()?j(`desktop.disconnected`,{reason:e.reason}):j(`desktop.disconnectedClean`)})()),t})()})(),n),n._$$click=()=>e.onRetry(),V(n,()=>j(e.inventoryError?`common.retry`:`desktop.reconnect`)),t},get children(){return G(Ft,{get heading(){return j(e.inventoryError?`desktop.inventoryError`:e.kind===`error`?`desktop.connectionError`:e.kind===`lost`?`desktop.connectionLost`:`desktop.disconnectedClean`)},get description(){return e.reason},get action(){return t()}})}})}function sn(e){W(()=>{let t=e.bind;return()=>t(void 0)});var t=Bn();return q(()=>t=>e.bind(t),t),t}var cn,ln,un,dn,$,fn,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn,Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn,Fn,In,Ln,Rn,zn,Bn,Vn;function Hn(){return(Hn=e((()=>{J(),B(),Q(),k(),g(),Ne(),Oe(),Te(),Pt(),Ut(),be(),Xt(),cn=Y(`<section><!><!><!>`),ln=Y(`<header class="rail-header bp-header"><div class="rail-header__title bp-title"></div><div class="rail-header__actions bp-actions"><!><!><!><!><!>`),un=Y(`<div class=desktop-content><!><!><!><!><!>`),dn=Y(`<div class=desktop-status role=status><div></div><h2></h2><div></div><!><!><!><!><!><!>`),$=Y(`<div>`),fn=Y(`<div class=desktop-note--error role=alert>`),pn=Y(`<button class="desktop-button desktop-button--primary"type=button>`),mn=Y(`<button class=desktop-button type=button>`),hn=Y(`<div class=desktop-toolbar><span></span><span class=desktop-toolbar__spacer></span><button type=button><!><!>`),gn=Y(`<div class=desktop-picker>`),_n=Y(`<div class="desktop-toolbar session-panel-rail"data-presentation=desktop><span class=desktop-toolbar__spacer>`),vn=Y(`<div class=desktop-status role=status><button class=desktop-button type=button>`),yn=Y(`<div class=desktop-status>`),bn=Y(`<div class=desktop-environment><div class=desktop-environment__details><div class=desktop-environment__id></div><div class=desktop-environment__meta><span></span></div></div><button class="desktop-button desktop-button--primary"type=button>`),xn=Y(`<div class=desktop-environment__sessions>`),Sn=Y(`<span class=desktop-session>`),Cn=Y(`<div class=desktop-status><form class=desktop-credentials><div></div><label class=desktop-credentials__label><input class=desktop-credentials__input name=password type=password autocomplete=off required></label><button class="desktop-button desktop-button--primary"type=submit>`),wn=Y(`<div class="desktop-toolbar desktop-credentials-rail"><span>`),Tn=Y(`<strong class=desktop-credentials__title>`),En=Y(`<label class=desktop-credentials__label><input class=desktop-credentials__input name=username type=text autocomplete=off required>`),Dn=Y(`<div class=desktop-stage><!><!><!><!>`),On=Y(`<div class="desktop-toolbar desktop-toolbar--connection"><span class=desktop-toolbar__spacer></span><!><!><!><!><button class=desktop-toolbar-action type=button>`),kn=Y(`<div class=desktop-apps>`),An=Y(`<button class=desktop-app-button type=button><span class=desktop-app-button__icon aria-hidden=true></span><span>`),jn=Y(`<button class=desktop-toolbar-action type=button>`),Mn=Y(`<span class=desktop-toolbar-mode role=status>`),Nn=Y(`<div class=desktop-takeover role=status>`),Pn=Y(`<button class=desktop-stage__take-control type=button>`),Fn=Y(`<div class=desktop-control-transition role=status><span>`),In=Y(`<div class="desktop-note desktop-note--error"role=alert>`),Ln=Y(`<div class=desktop-note role=status>`),Rn=Y(`<button class=desktop-button type=button><!><!>`),zn=Y(`<div class=desktop-status><button class="desktop-button desktop-button--primary"type=button>`),Bn=Y(`<div class=desktop-surface>`),M(Z),Vn={"systems.desktopSetupEnableHint":`desktop.hostDesktopEnableHint`,"systems.screenSharingSetupHint":`desktop.hostScreenSharingSetupHint`,"systems.desktopServerSetupHint":`desktop.hostDesktopServerSetupHint`},_e([`click`])})))()}function Un(e){var t=Wn();return V(t,G(Qt,R(e,{connection:()=>(()=>{var t=qn(),n=t.firstChild,r=n.nextSibling,i=r.nextSibling,a=i.firstChild,o=a.nextSibling,s=o.firstChild,c=s.nextSibling,l=o.nextSibling,u=l.firstChild,d=u.nextSibling,f=l.nextSibling,p=f.firstChild,m=p.nextSibling;V(t,G(sn,{get bind(){return e.surfaceRef}}),n),V(t,(()=>{var t=H(()=>e.state===`connecting`);return()=>t()&&G(ye,{variant:`desktop`,get label(){return j(`desktop.connecting`)},overlay:!0})})(),r),r._$$input=t=>e.keyboard.handleInput(t),r._$$keyup=t=>e.keyboard.handleKeyboardEvent(t),r._$$keydown=t=>e.keyboard.handleKeyboardEvent(t);var h=e.keyboard.inputRef;return typeof h==`function`||Array.isArray(h)?q(()=>h,r):e.keyboard.inputRef=r,V(i,()=>e.audioControl,a),V(i,()=>e.pictureInPictureControl,o),o._$$click=()=>e.onControlToggle(),V(s,G(N,{get name(){return e.controlling?`hand`:`eye`}})),V(c,()=>j(e.controlling?`desktop.control`:`desktop.viewOnly`)),l._$$click=t=>e.keyboard.focus(t),V(u,G(se,{get children(){return[Gn(),Kn()]}})),V(d,()=>j(`desktop.keyboard`)),V(i,G(mt,R(()=>e.sizing)),f),f._$$click=()=>e.onClose(),V(p,G(N,{name:`arrowLeft`})),V(m,()=>j(`desktop.back`)),K(()=>({e:j(`desktop.keyboardInput`),t:e.state!==`connected`||!e.controlling,a:j(`desktop.touchControls`),o:j(e.controlling?`desktop.switchToViewOnly`:`desktop.takeControl`),i:e.controlling?`true`:`false`,n:e.state!==`connected`,s:j(`desktop.keyboard`),h:e.state!==`connected`||!e.controlling,r:j(`desktop.back`)}),({e,t,a:n,o:a,i:s,n:c,s:u,h:d,r:p},m)=>{e!==m?.e&&U(r,`aria-label`,e),t!==m?.t&&U(r,`disabled`,t),n!==m?.a&&U(i,`aria-label`,n),a!==m?.o&&U(o,`aria-label`,a),s!==m?.i&&U(o,`aria-pressed`,s),c!==m?.n&&U(o,`disabled`,c),u!==m?.s&&U(l,`aria-label`,u),d!==m?.h&&U(l,`disabled`,d),p!==m?.r&&U(f,`aria-label`,p)}),t})()}))),K(()=>j(`desktop.title`),e=>{U(t,`aria-label`,e)}),t}var Wn,Gn,Kn,qn;function Jn(){return(Jn=e((()=>{J(),Q(),k(),g(),Te(),O(),Hn(),Wn=Y(`<section class=desktop-document>`),Gn=Y(`<svg><rect width=20 height=14 x=2 y=5 rx=2></svg>`,2),Kn=Y(`<svg><path d="M6 9h.01M10 9h.01M14 9h.01M18 9h.01M6 13h.01M10 13h.01M14 13h.01M18 13h.01M8 17h8"></svg>`,2),qn=Y(`<div class=desktop-stage><!><textarea class=desktop-keyboard-input inputmode=text autocomplete=off autocapitalize=off spellcheck=false tabindex=-1></textarea><nav class=desktop-touch-toolbar><!><button class=desktop-touch-action type=button><span class=desktop-touch-action__icon aria-hidden=true></span><span class=desktop-touch-action__label></span></button><button class=desktop-touch-action type=button><span class=desktop-touch-action__icon aria-hidden=true></span><span class=desktop-touch-action__label></span></button><button class=desktop-touch-action type=button><span class=desktop-touch-action__icon aria-hidden=true></span><span class=desktop-touch-action__label>`),M(Z),_e([`keydown`,`keyup`,`input`,`click`])})))()}function Yn(e){let t=Xn,n,r=null,i=new Map;W(()=>{let e=l(window,`blur`,()=>i.clear()),t=l(window,`keyup`,a,!0);return()=>{e(),t(),s()}});function a(e){if(!(e instanceof KeyboardEvent)||!e.isTrusted||e.composedPath()[0]===n||!i.has(e.code))return;let t=f();t&&i.delete(e.code)&&t.sendKeyboardEvent(e)}function o(e){let t=f();e&&t&&d(e,t),n?.focus({preventScroll:!0}),n?.setSelectionRange(n.value.length,n.value.length)}function s(e){e||(i.clear(),r=null),t=Xn;let a=e??n;a&&(a.value=Xn)}function c(e){let t=f();t&&(e.type===`keydown`&&d(e,t),!(!e.isComposing&&!e.altKey&&(oe()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&e.key.toLowerCase()===`v`)&&([`Meta`,`Control`,`Shift`,`Alt`].includes(e.key)&&(e.type===`keydown`?i.set(e.code,e):i.delete(e.code)),t.sendKeyboardEvent(e),e.preventDefault()))}function u(e){let n=e.currentTarget,r=f();if(!r){s(n);return}let a=n.value,o=e.inputType===`insertFromPaste`?[...i.values()]:[];for(let e of o)r.sendKeyboardEvent(new KeyboardEvent(`keyup`,e));let c=0;for(let e of t){if(!a.startsWith(e,c))break;c+=e.length}for(let e=Array.from(t.slice(c)).length;e>0;--e)r.sendBackspace();r.sendText(a.slice(c));for(let e of o)r.sendKeyboardEvent(e);a.length<1||a.length>32?s(n):t=a}function d(e,t){if(e.isTrusted)for(let[n,r]of i)e.getModifierState(r.key)||(i.delete(n),t.sendKeyboardEvent(new KeyboardEvent(`keyup`,r)))}function f(){let t=e();return t!==r&&(i.clear(),r=t),t}return{inputRef:e=>{n=e,n.value=t},focus:o,reset:s,handleKeyboardEvent:c,handleInput:u}}var Xn;function Zn(){return(Zn=e((()=>{B(),te(),Xn=`________________`})))()}function Qn(e,t){e.request(`desktop.release`,{wsPath:t}).catch(()=>void 0)}var $n;function er(){return(er=e((()=>{$n=class{constructor(){this.current=null,this.retained=null,this.connected=!1,this.hiddenTimer=null}get handle(){return this.connected?this.current:null}begin(e){this.clearHiddenTimer();let t=e?this.connected?this.current:this.retained:null,n=this.current,r=this.retained;this.current=null,this.retained=t,this.connected=!1;let i=this.abandonObservation;this.abandonObservation=void 0,i?.(),n!==t&&n?.disconnect(),r!==t&&r?.disconnect(),t?.disableInput()}setPresented(e,t){let n=this.hiddenTimer!==null;return this.clearHiddenTimer(),e?(n&&this.current?.setPresented(!0),!n):(this.handle?.setPresented(!1)?this.hiddenTimer=setTimeout(t,3e4):t(),!1)}clearHiddenTimer(){this.hiddenTimer!==null&&(clearTimeout(this.hiddenTimer),this.hiddenTimer=null)}attach(e){this.current=e}retainObservation(e){this.abandonObservation=e}setSizingMode(e){this.current?.setSizingMode(e)}markConnected(){this.abandonObservation=void 0,this.connected=!0;let e=this.retained;this.retained=null,e?.disconnect()}disconnect(){this.begin(!1)}}})))()}function tr(e,t){let n=e.get(`password`);if(typeof n!=`string`||n.length===0)return;let r=e.get(`username`),i=typeof r==`string`?r.trim():``;if(t!==`ard-account`||i)return{...i?{username:i}:{},password:n}}function nr(e,t,n){return e.kind!==`environment`&&n?.password&&(t===`vnc-password`||t===`ard-account`&&n.username)?n:void 0}function rr(e,t){let n=e.preauthenticated?void 0:e.vncPassword?{password:e.vncPassword}:e.auth===`vnc-password`?t:void 0;return e.auth===`vnc-password`&&e.preauthenticated!==!0&&!n?.password?{phase:`credentials`,auth:`vnc-password`,credentials:n}:{phase:`ready`,auth:e.auth===`ard-account`?`ard-account`:void 0,credentials:n}}function ir(e){if(!e||typeof e!=`object`||!(`details`in e))return null;let t=e.details;if(!t||typeof t!=`object`||!(`code`in t)||t.code!==ar)return null;let n=`auth`in t?t.auth:void 0;return n===`vnc-password`||n===`ard-account`?n:null}var ar;function or(){return(or=e((()=>{ar=`DESKTOP_CREDENTIALS_REQUIRED`})))()}function sr(e){return{client:e.client,sessions:e.sessions,available:e.available,suppressed:e.suppressed,documentMode:e.documentMode,requestedSource:e.requestedSource,sessionKey:e.sessionKey,documentControl:e.documentControl,suppliedEnvironments:e.suppliedEnvironments,embedded:e.embedded,presented:e.presented}}function cr(e,t,n){let r,i=()=>{r?.(),h()},a=!1,o,s,c=null,u,d=[],f,p,m=e=>{f=e,e&&(p?.(e),p=void 0)};function h(){if(!a||o)return;let r=()=>{if(o!==r)return;o=void 0;let t=sr(e),i=s;s=t,n.reconcile(t,i);let a=e.available&&e.suppliedEnvironments===null?e.client:null;a!==c&&(u?.(),c=a,u=a?n.subscribeClient(a):void 0)};o=r,t(r)}function g(){a=!1,o=void 0,s=void 0,u?.(),u=void 0,c=null,d.forEach(e=>e()),d=[],n.detach()}return{notify:i,subscribe(e){return r=e,()=>{r=void 0}},surface:()=>f,surfaceRef:m,waitForSurface:()=>new Promise(e=>{p=e}),cancelSurfaceWait(){p?.(void 0),p=void 0},attach(r){t(()=>{let t=n.dockLayout.open;return n.dockLayout.connect(),r&&n.dockLayout.setOpen(t,!1),a=!0,d=[l(window,v,t=>{e.embedded||n.handleToggleRequest(t)})],i(),g})}}}function lr(){return(lr=e((()=>{y()})))()}function ur(e,t){let{host:n,surfaceRef:r,environments:i,currentId:a,phase:o,loading:s,automaticSource:c,hostSetup:l,controlling:u,errorText:d,noticeText:f,disconnectedReason:p,connectionTransition:m,connectionFailure:h,controlTakeoverRecoveryUsed:g,desktopApps:_,sizingMode:v,canResize:y,username:b,ardAccount:x,controls:S,sessionSource:C,dockLayout:w}=e,T=i.find(e=>e.id===a);return{documentMode:n.documentMode,embedded:n.embedded,surfaceRef:r,workspaceControls:n.workspaceControls,machine:a?{name:T?.label||a,host:xe({id:a}).kind===`host`}:null,content:{state:o,loading:s,automaticSource:c,hasTarget:n.sessionKey!==null||n.requestedSource!==null,errorText:d,noticeText:f,takeoverText:g&&(o===`connecting`||o===`connected`)?f:null,transition:m,availability:C.desktopAvailability,picker:{automatic:c&&n.embedded&&n.sessionKey!==null,environments:i,hostSetup:l,onRefresh:t.onRefresh,onConnect:t.onConnect},credentials:{ardAccount:x,username:b,onSubmit:t.onCredentialsSubmit,onBack:t.onBack},recovery:{kind:h,reason:p,onRetry:t.onRetry}},controlling:u,desktopApps:_,launcher:S.launcher,startup:C.startupEnvironment,sizing:{mode:v,canResize:y&&u&&o===`connected`,onChange:t.onSizingChange},mobileKeyboard:S.mobileKeyboard,pictureInPicture:S.pictureInPicture,audio:S.audio,fullscreenMode:S.fullscreenMode,dockLayout:w,onControlToggle:t.onControlToggle,onTakeControl:t.onTakeControl,onLaunch:t.onLaunch,onClose:t.onClose,onDocumentClose:t.onDocumentClose,focusTarget:t.focusTarget,onDisconnect:t.onDisconnect}}function dr(){return(dr=e((()=>{be()})))()}var fr;function pr(){return(pr=e((()=>{T(),f(),be(),fr=class{constructor(e,t,n,r,i,a,o){this.context=e,this.notify=t,this.currentTarget=n,this.onTargetChange=r,this.onInventoryChange=i,this.requestedAvailabilityTarget=a,this.onTargetError=o,this.refreshId=0,this.desktopSource=null,this.availabilitySnapshot=null}subscribe(e){return e.addEventListener(t=>{if(!this.context.isConnected||!this.context.available||e!==this.context.client)return;if(t.event===`node.runnerInventory.changed`){let e=t.payload;o(e)&&typeof e.nodeId==`string`&&e.nodeId.length>0&&(this.availabilityTarget===`node:${e.nodeId}`?this.refreshDesktopAvailability(e.nodeId):this.onInventoryChange());return}if(t.event===`presence`||t.event===`node.pair.resolved`||t.event===`config.changed`){this.onInventoryChange();return}let n=this.context.documentMode&&this.context.sessionKey!==null&&this.context.requestedSource===null&&t.event===`sessions.changed`&&!(o(t.payload)&&t.payload.phase===`message`)?C(t.payload):null;if(n&&s(n.key,this.context.sessionKey)){let e=this.resolveTarget();e&&e.target.then(t=>{e.isCurrent()&&t!==void 0&&(t===null||t!==this.currentTarget())&&this.onTargetChange(t)}).catch(t=>{e.isCurrent()&&this.onTargetError(t)})}})}invalidate(){this.refreshId+=1,this.stopStartup()?.resolve(void 0)}stopStartup(){globalThis.clearInterval(this.startupTimer),this.startupTimer=void 0;let e=this.startup;return this.startup=void 0,this.startupEnvironment&&(this.startupEnvironment=void 0,this.notify()),e}async refreshStartup(){let e=this.startup;if(e&&!e.busy){if(!e.isCurrent())this.stopStartup()?.resolve(void 0);else{e.busy=!0;try{let t=await e.load();if(this.startup!==e)return;!e.isCurrent()||!t?.pendingSource?this.stopStartup()?.resolve(e.isCurrent()?t:void 0):(this.startupEnvironment=t.environments.find(e=>e.id===t.pendingSource),this.notify())}catch(t){this.startup===e&&this.stopStartup()?.reject(t)}finally{e.busy=!1}}}}async waitForStartup(e,t){let n=await e();if(t())return n?.pendingSource?await new Promise((r,i)=>{this.startupEnvironment=n.environments.find(e=>e.id===n.pendingSource),this.notify(),this.startup={load:e,isCurrent:t,resolve:r,reject:i,busy:!1},this.startupTimer=globalThis.setInterval(()=>void this.refreshStartup(),2e3)}):n}loadInventory(e){this.invalidate();let t=this.context.client,n=e.automatic?this.resolveTarget(e.target,e.refresh):{target:Promise.resolve(e.target),isCurrent:()=>!0},r=()=>this.context.isConnected&&this.context.available&&t===this.context.client&&e.isCurrent()&&n?.isCurrent()===!0;return{isCurrent:r,result:t&&n?this.waitForStartup(()=>Ce(t,{target:n.target,isCurrent:r,recoverToPicker:this.context.documentMode&&!this.context.embedded}),r):Promise.resolve(void 0)}}setDesktopSource(e,t){let n=this.context.client,r=this.desktopSource;r&&(r.client!==n||e.kind!==`node`||r.nodeId!==e.nodeId)&&this.clearDesktopSource(),this.desktopSource=n&&e.kind===`node`?{client:n,nodeId:e.nodeId,availability:t}:null}clearDesktopSource(){this.desktopSource=null,this.availabilitySnapshot=null}get desktopAvailability(){let e=this.desktopSource;if(!e||e.client!==this.context.client)return;let t=this.availabilitySnapshot;return t?.client===e.client&&t.nodeId===e.nodeId?t.availability:e.availability}get availabilityTarget(){return this.desktopSource&&this.desktopSource.client!==this.context.client?null:this.requestedAvailabilityTarget()}async refreshDesktopAvailability(e){let{client:t}=this.context;if(!t)return;let n=`node:${e}`,r=()=>this.context.isConnected&&this.context.available&&t===this.context.client&&n===this.availabilityTarget;try{let i=await t.request(`environments.status`,{environmentId:n});if(!r())return;if(i.id!==n)throw Error(`Desktop status returned a different environment`);this.availabilitySnapshot={client:t,nodeId:e,availability:i.desktopAvailability},this.notify()}catch{r()&&this.desktopAvailability&&(this.availabilitySnapshot={client:t,nodeId:e,availability:{state:`unknown`}},this.notify())}}resolveTarget(e,t=!1){let{client:n,sessions:r,sessionKey:i,requestedSource:a,documentMode:o}=this.context;if(!n)return;let s=++this.refreshId,c=()=>s===this.refreshId&&this.context.isConnected&&n===this.context.client&&r===this.context.sessions&&i===this.context.sessionKey&&o===this.context.documentMode&&this.context.available&&a===this.context.requestedSource,l=a??e;if(l===void 0&&o&&i!==null&&!r)throw Error(`Desktop session capability is unavailable`);return{target:l===void 0&&o&&i!==null&&r?r.describe({key:i},{client:n,refresh:t}).then(({session:e})=>Ee(e??void 0)):Promise.resolve(l??(i===null?void 0:null)),isCurrent:c}}}})))()}function mr(e,t){let n=()=>M.notify(),r=!1,o,s=[],c=!1,l=`picker`,u=null,d=null,f=!1,m=null,h=null,g=null,_=`connecting`,v=null,y=[],b=`fit`,x=!1,S=new $n,C,w,T=null,E=0,te=()=>void I(void 0,void 0,!0),D=Yt(e,n,te),ne=!1,O=`pending`,k=()=>O===`pending`||O===`resolved`,re=()=>k()&&e.embedded&&e.sessionKey!==null,A=new fr(e,n,()=>u,e=>{k()&&(P(`pending`),I(void 0,e))},()=>{(l===`picker`||l===`inventory-error`&&k())&&!e.suppressed&&(e.embedded?e.presented:e.documentMode||j.open)&&I()},()=>l===`picker`&&!c||l===`inventory-error`?null:u??(k()?e.requestedSource:null),e=>{k()&&(l===`picker`||l===`inventory-error`)&&(A.invalidate(),E+=1,c=!1,m=p(`desktop.errors.listFailed`,{error:i(e)}),l=`inventory-error`,n())}),ie=()=>f?S.handle:null,j=ae({layout:ee,reservationPrefix:`desktop`,isAvailable:()=>e.available,isFullscreen:()=>o?.fullscreenMode.ownsFullscreen()??!1,isEmbedded:()=>e.embedded,notify:n}),M=cr(e,t,{dockLayout:j,reconcile:ce,subscribeClient:e=>A.subscribe(e),handleToggleRequest:e=>le(e),detach:se}),oe=()=>({connected:l===`connected`,reconnect:()=>void L(u,f)});function se(){r=!1,e.documentMode&&k()?P(`pending`):F(),A.clearDesktopSource(),C=void 0,j.dispose()}function ce(t,r){if(t.suppressed!==r?.suppressed){let t=j.setSuppressed(e.suppressed);e.suppressed?P():t&&I()}let i=t.client!==r?.client||t.available!==r?.available,a=i||t.sessions!==r?.sessions||t.embedded!==r?.embedded||t.documentMode!==r?.documentMode||t.sessionKey!==r?.sessionKey||t.documentControl!==r?.documentControl||t.requestedSource!==r?.requestedSource&&(!e.embedded||e.suppliedEnvironments!==null||k());if((e.documentMode||e.embedded)&&a?(P(`pending`),e.available&&(!e.embedded||e.presented&&e.refreshOnPresentation)&&I()):e.embedded&&t.presented!==r?.presented&&l!==`disconnected`?(o.pictureInPicture.close(),o.mobileKeyboard.reset(),e.presented||o.audio.retire(),S.setPresented(e.presented,()=>P(`pending`))&&e.refreshOnPresentation&&I()):i&&(!e.available&&j.open?(j.hideWithoutPersisting(),P()):e.available&&j.restoreOpenState()&&I()),t.suppliedEnvironments!==r?.suppliedEnvironments&&e.suppliedEnvironments!==null){s=[...e.suppliedEnvironments],n();let t=s.find(e=>e.id===u);d&&A.setDesktopSource(d,t?.desktopAvailability)}!r&&!e.documentMode&&!e.embedded&&j.open&&I(),j.syncReservation(),e.onFocusTargetChange?.({kind:`desktop`,control:f,...O===`picker`?{}:O===`explicit`||e.sessionKey===null?{source:u}:{session:e.sessionKey}})}let le=t=>{if(e.documentMode||e.suppressed||e.embedded&&!e.presented)return;let n=t instanceof CustomEvent&&typeof t.detail==`object`&&t.detail!==null?t.detail:null;if(!e.embedded&&(n?.dock===`right`||n?.dock===`bottom`)&&j.setDock(n.dock,!1),n?.open===!1){N();return}if(!e.available||e.embedded&&!e.client)return;let r=e.embedded||j.open;e.embedded||j.setOpen(!0);let i=n?.environmentId??(n?.open===!0?u:null);i?ue(i,!!n?.environmentId):e.embedded?(P(e.sessionKey===null?`picker`:`pending`),I()):r?n?.open!==!0&&N():I()};function N(){P(),e.embedded||j.setOpen(!1)}function P(e=`picker`){F(),l=`picker`,O=e,u=null,d=null,C=void 0,w=void 0,y=[],f=!1,b=`fit`,x=!1,g=null,D.clear(),n(),A.clearDesktopSource()}function F(e=!1){r&&(o.audio.close(),o.pictureInPicture.close(),o.mobileKeyboard.reset()),E+=1,M.cancelSurfaceWait(),T=null,S.begin(e),e||(A.invalidate(),c=!1,r&&o.launcher.clear())}async function I(t,r,a=!1){if(!e.client||!e.available||e.embedded&&!e.presented)return!1;let o=t??++E;c=!0,m=null,n();let u=!1,d;if(e.suppliedEnvironments!==null){s=[...e.suppliedEnvironments],c=!1,n();let t=s.find(t=>t.id===e.requestedSource&&t.desktop);return t&&O===`pending`&&(O=`resolved`,await L(t.id,!1)),!0}let f=A.loadInventory({automatic:O===`pending`,target:r,refresh:a,isCurrent:()=>o===E&&(!e.embedded||e.presented)});try{let e=await f.result;e&&f.isCurrent()&&(d=e.selectedSource,D.set(re()?e.hostSetup??null:null),s=e.environments,n(),u=!0)}catch(t){f.isCurrent()&&(m=p(`desktop.errors.listFailed`,{error:i(t)}),(e.requestedSource!==null||e.sessionKey!==null)&&(l=`inventory-error`))}finally{f.isCurrent()&&(c=!1,n())}return u&&f.isCurrent()&&O===`pending`&&(d===void 0?(e.requestedSource!==null||e.sessionKey!==null)&&(h=D.view()?null:p(`desktop.sourceUnavailable`),n()):(O=`resolved`,n(),await L(d,e.documentControl))),u}async function ue(e,t=!0){if(e===u&&(l===`connecting`||l===`connected`||l===`credentials`)){t&&(O=`explicit`,n());return}P(t?`explicit`:O),u=e,l=`connecting`;let r=E,i=await I(r,e);r===E&&(i?L(e,!1):(l=`inventory-error`,n()))}async function L(t,r,i=!1){let a=e.client;if(!t||!a||!e.available||e.embedded&&!e.presented)return;_=l===`connected`&&u===t&&f!==r?r?`taking-control`:`switching-to-viewing`:`connecting`,v=null,u!==t&&(C=void 0,w=void 0,b=`fit`),x=!1,D.clear();let o=s.find(e=>e.id===t);y=[...o?.worker?.desktopApps??[]],F(u===t);let c=E,p=xe(o??{id:t});u=t,d=p,A.setDesktopSource(p,o?.desktopAvailability),f=r,l=`connecting`,m=null,g=null,i||(h=null),ne=i,n();try{let e=nr(p,w,C),i=await a.request(`desktop.observe`,{source:p,control:r,...e?{credentials:e}:{}}),o=()=>Qn(a,i.wsPath);if(c!==E){o();return}f=i.control,x=i.canResize===!0,n(),(!x||!f)&&b===`match`&&(b=`fit`);let s=rr(i,C);if(s.phase===`credentials`&&S.disconnect(),S.retainObservation(o),w=s.auth??w,s.phase===`credentials`){T={environmentId:t,control:r,observed:i,operationId:c},l=`credentials`,n();return}await R({environmentId:t,control:r,observed:i,operationId:c},s.credentials)}catch(e){let i=ir(e);if(i&&c===E){S.disconnect(),w=i,T={environmentId:t,control:r,operationId:c},l=`credentials`,n();return}z(c,e)}}async function R(t,r){let i=e.client;if(i&&t.operationId===E){l=`connecting`,n();try{let s=M.surface()??await M.waitForSurface();if(t.operationId!==E)return;if(!s)throw Error(`Desktop render target is unavailable`);o.audio.connect(t.observed,i.gatewayUrl);let c=await e.desktopClientFactory().connect({background:`var(--bg)`,isCurrent:()=>t.operationId===E,wsUrl:t.observed.wsPath,gatewayUrl:i.gatewayUrl,credentials:r,viewOnly:!t.observed.control,canResize:t.observed.canResize,sizingMode:b,target:s,onConnect:()=>{t.operationId===E&&(S.setSizingMode(b),S.markConnected(),l=`connected`,n())},onDisconnect:e=>{t.operationId===E&&fe(t.environmentId,e)},onSecurityFailure:e=>{if(t.operationId===E){let r=a(e.reason,p(`desktop.unknownReason`));m=p(`desktop.errors.securityFailed`,{reason:r}),n(),z(t.operationId,Error(r))}}});if(t.operationId!==E){c.disconnect();return}S.attach(c),S.setSizingMode(b)}catch(e){z(t.operationId,e)}}}function z(e,t){e===E&&(F(),v=`error`,l=`disconnected`,g=i(t),n())}function de(e){e.preventDefault();let t=T;if(!t||t.operationId!==E)return;let n=tr(new FormData(e.currentTarget),w);n&&(C=n,T=null,t.observed?R({...t,observed:t.observed},n):L(t.environmentId,t.control))}function fe(t,{code:r,reason:i,clean:o}){if(F(),r===1008&&w===`ard-account`&&t!==null)C=C?.username?{username:C.username}:void 0,T={environmentId:t,control:f,operationId:E},l=`credentials`,m=p(`desktop.errors.securityFailed`,{reason:a(i,p(`desktop.unknownReason`))}),n();else if(r===4e3&&(i===`control-taken`||i?.startsWith(`control-taken:`))&&f&&t!==null&&(!e.embedded||e.presented)&&!ne){let e=a(i.slice(14));h=e?p(`desktop.controlTakenBy`,{operator:e}):p(`desktop.controlTaken`),n(),L(t,!1,!0)}else v=o?`closed`:`lost`,l=`disconnected`,g=a(i,r?p(`desktop.closeCode`,{code:String(r)}):``)||(o?null:p(`desktop.errors.connectionFailed`)),n()}return{notify:n,subscribe:M.subscribe,attach(e,t){o=e,r=!0,M.attach(t)},inputsChanged:n,surface:M.surface,launchTarget:()=>({client:e.client,source:d,presented:!e.embedded||e.presented,state:l,apps:y}),get view(){return ur({host:e,surfaceRef:M.surfaceRef,environments:s,currentId:u,phase:l,loading:c,automaticSource:k(),hostSetup:D.view(),controlling:f,errorText:m,noticeText:h,disconnectedReason:g,connectionTransition:_,connectionFailure:v,controlTakeoverRecoveryUsed:ne,desktopApps:y,sizingMode:b,canResize:x,username:C?.username??``,ardAccount:w===`ard-account`,controls:o,sessionSource:A,dockLayout:j},{onRefresh:te,onConnect:e=>{O=`explicit`,n(),L(e,!1)},onCredentialsSubmit:de,onBack:O===`explicit`?()=>P():void 0,onRetry:()=>{l===`inventory-error`&&e.documentMode||!u?(O=O===`picker`?`picker`:`pending`,l=`picker`,n(),I(void 0,void 0,!0)):l===`inventory-error`&&u?ue(u):L(u,f)},onSizingChange:e=>{b=e,n(),S.setSizingMode(e)},onControlToggle:()=>void L(u,!f),onTakeControl:()=>void L(u,!0),onLaunch:e=>o.launcher.launch(e),onClose:N,onDocumentClose:()=>e.onDocumentClose?.(),focusTarget:()=>({basePath:e.basePath,source:u,control:f,workspaceControls:e.workspaceControls}),onDisconnect:()=>{e.embedded&&(e.sessionKey!==null||e.suppliedEnvironments!==null)?fe(u,{clean:!0}):P()}})},audioTarget:oe,keyboardTarget:ie,dockLayout:j,handleToggleRequest:le}}function hr(){return(hr=e((()=>{m(),Q(),r(),h(),ct(),er(),or(),S(),lr(),dr(),pr(),be(),Xt(),Z()})))()}function gr(e,t){let[n,r]=P(!1),[i,a]=P(),[o,s]=L(!1),c=null,u,d=null,f=()=>e.ownerDocument.defaultView,m=()=>f()?.isSecureContext===!0&&typeof f()?.documentPictureInPicture?.requestWindow==`function`,h=()=>{d?.(),d=null;let e=c;c=null,e?.close()};W(()=>()=>{u=void 0,h()});let g=()=>{u&&(u.cancelled=!0),h(),r(!1),a(void 0)},_=ve(function*(){if(c){g();return}let n=f(),i=n?.documentPictureInPicture,a=t();if(u||!n?.isSecureContext||!i||!a||!e.isConnected)return;let o={cancelled:!1};u=o,s(!0);let l=null;try{if(l=yield i.requestWindow({width:640,height:400}),l.closed||u!==o||o.cancelled||!e.isConnected||t()!==a){l.close();return}c=l,v(l,a)}catch{if(l?.close(),u===o&&!o.cancelled)throw h(),Error(p(`desktop.errors.pictureInPictureFailed`))}finally{u===o&&(u=void 0,r(c!==null))}}),v=(n,r)=>{let i=n.document;i.title=p(`desktop.pictureInPictureTitle`),i.documentElement.lang=e.ownerDocument.documentElement.lang;let o=i.createElement(`canvas`);o.setAttribute(`role`,`img`),o.setAttribute(`aria-label`,p(`desktop.pictureInPictureTitle`)),o.style.cssText=`display:block;width:100%;height:100%;object-fit:contain;pointer-events:none`,i.body.style.cssText=`margin:0;height:100vh;background:var(--bg);color:var(--text);overflow:hidden`,i.body.replaceChildren(o);let s=o.getContext(`2d`);if(!s)throw Error(`Picture-in-Picture canvas is unavailable`);let u=e.ownerDocument.documentElement,f=()=>{let e=getComputedStyle(u);i.documentElement.style.setProperty(`--bg`,e.getPropertyValue(`--bg`)),i.documentElement.style.setProperty(`--text`,e.getPropertyValue(`--text`)),i.documentElement.style.colorScheme=e.colorScheme};f();let m=new MutationObserver(f);m.observe(u,{attributes:!0,attributeFilter:[`data-theme`,`data-theme-mode`,`style`]});let h=0,_=-1/0,v=l(n,`pagehide`,()=>{c===n&&g()},{once:!0});d=()=>{m.disconnect(),n.cancelAnimationFrame(h),v(),o.remove()};let y=e=>{if(c===n){if(n.closed||t()!==r||!r.isConnected)g();else try{if(e-_>=1e3/30&&r.width>0&&r.height>0){let t=Math.min(1,n.innerWidth*n.devicePixelRatio/r.width,n.innerHeight*n.devicePixelRatio/r.height),i=Math.max(1,Math.round(r.width*t)),a=Math.max(1,Math.round(r.height*t));(o.width!==i||o.height!==a)&&(o.width=i,o.height=a),s.drawImage(r,0,0,i,a),_=e}h=n.requestAnimationFrame(y)}catch{g();let e=Promise.reject(Error(p(`desktop.errors.pictureInPictureFailed`)));a({result:e}),e.catch(()=>{})}}};h=n.requestAnimationFrame(y)};return{feedback:()=>o()?{pending:!0}:{active:n()},outcome:i,supported:m,close:g,toggle(){if(u)return;let e=_();return a({result:e}),e.catch(()=>{}),e}}}function _r(){return(_r=e((()=>{B(),m(),Q(),Z()})))()}var vr;function yr(){return(yr=e((()=>{vr=`openclaw-desktop-panel{& .desktop-apps{align-items:center;gap:3px;min-width:0;display:flex}& .desktop-app-button,& .desktop-toolbar-action,& .desktop-toolbar-mode{color:var(--muted);font:inherit;white-space:nowrap;background:0 0;border:0;border-radius:4px;align-items:center;gap:5px;padding:5px 7px;font-size:12px;display:inline-flex}& .desktop-app-button{color:var(--text)}@media (hover:hover){& .desktop-app-button:hover:not(:disabled),& .desktop-toolbar-action:hover:not(:disabled){background:color-mix(in srgb, var(--text) 8%, transparent);color:var(--text)}}& .desktop-app-button:focus-visible,& .desktop-toolbar-action:focus-visible{outline:2px solid var(--focus,var(--accent));outline-offset:1px}& .desktop-app-button:disabled,& .desktop-toolbar-action:disabled{cursor:default;opacity:.55}& .desktop-app-button__icon{width:15px;height:15px;display:inline-flex}& .desktop-app-button__icon svg{stroke-width:1.75px;width:100%;height:100%}& .desktop-app-button__icon--launching{animation:.9s linear infinite desktop-app-launch}@media (prefers-reduced-motion:reduce){& .desktop-app-button__icon--launching{animation:none}}& .bp--embedded{width:100%;height:100%;position:relative}& .bp--bottom{left:var(--shell-nav-width,0);right:calc(var(--oc-terminal-reserve-right,0px) + var(--oc-browser-reserve-right,0px));bottom:calc(var(--oc-terminal-reserve-bottom,0px) + var(--oc-browser-reserve-bottom,0px))}& .bp--right{top:var(--shell-topbar-height,0);right:calc(var(--oc-terminal-reserve-right,0px) + var(--oc-browser-reserve-right,0px));bottom:calc(var(--oc-terminal-reserve-bottom,0px) + var(--oc-browser-reserve-bottom,0px))}& .bp-title{min-width:0}& .bp-icon[aria-disabled=true]{opacity:.4}& .desktop-toolbar-action>svg{width:15px;height:15px}& a.desktop-open-window{cursor:pointer;text-decoration:none}& .desktop-audio-button{align-items:center;gap:5px;display:inline-flex}& .desktop-audio-button>svg{flex-shrink:0;width:18px;height:18px}& .desktop-audio-button:disabled,& .desktop-audio-button[aria-disabled=true]{opacity:.5}& .desktop-touch-toolbar .desktop-audio-label{display:none}& .desktop-fullscreen-icon>svg{width:15px;height:15px}& .bp:fullscreen{border:0;width:100%;height:100%;inset:0}& .desktop-content{flex-direction:column;flex:1;min-height:0;display:flex}& .desktop-toolbar:not([data-presentation=desktop]){border-bottom:1px solid var(--border);align-items:center;gap:8px;padding:8px 10px;display:flex}& .desktop-toolbar--connection{flex-wrap:wrap;gap:12px;min-height:42px}& .desktop-toolbar__spacer{flex:1}& .desktop-sizing{border:1px solid var(--border);background:var(--bg);width:88px;height:32px;color:var(--text);font:inherit;border-radius:6px;flex:none;padding:0 6px;font-size:12px}& .desktop-touch-toolbar .desktop-sizing{height:44px}& .desktop-sizing-menu__trigger{height:28px;padding:0 7px}& .desktop-sizing-menu__value{white-space:nowrap;align-items:center;gap:5px;display:inline-flex}& .desktop-sizing-menu__value>svg{stroke-width:2px;width:12px;height:12px}& .desktop-sizing-menu__icon{display:none}& .desktop-presentation--desktop .desktop-content{container-type:inline-size}& .desktop-rail__identity{flex:1;align-items:center;gap:8px;min-width:0;font-size:13px;display:flex}& .desktop-rail__dot{background:var(--muted);border-radius:50%;flex-shrink:0;width:6px;height:6px}& .desktop-rail__dot.is-connected{background:var(--ok)}& .desktop-rail__dot.is-disconnected{background:var(--danger)}& .desktop-rail__machine{flex-direction:column;gap:2px;min-width:0;display:flex}& .desktop-rail__name{white-space:nowrap;overflow:hidden}& .desktop-rail__name.is-overflowing{mask-image:linear-gradient(90deg,#000 calc(100% - 18px),#0000)}& .desktop-rail__host{color:var(--muted);font-size:10px}& .desktop-connection-rail[data-presentation=desktop] .desktop-rail__machine{flex-flow:wrap;align-items:baseline;gap:0 8px}& .desktop-connection-rail[data-presentation=desktop] .desktop-rail__name{min-width:0;max-width:100%;color:var(--text);font-weight:500}& .desktop-connection-rail[data-presentation=desktop] .desktop-rail__host{flex:none;line-height:12px}& .desktop-rail__actions,& .desktop-rail__window,& .desktop-rail__pill{align-items:center;display:flex}& .desktop-rail__actions{gap:var(--session-rail-group-gap,8px);flex-shrink:0}& .desktop-rail__pill{box-sizing:border-box;height:var(--session-rail-control,33px);gap:var(--session-rail-gap,2px);padding:var(--session-rail-inset,2.5px);box-shadow:inset 0 0 0 1px var(--border);border-radius:var(--radius-full);background:var(--session-rail-pill,var(--bg-hover))}& .desktop-rail__pill>:not(:first-child){border-left:1px solid var(--session-rail-separator,var(--border-strong))}& .desktop-connection-rail .desktop-toolbar-action{height:var(--session-rail-target,28px);min-width:var(--session-rail-target,28px);border-radius:var(--radius-full);justify-content:center;padding:0 6px}& .desktop-connection-rail .desktop-toolbar-action>svg,& .desktop-rail__more svg{width:var(--session-rail-icon,18px);height:var(--session-rail-icon,18px);stroke-width:2px}& .desktop-rail__tools .desktop-audio-label,& .desktop-rail__actions .desktop-rail__action-label{display:none}& .desktop-rail__window{gap:var(--session-rail-gap,2px)}& .desktop-rail__window-group{display:flex}& .desktop-rail__window>:not(:first-child){border-left:1px solid var(--session-rail-separator,var(--border-strong))}& .desktop-connection-rail[data-presentation=desktop] .desktop-toolbar-action,& .desktop-connection-rail[data-presentation=desktop] .desktop-sizing-menu__value{gap:var(--session-rail-label-gap)}& .desktop-connection-rail[data-presentation=desktop] .desktop-rail__more>.oc-menu-item__label{align-items:center;display:inline-flex}@media (hover:hover){& .desktop-connection-rail[data-presentation=desktop] .desktop-toolbar-action:hover:not(:disabled){background:var(--session-rail-hover,var(--bg-hover))}}& .desktop-connection-rail[data-presentation=desktop] .desktop-sizing-menu__value>svg{width:var(--session-rail-icon,18px);height:var(--session-rail-icon,18px)}& .desktop-connection-rail[data-presentation=desktop] .desktop-rail__cursor{transform:translate(.5px,.5px)}& .desktop-rail__overflow-tools,& .desktop-rail__overflow-window{display:none}& .desktop-rail__menu .desktop-toolbar-action{justify-content:flex-start;width:100%;min-height:32px}& .desktop-rail__menu .desktop-rail__action-label{display:inline}& .desktop-rail__menu .desktop-sizing-menu__trigger{width:100%}& .desktop-rail__menu .desktop-sizing-menu__icon{width:18px;height:18px;display:block}& .desktop-rail__menu:not(.desktop-rail__menu--desktop){& .oc-menu-item{gap:5px;padding-inline:4px}& .oc-menu-item__icon{margin-inline-end:0}& .oc-menu-item__icon>svg{width:18px;height:18px}}& .desktop-rail__menu--desktop{border-radius:22px;width:330px;padding:8px}& .desktop-rail__menu--desktop .oc-menu-item,& .desktop-rail__menu--desktop .desktop-toolbar-action{min-height:36px;color:var(--text);white-space:normal;border-radius:10px;gap:10px;padding:8px 10px;font-size:13px;line-height:18px}& .desktop-rail__menu--desktop svg{width:16px;height:16px;color:var(--muted);flex:none}& .desktop-rail__menu--desktop .oc-menu-item__icon{margin-inline-end:0}& .desktop-rail__menu--desktop .desktop-rail__menu-section,& .desktop-rail__menu--desktop .desktop-rail__overflow-window{border-top:1px solid var(--border);margin-top:6px;padding-top:6px}& .desktop-rail__menu--desktop .desktop-rail__disconnect{border-top:1px solid var(--border);margin-top:6px}& .desktop-presentation--desktop .desktop-content:has(>.desktop-connection-rail)>.desktop-note{order:1}& .desktop-presentation--desktop .desktop-stage{order:2}& .desktop-presentation--fullscreen .bp-header{display:none}& .desktop-presentation--fullscreen .desktop-connection-rail{border-top:1px solid var(--border);border-bottom:0;flex-basis:65px;order:3;justify-content:center;height:65px;position:relative}& .desktop-presentation--fullscreen .desktop-rail__identity{max-width:calc(50% - 225px);position:absolute;left:12px}@container (width<=900px){& .desktop-presentation--fullscreen .desktop-rail__identity{max-width:calc(100% - 24px);bottom:calc(100% + 8px)}}@container (width<=560px){& .desktop-rail__tools{display:none}& .desktop-rail__overflow-tools{display:block}}@container (width<420px){& .desktop-rail__window,& .desktop-rail__window-group:not(:has(.desktop-open-window)){display:none}& .desktop-rail__window-group>.desktop-open-window{border-left:0}& .desktop-rail__overflow-window{display:block}}& .desktop-button{border:1px solid var(--border);color:var(--text);font:inherit;background:0 0;border-radius:6px;padding:5px 10px;font-size:12px}& .desktop-presentation--desktop .desktop-picker:has(>openclaw-panel-empty-state),& .desktop-presentation--mobile .desktop-picker:has(>openclaw-panel-empty-state){padding:0}& .desktop-status-surface{text-align:center;min-height:0;color:var(--muted);flex-direction:column;flex:1;justify-content:center;align-items:center;padding:24px;display:flex;overflow:auto}& .desktop-status-surface>strong{color:var(--text);font-size:14px;font-weight:500}& .desktop-presentation--desktop .desktop-content>.desktop-status-surface{order:2}& .desktop-status-surface>p{overflow-wrap:anywhere;max-width:360px;margin:6px 0 0;font-size:13px;line-height:1.5}& .desktop-status-surface__icon{margin-bottom:16px;display:flex;position:relative}& .desktop-status-surface__icon>svg{stroke-width:1.5px;width:36px;height:36px}& .desktop-status-surface__icon>.desktop-status-surface__spinner{background:var(--bg);border-radius:50%;width:15px;height:15px;padding:2px;animation:1s linear infinite desktop-status-spin;position:absolute;bottom:-4px;right:-5px}& .desktop-status-surface__action{margin-top:20px}& .desktop-status-surface__action .desktop-button{align-items:center;gap:6px;padding:6px 10px;font-size:13px;display:inline-flex}& .desktop-status-surface__action svg{width:14px;height:14px}& .desktop-status-surface--anchored{justify-content:flex-start;align-items:stretch;padding:0}& .desktop-status-surface--anchored .empty-state__title{font-size:calc(14px * var(--control-ui-text-scale,1))}& .desktop-status-surface--anchored .empty-state__description{max-width:360px;margin-top:6px}& .desktop-status-surface--anchored .empty-state__description:empty{display:none}& .desktop-status-surface--anchored .desktop-status-surface__icon{width:36px;height:36px;margin-bottom:16px}& .desktop-status-surface--anchored [slot=action]{margin-top:20px}& .desktop-status-surface--anchored .desktop-button{border-radius:var(--radius-full);background:var(--bg-hover);border:0;align-items:center;gap:6px;padding:6px 10px;font-size:13px;display:inline-flex}& .desktop-status-surface--anchored .desktop-button>svg{width:14px;height:14px}& .desktop-status-surface--overlay{z-index:2;background:color-mix(in srgb, var(--bg) 75%, transparent);pointer-events:none;position:absolute;inset:0}& .desktop-control-transition{z-index:2;background:var(--overlay-palette-backdrop);color:var(--text);pointer-events:none;flex-direction:column;justify-content:center;align-items:center;gap:8px;font-size:13px;display:flex;position:absolute;inset:0}& .desktop-control-transition>svg{width:16px;height:16px;animation:1s linear infinite desktop-status-spin}@media (prefers-reduced-motion:reduce){& .desktop-control-transition>svg{animation:none}}& .desktop-presentation--desktop:not(.desktop-presentation--fullscreen) .desktop-surface,& .desktop-presentation--desktop:not(.desktop-presentation--fullscreen) .desktop-stage__take-control{top:28px}& .desktop-viewer-hint{z-index:3;color:var(--muted);pointer-events:none;opacity:0;font-size:11px;line-height:16px;position:absolute;top:6px;left:12px}& .desktop-viewer-hint[data-fullscreen=false]{left:auto;right:12px}& .desktop-viewer-hint[data-active=true][data-fullscreen=true][data-positioned=true]{opacity:1}@media (hover:hover){& .desktop-stage:hover .desktop-viewer-hint[data-active=true][data-fullscreen=false]{opacity:1}}& .desktop-viewer-hint[data-fullscreen=true]{border:1px solid var(--border);background:var(--bg);color:var(--text);box-shadow:var(--overlay-shadow);border-radius:6px;padding:7px 10px;font-size:13px}& .desktop-takeover{background:color-mix(in srgb, var(--warn) 12%, var(--bg));color:var(--warn);order:1;padding:9px 12px;font-size:12px;line-height:18px}& .desktop-takeover--fullscreen{border-radius:6px;max-width:calc(50% - 225px);position:absolute;right:12px}@container (width<=900px){& .desktop-takeover--fullscreen{max-width:calc(100% - 24px);bottom:calc(100% + 8px)}& .desktop-presentation--fullscreen .desktop-connection-rail:has(.desktop-takeover) .desktop-rail__identity{bottom:calc(100% + 52px)}}& .desktop-presentation--desktop .desktop-credentials{gap:16px;width:min(360px,100%)}& .desktop-presentation--desktop .desktop-status:has(.desktop-credentials){padding:24px}& .desktop-credentials__title{color:var(--text);font-size:18px;line-height:24px}& .desktop-credentials__icon{width:24px;height:24px}& .desktop-presentation--desktop .desktop-credentials__input{box-sizing:border-box;min-height:40px}& .desktop-presentation--desktop .desktop-credentials>button{border-color:var(--border);background:var(--bg-hover);min-height:40px;color:var(--text)}& .desktop-credentials-rail>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}& .desktop-presentation--mobile .desktop-toolbar{box-sizing:border-box;gap:4px;min-height:40px;padding:0 8px;font-size:14px}& .desktop-presentation--mobile .desktop-toolbar button{border:0;align-items:center;gap:4px;min-height:32px;display:inline-flex}& .desktop-presentation--mobile .desktop-toolbar svg{width:16px;height:16px}& .desktop-connection-rail--mobile{box-sizing:border-box;border-bottom:1px solid var(--border);flex:0 0 40px;align-items:center;gap:6px;height:40px;padding:0 8px;display:flex}& .desktop-connection-rail--mobile .desktop-rail__actions{gap:4px}& .desktop-connection-rail--mobile .desktop-rail__pill{height:32px;box-shadow:none;background:0 0;border-radius:8px;padding:0}& .desktop-connection-rail--mobile .desktop-rail__pill>:not(:first-child){border-left-color:var(--border)}& .desktop-connection-rail--mobile .desktop-toolbar-action{border-radius:4px;min-width:0;height:32px;padding:0 4px}& .desktop-connection-rail--mobile .desktop-rail__tools{display:flex}& .desktop-connection-rail--mobile .desktop-rail__window{display:none}& .desktop-connection-rail--mobile .desktop-rail__overflow-tools,& .desktop-connection-rail--mobile .desktop-rail__overflow-window{display:block}@media (prefers-reduced-motion:reduce){& .desktop-status-surface__icon>.desktop-status-surface__spinner{animation:none}}@media (hover:hover){& .desktop-button:hover:not(:disabled){background:color-mix(in srgb, var(--text) 10%, transparent)}}& .desktop-button--primary{border-color:var(--accent);color:var(--accent)}& .desktop-button:disabled,& .desktop-touch-action:disabled{opacity:.5}& .desktop-session{max-width:100%;color:var(--muted);text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;overflow:hidden}& .desktop-note{border-bottom:1px solid var(--border);color:var(--muted);padding:7px 12px;font-size:12px}& .desktop-note--error{color:var(--danger)}& .desktop-picker,& .desktop-status{background:var(--panel);flex-direction:column;flex:1;gap:10px;min-height:0;padding:14px;display:flex;overflow:auto}& .desktop-status{text-align:center;color:var(--muted);justify-content:center;align-items:center}& .desktop-credentials{text-align:left;flex-direction:column;gap:10px;width:min(320px,100%);display:flex}& .desktop-credentials__label{color:var(--text);flex-direction:column;gap:5px;font-size:12px;display:flex}& .desktop-credentials__input{border:1px solid var(--border);background:var(--bg);color:var(--text);font:inherit;border-radius:6px;padding:7px 9px}& .desktop-environment{border:1px solid var(--border);border-radius:8px;align-items:center;gap:10px;padding:10px;display:flex}& .desktop-environment__details{flex-direction:column;flex:1;gap:5px;min-width:0;display:flex}& .desktop-environment__id{color:var(--text);text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;overflow:hidden}& .desktop-environment__meta,& .desktop-environment__sessions{color:var(--muted);flex-wrap:wrap;align-items:center;gap:5px;font-size:11px;display:flex}& .desktop-stage{background:var(--bg);flex:1;min-height:0;position:relative;overflow:hidden}& .desktop-surface{background:var(--bg);position:absolute;inset:0}& .desktop-stage__take-control{cursor:var(--cursor-action,pointer);background:0 0;border:0;padding:0;position:absolute;inset:0}& .desktop-stage__take-control:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}& .desktop-document{box-sizing:border-box;background:var(--bg);display:flex;position:fixed;inset:0;overflow:hidden}& .desktop-document .desktop-content,& .desktop-document .desktop-stage{width:100%}& .desktop-touch-toolbar{z-index:3;right:12px;bottom:max(12px, env(safe-area-inset-bottom));box-sizing:border-box;border:1px solid color-mix(in srgb, var(--text) 16%, transparent);background:color-mix(in srgb, var(--bg) 84%, transparent);width:max-content;max-width:calc(100% - 24px);box-shadow:var(--overlay-shadow);backdrop-filter:blur(16px);border-radius:14px;flex-wrap:wrap;justify-content:center;align-items:center;gap:4px;margin:0 auto;padding:5px;display:flex;position:absolute;left:12px}& .desktop-touch-action{min-width:48px;height:44px;color:var(--text);font:inherit;background:0 0;border:0;border-radius:10px;justify-content:center;align-items:center;gap:5px;padding:0 9px;font-size:11px;display:inline-flex}& .desktop-touch-action[aria-pressed=true]{color:var(--accent);background:color-mix(in srgb, var(--accent) 16%, transparent)}& .desktop-touch-action:focus-visible{outline:2px solid var(--focus,var(--accent));outline-offset:1px}& .desktop-touch-action>svg{flex-shrink:0;width:18px;height:18px}& .desktop-touch-action__icon{width:18px;height:18px;display:inline-flex}& .desktop-touch-action__icon svg{stroke-width:1.8px;width:100%;height:100%}& .desktop-keyboard-input{opacity:0;pointer-events:none;border:0;width:1px;height:1px;padding:0;position:fixed;bottom:0;left:50%}@media (width<=560px){& .desktop-touch-action{min-width:44px;padding:0 7px}& .desktop-touch-action__label{display:none}}@media (width<=400px){& .desktop-touch-toolbar{grid-template-columns:repeat(3,minmax(44px,1fr));width:calc(100% - 24px);display:grid}& .desktop-touch-toolbar .desktop-sizing{box-sizing:border-box;width:100%}}}@keyframes desktop-app-launch{50%{opacity:.6;transform:rotate(180deg)scale(.92)}to{transform:rotate(360deg)}}@keyframes desktop-status-spin{to{transform:rotate(360deg)}}`})))()}var br=t({DesktopPanel:()=>Nr});function xr(e){let t=()=>j(e.controller.active()?`desktop.exitFullscreen`:e.controller.supported()?`desktop.enterFullscreen`:`desktop.fullscreenUnavailable`);var n=Er(),r=n.firstChild,i=r.firstChild;return n._$owner=de(),r._$$click=t=>void e.controller.toggle(t.currentTarget),V(i,G(N,{get name(){return e.controller.active()?`minimize`:`maximize`}})),K(()=>({e:t(),t:t(),a:e.controller.active()?`true`:`false`,o:e.controller.supported()?`false`:`true`}),({e,t,a:i,o:a},o)=>{e!==o?.e&&(n.content=e),t!==o?.t&&U(r,`aria-label`,t),i!==o?.a&&U(r,`aria-pressed`,i),a!==o?.o&&U(r,`aria-disabled`,a)}),n}function Sr(e){let t=()=>j(e.controller.feedback().active?`desktop.exitPictureInPicture`:e.controller.supported()?`desktop.enterPictureInPicture`:`desktop.pictureInPictureUnavailable`);var n=kr(),r=n.firstChild,i=r.nextSibling;return n._$$click=()=>void e.controller.toggle(),V(n,G(se,{get children(){return[Dr(),Or()]}}),r),V(n,(()=>{var n=H(()=>!!e.showLabel);return()=>n()?(()=>{var e=Ar();return V(e,t),e})():e.showLabel})(),i),K(()=>({e:ge([e.documentMode?`desktop-touch-action`:`desktop-toolbar-action`,`desktop-picture-in-picture-button`]),t:t(),a:t(),o:e.controller.feedback().active?`true`:`false`,i:e.controller.feedback().pending?`true`:`false`,n:!e.controller.supported()||!e.connected||e.controller.feedback().pending}),({e,t,a:r,o:i,i:a,n:o},s)=>{he(n,e,s?.e),t!==s?.t&&U(n,`title`,t),r!==s?.a&&U(n,`aria-label`,r),i!==s?.o&&U(n,`aria-pressed`,i),a!==s?.i&&U(n,`aria-busy`,a),o!==s?.n&&U(n,`disabled`,o)}),n}function Cr(e){return G(z,{get when(){return H(()=>!e.pending)()&&e.outcome},keyed:!0,get fallback(){return e.children},children:t=>{let n=I(()=>t.result.then(()=>null),{loadingValue:null});return G(fe,{fallback:e=>G(an,{get errorText(){return i(e())},noticeText:null}),get children(){return[H(()=>n()),H(()=>e.children)]}})}})}function wr(e){let t=I(()=>e.view.documentMode?void 0:e.presentation?.platform),n=I(()=>t()===`desktop`),r={get state(){return e.view.content.state===`picker`&&e.view.content.loading&&e.view.content.automaticSource&&e.view.content.hasTarget?`connecting`:e.view.content.state},notice(){return[G(Cr,{get outcome(){return e.view.pictureInPicture.outcome()},get pending(){return e.view.pictureInPicture.feedback().pending},get children(){return G(Cr,{get outcome(){return e.view.fullscreenMode.outcome()},get children(){return G(Cr,{get outcome(){return e.view.launcher.outcome()},get pending(){return e.view.launcher.launchingApp()!==null},get children(){return G(an,{get errorText(){return e.view.content.errorText},get noticeText(){return H(()=>!!(n()&&e.view.content.takeoverText))()?null:e.view.content.noticeText}})}})}})}}),G(an,{errorText:null,noticeText:null,get availability(){return e.view.content.availability}}),G(Ue,{get state(){return e.view.audio.state()}}),H(()=>H(()=>!(n()||!e.view.startup))()?G(an,{errorText:null,get noticeText(){return j(e.view.startup.worker?.state===`bootstrapping`?`desktop.preparing`:`desktop.starting`)}}):!n()&&e.view.startup)]},picker(){return G(en,R(()=>e.view.content.picker,{get loading(){return e.view.content.loading},get presentation(){return t()},get openWindowHref(){return H(()=>!!n())()?e.presentation?.openWindowHref:void 0},get genuineEmpty(){return H(()=>!(e.view.content.loading||e.view.content.errorText||e.view.content.noticeText||e.view.content.hasTarget||e.view.startup||e.view.content.availability?.state===`locked`))()?e.view.content.availability?.state!==`unknown`:!e.view.content.loading&&!e.view.content.errorText&&!e.view.content.noticeText&&!e.view.content.hasTarget&&!e.view.startup&&e.view.content.availability?.state!==`locked`}}))},credentials(){return G(nn,R(()=>e.view.content.credentials,{get presentation(){return t()},get machineName(){return e.view.machine?.name}}))},recovery(){return G(on,R(()=>e.view.content.recovery,{get inventoryError(){return e.view.content.state===`inventory-error`},get presentation(){return t()}}))}},i=()=>G(Sr,{get controller(){return e.view.pictureInPicture},get connected(){return e.view.content.state===`connected`},get documentMode(){return e.view.documentMode}}),a=()=>G(He,{get state(){return e.view.audio.state()},get connected(){return e.view.content.state===`connected`},get documentMode(){return e.view.documentMode},onToggle:()=>e.view.audio.toggle()}),o=()=>{let t=e.view.focusTarget();Fe(t.basePath,t.source,!t.workspaceControls&&t.control)},s={get platform(){return t()??`desktop`},get machine(){return e.view.machine},get fullscreen(){return e.view.fullscreenMode.active()},get fullscreenSupported(){return e.view.fullscreenMode.supported()},get expanded(){return e.presentation?.expanded??!1},get onToggleExpanded(){return e.presentation?.onToggleExpanded},get onOpenWindow(){return e.view.workspaceControls?o:void 0},get openWindowHref(){return e.presentation?.openWindowHref},get takeoverText(){return e.view.content.takeoverText},get failureKind(){return e.view.content.recovery.kind},get pendingLabel(){if(e.view.startup)return j(e.view.startup.worker?.state===`bootstrapping`?`desktop.preparing`:`desktop.starting`);let t=e.view.content.state===`connecting`?e.view.content.transition:`connecting`;return j(t===`taking-control`?`desktop.takingControl`:t===`switching-to-viewing`?`desktop.switchingToViewing`:`desktop.connecting`)},get controlTransition(){return e.view.content.state===`connecting`&&e.view.content.transition!==`connecting`},onFullscreen:t=>void e.view.fullscreenMode.toggle(t),audioControl:()=>(!e.view.fullscreenMode.active()||e.view.audio.state()!==`unavailable`&&e.view.audio.state()!==`unsupported`)&&a(),pictureInPictureControl:()=>(!e.view.fullscreenMode.active()||e.view.pictureInPicture.supported())&&G(Sr,{get controller(){return e.view.pictureInPicture},get connected(){return e.view.content.state===`connected`},documentMode:!1,showLabel:!0})},c=R(()=>e.view,{get launchingApp(){return e.view.launcher.launchingApp()},get rail(){return t()?s:void 0},get showApps(){let t=e.view.focusTarget();return t.source!==null&&xe({id:t.source}).kind===`environment`},get pictureInPictureControl(){return i()},get audioControl(){return a()}});return H(()=>H(()=>!!e.view.documentMode)()?G(Un,R(r,{get surfaceRef(){return e.view.surfaceRef},get controlling(){return e.view.controlling},get sizing(){return e.view.sizing},get keyboard(){return e.view.mobileKeyboard},get pictureInPictureControl(){return i()},get audioControl(){return a()},get onControlToggle(){return e.view.onControlToggle},get onClose(){return e.view.onDocumentClose}})):G(Zt,{get embedded(){return e.view.embedded},get desktopPresentation(){return n()},get mobilePresentation(){return t()===`mobile`},get workspaceControls(){return e.view.workspaceControls},get dock(){return e.view.dockLayout.dock},get height(){return e.view.dockLayout.height},get width(){return e.view.dockLayout.width},get fullscreen(){return e.view.fullscreenMode.active()},get sectionRef(){return e.view.fullscreenMode.sectionRef},renderResizer:()=>!e.view.fullscreenMode.active()&&G(De,{get controller(){return e.view.dockLayout},classPrefix:`bp`,get label(){return j(`desktop.resize`)}}),renderFullscreenControl:()=>G(xr,{get controller(){return e.view.fullscreenMode}}),onDock:t=>e.view.dockLayout.setDock(t),onOpenWindow:o,get onClose(){return e.view.onClose},content:r,connection:c}))}var Tr,Er,Dr,Or,kr,Ar,jr,Mr,Nr;function Pr(){return(Pr=e((()=>{J(),B(),r(),k(),re(),x(),Re(),ke(),je(),g(),O(),A(),Be(),Xe(),rt(),ct(),Jn(),Ie(),Zn(),hr(),Hn(),_r(),be(),we(),yr(),Tr=Y(`<style>`),Er=Y(`<openclaw-tooltip><button class="bp-icon desktop-fullscreen-button"type=button><span class=desktop-fullscreen-icon aria-hidden=true>`,1),Dr=Y(`<svg><rect x=2 y=3 width=20 height=18 rx=2></svg>`,2),Or=Y(`<svg><rect x=12 y=11 width=7 height=7 rx=1></svg>`,2),kr=Y(`<button type=button><!><!>`),Ar=Y(`<span class=desktop-rail__action-label>`),jr=new WeakMap,Mr=e=>{let t=jr.get(e);return t||(t=mr(e,W),jr.set(e,t)),t},Nr=E(`openclaw-desktop-panel`,(e,t)=>{let n=jr.has(t),r=Mr(t),i=Le(t.ownerDocument,r.notify);r.attach({audio:Ze(t,r.audioTarget),mobileKeyboard:Yn(r.keyboardTarget),pictureInPicture:gr(t,()=>{let e=r.launchTarget();return t.available&&e.state===`connected`&&e.presented?it(r.surface()):null}),launcher:ze(r.launchTarget),fullscreenMode:i},n);let a=D(r,e=>e);return[(()=>{var e=Tr();return V(e,`${Ae}\n${Se}\n${vr}`),e})(),H(()=>H(()=>!!(e.available&&(e.documentMode||e.embedded||a.read().dockLayout.open)))()?G(wr,{get view(){return a.read().view},get presentation(){return e.presentation}}):e.available&&(e.documentMode||e.embedded||a.read().dockLayout.open))]},{properties:{client:{default:null,attribute:!1},sessions:{default:void 0,attribute:!1},available:{default:!1,type:Boolean},suppressed:{default:!1,type:Boolean},documentMode:{default:!1,type:Boolean,reflect:!0},presentation:{default:null,attribute:!1},requestedSource:{default:null,attribute:!1},sessionKey:{default:null,attribute:!1},documentControl:{default:!1,type:Boolean},basePath:{default:``,attribute:!1},suppliedEnvironments:{default:null,attribute:!1},workspaceControls:{default:!1,type:Boolean},embedded:{default:!1,type:Boolean,reflect:!0},presented:{default:!1,type:Boolean},refreshOnPresentation:{default:!0,type:Boolean},runtimeConfig:{default:null,attribute:!1},onDocumentClose:{default:null,attribute:!1},onFocusTargetChange:{default:null,attribute:!1},desktopClientFactory:{default:()=>new st,attribute:!1}},propertyChanged:e=>jr.get(e)?.inputsChanged(),methods:{handleToggleRequest:(e,t)=>Mr(e).handleToggleRequest(t)}}),_e([`click`])})))()}export{Xt as a,qt as i,Pr as n,Kt as o,Jt as r,Gt as s,br as t};