clay-server 5.3.0-beta.4 → 5.3.0-beta.5

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.
Files changed (40) hide show
  1. package/lib/ask-user-request-identity.js +18 -1
  2. package/lib/project-delegated-follow-up.js +18 -9
  3. package/lib/public/css/right-workbench.css +26 -3
  4. package/lib/public/css/shared-browser.css +21 -0
  5. package/lib/public/css/sticky-notes.css +3 -2
  6. package/lib/public/index.html +2 -2
  7. package/lib/public/modules/app-header.js +24 -2
  8. package/lib/public/modules/app-messages.js +1 -1
  9. package/lib/public/modules/clay-session-links.js +1 -1
  10. package/lib/public/modules/filebrowser.js +2 -2
  11. package/lib/public/modules/pane-activation.js +3 -0
  12. package/lib/public/modules/pane-browser-bridge.js +15 -5
  13. package/lib/public/modules/pane-header-runtime.js +18 -0
  14. package/lib/public/modules/right-workbench.js +92 -62
  15. package/lib/public/modules/shared-browser.js +6 -0
  16. package/lib/public/modules/split-pane-renderer.js +6 -8
  17. package/lib/public/modules/split-pane-runtime.js +23 -0
  18. package/lib/public/modules/split-view.js +8 -14
  19. package/lib/public/modules/sticky-notes.js +8 -10
  20. package/lib/public/modules/terminal.js +7 -2
  21. package/lib/public/modules/theme.js +5 -0
  22. package/lib/public/modules/workspace-assignment-card.js +9 -6
  23. package/lib/public/pane-assets/{app-ED2VCGNQ.js → app-6H5S2Y3Z.js} +1 -1
  24. package/lib/public/pane-assets/chunk-3QV5SDC4.js +1 -0
  25. package/lib/public/pane-assets/{chunk-JAEQCN5S.js → chunk-4FM3U3DW.js} +1 -1
  26. package/lib/public/pane-assets/{chunk-6SM2WQJX.js → chunk-7GZH3FZY.js} +1 -1
  27. package/lib/public/pane-assets/chunk-AGJTF5WQ.js +1 -0
  28. package/lib/public/pane-assets/chunk-NPKRTUNG.js +2 -0
  29. package/lib/public/pane-assets/{chunk-IYFILQHZ.js → chunk-VGA2Y3D2.js} +1 -1
  30. package/lib/public/pane-assets/{chunk-IZ2ZANEY.js → chunk-WKO3T75E.js} +89 -89
  31. package/lib/public/pane-assets/manifest.json +361 -359
  32. package/lib/public/pane-assets/{style-JVCOCG3W.css → style-TSRDU54Z.css} +1 -1
  33. package/lib/server.js +1 -0
  34. package/lib/workspace-assignment-service.js +56 -11
  35. package/lib/workspace-follow-up-queue.js +92 -0
  36. package/lib/workspace-query-mcp-server.js +1 -1
  37. package/package.json +1 -1
  38. package/lib/public/pane-assets/chunk-6D4DPE5X.js +0 -1
  39. package/lib/public/pane-assets/chunk-7H36SUZA.js +0 -2
  40. package/lib/public/pane-assets/chunk-ST2Q62ET.js +0 -1
@@ -1 +1 @@
1
- import{$ as In,$a as Sr,$b as ho,Aa as nt,Ab as Wr,Ac as _o,Ba as er,Bb as zr,Bc as No,C as an,Cb as Gr,Cc as Oo,D as sn,Da as tr,Db as Kr,Dc as Ho,E as ln,Ea as nr,Eb as Yr,Ec as Fo,F as dn,Fa as rr,Fb as Qr,G as cn,Ga as or,Gb as Jr,H as un,Ha as ar,Hb as $r,I as fn,Ia as ir,Ib as Xr,J as pn,Ja as rt,Jb as Zr,K as q,Ka as sr,Kb as eo,L as mn,La as Be,Lb as to,M as gn,Ma as je,Mb as no,N as V,Na as lr,Nb as ro,O as hn,Oa as dr,Ob as oo,P as vn,Pa as cr,Q as bn,Qa as ur,Qb as ot,R as yn,Ra as fr,Rb as ao,S as Sn,Sa as pr,Sb as io,T as wn,Ta as he,Tb as so,U as kn,Ua as mr,Ub as lo,V as Cn,Va as gr,Vb as co,W as Mn,Wa as hr,Wb as uo,X as En,Xa as ve,Xb as fo,Y as Pn,Ya as vr,Yb as po,Z as xn,Za as br,Zb as mo,_ as Ln,_a as yr,_b as go,a as qt,aa as Tn,ab as wr,ac as vo,b as Vt,ba as Rn,bb as kr,bc as bo,c as Wt,ca as Dn,cb as Ue,cc as yo,d as zt,da as An,db as Cr,dc as So,e as Gt,ea as Bn,eb as Mr,ec as wo,f as Kt,fa as jn,fb as Er,fc as ko,g as Yt,ga as Un,gb as Pr,gc as Co,h as Qt,ha as _n,hb as xr,hc as Mo,i as Jt,ia as Nn,ib as Lr,ic as Eo,j as $t,ja as On,jb as Ir,jc as Po,k as Xt,ka as Hn,kb as Tr,kc as oe,la as Fn,lb as be,lc as ae,ma as tt,mb as Rr,mc as xo,na as qn,nb as _e,nc as Lo,oa as Vn,ob as Dr,oc as Io,pa as re,pb as Ar,pc as To,qa as Wn,qb as Br,qc as Ro,r as et,ra as zn,rb as jr,rc as Do,sa as Gn,sb as Ur,sc as Ao,t as Zt,ta as Kn,tb as _r,tc as Bo,ua as Yn,ub as Nr,uc as jo,v as en,va as Qn,vb as Or,w as nn,wa as Jn,wb as Hr,wc as Ne,x as rn,xa as $n,xb as Fr,y as on,ya as Xn,yb as qr,yc as at,za as Zn,zb as Vr,zc as Uo}from"./chunk-IZ2ZANEY.js";import{A as Ht,D as Ft,E as D,F as Q,P as tn,c as F,d as _t,e as Nt,i as Ot,z as Ze}from"./chunk-7H36SUZA.js";import{a as Ut,b as a,c as w}from"./chunk-DGOFGEUK.js";var ye=[];function it(){var e=a.snap(),t=e.paneDeferredBootstrap;!t||t.scheduled||!t.jobs.length||!e.connected||!e.paneReady||e.paneSuspended||(a.set({paneDeferredBootstrap:Object.assign({},t,{scheduled:!0})}),setTimeout(function(){var n=a.snap(),r=n.paneDeferredBootstrap;if(r){var o=r.jobs.slice(),i=n.connected&&n.paneReady&&!n.paneSuspended?o.shift():null;a.set({paneDeferredBootstrap:Object.assign({},r,{scheduled:!1,jobs:o})});try{if(i!==null&&ye[i]){var s=ye[i];ye[i]=null,s()}}finally{it()}}},0))}function Oe(e){if(!a.get("paneMode")){e.forEach(function(n){n()});return}var t=a.get("paneDeferredBootstrap");t||(t={jobs:[],scheduled:!1},a.subscribe(function(n,r){(n.paneReady!==r.paneReady||n.connected!==r.connected||n.paneSuspended!==r.paneSuspended)&&it()})),a.set({paneDeferredBootstrap:Object.assign({},t,{jobs:t.jobs.concat(e.map(function(n){var r=ye.length;return ye.push(n),r}))})}),it()}function qo(){Ft(),Ot(),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=Nt(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||!Ze(e,t)||!Ht(e,t)||(t.type==="clay-pane-present-markdown"?(_t(e,t,Ze(e,t)),Oo(t.message)):nn(t.message))})}var di="(max-width: 768px)",ci=["sticky-notes-toggle-btn","shared-browser-toggle-btn","terminal-toggle-btn"],ui=["shared-browser-toggle-btn","terminal-toggle-btn","sticky-notes-toggle-btn"];function Vo(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 o=e?ci:ui,i=0;i<o.length;i++){var s=document.getElementById(o[i]);s&&(e?t.appendChild(s):n.insertBefore(s,r))}}var fi=150,ie=24,Se=12,Wo=null;function zo(e,t,n){return Math.round(e.offsetWidth)+"|"+Math.round(t.offsetWidth)+"|"+Math.round(n.offsetWidth)}function Go(e){var t=document.getElementById("top-bar"),n=t&&t.querySelector(".top-bar-left-pills"),r=t&&t.querySelector(".top-bar-actions"),o=document.getElementById("cmd-palette-btn");if(!(!t||!n||!r||!o)&&t.offsetWidth&&!(!e&&Wo===zo(t,n,r))&&getComputedStyle(o).display!=="none"){for(var i=[[],["usage-compact"],["usage-compact","usage-compact-link"]],s=null,l=0;l<i.length&&!s;l++){t.classList.remove("usage-compact","usage-compact-link","search-icon"),i[l].forEach(function(P){t.classList.add(P)}),t.style.removeProperty("--top-bar-search-width"),t.style.removeProperty("--top-bar-search-left");var u=t.getBoundingClientRect().width,d=u/2,c=t.getBoundingClientRect().left,p=n.getBoundingClientRect().right-c,g=r.getBoundingClientRect().left-c,v=Math.min(d-p,g-d)-Se,y=Math.min(520,u*.4);if(2*v>=fi)s={mode:"full",width:Math.min(y,2*v),left:null,level:l};else if(g-p>=ie+2*Se){var M=p+Se+ie/2,E=g-Se-ie/2;s={mode:"icon",width:ie,left:Math.min(Math.max(d,M),E),level:l}}}s||(s={mode:"icon",width:ie,left:Math.max(n.getBoundingClientRect().right-t.getBoundingClientRect().left+Se+ie/2,0),level:i.length-1}),t.classList.toggle("search-icon",s.mode==="icon"),s.mode==="full"?t.style.setProperty("--top-bar-search-width",Math.round(s.width)+"px"):t.style.setProperty("--top-bar-search-left",Math.round(s.left)+"px"),Wo=zo(t,n,r)}}function pi(){var e=document.getElementById("top-bar");if(!(!e||typeof ResizeObserver>"u")){var t=!1,n=function(o){t||(t=!0,requestAnimationFrame(function(){t=!1,Go(o===!0)}))},r=new ResizeObserver(function(){n(!1)});r.observe(e),[".top-bar-left-pills",".top-bar-actions"].forEach(function(o){var i=e.querySelector(o);i&&r.observe(i)}),new MutationObserver(function(){n(!0)}).observe(e.querySelector(".top-bar-actions"),{childList:!0,subtree:!0,characterData:!0}),Go(!0)}}function mi(){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 Ko(){var e=window.matchMedia(di);Vo(e.matches),e.addEventListener("change",function(){Vo(e.matches)}),mi(),pi()}var Jo={},lt={},x=null,B=null,j=null,$o=0,Xo=[],He={},dt=null;function Yo(e){Jo[e.id]=e}function st(e,t){lt[e]=t}function Zo(e,t){var n=Jo[e];n&&(j=n,$o=0,Xo=[],dt=t||null,gi(),Fe(n.steps[0].id),B.classList.remove("hidden"),x.classList.remove("hidden"),setTimeout(function(){x.focus()},50))}function we(){B&&B.classList.add("hidden"),x&&x.classList.add("hidden");var e=dt;j=null,dt=null,e&&e()}function ea(){vi(),bi()}function gi(){x||(B=document.createElement("div"),B.className="playbook-overlay hidden",B.addEventListener("click",function(e){e.target===B&&we()}),x=document.createElement("div"),x.className="playbook-modal hidden",x.setAttribute("tabindex","-1"),x.addEventListener("keydown",function(e){e.key==="Escape"&&we()}),B.appendChild(x),document.body.appendChild(B))}function Fe(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($o=n,Xo.push(e),t.condition&&t.branches){var o=t.condition(),i=t.branches[o]||t.branches.default;if(i){Fe(i);return}}hi(t)}}}function hi(e){for(var t=j,n=t.steps.filter(function(k){return!k.condition}).length,r=0,o=0,i=0;i<t.steps.length;i++)t.steps[i].condition||(o++,t.steps[i].id===e.id&&(r=o));var s="";s+='<div class="playbook-header">',s+='<div class="playbook-header-left">',s+='<span class="playbook-icon">'+(t.icon||"\u{1F4D6}")+"</span>",s+='<span class="playbook-title">'+se(t.title)+"</span>",s+="</div>",s+='<button class="playbook-close" title="Close">&times;</button>',s+="</div>",s+='<div class="playbook-progress">';for(var l=0;l<n;l++){var u="playbook-progress-dot";l+1<r?u+=" done":l+1===r&&(u+=" active"),s+='<span class="'+u+'"></span>'}s+="</div>",s+='<div class="playbook-body">',s+='<h2 class="playbook-step-title">'+se(e.title)+"</h2>";var d=typeof e.body=="function"?e.body():e.body||"";if(s+='<div class="playbook-step-body">'+d+"</div>",e.note&&(s+='<div class="playbook-step-note">'+se(e.note)+"</div>"),s+="</div>",e.actions&&e.actions.length>0){s+='<div class="playbook-actions">';for(var c=0;c<e.actions.length;c++){var p=e.actions[c],g="playbook-btn";c===0?g+=" playbook-btn-primary":g+=" playbook-btn-secondary",s+='<button class="'+g+'" data-action="'+(p.action||"")+'" data-next="'+(p.next||"")+'">'+se(p.label)+"</button>"}s+="</div>"}x.innerHTML=s,D();var v=x.querySelector(".playbook-close");v&&v.addEventListener("click",we);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&&lt[A]?(k.disabled=!0,k.textContent+="...",lt[A](function(){h?Fe(h):(Qo(j.id),we())})):h?Fe(h):(Qo(j.id),we())})})(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 Qo(e){He[e]=!0;try{localStorage.setItem("clay-playbooks-done",JSON.stringify(He))}catch{}}function vi(){try{var e=JSON.parse(localStorage.getItem("clay-playbooks-done")||"{}");He=e||{}}catch{He={}}}function bi(){if(Yo({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 o=location.protocol==="https:"&&location.hostname!=="localhost"&&location.hostname!=="127.0.0.1",i="The browser says permission is granted, but the notification didn't show.<br><br>";return o&&(i+="\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>"),i+="<strong>Also check your OS notification settings:</strong><br>",t?i+="<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>":i+="<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>",i+="<br>After adjusting, come back and try again.",i},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:""}]}]}),st("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()})}),st("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 o=navigator.userAgent||"",i=navigator.platform||"";return i.indexOf("Mac")!==-1||o.indexOf("Mac")!==-1?"mac":i.indexOf("Win")!==-1||o.indexOf("Windows")!==-1?"windows":"linux"},n=function(){var o=t(),i="The certificate has been downloaded as <strong>clay-ca.pem</strong>.<br><br>";return o==="mac"?(i+="<strong>macOS \u2014 run in Terminal:</strong><br>",i+=r("sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/Downloads/clay-ca.pem")):o==="windows"?(i+="<strong>Windows \u2014 run in PowerShell (Admin):</strong><br>",i+=r('certutil -addstore -f "Root" %USERPROFILE%\\Downloads\\clay-ca.pem')):(i+="<strong>Linux \u2014 run in terminal:</strong><br>",i+=r("sudo cp ~/Downloads/clay-ca.pem /usr/local/share/ca-certificates/clay-ca.crt && sudo update-ca-certificates")),i+='<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>',i+="<br>Then <strong>restart your browser</strong> to apply the change.",i},r=function(o){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">'+se(o)+'</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="'+se(o)+'">Copy</button></div>'};Yo({id:"trust-certificate",title:"Trust Certificate",icon:"\u{1F512}",description:"Getting certificate warnings? Fix them here",tipMatch:function(o){return o.indexOf("certificate")!==-1||o.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:""}]}]}),st("cert_download",function(o){var i=document.createElement("a");i.href="/ca/download",i.download="clay-ca.pem",document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(o,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 se(e){var t=document.createElement("div");return t.textContent=e||"",t.innerHTML}function ta(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"),o=null,i=0,s=[],l=window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function u(d){o=null;var c=a.get("speechActive");if(!(!c||c.id!==e||!t.isConnected||!r)&&(o=requestAnimationFrame(u),!(d-i<(l?100:32)))){i=d;var p=t.clientWidth,g=t.clientHeight,v=Math.min(window.devicePixelRatio||1,2);(n.width!==Math.round(p*v)||n.height!==Math.round(g*v))&&(n.width=Math.round(p*v),n.height=Math.round(g*v)),r.setTransform(v,0,0,v,0,0),r.clearRect(0,0,p,g);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=c.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 N=P.length-b+S/(h-1)*(b-1)+R,O=Math.floor(N),Re=N-O,Z=P[O]||0,De=P[Math.min(O+1,P.length-1)]||0,ee=(Z+(De-Z)*Re)*A,H=s[S]||0,te=l?ee:H+(ee-H)*(ee>H?.5:.24);s[S]=te;for(var Y=1+te*(g*.46-1),Ae=Math.min(1,(S+1)/8,(h-S)/8),ne=0;ne<=g*.48;ne+=3.2){var Xe=Math.exp(-Math.pow(ne/Y,2)*1.7);if(!(Xe<.035)){var jt=.35+Xe*.65;r.globalAlpha=(.12+Xe*.78)*Ae,r.beginPath(),r.arc((S+.5)*p/h,g/2+ne,jt,0,Math.PI*2),r.fill(),ne&&(r.beginPath(),r.arc((S+.5)*p/h,g/2-ne,jt,0,Math.PI*2),r.fill())}}}r.globalAlpha=1}}return{element:t,update:function(d){t.hidden=!d,d&&o===null&&(o=requestAnimationFrame(u)),!d&&o!==null&&(cancelAnimationFrame(o),o=null,s=[])}}}function na(e,t,n){var r=document.getElementById(e),o=document.getElementById(t),i=document.getElementById(n);if(!r||!o||!i||r.dataset.speechBound)return;var s=document.getElementById(e==="stt-btn"?"input-row":"home-mate-chat-composer")||i,l=document.getElementById(e==="stt-btn"?"input-bottom":"home-mate-chat-composer")||s;r.addEventListener("click",qe),r.dataset.speechBound="true",r.classList.add("stt-button");var u=document.createElement("span");u.className="stt-controls",r.before(u),u.appendChild(r);var d=document.createElement("button");d.type="button",d.id=e+"-picker",d.className="stt-picker-toggle",d.innerHTML=Q("chevron-down"),d.setAttribute("aria-label","Choose voice model"),d.setAttribute("aria-haspopup","dialog"),d.setAttribute("aria-expanded","false"),d.title="Choose voice model",u.appendChild(d),d.addEventListener("click",function(){qe(),je(d)});var c=document.createElement("div");c.className="stt-progress",c.hidden=!0;var p=document.createElement("span");p.id=e+"-status",p.className="stt-status",p.setAttribute("role","status");var g=document.createElement("span");g.className="stt-timer",g.setAttribute("aria-hidden","true");var v=document.createElement("button");v.type="button",v.innerHTML=Q("x"),v.className="stt-cancel",v.title="Cancel voice input",v.setAttribute("aria-label","Cancel voice input"),v.addEventListener("click",function(){re(),a.set({speechRetry:null})});var y=ta(e),M=document.createElement("button");M.type="button",M.textContent="Retry",M.addEventListener("click",Yn);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(){Vn(e,"")}),c.append(v,y.element,g,p,M,E,P),s.prepend(c),r.setAttribute("aria-describedby",p.id),r.addEventListener("click",function(){var h=a.get("speechActive");if(h&&h.id===e){h.model&&h.phase==="recording"?Kn():re();return}var b=rt(),R=a.get("speechSettings");if(b.provider==="browser"&&!tt().available){je(d);return}if(b.provider!=="browser"&&(!R||R.configured.indexOf(b.provider)<0)){je(d);return}b.provider==="browser"?Wn(e,o):Gn(e,o,b)}),o.addEventListener("beforeinput",function(){var h=a.get("speechActive");h&&h.id===e&&re("Voice input stopped so you can edit your draft."),a.set({speechRetry:null})}),o.addEventListener("input",function(){var h=a.get("speechActive");h&&h.id===e&&!h.writing&&re()});function k(){var h=a.get("speechActive"),b=!!h&&h.id===e,R=rt(),S=sr(R.provider),N=R.provider==="browser"?a.get("speechBrowserIdentity"):null,O=b&&h.model&&h.phase!=="recording",Re=b&&!!h.autoSend;s.classList.toggle("stt-recording",b),c.classList.toggle("stt-auto-send",Re),c.classList.toggle("stt-progress-active",b),c.classList.toggle("stt-progress-pending",!!O);var Z=b?l:s;(c.parentElement!==Z||c!==Z.firstElementChild)&&Z.prepend(c),y.update(b?h:null),d.hidden=b,r.disabled=o.disabled||o.readOnly||!a.get("speechSettings"),d.disabled=o.disabled||o.readOnly||b,r.classList.toggle("stt-active",b),r.setAttribute("aria-pressed",String(b));var De=b?Re?"Cancel pending voice send":O?"Cancel voice input":R.mode==="recorded"?"Stop and transcribe":"Stop voice input":"Start voice input";r.setAttribute("aria-label",De+" \xB7 "+(S?S.name+" \xB7 ":"")+R.name),r.title=De+" \xB7 "+R.name;var ee=[b,O,S&&S.id,N&&N.id].join(":");if(r.dataset.speechIcon!==ee){if(r.dataset.speechIcon=ee,r.innerHTML=Q(b?O?"x":"square":"mic"),!b&&(S||N&&N.icon)){var H=document.createElement("img");H.className="stt-vendor-badge",H.src=S?S.icon:N.icon,H.alt="",r.appendChild(H)}D()}var te=(a.get("speechStatuses")||{})[e]||"",Y=(a.get("speechErrors")||{})[e];c.classList.toggle("stt-progress-error",!!Y),p.setAttribute("role",Y?"alert":"status"),P.hidden=!Y,E.hidden=!Y||!S,S&&(E.href=S.url),R.provider==="browser"&&!qn()&&(te="Browser voice input is unavailable. Choose a connected speech provider or type your message."),window.isSecureContext||(te="Voice input requires a secure HTTPS connection."),p.textContent=te,g.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 Ae=a.get("speechRetry");M.hidden=!Ae||Ae.id!==e,c.hidden=!b&&!Y&&M.hidden}a.subscribe(k);var A=new MutationObserver(k);A.observe(o,{attributes:!0,attributeFilter:["disabled","readonly"]}),k()}function qe(){a.set({speechBrowserIdentity:tt()})}function ra(){qe(),window.addEventListener("focus",qe),zn(),lr(),na("stt-btn","input","input-wrapper"),na("home-stt-btn","home-mate-chat-input","home-mate-chat-composer-frame"),Be(),window.addEventListener("focus",Be);try{window.top.document.addEventListener("clay:speech-settings-saved",Be)}catch{}}var m=null,T=null,ke=null;function Ce(){return document.body.dataset.myDisplayName||"Clay user"}function de(e){if(m){var t=m.querySelector("#account-ai-section");t&&cr(t),m.remove(),m=null,T.setAttribute("aria-expanded","false"),T.setAttribute("aria-label","Open account menu for "+Ce()),document.removeEventListener("pointerdown",oa),document.removeEventListener("focusin",aa),document.removeEventListener("keydown",ia),window.removeEventListener("resize",le),a.set({defaultAiInlineEditing:!1}),e&&ke&&document.contains(ke)&&ke.focus({preventScroll:!0}),ke=null}}function ft(e){return e&&e.closest&&e.closest(".avatar-positioner-overlay")}function oa(e){!m||m.contains(e.target)||T.contains(e.target)||ft(e.target)||de(!1)}function aa(e){!m||m.contains(e.target)||T.contains(e.target)||ft(e.target)||de(!1)}function ia(e){e.key==="Escape"&&(ft(e.target)||document.querySelector(".avatar-positioner-overlay")||(e.preventDefault(),e.stopPropagation(),de(!0)))}function le(){if(!(!m||!T)){var e=T.getBoundingClientRect(),t=Math.min(280,window.innerWidth-24),n=Math.max(12,Math.min(window.innerWidth-t-12,e.left));m.style.width=t+"px",m.style.left=n+"px",m.style.top=Math.max(12,e.top-m.offsetHeight-8)+"px"}}function ct(e){var t=m&&m.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=Ce(),t.querySelector("#account-name-edit").addEventListener("click",yi),window.lucide&&window.lucide.createIcons({nodes:[t]}),e&&t.querySelector("#account-name-edit").focus())}function yi(){var e=m&&m.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=a.get("accountNameDraft")===void 0?nt().name||"":a.get("accountNameDraft"),t.addEventListener("input",function(){a.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",Qn({name:t.value.trim()}).then(function(){a.set({accountNameDraft:void 0}),ct(!0)}).catch(function(o){t.disabled=!1,n.textContent=o.message,t.focus()})):r.key==="Escape"&&(r.preventDefault(),a.set({accountNameDraft:void 0}),ct(!0)),r.stopPropagation()}),t.focus(),t.select()}}function Si(){var e=m&&m.querySelector("#account-avatar-editor");e&&(e.hidden=!e.hidden,e.hidden||e.querySelector("#account-avatar-upload").focus(),le())}function wi(){var e=m.querySelector("#account-avatar-edit"),t=m.querySelector("#account-avatar-editor"),n=t.querySelector("#account-avatar-upload"),r=t.querySelector("#account-avatar-file"),o=t.querySelector("#account-avatar-generate");e.addEventListener("click",function(i){i.stopPropagation(),Si()}),t.addEventListener("click",function(i){i.stopPropagation()}),n.addEventListener("click",function(){r.click()}),r.addEventListener("change",function(){var i=r.files&&r.files[0];if(i){var s=new Image,l=URL.createObjectURL(i);s.onload=function(){Xn(s,l,function(u){URL.revokeObjectURL(l),$n(u).then(function(){t.hidden=!0}).catch(function(){t.dataset.error="true"})})},s.src=l}}),o.addEventListener("click",function(){Jn(),t.hidden=!0})}function ki(){m=document.createElement("div"),m.id="account-popover",m.className="account-popover",m.setAttribute("role","dialog"),m.setAttribute("aria-label","Account");var e=nt(),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/*">',m.appendChild(t),m.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"),m.appendChild(r),dr(r),t.querySelector(".account-settings-button").addEventListener("click",Ci),document.body.appendChild(m),ct(),wi(),ut(),window.lucide&&window.lucide.createIcons({nodes:[m]}),le()}function ut(){var e=document.getElementById("cursor-share-toggle");if(e){var t=a.get("cursorSharingHydrated")===!0,n=t&&a.get("cursorSharingEnabled")===!0,r=a.get("cursorSharingPending")!==null&&a.get("cursorSharingPending")!==void 0,o=a.get("connected")!==!1,i=a.get("cursorSharingError"),s=!!i&&!t&&o,l=t&&!n&&!r&&!i&&o;e.hidden=a.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||!o||!t&&!s;var u=r?"waiting":o?i?s?"error; activate to retry":"error":t?n?"on":"off":"unavailable":"offline";e.setAttribute("aria-label","Cursor sharing "+u);var d=r?"Cursor sharing is waiting for confirmation.":o?i?s?"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.";Br(e,d)}}function Ci(e){e.stopPropagation(),de(!0),fr()}function Mi(e){if(e.stopPropagation(),!e.currentTarget.disabled){if(a.get("cursorSharingError")&&a.get("cursorSharingHydrated")!==!0){Ur();return}jr(a.get("cursorSharingEnabled")!==!0)}}function Ei(){var e=m&&m.querySelector("#account-ai-section select");e&&e.focus({preventScroll:!0})}function Pi(){m||sa(),a.set({defaultAiInlineEditing:!0}),Ei()}function sa(){if(m){de(!0);return}ke=document.activeElement,ki(),T.setAttribute("aria-expanded","true"),T.setAttribute("aria-label","Close account menu for "+Ce()),document.addEventListener("pointerdown",oa),document.addEventListener("focusin",aa),document.addEventListener("keydown",ia),window.addEventListener("resize",le)}function la(){if(T=document.getElementById("user-account-trigger"),!!T){T.addEventListener("click",sa),document.addEventListener("clay:open-account-default-ai",Pi);var e=document.getElementById("cursor-share-toggle");e&&e.addEventListener("click",Mi),ut(),T.setAttribute("aria-label","Open account menu for "+Ce()),a.subscribe(function(t,n){t.myUserId!==n.myUserId&&t.accountNameDraft!==void 0&&a.set({accountNameDraft:void 0}),(t.myUserId!==n.myUserId||t.connected===!1&&n.connected!==!1)&&de(!1),ut(),m&&le()}),document.addEventListener("clay:profile-updated",function(){if(m){var t=m.querySelector(".account-name-display span");t&&(t.textContent=Ce());var n=m.querySelector("#account-avatar-edit img");n&&(n.src=document.body.dataset.myAvatarUrl||n.src)}}),window.addEventListener("resize",le)}}var xi=[{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"}],Li=[{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"}],ue={session:{tools:xi,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:Li,activeContainerId:"mate-sidebar-tools",hiddenSectionId:"mate-sidebar-tools-hidden"}},Ii={"skills-btn":"mcp-btn"},Ti={"mate-skills-btn":"mate-mcp-btn","mate-debate-btn":"mate-debates-btn"},da=["git-sidebar-btn","loop-tool-btn","debates-btn"];function ce(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}function fa(e,t){var n=t&&t.order||[],r=t&&t.hidden||[],o={order:n.slice(),hidden:r.slice(),migrated:!1};if(e!=="session"&&e!=="mate")return o;for(var i=e==="mate"?Ti:Ii,s=Object.keys(i),l=0;l<s.length;l++){var u=s[l],d=i[u],c=ce(o.order,u)!==-1,p=ce(o.hidden,u)!==-1;if(!(!c&&!p)){var g=ce(o.order,d)!==-1||ce(o.hidden,d)!==-1;o.order=ua(o.order,u,d,g),o.hidden=ua(o.hidden,u,d,g),o.migrated=!0}}if(e!=="session")return o;for(var v=0;v<da.length;v++){var y=da[v];ce(o.order,y)===-1&&ce(o.hidden,y)===-1||(o.order=ca(o.order,y),o.hidden=ca(o.hidden,y),o.migrated=!0)}return o}function ca(e,t){for(var n=[],r=0;r<e.length;r++)e[r]!==t&&n.push(e[r]);return n}function ua(e,t,n,r){for(var o=[],i={},s=0;s<e.length;s++){var l=e[s];if(l===t){if(r)continue;l=n}i[l]||(i[l]=!0,o.push(l))}return o}var Ve={},W=null,fe=null;function ga(){for(var e in ue)Ri(e);Ai(),D()}function Ri(e){var t=ue[e],n=document.getElementById(t.activeContainerId);if(n){(t.fixedTools||[]).forEach(function(o){n.appendChild(pa(o,e))});for(var r=0;r<t.tools.length;r++)n.appendChild(pa(t.tools[r],e));n.addEventListener("dragover",function(o){if(!(fe!==e||!W)){o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect="move");var i=Di(n,o.clientX,o.clientY);i==null?(W.parentNode!==n||W.nextSibling)&&n.appendChild(W):i!==W&&n.insertBefore(W,i)}}),n.addEventListener("drop",function(o){fe===e&&o.preventDefault()})}}function pa(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 o=document.createElement("span");if(o.className="tool-btn-label",o.textContent=e.label,n.appendChild(o),e.countId){var i=document.createElement("span");i.id=e.countId,i.className="sidebar-badge hidden",e.id==="you-button"&&(i.className="sidebar-badge me-unread-badge",i.hidden=!0),n.appendChild(i)}return n.addEventListener("dragstart",function(s){if(e.fixed){s.preventDefault();return}var l=n.parentNode;if(!l||l.id!==ue[t].activeContainerId){s.preventDefault();return}W=n,fe=t,s.dataTransfer.effectAllowed="move";try{s.dataTransfer.setData("text/plain",e.id)}catch{}n.classList.add("dragging")}),n.addEventListener("dragend",function(){n.classList.remove("dragging"),fe&&Bi(fe),W=null,fe=null}),n}function Di(e,t,n){for(var r=Array.prototype.slice.call(e.querySelectorAll("[data-tool-id]:not(.dragging)")),o=null,i=Number.POSITIVE_INFINITY,s=0;s<r.length;s++)if(r[s].dataset.fixed!=="true"){var l=r[s].getBoundingClientRect(),u=n-(l.top+l.height/2),d=t-(l.left+l.width/2),c=Math.abs(u)*2+Math.abs(d),p=u<-l.height/2||Math.abs(u)<=l.height/2&&d<0;p&&c<i&&(i=c,o=r[s])}return o}function Ai(){fetch("/api/user/tool-palettes",{credentials:"same-origin"}).then(function(e){return e.ok?e.json():null}).then(function(e){e&&(ma("session",e.session||null),ma("mate",e.mate||null))}).catch(function(){})}function ma(e,t){if(!t)return;var n=ue[e];if(!n)return;var r=document.getElementById(n.activeContainerId);if(!r)return;var o=fa(e,t),i={};function s(v){if(!i[v]){var y=document.getElementById(v);!y||y.dataset.fixed==="true"||(r.appendChild(y),i[v]=!0)}}for(var l={},u=0;u<o.hidden.length;u++)l[o.hidden[u]]=!0;for(var d=0;d<o.order.length;d++)l[o.order[d]]||s(o.order[d]);for(var c=0;c<n.tools.length;c++)l[n.tools[c].id]||s(n.tools[c].id);for(var p=0;p<o.hidden.length;p++)s(o.hidden[p]);for(var g=0;g<n.tools.length;g++)s(n.tools[g].id)}function Bi(e){Ve[e]&&clearTimeout(Ve[e]),Ve[e]=setTimeout(function(){Ve[e]=null,ji(e)},250)}function ji(e){var t=ue[e];if(t){var n=document.getElementById(t.activeContainerId);if(n){for(var r=[],o=n.querySelectorAll("[data-tool-id]"),i=0;i<o.length;i++)o[i].dataset.fixed!=="true"&&r.push(o[i].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 Me=[],pt=[],L=null,J=null,mt=null,U=!1,Ee="project",z=0,C=[];function ha(e){e!=="project"&&e!=="mate"||(U&&G(!1),gt(e))}function ya(){Ui(),J=L.querySelector(".cmd-palette-results"),mt=L.querySelector(".project-switcher-header");var e=a.get("currentSlug");e&&(Me=[e]);var t=a.get("dmTargetUser");t&&t.isMate&&t.id&&(pt=[t.id]),a.subscribe(function(d,c){d.currentSlug&&d.currentSlug!==c.currentSlug&&(ba(Me,d.currentSlug),Me=Me);var p=va(d.dmTargetUser),g=va(c.dmTargetUser);p&&p!==g&&ba(pt,p)});var n=L.querySelector(".cmd-palette-backdrop");n&&n.addEventListener("click",function(){G(!1)}),document.addEventListener("keydown",_i,!0),document.addEventListener("keyup",Ni,!0),window.addEventListener("blur",function(){U&&G(!1)});var r=/Mac|iPhone|iPod|iPad/i.test(navigator.platform),o=r?"\u2318E":"Ctrl+E",i=r?"\u2318M":"Ctrl+M",s=document.getElementById("icon-strip-hint-project"),l=document.getElementById("icon-strip-hint-mate");s&&(s.textContent=o,s.title="Switch project ("+o+")",s.addEventListener("click",function(){ha("project")})),l&&(l.textContent=i,l.title="Switch mate ("+i+")",l.addEventListener("click",function(){ha("mate")}));function u(){if(l){var d=a.get("cachedMatesList")||[];l.classList.toggle("hidden",d.length===0)}}u(),a.subscribe(function(d,c){(d.cachedMatesList!==c.cachedMatesList||d.projectMateDmsEnabled!==c.projectMateDmsEnabled)&&u()})}function Ui(){if(L=document.getElementById("project-switcher"),!L){var e=/Mac|iPhone|iPod|iPad/i.test(navigator.platform),t=e?"<kbd>\u2318</kbd>":"<kbd>Ctrl</kbd>";L=document.createElement("div"),L.id="project-switcher",L.className="cmd-palette hidden project-switcher",L.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(L)}}function va(e){return e&&e.isMate&&e.id?e.id:null}function ba(e,t){var n=e.indexOf(t);n!==-1&&e.splice(n,1),e.unshift(t)}function _i(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?Ee!==r?gt(r):e.shiftKey?We(-1):We(1):gt(r);return}if(U){if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),G(!1);return}if(e.key==="Enter"){e.preventDefault(),e.stopPropagation(),G(!0);return}if(e.key==="ArrowRight"||e.key==="ArrowDown"){e.preventDefault(),We(1);return}if(e.key==="ArrowLeft"||e.key==="ArrowUp"){e.preventDefault(),We(-1);return}}}}function Ni(e){U&&(e.key==="Meta"||e.key==="Control")&&G(!0)}function gt(e){if(Ee=e,C=Fi(e),C.length===0){U&&G(!1);return}mt&&(mt.textContent=e==="mate"?"Switch mate":"Switch project"),Oi(e),Wi(),z=Hi(),ht(),L.classList.remove("hidden"),U=!0,D(),Ne(J)}function Oi(e){var t=L.querySelector(".proj-next-key"),n=L.querySelector(".proj-prev-key"),r=e==="mate"?"M":"E";t&&(t.textContent=r),n&&(n.textContent=r)}function Hi(){if(C.length===0)return 0;for(var e=Ee==="mate"?pt:Me,t=Sa(),n=0;n<e.length;n++){var r=e[n];if(r!==t){for(var o=0;o<C.length;o++)if(C[o].key===r&&!C[o].disabled)return o}}for(var i=0;i<C.length;i++)if(!C[i].disabled&&C[i].key!==t)return i;for(var s=0;s<C.length;s++)if(!C[s].disabled)return s;return 0}function Sa(){if(Ee==="mate"){var e=ot(a.snap());return e?e.id:null}return a.get("currentSlug")}function Fi(e){return e==="mate"?Vi():qi()}function qi(){var e=(be()||[]).filter(function(t){return!t.isMate});return e.map(function(t){var n=to(t);return{key:t.slug,title:t.title||t.project||t.slug,icon:t.icon||null,fallbackIcon:"folder",isCurrent:t.slug===a.get("currentSlug"),external:n,disabled:!1,disabledReason:null}})}function Vi(){var e=a.get("cachedMatesList")||[],t=ot(a.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:qt(r,88),fallbackIcon:"user",isCurrent:r.id===n,disabled:!1,disabledReason:null}})}function G(e){if(U&&(U=!1,L.classList.add("hidden"),!!e)){var t=C[z];!t||t.disabled||(Ee==="mate"?t.key!==Sa()&&ao(t.key):t.key!==a.get("currentSlug")&&_e(t.key))}}function We(e){if(C.length!==0){for(var t=e>0?1:-1,n=z,r=0;r<C.length;r++)if(n=(n+t+C.length)%C.length,!C[n].disabled){z=n,ht();return}}}function Wi(){if(J){J.innerHTML="";for(var e=0;e<C.length;e++)J.appendChild(zi(C[e],e))}}function zi(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=no(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 o=document.createElement("img");o.src=e.avatarUrl,o.alt="",o.className="project-switcher-avatar",r.appendChild(o)}else{var i=document.createElement("i");i.setAttribute("data-lucide",e.fallbackIcon||"folder"),r.appendChild(i)}e.external&&ro(r,"project-switcher-external-badge"),n.appendChild(r);var s=document.createElement("div");s.className="cmd-palette-item-body";var l=document.createElement("div");l.className="cmd-palette-item-title-row";var u=document.createElement("span");if(u.className="cmd-palette-item-title",u.textContent=e.title,l.appendChild(u),e.isCurrent){var d=document.createElement("span");d.className="project-switcher-current",d.textContent="current",l.appendChild(d)}if(e.disabled&&e.disabledReason){var c=document.createElement("span");c.className="project-switcher-disabled-reason",c.textContent=e.disabledReason,l.appendChild(c)}return s.appendChild(l),n.appendChild(s),n.addEventListener("mouseenter",function(){e.disabled||(z=t,ht())}),n.addEventListener("click",function(){e.disabled||(z=t,G(!0))}),n}function ht(){if(J){for(var e=J.querySelectorAll(".cmd-palette-item"),t=0;t<e.length;t++)e[t].classList.toggle("active",t===z);var n=e[z];n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest"})}}var Gi=/^[a-zA-Z0-9_-]{1,120}$/;function vt(){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 bt(e){var t=Ao();try{e.contentWindow&&e.contentWindow.postMessage({type:"clay-appearance",snapshot:t},window.location.origin)}catch{}}function wa(e){return typeof e=="string"&&Gi.test(e)}function yt(e){return e===null||wa(e)}function Ki(e){var t=e&&typeof e=="object"?e.preference:null;return!t||typeof t!="object"||!wa(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:yt(t.theme)&&yt(t.lightTheme)&&yt(t.darkTheme)}function ka(){if(a.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"||!Ki(t.snapshot))){var n=a.get("myUserId")||null;n!==null&&t.snapshot.userId!==n||Bo(t.snapshot)}}});return}Do(function(){vt().forEach(bt)}),a.subscribe(function(e,t){e.myUserId!==t.myUserId&&vt().forEach(bt)}),document.addEventListener("load",function(e){e.target&&e.target.tagName==="IFRAME"&&vt().indexOf(e.target)>=0&&bt(e.target)},!0)}var Yi=500,Ca=10,pe=null,St=0,wt=0,Pe=!1,Ma=null;function ze(){pe&&(clearTimeout(pe),pe=null)}function Ea(){"ontouchstart"in window&&(document.addEventListener("touchstart",function(e){if(e.touches.length!==1){ze();return}var t=e.touches[0];St=t.clientX,wt=t.clientY,Pe=!1,Ma=e.target,pe=setTimeout(function(){pe=null,Pe=!0,navigator.vibrate&&navigator.vibrate(30);var n=new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:St,clientY:wt});Ma.dispatchEvent(n)},Yi)},{passive:!0}),document.addEventListener("touchmove",function(e){if(pe){var t=e.touches[0],n=t.clientX-St,r=t.clientY-wt;n*n+r*r>Ca*Ca&&ze()}},{passive:!0}),document.addEventListener("touchend",function(e){ze(),Pe&&(Pe=!1,e.preventDefault())},{passive:!1}),document.addEventListener("touchcancel",function(){ze(),Pe=!1},{passive:!0}))}var Pa=!1,xa=!1;function kt(e){return/^\/p\/[a-z0-9_-]+(?:\/|$)/.test(e||"")}function Qi(e){return e?e.paneMode||kt(e.pathname)||e.currentSlug?"project":e.projectsLoaded!==!0?"wait":"projects":"wait"}function La(){document.body.classList.remove("home-surface-boot-pending");var e=document.getElementById("connect-overlay");e&&a.get("connected")&&e.classList.add("hidden")}function Ji(e){return e?"/p/"+e+"/":null}function Ia(e){if(!xa){var t=Qi({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(xa=!0,t==="project"){if(!kt(location.pathname)){var n=Ji(e.currentSlug);n&&history.replaceState(null,"",n)}a.set({homeSurfaceBootResolved:!0}),La();var r=document.getElementById("input");r&&!r.disabled&&r.focus({preventScroll:!0});return}a.set({homeSurfaceBootResolved:!0,projectsHubRestoreRequested:!0}),La()}}}function Ta(){if(!Pa){if(Pa=!0,!kt(location.pathname)&&!a.get("paneMode")){document.body.classList.add("home-surface-boot-pending");var e=document.getElementById("connect-overlay-msg");e&&(e.textContent="Restoring your workspace\u2026")}a.subscribe(function(t){Ia(t)}),Ia(a.snap())}}var $i=3600*1e3,Xi="(max-width: 768px)",Ct=null,Mt=!1;function Zi(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 Da(){var e=a.get("githubStarCount"),t=document.getElementById("github-star-count"),n=document.getElementById("github-star-link");if(!(!t||!n)){var r=typeof e=="number"?Zi(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 es(){return!!(window.matchMedia&&window.matchMedia(Xi).matches)}function Ra(){return Mt||es()?Promise.resolve():(Mt=!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"&&(a.set({githubStarCount:e.stars}),Da())}).catch(function(){}).then(function(){Mt=!1}))}function Aa(){document.getElementById("github-star")&&(Da(),Ra(),Ct&&clearInterval(Ct),Ct=setInterval(Ra,$i))}var _=!1,Ge=null,Ba={shell:"terminal",agent:"sparkles",other:"circle-dot"};function _a(){a.subscribe(function(e,t){e.activeBackgroundTasks!==t.activeBackgroundTasks&&Et()}),Et()}function Na(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 o=Math.floor(r/60),i=r%60;if(o<60)return o+"m "+ja(i)+"s";var s=Math.floor(o/60);return s+"h "+ja(o%60)+"m"}function ja(e){return e<10?"0"+e:String(e)}function Ke(){Ge&&(clearInterval(Ge),Ge=null)}function ts(){Ke(),Ge=setInterval(ns,1e3)}function ns(){var e=document.getElementById("background-tasks-bar");if(!e||!_){Ke();return}for(var t=Date.now(),n=e.querySelectorAll(".background-task-elapsed"),r=0;r<n.length;r++){var o=Number(n[r].dataset.startedAt);n[r].textContent=Na(o,t)}}function rs(){return'<span class="background-tasks-activity" aria-hidden="true"><i></i><i></i><i></i></span>'}function Oa(e){return!!(e&&e.ambient===!0)}function os(e){for(var t=[],n=[],r=Array.isArray(e)?e:[],o=0;o<r.length;o++)r[o]&&(Oa(r[o])?n.push(r[o]):t.push(r[o]));return{user:t,ambient:n}}function Ua(e,t){var n=e.task_type||"other",r=Ba[n]||Ba.other,o=e.description||"Background task",i=typeof e.started_at=="number"?e.started_at:0,s=Na(i,t);return'<div class="background-task-row'+(Oa(e)?" ambient":"")+'"><span class="background-task-icon" title="'+F(n)+'">'+Q(r)+'</span><span class="background-task-description" title="'+F(o)+'">'+F(o)+'</span><span class="background-task-meta"><span class="background-task-type">'+F(n)+'</span><span class="background-task-elapsed" data-started-at="'+i+'">'+F(s)+'</span></span><button type="button" class="background-task-stop" data-task-id="'+F(e.task_id||"")+'" aria-label="Stop '+F(o)+'">Stop</button></div>'}function Et(){var e=a.get("activeBackgroundTasks")||[],t=os(e),n=document.getElementById("background-tasks-bar");if(t.user.length===0){n&&n.remove(),_=!1,Ke();return}var r=document.getElementById("input-area");if(!(!r||!r.parentNode)){var o=n||document.createElement("div");o.id="background-tasks-bar",o.className="background-tasks-bar"+(_?" expanded":"");var i=t.user.length===1?"background task":"background tasks",s=t.user.length+" "+i,l='<button type="button" class="background-tasks-toggle" aria-expanded="'+_+'" aria-controls="background-tasks-list" aria-label="'+s+", "+(_?"collapse":"expand")+' details">'+rs()+'<span class="background-tasks-summary">'+s+'</span><span class="background-tasks-chevron" aria-hidden="true">'+Q("chevron-right")+"</span></button>";if(_){var u=Date.now();l+='<div class="background-tasks-list" id="background-tasks-list">';for(var d=0;d<t.user.length;d++)l+=Ua(t.user[d],u);if(t.ambient.length>0){l+='<div class="background-tasks-section-label">Housekeeping</div>';for(var c=0;c<t.ambient.length;c++)l+=Ua(t.ambient[c],u)}l+="</div>"}o.innerHTML=l,n||r.parentNode.insertBefore(o,r),D(),o.querySelector(".background-tasks-toggle").addEventListener("click",function(){_=!_,Et()});for(var p=o.querySelectorAll(".background-task-stop"),g=0;g<p.length;g++)p[g].addEventListener("click",function(){var v=w();v&&v.readyState===1&&v.send(JSON.stringify({type:"stop_task",taskId:this.dataset.taskId}))});_?ts():Ke()}}var Tt=new URLSearchParams(location.search),ge=Tt.get("pane")==="1";ge&&typeof performance<"u"&&performance.mark&&performance.mark("clay:app-evaluated");var X=Number(Tt.get("session"));(!Number.isSafeInteger(X)||X<1)&&(X=null);ge&&document.body.classList.add("pane-mode");var Qe=location.pathname.match(/^\/p\/([a-z0-9_-]+)/),as=document.body.dataset.homeProjectSlug||null,Ie=Qe?Qe[1]:as,K=Ie?"/p/"+Ie+"/":"/",me=Ie?"/p/"+Ie+"/ws":"/ws";ge&&(me+="?pane=1",X&&(me+="&session="+X),Tt.get("contextual")==="1"&&(me+="&contextual=1"));var f=function(e){return document.getElementById(e)},I=f("messages"),$e=f("input"),is=f("send-btn");var Lt=f("header-title"),gh=f("header-rename-btn"),ss=f("slash-menu"),hh=f("suggestion-chips"),ls=f("sidebar"),ds=f("sidebar-overlay"),Qa=f("session-list"),cs=f("new-session-btn"),us=f("hamburger-btn"),fs=f("sidebar-toggle-btn"),ps=f("sidebar-expand-btn"),ms=f("image-preview-bar"),vh=f("connect-overlay");var gs="/claude-code-avatar.png";function Ja(e){Ue(e)}function hs(){return!1}function $a(){var e=document.getElementById("icon-strip-add");e&&e.click()}function Xa(e){Zr(e)}function vs(){eo()}var bh=f("project-list-section"),yh=f("project-list"),Sh=f("project-list-add"),bs=f("project-hint"),Ha=f("project-hint-dismiss"),Je=Ie||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"&&Dt()});Ha&&Ha.addEventListener("click",function(){bs.classList.add("hidden");try{localStorage.setItem("clay-project-hint-dismissed","1")}catch{}});f("mermaid-modal").querySelector(".confirm-backdrop").addEventListener("click",at);f("mermaid-modal").querySelector(".mermaid-modal-btn[title='Close']").addEventListener("click",at);f("image-modal").querySelector(".confirm-backdrop").addEventListener("click",Dt);f("image-modal").querySelector(".image-modal-close").addEventListener("click",Dt);function Rt(e){dn(e)}function Dt(){cn()}var Za="";try{xe=localStorage.getItem("clay-project-name-"+(Je||"default")),xe&&(Za=xe,Lt&&(Lt.textContent=xe),Pt=f("title-bar-project-name"),Pt&&(Pt.textContent=xe)),xt=localStorage.getItem("clay-project-icon-"+(Je||"default")),xt&&(Le=f("title-bar-project-icon"),Le&&(Le.textContent=xt,Ne(Le),Le.classList.add("has-icon")))}catch{}var xe,Pt,xt,Le;function ei(e,t,n,r){un(e,t,n,r)}Ut({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:K,wsPath:me,paneMode:ge,paneSessionId:X,panePinPending:ge&&!!X,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:Za,cwd:"",currentSlug:Je,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:br(),projectStartFolder:yr(),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:[],sessionVendorBound:!1,cliSessionId:null,isHeadlessMode:!1,savedMainSlug:null,connected:!1,fileReadRequest: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}});gr({$:f,get ws(){return w()},get connected(){return a.get("connected")},get processing(){return a.get("processing")},messagesEl:I,addSystemMessage:ii});jo();ka();Ar();Ea();var ys={$:f,get ws(){return w()},get connected(){return a.get("connected")},get projectName(){return a.get("projectName")},messagesEl:I,sessionListEl:Qa,sidebar:ls,sidebarOverlay:ds,sidebarToggleBtn:fs,sidebarExpandBtn:ps,hamburgerBtn:us,newSessionBtn:cs,headerTitleEl:Lt,showConfirm:ei,onFilesTabOpen:function(){No(),Ho(),V()&&q()},requestKnowledgeList:function(){Hn()},switchProject:function(e){si(e)},openTerminal:function(){Ro()},showHomeHub:function(){Ja()},getUpcomingSchedules:hn,get multiUser(){return a.get("isMultiUserMode")},get myUserId(){return a.get("myUserId")},get projectOwnerId(){return a.get("currentProjectOwnerId")},get ownerLocked(){return a.get("ownerLocked")},openDm:function(e){Xa(e)},openMateWizard:function(){$a()},openAddProjectModal:function(){Sr()},sendWs:function(e){var t=w();t&&t.readyState===1&&t.send(JSON.stringify(e))},onDmRemoveUser:function(e){var t=Object.assign({},a.get("dmRemovedUsers"));t[e]=!0,a.set({dmRemovedUsers:t})},getHistoryFrom:function(){return a.get("historyFrom")},get permissions(){return a.get("permissions")},get projectList(){return be()||[]},availableBuiltins:function(){return a.get("cachedAvailableBuiltins")||[]}};ga();Oe([pr,Bn,jn,Zt,Un,en,vr,Yr]);Io(ys);var At=function(){return w()};Fn(At);Nn(At);Oe([tr]);_n(At,{onShow:function(){On(),Co()}});so({switchProject:function(e){si(e)},currentSlug:function(){return a.get("currentSlug")},matesList:function(){return a.get("cachedMatesList")||[]},availableBuiltins:function(){return a.get("cachedAvailableBuiltins")||[]},allUsers:function(){return a.get("cachedAllUsers")||[]},dmConversations:function(){return a.get("cachedDmConversations")||[]},myUserId:function(){return a.get("myUserId")},selectSession:function(e){V()&&q();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){Xa(e)},runAction:function(e){switch(e){case"createMate":$a();break;case"openSettings":vn();break;case"showHome":Ja();break}}});ya();nr();Xt();function Ss(e){Cn(e)}function ws(){Mn()}function ks(e){En(e)}function Cs(){go()}function Ms(){ho()}function ti(){Ln()}function ni(){In()}function Es(){Tn()}function Ps(){Rn()}function Bt(e){Kt(e)}var $=f("new-msg-btn"),Fa="\u2193 Latest";function It(){var e=f("input-area");e&&($.style.bottom=e.offsetHeight+12+"px")}var qa=f("input-area");qa&&window.ResizeObserver?new ResizeObserver(It).observe(qa):window.addEventListener("resize",It);It();I.addEventListener("scroll",function(){if(!Vt()){var e=I.scrollHeight-I.scrollTop-I.clientHeight,t=e>150;Gt(t),t?($.classList.contains("hidden")&&($.textContent=Fa),$.classList.remove("hidden")):($.classList.add("hidden"),$.textContent=Fa)}});$.addEventListener("click",function(){ri()});document.addEventListener("visibilitychange",function(){document.hidden||Te()});I.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;ei("Fork session from this message?",function(){var o=w();o&&o.readyState===1&&o.send(JSON.stringify({type:"fork_session",uuid:r}))},"Fork",!1)}}});function Te(){Yt()}function ri(){Qt()}ln();kn();Pr();rr();qr();Nr();_a();Qr();Hr();Fr();zr();lo();xn();Dn();Wt();rn({$:f,get ws(){return w()},get connected(){return a.get("connected")},get turnCounter(){return zt()},messagesEl:I,inputEl:$e,finalizeAssistantBlock:function(){xs()},addToMessages:function(e){Bt(e)},scrollToBottom:function(){Te()},setActivity:function(e){ks(e)},stopUrgentBlink:function(){ws()},showImageModal:Rt,getContextPercent:function(){var e=Pn();return e.contextWindow>0?Math.round(e.input/e.contextWindow*100):0},isMateDm:function(){return a.get("dmMode")&&a.get("dmTargetUser")&&a.get("dmTargetUser").isMate},getMateName:function(){return a.get("dmTargetUser")&&a.get("dmTargetUser").displayName||"Mate"},getMateAvatarUrl:function(){return document.body.dataset.mateAvatarUrl||""},getClaudeAvatar:function(){return gs},getMateById:function(e){var t=a.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 oi(e,t,n,r,o){uo(e,t,n,r,o)}function ai(e,t){po(e,t)}function xs(){mo()}function ii(e,t){fo(e,t)}function Ls(){bo()}function Is(){Rr()}function si(e){_e(e)}window.addEventListener("popstate",function(){if(/^\/projects\/?$/.test(location.pathname)){Ue(!0);return}Cr();var e=location.pathname.match(/^\/p\/([a-z0-9_-]+)/),t=e?e[1]:null;if(!t){Ue(!0);return}er("project",t),hs()&&void 0,t&&t!==a.get("currentSlug")&&(_o(),oe(),V()&&q(),mn(t),a.set({currentSlug:t}),K="/p/"+t+"/",me="/p/"+t+"/ws",a.set({basePath:K,wsPath:me}),Is(),li())});function li(){$r()}co({get ws(){return w()},get connected(){return a.get("connected")},get processing(){return a.get("processing")},get basePath(){return K},inputEl:$e,sendBtn:is,slashMenu:ss,messagesEl:I,imagePreviewBar:ms,slashCommands:function(){return a.get("slashCommands")},messageUuidMap:function(){return a.get("messageUuidMap")},addUserMessage:oi,addSystemMessage:ii,toggleUsagePanel:ti,toggleStatusPanel:ni,toggleContextPanel:Ps,resetContextData:Es,showImageModal:Rt,hideSuggestionChips:Ls,getGhostSuggestion:function(){return vo()},setSendBtnMode:Ss,isDmMode:function(){return a.get("dmMode")&&!(a.get("dmTargetUser")&&a.get("dmTargetUser").isMate)},getDmKey:function(){return a.get("dmKey")},handleDmSend:function(){vs()},isDebateEndedMode:function(){return a.get("debateEndedMode")},handleDebateEndedSend:function(){handleDebateEndedSend()},isDebateConcludeMode:function(){return a.get("debateConcludeMode")},handleDebateConcludeSend:function(){Ds()},isDebateFloorMode:function(){return a.get("debateFloorMode")},handleDebateFloorSend:function(){Bs()},isMateDm:function(){return a.get("dmMode")&&a.get("dmTargetUser")&&a.get("dmTargetUser").isMate},getDmMateId:function(){var e=a.get("dmTargetUser");return a.get("dmMode")&&e&&e.isMate?e.id:null},getMateName:function(){return a.get("dmTargetUser")&&a.get("dmTargetUser").displayName||"Mate"},getMateAvatarUrl:function(){return document.body.dataset.mateAvatarUrl||""},showMatePreThinking:function(){Ms()},showClaudePreThinking:function(){Cs()},myUserId:function(){return a.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"}});hr();Gr({get ws(){return w()},get connected(){return a.get("connected")},inputEl:$e,messagesEl:I,matesList:function(){return a.get("cachedMatesList")||[]},availableBuiltins:function(){return a.get("cachedAvailableBuiltins")||[]},allUsers:function(){return a.get("cachedAllUsers")||[]},myUserId:function(){return a.get("myUserId")},scrollToBottom:Te,addUserMessage:oi,addCopyHandler:ai,addToMessages:Bt,showImageModal:Rt,showPasteModal:sn});xr({get ws(){return w()},sendWs:function(e){var t=w();t&&t.readyState===1&&t.send(JSON.stringify(e))},messagesEl:I,addToMessages:function(e){Bt(e)},scrollToBottom:Te,addCopyHandler:ai,matesList:function(){return a.get("cachedMatesList")||[]},availableBuiltins:function(){return a.get("cachedAvailableBuiltins")||[]},currentMateId:function(){return a.get("dmTargetUser")&&a.get("dmTargetUser").isMate?a.get("dmTargetUser").id:a.get("homeChatMateId")||null},requireSkills:Rs,showDebateEndedMode:function(e){As(e)}});ra();Zn({basePath:K});bn();ur({basePath:K});function Ts(){fn()}fetch("/api/me").then(function(e){return e.json()}).then(function(e){if(e.multiUser&&(a.set({isMultiUserMode:!0}),document.body&&document.body.classList.add("is-multi-user")),e.user&&e.user.id&&(a.set({myUserId:e.user.id}),yn()),a.set({authIdentityLoaded:!0}),a.set({permissions:e.permissions||null,projectsAccessLoaded:!0}),e.mustChangePin&&Ts(),!a.get("isMultiUserMode")){var t=document.getElementById("icon-strip-users");t&&(t.innerHTML="",t.classList.add("hidden"))}la();var n=a.get("permissions");if(n){if(!n.terminal){var r=document.getElementById("terminal-toggle-btn");r&&(r.style.display="none");var o=document.getElementById("terminal-sidebar-btn");o&&(o.style.display="none");var i=document.getElementById("shell-command-btn");i&&(i.style.display="none");var s=document.getElementById("input-more-shell");s&&(s.style.display="none")}if(!n.fileBrowser){var l=document.getElementById("file-browser-btn");l&&(l.style.display="none");var u=document.getElementById("git-placard");u&&(u.style.display="none")}if(!n.skills){var d=document.getElementById("skills-btn");d&&(d.style.display="none");var c=document.getElementById("mate-skills-btn");c&&(c.style.display="none")}if(!n.scheduledTasks){var p=document.getElementById("scheduler-btn");p&&(p.style.display="none")}if(!n.createProject){var g=document.getElementById("icon-strip-add");g&&(g.style.display="none")}}}).catch(function(){});ar().then(function(e){if(a.get("isMultiUserMode")&&!e){var t=document.getElementById("update-pill-wrap");t&&(t.style.display="none")}});or({$:f,get ws(){return w()},get connected(){return a.get("connected")},messagesEl:I,sessionListEl:Qa,scrollToBottom:Te,forceScrollToBottom:ri,basePath:K,toggleUsagePanel:ti,toggleStatusPanel:ni});ir();Sn(oo());wn();Uo({get ws(){return w()},get connected(){return a.get("connected")},get activeSessionId(){return a.get("activeSessionId")},get cwd(){return a.get("cwd")},messagesEl:I,fileTreeEl:f("file-tree"),fileViewerEl:f("file-viewer")});Oe([Lo,Ko,tn]);qo();Or();An();To({get ws(){return w()},get connected(){return a.get("connected")},terminalContainerEl:f("terminal-container"),terminalBodyEl:f("terminal-body"),fileViewerEl:f("file-viewer")});on({get ws(){return w()},get connected(){return a.get("connected")}});ea();(function(){var e=new URLSearchParams(window.location.search),t=e.get("playbook");if(t){setTimeout(function(){Zo(t)},300),e.delete("playbook");var n=e.toString(),r=window.location.pathname+(n?"?"+n:"")+window.location.hash;window.history.replaceState(null,"",r)}})();Jt({messagesEl:I,get ws(){return w()},getHistoryFrom:function(){return a.get("historyFrom")}});var Va=f("find-in-session-btn");Va&&Va.addEventListener("click",function(){$t()});wo();xo();yo(function(){ae()&&Eo()});var Wa=f("sticky-notes-sidebar-btn");Wa&&Wa.addEventListener("click",function(){he(),ve(),V()&&q(),ae()&&oe(),ko(),Mo()});var za=document.querySelectorAll("#sticky-notes-toggle-btn");for(Ye=0;Ye<za.length;Ye++)za[Ye].addEventListener("click",function(){So()});var Ye,Ga=f("sticky-notes-sidebar-count");Ga&&Ga.addEventListener("click",function(e){e.stopPropagation(),he(),ve(),V()&&q(),ae()?oe():Po()});var Ka=f("git-placard-more"),Ya=f("terminal-sidebar-btn");Ka&&Ka.addEventListener("click",function(){et(),he(),ve(),ae()&&oe(),V()&&q()});Ya&&Ya.addEventListener("click",function(){et(),he(),ve(),ae()&&oe(),V()&&q()});function Rs(e,t){Vr(e,t)}function Ds(){Lr()}function As(e){Ir(e)}function Bs(){Tr()}an();mr();pn({get ws(){return w()},get connected(){return a.get("connected")},get activeSessionId(){return a.get("activeSessionId")},basePath:K,currentSlug:Je,getProjects:function(){return be()}});_r();Er();Dr();Aa();wr();io();Wr();kr();Kr();Mr();Ta();Xr();Jr();lucide.createIcons();ge&&typeof performance<"u"&&performance.mark&&performance.mark("clay:bootstrap-complete");li();Qe&&location.hash==="#scheduler"?setTimeout(function(){gn("calendar")},500):Qe&&$e.focus();
1
+ import{$ as In,$a as Sr,$b as ho,Aa as nt,Ab as Wr,Ac as _o,Ba as er,Bb as zr,Bc as No,C as an,Cb as Gr,Cc as Oo,D as sn,Da as tr,Db as Kr,Dc as Ho,E as ln,Ea as nr,Eb as Yr,Ec as Fo,F as dn,Fa as rr,Fb as Qr,G as cn,Ga as or,Gb as Jr,H as un,Ha as ar,Hb as $r,I as fn,Ia as ir,Ib as Xr,J as pn,Ja as rt,Jb as Zr,K as q,Ka as sr,Kb as eo,L as mn,La as Be,Lb as to,M as gn,Ma as je,Mb as no,N as V,Na as lr,Nb as ro,O as hn,Oa as dr,Ob as oo,P as vn,Pa as cr,Q as bn,Qa as ur,Qb as ot,R as yn,Ra as fr,Rb as ao,S as Sn,Sa as pr,Sb as io,T as wn,Ta as he,Tb as so,U as kn,Ua as mr,Ub as lo,V as Cn,Va as gr,Vb as co,W as Mn,Wa as hr,Wb as uo,X as En,Xa as ve,Xb as fo,Y as Pn,Ya as vr,Yb as po,Z as xn,Za as br,Zb as mo,_ as Ln,_a as yr,_b as go,a as qt,aa as Tn,ab as wr,ac as vo,b as Vt,ba as Rn,bb as kr,bc as bo,c as Wt,ca as Dn,cb as Ue,cc as yo,d as zt,da as An,db as Cr,dc as So,e as Gt,ea as Bn,eb as Mr,ec as wo,f as Kt,fa as jn,fb as Er,fc as ko,g as Yt,ga as Un,gb as Pr,gc as Co,h as Qt,ha as _n,hb as xr,hc as Mo,i as Jt,ia as Nn,ib as Lr,ic as Eo,j as $t,ja as On,jb as Ir,jc as Po,k as Xt,ka as Hn,kb as Tr,kc as oe,la as Fn,lb as be,lc as ae,ma as tt,mb as Rr,mc as xo,na as qn,nb as _e,nc as Lo,oa as Vn,ob as Dr,oc as Io,pa as re,pb as Ar,pc as To,qa as Wn,qb as Br,qc as Ro,r as et,ra as zn,rb as jr,rc as Do,sa as Gn,sb as Ur,sc as Ao,t as Zt,ta as Kn,tb as _r,tc as Bo,ua as Yn,ub as Nr,uc as jo,v as en,va as Qn,vb as Or,w as nn,wa as Jn,wb as Hr,wc as Ne,x as rn,xa as $n,xb as Fr,y as on,ya as Xn,yb as qr,yc as at,za as Zn,zb as Vr,zc as Uo}from"./chunk-WKO3T75E.js";import{A as Ht,D as Ft,E as D,F as Q,Q as tn,c as F,d as _t,e as Nt,i as Ot,z as Ze}from"./chunk-NPKRTUNG.js";import{a as Ut,b as a,c as w}from"./chunk-DGOFGEUK.js";var ye=[];function it(){var e=a.snap(),t=e.paneDeferredBootstrap;!t||t.scheduled||!t.jobs.length||!e.connected||!e.paneReady||e.paneSuspended||(a.set({paneDeferredBootstrap:Object.assign({},t,{scheduled:!0})}),setTimeout(function(){var n=a.snap(),r=n.paneDeferredBootstrap;if(r){var o=r.jobs.slice(),i=n.connected&&n.paneReady&&!n.paneSuspended?o.shift():null;a.set({paneDeferredBootstrap:Object.assign({},r,{scheduled:!1,jobs:o})});try{if(i!==null&&ye[i]){var s=ye[i];ye[i]=null,s()}}finally{it()}}},0))}function Oe(e){if(!a.get("paneMode")){e.forEach(function(n){n()});return}var t=a.get("paneDeferredBootstrap");t||(t={jobs:[],scheduled:!1},a.subscribe(function(n,r){(n.paneReady!==r.paneReady||n.connected!==r.connected||n.paneSuspended!==r.paneSuspended)&&it()})),a.set({paneDeferredBootstrap:Object.assign({},t,{jobs:t.jobs.concat(e.map(function(n){var r=ye.length;return ye.push(n),r}))})}),it()}function qo(){Ft(),Ot(),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=Nt(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||!Ze(e,t)||!Ht(e,t)||(t.type==="clay-pane-present-markdown"?(_t(e,t,Ze(e,t)),Oo(t.message)):nn(t.message))})}var di="(max-width: 768px)",ci=["sticky-notes-toggle-btn","shared-browser-toggle-btn","terminal-toggle-btn"],ui=["shared-browser-toggle-btn","terminal-toggle-btn","sticky-notes-toggle-btn"];function Vo(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 o=e?ci:ui,i=0;i<o.length;i++){var s=document.getElementById(o[i]);s&&(e?t.appendChild(s):n.insertBefore(s,r))}}var fi=150,ie=24,Se=12,Wo=null;function zo(e,t,n){return Math.round(e.offsetWidth)+"|"+Math.round(t.offsetWidth)+"|"+Math.round(n.offsetWidth)}function Go(e){var t=document.getElementById("top-bar"),n=t&&t.querySelector(".top-bar-left-pills"),r=t&&t.querySelector(".top-bar-actions"),o=document.getElementById("cmd-palette-btn");if(!(!t||!n||!r||!o)&&t.offsetWidth&&!(!e&&Wo===zo(t,n,r))&&getComputedStyle(o).display!=="none"){for(var i=[[],["usage-compact"],["usage-compact","usage-compact-link"]],s=null,l=0;l<i.length&&!s;l++){t.classList.remove("usage-compact","usage-compact-link","search-icon"),i[l].forEach(function(P){t.classList.add(P)}),t.style.removeProperty("--top-bar-search-width"),t.style.removeProperty("--top-bar-search-left");var u=t.getBoundingClientRect().width,d=u/2,c=t.getBoundingClientRect().left,p=n.getBoundingClientRect().right-c,g=r.getBoundingClientRect().left-c,v=Math.min(d-p,g-d)-Se,y=Math.min(520,u*.4);if(2*v>=fi)s={mode:"full",width:Math.min(y,2*v),left:null,level:l};else if(g-p>=ie+2*Se){var M=p+Se+ie/2,E=g-Se-ie/2;s={mode:"icon",width:ie,left:Math.min(Math.max(d,M),E),level:l}}}s||(s={mode:"icon",width:ie,left:Math.max(n.getBoundingClientRect().right-t.getBoundingClientRect().left+Se+ie/2,0),level:i.length-1}),t.classList.toggle("search-icon",s.mode==="icon"),s.mode==="full"?t.style.setProperty("--top-bar-search-width",Math.round(s.width)+"px"):t.style.setProperty("--top-bar-search-left",Math.round(s.left)+"px"),Wo=zo(t,n,r)}}function pi(){var e=document.getElementById("top-bar");if(!(!e||typeof ResizeObserver>"u")){var t=!1,n=function(o){t||(t=!0,requestAnimationFrame(function(){t=!1,Go(o===!0)}))},r=new ResizeObserver(function(){n(!1)});r.observe(e),[".top-bar-left-pills",".top-bar-actions"].forEach(function(o){var i=e.querySelector(o);i&&r.observe(i)}),new MutationObserver(function(){n(!0)}).observe(e.querySelector(".top-bar-actions"),{childList:!0,subtree:!0,characterData:!0}),Go(!0)}}function mi(){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 Ko(){var e=window.matchMedia(di);Vo(e.matches),e.addEventListener("change",function(){Vo(e.matches)}),mi(),pi()}var Jo={},lt={},x=null,B=null,j=null,$o=0,Xo=[],He={},dt=null;function Yo(e){Jo[e.id]=e}function st(e,t){lt[e]=t}function Zo(e,t){var n=Jo[e];n&&(j=n,$o=0,Xo=[],dt=t||null,gi(),Fe(n.steps[0].id),B.classList.remove("hidden"),x.classList.remove("hidden"),setTimeout(function(){x.focus()},50))}function we(){B&&B.classList.add("hidden"),x&&x.classList.add("hidden");var e=dt;j=null,dt=null,e&&e()}function ea(){vi(),bi()}function gi(){x||(B=document.createElement("div"),B.className="playbook-overlay hidden",B.addEventListener("click",function(e){e.target===B&&we()}),x=document.createElement("div"),x.className="playbook-modal hidden",x.setAttribute("tabindex","-1"),x.addEventListener("keydown",function(e){e.key==="Escape"&&we()}),B.appendChild(x),document.body.appendChild(B))}function Fe(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($o=n,Xo.push(e),t.condition&&t.branches){var o=t.condition(),i=t.branches[o]||t.branches.default;if(i){Fe(i);return}}hi(t)}}}function hi(e){for(var t=j,n=t.steps.filter(function(k){return!k.condition}).length,r=0,o=0,i=0;i<t.steps.length;i++)t.steps[i].condition||(o++,t.steps[i].id===e.id&&(r=o));var s="";s+='<div class="playbook-header">',s+='<div class="playbook-header-left">',s+='<span class="playbook-icon">'+(t.icon||"\u{1F4D6}")+"</span>",s+='<span class="playbook-title">'+se(t.title)+"</span>",s+="</div>",s+='<button class="playbook-close" title="Close">&times;</button>',s+="</div>",s+='<div class="playbook-progress">';for(var l=0;l<n;l++){var u="playbook-progress-dot";l+1<r?u+=" done":l+1===r&&(u+=" active"),s+='<span class="'+u+'"></span>'}s+="</div>",s+='<div class="playbook-body">',s+='<h2 class="playbook-step-title">'+se(e.title)+"</h2>";var d=typeof e.body=="function"?e.body():e.body||"";if(s+='<div class="playbook-step-body">'+d+"</div>",e.note&&(s+='<div class="playbook-step-note">'+se(e.note)+"</div>"),s+="</div>",e.actions&&e.actions.length>0){s+='<div class="playbook-actions">';for(var c=0;c<e.actions.length;c++){var p=e.actions[c],g="playbook-btn";c===0?g+=" playbook-btn-primary":g+=" playbook-btn-secondary",s+='<button class="'+g+'" data-action="'+(p.action||"")+'" data-next="'+(p.next||"")+'">'+se(p.label)+"</button>"}s+="</div>"}x.innerHTML=s,D();var v=x.querySelector(".playbook-close");v&&v.addEventListener("click",we);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&&lt[A]?(k.disabled=!0,k.textContent+="...",lt[A](function(){h?Fe(h):(Qo(j.id),we())})):h?Fe(h):(Qo(j.id),we())})})(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 Qo(e){He[e]=!0;try{localStorage.setItem("clay-playbooks-done",JSON.stringify(He))}catch{}}function vi(){try{var e=JSON.parse(localStorage.getItem("clay-playbooks-done")||"{}");He=e||{}}catch{He={}}}function bi(){if(Yo({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 o=location.protocol==="https:"&&location.hostname!=="localhost"&&location.hostname!=="127.0.0.1",i="The browser says permission is granted, but the notification didn't show.<br><br>";return o&&(i+="\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>"),i+="<strong>Also check your OS notification settings:</strong><br>",t?i+="<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>":i+="<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>",i+="<br>After adjusting, come back and try again.",i},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:""}]}]}),st("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()})}),st("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 o=navigator.userAgent||"",i=navigator.platform||"";return i.indexOf("Mac")!==-1||o.indexOf("Mac")!==-1?"mac":i.indexOf("Win")!==-1||o.indexOf("Windows")!==-1?"windows":"linux"},n=function(){var o=t(),i="The certificate has been downloaded as <strong>clay-ca.pem</strong>.<br><br>";return o==="mac"?(i+="<strong>macOS \u2014 run in Terminal:</strong><br>",i+=r("sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/Downloads/clay-ca.pem")):o==="windows"?(i+="<strong>Windows \u2014 run in PowerShell (Admin):</strong><br>",i+=r('certutil -addstore -f "Root" %USERPROFILE%\\Downloads\\clay-ca.pem')):(i+="<strong>Linux \u2014 run in terminal:</strong><br>",i+=r("sudo cp ~/Downloads/clay-ca.pem /usr/local/share/ca-certificates/clay-ca.crt && sudo update-ca-certificates")),i+='<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>',i+="<br>Then <strong>restart your browser</strong> to apply the change.",i},r=function(o){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">'+se(o)+'</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="'+se(o)+'">Copy</button></div>'};Yo({id:"trust-certificate",title:"Trust Certificate",icon:"\u{1F512}",description:"Getting certificate warnings? Fix them here",tipMatch:function(o){return o.indexOf("certificate")!==-1||o.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:""}]}]}),st("cert_download",function(o){var i=document.createElement("a");i.href="/ca/download",i.download="clay-ca.pem",document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(o,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 se(e){var t=document.createElement("div");return t.textContent=e||"",t.innerHTML}function ta(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"),o=null,i=0,s=[],l=window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;function u(d){o=null;var c=a.get("speechActive");if(!(!c||c.id!==e||!t.isConnected||!r)&&(o=requestAnimationFrame(u),!(d-i<(l?100:32)))){i=d;var p=t.clientWidth,g=t.clientHeight,v=Math.min(window.devicePixelRatio||1,2);(n.width!==Math.round(p*v)||n.height!==Math.round(g*v))&&(n.width=Math.round(p*v),n.height=Math.round(g*v)),r.setTransform(v,0,0,v,0,0),r.clearRect(0,0,p,g);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=c.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 N=P.length-b+S/(h-1)*(b-1)+R,O=Math.floor(N),Re=N-O,Z=P[O]||0,De=P[Math.min(O+1,P.length-1)]||0,ee=(Z+(De-Z)*Re)*A,H=s[S]||0,te=l?ee:H+(ee-H)*(ee>H?.5:.24);s[S]=te;for(var Y=1+te*(g*.46-1),Ae=Math.min(1,(S+1)/8,(h-S)/8),ne=0;ne<=g*.48;ne+=3.2){var Xe=Math.exp(-Math.pow(ne/Y,2)*1.7);if(!(Xe<.035)){var jt=.35+Xe*.65;r.globalAlpha=(.12+Xe*.78)*Ae,r.beginPath(),r.arc((S+.5)*p/h,g/2+ne,jt,0,Math.PI*2),r.fill(),ne&&(r.beginPath(),r.arc((S+.5)*p/h,g/2-ne,jt,0,Math.PI*2),r.fill())}}}r.globalAlpha=1}}return{element:t,update:function(d){t.hidden=!d,d&&o===null&&(o=requestAnimationFrame(u)),!d&&o!==null&&(cancelAnimationFrame(o),o=null,s=[])}}}function na(e,t,n){var r=document.getElementById(e),o=document.getElementById(t),i=document.getElementById(n);if(!r||!o||!i||r.dataset.speechBound)return;var s=document.getElementById(e==="stt-btn"?"input-row":"home-mate-chat-composer")||i,l=document.getElementById(e==="stt-btn"?"input-bottom":"home-mate-chat-composer")||s;r.addEventListener("click",qe),r.dataset.speechBound="true",r.classList.add("stt-button");var u=document.createElement("span");u.className="stt-controls",r.before(u),u.appendChild(r);var d=document.createElement("button");d.type="button",d.id=e+"-picker",d.className="stt-picker-toggle",d.innerHTML=Q("chevron-down"),d.setAttribute("aria-label","Choose voice model"),d.setAttribute("aria-haspopup","dialog"),d.setAttribute("aria-expanded","false"),d.title="Choose voice model",u.appendChild(d),d.addEventListener("click",function(){qe(),je(d)});var c=document.createElement("div");c.className="stt-progress",c.hidden=!0;var p=document.createElement("span");p.id=e+"-status",p.className="stt-status",p.setAttribute("role","status");var g=document.createElement("span");g.className="stt-timer",g.setAttribute("aria-hidden","true");var v=document.createElement("button");v.type="button",v.innerHTML=Q("x"),v.className="stt-cancel",v.title="Cancel voice input",v.setAttribute("aria-label","Cancel voice input"),v.addEventListener("click",function(){re(),a.set({speechRetry:null})});var y=ta(e),M=document.createElement("button");M.type="button",M.textContent="Retry",M.addEventListener("click",Yn);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(){Vn(e,"")}),c.append(v,y.element,g,p,M,E,P),s.prepend(c),r.setAttribute("aria-describedby",p.id),r.addEventListener("click",function(){var h=a.get("speechActive");if(h&&h.id===e){h.model&&h.phase==="recording"?Kn():re();return}var b=rt(),R=a.get("speechSettings");if(b.provider==="browser"&&!tt().available){je(d);return}if(b.provider!=="browser"&&(!R||R.configured.indexOf(b.provider)<0)){je(d);return}b.provider==="browser"?Wn(e,o):Gn(e,o,b)}),o.addEventListener("beforeinput",function(){var h=a.get("speechActive");h&&h.id===e&&re("Voice input stopped so you can edit your draft."),a.set({speechRetry:null})}),o.addEventListener("input",function(){var h=a.get("speechActive");h&&h.id===e&&!h.writing&&re()});function k(){var h=a.get("speechActive"),b=!!h&&h.id===e,R=rt(),S=sr(R.provider),N=R.provider==="browser"?a.get("speechBrowserIdentity"):null,O=b&&h.model&&h.phase!=="recording",Re=b&&!!h.autoSend;s.classList.toggle("stt-recording",b),c.classList.toggle("stt-auto-send",Re),c.classList.toggle("stt-progress-active",b),c.classList.toggle("stt-progress-pending",!!O);var Z=b?l:s;(c.parentElement!==Z||c!==Z.firstElementChild)&&Z.prepend(c),y.update(b?h:null),d.hidden=b,r.disabled=o.disabled||o.readOnly||!a.get("speechSettings"),d.disabled=o.disabled||o.readOnly||b,r.classList.toggle("stt-active",b),r.setAttribute("aria-pressed",String(b));var De=b?Re?"Cancel pending voice send":O?"Cancel voice input":R.mode==="recorded"?"Stop and transcribe":"Stop voice input":"Start voice input";r.setAttribute("aria-label",De+" \xB7 "+(S?S.name+" \xB7 ":"")+R.name),r.title=De+" \xB7 "+R.name;var ee=[b,O,S&&S.id,N&&N.id].join(":");if(r.dataset.speechIcon!==ee){if(r.dataset.speechIcon=ee,r.innerHTML=Q(b?O?"x":"square":"mic"),!b&&(S||N&&N.icon)){var H=document.createElement("img");H.className="stt-vendor-badge",H.src=S?S.icon:N.icon,H.alt="",r.appendChild(H)}D()}var te=(a.get("speechStatuses")||{})[e]||"",Y=(a.get("speechErrors")||{})[e];c.classList.toggle("stt-progress-error",!!Y),p.setAttribute("role",Y?"alert":"status"),P.hidden=!Y,E.hidden=!Y||!S,S&&(E.href=S.url),R.provider==="browser"&&!qn()&&(te="Browser voice input is unavailable. Choose a connected speech provider or type your message."),window.isSecureContext||(te="Voice input requires a secure HTTPS connection."),p.textContent=te,g.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 Ae=a.get("speechRetry");M.hidden=!Ae||Ae.id!==e,c.hidden=!b&&!Y&&M.hidden}a.subscribe(k);var A=new MutationObserver(k);A.observe(o,{attributes:!0,attributeFilter:["disabled","readonly"]}),k()}function qe(){a.set({speechBrowserIdentity:tt()})}function ra(){qe(),window.addEventListener("focus",qe),zn(),lr(),na("stt-btn","input","input-wrapper"),na("home-stt-btn","home-mate-chat-input","home-mate-chat-composer-frame"),Be(),window.addEventListener("focus",Be);try{window.top.document.addEventListener("clay:speech-settings-saved",Be)}catch{}}var m=null,T=null,ke=null;function Ce(){return document.body.dataset.myDisplayName||"Clay user"}function de(e){if(m){var t=m.querySelector("#account-ai-section");t&&cr(t),m.remove(),m=null,T.setAttribute("aria-expanded","false"),T.setAttribute("aria-label","Open account menu for "+Ce()),document.removeEventListener("pointerdown",oa),document.removeEventListener("focusin",aa),document.removeEventListener("keydown",ia),window.removeEventListener("resize",le),a.set({defaultAiInlineEditing:!1}),e&&ke&&document.contains(ke)&&ke.focus({preventScroll:!0}),ke=null}}function ft(e){return e&&e.closest&&e.closest(".avatar-positioner-overlay")}function oa(e){!m||m.contains(e.target)||T.contains(e.target)||ft(e.target)||de(!1)}function aa(e){!m||m.contains(e.target)||T.contains(e.target)||ft(e.target)||de(!1)}function ia(e){e.key==="Escape"&&(ft(e.target)||document.querySelector(".avatar-positioner-overlay")||(e.preventDefault(),e.stopPropagation(),de(!0)))}function le(){if(!(!m||!T)){var e=T.getBoundingClientRect(),t=Math.min(280,window.innerWidth-24),n=Math.max(12,Math.min(window.innerWidth-t-12,e.left));m.style.width=t+"px",m.style.left=n+"px",m.style.top=Math.max(12,e.top-m.offsetHeight-8)+"px"}}function ct(e){var t=m&&m.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=Ce(),t.querySelector("#account-name-edit").addEventListener("click",yi),window.lucide&&window.lucide.createIcons({nodes:[t]}),e&&t.querySelector("#account-name-edit").focus())}function yi(){var e=m&&m.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=a.get("accountNameDraft")===void 0?nt().name||"":a.get("accountNameDraft"),t.addEventListener("input",function(){a.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",Qn({name:t.value.trim()}).then(function(){a.set({accountNameDraft:void 0}),ct(!0)}).catch(function(o){t.disabled=!1,n.textContent=o.message,t.focus()})):r.key==="Escape"&&(r.preventDefault(),a.set({accountNameDraft:void 0}),ct(!0)),r.stopPropagation()}),t.focus(),t.select()}}function Si(){var e=m&&m.querySelector("#account-avatar-editor");e&&(e.hidden=!e.hidden,e.hidden||e.querySelector("#account-avatar-upload").focus(),le())}function wi(){var e=m.querySelector("#account-avatar-edit"),t=m.querySelector("#account-avatar-editor"),n=t.querySelector("#account-avatar-upload"),r=t.querySelector("#account-avatar-file"),o=t.querySelector("#account-avatar-generate");e.addEventListener("click",function(i){i.stopPropagation(),Si()}),t.addEventListener("click",function(i){i.stopPropagation()}),n.addEventListener("click",function(){r.click()}),r.addEventListener("change",function(){var i=r.files&&r.files[0];if(i){var s=new Image,l=URL.createObjectURL(i);s.onload=function(){Xn(s,l,function(u){URL.revokeObjectURL(l),$n(u).then(function(){t.hidden=!0}).catch(function(){t.dataset.error="true"})})},s.src=l}}),o.addEventListener("click",function(){Jn(),t.hidden=!0})}function ki(){m=document.createElement("div"),m.id="account-popover",m.className="account-popover",m.setAttribute("role","dialog"),m.setAttribute("aria-label","Account");var e=nt(),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/*">',m.appendChild(t),m.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"),m.appendChild(r),dr(r),t.querySelector(".account-settings-button").addEventListener("click",Ci),document.body.appendChild(m),ct(),wi(),ut(),window.lucide&&window.lucide.createIcons({nodes:[m]}),le()}function ut(){var e=document.getElementById("cursor-share-toggle");if(e){var t=a.get("cursorSharingHydrated")===!0,n=t&&a.get("cursorSharingEnabled")===!0,r=a.get("cursorSharingPending")!==null&&a.get("cursorSharingPending")!==void 0,o=a.get("connected")!==!1,i=a.get("cursorSharingError"),s=!!i&&!t&&o,l=t&&!n&&!r&&!i&&o;e.hidden=a.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||!o||!t&&!s;var u=r?"waiting":o?i?s?"error; activate to retry":"error":t?n?"on":"off":"unavailable":"offline";e.setAttribute("aria-label","Cursor sharing "+u);var d=r?"Cursor sharing is waiting for confirmation.":o?i?s?"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.";Br(e,d)}}function Ci(e){e.stopPropagation(),de(!0),fr()}function Mi(e){if(e.stopPropagation(),!e.currentTarget.disabled){if(a.get("cursorSharingError")&&a.get("cursorSharingHydrated")!==!0){Ur();return}jr(a.get("cursorSharingEnabled")!==!0)}}function Ei(){var e=m&&m.querySelector("#account-ai-section select");e&&e.focus({preventScroll:!0})}function Pi(){m||sa(),a.set({defaultAiInlineEditing:!0}),Ei()}function sa(){if(m){de(!0);return}ke=document.activeElement,ki(),T.setAttribute("aria-expanded","true"),T.setAttribute("aria-label","Close account menu for "+Ce()),document.addEventListener("pointerdown",oa),document.addEventListener("focusin",aa),document.addEventListener("keydown",ia),window.addEventListener("resize",le)}function la(){if(T=document.getElementById("user-account-trigger"),!!T){T.addEventListener("click",sa),document.addEventListener("clay:open-account-default-ai",Pi);var e=document.getElementById("cursor-share-toggle");e&&e.addEventListener("click",Mi),ut(),T.setAttribute("aria-label","Open account menu for "+Ce()),a.subscribe(function(t,n){t.myUserId!==n.myUserId&&t.accountNameDraft!==void 0&&a.set({accountNameDraft:void 0}),(t.myUserId!==n.myUserId||t.connected===!1&&n.connected!==!1)&&de(!1),ut(),m&&le()}),document.addEventListener("clay:profile-updated",function(){if(m){var t=m.querySelector(".account-name-display span");t&&(t.textContent=Ce());var n=m.querySelector("#account-avatar-edit img");n&&(n.src=document.body.dataset.myAvatarUrl||n.src)}}),window.addEventListener("resize",le)}}var xi=[{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"}],Li=[{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"}],ue={session:{tools:xi,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:Li,activeContainerId:"mate-sidebar-tools",hiddenSectionId:"mate-sidebar-tools-hidden"}},Ii={"skills-btn":"mcp-btn"},Ti={"mate-skills-btn":"mate-mcp-btn","mate-debate-btn":"mate-debates-btn"},da=["git-sidebar-btn","loop-tool-btn","debates-btn"];function ce(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}function fa(e,t){var n=t&&t.order||[],r=t&&t.hidden||[],o={order:n.slice(),hidden:r.slice(),migrated:!1};if(e!=="session"&&e!=="mate")return o;for(var i=e==="mate"?Ti:Ii,s=Object.keys(i),l=0;l<s.length;l++){var u=s[l],d=i[u],c=ce(o.order,u)!==-1,p=ce(o.hidden,u)!==-1;if(!(!c&&!p)){var g=ce(o.order,d)!==-1||ce(o.hidden,d)!==-1;o.order=ua(o.order,u,d,g),o.hidden=ua(o.hidden,u,d,g),o.migrated=!0}}if(e!=="session")return o;for(var v=0;v<da.length;v++){var y=da[v];ce(o.order,y)===-1&&ce(o.hidden,y)===-1||(o.order=ca(o.order,y),o.hidden=ca(o.hidden,y),o.migrated=!0)}return o}function ca(e,t){for(var n=[],r=0;r<e.length;r++)e[r]!==t&&n.push(e[r]);return n}function ua(e,t,n,r){for(var o=[],i={},s=0;s<e.length;s++){var l=e[s];if(l===t){if(r)continue;l=n}i[l]||(i[l]=!0,o.push(l))}return o}var Ve={},W=null,fe=null;function ga(){for(var e in ue)Ri(e);Ai(),D()}function Ri(e){var t=ue[e],n=document.getElementById(t.activeContainerId);if(n){(t.fixedTools||[]).forEach(function(o){n.appendChild(pa(o,e))});for(var r=0;r<t.tools.length;r++)n.appendChild(pa(t.tools[r],e));n.addEventListener("dragover",function(o){if(!(fe!==e||!W)){o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect="move");var i=Di(n,o.clientX,o.clientY);i==null?(W.parentNode!==n||W.nextSibling)&&n.appendChild(W):i!==W&&n.insertBefore(W,i)}}),n.addEventListener("drop",function(o){fe===e&&o.preventDefault()})}}function pa(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 o=document.createElement("span");if(o.className="tool-btn-label",o.textContent=e.label,n.appendChild(o),e.countId){var i=document.createElement("span");i.id=e.countId,i.className="sidebar-badge hidden",e.id==="you-button"&&(i.className="sidebar-badge me-unread-badge",i.hidden=!0),n.appendChild(i)}return n.addEventListener("dragstart",function(s){if(e.fixed){s.preventDefault();return}var l=n.parentNode;if(!l||l.id!==ue[t].activeContainerId){s.preventDefault();return}W=n,fe=t,s.dataTransfer.effectAllowed="move";try{s.dataTransfer.setData("text/plain",e.id)}catch{}n.classList.add("dragging")}),n.addEventListener("dragend",function(){n.classList.remove("dragging"),fe&&Bi(fe),W=null,fe=null}),n}function Di(e,t,n){for(var r=Array.prototype.slice.call(e.querySelectorAll("[data-tool-id]:not(.dragging)")),o=null,i=Number.POSITIVE_INFINITY,s=0;s<r.length;s++)if(r[s].dataset.fixed!=="true"){var l=r[s].getBoundingClientRect(),u=n-(l.top+l.height/2),d=t-(l.left+l.width/2),c=Math.abs(u)*2+Math.abs(d),p=u<-l.height/2||Math.abs(u)<=l.height/2&&d<0;p&&c<i&&(i=c,o=r[s])}return o}function Ai(){fetch("/api/user/tool-palettes",{credentials:"same-origin"}).then(function(e){return e.ok?e.json():null}).then(function(e){e&&(ma("session",e.session||null),ma("mate",e.mate||null))}).catch(function(){})}function ma(e,t){if(!t)return;var n=ue[e];if(!n)return;var r=document.getElementById(n.activeContainerId);if(!r)return;var o=fa(e,t),i={};function s(v){if(!i[v]){var y=document.getElementById(v);!y||y.dataset.fixed==="true"||(r.appendChild(y),i[v]=!0)}}for(var l={},u=0;u<o.hidden.length;u++)l[o.hidden[u]]=!0;for(var d=0;d<o.order.length;d++)l[o.order[d]]||s(o.order[d]);for(var c=0;c<n.tools.length;c++)l[n.tools[c].id]||s(n.tools[c].id);for(var p=0;p<o.hidden.length;p++)s(o.hidden[p]);for(var g=0;g<n.tools.length;g++)s(n.tools[g].id)}function Bi(e){Ve[e]&&clearTimeout(Ve[e]),Ve[e]=setTimeout(function(){Ve[e]=null,ji(e)},250)}function ji(e){var t=ue[e];if(t){var n=document.getElementById(t.activeContainerId);if(n){for(var r=[],o=n.querySelectorAll("[data-tool-id]"),i=0;i<o.length;i++)o[i].dataset.fixed!=="true"&&r.push(o[i].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 Me=[],pt=[],L=null,J=null,mt=null,U=!1,Ee="project",z=0,C=[];function ha(e){e!=="project"&&e!=="mate"||(U&&G(!1),gt(e))}function ya(){Ui(),J=L.querySelector(".cmd-palette-results"),mt=L.querySelector(".project-switcher-header");var e=a.get("currentSlug");e&&(Me=[e]);var t=a.get("dmTargetUser");t&&t.isMate&&t.id&&(pt=[t.id]),a.subscribe(function(d,c){d.currentSlug&&d.currentSlug!==c.currentSlug&&(ba(Me,d.currentSlug),Me=Me);var p=va(d.dmTargetUser),g=va(c.dmTargetUser);p&&p!==g&&ba(pt,p)});var n=L.querySelector(".cmd-palette-backdrop");n&&n.addEventListener("click",function(){G(!1)}),document.addEventListener("keydown",_i,!0),document.addEventListener("keyup",Ni,!0),window.addEventListener("blur",function(){U&&G(!1)});var r=/Mac|iPhone|iPod|iPad/i.test(navigator.platform),o=r?"\u2318E":"Ctrl+E",i=r?"\u2318M":"Ctrl+M",s=document.getElementById("icon-strip-hint-project"),l=document.getElementById("icon-strip-hint-mate");s&&(s.textContent=o,s.title="Switch project ("+o+")",s.addEventListener("click",function(){ha("project")})),l&&(l.textContent=i,l.title="Switch mate ("+i+")",l.addEventListener("click",function(){ha("mate")}));function u(){if(l){var d=a.get("cachedMatesList")||[];l.classList.toggle("hidden",d.length===0)}}u(),a.subscribe(function(d,c){(d.cachedMatesList!==c.cachedMatesList||d.projectMateDmsEnabled!==c.projectMateDmsEnabled)&&u()})}function Ui(){if(L=document.getElementById("project-switcher"),!L){var e=/Mac|iPhone|iPod|iPad/i.test(navigator.platform),t=e?"<kbd>\u2318</kbd>":"<kbd>Ctrl</kbd>";L=document.createElement("div"),L.id="project-switcher",L.className="cmd-palette hidden project-switcher",L.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(L)}}function va(e){return e&&e.isMate&&e.id?e.id:null}function ba(e,t){var n=e.indexOf(t);n!==-1&&e.splice(n,1),e.unshift(t)}function _i(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?Ee!==r?gt(r):e.shiftKey?We(-1):We(1):gt(r);return}if(U){if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),G(!1);return}if(e.key==="Enter"){e.preventDefault(),e.stopPropagation(),G(!0);return}if(e.key==="ArrowRight"||e.key==="ArrowDown"){e.preventDefault(),We(1);return}if(e.key==="ArrowLeft"||e.key==="ArrowUp"){e.preventDefault(),We(-1);return}}}}function Ni(e){U&&(e.key==="Meta"||e.key==="Control")&&G(!0)}function gt(e){if(Ee=e,C=Fi(e),C.length===0){U&&G(!1);return}mt&&(mt.textContent=e==="mate"?"Switch mate":"Switch project"),Oi(e),Wi(),z=Hi(),ht(),L.classList.remove("hidden"),U=!0,D(),Ne(J)}function Oi(e){var t=L.querySelector(".proj-next-key"),n=L.querySelector(".proj-prev-key"),r=e==="mate"?"M":"E";t&&(t.textContent=r),n&&(n.textContent=r)}function Hi(){if(C.length===0)return 0;for(var e=Ee==="mate"?pt:Me,t=Sa(),n=0;n<e.length;n++){var r=e[n];if(r!==t){for(var o=0;o<C.length;o++)if(C[o].key===r&&!C[o].disabled)return o}}for(var i=0;i<C.length;i++)if(!C[i].disabled&&C[i].key!==t)return i;for(var s=0;s<C.length;s++)if(!C[s].disabled)return s;return 0}function Sa(){if(Ee==="mate"){var e=ot(a.snap());return e?e.id:null}return a.get("currentSlug")}function Fi(e){return e==="mate"?Vi():qi()}function qi(){var e=(be()||[]).filter(function(t){return!t.isMate});return e.map(function(t){var n=to(t);return{key:t.slug,title:t.title||t.project||t.slug,icon:t.icon||null,fallbackIcon:"folder",isCurrent:t.slug===a.get("currentSlug"),external:n,disabled:!1,disabledReason:null}})}function Vi(){var e=a.get("cachedMatesList")||[],t=ot(a.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:qt(r,88),fallbackIcon:"user",isCurrent:r.id===n,disabled:!1,disabledReason:null}})}function G(e){if(U&&(U=!1,L.classList.add("hidden"),!!e)){var t=C[z];!t||t.disabled||(Ee==="mate"?t.key!==Sa()&&ao(t.key):t.key!==a.get("currentSlug")&&_e(t.key))}}function We(e){if(C.length!==0){for(var t=e>0?1:-1,n=z,r=0;r<C.length;r++)if(n=(n+t+C.length)%C.length,!C[n].disabled){z=n,ht();return}}}function Wi(){if(J){J.innerHTML="";for(var e=0;e<C.length;e++)J.appendChild(zi(C[e],e))}}function zi(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=no(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 o=document.createElement("img");o.src=e.avatarUrl,o.alt="",o.className="project-switcher-avatar",r.appendChild(o)}else{var i=document.createElement("i");i.setAttribute("data-lucide",e.fallbackIcon||"folder"),r.appendChild(i)}e.external&&ro(r,"project-switcher-external-badge"),n.appendChild(r);var s=document.createElement("div");s.className="cmd-palette-item-body";var l=document.createElement("div");l.className="cmd-palette-item-title-row";var u=document.createElement("span");if(u.className="cmd-palette-item-title",u.textContent=e.title,l.appendChild(u),e.isCurrent){var d=document.createElement("span");d.className="project-switcher-current",d.textContent="current",l.appendChild(d)}if(e.disabled&&e.disabledReason){var c=document.createElement("span");c.className="project-switcher-disabled-reason",c.textContent=e.disabledReason,l.appendChild(c)}return s.appendChild(l),n.appendChild(s),n.addEventListener("mouseenter",function(){e.disabled||(z=t,ht())}),n.addEventListener("click",function(){e.disabled||(z=t,G(!0))}),n}function ht(){if(J){for(var e=J.querySelectorAll(".cmd-palette-item"),t=0;t<e.length;t++)e[t].classList.toggle("active",t===z);var n=e[z];n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest"})}}var Gi=/^[a-zA-Z0-9_-]{1,120}$/;function vt(){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 bt(e){var t=Ao();try{e.contentWindow&&e.contentWindow.postMessage({type:"clay-appearance",snapshot:t},window.location.origin)}catch{}}function wa(e){return typeof e=="string"&&Gi.test(e)}function yt(e){return e===null||wa(e)}function Ki(e){var t=e&&typeof e=="object"?e.preference:null;return!t||typeof t!="object"||!wa(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:yt(t.theme)&&yt(t.lightTheme)&&yt(t.darkTheme)}function ka(){if(a.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"||!Ki(t.snapshot))){var n=a.get("myUserId")||null;n!==null&&t.snapshot.userId!==n||Bo(t.snapshot)}}});return}Do(function(){vt().forEach(bt)}),a.subscribe(function(e,t){e.myUserId!==t.myUserId&&vt().forEach(bt)}),document.addEventListener("load",function(e){e.target&&e.target.tagName==="IFRAME"&&vt().indexOf(e.target)>=0&&bt(e.target)},!0)}var Yi=500,Ca=10,pe=null,St=0,wt=0,Pe=!1,Ma=null;function ze(){pe&&(clearTimeout(pe),pe=null)}function Ea(){"ontouchstart"in window&&(document.addEventListener("touchstart",function(e){if(e.touches.length!==1){ze();return}var t=e.touches[0];St=t.clientX,wt=t.clientY,Pe=!1,Ma=e.target,pe=setTimeout(function(){pe=null,Pe=!0,navigator.vibrate&&navigator.vibrate(30);var n=new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:St,clientY:wt});Ma.dispatchEvent(n)},Yi)},{passive:!0}),document.addEventListener("touchmove",function(e){if(pe){var t=e.touches[0],n=t.clientX-St,r=t.clientY-wt;n*n+r*r>Ca*Ca&&ze()}},{passive:!0}),document.addEventListener("touchend",function(e){ze(),Pe&&(Pe=!1,e.preventDefault())},{passive:!1}),document.addEventListener("touchcancel",function(){ze(),Pe=!1},{passive:!0}))}var Pa=!1,xa=!1;function kt(e){return/^\/p\/[a-z0-9_-]+(?:\/|$)/.test(e||"")}function Qi(e){return e?e.paneMode||kt(e.pathname)||e.currentSlug?"project":e.projectsLoaded!==!0?"wait":"projects":"wait"}function La(){document.body.classList.remove("home-surface-boot-pending");var e=document.getElementById("connect-overlay");e&&a.get("connected")&&e.classList.add("hidden")}function Ji(e){return e?"/p/"+e+"/":null}function Ia(e){if(!xa){var t=Qi({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(xa=!0,t==="project"){if(!kt(location.pathname)){var n=Ji(e.currentSlug);n&&history.replaceState(null,"",n)}a.set({homeSurfaceBootResolved:!0}),La();var r=document.getElementById("input");r&&!r.disabled&&r.focus({preventScroll:!0});return}a.set({homeSurfaceBootResolved:!0,projectsHubRestoreRequested:!0}),La()}}}function Ta(){if(!Pa){if(Pa=!0,!kt(location.pathname)&&!a.get("paneMode")){document.body.classList.add("home-surface-boot-pending");var e=document.getElementById("connect-overlay-msg");e&&(e.textContent="Restoring your workspace\u2026")}a.subscribe(function(t){Ia(t)}),Ia(a.snap())}}var $i=3600*1e3,Xi="(max-width: 768px)",Ct=null,Mt=!1;function Zi(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 Da(){var e=a.get("githubStarCount"),t=document.getElementById("github-star-count"),n=document.getElementById("github-star-link");if(!(!t||!n)){var r=typeof e=="number"?Zi(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 es(){return!!(window.matchMedia&&window.matchMedia(Xi).matches)}function Ra(){return Mt||es()?Promise.resolve():(Mt=!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"&&(a.set({githubStarCount:e.stars}),Da())}).catch(function(){}).then(function(){Mt=!1}))}function Aa(){document.getElementById("github-star")&&(Da(),Ra(),Ct&&clearInterval(Ct),Ct=setInterval(Ra,$i))}var _=!1,Ge=null,Ba={shell:"terminal",agent:"sparkles",other:"circle-dot"};function _a(){a.subscribe(function(e,t){e.activeBackgroundTasks!==t.activeBackgroundTasks&&Et()}),Et()}function Na(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 o=Math.floor(r/60),i=r%60;if(o<60)return o+"m "+ja(i)+"s";var s=Math.floor(o/60);return s+"h "+ja(o%60)+"m"}function ja(e){return e<10?"0"+e:String(e)}function Ke(){Ge&&(clearInterval(Ge),Ge=null)}function ts(){Ke(),Ge=setInterval(ns,1e3)}function ns(){var e=document.getElementById("background-tasks-bar");if(!e||!_){Ke();return}for(var t=Date.now(),n=e.querySelectorAll(".background-task-elapsed"),r=0;r<n.length;r++){var o=Number(n[r].dataset.startedAt);n[r].textContent=Na(o,t)}}function rs(){return'<span class="background-tasks-activity" aria-hidden="true"><i></i><i></i><i></i></span>'}function Oa(e){return!!(e&&e.ambient===!0)}function os(e){for(var t=[],n=[],r=Array.isArray(e)?e:[],o=0;o<r.length;o++)r[o]&&(Oa(r[o])?n.push(r[o]):t.push(r[o]));return{user:t,ambient:n}}function Ua(e,t){var n=e.task_type||"other",r=Ba[n]||Ba.other,o=e.description||"Background task",i=typeof e.started_at=="number"?e.started_at:0,s=Na(i,t);return'<div class="background-task-row'+(Oa(e)?" ambient":"")+'"><span class="background-task-icon" title="'+F(n)+'">'+Q(r)+'</span><span class="background-task-description" title="'+F(o)+'">'+F(o)+'</span><span class="background-task-meta"><span class="background-task-type">'+F(n)+'</span><span class="background-task-elapsed" data-started-at="'+i+'">'+F(s)+'</span></span><button type="button" class="background-task-stop" data-task-id="'+F(e.task_id||"")+'" aria-label="Stop '+F(o)+'">Stop</button></div>'}function Et(){var e=a.get("activeBackgroundTasks")||[],t=os(e),n=document.getElementById("background-tasks-bar");if(t.user.length===0){n&&n.remove(),_=!1,Ke();return}var r=document.getElementById("input-area");if(!(!r||!r.parentNode)){var o=n||document.createElement("div");o.id="background-tasks-bar",o.className="background-tasks-bar"+(_?" expanded":"");var i=t.user.length===1?"background task":"background tasks",s=t.user.length+" "+i,l='<button type="button" class="background-tasks-toggle" aria-expanded="'+_+'" aria-controls="background-tasks-list" aria-label="'+s+", "+(_?"collapse":"expand")+' details">'+rs()+'<span class="background-tasks-summary">'+s+'</span><span class="background-tasks-chevron" aria-hidden="true">'+Q("chevron-right")+"</span></button>";if(_){var u=Date.now();l+='<div class="background-tasks-list" id="background-tasks-list">';for(var d=0;d<t.user.length;d++)l+=Ua(t.user[d],u);if(t.ambient.length>0){l+='<div class="background-tasks-section-label">Housekeeping</div>';for(var c=0;c<t.ambient.length;c++)l+=Ua(t.ambient[c],u)}l+="</div>"}o.innerHTML=l,n||r.parentNode.insertBefore(o,r),D(),o.querySelector(".background-tasks-toggle").addEventListener("click",function(){_=!_,Et()});for(var p=o.querySelectorAll(".background-task-stop"),g=0;g<p.length;g++)p[g].addEventListener("click",function(){var v=w();v&&v.readyState===1&&v.send(JSON.stringify({type:"stop_task",taskId:this.dataset.taskId}))});_?ts():Ke()}}var Tt=new URLSearchParams(location.search),ge=Tt.get("pane")==="1";ge&&typeof performance<"u"&&performance.mark&&performance.mark("clay:app-evaluated");var X=Number(Tt.get("session"));(!Number.isSafeInteger(X)||X<1)&&(X=null);ge&&document.body.classList.add("pane-mode");var Qe=location.pathname.match(/^\/p\/([a-z0-9_-]+)/),as=document.body.dataset.homeProjectSlug||null,Ie=Qe?Qe[1]:as,K=Ie?"/p/"+Ie+"/":"/",me=Ie?"/p/"+Ie+"/ws":"/ws";ge&&(me+="?pane=1",X&&(me+="&session="+X),Tt.get("contextual")==="1"&&(me+="&contextual=1"));var f=function(e){return document.getElementById(e)},I=f("messages"),$e=f("input"),is=f("send-btn");var Lt=f("header-title"),gh=f("header-rename-btn"),ss=f("slash-menu"),hh=f("suggestion-chips"),ls=f("sidebar"),ds=f("sidebar-overlay"),Qa=f("session-list"),cs=f("new-session-btn"),us=f("hamburger-btn"),fs=f("sidebar-toggle-btn"),ps=f("sidebar-expand-btn"),ms=f("image-preview-bar"),vh=f("connect-overlay");var gs="/claude-code-avatar.png";function Ja(e){Ue(e)}function hs(){return!1}function $a(){var e=document.getElementById("icon-strip-add");e&&e.click()}function Xa(e){Zr(e)}function vs(){eo()}var bh=f("project-list-section"),yh=f("project-list"),Sh=f("project-list-add"),bs=f("project-hint"),Ha=f("project-hint-dismiss"),Je=Ie||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"&&Dt()});Ha&&Ha.addEventListener("click",function(){bs.classList.add("hidden");try{localStorage.setItem("clay-project-hint-dismissed","1")}catch{}});f("mermaid-modal").querySelector(".confirm-backdrop").addEventListener("click",at);f("mermaid-modal").querySelector(".mermaid-modal-btn[title='Close']").addEventListener("click",at);f("image-modal").querySelector(".confirm-backdrop").addEventListener("click",Dt);f("image-modal").querySelector(".image-modal-close").addEventListener("click",Dt);function Rt(e){dn(e)}function Dt(){cn()}var Za="";try{xe=localStorage.getItem("clay-project-name-"+(Je||"default")),xe&&(Za=xe,Lt&&(Lt.textContent=xe),Pt=f("title-bar-project-name"),Pt&&(Pt.textContent=xe)),xt=localStorage.getItem("clay-project-icon-"+(Je||"default")),xt&&(Le=f("title-bar-project-icon"),Le&&(Le.textContent=xt,Ne(Le),Le.classList.add("has-icon")))}catch{}var xe,Pt,xt,Le;function ei(e,t,n,r){un(e,t,n,r)}Ut({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:K,wsPath:me,paneMode:ge,paneSessionId:X,panePinPending:ge&&!!X,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:Za,cwd:"",currentSlug:Je,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:br(),projectStartFolder:yr(),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:[],sessionVendorBound:!1,cliSessionId:null,isHeadlessMode:!1,savedMainSlug:null,connected:!1,fileReadRequest: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}});gr({$:f,get ws(){return w()},get connected(){return a.get("connected")},get processing(){return a.get("processing")},messagesEl:I,addSystemMessage:ii});jo();ka();Ar();Ea();var ys={$:f,get ws(){return w()},get connected(){return a.get("connected")},get projectName(){return a.get("projectName")},messagesEl:I,sessionListEl:Qa,sidebar:ls,sidebarOverlay:ds,sidebarToggleBtn:fs,sidebarExpandBtn:ps,hamburgerBtn:us,newSessionBtn:cs,headerTitleEl:Lt,showConfirm:ei,onFilesTabOpen:function(){No(),Ho(),V()&&q()},requestKnowledgeList:function(){Hn()},switchProject:function(e){si(e)},openTerminal:function(){Ro()},showHomeHub:function(){Ja()},getUpcomingSchedules:hn,get multiUser(){return a.get("isMultiUserMode")},get myUserId(){return a.get("myUserId")},get projectOwnerId(){return a.get("currentProjectOwnerId")},get ownerLocked(){return a.get("ownerLocked")},openDm:function(e){Xa(e)},openMateWizard:function(){$a()},openAddProjectModal:function(){Sr()},sendWs:function(e){var t=w();t&&t.readyState===1&&t.send(JSON.stringify(e))},onDmRemoveUser:function(e){var t=Object.assign({},a.get("dmRemovedUsers"));t[e]=!0,a.set({dmRemovedUsers:t})},getHistoryFrom:function(){return a.get("historyFrom")},get permissions(){return a.get("permissions")},get projectList(){return be()||[]},availableBuiltins:function(){return a.get("cachedAvailableBuiltins")||[]}};ga();Oe([pr,Bn,jn,Zt,Un,en,vr,Yr]);Io(ys);var At=function(){return w()};Fn(At);Nn(At);Oe([tr]);_n(At,{onShow:function(){On(),Co()}});so({switchProject:function(e){si(e)},currentSlug:function(){return a.get("currentSlug")},matesList:function(){return a.get("cachedMatesList")||[]},availableBuiltins:function(){return a.get("cachedAvailableBuiltins")||[]},allUsers:function(){return a.get("cachedAllUsers")||[]},dmConversations:function(){return a.get("cachedDmConversations")||[]},myUserId:function(){return a.get("myUserId")},selectSession:function(e){V()&&q();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){Xa(e)},runAction:function(e){switch(e){case"createMate":$a();break;case"openSettings":vn();break;case"showHome":Ja();break}}});ya();nr();Xt();function Ss(e){Cn(e)}function ws(){Mn()}function ks(e){En(e)}function Cs(){go()}function Ms(){ho()}function ti(){Ln()}function ni(){In()}function Es(){Tn()}function Ps(){Rn()}function Bt(e){Kt(e)}var $=f("new-msg-btn"),Fa="\u2193 Latest";function It(){var e=f("input-area");e&&($.style.bottom=e.offsetHeight+12+"px")}var qa=f("input-area");qa&&window.ResizeObserver?new ResizeObserver(It).observe(qa):window.addEventListener("resize",It);It();I.addEventListener("scroll",function(){if(!Vt()){var e=I.scrollHeight-I.scrollTop-I.clientHeight,t=e>150;Gt(t),t?($.classList.contains("hidden")&&($.textContent=Fa),$.classList.remove("hidden")):($.classList.add("hidden"),$.textContent=Fa)}});$.addEventListener("click",function(){ri()});document.addEventListener("visibilitychange",function(){document.hidden||Te()});I.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;ei("Fork session from this message?",function(){var o=w();o&&o.readyState===1&&o.send(JSON.stringify({type:"fork_session",uuid:r}))},"Fork",!1)}}});function Te(){Yt()}function ri(){Qt()}ln();kn();Pr();rr();qr();Nr();_a();Qr();Hr();Fr();zr();lo();xn();Dn();Wt();rn({$:f,get ws(){return w()},get connected(){return a.get("connected")},get turnCounter(){return zt()},messagesEl:I,inputEl:$e,finalizeAssistantBlock:function(){xs()},addToMessages:function(e){Bt(e)},scrollToBottom:function(){Te()},setActivity:function(e){ks(e)},stopUrgentBlink:function(){ws()},showImageModal:Rt,getContextPercent:function(){var e=Pn();return e.contextWindow>0?Math.round(e.input/e.contextWindow*100):0},isMateDm:function(){return a.get("dmMode")&&a.get("dmTargetUser")&&a.get("dmTargetUser").isMate},getMateName:function(){return a.get("dmTargetUser")&&a.get("dmTargetUser").displayName||"Mate"},getMateAvatarUrl:function(){return document.body.dataset.mateAvatarUrl||""},getClaudeAvatar:function(){return gs},getMateById:function(e){var t=a.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 oi(e,t,n,r,o){uo(e,t,n,r,o)}function ai(e,t){po(e,t)}function xs(){mo()}function ii(e,t){fo(e,t)}function Ls(){bo()}function Is(){Rr()}function si(e){_e(e)}window.addEventListener("popstate",function(){if(/^\/projects\/?$/.test(location.pathname)){Ue(!0);return}Cr();var e=location.pathname.match(/^\/p\/([a-z0-9_-]+)/),t=e?e[1]:null;if(!t){Ue(!0);return}er("project",t),hs()&&void 0,t&&t!==a.get("currentSlug")&&(_o(),oe(),V()&&q(),mn(t),a.set({currentSlug:t}),K="/p/"+t+"/",me="/p/"+t+"/ws",a.set({basePath:K,wsPath:me}),Is(),li())});function li(){$r()}co({get ws(){return w()},get connected(){return a.get("connected")},get processing(){return a.get("processing")},get basePath(){return K},inputEl:$e,sendBtn:is,slashMenu:ss,messagesEl:I,imagePreviewBar:ms,slashCommands:function(){return a.get("slashCommands")},messageUuidMap:function(){return a.get("messageUuidMap")},addUserMessage:oi,addSystemMessage:ii,toggleUsagePanel:ti,toggleStatusPanel:ni,toggleContextPanel:Ps,resetContextData:Es,showImageModal:Rt,hideSuggestionChips:Ls,getGhostSuggestion:function(){return vo()},setSendBtnMode:Ss,isDmMode:function(){return a.get("dmMode")&&!(a.get("dmTargetUser")&&a.get("dmTargetUser").isMate)},getDmKey:function(){return a.get("dmKey")},handleDmSend:function(){vs()},isDebateEndedMode:function(){return a.get("debateEndedMode")},handleDebateEndedSend:function(){handleDebateEndedSend()},isDebateConcludeMode:function(){return a.get("debateConcludeMode")},handleDebateConcludeSend:function(){Ds()},isDebateFloorMode:function(){return a.get("debateFloorMode")},handleDebateFloorSend:function(){Bs()},isMateDm:function(){return a.get("dmMode")&&a.get("dmTargetUser")&&a.get("dmTargetUser").isMate},getDmMateId:function(){var e=a.get("dmTargetUser");return a.get("dmMode")&&e&&e.isMate?e.id:null},getMateName:function(){return a.get("dmTargetUser")&&a.get("dmTargetUser").displayName||"Mate"},getMateAvatarUrl:function(){return document.body.dataset.mateAvatarUrl||""},showMatePreThinking:function(){Ms()},showClaudePreThinking:function(){Cs()},myUserId:function(){return a.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"}});hr();Gr({get ws(){return w()},get connected(){return a.get("connected")},inputEl:$e,messagesEl:I,matesList:function(){return a.get("cachedMatesList")||[]},availableBuiltins:function(){return a.get("cachedAvailableBuiltins")||[]},allUsers:function(){return a.get("cachedAllUsers")||[]},myUserId:function(){return a.get("myUserId")},scrollToBottom:Te,addUserMessage:oi,addCopyHandler:ai,addToMessages:Bt,showImageModal:Rt,showPasteModal:sn});xr({get ws(){return w()},sendWs:function(e){var t=w();t&&t.readyState===1&&t.send(JSON.stringify(e))},messagesEl:I,addToMessages:function(e){Bt(e)},scrollToBottom:Te,addCopyHandler:ai,matesList:function(){return a.get("cachedMatesList")||[]},availableBuiltins:function(){return a.get("cachedAvailableBuiltins")||[]},currentMateId:function(){return a.get("dmTargetUser")&&a.get("dmTargetUser").isMate?a.get("dmTargetUser").id:a.get("homeChatMateId")||null},requireSkills:Rs,showDebateEndedMode:function(e){As(e)}});ra();Zn({basePath:K});bn();ur({basePath:K});function Ts(){fn()}fetch("/api/me").then(function(e){return e.json()}).then(function(e){if(e.multiUser&&(a.set({isMultiUserMode:!0}),document.body&&document.body.classList.add("is-multi-user")),e.user&&e.user.id&&(a.set({myUserId:e.user.id}),yn()),a.set({authIdentityLoaded:!0}),a.set({permissions:e.permissions||null,projectsAccessLoaded:!0}),e.mustChangePin&&Ts(),!a.get("isMultiUserMode")){var t=document.getElementById("icon-strip-users");t&&(t.innerHTML="",t.classList.add("hidden"))}la();var n=a.get("permissions");if(n){if(!n.terminal){var r=document.getElementById("terminal-toggle-btn");r&&(r.style.display="none");var o=document.getElementById("terminal-sidebar-btn");o&&(o.style.display="none");var i=document.getElementById("shell-command-btn");i&&(i.style.display="none");var s=document.getElementById("input-more-shell");s&&(s.style.display="none")}if(!n.fileBrowser){var l=document.getElementById("file-browser-btn");l&&(l.style.display="none");var u=document.getElementById("git-placard");u&&(u.style.display="none")}if(!n.skills){var d=document.getElementById("skills-btn");d&&(d.style.display="none");var c=document.getElementById("mate-skills-btn");c&&(c.style.display="none")}if(!n.scheduledTasks){var p=document.getElementById("scheduler-btn");p&&(p.style.display="none")}if(!n.createProject){var g=document.getElementById("icon-strip-add");g&&(g.style.display="none")}}}).catch(function(){});ar().then(function(e){if(a.get("isMultiUserMode")&&!e){var t=document.getElementById("update-pill-wrap");t&&(t.style.display="none")}});or({$:f,get ws(){return w()},get connected(){return a.get("connected")},messagesEl:I,sessionListEl:Qa,scrollToBottom:Te,forceScrollToBottom:ri,basePath:K,toggleUsagePanel:ti,toggleStatusPanel:ni});ir();Sn(oo());wn();Uo({get ws(){return w()},get connected(){return a.get("connected")},get activeSessionId(){return a.get("activeSessionId")},get cwd(){return a.get("cwd")},messagesEl:I,fileTreeEl:f("file-tree"),fileViewerEl:f("file-viewer")});Oe([Lo,Ko,tn]);qo();Or();An();To({get ws(){return w()},get connected(){return a.get("connected")},terminalContainerEl:f("terminal-container"),terminalBodyEl:f("terminal-body"),fileViewerEl:f("file-viewer")});on({get ws(){return w()},get connected(){return a.get("connected")}});ea();(function(){var e=new URLSearchParams(window.location.search),t=e.get("playbook");if(t){setTimeout(function(){Zo(t)},300),e.delete("playbook");var n=e.toString(),r=window.location.pathname+(n?"?"+n:"")+window.location.hash;window.history.replaceState(null,"",r)}})();Jt({messagesEl:I,get ws(){return w()},getHistoryFrom:function(){return a.get("historyFrom")}});var Va=f("find-in-session-btn");Va&&Va.addEventListener("click",function(){$t()});wo();xo();yo(function(){ae()&&Eo()});var Wa=f("sticky-notes-sidebar-btn");Wa&&Wa.addEventListener("click",function(){he(),ve(),V()&&q(),ae()&&oe(),ko(),Mo()});var za=document.querySelectorAll("#sticky-notes-toggle-btn");for(Ye=0;Ye<za.length;Ye++)za[Ye].addEventListener("click",function(){So()});var Ye,Ga=f("sticky-notes-sidebar-count");Ga&&Ga.addEventListener("click",function(e){e.stopPropagation(),he(),ve(),V()&&q(),ae()?oe():Po()});var Ka=f("git-placard-more"),Ya=f("terminal-sidebar-btn");Ka&&Ka.addEventListener("click",function(){et(),he(),ve(),ae()&&oe(),V()&&q()});Ya&&Ya.addEventListener("click",function(){et(),he(),ve(),ae()&&oe(),V()&&q()});function Rs(e,t){Vr(e,t)}function Ds(){Lr()}function As(e){Ir(e)}function Bs(){Tr()}an();mr();pn({get ws(){return w()},get connected(){return a.get("connected")},get activeSessionId(){return a.get("activeSessionId")},basePath:K,currentSlug:Je,getProjects:function(){return be()}});_r();Er();Dr();Aa();wr();io();Wr();kr();Kr();Mr();Ta();Xr();Jr();lucide.createIcons();ge&&typeof performance<"u"&&performance.mark&&performance.mark("clay:bootstrap-complete");li();Qe&&location.hash==="#scheduler"?setTimeout(function(){gn("calendar")},500):Qe&&$e.focus();
@@ -0,0 +1 @@
1
+ import{l as a,m as b,n as c,o as d}from"./chunk-WKO3T75E.js";import"./chunk-NPKRTUNG.js";import"./chunk-DGOFGEUK.js";export{a as closeLinear,c as handleLinearResult,d as initLinearPanel,b as openLinear};
@@ -1 +1 @@
1
- import{p as a,q as b,r as c,s as d,t as e,u as f}from"./chunk-IZ2ZANEY.js";import"./chunk-7H36SUZA.js";import"./chunk-DGOFGEUK.js";export{c as closeIssues,f as handleIssuesMessage,e as initIssues,d as openIssues,b as refreshGithubIssue,a as requestIssue};
1
+ import{p as a,q as b,r as c,s as d,t as e,u as f}from"./chunk-WKO3T75E.js";import"./chunk-NPKRTUNG.js";import"./chunk-DGOFGEUK.js";export{c as closeIssues,f as handleIssuesMessage,e as initIssues,d as openIssues,b as refreshGithubIssue,a as requestIssue};
@@ -1 +1 @@
1
- import{K as a,L as b,M as c,N as d,O as e,P as f}from"./chunk-7H36SUZA.js";import"./chunk-DGOFGEUK.js";export{e as handleSharedBrowserMessage,d as hideSharedBrowser,f as initSharedBrowser,c as openSharedBrowser,b as openSharedBrowserAt,a as sendBrowserInput};
1
+ import{L as a,M as b,N as c,O as d,P as e,Q as f}from"./chunk-NPKRTUNG.js";import"./chunk-DGOFGEUK.js";export{e as handleSharedBrowserMessage,d as hideSharedBrowser,f as initSharedBrowser,c as openSharedBrowser,b as openSharedBrowserAt,a as sendBrowserInput};
@@ -0,0 +1 @@
1
+ import{A as b,B as c,z as a}from"./chunk-WKO3T75E.js";import"./chunk-NPKRTUNG.js";import"./chunk-DGOFGEUK.js";export{a as closeLoginBrowser,c as handleLoginBrowserMessage,b as openLoginBrowser};