clay-server 5.4.0 → 5.5.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/agent-behavior-gate.js +223 -0
- package/lib/agent-behavior-schema.js +184 -0
- package/lib/daemon.js +15 -0
- package/lib/issues-mcp-server.js +16 -3
- package/lib/migrate-single-user.js +2 -0
- package/lib/project-issues.js +9 -2
- package/lib/project-log-feedback-delivery.js +3 -0
- package/lib/project-logs-mcp-server.js +23 -2
- package/lib/project-logs.js +40 -6
- package/lib/project-session-document.js +9 -1
- package/lib/project-session-notes.js +19 -8
- package/lib/project-session-pair-prompt.js +5 -4
- package/lib/project-user-knowledge.js +21 -3
- package/lib/project-worker-proposal.js +8 -2
- package/lib/project.js +108 -61
- package/lib/public/app.js +1 -0
- package/lib/public/css/agent-behavior.css +101 -0
- package/lib/public/modules/agent-behavior-nav.js +90 -0
- package/lib/public/modules/agent-behavior-view.js +235 -0
- package/lib/public/modules/agent-behavior.js +200 -0
- package/lib/public/modules/settings-shell-registry.js +1 -1
- package/lib/public/modules/settings-shell-view.js +18 -0
- package/lib/public/modules/user-settings-layout.js +8 -1
- package/lib/public/modules/user-settings.js +5 -2
- package/lib/public/pane-assets/{app-BDYH6Y7R.js → app-4IZ6F6ND.js} +1 -1
- package/lib/public/pane-assets/{chunk-HWLBH6AL.js → chunk-3E6LDNXF.js} +1 -1
- package/lib/public/pane-assets/chunk-6KO36HMU.js +1 -0
- package/lib/public/pane-assets/{chunk-N5SIEIOG.js → chunk-6ZF2FJT3.js} +1 -1
- package/lib/public/pane-assets/{chunk-TT3NECKK.js → chunk-A4MLSYBJ.js} +1 -1
- package/lib/public/pane-assets/{chunk-KF3LZRJK.js → chunk-A7OB7HQS.js} +1 -1
- package/lib/public/pane-assets/{chunk-QRVKAVH7.js → chunk-ADGKPVFD.js} +1 -1
- package/lib/public/pane-assets/{chunk-UMIYQYGM.js → chunk-DJ5WXQKT.js} +1 -1
- package/lib/public/pane-assets/{chunk-KB4T5B2R.js → chunk-ELL4UBGY.js} +1 -1
- package/lib/public/pane-assets/{chunk-FQQMXMH7.js → chunk-FILRACQB.js} +97 -97
- package/lib/public/pane-assets/chunk-H6MU72QE.js +1 -0
- package/lib/public/pane-assets/{chunk-X452YCE5.js → chunk-I6X5J2V5.js} +1 -1
- package/lib/public/pane-assets/{chunk-U5GH2UJM.js → chunk-L3FCTD7U.js} +1 -1
- package/lib/public/pane-assets/{chunk-VCNLKOVT.js → chunk-OB3KKICE.js} +1 -1
- package/lib/public/pane-assets/chunk-PJURCIJQ.js +1 -0
- package/lib/public/pane-assets/chunk-Q7RFSS5Q.js +1 -0
- package/lib/public/pane-assets/{chunk-42C2CZEP.js → chunk-RRYWV5JT.js} +1 -1
- package/lib/public/pane-assets/{chunk-E6NRPGVH.js → chunk-SEELA2D2.js} +1 -1
- package/lib/public/pane-assets/chunk-UTLQWAKG.js +1 -0
- package/lib/public/pane-assets/chunk-WE4NWXNK.js +1 -0
- package/lib/public/pane-assets/{chunk-YE45RR7W.js → chunk-YFUORWA6.js} +1 -1
- package/lib/public/pane-assets/{chunk-TMUCEZ7C.js → chunk-YWHBNEB2.js} +1 -1
- package/lib/public/pane-assets/{chunk-XI2DJM4H.js → chunk-YXJ7ISEK.js} +1 -1
- package/lib/public/pane-assets/chunk-Z2MHS43B.js +1 -0
- package/lib/public/pane-assets/manifest.json +436 -432
- package/lib/public/pane-assets/{style-VDIGFFLR.css → style-DZX6JAMF.css} +1 -1
- package/lib/public/style.css +1 -0
- package/lib/sdk-bridge.js +3 -2
- package/lib/server-agent-behavior-settings.js +72 -0
- package/lib/server-settings.js +2 -0
- package/lib/server.js +9 -0
- package/lib/session-notes-mcp-server.js +27 -7
- package/lib/session-skill-scope.js +2 -2
- package/lib/users-agent-behavior-preferences.js +38 -0
- package/lib/users.js +6 -0
- package/lib/yoke/adapters/claude.js +8 -4
- package/lib/yoke/skill-discovery.js +46 -1
- package/package.json +1 -1
- package/lib/public/pane-assets/chunk-46OOGVHU.js +0 -1
- package/lib/public/pane-assets/chunk-4OJW4FF4.js +0 -1
- package/lib/public/pane-assets/chunk-F7VIE6FJ.js +0 -1
- package/lib/public/pane-assets/chunk-FCJYJLVZ.js +0 -1
- package/lib/public/pane-assets/chunk-FEJDEXOW.js +0 -1
- package/lib/public/pane-assets/chunk-HEMCIILG.js +0 -1
- package/lib/public/pane-assets/chunk-RV5O66TO.js +0 -1
|
@@ -63,7 +63,24 @@ export function renderPageNav(pages, activePage, onSelect) {
|
|
|
63
63
|
markActivePage(activePage);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
// A page may hang a list of in-page links under its own nav item (desktop).
|
|
67
|
+
var subnav = { page: null, node: null };
|
|
68
|
+
var lastActivePage = null;
|
|
69
|
+
export function setPageSubnav(page, node) {
|
|
70
|
+
if (subnav.node && subnav.node.parentNode && subnav.node !== node) subnav.node.parentNode.removeChild(subnav.node);
|
|
71
|
+
subnav = { page: node ? page : null, node: node || null };
|
|
72
|
+
placeSubnav();
|
|
73
|
+
}
|
|
74
|
+
function placeSubnav() {
|
|
75
|
+
var nav = el('settings-page-nav');
|
|
76
|
+
if (!subnav.node) return;
|
|
77
|
+
var active = Array.from(nav.querySelectorAll('button.settings-nav-item')).filter(function (button) { return button.dataset.section === lastActivePage; })[0];
|
|
78
|
+
if (subnav.page === lastActivePage && active) active.after(subnav.node);
|
|
79
|
+
else if (subnav.node.parentNode === nav) nav.removeChild(subnav.node);
|
|
80
|
+
}
|
|
81
|
+
|
|
66
82
|
export function markActivePage(activePage) {
|
|
83
|
+
lastActivePage = activePage;
|
|
67
84
|
Array.from(el('settings-page-nav').querySelectorAll('button')).forEach(function (button) {
|
|
68
85
|
var active = button.dataset.section === activePage;
|
|
69
86
|
button.classList.toggle('active', active);
|
|
@@ -71,6 +88,7 @@ export function markActivePage(activePage) {
|
|
|
71
88
|
});
|
|
72
89
|
var select = el('settings-page-select');
|
|
73
90
|
if (activePage && select.value !== activePage) select.value = activePage;
|
|
91
|
+
placeSubnav();
|
|
74
92
|
}
|
|
75
93
|
|
|
76
94
|
// The selector is a plain select; settings-select upgrades it to the shared
|
|
@@ -4,6 +4,8 @@ import { store } from './store.js';
|
|
|
4
4
|
import { closeSpeechPicker } from './stt-picker.js';
|
|
5
5
|
import { loadSpeechSettings } from './stt-settings.js';
|
|
6
6
|
import { mountDefaultAi, unmountDefaultAi, requestDefaultAi } from './default-ai.js';
|
|
7
|
+
import { mountAgentBehavior, unmountAgentBehavior } from './agent-behavior-view.js';
|
|
8
|
+
import { resetAgentBehavior } from './agent-behavior.js';
|
|
7
9
|
import { resolvePage } from './settings-shell-registry.js';
|
|
8
10
|
|
|
9
11
|
export function resolveUserSettingsPage(id) { return resolvePage('personal', id); }
|
|
@@ -29,6 +31,9 @@ export function buildUserSettingsLayout() {
|
|
|
29
31
|
document.getElementById('us-auto-continue').closest('label').querySelector('.settings-hint').textContent = 'When a rate-limited conversation becomes eligible to retry, Clay can send a continuation automatically. This may resume work and consume usage without another message from you.';
|
|
30
32
|
heading(ai, 'Command permissions', 'These are personal Claude CLI allow rules, separate from model selection and Clay session approval modes. Managed defaults are shown for reference. Server access restrictions still apply. On an OS-user server these install in your OS home; otherwise they install in the shared server process home and can affect other Claude CLI launches there.');
|
|
31
33
|
ai.appendChild(document.getElementById('us-claude-allow-list').closest('.settings-card'));
|
|
34
|
+
var agent = document.createElement('div'); agent.className = 'us-section'; agent.dataset.section = 'us-agent';
|
|
35
|
+
agent.innerHTML = '<h2>Agent behavior</h2><p class="settings-hint">Choose how your Project Drivers use Clay memory, context, tools and connections. These choices apply to your own Driver conversations.</p><div id="us-agent-behavior"></div>';
|
|
36
|
+
root.querySelector('.us-modal-content').appendChild(agent);
|
|
32
37
|
section('us-mates').remove();
|
|
33
38
|
var experiments = document.createElement('details'); experiments.className = 'us-experiments'; experiments.innerHTML = '<summary>Experimental features</summary><p class="settings-hint">Personal opt-ins for features that may change.</p>';
|
|
34
39
|
experiments.appendChild(document.getElementById('us-capsules-enabled').closest('.settings-card'));chat.appendChild(experiments);section('us-experimental').remove();
|
|
@@ -43,9 +48,11 @@ export function buildUserSettingsLayout() {
|
|
|
43
48
|
export function loadUserSettingsExtras(page) {
|
|
44
49
|
if (page === 'us-integrations') loadPersonalIntegrations();
|
|
45
50
|
if (page === 'us-chat') loadSpeechSettings();
|
|
51
|
+
if (page === 'us-agent') mountAgentBehavior(document.getElementById('us-agent-behavior'));
|
|
46
52
|
if (page === 'us-ai') { mountDefaultAi(document.getElementById('us-default-ai')); requestDefaultAi(); var ws=getWs();if(ws && ws.readyState===1)ws.send(JSON.stringify({type:'get_claude_allow_list'})); }
|
|
47
53
|
}
|
|
48
|
-
export function
|
|
54
|
+
export function leaveAgentBehaviorPage() {unmountAgentBehavior();resetAgentBehavior();}
|
|
55
|
+
export function finishUserSettingsExtras() {leaveAgentBehaviorPage();closeSpeechPicker();unmountDefaultAi(document.getElementById('us-default-ai'));}
|
|
49
56
|
// Returns the draft prompt for leaving one personal page (or every page when
|
|
50
57
|
// pageId is omitted); the shell shows it with the shared confirmation.
|
|
51
58
|
export function personalLeavePrompt(pageId) {
|
|
@@ -6,7 +6,7 @@ import { initPersonalProfile } from './user-settings-profile.js';
|
|
|
6
6
|
import { initPersonalEditors } from './user-settings-editors.js';
|
|
7
7
|
import { initPersonalPreferences } from './user-settings-preferences.js';
|
|
8
8
|
import { showPinForm, hidePinForm, populateAccount, savePin, renderEmailSettings } from './user-settings-account.js';
|
|
9
|
-
import { buildUserSettingsLayout, resolveUserSettingsPage, loadUserSettingsExtras, finishUserSettingsExtras, personalLeavePrompt } from './user-settings-layout.js';
|
|
9
|
+
import { buildUserSettingsLayout, resolveUserSettingsPage, loadUserSettingsExtras, finishUserSettingsExtras, leaveAgentBehaviorPage, personalLeavePrompt } from './user-settings-layout.js';
|
|
10
10
|
import { enhanceSettingsSelects } from './settings-select.js';
|
|
11
11
|
import { loadNotificationSettings } from './notification-settings.js';
|
|
12
12
|
// user-settings.js — Personal settings pane of the unified settings shell
|
|
@@ -37,7 +37,7 @@ export function initUserSettings() {
|
|
|
37
37
|
pane: settingsEl,
|
|
38
38
|
enter: function () { populateAccount(); },
|
|
39
39
|
activate: function (page) { switchSection(page); },
|
|
40
|
-
leave: function () { resetAccountSessions(); finishUserSettingsExtras(); },
|
|
40
|
+
leave: function () { currentPage = null; resetAccountSessions(); finishUserSettingsExtras(); },
|
|
41
41
|
busy: function () { return store.get('speechPopup') ? 'Finish or close the open voice settings editor first.' : ''; },
|
|
42
42
|
leavePrompt: function (kind, pageId) { return personalLeavePrompt(kind === 'page' ? pageId : undefined); }
|
|
43
43
|
});
|
|
@@ -159,8 +159,11 @@ export function isUserSettingsOpen() {
|
|
|
159
159
|
return isSettingsShellOpen() && activeSettingsScope() === 'personal';
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
var currentPage = null;
|
|
162
163
|
function switchSection(sectionName) {
|
|
163
164
|
sectionName = resolveUserSettingsPage(sectionName);
|
|
165
|
+
if (currentPage === 'us-agent' && sectionName !== 'us-agent') leaveAgentBehaviorPage();
|
|
166
|
+
currentPage = sectionName;
|
|
164
167
|
loadUserSettingsExtras(sectionName);
|
|
165
168
|
for (var j = 0; j < sections.length; j++) {
|
|
166
169
|
sections[j].classList.toggle('active', sections[j].dataset.section === sectionName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as En,$a as Zn,$b as Or,$c as Io,Aa as Fn,Ab as yr,Ac as ao,B as tn,Ba as Hn,Bb as Sr,Bc as io,C as nn,Ca as qn,Cb as wr,Cc as so,D as rn,Da as Vn,Db as kr,Dc as lo,E as on,Ea as Wn,Eb as Cr,Ec as co,F as an,Fa as zn,Fb as Mr,Fc as uo,G as sn,Gb as Er,Gc as fo,H as ln,Hb as Pr,Hc as po,I as dn,Ic as mo,J as F,Jc as go,K as cn,Kc as ho,Kd as jo,L as un,Lb as me,Lc as vo,M as H,Mc as bo,N as fn,Nc as yo,O as pn,Oc as So,Od as Uo,P as mn,Pb as xr,Pc as wo,Q as gn,Qa as Gn,Qb as Ir,Qc as ko,Qd as _o,R as hn,Rb as Lr,S as vn,Sb as Tr,Sd as No,T as bn,Tb as Rr,Td as Oo,U as yn,Ub as Dr,Uc as Co,V as Sn,Va as Kn,Vb as Ar,Vc as Mo,W as wn,Wa as Yn,Wb as Br,Wc as ne,X as De,Xa as Qn,Xb as jr,Xc as re,Y as kn,Ya as Jn,Yb as Ur,Yc as Eo,Z as Cn,Za as $n,Zb as _r,Zc as Po,_ as Mn,_a as Xn,_b as Nr,_c as xo,_d as Fo,a as Nt,aa as Pn,ab as er,ac as Fr,ad as Lo,b as Ot,ba as xn,bb as Xe,bc as Hr,c as Ft,ca as In,cb as tr,cc as qr,d as Ht,da as Ln,db as nr,dc as Vr,e as qt,ea as Tn,eb as te,ec as Wr,f as Vt,fa as Rn,fb as rr,fc as zr,g as Wt,ga as Dn,gb as or,gc as Gr,h as zt,ha as An,hb as ar,i as Gt,ia as Bn,ib as ir,j as Kt,ja as jn,jb as sr,k as Yt,ka as Un,kb as lr,kc as Kr,la as $e,lb as dr,lc as Yr,ma as _n,mb as cr,mc as Qr,nb as ur,nc as Jr,ob as fr,oc as $r,od as To,pb as Ze,pc as Xr,pd as Ro,qc as Zr,qd as Do,r as Je,rb as pr,rc as eo,rd as Ao,sb as mr,sc as to,t as Qt,tb as gr,tc as no,td as Ue,ub as hr,uc as ro,v as Jt,vb as vr,vc as ge,vd as nt,w as Zt,wb as et,wc as oo,wd as Bo,x as en,xb as br,xc as je,ya as Nn,yb as Ae,za as On,zb as Be,zc as tt,zd as he}from"./chunk-FQQMXMH7.js";import"./chunk-U5GH2UJM.js";import"./chunk-JIV7O5GN.js";import{g as $t}from"./chunk-YE45RR7W.js";import{h as Xt}from"./chunk-42C2CZEP.js";import{A as _t,a as At,b as Bt,f as jt,w as Qe,x as Ut}from"./chunk-XI2DJM4H.js";import{a as w}from"./chunk-R7QVVFUG.js";import{d as D,e as ee}from"./chunk-E6NRPGVH.js";import{a as Dt,b as o}from"./chunk-VZ2OKDAO.js";var ve=[];function rt(){var e=o.snap(),t=e.paneDeferredBootstrap;!t||t.scheduled||!t.jobs.length||!e.connected||!e.paneReady||e.paneSuspended||(o.set({paneDeferredBootstrap:Object.assign({},t,{scheduled:!0})}),setTimeout(function(){var n=o.snap(),r=n.paneDeferredBootstrap;if(r){var a=r.jobs.slice(),s=n.connected&&n.paneReady&&!n.paneSuspended?a.shift():null;o.set({paneDeferredBootstrap:Object.assign({},r,{scheduled:!1,jobs:a})});try{if(s!==null&&ve[s]){var i=ve[s];ve[s]=null,i()}}finally{rt()}}},0))}function _e(e){if(!o.get("paneMode")){e.forEach(function(n){n()});return}var t=o.get("paneDeferredBootstrap");t||(t={jobs:[],scheduled:!1},o.subscribe(function(n,r){(n.paneReady!==r.paneReady||n.connected!==r.connected||n.paneSuspended!==r.paneSuspended)&&rt()})),o.set({paneDeferredBootstrap:Object.assign({},t,{jobs:t.jobs.concat(e.map(function(n){var r=ve.length;return ve.push(n),r}))})}),rt()}function Ho(){_t(),jt(),window.addEventListener("message",function(e){var t=e.data;if(e.origin===location.origin&&t&&t.type==="clay-studio-document-update"&&t.message){var n=Bt(t.message.path);n&&n.source===e.source&&n.descriptor.token===t.token&&Fo(t.message,n);return}!t||["clay-pane-present-markdown","clay-pane-present-wireframe"].indexOf(t.type)<0||!t.message||!t.message.controlPresentation||!Qe(e,t)||!Ut(e,t)||(t.type==="clay-pane-present-markdown"?(At(e,t,Qe(e,t)),No(t.message)):Xt(t.message))})}var ai="(max-width: 768px)",ii=["sticky-notes-toggle-btn","shared-browser-toggle-btn","terminal-toggle-btn"],si=["shared-browser-toggle-btn","terminal-toggle-btn","sticky-notes-toggle-btn"];function qo(e){var t=document.querySelector("#main-column > .title-bar-content .status"),n=document.querySelector("#top-bar .top-bar-actions"),r=document.getElementById("notif-center-btn");if(!(!t||!n))for(var a=e?ii:si,s=0;s<a.length;s++){var i=document.getElementById(a[s]);i&&(e?t.appendChild(i):n.insertBefore(i,r))}}var li=150,oe=24,be=12,Vo=null;function Wo(e,t,n){return Math.round(e.offsetWidth)+"|"+Math.round(t.offsetWidth)+"|"+Math.round(n.offsetWidth)}function zo(e){var t=document.getElementById("top-bar"),n=t&&t.querySelector(".top-bar-left-pills"),r=t&&t.querySelector(".top-bar-actions"),a=document.getElementById("cmd-palette-btn");if(!(!t||!n||!r||!a)&&t.offsetWidth&&!(!e&&Vo===Wo(t,n,r))&&getComputedStyle(a).display!=="none"){for(var s=[[],["usage-compact"],["usage-compact","usage-compact-link"]],i=null,l=0;l<s.length&&!i;l++){t.classList.remove("usage-compact","usage-compact-link","search-icon"),s[l].forEach(function(P){t.classList.add(P)}),t.style.removeProperty("--top-bar-search-width"),t.style.removeProperty("--top-bar-search-left");var c=t.getBoundingClientRect().width,d=c/2,u=t.getBoundingClientRect().left,p=n.getBoundingClientRect().right-u,m=r.getBoundingClientRect().left-u,v=Math.min(d-p,m-d)-be,y=Math.min(520,c*.4);if(2*v>=li)i={mode:"full",width:Math.min(y,2*v),left:null,level:l};else if(m-p>=oe+2*be){var M=p+be+oe/2,E=m-be-oe/2;i={mode:"icon",width:oe,left:Math.min(Math.max(d,M),E),level:l}}}i||(i={mode:"icon",width:oe,left:Math.max(n.getBoundingClientRect().right-t.getBoundingClientRect().left+be+oe/2,0),level:s.length-1}),t.classList.toggle("search-icon",i.mode==="icon"),i.mode==="full"?t.style.setProperty("--top-bar-search-width",Math.round(i.width)+"px"):t.style.setProperty("--top-bar-search-left",Math.round(i.left)+"px"),Vo=Wo(t,n,r)}}function di(){var e=document.getElementById("top-bar");if(!(!e||typeof ResizeObserver>"u")){var t=!1,n=function(a){t||(t=!0,requestAnimationFrame(function(){t=!1,zo(a===!0)}))},r=new ResizeObserver(function(){n(!1)});r.observe(e),[".top-bar-left-pills",".top-bar-actions"].forEach(function(a){var s=e.querySelector(a);s&&r.observe(s)}),new MutationObserver(function(){n(!0)}).observe(e.querySelector(".top-bar-actions"),{childList:!0,subtree:!0,characterData:!0}),zo(!0)}}function ci(){var e=document.querySelector("#main-column > .title-bar-content"),t=document.getElementById("top-bar");if(!(!e||!t)){var n=function(){t.classList.toggle("title-bar-hidden",e.classList.contains("hidden"))};n(),new MutationObserver(n).observe(e,{attributes:!0,attributeFilter:["class"]})}}function Go(){var e=window.matchMedia(ai);qo(e.matches),e.addEventListener("change",function(){qo(e.matches)}),ci(),di()}var Qo={},at={},x=null,B=null,j=null,Jo=0,$o=[],Ne={},it=null;function Ko(e){Qo[e.id]=e}function ot(e,t){at[e]=t}function Xo(e,t){var n=Qo[e];n&&(j=n,Jo=0,$o=[],it=t||null,ui(),Oe(n.steps[0].id),B.classList.remove("hidden"),x.classList.remove("hidden"),setTimeout(function(){x.focus()},50))}function ye(){B&&B.classList.add("hidden"),x&&x.classList.add("hidden");var e=it;j=null,it=null,e&&e()}function Zo(){pi(),mi()}function ui(){x||(B=document.createElement("div"),B.className="playbook-overlay hidden",B.addEventListener("click",function(e){e.target===B&&ye()}),x=document.createElement("div"),x.className="playbook-modal hidden",x.setAttribute("tabindex","-1"),x.addEventListener("keydown",function(e){e.key==="Escape"&&ye()}),B.appendChild(x),document.body.appendChild(B))}function Oe(e){if(j){for(var t=null,n=0,r=0;r<j.steps.length;r++)if(j.steps[r].id===e){t=j.steps[r],n=r;break}if(t){if(Jo=n,$o.push(e),t.condition&&t.branches){var a=t.condition(),s=t.branches[a]||t.branches.default;if(s){Oe(s);return}}fi(t)}}}function fi(e){for(var t=j,n=t.steps.filter(function(k){return!k.condition}).length,r=0,a=0,s=0;s<t.steps.length;s++)t.steps[s].condition||(a++,t.steps[s].id===e.id&&(r=a));var i="";i+='<div class="playbook-header">',i+='<div class="playbook-header-left">',i+='<span class="playbook-icon">'+(t.icon||"\u{1F4D6}")+"</span>",i+='<span class="playbook-title">'+ae(t.title)+"</span>",i+="</div>",i+='<button class="playbook-close" title="Close">×</button>',i+="</div>",i+='<div class="playbook-progress">';for(var l=0;l<n;l++){var c="playbook-progress-dot";l+1<r?c+=" done":l+1===r&&(c+=" active"),i+='<span class="'+c+'"></span>'}i+="</div>",i+='<div class="playbook-body">',i+='<h2 class="playbook-step-title">'+ae(e.title)+"</h2>";var d=typeof e.body=="function"?e.body():e.body||"";if(i+='<div class="playbook-step-body">'+d+"</div>",e.note&&(i+='<div class="playbook-step-note">'+ae(e.note)+"</div>"),i+="</div>",e.actions&&e.actions.length>0){i+='<div class="playbook-actions">';for(var u=0;u<e.actions.length;u++){var p=e.actions[u],m="playbook-btn";u===0?m+=" playbook-btn-primary":m+=" playbook-btn-secondary",i+='<button class="'+m+'" data-action="'+(p.action||"")+'" data-next="'+(p.next||"")+'">'+ae(p.label)+"</button>"}i+="</div>"}x.innerHTML=i,D();var v=x.querySelector(".playbook-close");v&&v.addEventListener("click",ye);for(var y=x.querySelectorAll(".playbook-btn"),M=0;M<y.length;M++)(function(k){k.addEventListener("click",function(){var A=k.dataset.action,h=k.dataset.next;A&&at[A]?(k.disabled=!0,k.textContent+="...",at[A](function(){h?Oe(h):(Yo(j.id),ye())})):h?Oe(h):(Yo(j.id),ye())})})(y[M]);for(var E=x.querySelectorAll("[data-copy-url]"),P=0;P<E.length;P++)(function(k){k.addEventListener("click",function(A){A.stopPropagation();var h=k.dataset.copyUrl;navigator.clipboard.writeText(h).then(function(){k.textContent="Copied!",setTimeout(function(){k.textContent="Copy"},1500)})})})(E[P])}function Yo(e){Ne[e]=!0;try{localStorage.setItem("clay-playbooks-done",JSON.stringify(Ne))}catch{}}function pi(){try{var e=JSON.parse(localStorage.getItem("clay-playbooks-done")||"{}");Ne=e||{}}catch{Ne={}}}function mi(){if(Ko({id:"push-notifications",title:"Push Notifications",icon:"\u{1F514}",description:"Get notified when Claude finishes a long task",tipMatch:function(t){return t.indexOf("Push notification")!==-1},steps:[{id:"intro",title:"Never miss a response",body:"When Claude is working on a long task, you can walk away and get a push notification the moment it's done. Works even when Clay is in the background.",actions:[{label:"Enable notifications",action:"notif_request",next:"check_perm"},{label:"Not now",next:""}]},{id:"check_perm",condition:function(){return typeof Notification>"u"?"unsupported":Notification.permission},branches:{granted:"test",denied:"denied",default:"denied",unsupported:"unsupported"}},{id:"test",title:"Let's test it!",body:"Click below to send a test notification. You should see it pop up from your system.",actions:[{label:"Send test notification",action:"notif_test",next:"check_test"},{label:"Skip",next:"done"}]},{id:"check_test",title:"Did you see it?",body:"A notification should have appeared from your system just now.",actions:[{label:"Yes, it worked!",next:"done"},{label:"No, nothing appeared",next:"troubleshoot"}]},{id:"troubleshoot",title:"Troubleshooting",body:function(){var t=navigator.platform&&navigator.platform.indexOf("Mac")!==-1,n="your browser",r=navigator.userAgent||"";r.indexOf("Arc")!==-1?n="Arc":r.indexOf("Edg/")!==-1?n="Edge":r.indexOf("Firefox")!==-1?n="Firefox":r.indexOf("Chrome")!==-1?n="Chrome":r.indexOf("Safari")!==-1&&(n="Safari");var a=location.protocol==="https:"&&location.hostname!=="localhost"&&location.hostname!=="127.0.0.1",s="The browser says permission is granted, but the notification didn't show.<br><br>";return a&&(s+="\u{1F512} <strong>Untrusted certificate?</strong><br>If you're using a self-signed or untrusted TLS certificate, some browsers silently block notifications even on HTTPS.<br>Run <strong>mkcert -install</strong> on the server to trust the root CA, or add the certificate to your system keychain as trusted.<br><br>"),s+="<strong>Also check your OS notification settings:</strong><br>",t?s+="<strong>1.</strong> Open <strong>System Settings \u2192 Notifications</strong><br><strong>2.</strong> Find <strong>"+n+"</strong> in the list<br><strong>3.</strong> Make sure <strong>Allow Notifications</strong> is turned on<br><strong>4.</strong> Check that <strong>Do Not Disturb</strong> / Focus mode is off<br>":s+="<strong>1.</strong> Make sure notifications are enabled for <strong>"+n+"</strong><br><strong>2.</strong> Check that Do Not Disturb / Focus mode is off<br>",s+="<br>After adjusting, come back and try again.",s},actions:[{label:"Try again",action:"notif_test",next:"check_test"},{label:"I'll fix it later",next:"done"}]},{id:"denied",title:"Permission needed",body:function(){var t=!window.isSecureContext||location.protocol==="http:"&&location.hostname!=="localhost"&&location.hostname!=="127.0.0.1"&&location.hostname!=="[::1]";if(t)return"\u26A0\uFE0F <strong>Insecure context detected.</strong><br><br>Notifications require a <strong>secure context</strong> (HTTPS or localhost). You're accessing Clay over <strong>"+location.protocol+"//"+location.hostname+"</strong>, so the browser automatically blocks notifications.<br><br><strong>How to fix:</strong><br><strong>1.</strong> Access Clay via <strong>https://</strong> (set up a TLS certificate)<br><strong>2.</strong> Or access via <strong>localhost:"+location.port+"</strong> instead of an IP address<br>";var n="chrome://settings/content/notifications",r=navigator.userAgent||"";return r.indexOf("Firefox")!==-1?n="about:preferences#privacy":r.indexOf("Edg/")!==-1?n="edge://settings/content/notifications":r.indexOf("Arc")!==-1&&(n="arc://settings/content/notifications"),'Your browser blocked the notification permission.<br><br><strong>1.</strong> Click the lock icon in the address bar<br><strong>2.</strong> Find "Notifications" and set it to "Allow"<br><strong>3.</strong> Reload the page<br><br>Or paste this into your address bar:<br><div style="display:flex;align-items:center;gap:6px;margin-top:6px"><code style="font-size:12px;color:var(--accent);flex:1;user-select:all">'+n+'</code><button class="playbook-btn-secondary" style="padding:3px 8px;font-size:11px" data-copy-url="'+n+'">Copy</button></div>'},actions:[{label:"Got it",next:""}]},{id:"unsupported",title:"Not supported",body:"Your browser doesn't support notifications. Try Chrome, Edge, or Firefox for the best experience.",actions:[{label:"Got it",next:""}]},{id:"done",title:"All set! \u{1F389}",body:"You'll now get a notification whenever Claude finishes processing. This works even when Clay is minimized or in another tab.",note:"You can toggle notifications anytime from the header bar.",actions:[{label:"Done",next:""}]}]}),ot("notif_request",function(t){if(typeof Notification>"u"){t();return}Notification.requestPermission().then(function(n){if(n==="granted")try{localStorage.setItem("notif-alert","1");var r=document.getElementById("notif-toggle-alert");r&&(r.checked=!0)}catch{}t()}).catch(function(){t()})}),ot("notif_test",function(t){if(typeof Notification>"u"){t();return}if(Notification.permission!=="granted"){Notification.requestPermission().then(function(n){n==="granted"?e(t):t()}).catch(function(){t()});return}e(t)}),location.protocol==="https:"){let t=function(){var a=navigator.userAgent||"",s=navigator.platform||"";return s.indexOf("Mac")!==-1||a.indexOf("Mac")!==-1?"mac":s.indexOf("Win")!==-1||a.indexOf("Windows")!==-1?"windows":"linux"},n=function(){var a=t(),s="The certificate has been downloaded as <strong>clay-ca.pem</strong>.<br><br>";return a==="mac"?(s+="<strong>macOS \u2014 run in Terminal:</strong><br>",s+=r("sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/Downloads/clay-ca.pem")):a==="windows"?(s+="<strong>Windows \u2014 run in PowerShell (Admin):</strong><br>",s+=r('certutil -addstore -f "Root" %USERPROFILE%\\Downloads\\clay-ca.pem')):(s+="<strong>Linux \u2014 run in terminal:</strong><br>",s+=r("sudo cp ~/Downloads/clay-ca.pem /usr/local/share/ca-certificates/clay-ca.crt && sudo update-ca-certificates")),s+='<br><div style="padding:8px 10px;background:var(--bg-deeper);border-radius:6px;border-left:3px solid var(--accent)"><strong style="font-size:11px">Or ask Claude Code:</strong><br><code style="font-family:monospace;font-size:12px;line-height:1.5;color:var(--text-secondary)">Install ~/Downloads/clay-ca.pem as a trusted root certificate</code></div>',s+="<br>Then <strong>restart your browser</strong> to apply the change.",s},r=function(a){return'<div style="margin-top:8px;position:relative;background:var(--bg-deeper);border-radius:6px;padding:8px 10px"><code style="display:block;font-family:monospace;font-size:12px;word-break:break-all;line-height:1.5;padding-right:50px">'+ae(a)+'</code><button class="playbook-btn-secondary" style="position:absolute;top:8px;right:8px;padding:2px 8px;font-size:11px;white-space:nowrap" data-copy-url="'+ae(a)+'">Copy</button></div>'};Ko({id:"trust-certificate",title:"Trust Certificate",icon:"\u{1F512}",description:"Getting certificate warnings? Fix them here",tipMatch:function(a){return a.indexOf("certificate")!==-1||a.indexOf("Certificate")!==-1},steps:[{id:"intro",title:"Getting certificate warnings?",body:"Clay generates a local CA certificate for secure HTTPS connections. Your browser may show warnings until you install and trust this certificate on your device.",actions:[{label:"Download certificate",action:"cert_download",next:"install"},{label:"Not now",next:""}]},{id:"install",title:"Install the certificate",body:n,actions:[{label:"Done, I installed it",next:"done"},{label:"I'll do it later",next:""}]},{id:"done",title:"All set! \u{1F389}",body:"After restarting your browser, certificate warnings should disappear. If you still see them, make sure you ran the terminal command with admin privileges.",actions:[{label:"Done",next:""}]}]}),ot("cert_download",function(a){var s=document.createElement("a");s.href="/ca/download",s.download="clay-ca.pem",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(a,500)})}function e(t){try{var n=new Notification("Clay",{body:"Notifications are working! \u{1F389}",tag:"clay-test-"+Date.now()});n.onclick=function(){window.focus(),n.close()},setTimeout(function(){try{n.close()}catch{}},5e3)}catch(r){console.warn("[Playbook] Notification failed:",r)}setTimeout(t,800)}}function ae(e){var t=document.createElement("div");return t.textContent=e||"",t.innerHTML}function ea(e){var t=document.createElement("span");t.className="stt-meter",t.setAttribute("aria-hidden","true");var n=document.createElement("canvas");t.appendChild(n);var r=n.getContext("2d"),a=null,s=0,i=[],l=window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function c(d){a=null;var u=o.get("speechActive");if(!(!u||u.id!==e||!t.isConnected||!r)&&(a=requestAnimationFrame(c),!(d-s<(l?100:32)))){s=d;var p=t.clientWidth,m=t.clientHeight,v=Math.min(window.devicePixelRatio||1,2);(n.width!==Math.round(p*v)||n.height!==Math.round(m*v))&&(n.width=Math.round(p*v),n.height=Math.round(m*v)),r.setTransform(v,0,0,v,0,0),r.clearRect(0,0,p,m);var y=getComputedStyle(t),M=r.createLinearGradient(0,0,p,0);M.addColorStop(0,y.getPropertyValue("--brand-green").trim()||y.color),M.addColorStop(.5,y.getPropertyValue("--brand-blue").trim()||y.color),M.addColorStop(1,y.getPropertyValue("--brand-green").trim()||y.color),r.fillStyle=M;for(var E=u.audioSignal,P=E?E.levels:[],k=E?Date.now()-E.updatedAt:0,A=Math.max(0,1-Math.max(0,k-250)/900),h=Math.max(2,Math.floor(p/4)),b=Math.round(Math.min(160,Math.max(80,h))*1.25),R=l?0:Math.min(1,k/20),S=0;S<h;S++){var _=P.length-b+S/(h-1)*(b-1)+R,N=Math.floor(_),Le=_-N,J=P[N]||0,Te=P[Math.min(N+1,P.length-1)]||0,$=(J+(Te-J)*Le)*A,O=i[S]||0,X=l?$:O+($-O)*($>O?.5:.24);i[S]=X;for(var G=1+X*(m*.46-1),Re=Math.min(1,(S+1)/8,(h-S)/8),Z=0;Z<=m*.48;Z+=3.2){var Ye=Math.exp(-Math.pow(Z/G,2)*1.7);if(!(Ye<.035)){var Rt=.35+Ye*.65;r.globalAlpha=(.12+Ye*.78)*Re,r.beginPath(),r.arc((S+.5)*p/h,m/2+Z,Rt,0,Math.PI*2),r.fill(),Z&&(r.beginPath(),r.arc((S+.5)*p/h,m/2-Z,Rt,0,Math.PI*2),r.fill())}}}r.globalAlpha=1}}return{element:t,update:function(d){t.hidden=!d,d&&a===null&&(a=requestAnimationFrame(c)),!d&&a!==null&&(cancelAnimationFrame(a),a=null,i=[])}}}function ta(e,t,n){var r=document.getElementById(e),a=document.getElementById(t),s=document.getElementById(n);if(!r||!a||!s||r.dataset.speechBound)return;var i=document.getElementById(e==="stt-btn"?"input-row":"home-mate-chat-composer")||s,l=document.getElementById(e==="stt-btn"?"input-bottom":"home-mate-chat-composer")||i;r.addEventListener("click",Fe),r.dataset.speechBound="true",r.classList.add("stt-button");var c=document.createElement("span");c.className="stt-controls",r.before(c),c.appendChild(r);var d=document.createElement("button");d.type="button",d.id=e+"-picker",d.className="stt-picker-toggle",d.innerHTML=ee("chevron-down"),d.setAttribute("aria-label","Choose voice model"),d.setAttribute("aria-haspopup","dialog"),d.setAttribute("aria-expanded","false"),d.title="Choose voice model",c.appendChild(d),d.addEventListener("click",function(){Fe(),Be(d)});var u=document.createElement("div");u.className="stt-progress",u.hidden=!0;var p=document.createElement("span");p.id=e+"-status",p.className="stt-status",p.setAttribute("role","status");var m=document.createElement("span");m.className="stt-timer",m.setAttribute("aria-hidden","true");var v=document.createElement("button");v.type="button",v.innerHTML=ee("x"),v.className="stt-cancel",v.title="Cancel voice input",v.setAttribute("aria-label","Cancel voice input"),v.addEventListener("click",function(){te(),o.set({speechRetry:null})});var y=ea(e),M=document.createElement("button");M.type="button",M.textContent="Retry",M.addEventListener("click",sr);var E=document.createElement("a");E.textContent="Provider account",E.target="_blank",E.rel="noopener noreferrer";var P=document.createElement("button");P.type="button",P.textContent="Dismiss",P.addEventListener("click",function(){nr(e,"")}),u.append(v,y.element,m,p,M,E,P),i.prepend(u),r.setAttribute("aria-describedby",p.id),r.addEventListener("click",function(){var h=o.get("speechActive");if(h&&h.id===e){h.model&&h.phase==="recording"?ir():te();return}var b=et(),R=o.get("speechSettings");if(b.provider==="browser"&&!Xe().available){Be(d);return}if(b.provider!=="browser"&&(!R||R.configured.indexOf(b.provider)<0)){Be(d);return}b.provider==="browser"?rr(e,a):ar(e,a,b)}),a.addEventListener("beforeinput",function(){var h=o.get("speechActive");h&&h.id===e&&te("Voice input stopped so you can edit your draft."),o.set({speechRetry:null})}),a.addEventListener("input",function(){var h=o.get("speechActive");h&&h.id===e&&!h.writing&&te()});function k(){var h=o.get("speechActive"),b=!!h&&h.id===e,R=et(),S=br(R.provider),_=R.provider==="browser"?o.get("speechBrowserIdentity"):null,N=b&&h.model&&h.phase!=="recording",Le=b&&!!h.autoSend;i.classList.toggle("stt-recording",b),u.classList.toggle("stt-auto-send",Le),u.classList.toggle("stt-progress-active",b),u.classList.toggle("stt-progress-pending",!!N);var J=b?l:i;(u.parentElement!==J||u!==J.firstElementChild)&&J.prepend(u),y.update(b?h:null),d.hidden=b,r.disabled=a.disabled||a.readOnly||!o.get("speechSettings"),d.disabled=a.disabled||a.readOnly||b,r.classList.toggle("stt-active",b),r.setAttribute("aria-pressed",String(b));var Te=b?Le?"Cancel pending voice send":N?"Cancel voice input":R.mode==="recorded"?"Stop and transcribe":"Stop voice input":"Start voice input";r.setAttribute("aria-label",Te+" \xB7 "+(S?S.name+" \xB7 ":"")+R.name),r.title=Te+" \xB7 "+R.name;var $=[b,N,S&&S.id,_&&_.id].join(":");if(r.dataset.speechIcon!==$){if(r.dataset.speechIcon=$,r.innerHTML=ee(b?N?"x":"square":"mic"),!b&&(S||_&&_.icon)){var O=document.createElement("img");O.className="stt-vendor-badge",O.src=S?S.icon:_.icon,O.alt="",r.appendChild(O)}D()}var X=(o.get("speechStatuses")||{})[e]||"",G=(o.get("speechErrors")||{})[e];u.classList.toggle("stt-progress-error",!!G),p.setAttribute("role",G?"alert":"status"),P.hidden=!G,E.hidden=!G||!S,S&&(E.href=S.url),R.provider==="browser"&&!tr()&&(X="Browser voice input is unavailable. Choose a connected speech provider or type your message."),window.isSecureContext||(X="Voice input requires a secure HTTPS connection."),p.textContent=X,m.textContent=b&&h.startTime?Math.floor((Date.now()-h.startTime)/6e4)+":"+String(Math.floor((Date.now()-h.startTime)/1e3)%60).padStart(2,"0"):"",v.hidden=!b;var Re=o.get("speechRetry");M.hidden=!Re||Re.id!==e,u.hidden=!b&&!G&&M.hidden}o.subscribe(k);var A=new MutationObserver(k);A.observe(a,{attributes:!0,attributeFilter:["disabled","readonly"]}),k()}function Fe(){o.set({speechBrowserIdentity:Xe()})}function na(){Fe(),window.addEventListener("focus",Fe),or(),yr(),ta("stt-btn","input","input-wrapper"),ta("home-stt-btn","home-mate-chat-input","home-mate-chat-composer-frame"),Ae(),window.addEventListener("focus",Ae);try{window.top.document.addEventListener("clay:speech-settings-saved",Ae)}catch{}}var g=null,T=null,Se=null;function we(){return document.body.dataset.myDisplayName||"Clay user"}function se(e){if(g){var t=g.querySelector("#account-ai-section");t&&wr(t),g.remove(),g=null,T.setAttribute("aria-expanded","false"),T.setAttribute("aria-label","Open account menu for "+we()),document.removeEventListener("pointerdown",ra),document.removeEventListener("focusin",oa),document.removeEventListener("keydown",aa),window.removeEventListener("resize",ie),o.set({defaultAiInlineEditing:!1}),e&&Se&&document.contains(Se)&&Se.focus({preventScroll:!0}),Se=null}}function dt(e){return e&&e.closest&&e.closest(".avatar-positioner-overlay")}function ra(e){!g||g.contains(e.target)||T.contains(e.target)||dt(e.target)||se(!1)}function oa(e){!g||g.contains(e.target)||T.contains(e.target)||dt(e.target)||se(!1)}function aa(e){e.key==="Escape"&&(dt(e.target)||document.querySelector(".avatar-positioner-overlay")||(e.preventDefault(),e.stopPropagation(),se(!0)))}function ie(){if(!(!g||!T)){var e=T.getBoundingClientRect(),t=Math.min(280,window.innerWidth-24),n=Math.max(12,Math.min(window.innerWidth-t-12,e.left));g.style.width=t+"px",g.style.left=n+"px",g.style.top=Math.max(12,e.top-g.offsetHeight-8)+"px"}}function st(e){var t=g&&g.querySelector(".account-identity-copy");t&&(t.innerHTML='<button type="button" id="account-name-edit" class="account-name-display"><span></span><i data-lucide="pencil" aria-hidden="true"></i></button><small>Personal account</small>',t.querySelector("span").textContent=we(),t.querySelector("#account-name-edit").addEventListener("click",gi),window.lucide&&window.lucide.createIcons({nodes:[t]}),e&&t.querySelector("#account-name-edit").focus())}function gi(){var e=g&&g.querySelector(".account-identity-copy");if(e){var t=document.createElement("input");t.id="account-profile-name",t.setAttribute("aria-label","Display name"),t.className="account-name-input",t.type="text",t.maxLength=50,t.autocomplete="name",t.value=o.get("accountNameDraft")===void 0?Ze().name||"":o.get("accountNameDraft"),t.addEventListener("input",function(){o.set({accountNameDraft:t.value})}),e.innerHTML="",e.appendChild(t);var n=document.createElement("small");n.textContent="Enter to save \xB7 Escape to cancel",e.appendChild(n),t.addEventListener("keydown",function(r){r.key==="Enter"?(r.preventDefault(),t.disabled=!0,n.textContent="Saving\u2026",lr({name:t.value.trim()}).then(function(){o.set({accountNameDraft:void 0}),st(!0)}).catch(function(a){t.disabled=!1,n.textContent=a.message,t.focus()})):r.key==="Escape"&&(r.preventDefault(),o.set({accountNameDraft:void 0}),st(!0)),r.stopPropagation()}),t.focus(),t.select()}}function hi(){var e=g&&g.querySelector("#account-avatar-editor");e&&(e.hidden=!e.hidden,e.hidden||e.querySelector("#account-avatar-upload").focus(),ie())}function vi(){var e=g.querySelector("#account-avatar-edit"),t=g.querySelector("#account-avatar-editor"),n=t.querySelector("#account-avatar-upload"),r=t.querySelector("#account-avatar-file"),a=t.querySelector("#account-avatar-generate");e.addEventListener("click",function(s){s.stopPropagation(),hi()}),t.addEventListener("click",function(s){s.stopPropagation()}),n.addEventListener("click",function(){r.click()}),r.addEventListener("change",function(){var s=r.files&&r.files[0];if(s){var i=new Image,l=URL.createObjectURL(s);i.onload=function(){ur(i,l,function(c){URL.revokeObjectURL(l),cr(c).then(function(){t.hidden=!0}).catch(function(){t.dataset.error="true"})})},i.src=l}}),a.addEventListener("click",function(){dr(),t.hidden=!0})}function bi(){g=document.createElement("div"),g.id="account-popover",g.className="account-popover",g.setAttribute("role","dialog"),g.setAttribute("aria-label","Account");var e=Ze(),t=document.createElement("div");t.className="account-menu-identity",t.innerHTML='<button type="button" id="account-avatar-edit" class="account-avatar-edit" aria-label="Edit avatar"><img src="'+(document.body.dataset.myAvatarUrl||"")+'" alt=""></button><div class="account-identity-copy"></div><button type="button" class="account-settings-button" aria-label="User Settings" title="User Settings"><i data-lucide="settings" aria-hidden="true"></i></button>',t.querySelector("#account-avatar-edit img").alt=e.name||"Clay user";var n=document.createElement("div");n.id="account-avatar-editor",n.className="account-avatar-editor",n.hidden=!0,n.innerHTML='<button type="button" id="account-avatar-upload">Upload photo</button><button type="button" id="account-avatar-generate">Generate avatar</button><input id="account-avatar-file" type="file" accept="image/*">',g.appendChild(t),g.appendChild(n);var r=document.createElement("section");r.id="account-ai-section",r.className="account-inline-section account-ai-section",r.setAttribute("aria-label","Default AI"),g.appendChild(r),Sr(r),t.querySelector(".account-settings-button").addEventListener("click",yi),document.body.appendChild(g),st(),vi(),lt(),window.lucide&&window.lucide.createIcons({nodes:[g]}),ie()}function lt(){var e=document.getElementById("cursor-share-toggle");if(e){var t=o.get("cursorSharingHydrated")===!0,n=t&&o.get("cursorSharingEnabled")===!0,r=o.get("cursorSharingPending")!==null&&o.get("cursorSharingPending")!==void 0,a=o.get("connected")!==!1,s=o.get("cursorSharingError"),i=!!s&&!t&&a,l=t&&!n&&!r&&!s&&a;e.hidden=o.get("isMultiUserMode")!==!0,e.removeAttribute("role"),e.removeAttribute("aria-checked"),e.setAttribute("aria-pressed",n?"true":"false"),e.classList.toggle("on",n),e.classList.toggle("off",l),e.classList.toggle("pending",r),e.disabled=r||!a||!t&&!i;var c=r?"waiting":a?s?i?"error; activate to retry":"error":t?n?"on":"off":"unavailable":"offline";e.setAttribute("aria-label","Cursor sharing "+c);var d=r?"Cursor sharing is waiting for confirmation.":a?s?i?"Cursor sharing is unavailable. Click to retry.":"Cursor sharing is unavailable.":t?n?"Your cursor is visible to others. Click to stop sharing.":"Cursor sharing is off. Click to share your cursor.":"Cursor sharing is unavailable.":"Cursor sharing is offline.";Bn(e,d)}}function yi(e){e.stopPropagation(),se(!0),Cr()}function Si(e){if(e.stopPropagation(),!e.currentTarget.disabled){if(o.get("cursorSharingError")&&o.get("cursorSharingHydrated")!==!0){Dr();return}Rr(o.get("cursorSharingEnabled")!==!0)}}function wi(){var e=g&&g.querySelector("#account-ai-section select");e&&e.focus({preventScroll:!0})}function ki(){g||ia(),o.set({defaultAiInlineEditing:!0}),wi()}function ia(){if(g){se(!0);return}Se=document.activeElement,bi(),T.setAttribute("aria-expanded","true"),T.setAttribute("aria-label","Close account menu for "+we()),document.addEventListener("pointerdown",ra),document.addEventListener("focusin",oa),document.addEventListener("keydown",aa),window.addEventListener("resize",ie)}function sa(){if(T=document.getElementById("user-account-trigger"),!!T){T.addEventListener("click",ia),document.addEventListener("clay:open-account-default-ai",ki);var e=document.getElementById("cursor-share-toggle");e&&e.addEventListener("click",Si),lt(),T.setAttribute("aria-label","Open account menu for "+we()),o.subscribe(function(t,n){t.myUserId!==n.myUserId&&t.accountNameDraft!==void 0&&o.set({accountNameDraft:void 0}),(t.myUserId!==n.myUserId||t.connected===!1&&n.connected!==!1)&&se(!1),lt(),g&&ie()}),document.addEventListener("clay:profile-updated",function(){if(g){var t=g.querySelector(".account-name-display span");t&&(t.textContent=we());var n=g.querySelector("#account-avatar-edit img");n&&(n.src=document.body.dataset.myAvatarUrl||n.src)}}),window.addEventListener("resize",ie)}}var Ci=[{id:"file-browser-btn",icon:"folder-tree",label:"File browser"},{id:"terminal-sidebar-btn",icon:"square-terminal",label:"Terminal",countId:"terminal-sidebar-count"},{id:"sticky-notes-sidebar-btn",icon:"sticky-note",label:"Sticky Notes",countId:"sticky-notes-sidebar-count"},{id:"project-logs-btn",icon:"notebook-tabs",label:"Logs",countId:"project-logs-count"},{id:"mcp-btn",icon:"cable",label:"MCP / Skills",countId:"mcp-sidebar-count"},{id:"scheduler-btn",icon:"calendar-clock",label:"Scheduled"},{id:"issues-btn",icon:"circle-dot",label:"Issues"},{id:"shared-browser-btn",icon:"globe",label:"Browser"}],Mi=[{id:"mate-memory-btn",icon:"brain",label:"Memory",countId:"mate-memory-count"},{id:"mate-knowledge-btn",icon:"book-open",label:"Knowledge",countId:"mate-knowledge-count"},{id:"mate-sticky-notes-btn",icon:"sticky-note",label:"Sticky Notes"},{id:"mate-debates-btn",icon:"messages-square",label:"Debates"},{id:"mate-mcp-btn",icon:"cable",label:"MCP / Skills",countId:"mate-mcp-sidebar-count"}],de={session:{tools:Ci,fixedTools:[{id:"you-button",icon:"user-round",label:"Me",countId:"me-unread-badge",fixed:!0,scope:"clay"}],activeContainerId:"session-actions",hiddenSectionId:"session-actions-hidden"},mate:{tools:Mi,activeContainerId:"mate-sidebar-tools",hiddenSectionId:"mate-sidebar-tools-hidden"}},Ei={"skills-btn":"mcp-btn"},Pi={"mate-skills-btn":"mate-mcp-btn","mate-debate-btn":"mate-debates-btn"},la=["git-sidebar-btn","loop-tool-btn","debates-btn"];function le(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}function ua(e,t){var n=t&&t.order||[],r=t&&t.hidden||[],a={order:n.slice(),hidden:r.slice(),migrated:!1};if(e!=="session"&&e!=="mate")return a;for(var s=e==="mate"?Pi:Ei,i=Object.keys(s),l=0;l<i.length;l++){var c=i[l],d=s[c],u=le(a.order,c)!==-1,p=le(a.hidden,c)!==-1;if(!(!u&&!p)){var m=le(a.order,d)!==-1||le(a.hidden,d)!==-1;a.order=ca(a.order,c,d,m),a.hidden=ca(a.hidden,c,d,m),a.migrated=!0}}if(e!=="session")return a;for(var v=0;v<la.length;v++){var y=la[v];le(a.order,y)===-1&&le(a.hidden,y)===-1||(a.order=da(a.order,y),a.hidden=da(a.hidden,y),a.migrated=!0)}return a}function da(e,t){for(var n=[],r=0;r<e.length;r++)e[r]!==t&&n.push(e[r]);return n}function ca(e,t,n,r){for(var a=[],s={},i=0;i<e.length;i++){var l=e[i];if(l===t){if(r)continue;l=n}s[l]||(s[l]=!0,a.push(l))}return a}var He={},q=null,ce=null;function ma(){for(var e in de)xi(e);Li(),D()}function xi(e){var t=de[e],n=document.getElementById(t.activeContainerId);if(n){(t.fixedTools||[]).forEach(function(a){n.appendChild(fa(a,e))});for(var r=0;r<t.tools.length;r++)n.appendChild(fa(t.tools[r],e));n.addEventListener("dragover",function(a){if(!(ce!==e||!q)){a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect="move");var s=Ii(n,a.clientX,a.clientY);s==null?(q.parentNode!==n||q.nextSibling)&&n.appendChild(q):s!==q&&n.insertBefore(q,s)}}),n.addEventListener("drop",function(a){ce===e&&a.preventDefault()})}}function fa(e,t){var n=document.createElement("button");n.id=e.id,n.type="button",n.className="palette-tile",n.title=e.label,n.setAttribute("aria-label",e.label),n.dataset.toolId=e.id,n.dataset.palette=t,n.draggable=!0,e.fixed&&(n.draggable=!1,n.dataset.fixed="true"),e.scope&&(n.dataset.scope=e.scope),e.id==="you-button"&&(n.classList.add("you-button"),n.setAttribute("aria-pressed","false"));var r=document.createElement("i");r.setAttribute("data-lucide",e.icon),n.appendChild(r);var a=document.createElement("span");if(a.className="tool-btn-label",a.textContent=e.label,n.appendChild(a),e.countId){var s=document.createElement("span");s.id=e.countId,s.className="sidebar-badge hidden",e.id==="you-button"&&(s.className="sidebar-badge me-unread-badge",s.hidden=!0),n.appendChild(s)}return n.addEventListener("dragstart",function(i){if(e.fixed){i.preventDefault();return}var l=n.parentNode;if(!l||l.id!==de[t].activeContainerId){i.preventDefault();return}q=n,ce=t,i.dataTransfer.effectAllowed="move";try{i.dataTransfer.setData("text/plain",e.id)}catch{}n.classList.add("dragging")}),n.addEventListener("dragend",function(){n.classList.remove("dragging"),ce&&Ti(ce),q=null,ce=null}),n}function Ii(e,t,n){for(var r=Array.prototype.slice.call(e.querySelectorAll("[data-tool-id]:not(.dragging)")),a=null,s=Number.POSITIVE_INFINITY,i=0;i<r.length;i++)if(r[i].dataset.fixed!=="true"){var l=r[i].getBoundingClientRect(),c=n-(l.top+l.height/2),d=t-(l.left+l.width/2),u=Math.abs(c)*2+Math.abs(d),p=c<-l.height/2||Math.abs(c)<=l.height/2&&d<0;p&&u<s&&(s=u,a=r[i])}return a}function Li(){fetch("/api/user/tool-palettes",{credentials:"same-origin"}).then(function(e){return e.ok?e.json():null}).then(function(e){e&&(pa("session",e.session||null),pa("mate",e.mate||null))}).catch(function(){})}function pa(e,t){if(!t)return;var n=de[e];if(!n)return;var r=document.getElementById(n.activeContainerId);if(!r)return;var a=ua(e,t),s={};function i(v){if(!s[v]){var y=document.getElementById(v);!y||y.dataset.fixed==="true"||(r.appendChild(y),s[v]=!0)}}for(var l={},c=0;c<a.hidden.length;c++)l[a.hidden[c]]=!0;for(var d=0;d<a.order.length;d++)l[a.order[d]]||i(a.order[d]);for(var u=0;u<n.tools.length;u++)l[n.tools[u].id]||i(n.tools[u].id);for(var p=0;p<a.hidden.length;p++)i(a.hidden[p]);for(var m=0;m<n.tools.length;m++)i(n.tools[m].id)}function Ti(e){He[e]&&clearTimeout(He[e]),He[e]=setTimeout(function(){He[e]=null,Ri(e)},250)}function Ri(e){var t=de[e];if(t){var n=document.getElementById(t.activeContainerId);if(n){for(var r=[],a=n.querySelectorAll("[data-tool-id]"),s=0;s<a.length;s++)a[s].dataset.fixed!=="true"&&r.push(a[s].dataset.toolId);fetch("/api/user/tool-palettes",{method:"PUT",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({palette:e,order:r,hidden:[]})}).catch(function(){})}}}var ke=[],ct=[],I=null,K=null,ut=null,U=!1,Ce="project",V=0,C=[];function ga(e){e!=="project"&&e!=="mate"||(U&&W(!1),ft(e))}function ba(){Di(),K=I.querySelector(".cmd-palette-results"),ut=I.querySelector(".project-switcher-header");var e=o.get("currentSlug");e&&(ke=[e]);var t=o.get("dmTargetUser");t&&t.isMate&&t.id&&(ct=[t.id]),o.subscribe(function(d,u){d.currentSlug&&d.currentSlug!==u.currentSlug&&(va(ke,d.currentSlug),ke=ke);var p=ha(d.dmTargetUser),m=ha(u.dmTargetUser);p&&p!==m&&va(ct,p)});var n=I.querySelector(".cmd-palette-backdrop");n&&n.addEventListener("click",function(){W(!1)}),document.addEventListener("keydown",Ai,!0),document.addEventListener("keyup",Bi,!0),window.addEventListener("blur",function(){U&&W(!1)});var r=/Mac|iPhone|iPod|iPad/i.test(navigator.platform),a=r?"\u2318E":"Ctrl+E",s=r?"\u2318M":"Ctrl+M",i=document.getElementById("icon-strip-hint-project"),l=document.getElementById("icon-strip-hint-mate");i&&(i.textContent=a,i.title="Switch project ("+a+")",i.addEventListener("click",function(){ga("project")})),l&&(l.textContent=s,l.title="Switch mate ("+s+")",l.addEventListener("click",function(){ga("mate")}));function c(){if(l){var d=o.get("cachedMatesList")||[];l.classList.toggle("hidden",d.length===0)}}c(),o.subscribe(function(d,u){(d.cachedMatesList!==u.cachedMatesList||d.projectMateDmsEnabled!==u.projectMateDmsEnabled)&&c()})}function Di(){if(I=document.getElementById("project-switcher"),!I){var e=/Mac|iPhone|iPod|iPad/i.test(navigator.platform),t=e?"<kbd>\u2318</kbd>":"<kbd>Ctrl</kbd>";I=document.createElement("div"),I.id="project-switcher",I.className="cmd-palette hidden project-switcher",I.innerHTML='<div class="cmd-palette-backdrop"></div><div class="cmd-palette-dialog project-switcher-dialog"><div class="project-switcher-header">Switch project</div><div class="cmd-palette-results"></div><div class="cmd-palette-footer project-switcher-footer"><span class="project-switcher-shortcuts">'+t+'<kbd class="proj-next-key">E</kbd> next \xB7 <kbd>\u21E7</kbd>'+t+'<kbd class="proj-prev-key">E</kbd> prev \xB7 <kbd>\u23CE</kbd> select \xB7 <kbd>Esc</kbd> cancel</span></div></div>',document.body.appendChild(I)}}function ha(e){return e&&e.isMate&&e.id?e.id:null}function va(e,t){var n=e.indexOf(t);n!==-1&&e.splice(n,1),e.unshift(t)}function Ai(e){if(e.key){var t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase();if(t&&(n==="e"||n==="m")){var r=n==="e"?"project":"mate";e.preventDefault(),e.stopPropagation(),U?Ce!==r?ft(r):e.shiftKey?qe(-1):qe(1):ft(r);return}if(U){if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),W(!1);return}if(e.key==="Enter"){e.preventDefault(),e.stopPropagation(),W(!0);return}if(e.key==="ArrowRight"||e.key==="ArrowDown"){e.preventDefault(),qe(1);return}if(e.key==="ArrowLeft"||e.key==="ArrowUp"){e.preventDefault(),qe(-1);return}}}}function Bi(e){U&&(e.key==="Meta"||e.key==="Control")&&W(!0)}function ft(e){if(Ce=e,C=_i(e),C.length===0){U&&W(!1);return}ut&&(ut.textContent=e==="mate"?"Switch mate":"Switch project"),ji(e),Fi(),V=Ui(),pt(),I.classList.remove("hidden"),U=!0,D(),Ue(K)}function ji(e){var t=I.querySelector(".proj-next-key"),n=I.querySelector(".proj-prev-key"),r=e==="mate"?"M":"E";t&&(t.textContent=r),n&&(n.textContent=r)}function Ui(){if(C.length===0)return 0;for(var e=Ce==="mate"?ct:ke,t=ya(),n=0;n<e.length;n++){var r=e[n];if(r!==t){for(var a=0;a<C.length;a++)if(C[a].key===r&&!C[a].disabled)return a}}for(var s=0;s<C.length;s++)if(!C[s].disabled&&C[s].key!==t)return s;for(var i=0;i<C.length;i++)if(!C[i].disabled)return i;return 0}function ya(){if(Ce==="mate"){var e=tt(o.snap());return e?e.id:null}return o.get("currentSlug")}function _i(e){return e==="mate"?Oi():Ni()}function Ni(){var e=(ge()||[]).filter(function(t){return!t.isMate});return e.map(function(t){var n=eo(t);return{key:t.slug,title:t.title||t.project||t.slug,icon:t.icon||null,fallbackIcon:"folder",isCurrent:t.slug===o.get("currentSlug"),external:n,disabled:!1,disabledReason:null}})}function Oi(){var e=o.get("cachedMatesList")||[],t=tt(o.snap()),n=t?t.id:null;return e.map(function(r){return{key:r.id,title:r.displayName||r.name||r.id,icon:null,avatarUrl:Nt(r,88),fallbackIcon:"user",isCurrent:r.id===n,disabled:!1,disabledReason:null}})}function W(e){if(U&&(U=!1,I.classList.add("hidden"),!!e)){var t=C[V];!t||t.disabled||(Ce==="mate"?t.key!==ya()&&ao(t.key):t.key!==o.get("currentSlug")&&je(t.key))}}function qe(e){if(C.length!==0){for(var t=e>0?1:-1,n=V,r=0;r<C.length;r++)if(n=(n+t+C.length)%C.length,!C[n].disabled){V=n,pt();return}}}function Fi(){if(K){K.innerHTML="";for(var e=0;e<C.length;e++)K.appendChild(Hi(C[e],e))}}function Hi(e,t){var n=document.createElement("button");n.type="button",n.className="cmd-palette-item project-switcher-item",e.disabled&&n.classList.add("disabled"),e.disabled&&e.disabledReason&&(n.title=e.disabledReason),e.external&&(n.title=to(e.title)),n.dataset.index=String(t);var r=document.createElement("div");if(r.className="cmd-palette-item-icon",e.icon)r.textContent=e.icon;else if(e.avatarUrl){var a=document.createElement("img");a.src=e.avatarUrl,a.alt="",a.className="project-switcher-avatar",r.appendChild(a)}else{var s=document.createElement("i");s.setAttribute("data-lucide",e.fallbackIcon||"folder"),r.appendChild(s)}e.external&&no(r,"project-switcher-external-badge"),n.appendChild(r);var i=document.createElement("div");i.className="cmd-palette-item-body";var l=document.createElement("div");l.className="cmd-palette-item-title-row";var c=document.createElement("span");if(c.className="cmd-palette-item-title",c.textContent=e.title,l.appendChild(c),e.isCurrent){var d=document.createElement("span");d.className="project-switcher-current",d.textContent="current",l.appendChild(d)}if(e.disabled&&e.disabledReason){var u=document.createElement("span");u.className="project-switcher-disabled-reason",u.textContent=e.disabledReason,l.appendChild(u)}return i.appendChild(l),n.appendChild(i),n.addEventListener("mouseenter",function(){e.disabled||(V=t,pt())}),n.addEventListener("click",function(){e.disabled||(V=t,W(!0))}),n}function pt(){if(K){for(var e=K.querySelectorAll(".cmd-palette-item"),t=0;t<e.length;t++)e[t].classList.toggle("active",t===V);var n=e[V];n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest"})}}var qi=/^[a-zA-Z0-9_-]{1,120}$/;function mt(){return Array.prototype.filter.call(document.querySelectorAll("iframe"),function(e){try{var t=new URL(e.src,window.location.href);return t.origin===window.location.origin&&t.searchParams.get("pane")==="1"}catch{return!1}})}function gt(e){var t=Ro();try{e.contentWindow&&e.contentWindow.postMessage({type:"clay-appearance",snapshot:t},window.location.origin)}catch{}}function Sa(e){return typeof e=="string"&&qi.test(e)}function ht(e){return e===null||Sa(e)}function Vi(e){var t=e&&typeof e=="object"?e.preference:null;return!t||typeof t!="object"||!Sa(e.themeId)||e.userId!==null&&(typeof e.userId!="string"||!e.userId||e.userId.length>200)||typeof t.configured!="boolean"||t.mode!==null&&t.mode!=="light"&&t.mode!=="dark"?!1:ht(t.theme)&&ht(t.lightTheme)&&ht(t.darkTheme)}function wa(){if(o.get("paneMode")){if(window.parent===window)return;window.addEventListener("message",function(e){if(!(e.origin!==window.location.origin||e.source!==window.parent)){var t=e.data;if(!(!t||t.type!=="clay-appearance"||!Vi(t.snapshot))){var n=o.get("myUserId")||null;n!==null&&t.snapshot.userId!==n||Do(t.snapshot)}}});return}To(function(){mt().forEach(gt)}),o.subscribe(function(e,t){e.myUserId!==t.myUserId&&mt().forEach(gt)}),document.addEventListener("load",function(e){e.target&&e.target.tagName==="IFRAME"&&mt().indexOf(e.target)>=0&>(e.target)},!0)}var Wi=500,ka=10,ue=null,vt=0,bt=0,Me=!1,Ca=null;function Ve(){ue&&(clearTimeout(ue),ue=null)}function Ma(){"ontouchstart"in window&&(document.addEventListener("touchstart",function(e){if(e.touches.length!==1){Ve();return}var t=e.touches[0];vt=t.clientX,bt=t.clientY,Me=!1,Ca=e.target,ue=setTimeout(function(){ue=null,Me=!0,navigator.vibrate&&navigator.vibrate(30);var n=new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:vt,clientY:bt});Ca.dispatchEvent(n)},Wi)},{passive:!0}),document.addEventListener("touchmove",function(e){if(ue){var t=e.touches[0],n=t.clientX-vt,r=t.clientY-bt;n*n+r*r>ka*ka&&Ve()}},{passive:!0}),document.addEventListener("touchend",function(e){Ve(),Me&&(Me=!1,e.preventDefault())},{passive:!1}),document.addEventListener("touchcancel",function(){Ve(),Me=!1},{passive:!0}))}var Ea=!1,Pa=!1;function yt(e){return/^\/p\/[a-z0-9_-]+(?:\/|$)/.test(e||"")}function zi(e){return e?e.paneMode||yt(e.pathname)||e.currentSlug?"project":e.projectsLoaded!==!0?"wait":"projects":"wait"}function xa(){document.body.classList.remove("home-surface-boot-pending");var e=document.getElementById("connect-overlay");e&&o.get("connected")&&e.classList.add("hidden")}function Gi(e){return e?"/p/"+e+"/":null}function Ia(e){if(!Pa){var t=zi({surfaceLoaded:e.homeSurfaceLoaded,projectsLoaded:e.projectListLoaded,dockLoaded:e.homeDockPreferenceLoaded,surface:e.homePrimarySurface,currentSlug:e.currentSlug,pathname:location.pathname,paneMode:e.paneMode});if(t!=="wait"){if(Pa=!0,t==="project"){if(!yt(location.pathname)){var n=Gi(e.currentSlug);n&&history.replaceState(null,"",n)}o.set({homeSurfaceBootResolved:!0}),xa();var r=document.getElementById("input");r&&!r.disabled&&r.focus({preventScroll:!0});return}o.set({homeSurfaceBootResolved:!0,projectsHubRestoreRequested:!0}),xa()}}}function La(){if(!Ea){if(Ea=!0,!yt(location.pathname)&&!o.get("paneMode")){document.body.classList.add("home-surface-boot-pending");var e=document.getElementById("connect-overlay-msg");e&&(e.textContent="Restoring your workspace\u2026")}o.subscribe(function(t){Ia(t)}),Ia(o.snap())}}var Ki=3600*1e3,Yi="(max-width: 768px)",St=null,wt=!1;function Qi(e){if(typeof e!="number"||!isFinite(e)||e<0)return"";if(e=Math.floor(e),e<1e3)return String(e);for(var t=[[1e6,"m"],[1e3,"k"]],n=0;n<t.length;n++)if(e>=t[n][0]){var r=Math.floor(e/t[n][0]*10)/10;return(r%1===0?String(r):r.toFixed(1))+t[n][1]}return String(e)}function Ra(){var e=o.get("githubStarCount"),t=document.getElementById("github-star-count"),n=document.getElementById("github-star-link");if(!(!t||!n)){var r=typeof e=="number"?Qi(e):"";t.textContent=r,t.classList.toggle("hidden",!r),n.setAttribute("aria-label",r?"Star Clay on GitHub, "+e+" stars":"Star Clay on GitHub")}}function Ji(){return!!(window.matchMedia&&window.matchMedia(Yi).matches)}function Ta(){return wt||Ji()?Promise.resolve():(wt=!0,fetch("/api/github-stars",{credentials:"same-origin"}).then(function(e){return e.ok?e.json():null}).then(function(e){e&&typeof e.stars=="number"&&(o.set({githubStarCount:e.stars}),Ra())}).catch(function(){}).then(function(){wt=!1}))}function Da(){document.getElementById("github-star")&&(Ra(),Ta(),St&&clearInterval(St),St=setInterval(Ta,Ki))}function ja(){o.subscribe(function(e,t){if(e.sessionOriginId!==t.sessionOriginId||e.currentSlug!==t.currentSlug){o.set({activeBackgroundTasks:[],backgroundTaskCatalog:[]});return}e.backgroundTaskViewer!==t.backgroundTaskViewer&&document.querySelectorAll("[data-background-task]").forEach(function(n){var r=e.backgroundTaskViewer;n.setAttribute("aria-expanded",String(!!r&&n.dataset.backgroundTask===r.taskId))}),(e.activeBackgroundTasks!==t.activeBackgroundTasks||e.backgroundTaskCatalog!==t.backgroundTaskCatalog)&&Ba()}),Ba()}function $i(e,t){if(typeof e!="number"||!isFinite(e)||e<=0)return"";var n=typeof t=="number"?t:Date.now(),r=Math.floor((n-e)/1e3);if(r<0&&(r=0),r<60)return r+"s";var a=Math.floor(r/60),s=r%60;if(a<60)return a+"m "+Aa(s)+"s";var i=Math.floor(a/60);return i+"h "+Aa(a%60)+"m"}function Aa(e){return e<10?"0"+e:String(e)}function Xi(e){return!!(e&&e.ambient===!0)}function Zi(e){for(var t=[],n=[],r=Array.isArray(e)?e:[],a=0;a<r.length;a++)r[a]&&(Xi(r[a])?n.push(r[a]):t.push(r[a]));return{user:t,ambient:n}}function Ba(){var e=document.getElementById("background-tasks-bar");e&&e.remove();var t=Zi(o.get("backgroundTaskCatalog")||o.get("activeBackgroundTasks")||[]),n=t.user.length?t.user.concat(t.ambient):[],r=document.getElementById("background-task-tabs");if(!n.length){r&&r.remove();return}var a=document.getElementById("messages");if(a){r||(r=document.createElement("div"),r.id="background-task-tabs",r.className="split-view-workers background-task-tabs",r.setAttribute("aria-label","Background tasks"),a.parentNode.insertBefore(r,a));var s=JSON.stringify(n.map(function(i){return[i.task_id,i.run_id,i.active,i.description]}));r.dataset.signature!==s&&(r.dataset.signature=s,r.textContent="",n.forEach(function(i){var l=document.createElement("span");l.className="split-view-worker-pill"+(i.ambient?" background-task-ambient":"");var c=document.createElement("button");c.type="button",c.className="split-view-worker-chip",c.dataset.backgroundTask=i.task_id,Un(c,$e(i)),i.preview&&jn($e(i),i.preview,!1),c.title=(i.ambient?"Housekeeping \xB7 ":"")+(i.description||"Background task")+(i.started_at?" \xB7 "+$i(i.started_at):"")+(i.active===!1?" \xB7 Finished":" \xB7 Running"),c.setAttribute("aria-haspopup","dialog");var d=o.get("backgroundTaskViewer");c.setAttribute("aria-expanded",String(!!d&&d.taskId===i.task_id));var u=document.createElement("span");u.className="split-view-worker-dot",u.dataset.state=i.active===!1?"ready":"working";var p=document.createElement("span");if(p.className="split-view-worker-name",p.textContent=i.description||"Background task",u.setAttribute("aria-label",i.active===!1?"Finished":"Running"),c.append(u,p),c.addEventListener("click",function(){_n(i)}),l.appendChild(c),i.active!==!1){var m=document.createElement("button");m.type="button",m.className="split-view-worker-remove",m.setAttribute("aria-label","Stop "+(i.description||"background task")),m.title="Stop task",m.innerHTML=ee("square"),m.addEventListener("click",function(){var v=w();v&&v.readyState===1&&v.send(JSON.stringify({type:"background_task_stop",requestId:crypto.randomUUID(),taskId:i.task_id,runId:i.run_id||null,sessionOriginId:o.get("sessionOriginId")}))}),l.appendChild(m)}r.appendChild(l)}),D())}}var Pt=new URLSearchParams(location.search),pe=Pt.get("pane")==="1";pe&&typeof performance<"u"&&performance.mark&&performance.mark("clay:app-evaluated");var Q=Number(Pt.get("session"));(!Number.isSafeInteger(Q)||Q<1)&&(Q=null);pe&&document.body.classList.add("pane-mode");var ze=location.pathname.match(/^\/p\/([a-z0-9_-]+)/),es=document.body.dataset.homeProjectSlug||null,xe=ze?ze[1]:es,z=xe?"/p/"+xe+"/":"/",fe=xe?"/p/"+xe+"/ws":"/ws";pe&&(fe+="?pane=1",Q&&(fe+="&session="+Q),Pt.get("contextual")==="1"&&(fe+="&contextual=1"));var f=function(e){return document.getElementById(e)},L=f("messages"),Ke=f("input"),ts=f("send-btn");var Mt=f("header-title"),fh=f("header-rename-btn"),ns=f("slash-menu"),ph=f("suggestion-chips"),rs=f("sidebar"),os=f("sidebar-overlay"),za=f("session-list"),as=f("new-session-btn"),is=f("hamburger-btn"),ss=f("sidebar-toggle-btn"),ls=f("sidebar-expand-btn"),ds=f("image-preview-bar"),mh=f("connect-overlay");var cs="/claude-code-avatar.png";function Ga(e){De(e)}function us(){return!1}function Ka(){var e=document.getElementById("icon-strip-add");e&&e.click()}function Ya(e){Xr(e)}function fs(){Zr()}var gh=f("project-list-section"),hh=f("project-list"),vh=f("project-list-add"),ps=f("project-hint"),Ua=f("project-hint-dismiss"),Ge=xe||null;document.addEventListener("keydown",function(e){if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="z"){var t=document.activeElement,n=t&&t.tagName;(n==="TEXTAREA"||n==="INPUT"||t&&t.isContentEditable)&&(e.preventDefault(),e.stopPropagation(),e.shiftKey?document.execCommand("redo",!1,null):document.execCommand("undo",!1,null))}},!0);document.addEventListener("keydown",function(e){e.key==="Escape"&&It()});Ua&&Ua.addEventListener("click",function(){ps.classList.add("hidden");try{localStorage.setItem("clay-project-hint-dismissed","1")}catch{}});f("mermaid-modal").querySelector(".confirm-backdrop").addEventListener("click",nt);f("mermaid-modal").querySelector(".mermaid-modal-btn[title='Close']").addEventListener("click",nt);f("image-modal").querySelector(".confirm-backdrop").addEventListener("click",It);f("image-modal").querySelector(".image-modal-close").addEventListener("click",It);function xt(e){on(e)}function It(){an()}var Qa="";try{Ee=localStorage.getItem("clay-project-name-"+(Ge||"default")),Ee&&(Qa=Ee,Mt&&(Mt.textContent=Ee),kt=f("title-bar-project-name"),kt&&(kt.textContent=Ee)),Ct=localStorage.getItem("clay-project-icon-"+(Ge||"default")),Ct&&(Pe=f("title-bar-project-icon"),Pe&&(Pe.textContent=Ct,Ue(Pe),Pe.classList.add("has-icon")))}catch{}var Ee,kt,Ct,Pe;function Ja(e,t,n,r){sn(e,t,n,r)}Dt({networkSettings:{loaded:!1,busy:!1,confirming:!1,draft:"",saved:"",status:"",errorKind:"",requestId:0},vendorLoginBrowser:null,githubStarCount:null,sharedBrowser:null,sharedBrowsers:[],mcpSkillsWorkbench:{},mateKnowledgeWorkspaces:{},mateColorSave:null,mcpConnections:{screen:"list",servers:[],search:"",loaded:!1},sharedBrowserOpen:!1,sharedBrowserUi:{},sharedBrowserSettings:{},browserLinksBound:!1,basePath:z,wsPath:fe,paneMode:pe,paneSessionId:Q,panePinPending:pe&&!!Q,paneCommittedBinding:null,panePendingBinding:null,paneReady:!1,paneSuspended:!1,paneActivationGeneration:0,paneActivationTimer:null,panePointerBinding:null,paneRichDrafts:{},paneLayoutScrollLock:null,paneLastUserScrollTop:null,paneUserScrollIntent:null,paneUserScrollRevision:0,sessionRichDrafts:{},sessionActionEpoch:0,composerUploadingCount:0,deferredSessionSwitch:null,paneCallbackBinding:null,paneActionEvents:[],paneHeldKeys:{},rewindAction:null,handoffAction:null,authIdentityLoaded:!1,splitIdentityBlockedSocket:null,splitIdentityHydrated:!1,paneActivationUnsupported:!1,paneBindingSessions:[],splitPanes:null,splitGroups:[],splitViewWorkerConversation:null,splitViewWorkerRemoval:null,projectSplitViews:[],projectSplitViewRevision:0,projectSplitViewContextKey:null,projectSplitViewHydrated:!1,projectSplitViewPending:null,projectSplitViewError:"",projectSplitViewActiveId:null,projectSplitViewFocusedOrigin:null,projectSplitViewPreviewTree:null,projectSplitViewDrag:null,splitViewOrganizationDrag:null,projectSplitViewDividerDrag:null,projectSplitViewTranscriptScroll:{},projectSplitViewSuppressClick:null,projectSplitViewSocketGeneration:0,projectSplitViewRequestSocket:null,projectSplitViewRequestGeneration:null,projectSplitViewRequestOwnerId:null,projectSplitViewRequestSlug:null,sessionFolders:null,sessionFoldersSlug:null,sessionFolderCreate:null,sidebarCreationEffects:[],sessionSearch:null,sessionFolderViewMenu:null,sessionFolderLayouts:{},sessionFolderDrag:null,sessionFolderMenu:null,sessionFolderContext:null,sessionFolderModal:null,sessionContextMenu:null,sessionInlineRename:null,splitDelegations:{},pairResultStatus:[],notesTemporarilyHidden:!1,pairResultTrayOpen:!1,dmMode:!1,historyFrom:0,loadingMore:!1,historyTotal:0,replayingHistory:!1,historyReplayBatch:null,pendingSessionEntryNavigation:null,sessionEntryHighlight:null,sessionNavigationRequestId:null,projectName:Qa,cwd:"",currentSlug:Ge,githubWorkPopoverBound:!1,githubWorkSessions:[],githubWorkProject:null,githubWorkRefresh:null,workPrimaryPending:null,activeProjectSlug:null,activeProjectMateId:null,activeProjectMateName:"",clayReturnTarget:null,contextualPrepared:null,contextualSubmitted:{},contextualClay:{mode:"closed",mateId:null},contextualConversationHistory:null,contextualConversationRequest:null,clayControlActivity:null,clayControlOrder:0,clayControlReceipts:[],clayControlForwarded:null,controlRuntimeId:null,studioDocumentSource:null,studioDocumentView:null,clayStudioRelays:{},clayStudioForwarded:{},clayStudioSurfaces:{},clayControlNotifications:[],clayControlFileView:null,clayControlTerminalViews:[],clayControlGitView:null,clayNavigationRendering:null,clayControlViewerRef:null,contextualSessionReady:!1,contextualSessionReceived:!1,contextualSessionUnavailable:!1,clayReturnPendingProjectSlug:null,activeSessionMateId:null,activeSessionMateName:"",sessionActivatedProjectSlug:null,sessionListProjectSlug:null,splitGroupsProjectSlug:null,socketPath:null,pendingHomeProjectSlug:null,homeProjectEmptyVisible:!1,homeShellVisible:!1,projectMateFilterMode:"all",projectMateFilterTurns:0,projectMateFilterActivated:!1,projectMateCreationActive:!1,projectMateCreationMateId:null,projectMateCreationSessionId:null,projectMateCreationRequestId:null,projectMateCreationPendingStart:!1,projectMateCreationAwaitingHistory:!1,projectMateCreationAwaitingMateList:!1,projectMateCreationHistoryReady:!1,projectMateCreationLocalId:null,projectMateCreationMessages:[],projectMateCreationPendingMateId:null,projectDebatePlanningActive:!1,projectDebatePlanningMateId:null,projectDebatePlanningSessionId:null,projectDebatePlanningLocalId:null,projectDebatePlanningRequestId:null,projectDebatePlanningPendingStart:!1,projectDebatePlanningAwaitingHistory:!1,projectDebatePlanningAwaitingMateList:!1,projectDebatePlanningHistoryReady:!1,projectDebatePlanningTopic:"",projectDebatePlanningMessages:[],projectDebatePlanningError:"",projectDebatePlanningRetryable:!1,debatesWorkbenchStatus:"idle",debatesWorkbenchRequestId:null,debatesWorkbenchItems:[],debatesWorkbenchError:"",debatesWorkbenchFilter:"all",debatesWorkbenchCreating:!1,debatesWorkbenchWide:!1,debatesWorkbenchFullscreen:!1,debatesWorkbenchScrollTop:0,pendingDebateNavigation:null,pendingProjectSessionNavigation:null,projectsHubVisible:!1,projectsHubMarkup:null,projectsHubList:[],projectListLoaded:!1,projectsAccessLoaded:!1,projectsHubRestoreRequested:!1,projectStart:hn(),projectStartFolder:vn(),onboardingStep:"welcome",onboardingIntent:null,currentProjectOwnerId:null,isOsUsers:!1,skipPermsEnabled:!1,autonomousSelectedMode:"normal",autonomousArming:!1,autonomousArmToken:null,autonomousArmRequestId:null,autonomousArmSessionId:null,autonomousActionRequestId:null,autonomousActionSessionId:null,autonomousCriteria:"",autonomousMaxContinuations:10,autonomousMaxMinutes:60,autonomousRun:null,autonomousExpanded:!1,loopInterviewBrief:null,loopInterviewEditing:!1,loopInterviewRunRequestId:null,loopInterviewRunSessionId:null,loopInterviewStarting:!1,loopInterviewRequestId:null,loopInterviewSessionId:null,slashCommands:[],processing:!1,scheduledMessageCorrelation:null,activeSessionId:null,speechActive:null,speechSettings:null,speechSettingsRequest:0,speechSettingsSaving:!1,speechSettingsError:"",speechPopup:null,speechRetry:null,speechLang:"en-US",speechStatuses:{},speechErrors:{},speechLanguageSaving:!1,speechLifecycleBound:!1,askUserRequests:{},activeBackgroundTasks:[],backgroundTaskCatalog:[],backgroundTaskViewer:null,splitSessionPicker:null,splitSessionCreation:null,agentMessagePreviews:{},agentMessageBubble:null,workerMessagePreviewSubscription:null,sessionVendorBound:!1,cliSessionId:null,isHeadlessMode:!1,savedMainSlug:null,connected:!1,fileReadRequest:null,filePaneInstances:{},activeFilePaneId:null,fileViewerIsPlantUml:!1,plantUmlPreviewJob:null,wireframeDraft:null,wireframeRenderQueue:[],wireframeRenderActive:null,wireframeRenderCache:[],pendingFileNavigation:null,rightWorkbenchOwner:null,rightWorkbenchRevision:0,fileViewerOpenRevision:0,cursorSharingEnabled:!1,cursorSharingHydrated:!1,cursorSharingPending:null,pendingOutboundMessages:[],pendingMessageQueue:{projectSlug:null,sessionId:null,revision:0,paused:!1,items:[],loading:!1,error:""},pendingMessageQueueRecovery:!1,pendingMessageQueueRequests:{},pendingMessageQueueEdit:null,pendingMessageQueueDrag:null,pendingMessageQueueFocusReturn:null,searchClayChatState:null,homeChatMateId:null,homeChatSessionId:null,homeChatSessionModel:null,homeChatSessionVendor:null,homeChatSessionModelLoading:!1,homeMateSessions:{},homeActiveSessionByMate:{},homePreferredMateId:null,homeSidebarCollapsed:!1,homeMatesCollapsed:!1,homeChatScope:"all",homeSubSurface:"chat",homeDebatesStatus:"idle",homeDebates:[],homeDebatesRequestId:null,homeDebatesError:"",homeSurfaceLoaded:!1,homePrimarySurface:null,homeSurfaceProjectSlug:null,homeSurfaceIntent:null,homeSurfaceBootResolved:!1,homeSurfaceRestoreRequested:!1,dockActiveToolId:null,dockOpen:!1,homeDockPreferenceLoaded:!1,dockFocus:!1,dockLibraryOpen:!1,dockBackstageOpen:!1,dockWidth:null,dockHasActivity:!1,dockActivityToolId:null,you:{},youActivity:{},youSequence:0,projectLogsOpen:!1,projectLogsWide:!1,projectLogsFullscreen:!1,projectLogsEntries:[],projectLogsSelectedRef:null,projectLogsView:"list",projectLogsCategory:"",projectLogsContextMode:"",projectLogsIsWorktree:!1,projectLogsListScroll:0,projectLogsListRequestId:null,projectLogsReadRequestId:null,projectLogsCommentRequestId:null,projectLogsCommentStatusEl:null,projectLogsDeleteRequestId:null,projectLogsCanDelete:!1,projectLogsUnread:0,projectLogsSeenRevisions:{},scheduledResultUnread:0,scheduledResultAutoFocusHandled:!1,scheduledResultFocusRef:null,scheduledResultPendingReadRef:null,scheduledResultSeenRefs:{},scheduledResultSessionRequestId:null,issuesOpen:!1,issuesView:"list",issuesSelected:null,issuesRows:[],issuesRequests:{},issueGithub:null,issuesViewRequest:null,issuesViewGeneration:0,issuesUpdateAvailable:null,issuesCache:{},issuesEpoch:0,issuesSearchTimer:null,issueLinkRequests:{},issueLinkOpenRef:null,scheduledTasksOpen:!1,scheduledTasksWide:!1,scheduledTasksFullscreen:!1,scheduledTaskRecords:[],scheduledTaskDraft:null,scheduledTaskEditingId:null,scheduledTaskNewSessionPending:!1,scheduledTaskInterviewRequestId:null,scheduledTaskActionRequestId:null,scheduledTaskListRequest:null,scheduledTaskInterviewId:null,scheduledTaskExpandedId:null,scheduledTaskDeleteId:null,scheduledTaskDraftForm:null,scheduledTaskEditForm:null,scheduledTaskCreateMenuOpen:!1,scheduledTaskManualRequest:null,installedTools:[],capsulesEnabled:!1,capsulesPreferenceLoaded:!1,homeToolRegistryLoaded:!1,toolScanErrors:[],defaultAiState:{loading:!1,saving:!1,refreshRequestId:null,saveRequestId:null,catalogRequestIds:{},catalogs:{},preference:null,selection:null,installedVendors:[],accountAvailable:!0,accountId:null,serverEpoch:null,canonicalRevision:0,error:""},defaultAiDraft:{vendor:"",model:"",effort:""},defaultAiDraftDirty:!1,defaultVendorState:{loading:!1,saving:!1,getRequestId:null,saveRequestId:null,preference:null,preferencePresent:!1,installedVendors:[],accountId:null,projectSlug:null,serverEpoch:null,canonicalRevision:0,error:""},projectSessionVisibilityState:{active:null,pending:null},dmTargetUser:null,dmKey:null,cachedMatesList:[],cachedDmFavorites:[],cachedAvailableBuiltins:[],projectMateDmsEnabled:!0,returningFromMateDm:!1,pendingMateInterview:null,pendingTermCommand:null,shellCommandMode:!1,shellCommandRunning:!1,pendingShellCommandId:null,mateProjectSlug:null,myUserId:null,contextViewPreferenceState:{mode:"off",canonicalMode:"off",preferencePresent:!1,loading:!1,saving:!1,requestId:null,saveRequestId:null,pendingSaves:[],accountId:null,serverEpoch:null,rejectedEpoch:null,canonicalRevision:0,error:""},contextViewOverride:null,isMultiUserMode:!1,dmUnread:{},dmRemovedUsers:{},cachedAllUsers:[],cachedOnlineIds:[],cachedDmConversations:[],sessionDrafts:{},messageUuidMap:[],currentMsgTs:null,richContextUsage:null,contextMeasurement:"unavailable",currentMsgEl:null,currentFullText:"",matePreThinkingEl:null,thinkingState:null,fileViewerFullscreen:!1,markdownSlidesActive:!1,markdownSlideIndex:0,markdownSlideCount:0,markdownSlideLevel:1,markdownSlidePreferredLevel:1,markdownSlideLevelExplicit:!1,currentModel:"",currentModels:[],modelListVendor:"",modelListStatus:"idle",modelListError:"",modelRequestId:"",modelSelectionPending:null,modelSelectionError:"",lastVendor:"",vendorInfo:{},rateLimitState:{},vendorUsageOverview:null,vendorUsageOpen:null,currentMode:"default",effectivePermissionMode:null,permissionCapabilities:{auto:!1,mcpOverride:!1},permissionModePendingByTarget:{},mcpPermissionModePendingByTarget:{},mcpPermissionModeOverrides:{},currentEffort:"medium",currentBetas:[],currentThinking:"adaptive",currentThinkingBudget:1e4,sessionFullAccess:!1,codexApproval:null,codexSandbox:null,codexWebSearch:null,ctxPopoverVisible:!1,headerContextEl:null,loopActive:!1,loopAvailable:!1,loopIteration:0,loopMaxIterations:0,loopBannerName:null,ralphPhase:"idle",ralphCraftingSessionId:null,ralphCraftingSource:null,ralphFilesReady:{promptReady:!1,judgeReady:!1,bothReady:!1},ralphPreviewContent:{prompt:"",judge:""},execModalShown:!1,debateStickyState:null,debateFloorMode:!1,debateConcludeMode:!1,debateEndedMode:!1,knownInstalledSkills:{},permissions:null,wizardData:{name:"",task:"",maxIterations:null,cron:null}});Er({$:f,get ws(){return w()},get connected(){return o.get("connected")},get processing(){return o.get("processing")},messagesEl:L,addSystemMessage:ni});Ao();wa();An();Ma();var ms={$:f,get ws(){return w()},get connected(){return o.get("connected")},get projectName(){return o.get("projectName")},messagesEl:L,sessionListEl:za,sidebar:rs,sidebarOverlay:os,sidebarToggleBtn:ss,sidebarExpandBtn:ls,hamburgerBtn:is,newSessionBtn:as,headerTitleEl:Mt,showConfirm:Ja,onFilesTabOpen:function(){_o(),Oo(),H()&&F()},requestKnowledgeList:function(){Zn()},switchProject:function(e){ri(e)},openTerminal:function(){Lo()},showHomeHub:function(){Ga()},getUpcomingSchedules:fn,get multiUser(){return o.get("isMultiUserMode")},get myUserId(){return o.get("myUserId")},get projectOwnerId(){return o.get("currentProjectOwnerId")},get ownerLocked(){return o.get("ownerLocked")},openDm:function(e){Ya(e)},openMateWizard:function(){Ka()},openAddProjectModal:function(){bn()},sendWs:function(e){var t=w();t&&t.readyState===1&&t.send(JSON.stringify(e))},onDmRemoveUser:function(e){var t=Object.assign({},o.get("dmRemovedUsers"));t[e]=!0,o.set({dmRemovedUsers:t})},getHistoryFrom:function(){return o.get("historyFrom")},get permissions(){return o.get("permissions")},get projectList(){return ge()||[]},availableBuiltins:function(){return o.get("cachedAvailableBuiltins")||[]}};ma();_e([Bo,Kn,Yn,Qt,Qn,Jt,xr,Kr]);xo(ms);var Lt=function(){return w()};er(Lt);$n(Lt);_e([pr]);Jn(Lt,{onShow:function(){Xn(),wo()}});pn({switchProject:function(e){ri(e)},currentSlug:function(){return o.get("currentSlug")},matesList:function(){return o.get("cachedMatesList")||[]},availableBuiltins:function(){return o.get("cachedAvailableBuiltins")||[]},allUsers:function(){return o.get("cachedAllUsers")||[]},dmConversations:function(){return o.get("cachedDmConversations")||[]},myUserId:function(){return o.get("myUserId")},selectSession:function(e){H()&&F();var t=document.getElementById("sticky-notes-panel");if(t&&!t.classList.contains("hidden")){var n=document.getElementById("sticky-notes-sidebar-btn");n&&n.click()}var r=w();r&&r.readyState===1&&r.send(JSON.stringify({type:"switch_session",id:e}))},openDm:function(e){Ya(e)},runAction:function(e){switch(e){case"createMate":Ka();break;case"openSettings":Mn();break;case"showHome":Ga();break}}});ba();zn();Yt();function gs(e){Ln(e)}function hs(){Tn()}function vs(e){Rn(e)}function bs(){po()}function ys(){mo()}function $a(){Fn()}function Xa(){Hn()}function Ss(){qn()}function ws(){Vn()}function Tt(e){Vt(e)}var Y=f("new-msg-btn"),_a="\u2193 Latest";function Et(){var e=f("input-area");e&&(Y.style.bottom=e.offsetHeight+12+"px")}var Na=f("input-area");Na&&window.ResizeObserver?new ResizeObserver(Et).observe(Na):window.addEventListener("resize",Et);Et();L.addEventListener("scroll",function(){if(!Ot()){var e=L.scrollHeight-L.scrollTop-L.clientHeight,t=e>150;qt(t),t?(Y.classList.contains("hidden")&&(Y.textContent=_a),Y.classList.remove("hidden")):(Y.classList.add("hidden"),Y.textContent=_a)}});Y.addEventListener("click",function(){Za()});document.addEventListener("visibilitychange",function(){document.hidden||Ie()});L.addEventListener("click",function(e){var t=e.target.closest(".msg-action-fork");if(t){var n=t.closest("[data-uuid]");if(!(!n||!n.dataset.uuid)){var r=n.dataset.uuid;Ja("Fork session from this message?",function(){var a=w();a&&a.readyState===1&&a.send(JSON.stringify({type:"fork_session",uuid:r}))},"Fork",!1)}}});function Ie(){Wt()}function Za(){zt()}rn();In();Ir();mr();Hr();Nr();ja();Yr();Or();Fr();Wr();gn();On();Wn();Ft();Zt({$:f,get ws(){return w()},get connected(){return o.get("connected")},get turnCounter(){return Ht()},messagesEl:L,inputEl:Ke,finalizeAssistantBlock:function(){ks()},addToMessages:function(e){Tt(e)},scrollToBottom:function(){Ie()},setActivity:function(e){vs(e)},stopUrgentBlink:function(){hs()},showImageModal:xt,getContextPercent:function(){var e=Nn();return e.contextWindow>0?Math.round(e.input/e.contextWindow*100):0},isMateDm:function(){return o.get("dmMode")&&o.get("dmTargetUser")&&o.get("dmTargetUser").isMate},getMateName:function(){return o.get("dmTargetUser")&&o.get("dmTargetUser").displayName||"Mate"},getMateAvatarUrl:function(){return document.body.dataset.mateAvatarUrl||""},getClaudeAvatar:function(){return cs},getMateById:function(e){var t=o.get("cachedMatesList");if(!e||!t)return null;for(var n=0;n<t.length;n++)if(t[n].id===e)return t[n];return null}});function ei(e,t,n,r,a){lo(e,t,n,r,a)}function ti(e,t){uo(e,t)}function ks(){fo()}function ni(e,t){co(e,t)}function Cs(){ho()}function Ms(){oo()}function ri(e){je(e)}window.addEventListener("popstate",function(){if(/^\/projects\/?$/.test(location.pathname)){De(!0);return}kn();var e=location.pathname.match(/^\/p\/([a-z0-9_-]+)/),t=e?e[1]:null;if(!t){De(!0);return}wn("project",t),us()&&void 0,t&&t!==o.get("currentSlug")&&(Uo(),ne(),H()&&F(),cn(t),o.set({currentSlug:t}),z="/p/"+t+"/",fe="/p/"+t+"/ws",o.set({basePath:z,wsPath:fe}),Ms(),oi())});function oi(){Jr()}so({get ws(){return w()},get connected(){return o.get("connected")},get processing(){return o.get("processing")},get basePath(){return z},inputEl:Ke,sendBtn:ts,slashMenu:ns,messagesEl:L,imagePreviewBar:ds,slashCommands:function(){return o.get("slashCommands")},messageUuidMap:function(){return o.get("messageUuidMap")},addUserMessage:ei,addSystemMessage:ni,toggleUsagePanel:$a,toggleStatusPanel:Xa,toggleContextPanel:ws,resetContextData:Ss,showImageModal:xt,hideSuggestionChips:Cs,getGhostSuggestion:function(){return go()},setSendBtnMode:gs,isDmMode:function(){return o.get("dmMode")&&!(o.get("dmTargetUser")&&o.get("dmTargetUser").isMate)},getDmKey:function(){return o.get("dmKey")},handleDmSend:function(){fs()},isDebateEndedMode:function(){return o.get("debateEndedMode")},handleDebateEndedSend:function(){handleDebateEndedSend()},isDebateConcludeMode:function(){return o.get("debateConcludeMode")},handleDebateConcludeSend:function(){xs()},isDebateFloorMode:function(){return o.get("debateFloorMode")},handleDebateFloorSend:function(){Ls()},isMateDm:function(){return o.get("dmMode")&&o.get("dmTargetUser")&&o.get("dmTargetUser").isMate},getDmMateId:function(){var e=o.get("dmTargetUser");return o.get("dmMode")&&e&&e.isMate?e.id:null},getMateName:function(){return o.get("dmTargetUser")&&o.get("dmTargetUser").displayName||"Mate"},getMateAvatarUrl:function(){return document.body.dataset.mateAvatarUrl||""},showMatePreThinking:function(){ys()},showClaudePreThinking:function(){bs()},myUserId:function(){return o.get("myUserId")},myDisplayName:function(){var e=null;try{e=JSON.parse(localStorage.getItem("clay_my_user")||"null")}catch{}return e&&(e.displayName||e.username)||document.body.dataset.myDisplayName||"Me"}});Pr();zr({get ws(){return w()},get connected(){return o.get("connected")},inputEl:Ke,messagesEl:L,matesList:function(){return o.get("cachedMatesList")||[]},availableBuiltins:function(){return o.get("cachedAvailableBuiltins")||[]},allUsers:function(){return o.get("cachedAllUsers")||[]},myUserId:function(){return o.get("myUserId")},scrollToBottom:Ie,addUserMessage:ei,addCopyHandler:ti,addToMessages:Tt,showImageModal:xt,showPasteModal:nn});Br({get ws(){return w()},sendWs:function(e){var t=w();t&&t.readyState===1&&t.send(JSON.stringify(e))},messagesEl:L,addToMessages:function(e){Tt(e)},scrollToBottom:Ie,addCopyHandler:ti,matesList:function(){return o.get("cachedMatesList")||[]},availableBuiltins:function(){return o.get("cachedAvailableBuiltins")||[]},currentMateId:function(){return o.get("dmTargetUser")&&o.get("dmTargetUser").isMate?o.get("dmTargetUser").id:o.get("homeChatMateId")||null},requireSkills:Ps,showDebateEndedMode:function(e){Is(e)}});na();fr({basePath:z});En();kr({basePath:z});function Es(){ln()}fetch("/api/me").then(function(e){return e.json()}).then(function(e){if(e.multiUser&&(o.set({isMultiUserMode:!0}),document.body&&document.body.classList.add("is-multi-user")),e.user&&e.user.id&&(o.set({myUserId:e.user.id}),Dn()),o.set({authIdentityLoaded:!0}),o.set({permissions:e.permissions||null,projectsAccessLoaded:!0}),e.mustChangePin&&Es(),!o.get("isMultiUserMode")){var t=document.getElementById("icon-strip-users");t&&(t.innerHTML="",t.classList.add("hidden"))}sa();var n=o.get("permissions");if(n){if(!n.terminal){var r=document.getElementById("terminal-toggle-btn");r&&(r.style.display="none");var a=document.getElementById("terminal-sidebar-btn");a&&(a.style.display="none");var s=document.getElementById("shell-command-btn");s&&(s.style.display="none");var i=document.getElementById("input-more-shell");i&&(i.style.display="none")}if(!n.fileBrowser){var l=document.getElementById("file-browser-btn");l&&(l.style.display="none");var c=document.getElementById("git-placard");c&&(c.style.display="none")}if(!n.skills){var d=document.getElementById("skills-btn");d&&(d.style.display="none");var u=document.getElementById("mate-skills-btn");u&&(u.style.display="none")}if(!n.scheduledTasks){var p=document.getElementById("scheduler-btn");p&&(p.style.display="none")}if(!n.createProject){var m=document.getElementById("icon-strip-add");m&&(m.style.display="none")}}}).catch(function(){});hr().then(function(e){if(o.get("isMultiUserMode")&&!e){var t=document.getElementById("update-pill-wrap");t&&(t.style.display="none")}});gr({$:f,get ws(){return w()},get connected(){return o.get("connected")},messagesEl:L,sessionListEl:za,scrollToBottom:Ie,forceScrollToBottom:Za,basePath:z,toggleUsagePanel:$a,toggleStatusPanel:Xa});vr();Pn(ro());xn();jo({get ws(){return w()},get connected(){return o.get("connected")},get activeSessionId(){return o.get("activeSessionId")},get cwd(){return o.get("cwd")},messagesEl:L,fileTreeEl:f("file-tree"),fileViewerEl:f("file-viewer")});_e([Po,Go,$t]);Ho();mn();Gn();Io({get ws(){return w()},get connected(){return o.get("connected")},terminalContainerEl:f("terminal-container"),terminalBodyEl:f("terminal-body"),fileViewerEl:f("file-viewer")});en({get ws(){return w()},get connected(){return o.get("connected")}});Zo();(function(){var e=new URLSearchParams(window.location.search),t=e.get("playbook");if(t){setTimeout(function(){Xo(t)},300),e.delete("playbook");var n=e.toString(),r=window.location.pathname+(n?"?"+n:"")+window.location.hash;window.history.replaceState(null,"",r)}})();Gt({messagesEl:L,get ws(){return w()},getHistoryFrom:function(){return o.get("historyFrom")}});var Oa=f("find-in-session-btn");Oa&&Oa.addEventListener("click",function(){Kt()});yo();Eo();vo(function(){re()&&Co()});var Fa=f("sticky-notes-sidebar-btn");Fa&&Fa.addEventListener("click",function(){he(),me(),H()&&F(),re()&&ne(),So(),ko()});var Ha=document.querySelectorAll("#sticky-notes-toggle-btn");for(We=0;We<Ha.length;We++)Ha[We].addEventListener("click",function(){bo()});var We,qa=f("sticky-notes-sidebar-count");qa&&qa.addEventListener("click",function(e){e.stopPropagation(),he(),me(),H()&&F(),re()?ne():Mo()});var Va=f("git-placard-more"),Wa=f("terminal-sidebar-btn");Va&&Va.addEventListener("click",function(){Je(),he(),me(),re()&&ne(),H()&&F()});Wa&&Wa.addEventListener("click",function(){Je(),he(),me(),re()&&ne(),H()&&F()});function Ps(e,t){qr(e,t)}function xs(){jr()}function Is(e){Ur(e)}function Ls(){_r()}tn();Mr();dn({get ws(){return w()},get connected(){return o.get("connected")},get activeSessionId(){return o.get("activeSessionId")},basePath:z,currentSlug:Ge,getProjects:function(){return ge()}});Ar();Lr();Tr();Da();yn();io();Vr();Sn();Gr();Cn();La();$r();Qr();lucide.createIcons();pe&&typeof performance<"u"&&performance.mark&&performance.mark("clay:bootstrap-complete");oi();ze&&location.hash==="#scheduler"?setTimeout(function(){un("calendar")},500):ze&&Ke.focus();
|
|
1
|
+
import{$ as En,$a as Zn,$b as Or,$c as Io,Aa as Fn,Ab as yr,Ac as ao,B as tn,Ba as Hn,Bb as Sr,Bc as io,C as nn,Ca as qn,Cb as wr,Cc as so,D as rn,Da as Vn,Db as kr,Dc as lo,E as on,Ea as Wn,Eb as Cr,Ec as co,F as an,Fa as zn,Fb as Mr,Fc as uo,G as sn,Gb as Er,Gc as fo,H as ln,Hb as Pr,Hc as po,I as dn,Ic as mo,J as F,Jc as go,K as cn,Kc as ho,Kd as jo,L as un,Lb as me,Lc as vo,M as H,Mc as bo,N as fn,Nc as yo,O as pn,Oc as So,Od as Uo,P as mn,Pb as xr,Pc as wo,Q as gn,Qa as Gn,Qb as Ir,Qc as ko,Qd as _o,R as hn,Rb as Lr,S as vn,Sb as Tr,Sd as No,T as bn,Tb as Rr,Td as Oo,U as yn,Ub as Dr,Uc as Co,V as Sn,Va as Kn,Vb as Ar,Vc as Mo,W as wn,Wa as Yn,Wb as Br,Wc as ne,X as De,Xa as Qn,Xb as jr,Xc as re,Y as kn,Ya as Jn,Yb as Ur,Yc as Eo,Z as Cn,Za as $n,Zb as _r,Zc as Po,_ as Mn,_a as Xn,_b as Nr,_c as xo,_d as Fo,a as Nt,aa as Pn,ab as er,ac as Fr,ad as Lo,b as Ot,ba as xn,bb as Xe,bc as Hr,c as Ft,ca as In,cb as tr,cc as qr,d as Ht,da as Ln,db as nr,dc as Vr,e as qt,ea as Tn,eb as te,ec as Wr,f as Vt,fa as Rn,fb as rr,fc as zr,g as Wt,ga as Dn,gb as or,gc as Gr,h as zt,ha as An,hb as ar,i as Gt,ia as Bn,ib as ir,j as Kt,ja as jn,jb as sr,k as Yt,ka as Un,kb as lr,kc as Kr,la as $e,lb as dr,lc as Yr,ma as _n,mb as cr,mc as Qr,nb as ur,nc as Jr,ob as fr,oc as $r,od as To,pb as Ze,pc as Xr,pd as Ro,qc as Zr,qd as Do,r as Je,rb as pr,rc as eo,rd as Ao,sb as mr,sc as to,t as Qt,tb as gr,tc as no,td as Ue,ub as hr,uc as ro,v as Jt,vb as vr,vc as ge,vd as nt,w as Zt,wb as et,wc as oo,wd as Bo,x as en,xb as br,xc as je,ya as Nn,yb as Ae,za as On,zb as Be,zc as tt,zd as he}from"./chunk-FILRACQB.js";import"./chunk-L3FCTD7U.js";import"./chunk-JIV7O5GN.js";import{g as $t}from"./chunk-YFUORWA6.js";import{h as Xt}from"./chunk-RRYWV5JT.js";import{A as _t,a as At,b as Bt,f as jt,w as Qe,x as Ut}from"./chunk-YXJ7ISEK.js";import{a as w}from"./chunk-R7QVVFUG.js";import{d as D,e as ee}from"./chunk-SEELA2D2.js";import{a as Dt,b as o}from"./chunk-VZ2OKDAO.js";var ve=[];function rt(){var e=o.snap(),t=e.paneDeferredBootstrap;!t||t.scheduled||!t.jobs.length||!e.connected||!e.paneReady||e.paneSuspended||(o.set({paneDeferredBootstrap:Object.assign({},t,{scheduled:!0})}),setTimeout(function(){var n=o.snap(),r=n.paneDeferredBootstrap;if(r){var a=r.jobs.slice(),s=n.connected&&n.paneReady&&!n.paneSuspended?a.shift():null;o.set({paneDeferredBootstrap:Object.assign({},r,{scheduled:!1,jobs:a})});try{if(s!==null&&ve[s]){var i=ve[s];ve[s]=null,i()}}finally{rt()}}},0))}function _e(e){if(!o.get("paneMode")){e.forEach(function(n){n()});return}var t=o.get("paneDeferredBootstrap");t||(t={jobs:[],scheduled:!1},o.subscribe(function(n,r){(n.paneReady!==r.paneReady||n.connected!==r.connected||n.paneSuspended!==r.paneSuspended)&&rt()})),o.set({paneDeferredBootstrap:Object.assign({},t,{jobs:t.jobs.concat(e.map(function(n){var r=ve.length;return ve.push(n),r}))})}),rt()}function Ho(){_t(),jt(),window.addEventListener("message",function(e){var t=e.data;if(e.origin===location.origin&&t&&t.type==="clay-studio-document-update"&&t.message){var n=Bt(t.message.path);n&&n.source===e.source&&n.descriptor.token===t.token&&Fo(t.message,n);return}!t||["clay-pane-present-markdown","clay-pane-present-wireframe"].indexOf(t.type)<0||!t.message||!t.message.controlPresentation||!Qe(e,t)||!Ut(e,t)||(t.type==="clay-pane-present-markdown"?(At(e,t,Qe(e,t)),No(t.message)):Xt(t.message))})}var ai="(max-width: 768px)",ii=["sticky-notes-toggle-btn","shared-browser-toggle-btn","terminal-toggle-btn"],si=["shared-browser-toggle-btn","terminal-toggle-btn","sticky-notes-toggle-btn"];function qo(e){var t=document.querySelector("#main-column > .title-bar-content .status"),n=document.querySelector("#top-bar .top-bar-actions"),r=document.getElementById("notif-center-btn");if(!(!t||!n))for(var a=e?ii:si,s=0;s<a.length;s++){var i=document.getElementById(a[s]);i&&(e?t.appendChild(i):n.insertBefore(i,r))}}var li=150,oe=24,be=12,Vo=null;function Wo(e,t,n){return Math.round(e.offsetWidth)+"|"+Math.round(t.offsetWidth)+"|"+Math.round(n.offsetWidth)}function zo(e){var t=document.getElementById("top-bar"),n=t&&t.querySelector(".top-bar-left-pills"),r=t&&t.querySelector(".top-bar-actions"),a=document.getElementById("cmd-palette-btn");if(!(!t||!n||!r||!a)&&t.offsetWidth&&!(!e&&Vo===Wo(t,n,r))&&getComputedStyle(a).display!=="none"){for(var s=[[],["usage-compact"],["usage-compact","usage-compact-link"]],i=null,l=0;l<s.length&&!i;l++){t.classList.remove("usage-compact","usage-compact-link","search-icon"),s[l].forEach(function(P){t.classList.add(P)}),t.style.removeProperty("--top-bar-search-width"),t.style.removeProperty("--top-bar-search-left");var c=t.getBoundingClientRect().width,d=c/2,u=t.getBoundingClientRect().left,p=n.getBoundingClientRect().right-u,m=r.getBoundingClientRect().left-u,v=Math.min(d-p,m-d)-be,y=Math.min(520,c*.4);if(2*v>=li)i={mode:"full",width:Math.min(y,2*v),left:null,level:l};else if(m-p>=oe+2*be){var M=p+be+oe/2,E=m-be-oe/2;i={mode:"icon",width:oe,left:Math.min(Math.max(d,M),E),level:l}}}i||(i={mode:"icon",width:oe,left:Math.max(n.getBoundingClientRect().right-t.getBoundingClientRect().left+be+oe/2,0),level:s.length-1}),t.classList.toggle("search-icon",i.mode==="icon"),i.mode==="full"?t.style.setProperty("--top-bar-search-width",Math.round(i.width)+"px"):t.style.setProperty("--top-bar-search-left",Math.round(i.left)+"px"),Vo=Wo(t,n,r)}}function di(){var e=document.getElementById("top-bar");if(!(!e||typeof ResizeObserver>"u")){var t=!1,n=function(a){t||(t=!0,requestAnimationFrame(function(){t=!1,zo(a===!0)}))},r=new ResizeObserver(function(){n(!1)});r.observe(e),[".top-bar-left-pills",".top-bar-actions"].forEach(function(a){var s=e.querySelector(a);s&&r.observe(s)}),new MutationObserver(function(){n(!0)}).observe(e.querySelector(".top-bar-actions"),{childList:!0,subtree:!0,characterData:!0}),zo(!0)}}function ci(){var e=document.querySelector("#main-column > .title-bar-content"),t=document.getElementById("top-bar");if(!(!e||!t)){var n=function(){t.classList.toggle("title-bar-hidden",e.classList.contains("hidden"))};n(),new MutationObserver(n).observe(e,{attributes:!0,attributeFilter:["class"]})}}function Go(){var e=window.matchMedia(ai);qo(e.matches),e.addEventListener("change",function(){qo(e.matches)}),ci(),di()}var Qo={},at={},x=null,B=null,j=null,Jo=0,$o=[],Ne={},it=null;function Ko(e){Qo[e.id]=e}function ot(e,t){at[e]=t}function Xo(e,t){var n=Qo[e];n&&(j=n,Jo=0,$o=[],it=t||null,ui(),Oe(n.steps[0].id),B.classList.remove("hidden"),x.classList.remove("hidden"),setTimeout(function(){x.focus()},50))}function ye(){B&&B.classList.add("hidden"),x&&x.classList.add("hidden");var e=it;j=null,it=null,e&&e()}function Zo(){pi(),mi()}function ui(){x||(B=document.createElement("div"),B.className="playbook-overlay hidden",B.addEventListener("click",function(e){e.target===B&&ye()}),x=document.createElement("div"),x.className="playbook-modal hidden",x.setAttribute("tabindex","-1"),x.addEventListener("keydown",function(e){e.key==="Escape"&&ye()}),B.appendChild(x),document.body.appendChild(B))}function Oe(e){if(j){for(var t=null,n=0,r=0;r<j.steps.length;r++)if(j.steps[r].id===e){t=j.steps[r],n=r;break}if(t){if(Jo=n,$o.push(e),t.condition&&t.branches){var a=t.condition(),s=t.branches[a]||t.branches.default;if(s){Oe(s);return}}fi(t)}}}function fi(e){for(var t=j,n=t.steps.filter(function(k){return!k.condition}).length,r=0,a=0,s=0;s<t.steps.length;s++)t.steps[s].condition||(a++,t.steps[s].id===e.id&&(r=a));var i="";i+='<div class="playbook-header">',i+='<div class="playbook-header-left">',i+='<span class="playbook-icon">'+(t.icon||"\u{1F4D6}")+"</span>",i+='<span class="playbook-title">'+ae(t.title)+"</span>",i+="</div>",i+='<button class="playbook-close" title="Close">×</button>',i+="</div>",i+='<div class="playbook-progress">';for(var l=0;l<n;l++){var c="playbook-progress-dot";l+1<r?c+=" done":l+1===r&&(c+=" active"),i+='<span class="'+c+'"></span>'}i+="</div>",i+='<div class="playbook-body">',i+='<h2 class="playbook-step-title">'+ae(e.title)+"</h2>";var d=typeof e.body=="function"?e.body():e.body||"";if(i+='<div class="playbook-step-body">'+d+"</div>",e.note&&(i+='<div class="playbook-step-note">'+ae(e.note)+"</div>"),i+="</div>",e.actions&&e.actions.length>0){i+='<div class="playbook-actions">';for(var u=0;u<e.actions.length;u++){var p=e.actions[u],m="playbook-btn";u===0?m+=" playbook-btn-primary":m+=" playbook-btn-secondary",i+='<button class="'+m+'" data-action="'+(p.action||"")+'" data-next="'+(p.next||"")+'">'+ae(p.label)+"</button>"}i+="</div>"}x.innerHTML=i,D();var v=x.querySelector(".playbook-close");v&&v.addEventListener("click",ye);for(var y=x.querySelectorAll(".playbook-btn"),M=0;M<y.length;M++)(function(k){k.addEventListener("click",function(){var A=k.dataset.action,h=k.dataset.next;A&&at[A]?(k.disabled=!0,k.textContent+="...",at[A](function(){h?Oe(h):(Yo(j.id),ye())})):h?Oe(h):(Yo(j.id),ye())})})(y[M]);for(var E=x.querySelectorAll("[data-copy-url]"),P=0;P<E.length;P++)(function(k){k.addEventListener("click",function(A){A.stopPropagation();var h=k.dataset.copyUrl;navigator.clipboard.writeText(h).then(function(){k.textContent="Copied!",setTimeout(function(){k.textContent="Copy"},1500)})})})(E[P])}function Yo(e){Ne[e]=!0;try{localStorage.setItem("clay-playbooks-done",JSON.stringify(Ne))}catch{}}function pi(){try{var e=JSON.parse(localStorage.getItem("clay-playbooks-done")||"{}");Ne=e||{}}catch{Ne={}}}function mi(){if(Ko({id:"push-notifications",title:"Push Notifications",icon:"\u{1F514}",description:"Get notified when Claude finishes a long task",tipMatch:function(t){return t.indexOf("Push notification")!==-1},steps:[{id:"intro",title:"Never miss a response",body:"When Claude is working on a long task, you can walk away and get a push notification the moment it's done. Works even when Clay is in the background.",actions:[{label:"Enable notifications",action:"notif_request",next:"check_perm"},{label:"Not now",next:""}]},{id:"check_perm",condition:function(){return typeof Notification>"u"?"unsupported":Notification.permission},branches:{granted:"test",denied:"denied",default:"denied",unsupported:"unsupported"}},{id:"test",title:"Let's test it!",body:"Click below to send a test notification. You should see it pop up from your system.",actions:[{label:"Send test notification",action:"notif_test",next:"check_test"},{label:"Skip",next:"done"}]},{id:"check_test",title:"Did you see it?",body:"A notification should have appeared from your system just now.",actions:[{label:"Yes, it worked!",next:"done"},{label:"No, nothing appeared",next:"troubleshoot"}]},{id:"troubleshoot",title:"Troubleshooting",body:function(){var t=navigator.platform&&navigator.platform.indexOf("Mac")!==-1,n="your browser",r=navigator.userAgent||"";r.indexOf("Arc")!==-1?n="Arc":r.indexOf("Edg/")!==-1?n="Edge":r.indexOf("Firefox")!==-1?n="Firefox":r.indexOf("Chrome")!==-1?n="Chrome":r.indexOf("Safari")!==-1&&(n="Safari");var a=location.protocol==="https:"&&location.hostname!=="localhost"&&location.hostname!=="127.0.0.1",s="The browser says permission is granted, but the notification didn't show.<br><br>";return a&&(s+="\u{1F512} <strong>Untrusted certificate?</strong><br>If you're using a self-signed or untrusted TLS certificate, some browsers silently block notifications even on HTTPS.<br>Run <strong>mkcert -install</strong> on the server to trust the root CA, or add the certificate to your system keychain as trusted.<br><br>"),s+="<strong>Also check your OS notification settings:</strong><br>",t?s+="<strong>1.</strong> Open <strong>System Settings \u2192 Notifications</strong><br><strong>2.</strong> Find <strong>"+n+"</strong> in the list<br><strong>3.</strong> Make sure <strong>Allow Notifications</strong> is turned on<br><strong>4.</strong> Check that <strong>Do Not Disturb</strong> / Focus mode is off<br>":s+="<strong>1.</strong> Make sure notifications are enabled for <strong>"+n+"</strong><br><strong>2.</strong> Check that Do Not Disturb / Focus mode is off<br>",s+="<br>After adjusting, come back and try again.",s},actions:[{label:"Try again",action:"notif_test",next:"check_test"},{label:"I'll fix it later",next:"done"}]},{id:"denied",title:"Permission needed",body:function(){var t=!window.isSecureContext||location.protocol==="http:"&&location.hostname!=="localhost"&&location.hostname!=="127.0.0.1"&&location.hostname!=="[::1]";if(t)return"\u26A0\uFE0F <strong>Insecure context detected.</strong><br><br>Notifications require a <strong>secure context</strong> (HTTPS or localhost). You're accessing Clay over <strong>"+location.protocol+"//"+location.hostname+"</strong>, so the browser automatically blocks notifications.<br><br><strong>How to fix:</strong><br><strong>1.</strong> Access Clay via <strong>https://</strong> (set up a TLS certificate)<br><strong>2.</strong> Or access via <strong>localhost:"+location.port+"</strong> instead of an IP address<br>";var n="chrome://settings/content/notifications",r=navigator.userAgent||"";return r.indexOf("Firefox")!==-1?n="about:preferences#privacy":r.indexOf("Edg/")!==-1?n="edge://settings/content/notifications":r.indexOf("Arc")!==-1&&(n="arc://settings/content/notifications"),'Your browser blocked the notification permission.<br><br><strong>1.</strong> Click the lock icon in the address bar<br><strong>2.</strong> Find "Notifications" and set it to "Allow"<br><strong>3.</strong> Reload the page<br><br>Or paste this into your address bar:<br><div style="display:flex;align-items:center;gap:6px;margin-top:6px"><code style="font-size:12px;color:var(--accent);flex:1;user-select:all">'+n+'</code><button class="playbook-btn-secondary" style="padding:3px 8px;font-size:11px" data-copy-url="'+n+'">Copy</button></div>'},actions:[{label:"Got it",next:""}]},{id:"unsupported",title:"Not supported",body:"Your browser doesn't support notifications. Try Chrome, Edge, or Firefox for the best experience.",actions:[{label:"Got it",next:""}]},{id:"done",title:"All set! \u{1F389}",body:"You'll now get a notification whenever Claude finishes processing. This works even when Clay is minimized or in another tab.",note:"You can toggle notifications anytime from the header bar.",actions:[{label:"Done",next:""}]}]}),ot("notif_request",function(t){if(typeof Notification>"u"){t();return}Notification.requestPermission().then(function(n){if(n==="granted")try{localStorage.setItem("notif-alert","1");var r=document.getElementById("notif-toggle-alert");r&&(r.checked=!0)}catch{}t()}).catch(function(){t()})}),ot("notif_test",function(t){if(typeof Notification>"u"){t();return}if(Notification.permission!=="granted"){Notification.requestPermission().then(function(n){n==="granted"?e(t):t()}).catch(function(){t()});return}e(t)}),location.protocol==="https:"){let t=function(){var a=navigator.userAgent||"",s=navigator.platform||"";return s.indexOf("Mac")!==-1||a.indexOf("Mac")!==-1?"mac":s.indexOf("Win")!==-1||a.indexOf("Windows")!==-1?"windows":"linux"},n=function(){var a=t(),s="The certificate has been downloaded as <strong>clay-ca.pem</strong>.<br><br>";return a==="mac"?(s+="<strong>macOS \u2014 run in Terminal:</strong><br>",s+=r("sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/Downloads/clay-ca.pem")):a==="windows"?(s+="<strong>Windows \u2014 run in PowerShell (Admin):</strong><br>",s+=r('certutil -addstore -f "Root" %USERPROFILE%\\Downloads\\clay-ca.pem')):(s+="<strong>Linux \u2014 run in terminal:</strong><br>",s+=r("sudo cp ~/Downloads/clay-ca.pem /usr/local/share/ca-certificates/clay-ca.crt && sudo update-ca-certificates")),s+='<br><div style="padding:8px 10px;background:var(--bg-deeper);border-radius:6px;border-left:3px solid var(--accent)"><strong style="font-size:11px">Or ask Claude Code:</strong><br><code style="font-family:monospace;font-size:12px;line-height:1.5;color:var(--text-secondary)">Install ~/Downloads/clay-ca.pem as a trusted root certificate</code></div>',s+="<br>Then <strong>restart your browser</strong> to apply the change.",s},r=function(a){return'<div style="margin-top:8px;position:relative;background:var(--bg-deeper);border-radius:6px;padding:8px 10px"><code style="display:block;font-family:monospace;font-size:12px;word-break:break-all;line-height:1.5;padding-right:50px">'+ae(a)+'</code><button class="playbook-btn-secondary" style="position:absolute;top:8px;right:8px;padding:2px 8px;font-size:11px;white-space:nowrap" data-copy-url="'+ae(a)+'">Copy</button></div>'};Ko({id:"trust-certificate",title:"Trust Certificate",icon:"\u{1F512}",description:"Getting certificate warnings? Fix them here",tipMatch:function(a){return a.indexOf("certificate")!==-1||a.indexOf("Certificate")!==-1},steps:[{id:"intro",title:"Getting certificate warnings?",body:"Clay generates a local CA certificate for secure HTTPS connections. Your browser may show warnings until you install and trust this certificate on your device.",actions:[{label:"Download certificate",action:"cert_download",next:"install"},{label:"Not now",next:""}]},{id:"install",title:"Install the certificate",body:n,actions:[{label:"Done, I installed it",next:"done"},{label:"I'll do it later",next:""}]},{id:"done",title:"All set! \u{1F389}",body:"After restarting your browser, certificate warnings should disappear. If you still see them, make sure you ran the terminal command with admin privileges.",actions:[{label:"Done",next:""}]}]}),ot("cert_download",function(a){var s=document.createElement("a");s.href="/ca/download",s.download="clay-ca.pem",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(a,500)})}function e(t){try{var n=new Notification("Clay",{body:"Notifications are working! \u{1F389}",tag:"clay-test-"+Date.now()});n.onclick=function(){window.focus(),n.close()},setTimeout(function(){try{n.close()}catch{}},5e3)}catch(r){console.warn("[Playbook] Notification failed:",r)}setTimeout(t,800)}}function ae(e){var t=document.createElement("div");return t.textContent=e||"",t.innerHTML}function ea(e){var t=document.createElement("span");t.className="stt-meter",t.setAttribute("aria-hidden","true");var n=document.createElement("canvas");t.appendChild(n);var r=n.getContext("2d"),a=null,s=0,i=[],l=window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function c(d){a=null;var u=o.get("speechActive");if(!(!u||u.id!==e||!t.isConnected||!r)&&(a=requestAnimationFrame(c),!(d-s<(l?100:32)))){s=d;var p=t.clientWidth,m=t.clientHeight,v=Math.min(window.devicePixelRatio||1,2);(n.width!==Math.round(p*v)||n.height!==Math.round(m*v))&&(n.width=Math.round(p*v),n.height=Math.round(m*v)),r.setTransform(v,0,0,v,0,0),r.clearRect(0,0,p,m);var y=getComputedStyle(t),M=r.createLinearGradient(0,0,p,0);M.addColorStop(0,y.getPropertyValue("--brand-green").trim()||y.color),M.addColorStop(.5,y.getPropertyValue("--brand-blue").trim()||y.color),M.addColorStop(1,y.getPropertyValue("--brand-green").trim()||y.color),r.fillStyle=M;for(var E=u.audioSignal,P=E?E.levels:[],k=E?Date.now()-E.updatedAt:0,A=Math.max(0,1-Math.max(0,k-250)/900),h=Math.max(2,Math.floor(p/4)),b=Math.round(Math.min(160,Math.max(80,h))*1.25),R=l?0:Math.min(1,k/20),S=0;S<h;S++){var _=P.length-b+S/(h-1)*(b-1)+R,N=Math.floor(_),Le=_-N,J=P[N]||0,Te=P[Math.min(N+1,P.length-1)]||0,$=(J+(Te-J)*Le)*A,O=i[S]||0,X=l?$:O+($-O)*($>O?.5:.24);i[S]=X;for(var G=1+X*(m*.46-1),Re=Math.min(1,(S+1)/8,(h-S)/8),Z=0;Z<=m*.48;Z+=3.2){var Ye=Math.exp(-Math.pow(Z/G,2)*1.7);if(!(Ye<.035)){var Rt=.35+Ye*.65;r.globalAlpha=(.12+Ye*.78)*Re,r.beginPath(),r.arc((S+.5)*p/h,m/2+Z,Rt,0,Math.PI*2),r.fill(),Z&&(r.beginPath(),r.arc((S+.5)*p/h,m/2-Z,Rt,0,Math.PI*2),r.fill())}}}r.globalAlpha=1}}return{element:t,update:function(d){t.hidden=!d,d&&a===null&&(a=requestAnimationFrame(c)),!d&&a!==null&&(cancelAnimationFrame(a),a=null,i=[])}}}function ta(e,t,n){var r=document.getElementById(e),a=document.getElementById(t),s=document.getElementById(n);if(!r||!a||!s||r.dataset.speechBound)return;var i=document.getElementById(e==="stt-btn"?"input-row":"home-mate-chat-composer")||s,l=document.getElementById(e==="stt-btn"?"input-bottom":"home-mate-chat-composer")||i;r.addEventListener("click",Fe),r.dataset.speechBound="true",r.classList.add("stt-button");var c=document.createElement("span");c.className="stt-controls",r.before(c),c.appendChild(r);var d=document.createElement("button");d.type="button",d.id=e+"-picker",d.className="stt-picker-toggle",d.innerHTML=ee("chevron-down"),d.setAttribute("aria-label","Choose voice model"),d.setAttribute("aria-haspopup","dialog"),d.setAttribute("aria-expanded","false"),d.title="Choose voice model",c.appendChild(d),d.addEventListener("click",function(){Fe(),Be(d)});var u=document.createElement("div");u.className="stt-progress",u.hidden=!0;var p=document.createElement("span");p.id=e+"-status",p.className="stt-status",p.setAttribute("role","status");var m=document.createElement("span");m.className="stt-timer",m.setAttribute("aria-hidden","true");var v=document.createElement("button");v.type="button",v.innerHTML=ee("x"),v.className="stt-cancel",v.title="Cancel voice input",v.setAttribute("aria-label","Cancel voice input"),v.addEventListener("click",function(){te(),o.set({speechRetry:null})});var y=ea(e),M=document.createElement("button");M.type="button",M.textContent="Retry",M.addEventListener("click",sr);var E=document.createElement("a");E.textContent="Provider account",E.target="_blank",E.rel="noopener noreferrer";var P=document.createElement("button");P.type="button",P.textContent="Dismiss",P.addEventListener("click",function(){nr(e,"")}),u.append(v,y.element,m,p,M,E,P),i.prepend(u),r.setAttribute("aria-describedby",p.id),r.addEventListener("click",function(){var h=o.get("speechActive");if(h&&h.id===e){h.model&&h.phase==="recording"?ir():te();return}var b=et(),R=o.get("speechSettings");if(b.provider==="browser"&&!Xe().available){Be(d);return}if(b.provider!=="browser"&&(!R||R.configured.indexOf(b.provider)<0)){Be(d);return}b.provider==="browser"?rr(e,a):ar(e,a,b)}),a.addEventListener("beforeinput",function(){var h=o.get("speechActive");h&&h.id===e&&te("Voice input stopped so you can edit your draft."),o.set({speechRetry:null})}),a.addEventListener("input",function(){var h=o.get("speechActive");h&&h.id===e&&!h.writing&&te()});function k(){var h=o.get("speechActive"),b=!!h&&h.id===e,R=et(),S=br(R.provider),_=R.provider==="browser"?o.get("speechBrowserIdentity"):null,N=b&&h.model&&h.phase!=="recording",Le=b&&!!h.autoSend;i.classList.toggle("stt-recording",b),u.classList.toggle("stt-auto-send",Le),u.classList.toggle("stt-progress-active",b),u.classList.toggle("stt-progress-pending",!!N);var J=b?l:i;(u.parentElement!==J||u!==J.firstElementChild)&&J.prepend(u),y.update(b?h:null),d.hidden=b,r.disabled=a.disabled||a.readOnly||!o.get("speechSettings"),d.disabled=a.disabled||a.readOnly||b,r.classList.toggle("stt-active",b),r.setAttribute("aria-pressed",String(b));var Te=b?Le?"Cancel pending voice send":N?"Cancel voice input":R.mode==="recorded"?"Stop and transcribe":"Stop voice input":"Start voice input";r.setAttribute("aria-label",Te+" \xB7 "+(S?S.name+" \xB7 ":"")+R.name),r.title=Te+" \xB7 "+R.name;var $=[b,N,S&&S.id,_&&_.id].join(":");if(r.dataset.speechIcon!==$){if(r.dataset.speechIcon=$,r.innerHTML=ee(b?N?"x":"square":"mic"),!b&&(S||_&&_.icon)){var O=document.createElement("img");O.className="stt-vendor-badge",O.src=S?S.icon:_.icon,O.alt="",r.appendChild(O)}D()}var X=(o.get("speechStatuses")||{})[e]||"",G=(o.get("speechErrors")||{})[e];u.classList.toggle("stt-progress-error",!!G),p.setAttribute("role",G?"alert":"status"),P.hidden=!G,E.hidden=!G||!S,S&&(E.href=S.url),R.provider==="browser"&&!tr()&&(X="Browser voice input is unavailable. Choose a connected speech provider or type your message."),window.isSecureContext||(X="Voice input requires a secure HTTPS connection."),p.textContent=X,m.textContent=b&&h.startTime?Math.floor((Date.now()-h.startTime)/6e4)+":"+String(Math.floor((Date.now()-h.startTime)/1e3)%60).padStart(2,"0"):"",v.hidden=!b;var Re=o.get("speechRetry");M.hidden=!Re||Re.id!==e,u.hidden=!b&&!G&&M.hidden}o.subscribe(k);var A=new MutationObserver(k);A.observe(a,{attributes:!0,attributeFilter:["disabled","readonly"]}),k()}function Fe(){o.set({speechBrowserIdentity:Xe()})}function na(){Fe(),window.addEventListener("focus",Fe),or(),yr(),ta("stt-btn","input","input-wrapper"),ta("home-stt-btn","home-mate-chat-input","home-mate-chat-composer-frame"),Ae(),window.addEventListener("focus",Ae);try{window.top.document.addEventListener("clay:speech-settings-saved",Ae)}catch{}}var g=null,T=null,Se=null;function we(){return document.body.dataset.myDisplayName||"Clay user"}function se(e){if(g){var t=g.querySelector("#account-ai-section");t&&wr(t),g.remove(),g=null,T.setAttribute("aria-expanded","false"),T.setAttribute("aria-label","Open account menu for "+we()),document.removeEventListener("pointerdown",ra),document.removeEventListener("focusin",oa),document.removeEventListener("keydown",aa),window.removeEventListener("resize",ie),o.set({defaultAiInlineEditing:!1}),e&&Se&&document.contains(Se)&&Se.focus({preventScroll:!0}),Se=null}}function dt(e){return e&&e.closest&&e.closest(".avatar-positioner-overlay")}function ra(e){!g||g.contains(e.target)||T.contains(e.target)||dt(e.target)||se(!1)}function oa(e){!g||g.contains(e.target)||T.contains(e.target)||dt(e.target)||se(!1)}function aa(e){e.key==="Escape"&&(dt(e.target)||document.querySelector(".avatar-positioner-overlay")||(e.preventDefault(),e.stopPropagation(),se(!0)))}function ie(){if(!(!g||!T)){var e=T.getBoundingClientRect(),t=Math.min(280,window.innerWidth-24),n=Math.max(12,Math.min(window.innerWidth-t-12,e.left));g.style.width=t+"px",g.style.left=n+"px",g.style.top=Math.max(12,e.top-g.offsetHeight-8)+"px"}}function st(e){var t=g&&g.querySelector(".account-identity-copy");t&&(t.innerHTML='<button type="button" id="account-name-edit" class="account-name-display"><span></span><i data-lucide="pencil" aria-hidden="true"></i></button><small>Personal account</small>',t.querySelector("span").textContent=we(),t.querySelector("#account-name-edit").addEventListener("click",gi),window.lucide&&window.lucide.createIcons({nodes:[t]}),e&&t.querySelector("#account-name-edit").focus())}function gi(){var e=g&&g.querySelector(".account-identity-copy");if(e){var t=document.createElement("input");t.id="account-profile-name",t.setAttribute("aria-label","Display name"),t.className="account-name-input",t.type="text",t.maxLength=50,t.autocomplete="name",t.value=o.get("accountNameDraft")===void 0?Ze().name||"":o.get("accountNameDraft"),t.addEventListener("input",function(){o.set({accountNameDraft:t.value})}),e.innerHTML="",e.appendChild(t);var n=document.createElement("small");n.textContent="Enter to save \xB7 Escape to cancel",e.appendChild(n),t.addEventListener("keydown",function(r){r.key==="Enter"?(r.preventDefault(),t.disabled=!0,n.textContent="Saving\u2026",lr({name:t.value.trim()}).then(function(){o.set({accountNameDraft:void 0}),st(!0)}).catch(function(a){t.disabled=!1,n.textContent=a.message,t.focus()})):r.key==="Escape"&&(r.preventDefault(),o.set({accountNameDraft:void 0}),st(!0)),r.stopPropagation()}),t.focus(),t.select()}}function hi(){var e=g&&g.querySelector("#account-avatar-editor");e&&(e.hidden=!e.hidden,e.hidden||e.querySelector("#account-avatar-upload").focus(),ie())}function vi(){var e=g.querySelector("#account-avatar-edit"),t=g.querySelector("#account-avatar-editor"),n=t.querySelector("#account-avatar-upload"),r=t.querySelector("#account-avatar-file"),a=t.querySelector("#account-avatar-generate");e.addEventListener("click",function(s){s.stopPropagation(),hi()}),t.addEventListener("click",function(s){s.stopPropagation()}),n.addEventListener("click",function(){r.click()}),r.addEventListener("change",function(){var s=r.files&&r.files[0];if(s){var i=new Image,l=URL.createObjectURL(s);i.onload=function(){ur(i,l,function(c){URL.revokeObjectURL(l),cr(c).then(function(){t.hidden=!0}).catch(function(){t.dataset.error="true"})})},i.src=l}}),a.addEventListener("click",function(){dr(),t.hidden=!0})}function bi(){g=document.createElement("div"),g.id="account-popover",g.className="account-popover",g.setAttribute("role","dialog"),g.setAttribute("aria-label","Account");var e=Ze(),t=document.createElement("div");t.className="account-menu-identity",t.innerHTML='<button type="button" id="account-avatar-edit" class="account-avatar-edit" aria-label="Edit avatar"><img src="'+(document.body.dataset.myAvatarUrl||"")+'" alt=""></button><div class="account-identity-copy"></div><button type="button" class="account-settings-button" aria-label="User Settings" title="User Settings"><i data-lucide="settings" aria-hidden="true"></i></button>',t.querySelector("#account-avatar-edit img").alt=e.name||"Clay user";var n=document.createElement("div");n.id="account-avatar-editor",n.className="account-avatar-editor",n.hidden=!0,n.innerHTML='<button type="button" id="account-avatar-upload">Upload photo</button><button type="button" id="account-avatar-generate">Generate avatar</button><input id="account-avatar-file" type="file" accept="image/*">',g.appendChild(t),g.appendChild(n);var r=document.createElement("section");r.id="account-ai-section",r.className="account-inline-section account-ai-section",r.setAttribute("aria-label","Default AI"),g.appendChild(r),Sr(r),t.querySelector(".account-settings-button").addEventListener("click",yi),document.body.appendChild(g),st(),vi(),lt(),window.lucide&&window.lucide.createIcons({nodes:[g]}),ie()}function lt(){var e=document.getElementById("cursor-share-toggle");if(e){var t=o.get("cursorSharingHydrated")===!0,n=t&&o.get("cursorSharingEnabled")===!0,r=o.get("cursorSharingPending")!==null&&o.get("cursorSharingPending")!==void 0,a=o.get("connected")!==!1,s=o.get("cursorSharingError"),i=!!s&&!t&&a,l=t&&!n&&!r&&!s&&a;e.hidden=o.get("isMultiUserMode")!==!0,e.removeAttribute("role"),e.removeAttribute("aria-checked"),e.setAttribute("aria-pressed",n?"true":"false"),e.classList.toggle("on",n),e.classList.toggle("off",l),e.classList.toggle("pending",r),e.disabled=r||!a||!t&&!i;var c=r?"waiting":a?s?i?"error; activate to retry":"error":t?n?"on":"off":"unavailable":"offline";e.setAttribute("aria-label","Cursor sharing "+c);var d=r?"Cursor sharing is waiting for confirmation.":a?s?i?"Cursor sharing is unavailable. Click to retry.":"Cursor sharing is unavailable.":t?n?"Your cursor is visible to others. Click to stop sharing.":"Cursor sharing is off. Click to share your cursor.":"Cursor sharing is unavailable.":"Cursor sharing is offline.";Bn(e,d)}}function yi(e){e.stopPropagation(),se(!0),Cr()}function Si(e){if(e.stopPropagation(),!e.currentTarget.disabled){if(o.get("cursorSharingError")&&o.get("cursorSharingHydrated")!==!0){Dr();return}Rr(o.get("cursorSharingEnabled")!==!0)}}function wi(){var e=g&&g.querySelector("#account-ai-section select");e&&e.focus({preventScroll:!0})}function ki(){g||ia(),o.set({defaultAiInlineEditing:!0}),wi()}function ia(){if(g){se(!0);return}Se=document.activeElement,bi(),T.setAttribute("aria-expanded","true"),T.setAttribute("aria-label","Close account menu for "+we()),document.addEventListener("pointerdown",ra),document.addEventListener("focusin",oa),document.addEventListener("keydown",aa),window.addEventListener("resize",ie)}function sa(){if(T=document.getElementById("user-account-trigger"),!!T){T.addEventListener("click",ia),document.addEventListener("clay:open-account-default-ai",ki);var e=document.getElementById("cursor-share-toggle");e&&e.addEventListener("click",Si),lt(),T.setAttribute("aria-label","Open account menu for "+we()),o.subscribe(function(t,n){t.myUserId!==n.myUserId&&t.accountNameDraft!==void 0&&o.set({accountNameDraft:void 0}),(t.myUserId!==n.myUserId||t.connected===!1&&n.connected!==!1)&&se(!1),lt(),g&&ie()}),document.addEventListener("clay:profile-updated",function(){if(g){var t=g.querySelector(".account-name-display span");t&&(t.textContent=we());var n=g.querySelector("#account-avatar-edit img");n&&(n.src=document.body.dataset.myAvatarUrl||n.src)}}),window.addEventListener("resize",ie)}}var Ci=[{id:"file-browser-btn",icon:"folder-tree",label:"File browser"},{id:"terminal-sidebar-btn",icon:"square-terminal",label:"Terminal",countId:"terminal-sidebar-count"},{id:"sticky-notes-sidebar-btn",icon:"sticky-note",label:"Sticky Notes",countId:"sticky-notes-sidebar-count"},{id:"project-logs-btn",icon:"notebook-tabs",label:"Logs",countId:"project-logs-count"},{id:"mcp-btn",icon:"cable",label:"MCP / Skills",countId:"mcp-sidebar-count"},{id:"scheduler-btn",icon:"calendar-clock",label:"Scheduled"},{id:"issues-btn",icon:"circle-dot",label:"Issues"},{id:"shared-browser-btn",icon:"globe",label:"Browser"}],Mi=[{id:"mate-memory-btn",icon:"brain",label:"Memory",countId:"mate-memory-count"},{id:"mate-knowledge-btn",icon:"book-open",label:"Knowledge",countId:"mate-knowledge-count"},{id:"mate-sticky-notes-btn",icon:"sticky-note",label:"Sticky Notes"},{id:"mate-debates-btn",icon:"messages-square",label:"Debates"},{id:"mate-mcp-btn",icon:"cable",label:"MCP / Skills",countId:"mate-mcp-sidebar-count"}],de={session:{tools:Ci,fixedTools:[{id:"you-button",icon:"user-round",label:"Me",countId:"me-unread-badge",fixed:!0,scope:"clay"}],activeContainerId:"session-actions",hiddenSectionId:"session-actions-hidden"},mate:{tools:Mi,activeContainerId:"mate-sidebar-tools",hiddenSectionId:"mate-sidebar-tools-hidden"}},Ei={"skills-btn":"mcp-btn"},Pi={"mate-skills-btn":"mate-mcp-btn","mate-debate-btn":"mate-debates-btn"},la=["git-sidebar-btn","loop-tool-btn","debates-btn"];function le(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}function ua(e,t){var n=t&&t.order||[],r=t&&t.hidden||[],a={order:n.slice(),hidden:r.slice(),migrated:!1};if(e!=="session"&&e!=="mate")return a;for(var s=e==="mate"?Pi:Ei,i=Object.keys(s),l=0;l<i.length;l++){var c=i[l],d=s[c],u=le(a.order,c)!==-1,p=le(a.hidden,c)!==-1;if(!(!u&&!p)){var m=le(a.order,d)!==-1||le(a.hidden,d)!==-1;a.order=ca(a.order,c,d,m),a.hidden=ca(a.hidden,c,d,m),a.migrated=!0}}if(e!=="session")return a;for(var v=0;v<la.length;v++){var y=la[v];le(a.order,y)===-1&&le(a.hidden,y)===-1||(a.order=da(a.order,y),a.hidden=da(a.hidden,y),a.migrated=!0)}return a}function da(e,t){for(var n=[],r=0;r<e.length;r++)e[r]!==t&&n.push(e[r]);return n}function ca(e,t,n,r){for(var a=[],s={},i=0;i<e.length;i++){var l=e[i];if(l===t){if(r)continue;l=n}s[l]||(s[l]=!0,a.push(l))}return a}var He={},q=null,ce=null;function ma(){for(var e in de)xi(e);Li(),D()}function xi(e){var t=de[e],n=document.getElementById(t.activeContainerId);if(n){(t.fixedTools||[]).forEach(function(a){n.appendChild(fa(a,e))});for(var r=0;r<t.tools.length;r++)n.appendChild(fa(t.tools[r],e));n.addEventListener("dragover",function(a){if(!(ce!==e||!q)){a.preventDefault(),a.dataTransfer&&(a.dataTransfer.dropEffect="move");var s=Ii(n,a.clientX,a.clientY);s==null?(q.parentNode!==n||q.nextSibling)&&n.appendChild(q):s!==q&&n.insertBefore(q,s)}}),n.addEventListener("drop",function(a){ce===e&&a.preventDefault()})}}function fa(e,t){var n=document.createElement("button");n.id=e.id,n.type="button",n.className="palette-tile",n.title=e.label,n.setAttribute("aria-label",e.label),n.dataset.toolId=e.id,n.dataset.palette=t,n.draggable=!0,e.fixed&&(n.draggable=!1,n.dataset.fixed="true"),e.scope&&(n.dataset.scope=e.scope),e.id==="you-button"&&(n.classList.add("you-button"),n.setAttribute("aria-pressed","false"));var r=document.createElement("i");r.setAttribute("data-lucide",e.icon),n.appendChild(r);var a=document.createElement("span");if(a.className="tool-btn-label",a.textContent=e.label,n.appendChild(a),e.countId){var s=document.createElement("span");s.id=e.countId,s.className="sidebar-badge hidden",e.id==="you-button"&&(s.className="sidebar-badge me-unread-badge",s.hidden=!0),n.appendChild(s)}return n.addEventListener("dragstart",function(i){if(e.fixed){i.preventDefault();return}var l=n.parentNode;if(!l||l.id!==de[t].activeContainerId){i.preventDefault();return}q=n,ce=t,i.dataTransfer.effectAllowed="move";try{i.dataTransfer.setData("text/plain",e.id)}catch{}n.classList.add("dragging")}),n.addEventListener("dragend",function(){n.classList.remove("dragging"),ce&&Ti(ce),q=null,ce=null}),n}function Ii(e,t,n){for(var r=Array.prototype.slice.call(e.querySelectorAll("[data-tool-id]:not(.dragging)")),a=null,s=Number.POSITIVE_INFINITY,i=0;i<r.length;i++)if(r[i].dataset.fixed!=="true"){var l=r[i].getBoundingClientRect(),c=n-(l.top+l.height/2),d=t-(l.left+l.width/2),u=Math.abs(c)*2+Math.abs(d),p=c<-l.height/2||Math.abs(c)<=l.height/2&&d<0;p&&u<s&&(s=u,a=r[i])}return a}function Li(){fetch("/api/user/tool-palettes",{credentials:"same-origin"}).then(function(e){return e.ok?e.json():null}).then(function(e){e&&(pa("session",e.session||null),pa("mate",e.mate||null))}).catch(function(){})}function pa(e,t){if(!t)return;var n=de[e];if(!n)return;var r=document.getElementById(n.activeContainerId);if(!r)return;var a=ua(e,t),s={};function i(v){if(!s[v]){var y=document.getElementById(v);!y||y.dataset.fixed==="true"||(r.appendChild(y),s[v]=!0)}}for(var l={},c=0;c<a.hidden.length;c++)l[a.hidden[c]]=!0;for(var d=0;d<a.order.length;d++)l[a.order[d]]||i(a.order[d]);for(var u=0;u<n.tools.length;u++)l[n.tools[u].id]||i(n.tools[u].id);for(var p=0;p<a.hidden.length;p++)i(a.hidden[p]);for(var m=0;m<n.tools.length;m++)i(n.tools[m].id)}function Ti(e){He[e]&&clearTimeout(He[e]),He[e]=setTimeout(function(){He[e]=null,Ri(e)},250)}function Ri(e){var t=de[e];if(t){var n=document.getElementById(t.activeContainerId);if(n){for(var r=[],a=n.querySelectorAll("[data-tool-id]"),s=0;s<a.length;s++)a[s].dataset.fixed!=="true"&&r.push(a[s].dataset.toolId);fetch("/api/user/tool-palettes",{method:"PUT",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({palette:e,order:r,hidden:[]})}).catch(function(){})}}}var ke=[],ct=[],I=null,K=null,ut=null,U=!1,Ce="project",V=0,C=[];function ga(e){e!=="project"&&e!=="mate"||(U&&W(!1),ft(e))}function ba(){Di(),K=I.querySelector(".cmd-palette-results"),ut=I.querySelector(".project-switcher-header");var e=o.get("currentSlug");e&&(ke=[e]);var t=o.get("dmTargetUser");t&&t.isMate&&t.id&&(ct=[t.id]),o.subscribe(function(d,u){d.currentSlug&&d.currentSlug!==u.currentSlug&&(va(ke,d.currentSlug),ke=ke);var p=ha(d.dmTargetUser),m=ha(u.dmTargetUser);p&&p!==m&&va(ct,p)});var n=I.querySelector(".cmd-palette-backdrop");n&&n.addEventListener("click",function(){W(!1)}),document.addEventListener("keydown",Ai,!0),document.addEventListener("keyup",Bi,!0),window.addEventListener("blur",function(){U&&W(!1)});var r=/Mac|iPhone|iPod|iPad/i.test(navigator.platform),a=r?"\u2318E":"Ctrl+E",s=r?"\u2318M":"Ctrl+M",i=document.getElementById("icon-strip-hint-project"),l=document.getElementById("icon-strip-hint-mate");i&&(i.textContent=a,i.title="Switch project ("+a+")",i.addEventListener("click",function(){ga("project")})),l&&(l.textContent=s,l.title="Switch mate ("+s+")",l.addEventListener("click",function(){ga("mate")}));function c(){if(l){var d=o.get("cachedMatesList")||[];l.classList.toggle("hidden",d.length===0)}}c(),o.subscribe(function(d,u){(d.cachedMatesList!==u.cachedMatesList||d.projectMateDmsEnabled!==u.projectMateDmsEnabled)&&c()})}function Di(){if(I=document.getElementById("project-switcher"),!I){var e=/Mac|iPhone|iPod|iPad/i.test(navigator.platform),t=e?"<kbd>\u2318</kbd>":"<kbd>Ctrl</kbd>";I=document.createElement("div"),I.id="project-switcher",I.className="cmd-palette hidden project-switcher",I.innerHTML='<div class="cmd-palette-backdrop"></div><div class="cmd-palette-dialog project-switcher-dialog"><div class="project-switcher-header">Switch project</div><div class="cmd-palette-results"></div><div class="cmd-palette-footer project-switcher-footer"><span class="project-switcher-shortcuts">'+t+'<kbd class="proj-next-key">E</kbd> next \xB7 <kbd>\u21E7</kbd>'+t+'<kbd class="proj-prev-key">E</kbd> prev \xB7 <kbd>\u23CE</kbd> select \xB7 <kbd>Esc</kbd> cancel</span></div></div>',document.body.appendChild(I)}}function ha(e){return e&&e.isMate&&e.id?e.id:null}function va(e,t){var n=e.indexOf(t);n!==-1&&e.splice(n,1),e.unshift(t)}function Ai(e){if(e.key){var t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase();if(t&&(n==="e"||n==="m")){var r=n==="e"?"project":"mate";e.preventDefault(),e.stopPropagation(),U?Ce!==r?ft(r):e.shiftKey?qe(-1):qe(1):ft(r);return}if(U){if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),W(!1);return}if(e.key==="Enter"){e.preventDefault(),e.stopPropagation(),W(!0);return}if(e.key==="ArrowRight"||e.key==="ArrowDown"){e.preventDefault(),qe(1);return}if(e.key==="ArrowLeft"||e.key==="ArrowUp"){e.preventDefault(),qe(-1);return}}}}function Bi(e){U&&(e.key==="Meta"||e.key==="Control")&&W(!0)}function ft(e){if(Ce=e,C=_i(e),C.length===0){U&&W(!1);return}ut&&(ut.textContent=e==="mate"?"Switch mate":"Switch project"),ji(e),Fi(),V=Ui(),pt(),I.classList.remove("hidden"),U=!0,D(),Ue(K)}function ji(e){var t=I.querySelector(".proj-next-key"),n=I.querySelector(".proj-prev-key"),r=e==="mate"?"M":"E";t&&(t.textContent=r),n&&(n.textContent=r)}function Ui(){if(C.length===0)return 0;for(var e=Ce==="mate"?ct:ke,t=ya(),n=0;n<e.length;n++){var r=e[n];if(r!==t){for(var a=0;a<C.length;a++)if(C[a].key===r&&!C[a].disabled)return a}}for(var s=0;s<C.length;s++)if(!C[s].disabled&&C[s].key!==t)return s;for(var i=0;i<C.length;i++)if(!C[i].disabled)return i;return 0}function ya(){if(Ce==="mate"){var e=tt(o.snap());return e?e.id:null}return o.get("currentSlug")}function _i(e){return e==="mate"?Oi():Ni()}function Ni(){var e=(ge()||[]).filter(function(t){return!t.isMate});return e.map(function(t){var n=eo(t);return{key:t.slug,title:t.title||t.project||t.slug,icon:t.icon||null,fallbackIcon:"folder",isCurrent:t.slug===o.get("currentSlug"),external:n,disabled:!1,disabledReason:null}})}function Oi(){var e=o.get("cachedMatesList")||[],t=tt(o.snap()),n=t?t.id:null;return e.map(function(r){return{key:r.id,title:r.displayName||r.name||r.id,icon:null,avatarUrl:Nt(r,88),fallbackIcon:"user",isCurrent:r.id===n,disabled:!1,disabledReason:null}})}function W(e){if(U&&(U=!1,I.classList.add("hidden"),!!e)){var t=C[V];!t||t.disabled||(Ce==="mate"?t.key!==ya()&&ao(t.key):t.key!==o.get("currentSlug")&&je(t.key))}}function qe(e){if(C.length!==0){for(var t=e>0?1:-1,n=V,r=0;r<C.length;r++)if(n=(n+t+C.length)%C.length,!C[n].disabled){V=n,pt();return}}}function Fi(){if(K){K.innerHTML="";for(var e=0;e<C.length;e++)K.appendChild(Hi(C[e],e))}}function Hi(e,t){var n=document.createElement("button");n.type="button",n.className="cmd-palette-item project-switcher-item",e.disabled&&n.classList.add("disabled"),e.disabled&&e.disabledReason&&(n.title=e.disabledReason),e.external&&(n.title=to(e.title)),n.dataset.index=String(t);var r=document.createElement("div");if(r.className="cmd-palette-item-icon",e.icon)r.textContent=e.icon;else if(e.avatarUrl){var a=document.createElement("img");a.src=e.avatarUrl,a.alt="",a.className="project-switcher-avatar",r.appendChild(a)}else{var s=document.createElement("i");s.setAttribute("data-lucide",e.fallbackIcon||"folder"),r.appendChild(s)}e.external&&no(r,"project-switcher-external-badge"),n.appendChild(r);var i=document.createElement("div");i.className="cmd-palette-item-body";var l=document.createElement("div");l.className="cmd-palette-item-title-row";var c=document.createElement("span");if(c.className="cmd-palette-item-title",c.textContent=e.title,l.appendChild(c),e.isCurrent){var d=document.createElement("span");d.className="project-switcher-current",d.textContent="current",l.appendChild(d)}if(e.disabled&&e.disabledReason){var u=document.createElement("span");u.className="project-switcher-disabled-reason",u.textContent=e.disabledReason,l.appendChild(u)}return i.appendChild(l),n.appendChild(i),n.addEventListener("mouseenter",function(){e.disabled||(V=t,pt())}),n.addEventListener("click",function(){e.disabled||(V=t,W(!0))}),n}function pt(){if(K){for(var e=K.querySelectorAll(".cmd-palette-item"),t=0;t<e.length;t++)e[t].classList.toggle("active",t===V);var n=e[V];n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest"})}}var qi=/^[a-zA-Z0-9_-]{1,120}$/;function mt(){return Array.prototype.filter.call(document.querySelectorAll("iframe"),function(e){try{var t=new URL(e.src,window.location.href);return t.origin===window.location.origin&&t.searchParams.get("pane")==="1"}catch{return!1}})}function gt(e){var t=Ro();try{e.contentWindow&&e.contentWindow.postMessage({type:"clay-appearance",snapshot:t},window.location.origin)}catch{}}function Sa(e){return typeof e=="string"&&qi.test(e)}function ht(e){return e===null||Sa(e)}function Vi(e){var t=e&&typeof e=="object"?e.preference:null;return!t||typeof t!="object"||!Sa(e.themeId)||e.userId!==null&&(typeof e.userId!="string"||!e.userId||e.userId.length>200)||typeof t.configured!="boolean"||t.mode!==null&&t.mode!=="light"&&t.mode!=="dark"?!1:ht(t.theme)&&ht(t.lightTheme)&&ht(t.darkTheme)}function wa(){if(o.get("paneMode")){if(window.parent===window)return;window.addEventListener("message",function(e){if(!(e.origin!==window.location.origin||e.source!==window.parent)){var t=e.data;if(!(!t||t.type!=="clay-appearance"||!Vi(t.snapshot))){var n=o.get("myUserId")||null;n!==null&&t.snapshot.userId!==n||Do(t.snapshot)}}});return}To(function(){mt().forEach(gt)}),o.subscribe(function(e,t){e.myUserId!==t.myUserId&&mt().forEach(gt)}),document.addEventListener("load",function(e){e.target&&e.target.tagName==="IFRAME"&&mt().indexOf(e.target)>=0&>(e.target)},!0)}var Wi=500,ka=10,ue=null,vt=0,bt=0,Me=!1,Ca=null;function Ve(){ue&&(clearTimeout(ue),ue=null)}function Ma(){"ontouchstart"in window&&(document.addEventListener("touchstart",function(e){if(e.touches.length!==1){Ve();return}var t=e.touches[0];vt=t.clientX,bt=t.clientY,Me=!1,Ca=e.target,ue=setTimeout(function(){ue=null,Me=!0,navigator.vibrate&&navigator.vibrate(30);var n=new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:vt,clientY:bt});Ca.dispatchEvent(n)},Wi)},{passive:!0}),document.addEventListener("touchmove",function(e){if(ue){var t=e.touches[0],n=t.clientX-vt,r=t.clientY-bt;n*n+r*r>ka*ka&&Ve()}},{passive:!0}),document.addEventListener("touchend",function(e){Ve(),Me&&(Me=!1,e.preventDefault())},{passive:!1}),document.addEventListener("touchcancel",function(){Ve(),Me=!1},{passive:!0}))}var Ea=!1,Pa=!1;function yt(e){return/^\/p\/[a-z0-9_-]+(?:\/|$)/.test(e||"")}function zi(e){return e?e.paneMode||yt(e.pathname)||e.currentSlug?"project":e.projectsLoaded!==!0?"wait":"projects":"wait"}function xa(){document.body.classList.remove("home-surface-boot-pending");var e=document.getElementById("connect-overlay");e&&o.get("connected")&&e.classList.add("hidden")}function Gi(e){return e?"/p/"+e+"/":null}function Ia(e){if(!Pa){var t=zi({surfaceLoaded:e.homeSurfaceLoaded,projectsLoaded:e.projectListLoaded,dockLoaded:e.homeDockPreferenceLoaded,surface:e.homePrimarySurface,currentSlug:e.currentSlug,pathname:location.pathname,paneMode:e.paneMode});if(t!=="wait"){if(Pa=!0,t==="project"){if(!yt(location.pathname)){var n=Gi(e.currentSlug);n&&history.replaceState(null,"",n)}o.set({homeSurfaceBootResolved:!0}),xa();var r=document.getElementById("input");r&&!r.disabled&&r.focus({preventScroll:!0});return}o.set({homeSurfaceBootResolved:!0,projectsHubRestoreRequested:!0}),xa()}}}function La(){if(!Ea){if(Ea=!0,!yt(location.pathname)&&!o.get("paneMode")){document.body.classList.add("home-surface-boot-pending");var e=document.getElementById("connect-overlay-msg");e&&(e.textContent="Restoring your workspace\u2026")}o.subscribe(function(t){Ia(t)}),Ia(o.snap())}}var Ki=3600*1e3,Yi="(max-width: 768px)",St=null,wt=!1;function Qi(e){if(typeof e!="number"||!isFinite(e)||e<0)return"";if(e=Math.floor(e),e<1e3)return String(e);for(var t=[[1e6,"m"],[1e3,"k"]],n=0;n<t.length;n++)if(e>=t[n][0]){var r=Math.floor(e/t[n][0]*10)/10;return(r%1===0?String(r):r.toFixed(1))+t[n][1]}return String(e)}function Ra(){var e=o.get("githubStarCount"),t=document.getElementById("github-star-count"),n=document.getElementById("github-star-link");if(!(!t||!n)){var r=typeof e=="number"?Qi(e):"";t.textContent=r,t.classList.toggle("hidden",!r),n.setAttribute("aria-label",r?"Star Clay on GitHub, "+e+" stars":"Star Clay on GitHub")}}function Ji(){return!!(window.matchMedia&&window.matchMedia(Yi).matches)}function Ta(){return wt||Ji()?Promise.resolve():(wt=!0,fetch("/api/github-stars",{credentials:"same-origin"}).then(function(e){return e.ok?e.json():null}).then(function(e){e&&typeof e.stars=="number"&&(o.set({githubStarCount:e.stars}),Ra())}).catch(function(){}).then(function(){wt=!1}))}function Da(){document.getElementById("github-star")&&(Ra(),Ta(),St&&clearInterval(St),St=setInterval(Ta,Ki))}function ja(){o.subscribe(function(e,t){if(e.sessionOriginId!==t.sessionOriginId||e.currentSlug!==t.currentSlug){o.set({activeBackgroundTasks:[],backgroundTaskCatalog:[]});return}e.backgroundTaskViewer!==t.backgroundTaskViewer&&document.querySelectorAll("[data-background-task]").forEach(function(n){var r=e.backgroundTaskViewer;n.setAttribute("aria-expanded",String(!!r&&n.dataset.backgroundTask===r.taskId))}),(e.activeBackgroundTasks!==t.activeBackgroundTasks||e.backgroundTaskCatalog!==t.backgroundTaskCatalog)&&Ba()}),Ba()}function $i(e,t){if(typeof e!="number"||!isFinite(e)||e<=0)return"";var n=typeof t=="number"?t:Date.now(),r=Math.floor((n-e)/1e3);if(r<0&&(r=0),r<60)return r+"s";var a=Math.floor(r/60),s=r%60;if(a<60)return a+"m "+Aa(s)+"s";var i=Math.floor(a/60);return i+"h "+Aa(a%60)+"m"}function Aa(e){return e<10?"0"+e:String(e)}function Xi(e){return!!(e&&e.ambient===!0)}function Zi(e){for(var t=[],n=[],r=Array.isArray(e)?e:[],a=0;a<r.length;a++)r[a]&&(Xi(r[a])?n.push(r[a]):t.push(r[a]));return{user:t,ambient:n}}function Ba(){var e=document.getElementById("background-tasks-bar");e&&e.remove();var t=Zi(o.get("backgroundTaskCatalog")||o.get("activeBackgroundTasks")||[]),n=t.user.length?t.user.concat(t.ambient):[],r=document.getElementById("background-task-tabs");if(!n.length){r&&r.remove();return}var a=document.getElementById("messages");if(a){r||(r=document.createElement("div"),r.id="background-task-tabs",r.className="split-view-workers background-task-tabs",r.setAttribute("aria-label","Background tasks"),a.parentNode.insertBefore(r,a));var s=JSON.stringify(n.map(function(i){return[i.task_id,i.run_id,i.active,i.description]}));r.dataset.signature!==s&&(r.dataset.signature=s,r.textContent="",n.forEach(function(i){var l=document.createElement("span");l.className="split-view-worker-pill"+(i.ambient?" background-task-ambient":"");var c=document.createElement("button");c.type="button",c.className="split-view-worker-chip",c.dataset.backgroundTask=i.task_id,Un(c,$e(i)),i.preview&&jn($e(i),i.preview,!1),c.title=(i.ambient?"Housekeeping \xB7 ":"")+(i.description||"Background task")+(i.started_at?" \xB7 "+$i(i.started_at):"")+(i.active===!1?" \xB7 Finished":" \xB7 Running"),c.setAttribute("aria-haspopup","dialog");var d=o.get("backgroundTaskViewer");c.setAttribute("aria-expanded",String(!!d&&d.taskId===i.task_id));var u=document.createElement("span");u.className="split-view-worker-dot",u.dataset.state=i.active===!1?"ready":"working";var p=document.createElement("span");if(p.className="split-view-worker-name",p.textContent=i.description||"Background task",u.setAttribute("aria-label",i.active===!1?"Finished":"Running"),c.append(u,p),c.addEventListener("click",function(){_n(i)}),l.appendChild(c),i.active!==!1){var m=document.createElement("button");m.type="button",m.className="split-view-worker-remove",m.setAttribute("aria-label","Stop "+(i.description||"background task")),m.title="Stop task",m.innerHTML=ee("square"),m.addEventListener("click",function(){var v=w();v&&v.readyState===1&&v.send(JSON.stringify({type:"background_task_stop",requestId:crypto.randomUUID(),taskId:i.task_id,runId:i.run_id||null,sessionOriginId:o.get("sessionOriginId")}))}),l.appendChild(m)}r.appendChild(l)}),D())}}var Pt=new URLSearchParams(location.search),pe=Pt.get("pane")==="1";pe&&typeof performance<"u"&&performance.mark&&performance.mark("clay:app-evaluated");var Q=Number(Pt.get("session"));(!Number.isSafeInteger(Q)||Q<1)&&(Q=null);pe&&document.body.classList.add("pane-mode");var ze=location.pathname.match(/^\/p\/([a-z0-9_-]+)/),es=document.body.dataset.homeProjectSlug||null,xe=ze?ze[1]:es,z=xe?"/p/"+xe+"/":"/",fe=xe?"/p/"+xe+"/ws":"/ws";pe&&(fe+="?pane=1",Q&&(fe+="&session="+Q),Pt.get("contextual")==="1"&&(fe+="&contextual=1"));var f=function(e){return document.getElementById(e)},L=f("messages"),Ke=f("input"),ts=f("send-btn");var Mt=f("header-title"),fh=f("header-rename-btn"),ns=f("slash-menu"),ph=f("suggestion-chips"),rs=f("sidebar"),os=f("sidebar-overlay"),za=f("session-list"),as=f("new-session-btn"),is=f("hamburger-btn"),ss=f("sidebar-toggle-btn"),ls=f("sidebar-expand-btn"),ds=f("image-preview-bar"),mh=f("connect-overlay");var cs="/claude-code-avatar.png";function Ga(e){De(e)}function us(){return!1}function Ka(){var e=document.getElementById("icon-strip-add");e&&e.click()}function Ya(e){Xr(e)}function fs(){Zr()}var gh=f("project-list-section"),hh=f("project-list"),vh=f("project-list-add"),ps=f("project-hint"),Ua=f("project-hint-dismiss"),Ge=xe||null;document.addEventListener("keydown",function(e){if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()==="z"){var t=document.activeElement,n=t&&t.tagName;(n==="TEXTAREA"||n==="INPUT"||t&&t.isContentEditable)&&(e.preventDefault(),e.stopPropagation(),e.shiftKey?document.execCommand("redo",!1,null):document.execCommand("undo",!1,null))}},!0);document.addEventListener("keydown",function(e){e.key==="Escape"&&It()});Ua&&Ua.addEventListener("click",function(){ps.classList.add("hidden");try{localStorage.setItem("clay-project-hint-dismissed","1")}catch{}});f("mermaid-modal").querySelector(".confirm-backdrop").addEventListener("click",nt);f("mermaid-modal").querySelector(".mermaid-modal-btn[title='Close']").addEventListener("click",nt);f("image-modal").querySelector(".confirm-backdrop").addEventListener("click",It);f("image-modal").querySelector(".image-modal-close").addEventListener("click",It);function xt(e){on(e)}function It(){an()}var Qa="";try{Ee=localStorage.getItem("clay-project-name-"+(Ge||"default")),Ee&&(Qa=Ee,Mt&&(Mt.textContent=Ee),kt=f("title-bar-project-name"),kt&&(kt.textContent=Ee)),Ct=localStorage.getItem("clay-project-icon-"+(Ge||"default")),Ct&&(Pe=f("title-bar-project-icon"),Pe&&(Pe.textContent=Ct,Ue(Pe),Pe.classList.add("has-icon")))}catch{}var Ee,kt,Ct,Pe;function Ja(e,t,n,r){sn(e,t,n,r)}Dt({agentBehavior:{status:"idle",error:"",catalog:null,policy:null,effective:null,edits:{},saved:{}},networkSettings:{loaded:!1,busy:!1,confirming:!1,draft:"",saved:"",status:"",errorKind:"",requestId:0},vendorLoginBrowser:null,githubStarCount:null,sharedBrowser:null,sharedBrowsers:[],mcpSkillsWorkbench:{},mateKnowledgeWorkspaces:{},mateColorSave:null,mcpConnections:{screen:"list",servers:[],search:"",loaded:!1},sharedBrowserOpen:!1,sharedBrowserUi:{},sharedBrowserSettings:{},browserLinksBound:!1,basePath:z,wsPath:fe,paneMode:pe,paneSessionId:Q,panePinPending:pe&&!!Q,paneCommittedBinding:null,panePendingBinding:null,paneReady:!1,paneSuspended:!1,paneActivationGeneration:0,paneActivationTimer:null,panePointerBinding:null,paneRichDrafts:{},paneLayoutScrollLock:null,paneLastUserScrollTop:null,paneUserScrollIntent:null,paneUserScrollRevision:0,sessionRichDrafts:{},sessionActionEpoch:0,composerUploadingCount:0,deferredSessionSwitch:null,paneCallbackBinding:null,paneActionEvents:[],paneHeldKeys:{},rewindAction:null,handoffAction:null,authIdentityLoaded:!1,splitIdentityBlockedSocket:null,splitIdentityHydrated:!1,paneActivationUnsupported:!1,paneBindingSessions:[],splitPanes:null,splitGroups:[],splitViewWorkerConversation:null,splitViewWorkerRemoval:null,projectSplitViews:[],projectSplitViewRevision:0,projectSplitViewContextKey:null,projectSplitViewHydrated:!1,projectSplitViewPending:null,projectSplitViewError:"",projectSplitViewActiveId:null,projectSplitViewFocusedOrigin:null,projectSplitViewPreviewTree:null,projectSplitViewDrag:null,splitViewOrganizationDrag:null,projectSplitViewDividerDrag:null,projectSplitViewTranscriptScroll:{},projectSplitViewSuppressClick:null,projectSplitViewSocketGeneration:0,projectSplitViewRequestSocket:null,projectSplitViewRequestGeneration:null,projectSplitViewRequestOwnerId:null,projectSplitViewRequestSlug:null,sessionFolders:null,sessionFoldersSlug:null,sessionFolderCreate:null,sidebarCreationEffects:[],sessionSearch:null,sessionFolderViewMenu:null,sessionFolderLayouts:{},sessionFolderDrag:null,sessionFolderMenu:null,sessionFolderContext:null,sessionFolderModal:null,sessionContextMenu:null,sessionInlineRename:null,splitDelegations:{},pairResultStatus:[],notesTemporarilyHidden:!1,pairResultTrayOpen:!1,dmMode:!1,historyFrom:0,loadingMore:!1,historyTotal:0,replayingHistory:!1,historyReplayBatch:null,pendingSessionEntryNavigation:null,sessionEntryHighlight:null,sessionNavigationRequestId:null,projectName:Qa,cwd:"",currentSlug:Ge,githubWorkPopoverBound:!1,githubWorkSessions:[],githubWorkProject:null,githubWorkRefresh:null,workPrimaryPending:null,activeProjectSlug:null,activeProjectMateId:null,activeProjectMateName:"",clayReturnTarget:null,contextualPrepared:null,contextualSubmitted:{},contextualClay:{mode:"closed",mateId:null},contextualConversationHistory:null,contextualConversationRequest:null,clayControlActivity:null,clayControlOrder:0,clayControlReceipts:[],clayControlForwarded:null,controlRuntimeId:null,studioDocumentSource:null,studioDocumentView:null,clayStudioRelays:{},clayStudioForwarded:{},clayStudioSurfaces:{},clayControlNotifications:[],clayControlFileView:null,clayControlTerminalViews:[],clayControlGitView:null,clayNavigationRendering:null,clayControlViewerRef:null,contextualSessionReady:!1,contextualSessionReceived:!1,contextualSessionUnavailable:!1,clayReturnPendingProjectSlug:null,activeSessionMateId:null,activeSessionMateName:"",sessionActivatedProjectSlug:null,sessionListProjectSlug:null,splitGroupsProjectSlug:null,socketPath:null,pendingHomeProjectSlug:null,homeProjectEmptyVisible:!1,homeShellVisible:!1,projectMateFilterMode:"all",projectMateFilterTurns:0,projectMateFilterActivated:!1,projectMateCreationActive:!1,projectMateCreationMateId:null,projectMateCreationSessionId:null,projectMateCreationRequestId:null,projectMateCreationPendingStart:!1,projectMateCreationAwaitingHistory:!1,projectMateCreationAwaitingMateList:!1,projectMateCreationHistoryReady:!1,projectMateCreationLocalId:null,projectMateCreationMessages:[],projectMateCreationPendingMateId:null,projectDebatePlanningActive:!1,projectDebatePlanningMateId:null,projectDebatePlanningSessionId:null,projectDebatePlanningLocalId:null,projectDebatePlanningRequestId:null,projectDebatePlanningPendingStart:!1,projectDebatePlanningAwaitingHistory:!1,projectDebatePlanningAwaitingMateList:!1,projectDebatePlanningHistoryReady:!1,projectDebatePlanningTopic:"",projectDebatePlanningMessages:[],projectDebatePlanningError:"",projectDebatePlanningRetryable:!1,debatesWorkbenchStatus:"idle",debatesWorkbenchRequestId:null,debatesWorkbenchItems:[],debatesWorkbenchError:"",debatesWorkbenchFilter:"all",debatesWorkbenchCreating:!1,debatesWorkbenchWide:!1,debatesWorkbenchFullscreen:!1,debatesWorkbenchScrollTop:0,pendingDebateNavigation:null,pendingProjectSessionNavigation:null,projectsHubVisible:!1,projectsHubMarkup:null,projectsHubList:[],projectListLoaded:!1,projectsAccessLoaded:!1,projectsHubRestoreRequested:!1,projectStart:hn(),projectStartFolder:vn(),onboardingStep:"welcome",onboardingIntent:null,currentProjectOwnerId:null,isOsUsers:!1,skipPermsEnabled:!1,autonomousSelectedMode:"normal",autonomousArming:!1,autonomousArmToken:null,autonomousArmRequestId:null,autonomousArmSessionId:null,autonomousActionRequestId:null,autonomousActionSessionId:null,autonomousCriteria:"",autonomousMaxContinuations:10,autonomousMaxMinutes:60,autonomousRun:null,autonomousExpanded:!1,loopInterviewBrief:null,loopInterviewEditing:!1,loopInterviewRunRequestId:null,loopInterviewRunSessionId:null,loopInterviewStarting:!1,loopInterviewRequestId:null,loopInterviewSessionId:null,slashCommands:[],processing:!1,scheduledMessageCorrelation:null,activeSessionId:null,speechActive:null,speechSettings:null,speechSettingsRequest:0,speechSettingsSaving:!1,speechSettingsError:"",speechPopup:null,speechRetry:null,speechLang:"en-US",speechStatuses:{},speechErrors:{},speechLanguageSaving:!1,speechLifecycleBound:!1,askUserRequests:{},activeBackgroundTasks:[],backgroundTaskCatalog:[],backgroundTaskViewer:null,splitSessionPicker:null,splitSessionCreation:null,agentMessagePreviews:{},agentMessageBubble:null,workerMessagePreviewSubscription:null,sessionVendorBound:!1,cliSessionId:null,isHeadlessMode:!1,savedMainSlug:null,connected:!1,fileReadRequest:null,filePaneInstances:{},activeFilePaneId:null,fileViewerIsPlantUml:!1,plantUmlPreviewJob:null,wireframeDraft:null,wireframeRenderQueue:[],wireframeRenderActive:null,wireframeRenderCache:[],pendingFileNavigation:null,rightWorkbenchOwner:null,rightWorkbenchRevision:0,fileViewerOpenRevision:0,cursorSharingEnabled:!1,cursorSharingHydrated:!1,cursorSharingPending:null,pendingOutboundMessages:[],pendingMessageQueue:{projectSlug:null,sessionId:null,revision:0,paused:!1,items:[],loading:!1,error:""},pendingMessageQueueRecovery:!1,pendingMessageQueueRequests:{},pendingMessageQueueEdit:null,pendingMessageQueueDrag:null,pendingMessageQueueFocusReturn:null,searchClayChatState:null,homeChatMateId:null,homeChatSessionId:null,homeChatSessionModel:null,homeChatSessionVendor:null,homeChatSessionModelLoading:!1,homeMateSessions:{},homeActiveSessionByMate:{},homePreferredMateId:null,homeSidebarCollapsed:!1,homeMatesCollapsed:!1,homeChatScope:"all",homeSubSurface:"chat",homeDebatesStatus:"idle",homeDebates:[],homeDebatesRequestId:null,homeDebatesError:"",homeSurfaceLoaded:!1,homePrimarySurface:null,homeSurfaceProjectSlug:null,homeSurfaceIntent:null,homeSurfaceBootResolved:!1,homeSurfaceRestoreRequested:!1,dockActiveToolId:null,dockOpen:!1,homeDockPreferenceLoaded:!1,dockFocus:!1,dockLibraryOpen:!1,dockBackstageOpen:!1,dockWidth:null,dockHasActivity:!1,dockActivityToolId:null,you:{},youActivity:{},youSequence:0,projectLogsOpen:!1,projectLogsWide:!1,projectLogsFullscreen:!1,projectLogsEntries:[],projectLogsSelectedRef:null,projectLogsView:"list",projectLogsCategory:"",projectLogsContextMode:"",projectLogsIsWorktree:!1,projectLogsListScroll:0,projectLogsListRequestId:null,projectLogsReadRequestId:null,projectLogsCommentRequestId:null,projectLogsCommentStatusEl:null,projectLogsDeleteRequestId:null,projectLogsCanDelete:!1,projectLogsUnread:0,projectLogsSeenRevisions:{},scheduledResultUnread:0,scheduledResultAutoFocusHandled:!1,scheduledResultFocusRef:null,scheduledResultPendingReadRef:null,scheduledResultSeenRefs:{},scheduledResultSessionRequestId:null,issuesOpen:!1,issuesView:"list",issuesSelected:null,issuesRows:[],issuesRequests:{},issueGithub:null,issuesViewRequest:null,issuesViewGeneration:0,issuesUpdateAvailable:null,issuesCache:{},issuesEpoch:0,issuesSearchTimer:null,issueLinkRequests:{},issueLinkOpenRef:null,scheduledTasksOpen:!1,scheduledTasksWide:!1,scheduledTasksFullscreen:!1,scheduledTaskRecords:[],scheduledTaskDraft:null,scheduledTaskEditingId:null,scheduledTaskNewSessionPending:!1,scheduledTaskInterviewRequestId:null,scheduledTaskActionRequestId:null,scheduledTaskListRequest:null,scheduledTaskInterviewId:null,scheduledTaskExpandedId:null,scheduledTaskDeleteId:null,scheduledTaskDraftForm:null,scheduledTaskEditForm:null,scheduledTaskCreateMenuOpen:!1,scheduledTaskManualRequest:null,installedTools:[],capsulesEnabled:!1,capsulesPreferenceLoaded:!1,homeToolRegistryLoaded:!1,toolScanErrors:[],defaultAiState:{loading:!1,saving:!1,refreshRequestId:null,saveRequestId:null,catalogRequestIds:{},catalogs:{},preference:null,selection:null,installedVendors:[],accountAvailable:!0,accountId:null,serverEpoch:null,canonicalRevision:0,error:""},defaultAiDraft:{vendor:"",model:"",effort:""},defaultAiDraftDirty:!1,defaultVendorState:{loading:!1,saving:!1,getRequestId:null,saveRequestId:null,preference:null,preferencePresent:!1,installedVendors:[],accountId:null,projectSlug:null,serverEpoch:null,canonicalRevision:0,error:""},projectSessionVisibilityState:{active:null,pending:null},dmTargetUser:null,dmKey:null,cachedMatesList:[],cachedDmFavorites:[],cachedAvailableBuiltins:[],projectMateDmsEnabled:!0,returningFromMateDm:!1,pendingMateInterview:null,pendingTermCommand:null,shellCommandMode:!1,shellCommandRunning:!1,pendingShellCommandId:null,mateProjectSlug:null,myUserId:null,contextViewPreferenceState:{mode:"off",canonicalMode:"off",preferencePresent:!1,loading:!1,saving:!1,requestId:null,saveRequestId:null,pendingSaves:[],accountId:null,serverEpoch:null,rejectedEpoch:null,canonicalRevision:0,error:""},contextViewOverride:null,isMultiUserMode:!1,dmUnread:{},dmRemovedUsers:{},cachedAllUsers:[],cachedOnlineIds:[],cachedDmConversations:[],sessionDrafts:{},messageUuidMap:[],currentMsgTs:null,richContextUsage:null,contextMeasurement:"unavailable",currentMsgEl:null,currentFullText:"",matePreThinkingEl:null,thinkingState:null,fileViewerFullscreen:!1,markdownSlidesActive:!1,markdownSlideIndex:0,markdownSlideCount:0,markdownSlideLevel:1,markdownSlidePreferredLevel:1,markdownSlideLevelExplicit:!1,currentModel:"",currentModels:[],modelListVendor:"",modelListStatus:"idle",modelListError:"",modelRequestId:"",modelSelectionPending:null,modelSelectionError:"",lastVendor:"",vendorInfo:{},rateLimitState:{},vendorUsageOverview:null,vendorUsageOpen:null,currentMode:"default",effectivePermissionMode:null,permissionCapabilities:{auto:!1,mcpOverride:!1},permissionModePendingByTarget:{},mcpPermissionModePendingByTarget:{},mcpPermissionModeOverrides:{},currentEffort:"medium",currentBetas:[],currentThinking:"adaptive",currentThinkingBudget:1e4,sessionFullAccess:!1,codexApproval:null,codexSandbox:null,codexWebSearch:null,ctxPopoverVisible:!1,headerContextEl:null,loopActive:!1,loopAvailable:!1,loopIteration:0,loopMaxIterations:0,loopBannerName:null,ralphPhase:"idle",ralphCraftingSessionId:null,ralphCraftingSource:null,ralphFilesReady:{promptReady:!1,judgeReady:!1,bothReady:!1},ralphPreviewContent:{prompt:"",judge:""},execModalShown:!1,debateStickyState:null,debateFloorMode:!1,debateConcludeMode:!1,debateEndedMode:!1,knownInstalledSkills:{},permissions:null,wizardData:{name:"",task:"",maxIterations:null,cron:null}});Er({$:f,get ws(){return w()},get connected(){return o.get("connected")},get processing(){return o.get("processing")},messagesEl:L,addSystemMessage:ni});Ao();wa();An();Ma();var ms={$:f,get ws(){return w()},get connected(){return o.get("connected")},get projectName(){return o.get("projectName")},messagesEl:L,sessionListEl:za,sidebar:rs,sidebarOverlay:os,sidebarToggleBtn:ss,sidebarExpandBtn:ls,hamburgerBtn:is,newSessionBtn:as,headerTitleEl:Mt,showConfirm:Ja,onFilesTabOpen:function(){_o(),Oo(),H()&&F()},requestKnowledgeList:function(){Zn()},switchProject:function(e){ri(e)},openTerminal:function(){Lo()},showHomeHub:function(){Ga()},getUpcomingSchedules:fn,get multiUser(){return o.get("isMultiUserMode")},get myUserId(){return o.get("myUserId")},get projectOwnerId(){return o.get("currentProjectOwnerId")},get ownerLocked(){return o.get("ownerLocked")},openDm:function(e){Ya(e)},openMateWizard:function(){Ka()},openAddProjectModal:function(){bn()},sendWs:function(e){var t=w();t&&t.readyState===1&&t.send(JSON.stringify(e))},onDmRemoveUser:function(e){var t=Object.assign({},o.get("dmRemovedUsers"));t[e]=!0,o.set({dmRemovedUsers:t})},getHistoryFrom:function(){return o.get("historyFrom")},get permissions(){return o.get("permissions")},get projectList(){return ge()||[]},availableBuiltins:function(){return o.get("cachedAvailableBuiltins")||[]}};ma();_e([Bo,Kn,Yn,Qt,Qn,Jt,xr,Kr]);xo(ms);var Lt=function(){return w()};er(Lt);$n(Lt);_e([pr]);Jn(Lt,{onShow:function(){Xn(),wo()}});pn({switchProject:function(e){ri(e)},currentSlug:function(){return o.get("currentSlug")},matesList:function(){return o.get("cachedMatesList")||[]},availableBuiltins:function(){return o.get("cachedAvailableBuiltins")||[]},allUsers:function(){return o.get("cachedAllUsers")||[]},dmConversations:function(){return o.get("cachedDmConversations")||[]},myUserId:function(){return o.get("myUserId")},selectSession:function(e){H()&&F();var t=document.getElementById("sticky-notes-panel");if(t&&!t.classList.contains("hidden")){var n=document.getElementById("sticky-notes-sidebar-btn");n&&n.click()}var r=w();r&&r.readyState===1&&r.send(JSON.stringify({type:"switch_session",id:e}))},openDm:function(e){Ya(e)},runAction:function(e){switch(e){case"createMate":Ka();break;case"openSettings":Mn();break;case"showHome":Ga();break}}});ba();zn();Yt();function gs(e){Ln(e)}function hs(){Tn()}function vs(e){Rn(e)}function bs(){po()}function ys(){mo()}function $a(){Fn()}function Xa(){Hn()}function Ss(){qn()}function ws(){Vn()}function Tt(e){Vt(e)}var Y=f("new-msg-btn"),_a="\u2193 Latest";function Et(){var e=f("input-area");e&&(Y.style.bottom=e.offsetHeight+12+"px")}var Na=f("input-area");Na&&window.ResizeObserver?new ResizeObserver(Et).observe(Na):window.addEventListener("resize",Et);Et();L.addEventListener("scroll",function(){if(!Ot()){var e=L.scrollHeight-L.scrollTop-L.clientHeight,t=e>150;qt(t),t?(Y.classList.contains("hidden")&&(Y.textContent=_a),Y.classList.remove("hidden")):(Y.classList.add("hidden"),Y.textContent=_a)}});Y.addEventListener("click",function(){Za()});document.addEventListener("visibilitychange",function(){document.hidden||Ie()});L.addEventListener("click",function(e){var t=e.target.closest(".msg-action-fork");if(t){var n=t.closest("[data-uuid]");if(!(!n||!n.dataset.uuid)){var r=n.dataset.uuid;Ja("Fork session from this message?",function(){var a=w();a&&a.readyState===1&&a.send(JSON.stringify({type:"fork_session",uuid:r}))},"Fork",!1)}}});function Ie(){Wt()}function Za(){zt()}rn();In();Ir();mr();Hr();Nr();ja();Yr();Or();Fr();Wr();gn();On();Wn();Ft();Zt({$:f,get ws(){return w()},get connected(){return o.get("connected")},get turnCounter(){return Ht()},messagesEl:L,inputEl:Ke,finalizeAssistantBlock:function(){ks()},addToMessages:function(e){Tt(e)},scrollToBottom:function(){Ie()},setActivity:function(e){vs(e)},stopUrgentBlink:function(){hs()},showImageModal:xt,getContextPercent:function(){var e=Nn();return e.contextWindow>0?Math.round(e.input/e.contextWindow*100):0},isMateDm:function(){return o.get("dmMode")&&o.get("dmTargetUser")&&o.get("dmTargetUser").isMate},getMateName:function(){return o.get("dmTargetUser")&&o.get("dmTargetUser").displayName||"Mate"},getMateAvatarUrl:function(){return document.body.dataset.mateAvatarUrl||""},getClaudeAvatar:function(){return cs},getMateById:function(e){var t=o.get("cachedMatesList");if(!e||!t)return null;for(var n=0;n<t.length;n++)if(t[n].id===e)return t[n];return null}});function ei(e,t,n,r,a){lo(e,t,n,r,a)}function ti(e,t){uo(e,t)}function ks(){fo()}function ni(e,t){co(e,t)}function Cs(){ho()}function Ms(){oo()}function ri(e){je(e)}window.addEventListener("popstate",function(){if(/^\/projects\/?$/.test(location.pathname)){De(!0);return}kn();var e=location.pathname.match(/^\/p\/([a-z0-9_-]+)/),t=e?e[1]:null;if(!t){De(!0);return}wn("project",t),us()&&void 0,t&&t!==o.get("currentSlug")&&(Uo(),ne(),H()&&F(),cn(t),o.set({currentSlug:t}),z="/p/"+t+"/",fe="/p/"+t+"/ws",o.set({basePath:z,wsPath:fe}),Ms(),oi())});function oi(){Jr()}so({get ws(){return w()},get connected(){return o.get("connected")},get processing(){return o.get("processing")},get basePath(){return z},inputEl:Ke,sendBtn:ts,slashMenu:ns,messagesEl:L,imagePreviewBar:ds,slashCommands:function(){return o.get("slashCommands")},messageUuidMap:function(){return o.get("messageUuidMap")},addUserMessage:ei,addSystemMessage:ni,toggleUsagePanel:$a,toggleStatusPanel:Xa,toggleContextPanel:ws,resetContextData:Ss,showImageModal:xt,hideSuggestionChips:Cs,getGhostSuggestion:function(){return go()},setSendBtnMode:gs,isDmMode:function(){return o.get("dmMode")&&!(o.get("dmTargetUser")&&o.get("dmTargetUser").isMate)},getDmKey:function(){return o.get("dmKey")},handleDmSend:function(){fs()},isDebateEndedMode:function(){return o.get("debateEndedMode")},handleDebateEndedSend:function(){handleDebateEndedSend()},isDebateConcludeMode:function(){return o.get("debateConcludeMode")},handleDebateConcludeSend:function(){xs()},isDebateFloorMode:function(){return o.get("debateFloorMode")},handleDebateFloorSend:function(){Ls()},isMateDm:function(){return o.get("dmMode")&&o.get("dmTargetUser")&&o.get("dmTargetUser").isMate},getDmMateId:function(){var e=o.get("dmTargetUser");return o.get("dmMode")&&e&&e.isMate?e.id:null},getMateName:function(){return o.get("dmTargetUser")&&o.get("dmTargetUser").displayName||"Mate"},getMateAvatarUrl:function(){return document.body.dataset.mateAvatarUrl||""},showMatePreThinking:function(){ys()},showClaudePreThinking:function(){bs()},myUserId:function(){return o.get("myUserId")},myDisplayName:function(){var e=null;try{e=JSON.parse(localStorage.getItem("clay_my_user")||"null")}catch{}return e&&(e.displayName||e.username)||document.body.dataset.myDisplayName||"Me"}});Pr();zr({get ws(){return w()},get connected(){return o.get("connected")},inputEl:Ke,messagesEl:L,matesList:function(){return o.get("cachedMatesList")||[]},availableBuiltins:function(){return o.get("cachedAvailableBuiltins")||[]},allUsers:function(){return o.get("cachedAllUsers")||[]},myUserId:function(){return o.get("myUserId")},scrollToBottom:Ie,addUserMessage:ei,addCopyHandler:ti,addToMessages:Tt,showImageModal:xt,showPasteModal:nn});Br({get ws(){return w()},sendWs:function(e){var t=w();t&&t.readyState===1&&t.send(JSON.stringify(e))},messagesEl:L,addToMessages:function(e){Tt(e)},scrollToBottom:Ie,addCopyHandler:ti,matesList:function(){return o.get("cachedMatesList")||[]},availableBuiltins:function(){return o.get("cachedAvailableBuiltins")||[]},currentMateId:function(){return o.get("dmTargetUser")&&o.get("dmTargetUser").isMate?o.get("dmTargetUser").id:o.get("homeChatMateId")||null},requireSkills:Ps,showDebateEndedMode:function(e){Is(e)}});na();fr({basePath:z});En();kr({basePath:z});function Es(){ln()}fetch("/api/me").then(function(e){return e.json()}).then(function(e){if(e.multiUser&&(o.set({isMultiUserMode:!0}),document.body&&document.body.classList.add("is-multi-user")),e.user&&e.user.id&&(o.set({myUserId:e.user.id}),Dn()),o.set({authIdentityLoaded:!0}),o.set({permissions:e.permissions||null,projectsAccessLoaded:!0}),e.mustChangePin&&Es(),!o.get("isMultiUserMode")){var t=document.getElementById("icon-strip-users");t&&(t.innerHTML="",t.classList.add("hidden"))}sa();var n=o.get("permissions");if(n){if(!n.terminal){var r=document.getElementById("terminal-toggle-btn");r&&(r.style.display="none");var a=document.getElementById("terminal-sidebar-btn");a&&(a.style.display="none");var s=document.getElementById("shell-command-btn");s&&(s.style.display="none");var i=document.getElementById("input-more-shell");i&&(i.style.display="none")}if(!n.fileBrowser){var l=document.getElementById("file-browser-btn");l&&(l.style.display="none");var c=document.getElementById("git-placard");c&&(c.style.display="none")}if(!n.skills){var d=document.getElementById("skills-btn");d&&(d.style.display="none");var u=document.getElementById("mate-skills-btn");u&&(u.style.display="none")}if(!n.scheduledTasks){var p=document.getElementById("scheduler-btn");p&&(p.style.display="none")}if(!n.createProject){var m=document.getElementById("icon-strip-add");m&&(m.style.display="none")}}}).catch(function(){});hr().then(function(e){if(o.get("isMultiUserMode")&&!e){var t=document.getElementById("update-pill-wrap");t&&(t.style.display="none")}});gr({$:f,get ws(){return w()},get connected(){return o.get("connected")},messagesEl:L,sessionListEl:za,scrollToBottom:Ie,forceScrollToBottom:Za,basePath:z,toggleUsagePanel:$a,toggleStatusPanel:Xa});vr();Pn(ro());xn();jo({get ws(){return w()},get connected(){return o.get("connected")},get activeSessionId(){return o.get("activeSessionId")},get cwd(){return o.get("cwd")},messagesEl:L,fileTreeEl:f("file-tree"),fileViewerEl:f("file-viewer")});_e([Po,Go,$t]);Ho();mn();Gn();Io({get ws(){return w()},get connected(){return o.get("connected")},terminalContainerEl:f("terminal-container"),terminalBodyEl:f("terminal-body"),fileViewerEl:f("file-viewer")});en({get ws(){return w()},get connected(){return o.get("connected")}});Zo();(function(){var e=new URLSearchParams(window.location.search),t=e.get("playbook");if(t){setTimeout(function(){Xo(t)},300),e.delete("playbook");var n=e.toString(),r=window.location.pathname+(n?"?"+n:"")+window.location.hash;window.history.replaceState(null,"",r)}})();Gt({messagesEl:L,get ws(){return w()},getHistoryFrom:function(){return o.get("historyFrom")}});var Oa=f("find-in-session-btn");Oa&&Oa.addEventListener("click",function(){Kt()});yo();Eo();vo(function(){re()&&Co()});var Fa=f("sticky-notes-sidebar-btn");Fa&&Fa.addEventListener("click",function(){he(),me(),H()&&F(),re()&&ne(),So(),ko()});var Ha=document.querySelectorAll("#sticky-notes-toggle-btn");for(We=0;We<Ha.length;We++)Ha[We].addEventListener("click",function(){bo()});var We,qa=f("sticky-notes-sidebar-count");qa&&qa.addEventListener("click",function(e){e.stopPropagation(),he(),me(),H()&&F(),re()?ne():Mo()});var Va=f("git-placard-more"),Wa=f("terminal-sidebar-btn");Va&&Va.addEventListener("click",function(){Je(),he(),me(),re()&&ne(),H()&&F()});Wa&&Wa.addEventListener("click",function(){Je(),he(),me(),re()&&ne(),H()&&F()});function Ps(e,t){qr(e,t)}function xs(){jr()}function Is(e){Ur(e)}function Ls(){_r()}tn();Mr();dn({get ws(){return w()},get connected(){return o.get("connected")},get activeSessionId(){return o.get("activeSessionId")},basePath:z,currentSlug:Ge,getProjects:function(){return ge()}});Ar();Lr();Tr();Da();yn();io();Vr();Sn();Gr();Cn();La();$r();Qr();lucide.createIcons();pe&&typeof performance<"u"&&performance.mark&&performance.mark("clay:bootstrap-complete");oi();ze&&location.hash==="#scheduler"?setTimeout(function(){un("calendar")},500):ze&&Ke.focus();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ga as a,Ha as b,Ia as c,Ja as d,Ka as e,La as f,Ma as g,Na as h,Oa as i,Pa as j}from"./chunk-
|
|
1
|
+
import{Ga as a,Ha as b,Ia as c,Ja as d,Ka as e,La as f,Ma as g,Na as h,Oa as i,Pa as j}from"./chunk-FILRACQB.js";import"./chunk-L3FCTD7U.js";import"./chunk-JIV7O5GN.js";import"./chunk-YFUORWA6.js";import"./chunk-RRYWV5JT.js";import"./chunk-YXJ7ISEK.js";import"./chunk-R7QVVFUG.js";import"./chunk-SEELA2D2.js";import"./chunk-VZ2OKDAO.js";export{j as applyReviewedSplitView,c as handleProjectSplitViewResult,b as handleProjectSplitViews,g as initSplitViewPresentations,d as organizePresentationView,i as presentationViewForSidebar,h as renderPresentationSplitView,a as requestProjectSplitViews,e as setActiveView,f as switchToStandalone};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{hc as a,ic as b,jc as c,kc as d}from"./chunk-FILRACQB.js";import"./chunk-L3FCTD7U.js";import"./chunk-JIV7O5GN.js";import"./chunk-YFUORWA6.js";import"./chunk-RRYWV5JT.js";import"./chunk-YXJ7ISEK.js";import"./chunk-R7QVVFUG.js";import"./chunk-SEELA2D2.js";import"./chunk-VZ2OKDAO.js";export{c as closeDebatesWorkbench,a as handleDebatesWorkbenchState,d as initDebatesWorkbench,b as openDebatesWorkbench};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ad as e,Bd as f,Cd as g,Dd as h,Ed as i,Fd as j,Gd as k,Hd as l,Id as m,Jd as n,wd as a,xd as b,yd as c,zd as d}from"./chunk-
|
|
1
|
+
import{Ad as e,Bd as f,Cd as g,Dd as h,Ed as i,Fd as j,Gd as k,Hd as l,Id as m,Jd as n,wd as a,xd as b,yd as c,zd as d}from"./chunk-FILRACQB.js";import"./chunk-L3FCTD7U.js";import"./chunk-JIV7O5GN.js";import"./chunk-YFUORWA6.js";import"./chunk-RRYWV5JT.js";import"./chunk-YXJ7ISEK.js";import"./chunk-R7QVVFUG.js";import"./chunk-SEELA2D2.js";import"./chunk-VZ2OKDAO.js";export{d as closeProjectLogs,k as handleProjectLogCommentReviewed,j as handleProjectLogCommented,l as handleProjectLogDeleted,f as handleProjectLogEntry,m as handleProjectLogUpdated,n as handleProjectLogsError,e as handleProjectLogsState,h as handleScheduledTaskResultCreated,i as handleScheduledTaskResultSession,g as handleScheduledTaskResultsState,a as initProjectLogs,c as openProjectLog,b as openProjectLogs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as a,G as b,H as c,I as d,J as e,K as f,L as g,M as h,N as i}from"./chunk-
|
|
1
|
+
import{F as a,G as b,H as c,I as d,J as e,K as f,L as g,M as h,N as i}from"./chunk-SEELA2D2.js";import"./chunk-VZ2OKDAO.js";export{d as claimRightWorkbench,i as handlesWorkbenchKey,f as isRightWorkbenchCurrent,b as registerRightWorkbench,e as releaseRightWorkbench,g as resetRightWorkbench,h as restoreWorkbenchDock,a as rightWorkbenchRevisionFor,c as unregisterRightWorkbench};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ib as a,Jb as b,Kb as c,Lb as d,Mb as e,Nb as f,Ob as g,Pb as h}from"./chunk-
|
|
1
|
+
import{Ib as a,Jb as b,Kb as c,Lb as d,Mb as e,Nb as f,Ob as g,Pb as h}from"./chunk-FILRACQB.js";import"./chunk-L3FCTD7U.js";import"./chunk-JIV7O5GN.js";import"./chunk-YFUORWA6.js";import"./chunk-RRYWV5JT.js";import"./chunk-YXJ7ISEK.js";import"./chunk-R7QVVFUG.js";import"./chunk-SEELA2D2.js";import"./chunk-VZ2OKDAO.js";export{d as closeScheduledTasks,f as handleScheduledTaskMessage,g as handleScheduledTaskSessionSwitched,b as humanRecurrence,h as initScheduledTasks,e as isScheduledTasksOpen,a as isStrictCron,c as openScheduledTasks};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-
|
|
1
|
+
import{a,b,c}from"./chunk-L3FCTD7U.js";import"./chunk-SEELA2D2.js";import"./chunk-VZ2OKDAO.js";export{c as closeMcpSkillsWorkbench,a as ensureMcpSkillsWorkbench,b as openMcpSkillsWorkbench};
|